diff --git a/apps/charts/webapp1/.helmignore b/apps/charts/webapp1/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/apps/charts/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/apps/charts/webapp1/Chart.yaml b/apps/charts/webapp1/Chart.yaml new file mode 100644 index 0000000..7ff4f92 --- /dev/null +++ b/apps/charts/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/apps/charts/webapp1/templates/NOTES.txt b/apps/charts/webapp1/templates/NOTES.txt new file mode 100644 index 0000000..7e2a035 --- /dev/null +++ b/apps/charts/webapp1/templates/NOTES.txt @@ -0,0 +1,4 @@ +# Accessing it +``` +minikube tunnel {{ .Values.namespace }} +``` \ No newline at end of file diff --git a/apps/charts/webapp1/templates/configmap.yaml b/apps/charts/webapp1/templates/configmap.yaml new file mode 100644 index 0000000..ce262d3 --- /dev/null +++ b/apps/charts/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/apps/charts/webapp1/templates/deployment.yaml b/apps/charts/webapp1/templates/deployment.yaml new file mode 100644 index 0000000..3e6c0c9 --- /dev/null +++ b/apps/charts/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/apps/charts/webapp1/templates/service.yaml b/apps/charts/webapp1/templates/service.yaml new file mode 100644 index 0000000..30784eb --- /dev/null +++ b/apps/charts/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/apps/charts/webapp1/values-dev.yaml b/apps/charts/webapp1/values-dev.yaml new file mode 100644 index 0000000..45dca69 --- /dev/null +++ b/apps/charts/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/apps/charts/webapp1/values-prod.yaml b/apps/charts/webapp1/values-prod.yaml new file mode 100644 index 0000000..003c8fa --- /dev/null +++ b/apps/charts/webapp1/values-prod.yaml @@ -0,0 +1,6 @@ +namespace: prod + +configmap: + data: + CUSTOM_HEADER: "Welcome to PROD" + diff --git a/apps/charts/webapp1/values.yaml b/apps/charts/webapp1/values.yaml new file mode 100644 index 0000000..e994132 --- /dev/null +++ b/apps/charts/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: 2 \ No newline at end of file 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"