Skip to content

Commit 51b0897

Browse files
committed
add single service kluctl example
1 parent 01180f3 commit 51b0897

File tree

27 files changed

+230
-12
lines changed

27 files changed

+230
-12
lines changed

12-deploying-to-multiple-environments/helm/Taskfile.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ version: "3"
33
tasks:
44
template-default:
55
cmds:
6-
- helm template ./api-golang-helm-chart
6+
- helm template ./api-golang-helm-chart | yq
77
desc: "Render chart yaml with default values"
88

99
template-staging:
1010
cmds:
11-
- helm template ./api-golang-helm-chart --values=./api-golang-helm-chart/values.staging.yaml
11+
- helm template ./api-golang-helm-chart --values=./api-golang-helm-chart/values.staging.yaml | yq
1212
desc: "Render chart yaml with staging values file"
1313

1414
template-production:
1515
cmds:
16-
- helm template ./api-golang-helm-chart --values=./api-golang-helm-chart/values.production.yaml
16+
- helm template ./api-golang-helm-chart --values=./api-golang-helm-chart/values.production.yaml | yq
1717
desc: "Render chart yaml with production values file"
1818

1919
package:
@@ -24,8 +24,10 @@ tasks:
2424
push:
2525
cmds:
2626
- helm push api-golang-helm-chart-0.1.0.tgz oci://registry-1.docker.io/sidpalas
27+
desc: "Push the helm chart to an oci registry"
2728

2829
build-push:
2930
cmds:
3031
- task: build
3132
- task: push
33+
desc: "Build & Push the helm chart to an oci registry"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
targets:
2+
- name: staging
3+
args:
4+
environment: staging
5+
# Adding a context to .kluctl.yaml helps prevent accidentally deploying to the wrong cluster!
6+
context: devops-directive-kubernetes-course
7+
8+
- name: production
9+
args:
10+
environment: production
11+
# Adding a context to .kluctl.yaml helps prevent accidentally deploying to the wrong cluster!
12+
context: gke_kubernetes-course-424917_us-central1-a_devops-directive-kubernetes-course
13+
14+
args:
15+
- name: environment
16+
17+
discriminator: kluctl-{{ target.name }}

12-deploying-to-multiple-environments/kluctl-single-service/README.md

Whitespace-only changes.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
version: "3"
2+
3+
tasks:
4+
helm-pull:
5+
cmds:
6+
- kluctl helm-pull
7+
desc: "Pre-pull helm charts"
8+
9+
render-staging:
10+
cmds:
11+
- kluctl render -t staging --print-all | yq
12+
desc: "Render resource yaml with staging values"
13+
14+
deploy-staging:
15+
cmds:
16+
- kluctl deploy -t staging
17+
desc: "Deploy staging configuration"
18+
19+
delete-staging:
20+
cmds:
21+
- kluctl delete -t staging
22+
desc: "Render resource yaml with staging values"
23+
24+
render-production:
25+
cmds:
26+
- kluctl render -t production --print-all | yq
27+
desc: "Render resource yaml with production values"
28+
29+
deploy-production:
30+
cmds:
31+
- kluctl deploy -t production
32+
desc: "Deploy production configuration"
33+
34+
delete-production:
35+
cmds:
36+
- kluctl delete -t production
37+
desc: "Render resource yaml with production values"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sharedVars:
2+
hostName: "kubernetes-course.devopsdirective.com"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sharedVars:
2+
hostName: "kubernetes-course-staging.devopsdirective.com"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
vars:
2+
- file: config/{{ args.environment }}.yaml
3+
4+
deployments:
5+
- path: namespaces
6+
- barrier: true
7+
- include: services
8+
9+
commonLabels:
10+
devopsdirective.com/course: "kubernetes-course"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: demo-app
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
apiGolang:
2+
version: 0.3.0 # PRODUCTION_IMAGE_TAG
3+
replicas: 2
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
apiGolang:
2+
version: 0.3.0-2-g29b7fb5 # STAGING_IMAGE_TAG
3+
replicas: 1

0 commit comments

Comments
 (0)