From 17d1d7bf9a57b6c922fbe971ce7042bc4be23b7b Mon Sep 17 00:00:00 2001 From: Steffen Brunner Date: Tue, 24 Jun 2025 11:36:21 +0200 Subject: [PATCH 1/3] feat: flux-config - OCIRepository and HelmRelease configurations added --- .../flux-config/templates/helm-release.yml | 15 +++++++ .../flux-config/templates/oci-repository.yml | 15 +++++++ helm/charts/flux-config/values.ci.yaml | 41 +++++++++++++++++++ helm/charts/flux-config/values.yaml | 18 +++++++- 4 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 helm/charts/flux-config/templates/helm-release.yml create mode 100644 helm/charts/flux-config/templates/oci-repository.yml diff --git a/helm/charts/flux-config/templates/helm-release.yml b/helm/charts/flux-config/templates/helm-release.yml new file mode 100644 index 0000000..306cb96 --- /dev/null +++ b/helm/charts/flux-config/templates/helm-release.yml @@ -0,0 +1,15 @@ +{{- range $item := .Values.helmReleases}} + {{- if and ($item) (ne $item.name "")}} +--- +apiVersion: helm.toolkit.fluxcd.io/v2 +kind: HelmRelease +metadata: + name: {{required "A valid value is required! (.Values.helmReleases[].name)" $item.name | lower | quote}} + namespace: {{ $item.namespace | default $.Values.defaults.namespace | lower | quote }} + labels: + openmcp.cloud/blueprint-building-block: "{{ $.Chart.Name }}" + openmcp.cloud/blueprint-building-block-version: "{{ $.Chart.Version }}" +spec: + {{- toYaml $item.spec | nindent 2 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/charts/flux-config/templates/oci-repository.yml b/helm/charts/flux-config/templates/oci-repository.yml new file mode 100644 index 0000000..aeb632f --- /dev/null +++ b/helm/charts/flux-config/templates/oci-repository.yml @@ -0,0 +1,15 @@ +{{- range $item := .Values.ociRepositorys}} + {{- if and ($item) (ne $item.name "")}} +--- +apiVersion: source.toolkit.fluxcd.io/v1 +kind: OCIRepository +metadata: + name: {{required "A valid value is required! (.Values.ociRepositorys[].name)" $item.name | lower | quote}} + namespace: {{ $item.namespace | default $.Values.defaults.namespace | lower | quote }} + labels: + openmcp.cloud/blueprint-building-block: "{{ $.Chart.Name }}" + openmcp.cloud/blueprint-building-block-version: "{{ $.Chart.Version }}" +spec: + {{- toYaml $item.spec | nindent 2 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/charts/flux-config/values.ci.yaml b/helm/charts/flux-config/values.ci.yaml index af2fcf2..0abe7a2 100644 --- a/helm/charts/flux-config/values.ci.yaml +++ b/helm/charts/flux-config/values.ci.yaml @@ -1,6 +1,47 @@ --- ###! /!\ this file is only used in github pipeline to template a valid and NOT empty helm manifest! ##### ######################################################################################################################## +ociRepositorys: + - name: podinfo + namespace: "default" + spec: + interval: 5m0s + url: oci://ghcr.io/stefanprodan/manifests/podinfo + ref: + tag: lates +######################################################################################################################## +helmReleases: + - name: podinfo + namespace: "default" + spec: + interval: 10m + timeout: 5m + chart: + spec: + chart: podinfo + version: '6.5.*' + sourceRef: + kind: HelmRepository + name: podinfo + interval: 5m + releaseName: podinfo + install: + remediation: + retries: 3 + upgrade: + remediation: + retries: 3 + test: + enable: true + driftDetection: + mode: enabled + ignore: + - paths: ["/spec/replicas"] + target: + kind: Deployment + values: + replicaCount: 2 +######################################################################################################################## kustomizations: - name: chrome-hub-root-app namespace: "default" diff --git a/helm/charts/flux-config/values.yaml b/helm/charts/flux-config/values.yaml index a726d3c..812eb67 100644 --- a/helm/charts/flux-config/values.yaml +++ b/helm/charts/flux-config/values.yaml @@ -6,12 +6,28 @@ defaults: # -- targetNamespace sets or overrides the default namespace in the `kind: Kustomization` manifests. targetNamespace: "default" ######################################################################################################################## +ociRepositorys: + # ociRepositorys[0].name -- defines k8s [`metadata.name`](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/object-meta/#ObjectMeta) value of `kind: GitRepository` + - name: "" + # -- *(optional)* defines k8s [`metadata.namespace`](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/object-meta/#ObjectMeta) value of `kind: GitRepository` + namespace: "default" + # spec -- defines k8s `spec` structured value of `kind: OCIRepository`. See [API browser](https://fluxcd.io/flux/components/source/ocirepositories/) + spec: +######################################################################################################################## +helmReleases: + # helmReleases[0].name -- defines k8s [`metadata.name`](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/object-meta/#ObjectMeta) value of `kind: GitRepository` + - name: "" + # -- *(optional)* defines k8s [`metadata.namespace`](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/object-meta/#ObjectMeta) value of `kind: GitRepository` + namespace: "default" + # spec -- defines k8s `spec` structured value of `kind: HelmRelease`. See [API browser](https://fluxcd.io/flux/components/helm/helmreleases/) + spec: +######################################################################################################################## gitRepositorys: # gitRepositorys[0].name -- defines k8s [`metadata.name`](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/object-meta/#ObjectMeta) value of `kind: GitRepository` - name: "" # -- *(optional)* defines k8s [`metadata.namespace`](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/object-meta/#ObjectMeta) value of `kind: GitRepository` namespace: "ns1" - # spec -- defines k8s `spec` structured value of `kind: GitRepository`. See [API broswer](https://fluxcd.io/flux/components/source/api/v1/#source.toolkit.fluxcd.io/v1.GitRepositorySpec) + # spec -- defines k8s `spec` structured value of `kind: GitRepository`. See [API browser](https://fluxcd.io/flux/components/source/api/v1/#source.toolkit.fluxcd.io/v1.GitRepositorySpec) spec: # -- [Interval](https://fluxcd.io/flux/components/source/api/v1/#source.toolkit.fluxcd.io/v1.GitRepositorySpec) at which the GitRepository URL is checked for updates. This interval is approximate and may be subject to jitter to ensure efficient use of resources. interval: 1m From f9e6004316b9d4c3e168aa6641574402629b621a Mon Sep 17 00:00:00 2001 From: sk31337 Date: Tue, 24 Jun 2025 09:36:52 +0000 Subject: [PATCH 2/3] chore(ci): update helm/charts/flux-config/Chart.yaml.version 0.0.17 -> 0.0.18 --- helm/charts/flux-config/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/charts/flux-config/Chart.yaml b/helm/charts/flux-config/Chart.yaml index 827de59..ffbebdd 100644 --- a/helm/charts/flux-config/Chart.yaml +++ b/helm/charts/flux-config/Chart.yaml @@ -17,7 +17,7 @@ icon: "https://avatars.githubusercontent.com/u/52158677?s=200&v=4" # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.0.17 +version: 0.0.18 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. From 2f1622bd746f8fc529d854beb4a262f933d0f8b1 Mon Sep 17 00:00:00 2001 From: sk31337 Date: Tue, 24 Jun 2025 09:36:54 +0000 Subject: [PATCH 3/3] chore(ci): update Helm Chart helm/charts/flux-config/README.md file --- helm/charts/flux-config/README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/helm/charts/flux-config/README.md b/helm/charts/flux-config/README.md index 35a6f0d..fa51a50 100644 --- a/helm/charts/flux-config/README.md +++ b/helm/charts/flux-config/README.md @@ -2,7 +2,7 @@ # flux-config -![Version: 0.0.17](https://img.shields.io/badge/Version-0.0.17-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.3.0](https://img.shields.io/badge/AppVersion-2.3.0-informational?style=flat-square) +![Version: 0.0.18](https://img.shields.io/badge/Version-0.0.18-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.3.0](https://img.shields.io/badge/AppVersion-2.3.0-informational?style=flat-square) A Helm Chart to template flux manifests to leverage GitOps on a OpenMCP cluster. @@ -54,6 +54,9 @@ A Helm Chart to template flux manifests to leverage GitOps on a OpenMCP cluster. | gitRepositorys[0].spec.secretRef | object | `{"name":""}` | *(optional)* [SecretRef](https://fluxcd.io/flux/components/source/api/v1/#source.toolkit.fluxcd.io/v1.GitRepositorySpec) specifies the Secret containing authentication credentials for the GitRepository. For HTTPS repositories the Secret must contain ‘username’ and ‘password’ fields for basic auth or ‘bearerToken’ field for token auth. For SSH repositories the Secret must contain ‘identity’ and ‘known_hosts’ fields. | | gitRepositorys[0].spec.secretRef.name | string | `""` | [`type SecretKeySelector `](https://pkg.go.dev/github.com/external-secrets/external-secrets/apis/meta/v1#SecretKeySelector) | | gitRepositorys[0].spec.url | string | `""` | [URL]() specifies the Git repository URL, it can be an HTTP/S or SSH address. | +| helmReleases[0].name | string | `""` | defines k8s [`metadata.name`](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/object-meta/#ObjectMeta) value of `kind: GitRepository` | +| helmReleases[0].namespace | string | `"default"` | *(optional)* defines k8s [`metadata.namespace`](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/object-meta/#ObjectMeta) value of `kind: GitRepository` | +| helmReleases[0].spec | string | `nil` | | | kustomizations | list | `[{"commonMetadata":[],"components":{},"decryption":[],"dependsOn":{},"force":null,"healthChecks":{},"images":{},"interval":null,"kubeConfig":[],"name":"","namePrefix":null,"nameSuffix":null,"namespace":"ns1","patches":null,"path":"","postBuild":[],"prune":null,"retryInterval":null,"serviceAccountName":null,"sourceRef":{"apiVersion":"","kind":"GitRepository","name":"","namespace":"ns1"},"suspend":null,"targetnamespace":"ns1","timeout":null,"wait":null}]` | defines independent [`kind: Kustomization`](https://fluxcd.io/flux/components/kustomize/api/v1/#kustomize.toolkit.fluxcd.io/v1.Kustomization) manifest without the generation of `kind: GitRepository`. | | kustomizations[0].commonMetadata | list | `[]` | [commonMetadata](https://fluxcd.io/flux/components/kustomize/kustomizations/#common-metadata) is an *(optional)*field used to specify any metadata that should be applied to all the Kustomization’s resources. | | kustomizations[0].components | object | `{}` | [components](https://fluxcd.io/flux/components/kustomize/kustomizations/#components) is an *(optional)*list used to specify Kustomize components. This allows using reusable pieces of configuration logic that can be included from multiple overlays. | @@ -83,6 +86,9 @@ A Helm Chart to template flux manifests to leverage GitOps on a OpenMCP cluster. | kustomizations[0].targetnamespace | string | `"ns1"` | *(optional)* targetNamespace defines the namespace in the `kind: Kustomization` manifests. | | kustomizations[0].timeout | string | `nil` | *(optional)* [Timeout](https://fluxcd.io/flux/components/kustomize/api/v1/#kustomize.toolkit.fluxcd.io/v1.KustomizationSpec) for validation, apply and health checking operations. Defaults to ‘Interval’ duration. e.g. 1m | | kustomizations[0].wait | string | `nil` | [wait](https://fluxcd.io/flux/components/kustomize/kustomizations/#wait) is an *(optional)*boolean field to perform health checks for all reconciled resources as part of the Kustomization. If set to true, .spec.healthChecks is ignored. | +| ociRepositorys[0].name | string | `""` | defines k8s [`metadata.name`](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/object-meta/#ObjectMeta) value of `kind: GitRepository` | +| ociRepositorys[0].namespace | string | `"default"` | *(optional)* defines k8s [`metadata.namespace`](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/object-meta/#ObjectMeta) value of `kind: GitRepository` | +| ociRepositorys[0].spec | string | `nil` | | ---------------------------------------------- Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2) \ No newline at end of file