### Flux Distribution Information Example Source: https://fluxoperator.dev/docs/crd/fluxreport.md Shows example distribution information when Flux is installed using the bootstrap command. ```yaml spec: distribution: entitlement: Issued by controlplane managedBy: 'flux bootstrap' status: Installed version: v2.3.0 ``` -------------------------------- ### Kustomization Example with Post-Build Substitution Source: https://fluxoperator.dev/docs/crd/kustomization.md Example of a Kustomization resource that uses post-build variable substitution for a region. ```yaml region: eu-central-1 ``` -------------------------------- ### Install Flux Instance from GitHub Source: https://fluxoperator.dev/docs/charts/flux-instance.md Use this command to install the Flux instance Helm chart directly from GitHub Container Registry. Ensure you have Helm v3 or later installed. ```shell helm upgrade -i flux \ oci://ghcr.io/controlplaneio-fluxcd/flux-instance \ --namespace flux-system \ --create-namespace \ --wait ``` -------------------------------- ### Example Flux Bootstrap Command Source: https://fluxoperator.dev/docs/guides/migration.md This command shows an example of how a cluster might have been bootstrapped using the Flux CLI. ```shell flux bootstrap github \ --components-extra=source-watcher \ --owner=my-org \ --repository=my-fleet \ --branch=main \ --path=clusters/my-cluster ``` -------------------------------- ### HelmRelease and HelmRepository Example Source: https://fluxoperator.dev/docs/crd/helmrelease.md This snippet defines a HelmRepository and a HelmRelease to deploy the podinfo Helm chart. It configures installation, upgrade, testing, and drift detection. ```yaml --- apiVersion: source.toolkit.fluxcd.io/v1 kind: HelmRepository metadata: name: podinfo namespace: default spec: interval: 15m url: https://stefanprodan.github.io/podinfo --- apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: name: podinfo namespace: default spec: interval: 15m 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 ``` -------------------------------- ### Flux GitRepository and Kustomization Example Source: https://fluxoperator.dev/docs/crd/kustomization.md This example defines a GitRepository source and a Kustomization that reconciles manifests from that repository. Use this to automate the deployment of Kustomize overlays. ```yaml apiVersion: source.toolkit.fluxcd.io/v1 kind: GitRepository metadata: name: podinfo namespace: default spec: interval: 5m url: https://github.com/stefanprodan/podinfo ref: branch: master --- apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: podinfo namespace: default spec: interval: 10m targetNamespace: default sourceRef: kind: GitRepository name: podinfo path: "./kustomize" prune: true timeout: 1m ``` -------------------------------- ### Get Buckets Command Output Source: https://fluxoperator.dev/docs/crd/bucket.md Example output of `kubectl get buckets` command, showing the status of the created Bucket resource. This helps verify if the Bucket is ready and has stored an artifact. ```console NAME ENDPOINT AGE READY STATUS minio-bucket minio.example.com 34s True stored artifact for revision 'sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' ``` -------------------------------- ### Install Flux MCP Server from GitHub Source: https://fluxoperator.dev/docs/charts/flux-operator-mcp.md Use this command to install the Flux MCP Server Helm chart from GitHub Container Registry. ```shell helm upgrade -i flux-operator-mcp \ oci://ghcr.io/controlplaneio-fluxcd/charts/flux-operator-mcp \ --namespace flux-system \ --create-namespace \ --wait ``` -------------------------------- ### Install Flux Operator and Instance with CLI Source: https://fluxoperator.dev/docs/guides/install.md Installs the Flux Operator and a Flux instance using the flux-operator CLI and a configuration file. ```shell flux-operator install -f flux-instance.yaml ``` -------------------------------- ### ResourceSet Example for Tenant Application Instances Source: https://fluxoperator.dev/docs/crd/resourceset.md This example defines a ResourceSet to generate Flux HelmRelease and OCIRepository objects for each tenant, based on their specified version and replica count. ```yaml apiVersion: fluxcd.controlplane.io/v1 kind: ResourceSet metadata: name: podinfo namespace: default annotations: fluxcd.controlplane.io/reconcile: "enabled" fluxcd.controlplane.io/reconcileEvery: "30m" fluxcd.controlplane.io/reconcileTimeout: "5m" spec: commonMetadata: labels: app.kubernetes.io/name: podinfo inputs: - tenant: "team1" app: version: "6.7.x" replicas: 2 - tenant: "team2" app: version: "6.6.x" replicas: 3 resources: - apiVersion: source.toolkit.fluxcd.io/v1 kind: OCIRepository metadata: name: podinfo-<< inputs.tenant >> namespace: default spec: interval: 10m url: oci://ghcr.io/stefanprodan/charts/podinfo ref: semver: << inputs.app.version | quote >> - apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: name: podinfo-<< inputs.tenant >> namespace: default spec: interval: 1h releaseName: podinfo-<< inputs.tenant >> chartRef: kind: OCIRepository name: podinfo-<< inputs.tenant >> values: replicaCount: << inputs.app.replicas | int >> ``` -------------------------------- ### ResourceSet Resources Template Example Source: https://fluxoperator.dev/docs/crd/resourceset.md This example demonstrates using the 'resourcesTemplate' field with Go templating to generate multiple OCIRepository and Kustomization resources based on input data. It shows conditional logic and iteration for creating resources. ```yaml spec: inputs: - bundle: addons decryption: false components: - ingress-nginx - cert-manager - bundle: apps decryption: true components: - frontend - backend resourcesTemplate: | --- apiVersion: source.toolkit.fluxcd.io/v1 kind: OCIRepository metadata: name: << inputs.bundle >> namespace: flux-system spec: interval: 10m url: oci://registry.example.com/<< inputs.bundle >> <<- range $component := inputs.components >> --- apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: << $component >> namespace: flux-system spec: interval: 1h prune: true <<- if inputs.decryption >> decryption: provider: sops secretRef: name: << inputs.bundle >>-sops <<- end >> sourceRef: kind: OCIRepository name: << inputs.bundle >> path: ./<< $component >> <<- end >> ``` -------------------------------- ### Flux Components Status Example Source: https://fluxoperator.dev/docs/crd/fluxinstance.md Records the status of installed Flux components, including image repository, tag, and digest. ```text Status: Components: Digest: sha256:161da425b16b64dda4b3cec2ba0f8d7442973aba29bb446db3b340626181a0bc Name: source-controller Repository: ghcr.io/fluxcd/source-controller Tag: v1.3.0 Digest: sha256:48a032574dd45c39750ba0f1488e6f1ae36756a38f40976a6b7a588d83acefc1 Name: kustomize-controller Repository: ghcr.io/fluxcd/kustomize-controller Tag: v1.3.0 ``` -------------------------------- ### Example Secret Reference Source: https://fluxoperator.dev/docs/crd/resourcesetinputprovider.md An example of how to reference a secret in the ResourceSetInputProvider spec. ```yaml spec: serviceAccountName: oci-pull-secrets-sa # optional, for OCIArtifactTag provider type only secretRef: name: github-pat # or oci-pull-secret for OCIArtifactTag provider type ``` -------------------------------- ### Trace ImageRepository Events (kubectl output example) Source: https://fluxoperator.dev/docs/crd/imagerepository.md Example output from `kubectl events --for ImageRepository/`, showing normal and warning events. ```console LAST SEEN TYPE REASON OBJECT MESSAGE 3m51s Normal Succeeded imagerepository/ successful scan, found 34 tags 114s Warning ImageURLInvalid imagerepository/ could not parse reference: ghcr.io/stefanprodan/podinfo:foo:bar ``` -------------------------------- ### Example kubectl events output Source: https://fluxoperator.dev/docs/crd/imageupdateautomation.md This console output shows example events for an ImageUpdateAutomation, including Git operation failures and successful reconciliations. ```console LAST SEEN TYPE REASON OBJECT MESSAGE 3m29s (x7 over 4m17s) Warning GitOperationFailed ImageUpdateAutomation/ failed to checkout source: unable to clone 'https://github.com/fluxcd/example': couldn't find remote ref "refs/heads/non-existing-branch" 3m14s (x4 over 3h24m) Normal Succeeded ImageUpdateAutomation/ repository up-to-date 2m41s (x12 over 174m) Normal Succeeded ImageUpdateAutomation/ no change since last reconciliation ``` -------------------------------- ### FluxInstance Info Metric Example Source: https://fluxoperator.dev/docs/crd/fluxinstance.md An example of the flux_instance_info Prometheus metric, which provides details about a FluxInstance resource. ```text flux_instance_info{ exported_namespace="flux-system", kind="FluxInstance", name="flux", ready="True", reason="ReconciliationSucceeded", registry="ghcr.io/fluxcd", revision="v2.3.0@sha256:75aa209c6a2e25b97114ccf092246d02ab4363bc136edefc239d2a88da882b63", suspended="False", uid="16ca7202-9319-445b-99d0-617c25bda182" } ``` -------------------------------- ### OCIRepository and HelmRelease Reference Example Source: https://fluxoperator.dev/docs/crd/helmrelease.md This example demonstrates how to configure an OCIRepository to fetch a Helm chart and then reference it in a HelmRelease. It specifies the chart's URL, version constraints, and a namespace. The HelmRelease then uses this OCIRepository as its source for the chart, along with custom values. ```yaml apiVersion: source.toolkit.fluxcd.io/v1 kind: OCIRepository metadata: name: podinfo namespace: default spec: interval: 10m layerSelector: mediaType: "application/vnd.cncf.helm.chart.content.v1.tar+gzip" operation: copy url: oci://ghcr.io/stefanprodan/charts/podinfo ref: semver: ">= 6.0.0" --- apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: name: podinfo namespace: default spec: interval: 10m chartRef: kind: OCIRepository name: podinfo namespace: default values: replicaCount: 2 ``` -------------------------------- ### ResourceSetInputProvider Schedule Example Source: https://fluxoperator.dev/docs/crd/resourcesetinputprovider.md Example of specifying multiple schedules with cron, timeZone, and window for ResourceSetInputProvider. Use this to define recurring reconciliation times and windows. ```yaml spec: schedule: # Every day-of-week from Monday through Thursday # between 10:00 to 16:00 - cron: "0 10 * * 1-4" timeZone: "Europe/London" window: "6h" # Every Friday from 10:00 to 13:00 - cron: "0 10 * * 5" timeZone: "Europe/London" window: "3h" ``` -------------------------------- ### OCIRepository Example Source: https://fluxoperator.dev/docs/crd/ocirepository.md This example defines an OCIRepository to fetch the latest tag of a podinfo OCI image. It specifies the interval for checking the repository and the URL of the OCI repository. ```yaml --- apiVersion: source.toolkit.fluxcd.io/v1 kind: OCIRepository metadata: name: podinfo namespace: default spec: interval: 5m0s url: oci://ghcr.io/stefanprodan/manifests/podinfo ref: tag: latest ``` -------------------------------- ### Install Flux Operator from GitHub Source: https://fluxoperator.dev/docs/charts/flux-operator.md Use this command to install the Flux Operator Helm chart from the GitHub Container Registry. Ensure you have Helm v3 or later installed. ```shell helm upgrade -i flux-operator \ oci://ghcr.io/controlplaneio-fluxcd/flux-operator \ --namespace flux-system \ --create-namespace \ --wait ``` -------------------------------- ### OCIRepository Event Output Example Source: https://fluxoperator.dev/docs/crd/ocirepository.md Example output from 'kubectl events --for OCIRepository/', showing event types, reasons, object, and messages. Useful for understanding the state and potential errors. ```console LAST SEEN TYPE REASON OBJECT MESSAGE 2m14s Normal NewArtifact ocirepository/ stored artifact for revision 'latest@sha256:3b6cdcc7adcc9a84d3214ee1c029543789d90b5ae69debe9efa3f66e982875de' 36s Normal ArtifactUpToDate ocirepository/ artifact up-to-date with remote revision: 'latest@sha256:3b6cdcc7adcc9a84d3214ee1c029543789d90b5ae69debe9efa3f66e982875de' 94s Warning OCIOperationFailed ocirepository/ failed to pull artifact from 'oci://ghcr.io/stefanprodan/manifests/podinfo': couldn't find tag "0.0.1" ``` -------------------------------- ### Advanced Commit Message Template Example Source: https://fluxoperator.dev/docs/crd/imageupdateautomation.md A comprehensive example showcasing iteration over changed files and objects, and displaying changes using Go text template syntax. ```yaml spec: commit: messageTemplate: | Automated image update Automation name: {{ .AutomationObject }} Files: {{ range $filename, $_ := .Changed.FileChanges -}} - {{ $filename }} {{ end -}} Objects: {{ range $resource, $changes := .Changed.Objects -}} - {{ $resource.Kind }} {{ $resource.Name }} Changes: {{- range $_, $change := $changes }} - {{ $change.OldValue }} -> {{ $change.NewValue }} {{ end -}} {{ end -}} ``` -------------------------------- ### Install Flux Instance from Quay Source: https://fluxoperator.dev/docs/charts/flux-instance.md This command installs the Flux instance Helm chart from Quay.io, allowing you to specify a custom registry for the distribution. It also sets the namespace and creates it if it doesn't exist. ```shell helm upgrade -i flux \ oci://quay.io/fluxoperatordev/charts/flux-instance \ --set instance.distribution.registry=quay.io/fluxoperatordev \ --namespace flux-system \ --create-namespace \ --wait ``` -------------------------------- ### OpenShift Cluster Configuration Example Source: https://fluxoperator.dev/docs/crd/fluxinstance.md Example configuration for an OpenShift Kubernetes cluster, including multitenancy and service account settings. ```yaml spec: cluster: type: openshift size: medium multitenant: true multitenantWorkloadIdentity: true objectLevelWorkloadIdentity: true tenantDefaultServiceAccount: "flux" tenantDefaultDecryptionServiceAccount: "flux-decryption" tenantDefaultKubeConfigServiceAccount: "flux-kubeconfig" networkPolicy: true domain: "cluster.local" ``` -------------------------------- ### Generic Provider Bucket and Secret Example Source: https://fluxoperator.dev/docs/crd/bucket.md Example of a Bucket configured with the 'generic' provider for S3-compatible storage and its corresponding credentials Secret. ```yaml --- apiVersion: source.toolkit.fluxcd.io/v1 kind: Bucket metadata: name: generic-insecure namespace: default spec: provider: generic interval: 5m0s bucketName: podinfo endpoint: minio.minio.svc.cluster.local:9000 timeout: 60s insecure: true secretRef: name: minio-credentials --- apiVersion: v1 kind: Secret metadata: name: minio-credentials namespace: default type: Opaque data: accesskey: secretkey: ``` -------------------------------- ### Install Flux MCP Server from Quay Source: https://fluxoperator.dev/docs/charts/flux-operator-mcp.md Use this command to install the Flux MCP Server Helm chart from Quay. This includes setting a custom image repository. ```shell helm upgrade -i flux-operator-mcp \ oci://quay.io/fluxoperatordev/charts/flux-operator-mcp \ --set image.repository=quay.io/fluxoperatordev/flux-operator-mcp \ --namespace flux-system \ --create-namespace \ --wait ``` -------------------------------- ### Flux Web UI Config Example Source: https://fluxoperator.dev/docs/web-ui/web-config-api.md An example YAML configuration file for the Flux Web UI server, specifying base URL and OAuth2 authentication settings. ```yaml # /etc/flux-status-page/config.yaml apiVersion: web.fluxcd.controlplane.io/v1 kind: Config spec: baseURL: https://flux-web.example.com authentication: type: OAuth2 oauth2: provider: OIDC clientID: clientSecret: issuerURL: https://dex.example.com ``` -------------------------------- ### HelmChart and HelmRelease Reference Example Source: https://fluxoperator.dev/docs/crd/helmrelease.md This example shows how to define a HelmChart resource that points to a HelmRepository and then use that HelmChart in a HelmRelease. It includes chart name, repository reference, version constraints, and custom values files. The HelmRelease references the HelmChart by its kind, name, and namespace. ```yaml apiVersion: source.toolkit.fluxcd.io/v1 kind: HelmChart metadata: name: podinfo namespace: default spec: interval: 10m chart: podinfo sourceRef: kind: HelmRepository name: podinfo version: "6.x" valuesFiles: - values-prod.yaml --- apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: name: podinfo namespace: default spec: interval: 10m chartRef: kind: HelmChart name: podinfo namespace: default values: replicaCount: 2 ``` -------------------------------- ### ResourceSet CEL Readiness Expressions Example Source: https://fluxoperator.dev/docs/crd/resourceset.md Configures complex readiness checks for ResourceSet dependencies using CEL expressions. This example checks for cluster readiness and a secret's content. ```yaml spec: dependsOn: - apiVersion: cluster.x-k8s.io/v1beta1 kind: Cluster name: my-cluster namespace: dev ready: true readyExpr: | metadata.generation == status.observedGeneration && status.controlPlaneReady == true - apiVersion: v1 kind: Secret name: my-gate namespace: dev ready: true readyExpr: | string(base64.decode(data.gate)) == 'opened' ``` -------------------------------- ### Azure Bucket Public Access Example Source: https://fluxoperator.dev/docs/crd/bucket.md Configure an Azure Bucket source for public access. This example assumes no specific authentication is required, and the bucket is publicly reachable. ```yaml --- apiVersion: source.toolkit.fluxcd.io/v1 kind: Bucket metadata: name: azure-public namespace: default spec: interval: 5m0s provider: azure bucketName: podinfo endpoint: https://podinfoaccount.blob.core.windows.net timeout: 30s ``` -------------------------------- ### Flux Components Information Example Source: https://fluxoperator.dev/docs/crd/fluxreport.md Provides an example of Flux components information, including image repository, tag, digest, and deployment readiness status for controllers. ```yaml spec: components: - image: ghcr.io/fluxcd/kustomize-controller:v1.3.0@sha256:48a032574dd45c39750ba0f1488e6f1ae36756a38f40976a6b7a588d83acefc1 name: kustomize-controller ready: true status: 'Current Deployment is available. Replicas: 1' - image: ghcr.io/fluxcd/source-controller:v1.3.0@sha256:161da425b16b64dda4b3cec2ba0f8d7442973aba29bb446db3b340626181a0bc name: source-controller ready: true status: 'Current Deployment is available. Replicas: 1' ``` -------------------------------- ### Example Flux Resource Info Metric Source: https://fluxoperator.dev/docs/crd/fluxreport.md An example of the `flux_resource_info` metric for a Kustomization resource. This illustrates the format and the inclusion of common and resource-specific labels. ```text flux_resource_info{ exported_namespace="flux-system", kind="Kustomization", name="flux-system", path="production/clusters", ready="True", reason="ReconciliationSucceeded", revision="refs/heads/main@sha1:d3c6dfa21465cc540d214811f46694fee0ce700d", source_name="flux-system", suspended="False", uid="359219f3-0793-4cf0-89a1-990ef1ac8098" } ``` -------------------------------- ### Start Flux MCP Server with stdio transport Source: https://fluxoperator.dev/docs/mcp/config.md Use this configuration to start the MCP Server using standard input/output (stdio), which is the default and compatible with most AI assistants. ```json { "flux-operator-mcp":{ "command":"/path/to/flux-operator-mcp", "args":["serve"], "env":{ "KUBECONFIG":"/path/to/.kube/config" } } } ``` -------------------------------- ### AWS Provider Bucket with Static Credentials Example Source: https://fluxoperator.dev/docs/crd/bucket.md Example of a Bucket configured with the 'aws' provider using static access key and secret key from a Kubernetes Secret. ```yaml --- apiVersion: source.toolkit.fluxcd.io/v1 kind: Bucket metadata: name: aws namespace: default spec: interval: 5m0s provider: aws bucketName: podinfo endpoint: s3.amazonaws.com region: us-east-1 secretRef: name: aws-credentials --- apiVersion: v1 kind: Secret metadata: name: aws-credentials namespace: default type: Opaque data: accesskey: secretkey: ``` -------------------------------- ### HelmRelease History Example Source: https://fluxoperator.dev/docs/crd/helmrelease.md This example shows the status history of a HelmRelease, detailing previous deployments, their versions, and test hook statuses. The history is ordered by release time, with the most recent first. ```yaml --- apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: name: status: history: - appVersion: 6.6.1 chartName: podinfo chartVersion: 6.6.1+0cc9a8446c95 configDigest: sha256:e15c415d62760896bd8bec192a44c5716dc224db9e0fc609b9ac14718f8f9e56 digest: sha256:e59349a6d8cf01d625de9fe73efd94b5e2a8cc8453d1b893ec367cfa2105bae9 firstDeployed: "2024-05-07T04:54:21Z" lastDeployed: "2024-05-07T04:54:55Z" name: podinfo namespace: podinfo ociDigest: sha256:0cc9a8446c95009ef382f5eade883a67c257f77d50f84e78ecef2aac9428d1e5 status: deployed testHooks: podinfo-grpc-test-goyey: lastCompleted: "2024-05-07T04:55:11Z" lastStarted: "2024-05-07T04:55:09Z" phase: Succeeded version: 2 - appVersion: 6.6.0 chartName: podinfo chartVersion: 6.6.0+cdd538a0167e configDigest: sha256:e15c415d62760896bd8bec192a44c5716dc224db9e0fc609b9ac14718f8f9e56 digest: sha256:9be0d34ced6b890a72026749bc0f1f9e3c1a89673e17921bbcc0f27774f31c3a firstDeployed: "2024-05-07T04:54:21Z" lastDeployed: "2024-05-07T04:54:21Z" name: podinfo namespace: podinfo ociDigest: sha256:cdd538a0167e4b51152b71a477e51eb6737553510ce8797dbcc537e1342311bb status: superseded testHooks: podinfo-grpc-test-q0ucx: lastCompleted: "2024-05-07T04:54:25Z" lastStarted: "2024-05-07T04:54:23Z" phase: Succeeded version: 1 ``` -------------------------------- ### HelmChart Status Artifact Example (Basic) Source: https://fluxoperator.dev/docs/crd/helmchart.md This example shows the structure of the `.status.artifact` field for a HelmChart, representing the last built chart as a gzip compressed TAR archive. It includes details like digest, size, and URL. ```yaml --- apiVersion: source.toolkit.fluxcd.io/v1 kind: HelmChart metadata: name: status: artifact: digest: sha256:e30b95a08787de69ffdad3c232d65cfb131b5b50c6fd44295f48a078fceaa44e lastUpdateTime: "2022-02-10T18:53:47Z" path: helmchart///-.tgz revision: 6.0.3 size: 14166 url: http://source-controller.flux-system.svc.cluster.local./helmchart///-.tgz ``` -------------------------------- ### Start Review Environment in GitLab CI Source: https://fluxoperator.dev/docs/resourcesets/gitlab-environments.md This GitLab CI/CD job starts a review environment. It uses the flux-operator-cli image to reconcile ResourceSetInputProvider and ResourceSet resources, matching the configuration in the ResourceSet. ```yaml start-review: stage: review environment: name: review/$CI_COMMIT_REF_SLUG # Matches configuration in the ResourceSet url: https://app-$CI_ENVIRONMENT_SLUG.example.com action: start on_stop: "stop-review" # We need an image with a shell, the flux-operator CLI and kubectl installed image: flux-operator-cli script: | # Set up Kubernetes context using GitLab Agent kubectl config use-context kubernetes_agent # Reconcile both the ResourceSetInputProvider and the ResourceSet flux-operator reconcile inputprovider --namespace app-preview --timeout 1m app-review-environments flux-operator reconcile resourceset --namespace app-preview --timeout 1m app-preview ``` -------------------------------- ### ResourceSet for Multi-Instance Application Deployment Source: https://fluxoperator.dev/docs/resourcesets/app-definition.md This example demonstrates how a single ResourceSet file can achieve what typically requires a complex Kustomize overlay structure for deploying multiple instances of an application with different configurations per tenant. It uses inputs to parameterize the OCIRepository and HelmRelease resources. ```yaml apiVersion: fluxcd.controlplane.io/v1 kind: ResourceSet metadata: name: app1 namespace: apps spec: inputs: - tenant: "tenant1" app: version: "6.7.x" replicas: 2 - tenant: "tenant2" app: version: "6.6.x" replicas: 3 resources: - apiVersion: source.toolkit.fluxcd.io/v1 kind: OCIRepository metadata: name: app1-<< inputs.tenant >> namespace: apps spec: interval: 10m url: oci://my.registry/org/charts/app1 ref: semver: << inputs.app.version | quote >> - apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: name: app1-<< inputs.tenant >> namespace: apps spec: interval: 1h releaseName: app1-<< inputs.tenant >> chartRef: kind: OCIRepository name: app1-<< inputs.tenant >> values: replicaCount: << inputs.app.replicas | int >> ``` -------------------------------- ### Get FluxInstance Status Source: https://fluxoperator.dev/docs/crd/fluxinstance.md Check the status of the FluxInstance resource after applying it. This command shows if the reconciliation has finished and the current revision of Flux installed. ```console $ kubectl -n flux-system get fluxinstance NAME AGE READY STATUS REVISION flux 59s True Reconciliation finished in 52s v2.3.0@sha256:4cc5babdb1279ad0177bf513292deadbfa3f7b7c3da0be7fa53b39ab434f7219 ``` -------------------------------- ### Flux Operator Subscription Manifest for OLM Source: https://fluxoperator.dev/docs/guides/install.md Example subscription manifest for installing the Flux Operator on OpenShift via Operator Lifecycle Manager (OLM). It configures environment variables and node affinity. ```yaml apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: flux-operator namespace: flux-system spec: channel: stable name: flux-operator source: operatorhubio-catalog sourceNamespace: olm config: env: - name: DEFAULT_SERVICE_ACCOUNT value: "flux-operator" - name: REPORTING_INTERVAL value: "30s" affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: role operator: In values: - flux tolerations: - effect: NoSchedule key: role operator: Equal value: flux ``` -------------------------------- ### Build Flux MCP Server from Source Source: https://fluxoperator.dev/docs/mcp/install.md Clone the repository and use 'make' to build the Flux MCP Server binary if you prefer building from source. Requires Go 1.26+. ```shell git clone https://github.com/controlplaneio-fluxcd/flux-operator.git cd flux-operator make mcp-build ``` -------------------------------- ### Create Preview Namespace and Service Account Source: https://fluxoperator.dev/docs/resourcesets/feature-branches.md Sets up a dedicated namespace and a service account with administrative privileges for deploying preview applications. ```yaml apiVersion: v1 kind: Namespace metadata: name: app-preview --- apiVersion: v1 kind: ServiceAccount metadata: name: flux namespace: app-preview --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: flux namespace: app-preview roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: admin subjects: - kind: ServiceAccount name: flux namespace: app-preview ``` -------------------------------- ### Flux Components Configuration Source: https://fluxoperator.dev/docs/crd/fluxinstance.md Specifies the list of Flux components to install. If not specified, a default set is installed. ```yaml spec: components: - source-controller - kustomize-controller - helm-controller - notification-controller - image-reflector-controller - image-automation-controller - source-watcher ``` -------------------------------- ### Example Permutation Input Sets Source: https://fluxoperator.dev/docs/crd/resourceset.md Illustrates the structure of input sets generated by the 'Permute' strategy, showing how inputs from the ResourceSet, Git tag provider, and OCI tag provider are combined. ```yaml - id: "768965678" my_rset: id: id1 someField: foo git_tag: id: "8765674567" sha: bf5d6e01cf802734853f6f3417b237e3ad0ba35d oci_tag: id: "9876543210" digest: sha256:d4ec9861522d4961b2acac5a070ef4f92d732480dff2062c2f3a1dcf9a5d1e91 - id: "234567654" my_rset: id: id2 someField: bar git_tag: id: "8765674567" sha: bf5d6e01cf802734853f6f3417b237e3ad0ba35d oci_tag: id: "9876543210" digest: sha256:d4ec9861522d4961b2acac5a070ef4f92d732480dff2062c2f3a1dcf9a5d1e91 ``` -------------------------------- ### Install Flux Operator using Helm Source: https://fluxoperator.dev/docs/guides/migration.md Install the Flux Operator in the same namespace where Flux is deployed using Helm. ```shell helm install flux-operator oci://ghcr.io/controlplaneio-fluxcd/charts/flux-operator \ --namespace flux-system ``` -------------------------------- ### Describe Bucket Details Source: https://fluxoperator.dev/docs/crd/bucket.md Example output of `kubectl describe bucket minio-bucket` command. This provides detailed information about the Bucket's status, including the artifact details and conditions. ```console ... Status: Artifact: Digest: sha256:72aa638abb455ca5f9ef4825b949fd2de4d4be0a74895bf7ed2338622cd12686 Last Update Time: 2024-02-01T23:43:38Z Path: bucket/default/minio-bucket/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.tar.gz Revision: sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 Size: 38099 URL: http://source-controller.source-system.svc.cluster.local./bucket/default/minio-bucket/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.tar.gz Conditions: Last Transition Time: 2024-02-01T23:43:38Z Message: stored artifact for revision 'sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' Observed Generation: 1 Reason: Succeeded Status: True Type: Ready Last Transition Time: 2024-02-01T23:43:38Z Message: stored artifact for revision 'sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' Observed Generation: 1 Reason: Succeeded Status: True Type: ArtifactInStorage Observed Generation: 1 URL: http://source-controller.source-system.svc.cluster.local./bucket/default/minio-bucket/latest.tar.gz Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal NewArtifact 82s source-controller stored artifact with 16 fetched files from 'example' bucket ``` -------------------------------- ### Install Flux Operator CLI with Homebrew Source: https://fluxoperator.dev/docs/guides/cli.md Installs the Flux Operator CLI using Homebrew for macOS and Linux systems. ```shell brew install controlplaneio-fluxcd/tap/flux-operator ``` -------------------------------- ### Install Flux MCP Server with Homebrew Source: https://fluxoperator.dev/docs/mcp/install.md Use this command to install the Flux MCP Server on macOS or Linux systems with Homebrew. ```shell brew install controlplaneio-fluxcd/tap/flux-operator-mcp ``` -------------------------------- ### Templated Kubernetes Resources Source: https://fluxoperator.dev/docs/crd/resourceset.md Example demonstrating templated Namespace, ServiceAccount, and RoleBinding resources based on input tenants and roles. ```yaml spec: inputs: - tenant: team1 role: admin - tenant: team2 role: cluster-admin resources: - apiVersion: v1 kind: Namespace metadata: name: << inputs.tenant >> - apiVersion: v1 kind: ServiceAccount metadata: name: flux namespace: << inputs.tenant >> - apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: flux namespace: << inputs.tenant >> subjects: - kind: ServiceAccount name: flux namespace: << inputs.tenant >> roleRef: kind: ClusterRole name: << inputs.role >> apiGroup: rbac.authorization.k8s.io ``` -------------------------------- ### Compose Artifact from Multiple Sources Source: https://fluxoperator.dev/docs/crd/artifactgenerator.md This example demonstrates how to compose a single artifact from multiple sources like GitRepository, OCIRepository, and Bucket. It specifies which files to copy from each source and where to place them in the generated artifact. ```yaml apiVersion: source.extensions.fluxcd.io/v1beta1 kind: ArtifactGenerator metadata: name: my-app namespace: apps spec: sources: - alias: backend kind: GitRepository name: my-backend - alias: frontend kind: OCIRepository name: my-frontend - alias: config kind: Bucket name: my-configs artifacts: - name: my-app-composite copy: - from: "@backend/deploy/**" to: "@artifact/my-app/backend/" - from: "@frontend/deploy/*.yaml" to: "@artifact/my-app/frontend/" - from: "@config/envs/prod/configmap.yaml" to: "@artifact/my-app/env.yaml" ``` -------------------------------- ### Example of Filtered Receiver Events Source: https://fluxoperator.dev/docs/crd/receiver.md This output shows example events for a Receiver, highlighting potential issues like a missing secret token. ```console LAST SEEN TYPE REASON OBJECT MESSAGE 3m44s Warning Failed receiver/ unable to read token from secret 'default/webhook-token' error: Secret "webhook-token" not found ``` -------------------------------- ### AWS Provider Bucket Example Source: https://fluxoperator.dev/docs/crd/bucket.md Example of a Bucket configured with the 'aws' provider, specifying the S3 endpoint and region for AWS S3 access. ```yaml --- apiVersion: source.toolkit.fluxcd.io/v1 kind: Bucket metadata: name: aws namespace: default spec: interval: 5m0s provider: aws bucketName: podinfo endpoint: s3.amazonaws.com region: us-east-1 timeout: 30s ``` -------------------------------- ### Kustomization Example for Tenant Sharding Source: https://fluxoperator.dev/docs/instance/sharding.md Shows how to add the `sharding.fluxcd.io/key` label to a Kustomization to assign all tenant resources to a specific shard. The `commonMetadata.labels` field propagates this key to reconciled resources. ```yaml apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: tenant1 namespace: tenant1 labels: sharding.fluxcd.io/key: shard1 spec: commonMetadata: labels: sharding.fluxcd.io/key: shard1 interval: 10m sourceRef: kind: GitRepository name: tenant1 path: ./deploy prune: true ``` -------------------------------- ### Default Value Assignment with get and default Source: https://fluxoperator.dev/docs/crd/resourceset.md Demonstrates assigning a default value to a field using the get and default functions when an input is not specified. ```yaml spec: inputs: - namespace: team1 resources: - apiVersion: source.toolkit.fluxcd.io/v1 kind: OCIRepository metadata: name: << get inputs "name" | default inputs.namespace >> namespace: << inputs.namespace >> ``` -------------------------------- ### Install Flux Operator with Workload Identity Source: https://fluxoperator.dev/docs/crd/resourcesetinputprovider.md Install the Flux Operator using Helm, enabling workload identity and setting a default service account. ```shell helm install flux-operator oci://ghcr.io/controlplaneio-fluxcd/charts/flux-operator \ --namespace flux-system \ --create-namespace \ --set multitenancy.enabledForWorkloadIdentity=true \ --set multitenancy.defaultWorkloadIdentityServiceAccount=flux-operator ``` -------------------------------- ### Kustomization Dependency with Ready Expression Source: https://fluxoperator.dev/docs/crd/kustomization.md Demonstrates using `readyExpr` to ensure a dependency's version label matches the current Kustomization's version label before proceeding. ```yaml apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: app-backend namespace: apps labels: app/version: v1.2.3 --- apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: app-frontend namespace: apps labels: app/version: v1.2.3 spec: dependsOn: - name: app-backend readyExpr: > dep.metadata.labels['app/version'] == self.metadata.labels['app/version'] && dep.status.conditions.filter(e, e.type == 'Ready').all(e, e.status == 'True') && dep.metadata.generation == dep.status.observedGeneration ``` -------------------------------- ### Install Flux Operator with Kubectl Source: https://fluxoperator.dev/docs/guides/install.md Installs the Flux Operator by applying Kubernetes manifests directly from the latest release. This method is recommended for development and testing. ```shell kubectl apply -f https://github.com/controlplaneio-fluxcd/flux-operator/releases/latest/download/install.yaml ``` -------------------------------- ### Install Flux Operator from Quay Source: https://fluxoperator.dev/docs/charts/flux-operator.md This command installs the Flux Operator Helm chart from Quay. It allows specifying a custom image repository for the operator. ```shell helm upgrade -i flux-operator \ oci://quay.io/fluxoperatordev/charts/flux-operator \ --set image.repository=quay.io/fluxoperatordev/flux-operator \ --namespace flux-system \ --create-namespace \ --wait ``` -------------------------------- ### HelmRelease Dependency Ready Expression Example Source: https://fluxoperator.dev/docs/crd/helmrelease.md Demonstrates a HelmRelease with a dependency that uses a CEL expression to verify version and readiness status before proceeding. ```yaml apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: name: backend namespace: default spec: # ...omitted for brevity values: app: version: v1.2.3 --- apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: name: frontend namespace: default spec: # ...omitted for brevity values: app: version: v1.2.3 dependsOn: - name: backend readyExpr: > dep.spec.values.app.version == self.spec.values.app.version && dep.status.conditions.filter(e, e.type == 'Ready').all(e, e.status == 'True') && dep.metadata.generation == dep.status.observedGeneration ``` -------------------------------- ### Example Manifest with Variables Source: https://fluxoperator.dev/docs/crd/kustomization.md Illustrates how variables can be embedded within Kubernetes manifest definitions, such as metadata labels. ```yaml --- apiVersion: v1 kind: Namespace metadata: name: apps labels: environment: ${cluster_env:=dev} region: "${cluster_region}" ``` -------------------------------- ### Flux Kustomization Events Output Example Source: https://fluxoperator.dev/docs/crd/kustomization.md Example output from `flux events` showing various reconciliation states, including artifact failures and successful reconciliations. ```console LAST SEEN TYPE REASON OBJECT MESSAGE 3m2s Warning ArtifactFailed Kustomization/podinfo kustomization path not found: stat /tmp/kustomization-3336282420/invalid: no such file or directory 2m53s Normal ReconciliationSucceeded Kustomization/podinfo Reconciliation finished in 75.190237ms, next run in 5m0s 2m53s Normal Progressing Kustomization/podinfo Service/default/podinfo created Deployment/default/podinfo created HorizontalPodAutoscaler/default/podinfo created 19s (x17 over 8m24s) Normal GitOperationSucceeded GitRepository/podinfo no changes since last reconcilation: observed revision 'master/67e2c98a60dc92283531412a9e604dd4bae005a9' ```