Files
gatewayapi-certificates-ope…/deploy/manifests.yaml
Jan Novak a78e4421ef feat: initial implementation of gateway-cert-operator
Kubernetes operator that automates HTTPS listener configuration on
Gateway API Gateway resources whenever a cert-manager Certificate is
created or updated.

Core behaviour:
- Watches cert-manager Certificate resources for the annotation
  gateway-cert-operator.io/gateway-name to identify the target Gateway
- Builds HTTPS listeners (prefixed "auto-") from each Certificate's
  DNS SANs and merges them into the target Gateway's listener list
- Preserves any manually-managed listeners; removes stale auto-listeners
  when Certificates are deleted or their annotations are removed
- Supports optional annotations to override the target namespace and
  listener port (default 443)

Components:
- main.go                            – manager setup, scheme registration,
                                       health/readiness probes
- internal/controller/               – Certificate reconciler with field
                                       indexing and dual-watch pattern
- internal/gateway/patch.go          – listener construction, merge, and
                                       equality helpers
- deploy/manifests.yaml              – Namespace, RBAC, and Deployment
- docs/README.md                     – usage guide and architecture notes
- Dockerfile                         – distroless multi-stage build

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 10:54:33 +01:00

103 lines
2.5 KiB
YAML

---
apiVersion: v1
kind: Namespace
metadata:
name: gateway-cert-operator-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: gateway-cert-operator
namespace: gateway-cert-operator-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: gateway-cert-operator
rules:
# Watch and read Certificates
- apiGroups: ["cert-manager.io"]
resources: ["certificates"]
verbs: ["get", "list", "watch"]
# Read and patch Gateways
- apiGroups: ["gateway.networking.k8s.io"]
resources: ["gateways"]
verbs: ["get", "list", "watch", "patch"]
# Emit events
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "patch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: gateway-cert-operator
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: gateway-cert-operator
subjects:
- kind: ServiceAccount
name: gateway-cert-operator
namespace: gateway-cert-operator-system
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: gateway-cert-operator
namespace: gateway-cert-operator-system
labels:
app.kubernetes.io/name: gateway-cert-operator
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: gateway-cert-operator
template:
metadata:
labels:
app.kubernetes.io/name: gateway-cert-operator
spec:
serviceAccountName: gateway-cert-operator
securityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
containers:
- name: manager
image: gateway-cert-operator:latest
args:
- --metrics-bind-address=:8080
- --health-probe-bind-address=:8081
ports:
- name: metrics
containerPort: 8080
protocol: TCP
- name: healthz
containerPort: 8081
protocol: TCP
livenessProbe:
httpGet:
path: /healthz
port: healthz
initialDelaySeconds: 5
periodSeconds: 10
readinessProbe:
httpGet:
path: /readyz
port: healthz
initialDelaySeconds: 5
periodSeconds: 10
resources:
limits:
cpu: 100m
memory: 64Mi
requests:
cpu: 50m
memory: 32Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]