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

[TT-9291] Add extraVolume and extraVolumeMounts #638

Merged
merged 5 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 4 additions & 0 deletions config/helm/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ patchesStrategicMerge:
- manager_env_vars_patch.yaml
# add custom node selector
- manager_node_selector_patch.yaml
# add extraVolume for manager pod
- manager_extra_volume.yaml
# add extraVolumeMounts for manager pod
- manager_extra_volumemounts.yaml

# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
# crd/kustomization.yaml
Expand Down
10 changes: 10 additions & 0 deletions config/helm/manager_extra_volume.yaml
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:
volumes:
- name: CONTROLLER_MANAGER_EXTRA_VOLUME
komalsukhani marked this conversation as resolved.
Show resolved Hide resolved
13 changes: 13 additions & 0 deletions config/helm/manager_extra_volumemounts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller-manager
namespace: system
spec:
template:
spec:
containers:
- name: manager
volumeMounts:
- mountPath: CONTROLLER_MANAGER_EXTRA_VOLUMEMOUNTS

14 changes: 14 additions & 0 deletions hack/helm/pre_helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ func main() {
{securityContext, securityContextTPL},
{imageRBAC, imageRBACTPL},
{nodeSelector, nodeSelectorTPL},
{extraVolume, extraVolumeTPL},
{extraVolumeMounts, extraVolumeMountsTPL},

{"OPERATOR_FULLNAME", `{{ include "tyk-operator-helm.fullname" . }}`},
{"RELEASE_NAMESPACE", "{{ .Release.Namespace }}"},
Expand Down Expand Up @@ -127,3 +129,15 @@ const nodeSelectorTPL = `{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}`

const extraVolume = `- name: CONTROLLER_MANAGER_EXTRA_VOLUME`

const extraVolumeTPL = `{{ if .Values.extraVolumes }}
{{ toYaml .Values.extraVolumes | nindent 6 }}
{{ end }}`

const extraVolumeMounts = `- mountPath: CONTROLLER_MANAGER_EXTRA_VOLUMEMOUNTS`

const extraVolumeMountsTPL = `{{ if .Values.extraVolumeMounts }}
{{ toYaml .Values.extraVolumeMounts | nindent 8}}
{{ end }}`
6 changes: 6 additions & 0 deletions helm/templates/all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,9 @@ spec:
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: cert
readOnly: true
{{ if .Values.extraVolumeMounts }}
{{ toYaml .Values.extraVolumeMounts | nindent 8}}
{{ end }}
- mountPath: /controller_manager_config.yaml
name: manager-config
subPath: controller_manager_config.yaml
Expand Down Expand Up @@ -491,6 +494,9 @@ spec:
secret:
defaultMode: 420
secretName: webhook-server-cert
{{ if .Values.extraVolumes }}
{{ toYaml .Values.extraVolumes | nindent 6 }}
{{ end }}
- configMap:
name: {{ include "tyk-operator-helm.fullname" . }}-manager-config
name: manager-config
Expand Down
29 changes: 27 additions & 2 deletions helm/values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
replicaCount: 1

# loads environment variables to the operator.
envFrom:
- secretRef:
Expand All @@ -12,22 +13,46 @@ image:
repository: tykio/tyk-operator
pullPolicy: IfNotPresent
tag: "v0.14.2"
imagePullSecrets: []

nameOverride: ""
fullnameOverride: ""

# extraVolumes is a list of volumes to be added to the pod
# extraVolumes:
# - name: ca-certs
# secret:
# secretName: ca-certs
# - name: ca-certs
# configMap:
# name: custom-ca-configmap
extraVolumes: []

# extraVolumeMounts is a list of volume mounts to be added to the pod
# extraVolumeMounts:
# - name: ca-certs
# mountPath: /etc/ssl/certs/your-cert.pem
# subPath: your-cert.pem
# readOnly: false
extraVolumeMounts: []

# healthProbePort identifies the port the Controller Manager will listen on. Used by liveness and readiness probes
healthProbePort: 8081

# metricsPort identifies the port on which Tyk Operator metrics are served
metricsPort: 8080

# webhookPort identifies the port on which webhooks are handled
webhookPort: 9443

annotations: {}
podAnnotations: {}
podSecurityContext:
allowPrivilegeEscalation: false
resources: {}
nodeSelector: {}
#specify necessary resources for kube-rbac-proxy container
hostNetwork: false

# rbac specifies necessary resources for kube-rbac-proxy container
rbac:
resources: {}
# specify custom/internal repo name for kube-rbac-proxy container
Expand Down