Skip to content

Commit 23c846b

Browse files
committed
Update enableSearchFeature and image tags
1 parent 1f610c8 commit 23c846b

File tree

6 files changed

+39
-27
lines changed

6 files changed

+39
-27
lines changed

.github/workflows/cd.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,18 @@ jobs:
114114
if [[ "$COMMIT_MESSAGE" == \[v1\]* ]]; then
115115
echo "Update is for v1. Not setting v2.image.tag."
116116
# Update the app without changing the v2 image but instead change the v1 image to IMAGE_TAG ensure the v2.image.tag is not changed from the values.yaml file
117-
helm upgrade --install app-release ./my-chart --set v1.image.tag=$IMAGE_TAG,v2.image.tag=$CURRENT_V2_IMAGE_TAG
117+
helm upgrade --install app-release ./my-chart --set v1.springAppContainer.image.tag=$IMAGE_TAG,v2.springAppContainer.image.tag=$CURRENT_V2_IMAGE_TAG
118118
else
119119
# If the commit message does not start with [v1], it's an update for v2
120120
echo "Update is for v2. Setting v2.image.tag to: $IMAGE_TAG."
121121
# Update the app and change the v2 image to IMAGE_TAG
122-
helm upgrade --install app-release ./my-chart --set v2.image.tag=$IMAGE_TAG,v1.image.tag=$CURRENT_V1_IMAGE_TAG
122+
helm upgrade --install app-release ./my-chart --set v2.springAppContainer.image.tag=$IMAGE_TAG,v1.springAppContainer.image.tag=$CURRENT_V1_IMAGE_TAG
123123
fi
124124
else
125125
# If the app deployment does not exist
126126
echo "App deployment does not exist. Setting v2.image.tag to: $IMAGE_TAG."
127127
# Set v2.image.tag to IMAGE_TAG as a new deployment starting point and leave v1.image.tag as the default value in the values.yaml file
128-
helm upgrade --install app-release ./my-chart --set v2.image.tag=$IMAGE_TAG
128+
helm upgrade --install app-release ./my-chart --set v2.springAppContainer.image.tag=$IMAGE_TAG
129129
fi
130130
131131
# Wait for 30 seconds

my-chart/templates/spring-app-deployment-v1.yaml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,29 @@ spec:
2020
containers:
2121
- env:
2222
- name: DB_URL
23-
value: {{ quote .Values.v1.springAppContainer.env.dbUrl }}
23+
value: {{ .Values.v1.springAppContainer.env.dbUrl }}
2424
- name: USER_NAME
25-
value: {{ quote .Values.v1.springAppContainer.env.userName }}
25+
value: {{ .Values.v1.springAppContainer.env.userName }}
2626
- name: PASSWORD
27-
value: {{ quote .Values.v1.springAppContainer.env.password }}
27+
value: {{ .Values.v1.springAppContainer.env.password }}
2828
- name: CHANGELOG_VERSION
29-
value: {{ quote .Values.v1.springAppContainer.env.changelogVersion }}
29+
value: {{ .Values.v1.springAppContainer.env.changelogVersion }}
3030
- name: REDIS_HOST
31-
value: {{ quote .Values.v1.springAppContainer.env.redisHost }}
31+
value: {{ .Values.v1.springAppContainer.env.redisHost }}
3232
- name: KUBERNETES_CLUSTER_DOMAIN
33-
value: {{ quote .Values.kubernetesClusterDomain }}
33+
value: {{ .Values.kubernetesClusterDomain }}
3434
image: {{ .Values.v1.springAppContainer.image.repository }}:{{ .Values.v1.springAppContainer.image.tag
3535
| default .Chart.AppVersion }}
36+
imagePullPolicy: Always
3637
name: spring-app-container
3738
ports:
3839
- containerPort: 8086
39-
resources: {{- toYaml .Values.v1.springAppContainer.resources | nindent 10 }}
40+
resources:
41+
limits:
42+
cpu: {{ .Values.v1.springAppContainer.resources.limits.cpu }}
43+
memory: {{ .Values.v1.springAppContainer.resources.limits.memory }}
44+
requests:
45+
cpu: {{ .Values.v1.springAppContainer.resources.requests.cpu }}
46+
memory: {{ .Values.v1.springAppContainer.resources.requests.memory }}
4047
imagePullSecrets:
4148
- name: your-registry-secret

my-chart/templates/spring-app-deployment-v2.yaml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,27 @@ spec:
2020
containers:
2121
- env:
2222
- name: DB_URL
23-
value: {{ quote .Values.v2.springAppContainer.env.dbUrl }}
23+
value: {{ .Values.v2.springAppContainer.env.dbUrl }}
2424
- name: USER_NAME
25-
value: {{ quote .Values.v2.springAppContainer.env.userName }}
25+
value: {{ .Values.v2.springAppContainer.env.userName }}
2626
- name: PASSWORD
27-
value: {{ quote .Values.v2.springAppContainer.env.password }}
27+
value: {{ .Values.v2.springAppContainer.env.password }}
2828
- name: CHANGELOG_VERSION
29-
value: {{ quote .Values.v2.springAppContainer.env.changelogVersion }}
29+
value: {{ .Values.v2.springAppContainer.env.changelogVersion }}
3030
- name: REDIS_HOST
31-
value: {{ quote .Values.v2.springAppContainer.env.redisHost }}
32-
- name: KUBERNETES_CLUSTER_DOMAIN
33-
value: {{ quote .Values.kubernetesClusterDomain }}
31+
value: {{ .Values.v2.springAppContainer.env.redisHost }}
3432
image: {{ .Values.v2.springAppContainer.image.repository }}:{{ .Values.v2.springAppContainer.image.tag
3533
| default .Chart.AppVersion }}
34+
imagePullPolicy: Always
3635
name: spring-app-container
3736
ports:
3837
- containerPort: 8086
39-
resources: {{- toYaml .Values.v2.springAppContainer.resources | nindent 10 }}
38+
resources:
39+
limits:
40+
cpu: {{ .Values.v2.springAppContainer.resources.limits.cpu }}
41+
memory: {{ .Values.v2.springAppContainer.resources.limits.memory }}
42+
requests:
43+
cpu: {{ .Values.v2.springAppContainer.resources.requests.cpu }}
44+
memory: {{ .Values.v2.springAppContainer.resources.requests.memory }}
4045
imagePullSecrets:
4146
- name: your-registry-secret

my-chart/values.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ v1:
99
userName: postgresadmin
1010
image:
1111
repository: ghcr.io/octodemo/java-springboot-demo
12-
tag: "196"
12+
tag: "199"
1313
resources:
1414
limits:
1515
cpu: "1"
1616
memory: 512Mi
1717
requests:
18-
cpu: 250m
18+
cpu: 125m
1919
memory: 128Mi
2020
v2:
21-
replicas: 2
21+
replicas: 3
2222
springAppContainer:
2323
env:
2424
changelogVersion: changelog_version-3.3.xml
@@ -28,13 +28,13 @@ v2:
2828
userName: postgresadmin
2929
image:
3030
repository: ghcr.io/octodemo/java-springboot-demo
31-
tag: "197"
31+
tag: "198"
3232
resources:
3333
limits:
3434
cpu: "1"
3535
memory: 512Mi
3636
requests:
37-
cpu: 250m
37+
cpu: 125m
3838
memory: 128Mi
3939
kubernetesClusterDomain: cluster.local
4040
postgresConfig:

src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ spring.redis.port=6379
1515
# spring.data.jpa.repositories.enabled=false
1616
# spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
1717
spring.jpa.hibernate.ddl-auto=none
18-
enableSearchFeature=false
18+
enableSearchFeature=true

src/test/java/net/codejava/JUnit5ExampleTest11.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ void testEnableSearchFeature() {
5858
// print a comment about the value of enableSearchFeature
5959
System.out.println("\n\n");
6060
System.out.println("--------------------------------------------------------------------------------");
61-
System.out.println("Expected value of enableSearchFeature: false");
61+
System.out.println("Expected value of enableSearchFeature: true");
6262
System.out.println("Actual value of enableSearchFeature: " + appController.getEnableSearchFeature());
6363
System.out.println("--------------------------------------------------------------------------------");
6464

65-
// assert that the value of enableSearchFeature is false
66-
assertEquals(false, appController.getEnableSearchFeature());
65+
// assert that the value of enableSearchFeature is true
66+
assertEquals(true, appController.getEnableSearchFeature());
6767

6868
System.out.println("\n\nTest11-2 Successful!\n\n");
6969
}

0 commit comments

Comments
 (0)