diff --git a/README.md b/README.md index 9a8f8c1..8f6fb3c 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,12 @@ helm list helm upgrade demo-helm-1633825301 charts/demo-helm ``` +You can wait for successful deployment too. + +``` +helm upgrade demo-helm-1633825301 charts/demo-helm --wait +``` + ## Setting registry pull secrets You have to have an image pull secret. So first you need the secrets: diff --git a/charts/demo-helm/Chart.yaml b/charts/demo-helm/Chart.yaml index e09f844..357a6cf 100644 --- a/charts/demo-helm/Chart.yaml +++ b/charts/demo-helm/Chart.yaml @@ -3,5 +3,5 @@ apiVersion: v2 name: demo-helm appVersion: 1.1.0 description: A Helm chart to practice helm -version: 0.2.0 +version: 0.3.0 type: application diff --git a/charts/demo-helm/templates/backend-service.yaml b/charts/demo-helm/templates/backend-service.yaml index ab6b666..96fef1a 100644 --- a/charts/demo-helm/templates/backend-service.yaml +++ b/charts/demo-helm/templates/backend-service.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: Service # https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata diff --git a/charts/demo-helm/templates/backend.yaml b/charts/demo-helm/templates/backend.yaml index 251dc15..e80c200 100644 --- a/charts/demo-helm/templates/backend.yaml +++ b/charts/demo-helm/templates/backend.yaml @@ -4,7 +4,7 @@ kind: Deployment metadata: # This allows us to ensure we have a unique config name. Which means we could have two of the same service # in the same namespace. - name: {{ .Release.Name }}-{{ .Chart.Name}}-deployment + name: {{ .Release.Name }}-{{ .Chart.Name}}-backend labels: app: {{ .Release.Name }}-{{ .Chart.Name}}-backend spec: @@ -29,4 +29,4 @@ spec: - containerPort: 5000 imagePullSecrets: - name: {{ $.Values.image_pull_secret }} - {{- end }} \ No newline at end of file + {{- end }} diff --git a/charts/demo-helm/templates/frontend-service.yaml b/charts/demo-helm/templates/frontend-service.yaml new file mode 100644 index 0000000..a06a603 --- /dev/null +++ b/charts/demo-helm/templates/frontend-service.yaml @@ -0,0 +1,15 @@ +--- +apiVersion: v1 +kind: Service +# https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata +metadata: + labels: + name: {{ $.Release.Name }}-{{ $.Chart.Name}}-frontend-service + name: {{ $.Release.Name }}-{{ $.Chart.Name}}-frontend-service +spec: + ports: + - protocol: 'TCP' + port: 80 + targetPort: 80 + selector: + app: {{ $.Release.Name }}-{{ $.Chart.Name}}-frontend diff --git a/charts/demo-helm/templates/frontend.yaml b/charts/demo-helm/templates/frontend.yaml new file mode 100644 index 0000000..cb17f33 --- /dev/null +++ b/charts/demo-helm/templates/frontend.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment + # https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata +metadata: + # This allows us to ensure we have a unique config name. Which means we could have two of the same service + # in the same namespace. + name: {{ .Release.Name }}-{{ .Chart.Name }}-frontend + labels: + app: {{ .Release.Name }}-{{ .Chart.Name }}-frontend +spec: + {{- with .Values.services.frontend }} + replicas: {{ .replicas }} + selector: + matchLabels: + app: {{ $.Release.Name }}-{{ $.Chart.Name }}-frontend + template: + metadata: + labels: + app: {{ $.Release.Name }}-{{ $.Chart.Name }}-frontend + # Here I am just demonstrating that you can pull values from Chart.yaml or Releases. + # Note the capital first letter in accessing the values + app_version: {{ $.Chart.AppVersion }} + spec: + containers: + - name: {{ $.Release.Name }}-{{ $.Chart.Name}}-frontend + image: {{ .image_name }}:{{ .image_version }} + imagePullPolicy: Always + ports: + - containerPort: 80 + imagePullSecrets: + - name: {{ $.Values.image_pull_secret }} + {{- end }} diff --git a/charts/demo-helm/templates/ingress.yaml b/charts/demo-helm/templates/ingress.yaml index b669f57..038d3b5 100644 --- a/charts/demo-helm/templates/ingress.yaml +++ b/charts/demo-helm/templates/ingress.yaml @@ -1,3 +1,4 @@ +--- apiVersion: networking.k8s.io/v1 kind: Ingress # https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata @@ -15,3 +16,21 @@ spec: name: {{ $.Release.Name }}-{{ $.Chart.Name}}-backend-service port: number: 80 +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +# https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata +metadata: + name: {{ .Release.Name }}-{{ .Chart.Name}}-frontend-ingress +spec: + rules: + - host: frontend.runcible.io + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ $.Release.Name }}-{{ $.Chart.Name}}-frontend-service + port: + number: 80