diff --git a/.github/workflows/jsonschema.yaml b/.github/workflows/jsonschema.yaml index 3d57500..b73929e 100644 --- a/.github/workflows/jsonschema.yaml +++ b/.github/workflows/jsonschema.yaml @@ -30,4 +30,6 @@ jobs: - name: Verify ClusterGroup values.schema.json run: | - check-jsonschema --schemafile ./values.schema.json "values.yaml" + check-jsonschema --schemafile ./values.schema.json \ + "values.yaml" \ + "tests/fixtures/values-cluster-group-schema.yaml" diff --git a/Chart.yaml b/Chart.yaml index 582351a..c065c65 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -3,7 +3,7 @@ description: A Helm chart to create per-clustergroup ArgoCD applications and any keywords: - pattern name: clustergroup -version: 0.9.49 +version: 0.9.50 home: https://github.com/validatedpatterns/clustergroup-chart maintainers: - name: Validated Patterns Team diff --git a/README.md b/README.md index 7a7bca7..36839ba 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # clustergroup -![Version: 0.9.49](https://img.shields.io/badge/Version-0.9.49-informational?style=flat-square) +![Version: 0.9.50](https://img.shields.io/badge/Version-0.9.50-informational?style=flat-square) A Helm chart to create per-clustergroup ArgoCD applications and any required namespaces or subscriptions. @@ -8,6 +8,7 @@ This chart is used to set up the basic building blocks in [Validated Patterns](h ### Notable changes +* v0.9.50: Ensure schema matches what we template. Add missing elements and correct some entries. * v0.9.49: Boolean Templates in override values now also render correctly * v0.9.48: Templates in override values now render * v0.9.45: Default value of `resourceTrackingMethod` is now `annotation` diff --git a/README.md.gotmpl b/README.md.gotmpl index 4dbf142..07606c0 100644 --- a/README.md.gotmpl +++ b/README.md.gotmpl @@ -9,6 +9,7 @@ This chart is used to set up the basic building blocks in [Validated Patterns](h ### Notable changes +* v0.9.50: Ensure schema matches what we template. Add missing elements and correct some entries. * v0.9.49: Boolean Templates in override values now also render correctly * v0.9.48: Templates in override values now render * v0.9.45: Default value of `resourceTrackingMethod` is now `annotation` diff --git a/tests/application_target_cluster_test.yaml b/tests/application_target_cluster_test.yaml new file mode 100644 index 0000000..623a15e --- /dev/null +++ b/tests/application_target_cluster_test.yaml @@ -0,0 +1,28 @@ +suite: Test clusterGroup.targetCluster on Argo CD Applications +templates: + - templates/plumbing/applications.yaml +release: + name: release-test +tests: + - it: should set spec.destination.name from clusterGroup.targetCluster + set: + global: + repoURL: https://github.com/validatedpatterns/multicloud-gitops + multiSourceRepoUrl: https://charts.validatedpatterns.io + clusterGroup: + name: example + targetCluster: my-remote-cluster + namespaces: [] + applications: + acm: + name: acm + namespace: open-cluster-management + project: hub + chart: acm + chartVersion: 0.1.* + asserts: + - hasDocuments: + count: 1 + - equal: + path: spec.destination.name + value: my-remote-cluster diff --git a/tests/fixtures/values-cluster-group-schema.yaml b/tests/fixtures/values-cluster-group-schema.yaml new file mode 100644 index 0000000..f97964c --- /dev/null +++ b/tests/fixtures/values-cluster-group-schema.yaml @@ -0,0 +1,31 @@ +# Minimal values exercised by check-jsonschema in CI to keep clusterGroup fields +# used by templates aligned with values.schema.json. +global: + options: + syncPolicy: Automatic + installPlanApproval: Automatic + useCSV: true + multiSourceRepoUrl: https://charts.validatedpatterns.io + +clusterGroup: + name: schema-fixture + targetCluster: spoke-cluster-1 + namespaces: [] + sharedValueFiles: + - values-{{ $.Values.clusterGroup.name }}.yaml + applications: + schema-fixture-app: + name: schema-fixture-app + namespace: fixture-ns + project: default + path: charts/fixture + overrides: + - name: plain-override + value: plain + - name: tpl-override + value: "{{ .Values.global.multiSourceRepoUrl }}" + forceString: true + syncPolicy: manual + fileParameters: + - name: some-values + path: secrets://config/values.yaml diff --git a/values.schema.json b/values.schema.json index 8c20a22..7828ec9 100644 --- a/values.schema.json +++ b/values.schema.json @@ -178,6 +178,10 @@ "readOnly": true, "description": "URL of the pattern's git repository, it is set automatically by the pattern's operator" }, + "multiSourceRepoUrl": { + "type": "string", + "description": "Default Helm repository URL for multisource Argo CD Applications when an application entry does not set repoURL. Passed as a Helm parameter and used by templates under global.multiSourceRepoUrl." + }, "hubClusterDomain": { "type": "string", "readOnly": true, @@ -516,6 +520,17 @@ "disabled": { "type": "boolean", "description": "Whether to disable namespace creation. If set to true, the namespace will be skipped." + }, + "operatorGroup": { + "type": "boolean", + "description": "When false, no OperatorGroup is created for this namespace map entry." + }, + "targetNamespaces": { + "type": "array", + "description": "OperatorGroup spec.targetNamespaces entries; when set and non-empty, overrides the default single-namespace target.", + "items": { + "type": "string" + } } } }, @@ -613,19 +628,66 @@ "description": "List of extra fields that will be passed to ArgoCD." }, "overrides": { - "type": "object" + "type": "array", + "description": "Extra Helm parameters for this application; rendered under spec.source.helm.parameters or spec.sources[1].helm.parameters.", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string", + "description": "Parameter value; may contain Helm tpl expressions evaluated with the chart root context." + }, + "forceString": { + "type": "boolean", + "description": "When true, sets forceString on the Argo CD Application helm parameter." + } + }, + "required": [ + "name", + "value" + ] + } }, "fileParameters": { "type": "array", - "description": "FileParameters are file parameters to the helm template" + "description": "FileParameters are file parameters to the helm template", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string" + }, + "path": { + "type": "string" + } + }, + "required": [ + "name", + "path" + ] + } }, "ignoreDifferences": { "type": "array", "description": "IgnoreDifferences is a list of resources and their fields which should be ignored during comparison" }, "syncPolicy": { - "type": "object", - "description": "SyncPolicy controls when and how a sync will be performed" + "anyOf": [ + { + "type": "string", + "description": "When set to Manual (any case), Argo CD syncPolicy is omitted for this application. Automatic uses the chart default. Other strings follow the same lowercasing rules in templates." + }, + { + "type": "object", + "description": "Passed through to the Application spec.syncPolicy field as JSON." + } + ], + "description": "SyncPolicy controls when and how a sync will be performed; may be a string (e.g. Manual) or an object merged into the Application." }, "namespace": { "type": "string",