diff --git a/api/v1alpha1/helm_cluster_addon.go b/api/v1alpha1/helm_cluster_addon.go index f541a6b..870a8b2 100644 --- a/api/v1alpha1/helm_cluster_addon.go +++ b/api/v1alpha1/helm_cluster_addon.go @@ -32,8 +32,8 @@ const ( HelmClusterAddonLabelSourceName = "helm.deckhouse.io/cluster-addon" ) -// HelmClusterAddon represents a Helm addon that is installed across the whole cluster. -// +// HelmClusterAddon represents a single cluster-wide installation of a Helm chart, which may include custom resource definitions (CRDs) and requires cluster-admin permissions to deploy. Only one instance of a specific chart can be installed at any given time. + // +kubebuilder:object:root=true // +kubebuilder:subresource:status // +kubebuilder:metadata:labels={heritage=deckhouse,module=operator-helm} diff --git a/api/v1alpha1/helm_cluster_addon_chart.go b/api/v1alpha1/helm_cluster_addon_chart.go index a751624..a623fb8 100644 --- a/api/v1alpha1/helm_cluster_addon_chart.go +++ b/api/v1alpha1/helm_cluster_addon_chart.go @@ -27,7 +27,7 @@ const ( HelmClusterAddonChartLabelSourceName = "helm.deckhouse.io/cluster-addon-chart" ) -// HelmClusterAddonChart represents a Helm chart and its versions from specific repository. +// HelmClusterAddonChart represents a specific Helm chart discovered within a HelmClusterAddonRepository. These resources are automatically managed during repository synchronization and are immutable to user modifications. // // +kubebuilder:object:root=true // +kubebuilder:subresource:status diff --git a/api/v1alpha1/helm_cluster_addon_repository.go b/api/v1alpha1/helm_cluster_addon_repository.go index e3d65ca..d5b0436 100644 --- a/api/v1alpha1/helm_cluster_addon_repository.go +++ b/api/v1alpha1/helm_cluster_addon_repository.go @@ -28,7 +28,7 @@ const ( HelmClusterAddonRepositoryLabelSourceName = "helm.deckhouse.io/cluster-addon-repository" ) -// HelmClusterAddonRepository represents a Helm or an OCI compliant repository with Helm charts. +// HelmClusterAddonRepository represents a Helm or OCI-compliant repository containing Helm charts that can be referenced by HelmClusterAddon resources. // // +kubebuilder:object:root=true // +kubebuilder:subresource:status diff --git a/crds/doc-ru-helmclusteraddoncharts.yaml b/crds/doc-ru-helmclusteraddoncharts.yaml index 2755585..a7e7948 100644 --- a/crds/doc-ru-helmclusteraddoncharts.yaml +++ b/crds/doc-ru-helmclusteraddoncharts.yaml @@ -8,7 +8,7 @@ spec: - name: v1alpha1 schema: openAPIV3Schema: - description: HelmClusterAddonChart описывает Helm-чарт и его версии из определённого репозитория. + description: HelmClusterAddonChart представляет собой Helm-чарт, обнаруженный в HelmClusterAddonRepository. Эти ресурсы создаются автоматически во время синхронизации репозитория и защищены от изменений. properties: status: properties: diff --git a/crds/doc-ru-helmclusteraddonrepositories.yaml b/crds/doc-ru-helmclusteraddonrepositories.yaml index 958b336..a85d2a5 100644 --- a/crds/doc-ru-helmclusteraddonrepositories.yaml +++ b/crds/doc-ru-helmclusteraddonrepositories.yaml @@ -8,7 +8,7 @@ spec: - name: v1alpha1 schema: openAPIV3Schema: - description: HelmClusterAddonRepository описывает Helm-репозиторий или OCI-репозиторий с Helm-чартами. + description: HelmClusterAddonRepository представляет собой Helm- или OCI-совместимый репозиторий, содержащий Helm-чарты, на которые могут ссылаться ресурсы HelmClusterAddon. properties: spec: properties: diff --git a/crds/doc-ru-helmclusteraddons.yaml b/crds/doc-ru-helmclusteraddons.yaml index d5da75a..4ed423d 100644 --- a/crds/doc-ru-helmclusteraddons.yaml +++ b/crds/doc-ru-helmclusteraddons.yaml @@ -8,7 +8,7 @@ spec: - name: v1alpha1 schema: openAPIV3Schema: - description: HelmClusterAddon описывает Helm-аддон, устанавливаемый на уровне кластера. + description: HelmClusterAddon представляет собой единичный экземпляр установки Helm-чарта в масштабе всего кластера, который может включать в себя определения пользовательских ресурсов (CRD) и требует прав cluster-admin для развертывания. В каждый момент времени может быть установлен только один экземпляр конкретного чарта. properties: spec: properties: diff --git a/crds/helmclusteraddoncharts.yaml b/crds/helmclusteraddoncharts.yaml index a6c0b83..b9cc38e 100644 --- a/crds/helmclusteraddoncharts.yaml +++ b/crds/helmclusteraddoncharts.yaml @@ -22,8 +22,9 @@ spec: - name: v1alpha1 schema: openAPIV3Schema: - description: HelmClusterAddonChart represents a Helm chart and its versions - from specific repository. + description: HelmClusterAddonChart represents a specific Helm chart discovered + within a HelmClusterAddonRepository. These resources are automatically managed + during repository synchronization and are immutable to user modifications. properties: apiVersion: description: |- diff --git a/crds/helmclusteraddonrepositories.yaml b/crds/helmclusteraddonrepositories.yaml index c7442d1..c75cddc 100644 --- a/crds/helmclusteraddonrepositories.yaml +++ b/crds/helmclusteraddonrepositories.yaml @@ -27,8 +27,9 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: HelmClusterAddonRepository represents a Helm or an OCI compliant - repository with Helm charts. + description: HelmClusterAddonRepository represents a Helm or OCI-compliant + repository containing Helm charts that can be referenced by HelmClusterAddon + resources. properties: apiVersion: description: |- diff --git a/crds/helmclusteraddons.yaml b/crds/helmclusteraddons.yaml index cff9fb2..0bf8bcc 100644 --- a/crds/helmclusteraddons.yaml +++ b/crds/helmclusteraddons.yaml @@ -35,8 +35,6 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: HelmClusterAddon represents a Helm addon that is installed across - the whole cluster. properties: apiVersion: description: |- diff --git a/docs/README.md b/docs/README.md index a73f907..03b3500 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4,9 +4,9 @@ description: "Deckhouse Kubernetes Platform — the operator-helm module for dec weight: 10 --- -The `operator-helm` module provides declarative management of Helm chart deployments for cluster administrators and DevOps engineers. It deploys applications through custom resources, reducing the amount of manual configuration required. +The `operator-helm` module allows you to declaratively manage Helm chart deployments in the cluster. It is designed for cluster administrators and DevOps engineers and automates application installation using custom resources. -The module acts as a Kubernetes operator that reconciles the desired state described in HelmClusterAddon resources with the actual Helm releases in the cluster. +The module controller monitors the state of HelmClusterAddon resources and automatically reconciles Helm releases in the cluster with the specified parameters. ## Main Features @@ -17,4 +17,24 @@ The module acts as a Kubernetes operator that reconciles the desired state descr - TLS verification and authentication support for private Helm and OCI repositories. - Management through CLI (`d8 k`) or the Deckhouse web interface. +{% alert level="info" %} +The module is under active development. Future plans include: + +- adding new custom resources to allow non-admin users to install charts; +- migrating to chart deployment using [Nelm](https://github.com/werf/nelm). +{% endalert %} + +## Custom Resources + +The following custom resources are used to manage Helm charts in the module: + +- **HelmClusterAddonRepository** — a Helm or OCI registry containing Helm charts for deployment in the cluster. +- **HelmClusterAddonChart** — a Helm chart discovered in the connected repository. These resources are automatically created and updated by the controller during repository synchronization and are protected from manual changes. +- **HelmClusterAddon** — a declarative description of a specific Helm chart release. The resource contains the target chart version, the namespace name for deployment, and custom values. + +## Limitations + +- Admin privileges (the `cluster-admin` role) are required to manage HelmClusterAddon and HelmClusterAddonRepository resources. +- A HelmClusterAddon resource referencing a specific HelmClusterAddonChart can only be created as a single instance in the cluster. This is because Helm charts can contain custom resource definitions (CRDs), and installing them multiple times at the cluster level is not allowed. + See [usage examples](example.html) for practical scenarios. diff --git a/docs/README.ru.md b/docs/README.ru.md index 55befb0..697a7a7 100644 --- a/docs/README.ru.md +++ b/docs/README.ru.md @@ -4,9 +4,9 @@ description: "Deckhouse Kubernetes Platform — модуль operator-helm дл weight: 10 --- -Модуль `operator-helm` предназначен для декларативного управления развёртыванием Helm-чартов. Ориентирован на администраторов кластеров и DevOps-инженеров, которым необходимо автоматизировать установку приложений через кастомные ресурсы. +Модуль `operator-helm` позволяет декларативно управлять развёртыванием Helm-чартов в кластере. Он ориентирован на администраторов кластеров и DevOps-инженеров и автоматизирует установку приложений с помощью кастомных ресурсов. -Модуль работает как оператор Kubernetes, приводя фактическое состояние Helm-релизов в соответствие с описанным в ресурсах HelmClusterAddon. +Контроллер модуля отслеживает состояние ресурсов HelmClusterAddon и автоматически приводит Helm-релизы в кластере в соответствие с заданными параметрами. ## Основные возможности @@ -17,4 +17,24 @@ weight: 10 - Поддержка проверки TLS-сертификатов и аутентификации для приватных OCI и Helm репозиториев. - Управление через CLI (`d8 k`) или веб-интерфейс Deckhouse. +{% alert level="info" %} +Модуль находится на стадии активного развития. В будущем планируется: + +- добавить новые кастомные ресурсы для установки чартов пользователями без привилегий администратора; +- перейти на развёртывание чартов с помощью [Nelm](https://github.com/werf/nelm). +{% endalert %} + +## Кастомные ресурсы + +Для управления Helm-чартами в модуле используются следующие кастомные ресурсы: + +- **HelmClusterAddonRepository** — репозиторий Helm или OCI, содержащий Helm-чарты для последующей установки в кластере. +- **HelmClusterAddonChart** — Helm-чарт, обнаруженный в подключённом репозитории. Эти ресурсы создаются и обновляются контроллером автоматически при синхронизации репозиториев и защищены от изменений. +- **HelmClusterAddon** — декларативное описание конкретного релиза Helm-чарта. Ресурс содержит целевую версию чарта, имя пространства имён для развёртывания и пользовательские значения параметров. + +## Ограничения + +- Для управления ресурсами HelmClusterAddon и HelmClusterAddonRepository требуются права администратора кластера (роль `cluster-admin`). +- Ресурс HelmClusterAddon, ссылающийся на заданный HelmClusterAddonChart, может быть создан в кластере только в единственном экземпляре. Это обусловлено тем, что Helm-чарты могут содержать определения кастомных ресурсов (CRD), повторная установка которых на уровне кластера недопустима. + Примеры использования приведены в разделе [примеры использования](example.html). diff --git a/tests/e2e/scripts/kind-d8-ci.sh b/tests/e2e/scripts/kind-d8-ci.sh index c0b54f0..8cb6756 100755 --- a/tests/e2e/scripts/kind-d8-ci.sh +++ b/tests/e2e/scripts/kind-d8-ci.sh @@ -47,6 +47,8 @@ D8_REGISTRY_ADDRESS=registry.deckhouse.io D8_REGISTRY_PATH=${D8_REGISTRY_ADDRESS}/deckhouse/ce D8_LICENSE_KEY= +OS_NAME=${OS_NAME:-} + KIND_INSTALL_DIRECTORY=$PARENT_DIR/kind/bin KIND_PATH=kind KIND_VERSION=v0.27.0 @@ -164,7 +166,8 @@ os_detect() { OS_NAME=mac else - noop # Unknown OS + echo "Failed to detect operating system. Use --os linux or --os mac." + exit 1 fi fi @@ -215,13 +218,13 @@ memory_check() { MEMORY_TOTAL_BYTES=$(sysctl -n hw.memsize 2>/dev/null) fi - if [[ ("$MEMORY_TOTAL_BYTES" -gt "0") && ("$MEMORY_TOTAL_BYTES" -lt "$REQUIRE_MEMORY_MIN_BYTES") ]]; then + if [[ -n "$MEMORY_TOTAL_BYTES" && ("$MEMORY_TOTAL_BYTES" -gt "0") && ("$MEMORY_TOTAL_BYTES" -lt "$REQUIRE_MEMORY_MIN_BYTES") ]]; then echo "Insufficient memory to install Deckhouse Kubernetes Platform." echo "Deckhouse Kubernetes Platform requires at least 4 gigabytes of memory." exit 1 fi - if [[ ("$MEMORY_TOTAL_BYTES" -eq "0") || (-z "$MEMORY_TOTAL_BYTES") ]]; then + if [[ -z "$MEMORY_TOTAL_BYTES" || ("$MEMORY_TOTAL_BYTES" -eq "0") ]]; then echo "Can't get the total memory value." echo "Note, that Deckhouse Kubernetes Platform requires at least 4 gigabytes of memory." echo "Press enter to continue..." @@ -428,6 +431,7 @@ spec: EOF if [[ -n "$D8_LICENSE_KEY" ]]; then + docker login -u license-token -p $D8_LICENSE_KEY generate_ee_access_string "$D8_LICENSE_KEY" cat <>${KIND_CONFIG_DIR}/config.yml ---