Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add openshift serving certs to metrics endpoint, fixes RHOAIENG-1828 #120

Merged
merged 1 commit into from
Aug 3, 2024
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
8 changes: 6 additions & 2 deletions config/overlays/odh/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ kind: Kustomization
# Adds odh namespace to all resources.
namespace: opendatahub

# patch to remove default `system` namespace in ../../manager/manager.yaml
patches:
- path: delete-namespace.yaml
# patch to remove default `system` namespace in ../../manager/manager.yaml
- path: patches/delete-namespace.yaml
# patch to add OpenShift serving cert annotation in metrics service
- path: patches/auth_proxy_service_patch.yaml
# patch to add serving cert to auth proxy container
- path: patches/manager_auth_proxy_patch.yaml

# Labels to add to all resources and selectors.
labels:
Expand Down
8 changes: 8 additions & 0 deletions config/overlays/odh/patches/auth_proxy_service_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This patch adds OpenShift serving cert annotation in HTTPS proxy for the controller manager
apiVersion: v1
kind: Service
metadata:
annotations:
service.beta.openshift.io/serving-cert-secret-name: controller-manager-metrics-service
name: controller-manager-metrics-service
namespace: system
29 changes: 29 additions & 0 deletions config/overlays/odh/patches/manager_auth_proxy_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This patch injects serving cert in HTTPS proxy for the controller manager
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller-manager
namespace: system
spec:
template:
spec:
containers:
- name: kube-rbac-proxy
args:
- "--secure-listen-address=0.0.0.0:8443"
- "--upstream=http://127.0.0.1:8080/"
- "--logtostderr=true"
- "--v=0"
- "--tls-cert-file=/etc/server-cert/tls.crt"
- "--tls-private-key-file=/etc/server-cert/tls.key"
# name must match the volume name below
volumeMounts:
- name: server-cert
mountPath: /etc/server-cert
readOnly: true
# The secret data is exposed to Containers in the Pod through a Volume.
volumes:
- name: server-cert
secret:
secretName: controller-manager-metrics-service
defaultMode: 0600
21 changes: 21 additions & 0 deletions config/overlays/odh/replacements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,24 @@
name: controller-manager
fieldPaths:
- spec.template.spec.containers.[name=manager].env.[name=DEFAULT_CERT].value
# Metrics service name replacements for auth proxy serving cert
- source:
kind: Service
name: controller-manager-metrics-service
fieldPath: metadata.name
targets:
- select:
kind: Service
name: controller-manager-metrics-service
fieldPaths:
- metadata.annotations.[service.beta.openshift.io/serving-cert-secret-name]
- source:
kind: Service
name: controller-manager-metrics-service
fieldPath: metadata.name
targets:
- select:
kind: Deployment
name: controller-manager
fieldPaths:
- spec.template.spec.volumes.[name=server-cert].secret.secretName