Skip to content

Commit

Permalink
Merge pull request #23 from dnvgl/fluxAutomationFix
Browse files Browse the repository at this point in the history
Fixed the flux image automation policy that always included default n…
  • Loading branch information
areicher authored Apr 13, 2023
2 parents a8844d4 + 1f5f180 commit 642b183
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion charts/platform-service/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v1
appVersion: "1.1"
description: Platform service chart
name: platform-service
version: 1.2.0
version: 1.2.1
8 changes: 7 additions & 1 deletion charts/platform-service/templates/image-policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,11 @@ spec:
{{- if .Values.image.fluxAutomation.filterTags }}
filterTags: {{ .Values.image.fluxAutomation.filterTags | toYaml | nindent 4 }}
{{- end }}
policy: {{ (required "policy is required when fluxAutomation is enabled" .Values.image.fluxAutomation.policy) | toYaml | nindent 4 }}
{{- if .Values.image.fluxAutomation.policy }}
policy: {{ .Values.image.fluxAutomation.policy | toYaml | nindent 4 }}
{{- else }}
policy:
numerical:
order: asc
{{- end }}
{{- end }}
6 changes: 3 additions & 3 deletions charts/platform-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ image:
#filterTags:
# pattern: '^dev-(?P<build>.*)'
# extract: '$build'
policy:
numerical:
order: asc
#policy:
# numerical:
# order: asc
# deploymentOnly -- This workload is an addon to another for the same app - only create the deployment and destination rule
deploymentOnly: false

Expand Down
2 changes: 1 addition & 1 deletion testing/generate-results.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ helm template test-release ../charts/platform-service -n test-ns -f values.yaml
> results/default-image-automation.yaml

helm template test-release ../charts/platform-service -n test-ns -f values.yaml \
--set image.fluxAutomation.enabled=true,image.fluxAutomation.filterTags.pattern='^dev-(?P<build>.*)',image.fluxAutomation.filterTags.extract='$build',image.fluxAutomation.policy.numerical.order=asc \
--set image.fluxAutomation.enabled=true,image.fluxAutomation.filterTags.pattern='^dev-(?P<build>.*)',image.fluxAutomation.filterTags.extract='$build',image.fluxAutomation.policy.semver.range='> 0' \
--show-only templates/image-policy.yaml \
--show-only templates/image-repository.yaml \
--debug \
Expand Down
4 changes: 2 additions & 2 deletions testing/results/image-automation-options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ spec:
extract: $build
pattern: ^dev-(?P<build>.*)
policy:
numerical:
order: asc
semver:
range: '> 0'
---
# Source: platform-service/templates/image-repository.yaml
apiVersion: image.toolkit.fluxcd.io/v1beta1
Expand Down

0 comments on commit 642b183

Please sign in to comment.