Skip to content

Commit b07fd83

Browse files
authored
Merge pull request #6 from LearnWithHomer/implement_helm
Adding the helm templates, removing the old configs.
2 parents ccd7dbb + 3bcef5f commit b07fd83

File tree

16 files changed

+101
-404
lines changed

16 files changed

+101
-404
lines changed

Jenkinsfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def upstream_image_tag = "4.5.1"
1212
def full_image_name = null
1313
def cluster = null
1414
def namespace = null
15+
def helm_data_file = null
1516

1617
pipeline {
1718
agent any
@@ -34,6 +35,7 @@ pipeline {
3435
full_image_name = "${homer_image_name}:${tag}"
3536
cluster = params.cluster
3637
namespace = params.namespace
38+
helm_data_file = "k8s/${cluster}/${namespace}"
3739
}
3840
}
3941
}
@@ -49,11 +51,29 @@ pipeline {
4951
}
5052
}
5153

54+
stage('Render and validate the Kubernetes deployment yaml'){
55+
when {
56+
expression {deploy}
57+
}
58+
steps {
59+
script {
60+
deploymentName = homerKubernetes.getDeploymentName()
61+
replicas = homerKubernetes.getReplicaCount(cluster, namespace, deploymentName)
62+
homerKubernetes.updateDeploymentYaml(null, 'k8s/deployment.yaml',full_image_name)
63+
homerKubernetes.updateReplicaCount(replicas)
64+
homerKubernetes.processConfigData(helm_data_file, namespace, cluster)
65+
homerKubernetes.validateParams()
66+
}
67+
}
68+
}
69+
5270

5371
stage('Deploy'){
5472
steps {
5573
script {
74+
homerKubernetes.deploy(namespace, cluster, 'output.yaml')
5675
homerKubernetes.deploy(namespace, cluster)
76+
homerKubernetes.watchDeploy(namespace, cluster, "jenkins-deployment.yaml") // Watch/wait for deployment
5777
homerKubernetes.deploy(namespace, cluster, 'k8s/service.yaml') //Create the service for the size
5878
}
5979
}

k8s/helm-chart/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

k8s/helm-chart/Chart.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v2
2+
name: squidex
3+
description: A Helm chart for Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
appVersion: 1.16.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ metadata:
1717
nginx.ingress.kubernetes.io/cors-allow-headers: "DNT,X-CustomHeader,X-LANG,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Api-Key,X-Device-Id,Access-Control-Allow-Origin"
1818
spec:
1919
rules:
20-
- host: squidex-dev.learnwithhomer.com
20+
- host: {{ .Values.ingressHost }}
2121
http:
2222
paths:
2323
- path: /
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: 'kubernetes-client.io/v1'
2+
kind: ExternalSecret
3+
metadata:
4+
name: squidex-params
5+
spec:
6+
backendType: systemManager
7+
data:
8+
- key: /squidex/{{ .Values.secretsEnvironment }}/{{ .Values.contentVersion }}/DOMAIN
9+
name: DOMAIN
10+
- key: /squidex/{{ .Values.secretsEnvironment }}/{{ .Values.contentVersion }}/ADMIN_EMAIL
11+
name: ADMIN_EMAIL
12+
- key: /squidex/{{ .Values.secretsEnvironment }}/{{ .Values.contentVersion }}/S3_BUCKET
13+
name: S3_BUCKET
Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,24 @@ metadata:
55
spec:
66
backendType: secretsManager
77
data:
8-
- key: homer-squidex-dev
8+
- key: {{ .Values.secretsEnvironment }}-{{ .Values.contentVersion }}-squidex
99
name: mongo_connection_string
1010
property: mongo_connection_string
11-
- key: homer-squidex-dev
11+
- key: {{ .Values.secretsEnvironment }}-{{ .Values.contentVersion }}-squidex
1212
name: squidex_admin_password
1313
property: squidex_admin_password
14-
- key: homer-squidex-dev
14+
- key: {{ .Values.secretsEnvironment }}-{{ .Values.contentVersion }}-squidex
1515
name: google_auth_client_id
1616
property: google_auth_client_id
17-
- key: homer-squidex-dev
17+
- key: {{ .Values.secretsEnvironment }}-{{ .Values.contentVersion }}-squidex
1818
name: google_auth_secret
1919
property: google_auth_secret
20-
- key: homer-squidex-dev
20+
- key: {{ .Values.secretsEnvironment }}-{{ .Values.contentVersion }}-squidex
2121
name: iam_access_key
2222
property: iam_access_key
23-
- key: homer-squidex-dev
23+
- key: {{ .Values.secretsEnvironment }}-{{ .Values.contentVersion }}-squidex
2424
name: iam_secret_key
2525
property: iam_secret_key
2626
- key: squidex-user
2727
name: email_smtp_password
2828
property: email_smtp_password
29-
---
30-
apiVersion: 'kubernetes-client.io/v1'
31-
kind: ExternalSecret
32-
metadata:
33-
name: squidex-params
34-
spec:
35-
backendType: systemManager
36-
data:
37-
- key: /squidex/staging/dev/DOMAIN
38-
name: DOMAIN
39-
- key: /squidex/staging/dev/ADMIN_EMAIL
40-
name: ADMIN_EMAIL
41-
- key: /squidex/staging/dev/S3_BUCKET
42-
name: S3_BUCKET

k8s/production/content-v1.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
contentVersion: v1
2+
secretsEnvironment: production
3+
ingressHost: squidex.learnwithhomer.com

k8s/production/content-v2.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
contentVersion: v2
2+
secretsEnvironment: production
3+
ingressHost: squidex-production-v2.learnwithhomer.com

k8s/staging/content-dev.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
contentVersion: v1
2+
secretsEnvironment: staging
3+
ingressHost: squidex-dev.learnwithhomer.com

k8s/staging/content-v1.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
contentVersion: v1
2+
secretsEnvironment: staging
3+
ingressHost: squidex-staging.learnwithhomer.com

0 commit comments

Comments
 (0)