diff --git a/Makefile b/Makefile index 11cd4113..77d640ff 100644 --- a/Makefile +++ b/Makefile @@ -63,8 +63,7 @@ test: manifests generate fmt vet setup-envtest ## Run tests. # TODO(user): To use a different vendor for e2e tests, modify the setup under 'tests/e2e'. # The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally. -# Prometheus and CertManager are installed by default; skip with: -# - PROMETHEUS_INSTALL_SKIP=true +# CertManager is installed by default; skip with: # - CERT_MANAGER_INSTALL_SKIP=true .PHONY: test-e2e test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind. @@ -173,7 +172,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint ## Tool Versions KUSTOMIZE_VERSION ?= v5.5.0 -CONTROLLER_TOOLS_VERSION ?= v0.17.1 +CONTROLLER_TOOLS_VERSION ?= v0.17.2 #ENVTEST_VERSION is the version of controller-runtime release branch to fetch the envtest setup script (i.e. release-0.20) ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-%d.%d", $$2, $$3}') #ENVTEST_K8S_VERSION is the version of Kubernetes to use for setting up ENVTEST binaries (i.e. 1.31) diff --git a/cmd/main.go b/cmd/main.go index 8c41c7ab..694674c0 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -144,7 +144,7 @@ func main() { // Metrics endpoint is enabled in 'config/default/kustomization.yaml'. The Metrics options configure the server. // More info: - // - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.20.0/pkg/metrics/server + // - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.20.2/pkg/metrics/server // - https://book.kubebuilder.io/reference/metrics.html metricsServerOptions := metricsserver.Options{ BindAddress: metricsAddr, @@ -156,7 +156,7 @@ func main() { // FilterProvider is used to protect the metrics endpoint with authn/authz. // These configurations ensure that only authorized users and service accounts // can access the metrics endpoint. The RBAC are configured in 'config/rbac/kustomization.yaml'. More info: - // https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.20.0/pkg/metrics/filters#WithAuthenticationAndAuthorization + // https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.20.2/pkg/metrics/filters#WithAuthenticationAndAuthorization metricsServerOptions.FilterProvider = filters.WithAuthenticationAndAuthorization } diff --git a/config/crd/bases/argocdcommenter.int128.github.io_applicationhealths.yaml b/config/crd/bases/argocdcommenter.int128.github.io_applicationhealths.yaml index 1ae8bae7..420e1811 100644 --- a/config/crd/bases/argocdcommenter.int128.github.io_applicationhealths.yaml +++ b/config/crd/bases/argocdcommenter.int128.github.io_applicationhealths.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.17.1 + controller-gen.kubebuilder.io/version: v0.17.2 name: applicationhealths.argocdcommenter.int128.github.io spec: group: argocdcommenter.int128.github.io diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index bceae327..99b7628f 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -77,6 +77,17 @@ patches: # delimiter: '.' # index: 0 # create: true +# - select: # Uncomment the following to set the Service name for TLS config in Prometheus ServiceMonitor +# kind: ServiceMonitor +# group: monitoring.coreos.com +# version: v1 +# name: controller-manager-metrics-monitor +# fieldPaths: +# - spec.endpoints.0.tlsConfig.serverName +# options: +# delimiter: '.' +# index: 0 +# create: true # # - source: # kind: Service @@ -96,6 +107,17 @@ patches: # delimiter: '.' # index: 1 # create: true +# - select: # Uncomment the following to set the Service namespace for TLS in Prometheus ServiceMonitor +# kind: ServiceMonitor +# group: monitoring.coreos.com +# version: v1 +# name: controller-manager-metrics-monitor +# fieldPaths: +# - spec.endpoints.0.tlsConfig.serverName +# options: +# delimiter: '.' +# index: 1 +# create: true # # - source: # Uncomment the following block if you have any webhook # kind: Service diff --git a/config/prometheus/monitor_tls_patch.yaml b/config/prometheus/monitor_tls_patch.yaml index e824dd0f..5bf84ce0 100644 --- a/config/prometheus/monitor_tls_patch.yaml +++ b/config/prometheus/monitor_tls_patch.yaml @@ -1,22 +1,19 @@ # Patch for Prometheus ServiceMonitor to enable secure TLS configuration # using certificates managed by cert-manager -apiVersion: monitoring.coreos.com/v1 -kind: ServiceMonitor -metadata: - name: controller-manager-metrics-monitor - namespace: system -spec: - endpoints: - - tlsConfig: - 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 +- op: replace + path: /spec/endpoints/0/tlsConfig + value: + # SERVICE_NAME and SERVICE_NAMESPACE will be substituted by kustomize + serverName: SERVICE_NAME.SERVICE_NAMESPACE.svc + 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