From 6a9c68fa423e31c940f6511b5759a370776032c0 Mon Sep 17 00:00:00 2001 From: rowdenb <148618268+rowdenb@users.noreply.github.com> Date: Thu, 12 Jun 2025 10:29:50 +1000 Subject: [PATCH 1/6] first commit --- webapp1/.helmignore | 23 +++++++++++++++++++++ webapp1/Chart.yaml | 24 ++++++++++++++++++++++ webapp1/templates/NOTES.txt | 4 ++++ webapp1/templates/configmap.yaml | 9 ++++++++ webapp1/templates/deployment.yaml | 34 +++++++++++++++++++++++++++++++ webapp1/templates/service.yaml | 16 +++++++++++++++ webapp1/values-dev.yaml | 8 ++++++++ webapp1/values-prod.yaml | 8 ++++++++ webapp1/values.yaml | 15 ++++++++++++++ 9 files changed, 141 insertions(+) create mode 100644 webapp1/.helmignore create mode 100644 webapp1/Chart.yaml create mode 100644 webapp1/templates/NOTES.txt create mode 100644 webapp1/templates/configmap.yaml create mode 100644 webapp1/templates/deployment.yaml create mode 100644 webapp1/templates/service.yaml create mode 100644 webapp1/values-dev.yaml create mode 100644 webapp1/values-prod.yaml create mode 100644 webapp1/values.yaml diff --git a/webapp1/.helmignore b/webapp1/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/webapp1/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/webapp1/Chart.yaml b/webapp1/Chart.yaml new file mode 100644 index 0000000..7ff4f92 --- /dev/null +++ b/webapp1/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: webapp1 +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +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.0 + +# 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 +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/webapp1/templates/NOTES.txt b/webapp1/templates/NOTES.txt new file mode 100644 index 0000000..7e2a035 --- /dev/null +++ b/webapp1/templates/NOTES.txt @@ -0,0 +1,4 @@ +# Accessing it +``` +minikube tunnel {{ .Values.namespace }} +``` \ No newline at end of file diff --git a/webapp1/templates/configmap.yaml b/webapp1/templates/configmap.yaml new file mode 100644 index 0000000..ce262d3 --- /dev/null +++ b/webapp1/templates/configmap.yaml @@ -0,0 +1,9 @@ +kind: ConfigMap +apiVersion: v1 +metadata: + name: {{ .Values.configmap.name }} + namespace: {{ .Values.namespace }} +data: + BG_COLOR: '#12181b' + FONT_COLOR: '#FFFFFF' + CUSTOM_HEADER: {{ .Values.configmap.data.CUSTOM_HEADER }} \ No newline at end of file diff --git a/webapp1/templates/deployment.yaml b/webapp1/templates/deployment.yaml new file mode 100644 index 0000000..3e6c0c9 --- /dev/null +++ b/webapp1/templates/deployment.yaml @@ -0,0 +1,34 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Values.appName }} + namespace: {{ .Values.namespace }} + labels: + app: {{ .Values.appName }} +spec: + replicas: {{ .Values.spec.replicas }} + selector: + matchLabels: + app: {{ .Values.appName }} + tier: frontend + template: + metadata: + labels: + app: {{ .Values.appName }} + tier: frontend + spec: # Pod spec + containers: + - name: mycontainer + image: "{{ .Values.image.name }}:{{ .Values.image.tag }}" + ports: + - containerPort: 80 + envFrom: + - configMapRef: + name: {{ .Values.configmap.name }} + resources: + requests: + memory: "16Mi" + cpu: "50m" # 50 milli cores (1/20 CPU) + limits: + memory: "128Mi" # 128 mebibytes + cpu: "100m" diff --git a/webapp1/templates/service.yaml b/webapp1/templates/service.yaml new file mode 100644 index 0000000..30784eb --- /dev/null +++ b/webapp1/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.appName }} + namespace: {{ .Values.namespace }} + labels: + app: {{ .Values.appName }} +spec: + ports: + - port: 80 + protocol: TCP + name: flask + selector: + app: {{ .Values.appName }} + tier: frontend + type: NodePort \ No newline at end of file diff --git a/webapp1/values-dev.yaml b/webapp1/values-dev.yaml new file mode 100644 index 0000000..45dca69 --- /dev/null +++ b/webapp1/values-dev.yaml @@ -0,0 +1,8 @@ +namespace: dev + +configmap: + data: + CUSTOM_HEADER: "Welcome to DEV" + +spec: + replicas: 2 \ No newline at end of file diff --git a/webapp1/values-prod.yaml b/webapp1/values-prod.yaml new file mode 100644 index 0000000..8f3e98b --- /dev/null +++ b/webapp1/values-prod.yaml @@ -0,0 +1,8 @@ +namespace: prod + +configmap: + data: + CUSTOM_HEADER: "Welcome to PROD" + +spec: + replicas: 5 \ No newline at end of file diff --git a/webapp1/values.yaml b/webapp1/values.yaml new file mode 100644 index 0000000..0455ff8 --- /dev/null +++ b/webapp1/values.yaml @@ -0,0 +1,15 @@ +appName: myhelmapp + +namespace: default + +configmap: + name: helmappconfigmapv1.1 + data: + CUSTOM_HEADER: "This app was deployed with HELM!" + +image: + name: devopsjourney1/mywebapp + tag: latest + +spec: + replicas: 5 \ No newline at end of file From 730f43b2bb4fb5725577c5d70349e1b9d9a1269e Mon Sep 17 00:00:00 2001 From: rowdenb <148618268+rowdenb@users.noreply.github.com> Date: Thu, 12 Jun 2025 10:39:44 +1000 Subject: [PATCH 2/6] Update --- webapp1/values-prod.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp1/values-prod.yaml b/webapp1/values-prod.yaml index 8f3e98b..545f5ca 100644 --- a/webapp1/values-prod.yaml +++ b/webapp1/values-prod.yaml @@ -5,4 +5,4 @@ configmap: CUSTOM_HEADER: "Welcome to PROD" spec: - replicas: 5 \ No newline at end of file + replicas: 4 \ No newline at end of file From 964ab1637ba73f6d21029b460b36c9c6c2fac78a Mon Sep 17 00:00:00 2001 From: rowdenb <148618268+rowdenb@users.noreply.github.com> Date: Thu, 12 Jun 2025 10:42:05 +1000 Subject: [PATCH 3/6] Update prod spec --- webapp1/values-prod.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/webapp1/values-prod.yaml b/webapp1/values-prod.yaml index 545f5ca..003c8fa 100644 --- a/webapp1/values-prod.yaml +++ b/webapp1/values-prod.yaml @@ -4,5 +4,3 @@ configmap: data: CUSTOM_HEADER: "Welcome to PROD" -spec: - replicas: 4 \ No newline at end of file From 624bf91bd5394ccca00f95a08aecf17da25ed2d9 Mon Sep 17 00:00:00 2001 From: rowdenb <148618268+rowdenb@users.noreply.github.com> Date: Thu, 12 Jun 2025 10:42:38 +1000 Subject: [PATCH 4/6] 6 reps --- webapp1/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp1/values.yaml b/webapp1/values.yaml index 0455ff8..b872863 100644 --- a/webapp1/values.yaml +++ b/webapp1/values.yaml @@ -12,4 +12,4 @@ image: tag: latest spec: - replicas: 5 \ No newline at end of file + replicas: 6 \ No newline at end of file From 234f753dc63cc56e0a3bc83f4fe6bdd5f10484cd Mon Sep 17 00:00:00 2001 From: rowdenb <148618268+rowdenb@users.noreply.github.com> Date: Thu, 12 Jun 2025 10:46:15 +1000 Subject: [PATCH 5/6] reps 2 --- webapp1/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp1/values.yaml b/webapp1/values.yaml index b872863..e994132 100644 --- a/webapp1/values.yaml +++ b/webapp1/values.yaml @@ -12,4 +12,4 @@ image: tag: latest spec: - replicas: 6 \ No newline at end of file + replicas: 2 \ No newline at end of file From 1b96e78913a3b12a5dbf13277ae70d7c86499fd7 Mon Sep 17 00:00:00 2001 From: Brad Rowden Date: Mon, 16 Jun 2025 14:15:34 +1000 Subject: [PATCH 6/6] Update for app of apps functionality. --- {webapp1 => apps/charts/webapp1}/.helmignore | 0 {webapp1 => apps/charts/webapp1}/Chart.yaml | 0 .../charts/webapp1}/templates/NOTES.txt | 0 .../charts/webapp1}/templates/configmap.yaml | 0 .../charts/webapp1}/templates/deployment.yaml | 0 .../charts/webapp1}/templates/service.yaml | 0 .../charts/webapp1}/values-dev.yaml | 0 .../charts/webapp1}/values-prod.yaml | 0 {webapp1 => apps/charts/webapp1}/values.yaml | 0 apps/charts/webapp2/.helmignore | 23 +++++++++++++ apps/charts/webapp2/Chart.yaml | 24 +++++++++++++ apps/charts/webapp2/templates/NOTES.txt | 4 +++ apps/charts/webapp2/templates/configmap.yaml | 9 +++++ apps/charts/webapp2/templates/deployment.yaml | 34 +++++++++++++++++++ apps/charts/webapp2/templates/service.yaml | 16 +++++++++ apps/charts/webapp2/values-dev.yaml | 8 +++++ apps/charts/webapp2/values-prod.yaml | 6 ++++ apps/charts/webapp2/values.yaml | 15 ++++++++ apps/webapps-platform.yaml | 20 +++++++++++ apps/webapps-webapp1.yaml | 24 +++++++++++++ apps/webapps-webapp2.yaml | 24 +++++++++++++ 21 files changed, 207 insertions(+) rename {webapp1 => apps/charts/webapp1}/.helmignore (100%) rename {webapp1 => apps/charts/webapp1}/Chart.yaml (100%) rename {webapp1 => apps/charts/webapp1}/templates/NOTES.txt (100%) rename {webapp1 => apps/charts/webapp1}/templates/configmap.yaml (100%) rename {webapp1 => apps/charts/webapp1}/templates/deployment.yaml (100%) rename {webapp1 => apps/charts/webapp1}/templates/service.yaml (100%) rename {webapp1 => apps/charts/webapp1}/values-dev.yaml (100%) rename {webapp1 => apps/charts/webapp1}/values-prod.yaml (100%) rename {webapp1 => apps/charts/webapp1}/values.yaml (100%) create mode 100644 apps/charts/webapp2/.helmignore create mode 100644 apps/charts/webapp2/Chart.yaml create mode 100644 apps/charts/webapp2/templates/NOTES.txt create mode 100644 apps/charts/webapp2/templates/configmap.yaml create mode 100644 apps/charts/webapp2/templates/deployment.yaml create mode 100644 apps/charts/webapp2/templates/service.yaml create mode 100644 apps/charts/webapp2/values-dev.yaml create mode 100644 apps/charts/webapp2/values-prod.yaml create mode 100644 apps/charts/webapp2/values.yaml create mode 100644 apps/webapps-platform.yaml create mode 100644 apps/webapps-webapp1.yaml create mode 100644 apps/webapps-webapp2.yaml diff --git a/webapp1/.helmignore b/apps/charts/webapp1/.helmignore similarity index 100% rename from webapp1/.helmignore rename to apps/charts/webapp1/.helmignore diff --git a/webapp1/Chart.yaml b/apps/charts/webapp1/Chart.yaml similarity index 100% rename from webapp1/Chart.yaml rename to apps/charts/webapp1/Chart.yaml diff --git a/webapp1/templates/NOTES.txt b/apps/charts/webapp1/templates/NOTES.txt similarity index 100% rename from webapp1/templates/NOTES.txt rename to apps/charts/webapp1/templates/NOTES.txt diff --git a/webapp1/templates/configmap.yaml b/apps/charts/webapp1/templates/configmap.yaml similarity index 100% rename from webapp1/templates/configmap.yaml rename to apps/charts/webapp1/templates/configmap.yaml diff --git a/webapp1/templates/deployment.yaml b/apps/charts/webapp1/templates/deployment.yaml similarity index 100% rename from webapp1/templates/deployment.yaml rename to apps/charts/webapp1/templates/deployment.yaml diff --git a/webapp1/templates/service.yaml b/apps/charts/webapp1/templates/service.yaml similarity index 100% rename from webapp1/templates/service.yaml rename to apps/charts/webapp1/templates/service.yaml diff --git a/webapp1/values-dev.yaml b/apps/charts/webapp1/values-dev.yaml similarity index 100% rename from webapp1/values-dev.yaml rename to apps/charts/webapp1/values-dev.yaml diff --git a/webapp1/values-prod.yaml b/apps/charts/webapp1/values-prod.yaml similarity index 100% rename from webapp1/values-prod.yaml rename to apps/charts/webapp1/values-prod.yaml diff --git a/webapp1/values.yaml b/apps/charts/webapp1/values.yaml similarity index 100% rename from webapp1/values.yaml rename to apps/charts/webapp1/values.yaml diff --git a/apps/charts/webapp2/.helmignore b/apps/charts/webapp2/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/apps/charts/webapp2/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/apps/charts/webapp2/Chart.yaml b/apps/charts/webapp2/Chart.yaml new file mode 100644 index 0000000..7ff4f92 --- /dev/null +++ b/apps/charts/webapp2/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: webapp1 +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +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.0 + +# 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 +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/apps/charts/webapp2/templates/NOTES.txt b/apps/charts/webapp2/templates/NOTES.txt new file mode 100644 index 0000000..7e2a035 --- /dev/null +++ b/apps/charts/webapp2/templates/NOTES.txt @@ -0,0 +1,4 @@ +# Accessing it +``` +minikube tunnel {{ .Values.namespace }} +``` \ No newline at end of file diff --git a/apps/charts/webapp2/templates/configmap.yaml b/apps/charts/webapp2/templates/configmap.yaml new file mode 100644 index 0000000..ce262d3 --- /dev/null +++ b/apps/charts/webapp2/templates/configmap.yaml @@ -0,0 +1,9 @@ +kind: ConfigMap +apiVersion: v1 +metadata: + name: {{ .Values.configmap.name }} + namespace: {{ .Values.namespace }} +data: + BG_COLOR: '#12181b' + FONT_COLOR: '#FFFFFF' + CUSTOM_HEADER: {{ .Values.configmap.data.CUSTOM_HEADER }} \ No newline at end of file diff --git a/apps/charts/webapp2/templates/deployment.yaml b/apps/charts/webapp2/templates/deployment.yaml new file mode 100644 index 0000000..3e6c0c9 --- /dev/null +++ b/apps/charts/webapp2/templates/deployment.yaml @@ -0,0 +1,34 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Values.appName }} + namespace: {{ .Values.namespace }} + labels: + app: {{ .Values.appName }} +spec: + replicas: {{ .Values.spec.replicas }} + selector: + matchLabels: + app: {{ .Values.appName }} + tier: frontend + template: + metadata: + labels: + app: {{ .Values.appName }} + tier: frontend + spec: # Pod spec + containers: + - name: mycontainer + image: "{{ .Values.image.name }}:{{ .Values.image.tag }}" + ports: + - containerPort: 80 + envFrom: + - configMapRef: + name: {{ .Values.configmap.name }} + resources: + requests: + memory: "16Mi" + cpu: "50m" # 50 milli cores (1/20 CPU) + limits: + memory: "128Mi" # 128 mebibytes + cpu: "100m" diff --git a/apps/charts/webapp2/templates/service.yaml b/apps/charts/webapp2/templates/service.yaml new file mode 100644 index 0000000..495de0a --- /dev/null +++ b/apps/charts/webapp2/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.appName }} + namespace: {{ .Values.namespace }} + labels: + app: {{ .Values.appName }} +spec: + ports: + - port: 8080 + protocol: TCP + name: flask + selector: + app: {{ .Values.appName }} + tier: frontend + type: NodePort \ No newline at end of file diff --git a/apps/charts/webapp2/values-dev.yaml b/apps/charts/webapp2/values-dev.yaml new file mode 100644 index 0000000..45dca69 --- /dev/null +++ b/apps/charts/webapp2/values-dev.yaml @@ -0,0 +1,8 @@ +namespace: dev + +configmap: + data: + CUSTOM_HEADER: "Welcome to DEV" + +spec: + replicas: 2 \ No newline at end of file diff --git a/apps/charts/webapp2/values-prod.yaml b/apps/charts/webapp2/values-prod.yaml new file mode 100644 index 0000000..003c8fa --- /dev/null +++ b/apps/charts/webapp2/values-prod.yaml @@ -0,0 +1,6 @@ +namespace: prod + +configmap: + data: + CUSTOM_HEADER: "Welcome to PROD" + diff --git a/apps/charts/webapp2/values.yaml b/apps/charts/webapp2/values.yaml new file mode 100644 index 0000000..e994132 --- /dev/null +++ b/apps/charts/webapp2/values.yaml @@ -0,0 +1,15 @@ +appName: myhelmapp + +namespace: default + +configmap: + name: helmappconfigmapv1.1 + data: + CUSTOM_HEADER: "This app was deployed with HELM!" + +image: + name: devopsjourney1/mywebapp + tag: latest + +spec: + replicas: 2 \ No newline at end of file diff --git a/apps/webapps-platform.yaml b/apps/webapps-platform.yaml new file mode 100644 index 0000000..bd9fcc6 --- /dev/null +++ b/apps/webapps-platform.yaml @@ -0,0 +1,20 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: webapp-app + namespace: argocd +spec: + project: default + source: + repoURL: https://github.com/rowdenb/helm-webapp.git + targetRevision: main + path: apps + directory: + recurse: true + destination: + server: https://kubernetes.default.svc + namespace: argocd + syncPolicy: + automated: + prune: false + selfHeal: false diff --git a/apps/webapps-webapp1.yaml b/apps/webapps-webapp1.yaml new file mode 100644 index 0000000..d2a25f3 --- /dev/null +++ b/apps/webapps-webapp1.yaml @@ -0,0 +1,24 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: datahub-prerequisites + namespace: argocd +spec: + project: default + source: + repoURL: https://github.com/rowdenb/helm-webapp.git + targetRevision: main + path: charts/webapp1 + helm: + valueFiles: + - values.yaml # or values/dev.yaml etc. if using environments + destination: + server: https://kubernetes.default.svc + namespace: webappns + syncPolicy: + automated: + selfHeal: false + prune: false + syncOptions: + - CreateNamespace=true + syncWave: "0" diff --git a/apps/webapps-webapp2.yaml b/apps/webapps-webapp2.yaml new file mode 100644 index 0000000..0c2c2e2 --- /dev/null +++ b/apps/webapps-webapp2.yaml @@ -0,0 +1,24 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: datahub + namespace: argocd +spec: + project: default + source: + repoURL: https://git.datalab.thsd.health.qld.gov.au/repo.git + targetRevision: main + path: charts/webapp2 + helm: + valueFiles: + - values.yaml # or values/dev.yaml if using per-environment overrides + destination: + server: https://kubernetes.default.svc + namespace: webappns + syncPolicy: + automated: + selfHeal: false + prune: false + syncOptions: + - CreateNamespace=true + syncWave: "1"