Skip to content

Commit 87d3128

Browse files
feat: add scheduling values (#396)
* chore(makefile): improve helm-testing makes Signed-off-by: Oliver Bähler <[email protected]> * feat(helm): add scheduling values Signed-off-by: Oliver Bähler <[email protected]> --------- Signed-off-by: Oliver Bähler <[email protected]>
1 parent c17230b commit 87d3128

File tree

6 files changed

+198
-121
lines changed

6 files changed

+198
-121
lines changed

Makefile

+7-6
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,18 @@ helm-docs: docker
103103
helm-lint: docker
104104
@docker run -v "$(SRC_ROOT):/workdir" --entrypoint /bin/sh quay.io/helmpack/chart-testing:v3.3.1 -c "cd /workdir; ct lint --config .github/configs/ct.yaml --lint-conf .github/configs/lintconf.yaml --all --debug"
105105

106-
helm-test: helm-controller-version kind ct ko-build-all
107-
@kind create cluster --wait=60s --name capsule-charts
108-
@kind load docker-image --name capsule-charts $(CAPSULE_PROXY_IMG):$(VERSION)
109-
@kubectl create ns capsule-system
110-
@make helm-install
106+
helm-test: helm-controller-version kind ct ko-build-all helm-create helm-install helm-destroy
111107

112108
helm-install:
113109
@kubectl apply --server-side=true -f https://github.com/cert-manager/cert-manager/releases/download/v1.13.2/cert-manager.yaml
114110
@make install-capsule
115111
@kubectl apply --server-side=true -f https://github.com/prometheus-operator/prometheus-operator/releases/download/v0.58.0/bundle.yaml
116-
@ct install --config $(SRC_ROOT)/.github/configs/ct.yaml --namespace=capsule-system --all --debug
112+
@$(CT) install --config $(SRC_ROOT)/.github/configs/ct.yaml --namespace=capsule-system --all --debug
113+
114+
helm-create:
115+
@kind create cluster --wait=60s --name capsule-charts
116+
@kind load docker-image --name capsule-charts $(CAPSULE_PROXY_IMG):$(VERSION)
117+
@kubectl create ns capsule-system
117118

118119
helm-destroy:
119120
@kind delete cluster --name capsule-charts

charts/capsule-proxy/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ If you only need to make minor customizations, you can specify them on the comma
6262
|-----|------|---------|-------------|
6363
| affinity | object | `{}` | Set affinity rules for the capsule-proxy pod. |
6464
| certManager.certificate.dnsNames | list | `[]` | Additional DNS Names to include in certificate |
65+
| certManager.certificate.includeInternalServiceNames | bool | `true` | Include internal service names in certificate (disable if you create a public cert) |
6566
| certManager.certificate.ipAddresses | list | `[]` | Additional IP Addresses to include in certificate |
6667
| certManager.certificate.uris | list | `[]` | Additional URIs to include in certificate |
6768
| certManager.externalCA.enabled | bool | `false` | Set if want cert manager to sign certificates with an external CA |
@@ -71,18 +72,25 @@ If you only need to make minor customizations, you can specify them on the comma
7172
| certManager.issuer.name | string | `""` | Set the name of the ClusterIssuer if issuer kind is ClusterIssuer and if cert manager will generate CA signed SSL certificates |
7273
| daemonset.hostNetwork | bool | `false` | Use the host network namespace for capsule-proxy pod. |
7374
| daemonset.hostPort | bool | `false` | Binding the capsule-proxy listening port to the host port. |
75+
| hostNetwork | bool | `false` | When deployed as DaemonSet use |
7476
| image.pullPolicy | string | `"IfNotPresent"` | Set the image pull policy. |
7577
| image.registry | string | `"ghcr.io"` | Set the image registry for capsule-proxy |
7678
| image.repository | string | `"projectcapsule/capsule-proxy"` | Set the image repository for capsule-proxy. |
7779
| image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion. |
7880
| imagePullSecrets | list | `[]` | Configuration for `imagePullSecrets` so that you can use a private images registry. |
81+
| jobs.affinity | object | `{}` | Set affinity rules |
7982
| jobs.annotations | object | `{}` | Annotations to add to the certgen job. |
8083
| jobs.certs.pullPolicy | string | `"IfNotPresent"` | Set the image pull policy of the post install certgen job |
8184
| jobs.certs.registry | string | `"docker.io"` | Set the image repository of the post install certgen job |
8285
| jobs.certs.repository | string | `"jettech/kube-webhook-certgen"` | Set the image repository of the post install certgen job |
8386
| jobs.certs.tag | string | `"v1.3.0"` | Set the image tag of the post install certgen job |
87+
| jobs.nodeSelector | object | `{}` | Set the node selector |
8488
| jobs.podSecurityContext | object | `{"seccompProfile":{"type":"RuntimeDefault"}}` | Security context for the job pods. |
89+
| jobs.priorityClassName | string | `""` | Set a pod priorityClassName |
90+
| jobs.restartPolicy | string | `"Never"` | Set the restartPolicy |
8591
| jobs.securityContext | object | `{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"readOnlyRootFilesystem":true,"runAsGroup":1002,"runAsNonRoot":true,"runAsUser":1002}` | Security context for the job containers. |
92+
| jobs.tolerations | list | `[]` | Set list of tolerations |
93+
| jobs.topologySpreadConstraints | list | `[]` | Set Topology Spread Constraints |
8694
| jobs.ttlSecondsAfterFinished | int | `60` | Sets the ttl in seconds after a finished certgen job is deleted. Set to -1 to never delete. |
8795
| kind | string | `"Deployment"` | Set the deployment mode of the capsule-proxy as `Deployment` or `DaemonSet`. |
8896
| nodeSelector | object | `{}` | Set the node selector for the capsule-proxy pod. |

charts/capsule-proxy/ci/ds-values.yaml

+36
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ tolerations:
4545
operator: Exists
4646
- effect: NoSchedule
4747
key: node-role.kubernetes.io/master
48+
affinity:
49+
nodeAffinity:
50+
preferredDuringSchedulingIgnoredDuringExecution:
51+
- weight: 1
52+
preference:
53+
matchExpressions:
54+
- key: another-node-label-key
55+
operator: In
56+
values:
57+
- another-node-label-value
4858
# Ingress
4959
ingress:
5060
enabled: true
@@ -59,3 +69,29 @@ ingress:
5969
# ServiceMonitor
6070
serviceMonitor:
6171
enabled: true
72+
jobs:
73+
affinity:
74+
nodeAffinity:
75+
preferredDuringSchedulingIgnoredDuringExecution:
76+
- weight: 1
77+
preference:
78+
matchExpressions:
79+
- key: another-node-label-key
80+
operator: In
81+
values:
82+
- another-node-label-value
83+
topologySpreadConstraints:
84+
- maxSkew: 1
85+
topologyKey: kubernetes.io/hostname
86+
whenUnsatisfiable: ScheduleAnyway
87+
labelSelector:
88+
matchLabels:
89+
app.kubernetes.io/name: capsule-proxy
90+
priorityClassName: "system-node-critical"
91+
nodeSelector:
92+
node-role.kubernetes.io/master: ""
93+
tolerations:
94+
- key: CriticalAddonsOnly
95+
operator: Exists
96+
- effect: NoSchedule
97+
key: node-role.kubernetes.io/master

charts/capsule-proxy/templates/certgen-job.yaml

+20-1
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,30 @@ spec:
1919
labels:
2020
{{- include "capsule-proxy.selectorLabels" . | nindent 8 }}
2121
spec:
22-
restartPolicy: Never
22+
restartPolicy: {{ $.Values.jobs.restartPolicy }}
2323
{{- with $.Values.jobs.podSecurityContext }}
2424
securityContext:
2525
{{- toYaml . | nindent 8 }}
2626
{{- end }}
27+
{{- with .Values.jobs.nodeSelector }}
28+
nodeSelector:
29+
{{- toYaml . | nindent 8 }}
30+
{{- end }}
31+
{{- with .Values.jobs.affinity }}
32+
affinity:
33+
{{- toYaml . | nindent 8 }}
34+
{{- end }}
35+
{{- with .Values.jobs.tolerations }}
36+
tolerations:
37+
{{- toYaml . | nindent 8 }}
38+
{{- end }}
39+
{{- with .Values.jobs.topologySpreadConstraints }}
40+
topologySpreadConstraints:
41+
{{- toYaml . | nindent 8 }}
42+
{{- end }}
43+
{{- with .Values.jobs.priorityClassName }}
44+
priorityClassName: {{ . }}
45+
{{- end }}
2746
containers:
2847
- name: post-install-job
2948
image: {{ include "capsule.jobs.certsFullyQualifiedDockerImage" $ }}

charts/capsule-proxy/templates/certmanager.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ spec:
4848
{{- range $dns := .Values.certManager.certificate.dnsNames }}
4949
- {{ $dns }}
5050
{{- end }}
51+
{{- if $.Values.certManager.certificate.includeInternalServiceNames }}
5152
- {{ include "capsule-proxy.fullname" . }}
5253
- {{ include "capsule-proxy.fullname" . }}.{{ .Release.Namespace }}.svc
54+
{{- end }}
5355
{{- with .Values.certManager.certificate.ipAddresses }}
5456
ipAddresses:
5557
{{- range $ip := . }}

0 commit comments

Comments
 (0)