Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This chart is used by the Validated Patterns installation script that can be fou
| main | object | depends on the individual settings | main is used primarily for initial bootstrap pattern configuration |
| main.analytics | object | `{"enabled":true}` | Settings related to the segment.io analytics collection by the patterns operator |
| main.analytics.enabled | bool | `true` | Whether analytics are enabled or not |
| main.clusterGroupName | string | `"default"` | Name of the clusterGroup to be used. Drives the clusterGroup chart |
| main.clusterGroupName | DEPRECATED | `nil` | Name of the clusterGroup to be used. Drives the clusterGroup chart. Use main.variant instead. Cannot be set together with main.variant. |
| main.experimentalCapabilities | string | `""` | String to enable certain experimental capabilities in the operator and the framework. Not needed unless you know exactly what you're doing. |
| main.git | object | depends on the individual settings | Settings related to the Git repository used to deploy the pattern |
| main.git.repoURL | string | `"https://github.com/pattern-clone/mypattern"` | Repository URL pointing to the pattern |
Expand All @@ -48,6 +48,7 @@ This chart is used by the Validated Patterns installation script that can be fou
| main.patternsOperator.subscriptionNamespace | string | `"openshift-operators"` | Namespace where the patterns operator subscription and related resources will be created |
| main.tokenSecret | string | `nil` | Name of the secret containing access credentials to clone the Git repository to deploy the pattern See https://validatedpatterns.io/blog/2023-12-20-private-repos/ for more information |
| main.tokenSecretNamespace | string | `nil` | Namespace where the above secret will be |
| main.variant | string | `nil` | Name of the variant to be used. Drives the clusterGroup chart. Replaces main.clusterGroupName. Cannot be set together with main.clusterGroupName. |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)
Expand Down
3 changes: 2 additions & 1 deletion crds/gitops.hybrid-cloud-patterns.io_patterns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ spec:
type: string
clusterGroupName:
type: string
variant:
type: string
experimentalCapabilities:
description: Comma separated capabilities to enable certain experimental
features
Expand Down Expand Up @@ -153,7 +155,6 @@ spec:
type: string
type: object
required:
- clusterGroupName
- gitSpec
type: object
status:
Expand Down
8 changes: 8 additions & 0 deletions templates/pattern.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ metadata:
name: {{ .Release.Name }}
namespace: {{ .Values.main.patternsOperator.subscriptionNamespace }}
spec:
{{- if and .Values.main.variant .Values.main.clusterGroupName }}
{{- fail "main.variant and main.clusterGroupName are mutually exclusive, please set only one" }}
{{- else if .Values.main.variant }}
variant: {{ .Values.main.variant }}
{{- else if .Values.main.clusterGroupName }}
clusterGroupName: {{ .Values.main.clusterGroupName }}
{{- else }}
{{- fail "either main.variant or main.clusterGroupName must be set" }}
{{- end }}
gitSpec:
{{- if .Values.main.git.repoUpstreamURL }}
originRepo: {{ .Values.main.git.repoUpstreamURL }}
Expand Down
49 changes: 48 additions & 1 deletion tests/pattern_custom_values_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ templates:
release:
name: release-custom-test
tests:
- it: "should render Pattern with required fields"
- it: "should render Pattern with clusterGroupName when main.clusterGroupName is set"
set:
main.clusterGroupName: "my-cluster-group"
main.variant: null
main.git.repoURL: "https://github.com/example/repo.git"
main.git.revision: "main"
main.multiSourceConfig.enabled: true
Expand All @@ -22,6 +23,8 @@ tests:
- equal:
path: spec.clusterGroupName
value: "my-cluster-group"
- notExists:
path: spec.variant
- equal:
path: spec.gitSpec.targetRepo
value: "https://github.com/example/repo.git"
Expand All @@ -36,8 +39,40 @@ tests:
- notExists:
path: spec.multiSourceConfig.clusterGroupChartGitRevision

- it: "should render Pattern with variant when main.variant is set"
set:
main.variant: "my-variant"
main.git.repoURL: "https://github.com/example/repo.git"
main.git.revision: "main"
main.multiSourceConfig.enabled: true
asserts:
- isKind:
of: Pattern
- equal:
path: spec.variant
value: "my-variant"
- notExists:
path: spec.clusterGroupName

- it: "should fail when both main.variant and main.clusterGroupName are set"
set:
main.variant: "my-variant"
main.clusterGroupName: "my-cluster-group"
asserts:
- failedTemplate:
errorMessage: "main.variant and main.clusterGroupName are mutually exclusive, please set only one"

- it: "should fail when neither main.variant nor main.clusterGroupName is set"
set:
main.variant: null
main.clusterGroupName: null
asserts:
- failedTemplate:
errorMessage: "either main.variant or main.clusterGroupName must be set"

- it: "should not include clusterGroupGitRepoUrl and clusterGroupChartGitRevision when clusterGroupChartVersion is set"
set:
main.variant: "default"
main.multiSourceConfig.clusterGroupChartVersion: "6.6.6"
asserts:
- notExists:
Expand All @@ -47,6 +82,7 @@ tests:

- it: "should include clusterGroupGitRepoUrl and clusterGroupChartGitRevision when clusterGroupChartVersion is not set"
set:
main.variant: "default"
main.multiSourceConfig.clusterGroupChartGitRevision: "test-branch"
main.multiSourceConfig.clusterGroupGitRepoUrl: "https://github.com/custom/clustergroup-chart"
asserts:
Expand All @@ -61,6 +97,7 @@ tests:

- it: "should include originRepo when repoUpstreamURL is set"
set:
main.variant: "default"
main.git.repoUpstreamURL: "https://github.com/example/upstream.git"
asserts:
- exists:
Expand All @@ -71,6 +108,7 @@ tests:

- it: "should not include tokenSecret and tokenSecretNamespace when only tokenSecret is set"
set:
main.variant: "default"
main.tokenSecret: "my-token-secret"
asserts:
- notExists:
Expand All @@ -80,6 +118,7 @@ tests:

- it: "should not include tokenSecret and tokenSecretNamespace when only tokenSecretNamespace is set"
set:
main.variant: "default"
main.tokenSecretNamespace: "my-token-namespace"
asserts:
- notExists:
Expand All @@ -89,6 +128,7 @@ tests:

- it: "should include tokenSecret and tokenSecretNamespace when both are set"
set:
main.variant: "default"
main.tokenSecret: "my-token-secret"
main.tokenSecretNamespace: "my-token-namespace"
asserts:
Expand All @@ -105,6 +145,7 @@ tests:

- it: "should include helmRepoUrl when multiSourceConfig.helmRepoUrl is set"
set:
main.variant: "default"
main.multiSourceConfig.helmRepoUrl: "https://charts.example.com/"
asserts:
- exists:
Expand All @@ -115,6 +156,7 @@ tests:

- it: "should include clusterGroupChartVersion when set"
set:
main.variant: "default"
main.multiSourceConfig.clusterGroupChartVersion: "1.0.0"
asserts:
- exists:
Expand All @@ -125,6 +167,7 @@ tests:

- it: "should include analyticsUUID when set"
set:
main.variant: "default"
main.analyticsUUID: "uuid-1234"
asserts:
- exists:
Expand All @@ -135,6 +178,7 @@ tests:

- it: "should include experimentalCapabilities when set"
set:
main.variant: "default"
main.experimentalCapabilities: "some-feature"
asserts:
- exists:
Expand All @@ -146,6 +190,7 @@ tests:
- it: "should include extraParameters when set"
set:
main:
variant: "default"
extraParameters:
- name: "param1"
value: "value1"
Expand All @@ -169,6 +214,8 @@ tests:

- it: "should include extraValueFiles when set"
set:
main:
variant: "default"
global:
extraValueFiles:
- "file1.yaml"
Expand Down
6 changes: 5 additions & 1 deletion tests/pattern_default_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ release:
name: release-test
tests:
- it: Should output default values
set:
main.variant: "default"
asserts:
- hasDocuments:
count: 1
Expand All @@ -16,8 +18,10 @@ tests:
name: release-test
namespace: openshift-operators
- equal:
path: spec.variant
value: "default"
- notExists:
path: spec.clusterGroupName
value: default
- equal:
path: spec.gitSpec.targetRepo
value: https://github.com/pattern-clone/mypattern
Expand Down
2 changes: 2 additions & 0 deletions tests/pattern_no_cr_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ tests:
- it: Should output a pattern if repoURL is set
set:
main:
variant: "default"
git:
repoURL: foo.bar
asserts:
Expand All @@ -33,6 +34,7 @@ tests:
- it: Should output a pattern if repoUpstreamURL is set
set:
main:
variant: "default"
git:
repoUpstreamURL: foo.bar
asserts:
Expand Down
2 changes: 2 additions & 0 deletions tests/pattern_snapshot_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ release:
name: release-test
tests:
- it: gitspec.targetRepo should match snapshot
set:
main.variant: "default"
asserts:
- matchSnapshot:
path: spec.gitSpec.targetRepo
17 changes: 17 additions & 0 deletions tests/subscription_namespace_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ templates:
tests:
- it: Should use default openshift-operators namespace for subscription
template: templates/subscription.yaml
set:
main.variant: "default"
asserts:
- equal:
path: metadata.namespace
Expand All @@ -16,6 +18,7 @@ tests:
template: templates/subscription.yaml
set:
main:
variant: "default"
patternsOperator:
subscriptionNamespace: custom-namespace
asserts:
Expand All @@ -27,6 +30,8 @@ tests:
template: templates/pattern.yaml
release:
name: release-test
set:
main.variant: "default"
asserts:
- equal:
path: metadata.namespace
Expand All @@ -38,6 +43,7 @@ tests:
name: release-test
set:
main:
variant: "default"
patternsOperator:
subscriptionNamespace: custom-namespace
asserts:
Expand All @@ -47,6 +53,8 @@ tests:

- it: Should use default openshift-operators namespace for configmap
template: templates/pattern-operator-configmap.yaml
set:
main.variant: "default"
asserts:
- equal:
path: metadata.namespace
Expand All @@ -56,6 +64,7 @@ tests:
template: templates/pattern-operator-configmap.yaml
set:
main:
variant: "default"
patternsOperator:
subscriptionNamespace: custom-namespace
asserts:
Expand All @@ -65,6 +74,8 @@ tests:

- it: Should not create namespace when using default openshift-operators
template: templates/subscription-namespace.yaml
set:
main.variant: "default"
asserts:
- hasDocuments:
count: 0
Expand All @@ -73,6 +84,7 @@ tests:
template: templates/subscription-namespace.yaml
set:
main:
variant: "default"
patternsOperator:
subscriptionNamespace: custom-namespace
asserts:
Expand Down Expand Up @@ -101,6 +113,7 @@ tests:
template: templates/subscription-namespace.yaml
set:
main:
variant: "default"
patternsOperator:
enableSubscription: false
asserts:
Expand All @@ -111,6 +124,7 @@ tests:
template: templates/subscription-namespace.yaml
set:
main:
variant: "default"
patternsOperator:
enableSubscription: false
subscriptionNamespace: custom-namespace
Expand All @@ -122,6 +136,7 @@ tests:
template: templates/subscription.yaml
set:
main:
variant: "default"
patternsOperator:
enableSubscription: false
asserts:
Expand All @@ -134,6 +149,7 @@ tests:
name: release-test
set:
main:
variant: "default"
patternsOperator:
enableSubscription: false
asserts:
Expand All @@ -146,6 +162,7 @@ tests:
template: templates/pattern-operator-configmap.yaml
set:
main:
variant: "default"
patternsOperator:
enableSubscription: false
asserts:
Expand Down
9 changes: 7 additions & 2 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,13 @@ main:
# -- Starting CSV for the install of the patterns operator
startingCSV: null

# -- Name of the clusterGroup to be used. Drives the clusterGroup chart
clusterGroupName: default
# -- (DEPRECATED) Name of the clusterGroup to be used. Drives the clusterGroup chart.
# Use main.variant instead. Cannot be set together with main.variant.
clusterGroupName: null

# -- Name of the variant to be used. Drives the clusterGroup chart.
# Replaces main.clusterGroupName. Cannot be set together with main.clusterGroupName.
variant: null

# -- Name of the secret containing access credentials to clone the Git repository to deploy the pattern
# See https://validatedpatterns.io/blog/2023-12-20-private-repos/ for more information
Expand Down