diff --git a/flux/README.md b/flux/README.md new file mode 100644 index 0000000..c4d1f79 --- /dev/null +++ b/flux/README.md @@ -0,0 +1,34 @@ +# Flux OCM Component + +This directory contains the OCM (Open Component Model) packaging for [Flux](http://github.com/fluxcd/flux2) + +## Component structure + +```text +flux/ +├── component-constructor.yaml # OCM component descriptor +├── values.yaml.tpl # values.yaml template for ocm-kit +``` + +## Quick start + +### 1. Build the CTF archive + +Run from the `flux/` directory of this repo: + +```bash +ocm add componentversion --version 0.1.0 --create --file ./ctf component-constructor.yaml +``` + +### 2. Transfer to a registry + +```bash +# Public registry (replace with your org) +ocm transfer ctf --copy-local-resources ./ctf ghcr.io/your-org + +# Local registry for testing +ocm transfer ctf --copy-local-resources ./ctf localhost:5001 +``` + +The `--copy-local-resources` flag rewrites the image references inside the +component to point to the target registry. diff --git a/flux/component-constructor.yaml b/flux/component-constructor.yaml new file mode 100644 index 0000000..3a5c52f --- /dev/null +++ b/flux/component-constructor.yaml @@ -0,0 +1,105 @@ +components: + - name: opendefense.cloud/flux + provider: + name: opendefense.cloud + labels: + - name: app.kubernetes.io/name + value: flux + - name: app.kubernetes.io/component + value: flux + - name: app.kubernetes.io/part-of + value: flux + resources: + # install via helm install + - name: flux-chart + type: helmChart + version: v2.18.3 + relation: external + access: + type: ociArtifact + imageReference: ghcr.io/fluxcd-community/charts/flux2:2.18.3 + + - name: flux-chart-values-template + type: yaml + version: v2.18.3 + labels: + - name: opendefense.cloud/helm/values-for + value: flux-chart + relation: local + input: + type: file + path: values.yaml.tpl + + # install via kubectl apply + - name: install-yaml + type: yaml + version: v2.8.5 + relation: external + access: + type: wget + url: https://github.com/fluxcd/flux2/releases/download/v2.8.5/install.yaml + + # images + - name: helm-controller-image + type: ociImage + version: v1.5.3 + relation: external + access: + type: ociArtifact + imageReference: ghcr.io/fluxcd/helm-controller:v1.5.3 + + - name: cli-image + type: ociImage + version: v2.8.5 + relation: external + access: + type: ociArtifact + imageReference: ghcr.io/fluxcd/flux-cli:v2.8.5 + + - name: image-automation-controller-image + type: ociImage + version: v1.1.1 + relation: external + access: + type: ociArtifact + imageReference: ghcr.io/fluxcd/image-automation-controller:v1.1.1 + + - name: image-reflector-controller-image + type: ociImage + version: v1.1.1 + relation: external + access: + type: ociArtifact + imageReference: ghcr.io/fluxcd/image-reflector-controller:v1.1.1 + + - name: kustomize-controller-image + type: ociImage + version: v1.8.3 + relation: external + access: + type: ociArtifact + imageReference: ghcr.io/fluxcd/kustomize-controller:v1.8.3 + + - name: notification-controller-image + type: ociImage + version: v1.8.3 + relation: external + access: + type: ociArtifact + imageReference: ghcr.io/fluxcd/notification-controller:v1.8.3 + + - name: source-controller-image + type: ociImage + version: v1.8.2 + relation: external + access: + type: ociArtifact + imageReference: ghcr.io/fluxcd/source-controller:v1.8.2 + + - name: source-watcher-image + type: ociImage + version: v2.1.1 + relation: external + access: + type: ociArtifact + imageReference: ghcr.io/fluxcd/source-watcher:v2.1.1 diff --git a/flux/values.yaml.tpl b/flux/values.yaml.tpl new file mode 100644 index 0000000..eac65da --- /dev/null +++ b/flux/values.yaml.tpl @@ -0,0 +1,39 @@ +{{- $cli := index .OCIResources "cli-image" }} +cli: + image: {{ $cli.Host }}/{{ $cli.Repository }} + tag: {{ $cli.Tag }} + +{{- $helmController := index .OCIResources "helm-controller-image" }} +helmController: + image: {{ $helmController.Host }}/{{ $helmController.Repository }} + tag: {{ $helmController.Tag }} + +{{- $imageAutomationController := index .OCIResources "image-automation-controller-image" }} +imageAutomationController: + image: {{ $imageAutomationController.Host }}/{{ $imageAutomationController.Repository }} + tag: {{ $imageAutomationController.Tag }} + +{{- $imageReflectionController := index .OCIResources "image-reflector-controller-image" }} +imageReflectionController: + image: {{ $imageReflectionController.Host }}/{{ $imageReflectionController.Repository }} + tag: {{ $imageReflectionController.Tag }} + +{{- $kustomizeController := index .OCIResources "kustomize-controller-image" }} +kustomizeController: + image: {{ $kustomizeController.Host }}/{{ $kustomizeController.Repository }} + tag: {{ $kustomizeController.Tag }} + +{{- $notificationController := index .OCIResources "notification-controller-image" }} +notificationController: + image: {{ $notificationController.Host }}/{{ $notificationController.Repository }} + tag: {{ $notificationController.Tag }} + +{{- $sourceController := index .OCIResources "source-controller-image" }} +sourceController: + image: {{ $sourceController.Host }}/{{ $sourceController.Repository }} + tag: {{ $sourceController.Tag }} + +{{- $sourceWatcher := index .OCIResources "source-watcher-image" }} +sourceWatcher: + image: {{ $sourceWatcher.Host }}/{{ $sourceWatcher.Repository }} + tag: {{ $sourceWatcher.Tag }}