-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enable cert-manager for k8s deployment
This commit introduces the following changes: - Split the default config into openshift and k8s specific - Add the cert-manager deployment for k8s - Introduces overlays in manager for managing both openshift and k8s deployments - Update the manifests to point to `default/openshift` for bundle generation - Modify `deploy` and `undeploy` targets in Makefile to reference `default/k8s` - Bump up kustomize version to `v5.4.3` - Updates the README Signed-off-by: vprashar2929 <vibhu.sharma2929@gmail.com>
- Loading branch information
1 parent
e116cc7
commit a81fa01
Showing
19 changed files
with
319 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
# Adds namespace to all resources. | ||
namespace: kepler-operator-system | ||
|
||
# Value of this field is prepended to the | ||
# names of all resources, e.g. a deployment named | ||
# "wordpress" becomes "alices-wordpress". | ||
# Note that it should also match with the prefix (text before '-') of the namespace | ||
# field above. | ||
namePrefix: kepler-operator- | ||
|
||
# Labels to add to all resources and selectors. | ||
#labels: | ||
#- includeSelectors: true | ||
# pairs: | ||
# someName: someValue | ||
|
||
resources: | ||
- ../../crd | ||
- ../../rbac | ||
- ../../manager/overlays/k8s | ||
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in | ||
# crd/kustomization.yaml | ||
- ../../webhook | ||
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required. | ||
- ../../certmanager | ||
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'. | ||
- ../../prometheus | ||
|
||
patches: | ||
# Protect the /metrics endpoint by putting it behind auth. | ||
# If you want your controller-manager to expose the /metrics | ||
# endpoint w/o any authn/z, please comment the following line. | ||
# - path: manager_auth_proxy_patch.yaml | ||
|
||
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in | ||
# crd/kustomization.yaml | ||
- path: manager_webhook_patch.yaml | ||
|
||
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. | ||
# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks. | ||
# 'CERTMANAGER' needs to be enabled to use ca injection | ||
- path: webhookcainjection_patch.yaml | ||
|
||
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix. | ||
# Uncomment the following replacements to add the cert-manager CA injection annotations | ||
replacements: | ||
- source: # Add cert-manager annotation to ValidatingWebhookConfiguration, MutatingWebhookConfiguration and CRDs | ||
kind: Certificate | ||
group: cert-manager.io | ||
version: v1 | ||
name: serving-cert # this name should match the one in certificate.yaml | ||
fieldPath: .metadata.namespace # namespace of the certificate CR | ||
targets: | ||
- select: | ||
kind: ValidatingWebhookConfiguration | ||
fieldPaths: | ||
- .metadata.annotations.[cert-manager.io/inject-ca-from] | ||
options: | ||
delimiter: '/' | ||
index: 0 | ||
create: true | ||
- select: | ||
kind: MutatingWebhookConfiguration | ||
fieldPaths: | ||
- .metadata.annotations.[cert-manager.io/inject-ca-from] | ||
options: | ||
delimiter: '/' | ||
index: 0 | ||
create: true | ||
- select: | ||
kind: CustomResourceDefinition | ||
fieldPaths: | ||
- .metadata.annotations.[cert-manager.io/inject-ca-from] | ||
options: | ||
delimiter: '/' | ||
index: 0 | ||
create: true | ||
- source: | ||
kind: Certificate | ||
group: cert-manager.io | ||
version: v1 | ||
name: serving-cert # this name should match the one in certificate.yaml | ||
fieldPath: .metadata.name | ||
targets: | ||
- select: | ||
kind: ValidatingWebhookConfiguration | ||
fieldPaths: | ||
- .metadata.annotations.[cert-manager.io/inject-ca-from] | ||
options: | ||
delimiter: '/' | ||
index: 1 | ||
create: true | ||
- select: | ||
kind: MutatingWebhookConfiguration | ||
fieldPaths: | ||
- .metadata.annotations.[cert-manager.io/inject-ca-from] | ||
options: | ||
delimiter: '/' | ||
index: 1 | ||
create: true | ||
- select: | ||
kind: CustomResourceDefinition | ||
fieldPaths: | ||
- .metadata.annotations.[cert-manager.io/inject-ca-from] | ||
options: | ||
delimiter: '/' | ||
index: 1 | ||
create: true | ||
- source: # Add cert-manager annotation to the webhook Service | ||
kind: Service | ||
version: v1 | ||
name: webhook-service | ||
fieldPath: .metadata.name # namespace of the service | ||
targets: | ||
- select: | ||
kind: Certificate | ||
group: cert-manager.io | ||
version: v1 | ||
fieldPaths: | ||
- .spec.dnsNames.0 | ||
- .spec.dnsNames.1 | ||
options: | ||
delimiter: '.' | ||
index: 0 | ||
create: true | ||
- source: | ||
kind: Service | ||
version: v1 | ||
name: webhook-service | ||
fieldPath: .metadata.namespace # namespace of the service | ||
targets: | ||
- select: | ||
kind: Certificate | ||
group: cert-manager.io | ||
version: v1 | ||
fieldPaths: | ||
- .spec.dnsNames.0 | ||
- .spec.dnsNames.1 | ||
options: | ||
delimiter: '.' | ||
index: 1 | ||
create: true |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# This patch inject a sidecar container which is a HTTP proxy for the | ||
# controller manager, it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews. | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: controller-manager | ||
namespace: system | ||
spec: | ||
template: | ||
spec: | ||
affinity: | ||
nodeAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: kubernetes.io/arch | ||
operator: In | ||
values: | ||
- amd64 | ||
- arm64 | ||
- ppc64le | ||
- s390x | ||
- key: kubernetes.io/os | ||
operator: In | ||
values: | ||
- linux | ||
containers: | ||
- name: kube-rbac-proxy | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
capabilities: | ||
drop: | ||
- "ALL" | ||
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.15.0 | ||
args: | ||
- "--secure-listen-address=0.0.0.0:8443" | ||
- "--upstream=http://127.0.0.1:8080/" | ||
- "--logtostderr=true" | ||
- "--v=0" | ||
ports: | ||
- containerPort: 8443 | ||
protocol: TCP | ||
name: https | ||
resources: | ||
limits: | ||
cpu: 500m | ||
memory: 128Mi | ||
requests: | ||
cpu: 5m | ||
memory: 64Mi | ||
- name: manager | ||
args: | ||
- "--health-probe-bind-address=:8081" | ||
- "--metrics-bind-address=127.0.0.1:8080" | ||
- "--leader-elect" | ||
- "--zap-log-level=3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: controller-manager | ||
namespace: system | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: manager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: controller | ||
namespace: system | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: manager | ||
ports: | ||
- containerPort: 9443 | ||
name: webhook-server | ||
protocol: TCP | ||
volumeMounts: | ||
- mountPath: /tmp/k8s-webhook-server/serving-certs | ||
name: cert | ||
readOnly: true | ||
volumes: | ||
- name: cert | ||
secret: | ||
defaultMode: 420 | ||
secretName: webhook-server-cert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# This patch add annotation to admission webhook config and | ||
# CERTIFICATE_NAMESPACE and CERTIFICATE_NAME will be substituted by kustomize | ||
apiVersion: admissionregistration.k8s.io/v1 | ||
kind: MutatingWebhookConfiguration | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: mutatingwebhookconfiguration | ||
app.kubernetes.io/instance: mutating-webhook-configuration | ||
app.kubernetes.io/component: webhook | ||
app.kubernetes.io/created-by: kepler-operator | ||
app.kubernetes.io/part-of: kepler-operator | ||
app.kubernetes.io/managed-by: kustomize | ||
name: mutating-webhook-configuration | ||
annotations: | ||
cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME | ||
--- | ||
apiVersion: admissionregistration.k8s.io/v1 | ||
kind: ValidatingWebhookConfiguration | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: validatingwebhookconfiguration | ||
app.kubernetes.io/instance: validating-webhook-configuration | ||
app.kubernetes.io/component: webhook | ||
app.kubernetes.io/created-by: kepler-operator | ||
app.kubernetes.io/part-of: kepler-operator | ||
app.kubernetes.io/managed-by: kustomize | ||
name: validating-webhook-configuration | ||
annotations: | ||
cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME |
File renamed without changes.
Oops, something went wrong.