Skip to content
Open
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
11 changes: 10 additions & 1 deletion bundle/manifests/gitops-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ metadata:
capabilities: Deep Insights
console.openshift.io/plugins: '["gitops-plugin"]'
containerImage: quay.io/redhat-developer/gitops-operator
createdAt: "2026-06-16T17:25:03Z"
createdAt: "2026-06-29T14:44:36Z"
description: Enables teams to adopt GitOps principles for managing cluster configurations
and application delivery across hybrid multi-cluster Kubernetes environments.
features.operators.openshift.io/disconnected: "true"
Expand Down Expand Up @@ -864,6 +864,7 @@ spec:
- --health-probe-bind-address=:8081
- --metrics-bind-address=:8443
- --leader-elect
- --metrics-secure=true
command:
- /usr/local/bin/manager
env:
Expand Down Expand Up @@ -910,10 +911,18 @@ spec:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
volumeMounts:
- mountPath: /tmp/k8s-metrics-server/serving-certs
name: metrics-certs
readOnly: true
securityContext:
runAsNonRoot: true
serviceAccountName: openshift-gitops-operator-controller-manager
terminationGracePeriodSeconds: 10
volumes:
- name: metrics-certs
secret:
secretName: gitops-operator-metrics-tls

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep the name as openshift-gitops-operator-metrics-tls and in other places ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure anand

permissions:
- rules:
- apiGroups:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
kind: Service
metadata:
annotations:
service.beta.openshift.io/serving-cert-secret-name: kube-rbac-proxy-tls
service.beta.openshift.io/serving-cert-secret-name: gitops-operator-metrics-tls
creationTimestamp: null
labels:
control-plane: gitops-operator
Expand Down
25 changes: 19 additions & 6 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func main() {
var metricsAddr string
var enableLeaderElection bool
var probeAddr string

var secureMetrics = false
var enableHTTP2 = false
var skipControllerNameValidation = true
var disableClusterTLSProfile = false
Expand All @@ -107,6 +107,8 @@ func main() {
"Enabling this will ensure there is only one active controller manager.")
flag.BoolVar(&enableHTTP2, "enable-http2", enableHTTP2, "If HTTP/2 should be enabled for the metrics and webhook servers.")
flag.BoolVar(&disableClusterTLSProfile, "disable-cluster-tls-profile", false, "Disable use of the cluster TLS security profile")
flag.BoolVar(&secureMetrics, "metrics-secure", secureMetrics, "If the metrics endpoint should be served securely.")

//Configure log level
logLevelStr := strings.ToLower(os.Getenv("LOG_LEVEL"))
logLevel := zapcore.InfoLevel
Expand Down Expand Up @@ -179,11 +181,7 @@ func main() {
}
webhookServer := webhook.NewServer(webhookServerOptions)

metricsServerOptions := metricsserver.Options{
BindAddress: metricsAddr,
TLSOpts: tlsOpts,
FilterProvider: filters.WithAuthenticationAndAuthorization,
}
metricsServerOptions := buildMetricsServerOptions(metricsAddr, secureMetrics, tlsOpts)

// Set default manager options
options := ctrl.Options{
Expand Down Expand Up @@ -472,3 +470,18 @@ func initK8sClient() (*kubernetes.Clientset, error) {

return k8sClient, nil
}

func buildMetricsServerOptions(metricsAddr string, secureMetrics bool, tlsOpts []func(*tls.Config)) metricsserver.Options {
opts := metricsserver.Options{
SecureServing: secureMetrics,
BindAddress: metricsAddr,
TLSOpts: tlsOpts,
}

if secureMetrics {
opts.FilterProvider = filters.WithAuthenticationAndAuthorization
opts.CertDir = "/tmp/k8s-metrics-server/serving-certs"
}

return opts
}
1 change: 1 addition & 0 deletions config/default/manager_metrics_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ spec:
- "--health-probe-bind-address=:8081"
- "--metrics-bind-address=:8443"
- "--leader-elect"
- "--metrics-secure=true"
ports:
- name: metrics
containerPort: 8443
Expand Down
14 changes: 11 additions & 3 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ spec:
securityContext:
runAsNonRoot: true
containers:
- command:
- name: manager
command:
- /usr/local/bin/manager
env:
- name: ARGOCD_CLUSTER_CONFIG_NAMESPACES
Expand All @@ -47,7 +48,6 @@ spec:
port: 8081
initialDelaySeconds: 15
periodSeconds: 20
name: manager
readinessProbe:
httpGet:
path: /readyz
Expand All @@ -62,5 +62,13 @@ spec:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
volumeMounts:
- name: metrics-certs
mountPath: /tmp/k8s-metrics-server/serving-certs
readOnly: true
volumes:
- name: metrics-certs
secret:
secretName: gitops-operator-metrics-tls
serviceAccountName: controller-manager
terminationGracePeriodSeconds: 10
terminationGracePeriodSeconds: 10
2 changes: 1 addition & 1 deletion config/rbac/metrics_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
kind: Service
metadata:
annotations:
service.beta.openshift.io/serving-cert-secret-name: kube-rbac-proxy-tls
service.beta.openshift.io/serving-cert-secret-name: gitops-operator-metrics-tls
labels:
control-plane: gitops-operator
name: metrics-service
Expand Down
Loading