Skip to content

Commit

Permalink
Allow easier patching of the controller deployment (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
bastjan authored Mar 1, 2024
1 parent dac4cf9 commit aa4ea78
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 23 deletions.
2 changes: 2 additions & 0 deletions class/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ parameters:
kustomize_input:
namespace: ${emergency_credentials_controller:namespace}

controller_deployment_patch: {}

cluster_admin_role: cluster-admin

emergency_accounts: {}
Expand Down
10 changes: 10 additions & 0 deletions component/emergency-credentials-controller.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ local removeUpstreamAlerts = {
},
};

local deploymentPatch = {
apiVersion: 'apps/v1',
kind: 'Deployment',
metadata: {
name: 'controller-manager',
namespace: upstreamNamespace,
},
} + com.makeMergeable(params.controller_deployment_patch);

local patch = function(p) {
patch: std.manifestJsonMinified(p),
};
Expand All @@ -50,6 +59,7 @@ com.Kustomization(
patches+: [
patch(removeUpstreamNamespace),
patch(removeUpstreamAlerts),
patch(deploymentPatch),
],
labels+: [
{
Expand Down
10 changes: 10 additions & 0 deletions tests/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,13 @@ parameters:
_tokenStores:
ext-s3:
type: s3

controller_deployment_patch:
spec:
template:
spec:
containers:
- name: manager
env:
- name: MY_ENV
value: test
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,14 @@ spec:
values:
- linux
containers:
- args:
- --secure-listen-address=0.0.0.0:8443
- --upstream=http://127.0.0.1:8080/
- --logtostderr=true
- --v=0
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.14.1
name: kube-rbac-proxy
ports:
- containerPort: 8443
name: https
protocol: TCP
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 5m
memory: 64Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
- args:
- --health-probe-bind-address=:8081
- --metrics-bind-address=127.0.0.1:8080
- --leader-elect
- --namespace=$(POD_NAMESPACE)
env:
- name: MY_ENV
value: test
- name: POD_NAMESPACE
valueFrom:
fieldRef:
Expand Down Expand Up @@ -99,6 +78,29 @@ spec:
capabilities:
drop:
- ALL
- args:
- --secure-listen-address=0.0.0.0:8443
- --upstream=http://127.0.0.1:8080/
- --logtostderr=true
- --v=0
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.14.1
name: kube-rbac-proxy
ports:
- containerPort: 8443
name: https
protocol: TCP
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 5m
memory: 64Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
securityContext:
runAsNonRoot: true
seccompProfile:
Expand Down

0 comments on commit aa4ea78

Please sign in to comment.