From d6f80c8f75deedc5657025e69aaf2f4fe185b025 Mon Sep 17 00:00:00 2001 From: JAM <272807+JessieAMorris@users.noreply.github.com> Date: Fri, 6 Dec 2024 15:03:34 -0700 Subject: [PATCH] Might help if I actually add the files --- charts/philter/Chart.yaml | 2 +- .../templates/ph-eye/_helpers-ph-eye.yaml | 22 ++++++ .../philter/templates/ph-eye/deployment.yaml | 79 +++++++++++++++++++ charts/philter/templates/ph-eye/hpa.yaml | 34 ++++++++ charts/philter/templates/ph-eye/service.yaml | 17 ++++ .../ph-eye/tests/test-connection.yaml | 17 ++++ 6 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 charts/philter/templates/ph-eye/_helpers-ph-eye.yaml create mode 100644 charts/philter/templates/ph-eye/deployment.yaml create mode 100644 charts/philter/templates/ph-eye/hpa.yaml create mode 100644 charts/philter/templates/ph-eye/service.yaml create mode 100644 charts/philter/templates/ph-eye/tests/test-connection.yaml diff --git a/charts/philter/Chart.yaml b/charts/philter/Chart.yaml index 8545349..7bf4f72 100644 --- a/charts/philter/Chart.yaml +++ b/charts/philter/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.8 +version: 0.1.9 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/philter/templates/ph-eye/_helpers-ph-eye.yaml b/charts/philter/templates/ph-eye/_helpers-ph-eye.yaml new file mode 100644 index 0000000..5d158fe --- /dev/null +++ b/charts/philter/templates/ph-eye/_helpers-ph-eye.yaml @@ -0,0 +1,22 @@ +{{/* +phEye fullname +*/}} +{{- define "philter.phEyeFullname" -}} +{{ include "philter.fullname" . }}-ph-eye-1 +{{- end }} + +{{/* +phEye common labels +*/}} +{{- define "philter.phEyeLabels" -}} +{{ include "philter.labels" . }} +{{ include "philter.phEyeSelectorLabels" . }} +{{- end }} + +{{/* +phEye selector labels +*/}} +{{- define "philter.phEyeSelectorLabels" -}} +{{ include "philter.selectorLabels" . }} +app.kubernetes.io/component: ph-eye +{{- end }} diff --git a/charts/philter/templates/ph-eye/deployment.yaml b/charts/philter/templates/ph-eye/deployment.yaml new file mode 100644 index 0000000..f6a2757 --- /dev/null +++ b/charts/philter/templates/ph-eye/deployment.yaml @@ -0,0 +1,79 @@ +{{- if .Values.phEye.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "philter.phEyeFullname" . }} + labels: + {{- include "philter.labels" . | nindent 4 }} +spec: + {{- if not .Values.phEye.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "philter.phEyeSelectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.phEye.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "philter.phEyeLabels" . | nindent 8 }} + {{- with .Values.phEye.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "philter.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.phEye.podSecurityContext | nindent 8 }} + containers: + - name: philter-ph-eye + securityContext: + {{- toYaml .Values.phEye.securityContext | nindent 12 }} + image: "{{ .Values.phEye.image.repository }}:{{ .Values.phEye.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.phEye.image.pullPolicy }} + {{- with .Values.phEye.env }} + env: + {{- toYaml . | nindent 12 }} + {{- end }} + ports: + - name: http + containerPort: {{ .Values.phEye.service.port }} + protocol: TCP + livenessProbe: + {{- toYaml .Values.phEye.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.phEye.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.phEye.resources | nindent 12 }} + {{- with .Values.phEye.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.phEye.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.phEye.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.phEye.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.phEye.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + + {{- with .Values.phEye.topologySpreadConstraints }} + topologySpreadConstraints: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} diff --git a/charts/philter/templates/ph-eye/hpa.yaml b/charts/philter/templates/ph-eye/hpa.yaml new file mode 100644 index 0000000..35fe3d7 --- /dev/null +++ b/charts/philter/templates/ph-eye/hpa.yaml @@ -0,0 +1,34 @@ +{{- if .Values.phEye.enabled }} +{{- if .Values.phEye.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "philter.phEyeFullname" . }} + labels: + {{- include "philter.phEyeLabels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "philter.phEyeFullname" . }} + minReplicas: {{ .Values.phEye.autoscaling.minReplicas }} + maxReplicas: {{ .Values.phEye.autoscaling.maxReplicas }} + metrics: + {{- if .Values.phEye.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.phEye.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.phEye.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.phEye.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} +{{- end }} diff --git a/charts/philter/templates/ph-eye/service.yaml b/charts/philter/templates/ph-eye/service.yaml new file mode 100644 index 0000000..bbf0e76 --- /dev/null +++ b/charts/philter/templates/ph-eye/service.yaml @@ -0,0 +1,17 @@ +{{- if .Values.phEye.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "philter.phEyeFullname" . }} + labels: + {{- include "philter.phEyeLabels" . | nindent 4 }} +spec: + type: {{ .Values.phEye.service.type }} + ports: + - port: {{ .Values.phEye.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "philter.phEyeSelectorLabels" . | nindent 4 }} +{{- end }} diff --git a/charts/philter/templates/ph-eye/tests/test-connection.yaml b/charts/philter/templates/ph-eye/tests/test-connection.yaml new file mode 100644 index 0000000..7f6b0cc --- /dev/null +++ b/charts/philter/templates/ph-eye/tests/test-connection.yaml @@ -0,0 +1,17 @@ +{{- if .Values.phEye.enabled }} +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "philter.phEyeFullname" . }}-test-connection" + labels: + {{- include "philter.phEyeLabels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "philter.phEyeFullname" . }}:{{ .Values.phEye.service.port }}'] + restartPolicy: Never +{{- end }}