Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ domain: vitistack.io
layout:
- go.kubebuilder.io/v4
plugins:
helm.kubebuilder.io/v1-alpha: {}
helm.kubebuilder.io/v2-alpha: {}
helm.kubebuilder.io/v2-alpha:
manifests: dist/install.yaml
output: dist
projectName: gatewayapi-securitypolicy-operator
repo: github.com/vitistack/gatewayapi-securitypolicy-operator
version: "3"
25 changes: 25 additions & 0 deletions dist/chart/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Patterns to ignore when building Helm packages.
# Operating system files
.DS_Store

# Version control directories
.git/
.gitignore
.bzr/
.hg/
.hgignore
.svn/

# Backup and temporary files
*.swp
*.tmp
*.bak
*.orig
*~

# IDE and editor-related files
.idea/
.vscode/

# Helm chart artifacts
dist/chart/*.tgz
14 changes: 14 additions & 0 deletions dist/chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v2
name: gatewayapi-securitypolicy-operator
description: A Helm chart to distribute gatewayapi-securitypolicy-operator
type: application

version: 0.1.0
appVersion: "0.1.0"

keywords:
- kubernetes
- operator

annotations:
kubebuilder.io/generated-by: kubebuilder
15 changes: 15 additions & 0 deletions dist/chart/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Thank you for installing {{ .Chart.Name }}.

Your release is named {{ .Release.Name }}.

The controller and CRDs have been installed in namespace {{ .Release.Namespace }}.

To verify the installation:

kubectl get pods -n {{ .Release.Namespace }}
kubectl get customresourcedefinitions

To learn more about the release, try:

$ helm status {{ .Release.Name }} -n {{ .Release.Namespace }}
$ helm get all {{ .Release.Name }} -n {{ .Release.Namespace }}
50 changes: 50 additions & 0 deletions dist/chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "gatewayapi-securitypolicy-operator.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "gatewayapi-securitypolicy-operator.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Namespace for generated references.
Always uses the Helm release namespace.
*/}}
{{- define "gatewayapi-securitypolicy-operator.namespaceName" -}}
{{- .Release.Namespace }}
{{- end }}

{{/*
Resource name with proper truncation for Kubernetes 63-character limit.
Takes a dict with:
- .suffix: Resource name suffix (e.g., "metrics", "webhook")
- .context: Template context (root context with .Values, .Release, etc.)
Dynamically calculates safe truncation to ensure total name length <= 63 chars.
*/}}
{{- define "gatewayapi-securitypolicy-operator.resourceName" -}}
{{- $fullname := include "gatewayapi-securitypolicy-operator.fullname" .context }}
{{- $suffix := .suffix }}
{{- $maxLen := sub 62 (len $suffix) | int }}
{{- if gt (len $fullname) $maxLen }}
{{- printf "%s-%s" (trunc $maxLen $fullname | trimSuffix "-") $suffix | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" $fullname $suffix | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
89 changes: 89 additions & 0 deletions dist/chart/templates/manager/manager.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/name: gatewayapi-securitypolicy-operator
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/instance: {{ .Release.Name }}
control-plane: controller-manager
name: {{ include "gatewayapi-securitypolicy-operator.resourceName" (dict "suffix" "controller-manager" "context" $) }}
namespace: {{ .Release.Namespace }}
spec:
replicas: {{ .Values.manager.replicas }}
selector:
matchLabels:
app.kubernetes.io/name: gatewayapi-securitypolicy-operator
control-plane: controller-manager
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: manager
labels:
app.kubernetes.io/name: gatewayapi-securitypolicy-operator
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
control-plane: controller-manager
spec:
{{- with .Values.manager.tolerations }}
tolerations: {{ toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.manager.affinity }}
affinity: {{ toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.manager.nodeSelector }}
nodeSelector: {{ toYaml . | nindent 10 }}
{{- end }}
containers:
- args:
{{- if .Values.metrics.enable }}
- --metrics-bind-address=:{{ .Values.metrics.port }}
{{- else }}
# Bind to :0 to disable the controller-runtime managed metrics server
- --metrics-bind-address=0
{{- end }}
- --health-probe-bind-address=:8081
{{- range .Values.manager.args }}
- {{ . }}
{{- end }}
command:
- /manager
image: "{{ .Values.manager.image.repository }}:{{ .Values.manager.image.tag }}"
imagePullPolicy: {{ .Values.manager.image.pullPolicy }}
livenessProbe:
httpGet:
path: /healthz
port: 8081
initialDelaySeconds: 15
periodSeconds: 20
name: manager
ports: []
readinessProbe:
httpGet:
path: /readyz
port: 8081
initialDelaySeconds: 5
periodSeconds: 10
resources:
{{- if .Values.manager.resources }}
{{- toYaml .Values.manager.resources | nindent 10 }}
{{- else }}
{}
{{- end }}
securityContext:
{{- if .Values.manager.securityContext }}
{{- toYaml .Values.manager.securityContext | nindent 10 }}
{{- else }}
{}
{{- end }}
volumeMounts: []
securityContext:
{{- if .Values.manager.podSecurityContext }}
{{- toYaml .Values.manager.podSecurityContext | nindent 8 }}
{{- else }}
{}
{{- end }}
serviceAccountName: {{ include "gatewayapi-securitypolicy-operator.resourceName" (dict "suffix" "controller-manager" "context" $) }}
terminationGracePeriodSeconds: 10
volumes: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- if .Values.metrics.enable }}
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/name: gatewayapi-securitypolicy-operator
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/instance: {{ .Release.Name }}
control-plane: controller-manager
name: {{ include "gatewayapi-securitypolicy-operator.resourceName" (dict "suffix" "controller-manager-metrics-service" "context" $) }}
namespace: {{ .Release.Namespace }}
spec:
ports:
- name: https
port: {{ .Values.metrics.port }}
protocol: TCP
targetPort: {{ .Values.metrics.port }}
selector:
app.kubernetes.io/name: gatewayapi-securitypolicy-operator
control-plane: controller-manager
{{- end }}
43 changes: 43 additions & 0 deletions dist/chart/templates/monitoring/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{- if .Values.prometheus.enable }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/name: {{ include "gatewayapi-securitypolicy-operator.name" . }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/instance: {{ .Release.Name }}
control-plane: controller-manager
name: {{ include "gatewayapi-securitypolicy-operator.resourceName" (dict "suffix" "controller-manager-metrics-monitor" "context" $) }}
namespace: {{ .Release.Namespace }}
spec:
endpoints:
- path: /metrics
port: https
scheme: https
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
tlsConfig:
{{- if .Values.certManager.enable }}
serverName: {{ include "gatewayapi-securitypolicy-operator.resourceName" (dict "suffix" "controller-manager-metrics-service" "context" $) }}.{{ .Release.Namespace }}.svc
# Apply secure TLS configuration with cert-manager
insecureSkipVerify: false
ca:
secret:
name: metrics-server-cert
key: ca.crt
cert:
secret:
name: metrics-server-cert
key: tls.crt
keySecret:
name: metrics-server-cert
key: tls.key
{{- else }}
# Development/Test mode (insecure configuration)
insecureSkipVerify: true
{{- end }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "gatewayapi-securitypolicy-operator.name" . }}
control-plane: controller-manager
{{- end }}
10 changes: 10 additions & 0 deletions dist/chart/templates/rbac/controller-manager.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/name: envoy-securitypolicy-operator
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/instance: {{ .Release.Name }}
name: {{ include "gatewayapi-securitypolicy-operator.resourceName" (dict "suffix" "controller-manager" "context" $) }}
namespace: {{ .Release.Namespace }}
42 changes: 42 additions & 0 deletions dist/chart/templates/rbac/leader-election-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/name: gatewayapi-securitypolicy-operator
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/instance: {{ .Release.Name }}
name: {{ include "gatewayapi-securitypolicy-operator.resourceName" (dict "suffix" "leader-election-role" "context" $) }}
namespace: {{ .Release.Namespace }}
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
18 changes: 18 additions & 0 deletions dist/chart/templates/rbac/leader-election-rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/name: gatewayapi-securitypolicy-operator
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/instance: {{ .Release.Name }}
name: {{ include "gatewayapi-securitypolicy-operator.resourceName" (dict "suffix" "leader-election-rolebinding" "context" $) }}
namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "gatewayapi-securitypolicy-operator.resourceName" (dict "suffix" "leader-election-role" "context" $) }}
subjects:
- kind: ServiceAccount
name: {{ include "gatewayapi-securitypolicy-operator.resourceName" (dict "suffix" "controller-manager" "context" $) }}
namespace: {{ .Release.Namespace }}
36 changes: 36 additions & 0 deletions dist/chart/templates/rbac/manager-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "gatewayapi-securitypolicy-operator.resourceName" (dict "suffix" "manager-role" "context" $) }}
rules:
- apiGroups:
- gateway.envoyproxy.io
resources:
- securitypolicies
verbs:
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- gateway.networking.k8s.io
resources:
- gateways
- grpcroutes
- httproutes
verbs:
- get
- list
- patch
- update
- watch
- apiGroups:
- networking.k8s.io
resources:
- networkpolicies
verbs:
- get
- list
- watch
Loading
Loading