Last active
January 30, 2023 11:27
-
-
Save bootswithdefer/103bd371087d8c5e9e7758c1184ad264 to your computer and use it in GitHub Desktop.
helm chart exercise
This file contains hidden or 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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: {{ include "mychart.fullname" . }} | |
labels: | |
{{- include "mychart.labels" . | nindent 4 }} | |
spec: | |
{{- if not .Values.autoscaling.enabled }} | |
replicas: {{ .Values.replicaCount }} | |
{{- end }} | |
selector: | |
matchLabels: | |
{{- include "mychart.selectorLabels" . | nindent 6 }} | |
template: | |
metadata: | |
{{- with .Values.podAnnotations }} | |
annotations: | |
{{- toYaml . | nindent 8 }} | |
{{- end }} | |
labels: | |
{{- include "mychart.selectorLabels" . | nindent 8 }} | |
spec: | |
{{- with .Values.imagePullSecrets }} | |
imagePullSecrets: | |
{{- toYaml . | nindent 8 }} | |
{{- end }} | |
serviceAccountName: {{ include "mychart.serviceAccountName" . }} | |
securityContext: | |
{{- toYaml .Values.podSecurityContext | nindent 8 }} | |
containers: | |
- name: {{ .Chart.Name }} | |
securityContext: | |
{{- toYaml .Values.securityContext | nindent 12 }} | |
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | |
imagePullPolicy: {{ .Values.image.pullPolicy }} | |
ports: | |
- name: http | |
containerPort: 80 | |
protocol: TCP | |
livenessProbe: | |
httpGet: | |
path: / | |
port: http | |
readinessProbe: | |
httpGet: | |
path: / | |
port: http | |
resources: | |
{{- toYaml .Values.resources | nindent 12 }} | |
volumeMounts: | |
- name: {{ include "mychart.fullname" . }} | |
mountPath: /usr/share/nginx/html | |
volumes: | |
- name: {{ include "mychart.fullname" . }} | |
persistentVolumeClaim: | |
claimName: {{ include "mychart.fullname" . }} | |
{{- with .Values.nodeSelector }} | |
nodeSelector: | |
{{- toYaml . | nindent 8 }} | |
{{- end }} | |
{{- with .Values.affinity }} | |
affinity: | |
{{- toYaml . | nindent 8 }} | |
{{- end }} | |
{{- with .Values.tolerations }} | |
tolerations: | |
{{- toYaml . | nindent 8 }} | |
{{- end }} |
This file contains hidden or 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
kind: PersistentVolumeClaim | |
apiVersion: v1 | |
metadata: | |
name: {{ include "mychart.fullname" . }} | |
spec: | |
storageClassName: {{ .Values.volume.storageClassName }} | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: {{ .Values.volume.storage }} |
This file contains hidden or 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
# Default values for mychart. | |
# This is a YAML-formatted file. | |
# Declare variables to be passed into your templates. | |
replicaCount: 1 | |
image: | |
repository: nginx | |
pullPolicy: IfNotPresent | |
# Overrides the image tag whose default is the chart appVersion. | |
tag: "" | |
imagePullSecrets: [] | |
nameOverride: "" | |
fullnameOverride: "" | |
serviceAccount: | |
# Specifies whether a service account should be created | |
create: true | |
# Annotations to add to the service account | |
annotations: {} | |
# The name of the service account to use. | |
# If not set and create is true, a name is generated using the fullname template | |
name: "" | |
podAnnotations: {} | |
podSecurityContext: {} | |
# fsGroup: 2000 | |
securityContext: {} | |
# capabilities: | |
# drop: | |
# - ALL | |
# readOnlyRootFilesystem: true | |
# runAsNonRoot: true | |
# runAsUser: 1000 | |
service: | |
type: LoadBalancer | |
port: 80 | |
ingress: | |
enabled: false | |
className: "" | |
annotations: {} | |
# kubernetes.io/ingress.class: nginx | |
# kubernetes.io/tls-acme: "true" | |
hosts: | |
- host: chart-example.local | |
paths: | |
- path: / | |
pathType: ImplementationSpecific | |
tls: [] | |
# - secretName: chart-example-tls | |
# hosts: | |
# - chart-example.local | |
resources: {} | |
# We usually recommend not to specify default resources and to leave this as a conscious | |
# choice for the user. This also increases chances charts run on environments with little | |
# resources, such as Minikube. If you do want to specify resources, uncomment the following | |
# lines, adjust them as necessary, and remove the curly braces after 'resources:'. | |
# limits: | |
# cpu: 100m | |
# memory: 128Mi | |
# requests: | |
# cpu: 100m | |
# memory: 128Mi | |
autoscaling: | |
enabled: false | |
minReplicas: 1 | |
maxReplicas: 100 | |
targetCPUUtilizationPercentage: 80 | |
# targetMemoryUtilizationPercentage: 80 | |
nodeSelector: {} | |
tolerations: [] | |
affinity: {} | |
volume: | |
storageClassName: efs-sc | |
storage: 10Gi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment