Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: devopsjourney1/helm-webapp
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: tchia04/helm-webapp
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 4 commits
  • 13 files changed
  • 1 contributor

Commits on Jun 21, 2024

  1. Copy the full SHA
    4108d44 View commit details
  2. add webapp1

    tchia04 committed Jun 21, 2024
    Copy the full SHA
    4100025 View commit details
  3. Merge pull request #1 from tchia04/add_webapp1

    add webapp1
    tchia04 authored Jun 21, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    8fb0b87 View commit details
  4. add link to video

    tchia04 committed Jun 21, 2024
    Copy the full SHA
    c9dbad6 View commit details
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ helm create webapp1


# Follow along with the video
- Create the files per the video, copying and pasting from templates-original
- Create the files per the video at https://www.youtube.com/watch?v=jUYNS90nq8U&t=147s, copying and pasting from templates-original
- you can also use the files in the solution folder

# Install the first one
@@ -16,19 +16,19 @@ helm install mywebapp-release webapp1/ --values webapp1/values.yaml

# Upgrade after templating
```
helm upgrade mywebapp-release webapp1/ --values mywebapp/values.yaml
helm upgrade mywebapp-release webapp1/ --values webapp1/values.yaml
```

# Accessing it
```
minikube tunnel
minikube service myhelmapp
```

# Create dev/prod
```
k create namespace dev
k create namespace prod
helm install mywebapp-release-dev webapp1/ --values webapp1/values.yaml -f webapp1/values-dev.yaml -n dev
kubectl create namespace dev
kubectl create namespace prod
helm install mywebapp-release-dev webapp1/ --values webapp1/values.yaml -f webapp1/values-dev.yaml -n dev
helm install mywebapp-release-prod webapp1/ --values webapp1/values.yaml -f webapp1/values-prod.yaml -n prod
helm ls --all-namespaces
```
2 changes: 1 addition & 1 deletion solution/webapp1/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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.0
version: 0.1.1

# 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
5 changes: 5 additions & 0 deletions solution/webapp1/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -16,6 +16,11 @@ spec:
labels:
app: {{ .Values.appName }}
tier: frontend
annotations:
# To force pod recreation on every upgrade,
# you can add annotations or checksums to the pod template that change on each upgrade.
rollme: {{ randAlphaNum 5 | quote }}

spec: # Pod spec
containers:
- name: mycontainer
2 changes: 1 addition & 1 deletion solution/webapp1/values.yaml
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ namespace: default
configmap:
name: myhelmapp-configmap-v1
data:
CUSTOM_HEADER: 'This app was deployed with helm!'
CUSTOM_HEADER: 'Fixed the update issue with helm. This app was deployed with helm!'

image:
name: devopsjourney1/mywebapp
23 changes: 23 additions & 0 deletions webapp1/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
24 changes: 24 additions & 0 deletions webapp1/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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.1

# 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"
2 changes: 2 additions & 0 deletions webapp1/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
servicename=$(k get service -l "app={{ .Values.appName }}" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace {{ .Values.namespace}} port-forward service/{{ .Values.appName }} 8888:80
9 changes: 9 additions & 0 deletions webapp1/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
39 changes: 39 additions & 0 deletions webapp1/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mydeployment
namespace: {{ .Values.namespace }}
labels:
app: {{ .Values.appName }}
spec:
replicas: 3
selector:
matchLabels:
app: {{ .Values.appName }}
tier: frontend
template:
metadata:
labels:
app: {{ .Values.appName }}
tier: frontend
annotations:
# To force pod recreation on every upgrade,
# you can add annotations or checksums to the pod template that change on each upgrade.
rollme: {{ randAlphaNum 5 | quote }}

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"
16 changes: 16 additions & 0 deletions webapp1/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions webapp1/values-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace: dev

configmap:
data:
CUSTOM_HEADER: 'This is on the DEV 2 environment!'
5 changes: 5 additions & 0 deletions webapp1/values-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace: prod

configmap:
data:
CUSTOM_HEADER: 'This is on the PROD 2 environment!'
13 changes: 13 additions & 0 deletions webapp1/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

namespace: default

appName: myhelmapp

configmap:
name: helmconfigmapv1.1
data:
CUSTOM_HEADER: 'Customized with helm in a configmap!'

image:
name: devopsjourney1/mywebapp
tag: latest