diff --git a/.github/workflows/superlinter.yml b/.github/workflows/superlinter.yml index 096abf1..0bd9430 100644 --- a/.github/workflows/superlinter.yml +++ b/.github/workflows/superlinter.yml @@ -29,6 +29,7 @@ jobs: DEFAULT_BRANCH: main GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # These are the validation we disable atm + VALIDATE_GIT_COMMITLINT: false VALIDATE_JSON_PRETTIER: false VALIDATE_KUBERNETES_KUBECONFORM: false VALIDATE_MARKDOWN: false @@ -41,7 +42,6 @@ jobs: VALIDATE_NATURAL_LANGUAGE: false VALIDATE_SPELL_CODESPELL: false VALIDATE_PYTHON_BLACK: false - VALIDATE_PYTHON_PYINK: false VALIDATE_PYTHON_PYLINT: false VALIDATE_PYTHON_RUFF_FORMAT: false VALIDATE_SHELL_SHFMT: false diff --git a/Chart.yaml b/Chart.yaml index 6bddeb0..84539f8 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -3,5 +3,5 @@ description: A Helm chart to install an ansible-automation-platform instance keywords: - pattern name: ansible-automation-platform-instance -version: 0.1.1 +version: 0.1.2 dependencies: diff --git a/Makefile b/Makefile index 0053249..7621470 100644 --- a/Makefile +++ b/Makefile @@ -34,9 +34,10 @@ helm-docs: ## Generates README.md from values.yaml test: helm-lint helm-unittest ## Runs helm lint and unit tests .PHONY: super-linter -super-linter: ## Runs super linter locally +super-linter: ## Runs super linter locally (mirrors .github/workflows/superlinter.yml) rm -rf .mypy_cache - podman run -e RUN_LOCAL=true -e USE_FIND_ALGORITHM=true \ + podman run -e RUN_LOCAL=true -e USE_FIND_ALGORITHM=true \ + -e VALIDATE_GIT_COMMITLINT=false \ -e VALIDATE_JSON_PRETTIER=false \ -e VALIDATE_KUBERNETES_KUBECONFORM=false \ -e VALIDATE_MARKDOWN=false \ @@ -49,11 +50,10 @@ super-linter: ## Runs super linter locally -e VALIDATE_NATURAL_LANGUAGE=false \ -e VALIDATE_SPELL_CODESPELL=false \ -e VALIDATE_PYTHON_BLACK=false \ - -e VALIDATE_PYTHON_PYINK=false \ -e VALIDATE_PYTHON_PYLINT=false \ -e VALIDATE_PYTHON_RUFF_FORMAT=false \ -e VALIDATE_SHELL_SHFMT=false \ -e VALIDATE_TRIVY=false \ -v $(PWD):/tmp/lint:rw,z \ -w /tmp/lint \ - ghcr.io/super-linter/super-linter:slim-v8 + ghcr.io/super-linter/super-linter:slim-v8.6.0 diff --git a/README.md b/README.md index 7dc6047..89b0d80 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,45 @@ # ansible-automation-platform-instance -![Version: 0.1.1](https://img.shields.io/badge/Version-0.1.1-informational?style=flat-square) +![Version: 0.1.2](https://img.shields.io/badge/Version-0.1.2-informational?style=flat-square) A Helm chart to install an ansible-automation-platform instance This chart is used to set up the Ansible Automation Platform Operator version 2.5. +Automation hub is optional and disabled by default. + +When automation hub is enabled, content storage uses the ReadWriteMany CephFS +storage class created by the validated patterns OpenShift Data Foundations chart +(`ocs-storagecluster-cephfs`). Redis and hub PostgreSQL use +`ocs-storagecluster-ceph-rbd` from that same chart. Install the OpenShift Data +Foundations chart in the cluster before enabling hub. + +Releases before 2.5 deploy hub as a standalone `AutomationHub` resource. +Releases from 2.5 onward configure hub on the `AnsibleAutomationPlatform` resource. + +Automation orchestrator is installed by the automation-orchestrator chart, with +its PostgreSQL cluster installed by the cloudnative-pg chart. + ## Values | Key | Type | Default | Description | |-----|------|---------|-------------| -| aap.eda_disabled | bool | `false` | | -| aap.hub_disabled | bool | `true` | | -| aap.lightspeed_disabled | bool | `true` | | -| eePullSecret.key | string | `"secret/data/hub/ee-pull-secret"` | | -| eePullSecret.manage | bool | `false` | | -| global.hubClusterDomain | string | `"example.com"` | | -| secretStore.kind | string | `"ClusterSecretStore"` | | -| secretStore.name | string | `"vault-backend"` | | +| aap.eda_disabled | bool | `false` | Disable Event-Driven Ansible. | +| aap.hub_disabled | bool | `true` | Disable automation hub. Enable hub only when the validated patterns OpenShift Data Foundations chart is installed in the same cluster. | +| aap.lightspeed_disabled | bool | `true` | Disable Ansible Lightspeed. | +| aap.release | string | `"2.5"` | Ansible Automation Platform release. Releases before 2.5 deploy automation hub as a standalone AutomationHub resource. | +| eePullSecret.key | string | `"secret/data/hub/ee-pull-secret"` | Vault path passed to the ExternalSecret extract key. | +| eePullSecret.manage | bool | `false` | Create an ExternalSecret for the automation controller execution environment pull secret. | +| global.hubClusterDomain | string | `"example.com"` | Domain used in the OpenShift console link for the platform route. | +| hub.fileStorageAccessMode | string | `"ReadWriteMany"` | Access mode for automation hub content. CephFS from the OpenShift Data Foundations chart provides ReadWriteMany. | +| hub.fileStorageSize | string | `"100Gi"` | Size of the automation hub content volume. | +| hub.fileStorageStorageClass | string | `"ocs-storagecluster-cephfs"` | Storage class for automation hub content. Created by the OpenShift Data Foundations chart. | +| hub.postgresStorageClass | string | `"ocs-storagecluster-ceph-rbd"` | Storage class for the automation hub PostgreSQL volume. Created by the OpenShift Data Foundations chart. | +| hub.redisStorageClass | string | `"ocs-storagecluster-ceph-rbd"` | Storage class for the automation hub Redis volume. Created by the OpenShift Data Foundations chart. | +| hub.redisStorageSize | string | `"10Gi"` | Size of the automation hub Redis volume. | +| hub.storageType | string | `"file"` | Automation hub content backend. file uses the CephFS ReadWriteMany class from the OpenShift Data Foundations chart. | +| secretStore.kind | string | `"ClusterSecretStore"` | External Secrets store kind. | +| secretStore.name | string | `"vault-backend"` | External Secrets store used when eePullSecret.manage is true. | ---------------------------------------------- Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2) diff --git a/README.md.gotmpl b/README.md.gotmpl index a2ac04d..2c2ab1d 100644 --- a/README.md.gotmpl +++ b/README.md.gotmpl @@ -7,6 +7,20 @@ This chart is used to set up the Ansible Automation Platform Operator version 2.5. +Automation hub is optional and disabled by default. + +When automation hub is enabled, content storage uses the ReadWriteMany CephFS +storage class created by the validated patterns OpenShift Data Foundations chart +(`ocs-storagecluster-cephfs`). Redis and hub PostgreSQL use +`ocs-storagecluster-ceph-rbd` from that same chart. Install the OpenShift Data +Foundations chart in the cluster before enabling hub. + +Releases before 2.5 deploy hub as a standalone `AutomationHub` resource. +Releases from 2.5 onward configure hub on the `AnsibleAutomationPlatform` resource. + +Automation orchestrator is installed by the automation-orchestrator chart, with +its PostgreSQL cluster installed by the cloudnative-pg chart. + {{ template "chart.homepageLine" . }} {{ template "chart.maintainersSection" . }} diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl new file mode 100644 index 0000000..45c19df --- /dev/null +++ b/templates/_helpers.tpl @@ -0,0 +1,15 @@ +{{/* +Hub content, Redis, and PostgreSQL storage for the validated patterns +OpenShift Data Foundations chart. That chart creates: + ocs-storagecluster-cephfs ReadWriteMany filesystem (hub content) + ocs-storagecluster-ceph-rbd ReadWriteOnce block (Redis and hub PostgreSQL) +*/}} +{{- define "aap.hubStorage" -}} +storage_type: {{ .Values.hub.storageType }} +file_storage_access_mode: {{ .Values.hub.fileStorageAccessMode }} +file_storage_size: {{ .Values.hub.fileStorageSize }} +file_storage_storage_class: {{ .Values.hub.fileStorageStorageClass }} +redis_storage_class: {{ .Values.hub.redisStorageClass }} +redis_storage_size: {{ .Values.hub.redisStorageSize }} +postgres_storage_class: {{ .Values.hub.postgresStorageClass }} +{{- end -}} diff --git a/templates/aap.yaml b/templates/aap.yaml index c24e988..76542ee 100644 --- a/templates/aap.yaml +++ b/templates/aap.yaml @@ -12,7 +12,12 @@ spec: disabled: false eda: disabled: {{ coalesce .Values.aap.eda_disabled "false" }} +{{- if semverCompare ">=2.5.0" (toString .Values.aap.release) }} hub: - disabled: {{ coalesce .Values.aap.hub_disabled "false" }} + disabled: {{ .Values.aap.hub_disabled }} +{{- if not .Values.aap.hub_disabled }} + {{- include "aap.hubStorage" . | nindent 4 }} +{{- end }} +{{- end }} lightspeed: disabled: {{ coalesce .Values.aap.lightspeed_disabled "false" }} diff --git a/templates/automationhub.yaml b/templates/automationhub.yaml new file mode 100644 index 0000000..2f3b6ad --- /dev/null +++ b/templates/automationhub.yaml @@ -0,0 +1,10 @@ +{{- if and (not .Values.aap.hub_disabled) (semverCompare "<2.5.0" (toString .Values.aap.release)) }} +--- +apiVersion: automationhub.ansible.com/v1beta1 +kind: AutomationHub +metadata: + name: hub + namespace: ansible-automation-platform +spec: + {{- include "aap.hubStorage" . | nindent 2 }} +{{- end }} diff --git a/tests/aap_test.yaml b/tests/aap_test.yaml new file mode 100644 index 0000000..4f8ec36 --- /dev/null +++ b/tests/aap_test.yaml @@ -0,0 +1,131 @@ +suite: ansible automation platform instance +templates: + - aap.yaml +tests: + - it: disables hub by default + asserts: + - hasDocuments: + count: 1 + - isKind: + of: AnsibleAutomationPlatform + - equal: + path: spec.hub.disabled + value: true + - notExists: + path: spec.hub.storage_type + - notExists: + path: spec.hub.file_storage_storage_class + - it: configures hub on the platform resource for release 2.5 + set: + aap.hub_disabled: false + asserts: + - hasDocuments: + count: 1 + - equal: + path: spec.hub.disabled + value: false + - equal: + path: spec.hub.storage_type + value: file + - equal: + path: spec.hub.file_storage_access_mode + value: ReadWriteMany + - equal: + path: spec.hub.file_storage_size + value: 100Gi + - equal: + path: spec.hub.file_storage_storage_class + value: ocs-storagecluster-cephfs + - equal: + path: spec.hub.redis_storage_class + value: ocs-storagecluster-ceph-rbd + - equal: + path: spec.hub.redis_storage_size + value: 10Gi + - equal: + path: spec.hub.postgres_storage_class + value: ocs-storagecluster-ceph-rbd + - it: honors hub storage overrides + set: + aap.hub_disabled: false + hub.fileStorageStorageClass: custom-cephfs + hub.fileStorageSize: 200Gi + hub.redisStorageClass: custom-rbd + asserts: + - equal: + path: spec.hub.file_storage_storage_class + value: custom-cephfs + - equal: + path: spec.hub.file_storage_size + value: 200Gi + - equal: + path: spec.hub.redis_storage_class + value: custom-rbd + - it: omits nested hub on releases before 2.5 + set: + aap.release: "2.4" + aap.hub_disabled: false + asserts: + - hasDocuments: + count: 1 + - isKind: + of: AnsibleAutomationPlatform + - notExists: + path: spec.hub +--- +suite: standalone automation hub +templates: + - automationhub.yaml +tests: + - it: does not render hub by default + asserts: + - hasDocuments: + count: 0 + - it: does not render hub for release 2.5 when hub is enabled + set: + aap.hub_disabled: false + asserts: + - hasDocuments: + count: 0 + - it: deploys a standalone AutomationHub on releases before 2.5 + set: + aap.release: "2.4" + aap.hub_disabled: false + asserts: + - hasDocuments: + count: 1 + - isKind: + of: AutomationHub + - equal: + path: metadata.name + value: hub + - equal: + path: spec.storage_type + value: file + - equal: + path: spec.file_storage_access_mode + value: ReadWriteMany + - equal: + path: spec.file_storage_storage_class + value: ocs-storagecluster-cephfs + - equal: + path: spec.redis_storage_class + value: ocs-storagecluster-ceph-rbd + - equal: + path: spec.postgres_storage_class + value: ocs-storagecluster-ceph-rbd + - it: skips standalone hub when hub is disabled on an older release + set: + aap.release: "2.4" + asserts: + - hasDocuments: + count: 0 + - it: accepts an unquoted release number + set: + aap.release: 2.4 + aap.hub_disabled: false + asserts: + - hasDocuments: + count: 1 + - isKind: + of: AutomationHub diff --git a/values.yaml b/values.yaml index e640eee..c2f889b 100644 --- a/values.yaml +++ b/values.yaml @@ -1,16 +1,44 @@ --- global: + # -- Domain used in the OpenShift console link for the platform route. hubClusterDomain: example.com eePullSecret: + # -- Create an ExternalSecret for the automation controller execution environment pull secret. manage: false + # -- Vault path passed to the ExternalSecret extract key. key: secret/data/hub/ee-pull-secret aap: + # -- Ansible Automation Platform release. Releases before 2.5 deploy automation hub as a standalone AutomationHub resource. + release: "2.5" + # -- Disable Event-Driven Ansible. eda_disabled: false + # -- Disable automation hub. Enable hub only when the validated patterns OpenShift Data Foundations chart is installed in the same cluster. hub_disabled: true + # -- Disable Ansible Lightspeed. lightspeed_disabled: true +# Storage defaults match the storage classes created by the validated patterns +# OpenShift Data Foundations chart (ocs-storagecluster-cephfs and ocs-storagecluster-ceph-rbd). +hub: + # -- Automation hub content backend. file uses the CephFS ReadWriteMany class from the OpenShift Data Foundations chart. + storageType: file + # -- Access mode for automation hub content. CephFS from the OpenShift Data Foundations chart provides ReadWriteMany. + fileStorageAccessMode: ReadWriteMany + # -- Size of the automation hub content volume. + fileStorageSize: 100Gi + # -- Storage class for automation hub content. Created by the OpenShift Data Foundations chart. + fileStorageStorageClass: ocs-storagecluster-cephfs + # -- Storage class for the automation hub Redis volume. Created by the OpenShift Data Foundations chart. + redisStorageClass: ocs-storagecluster-ceph-rbd + # -- Size of the automation hub Redis volume. + redisStorageSize: 10Gi + # -- Storage class for the automation hub PostgreSQL volume. Created by the OpenShift Data Foundations chart. + postgresStorageClass: ocs-storagecluster-ceph-rbd + secretStore: + # -- External Secrets store used when eePullSecret.manage is true. name: vault-backend + # -- External Secrets store kind. kind: ClusterSecretStore