This repository contains the source code and the CI/CD configuration of a demo app used for showcasing the Flux Operator GitOps features.
The container images at ghcr.io/controlplaneio-fluxcd/flux-appx
are build and pushed from GitHub Actions workflows.
The images are tagged using the following conventions:
<branch name>-<short sha>
- push commit to the main branchpr-<number>-<short sha>
- push commit to a branch in a pull request<git tag>
- push a Git tag in semver format
The following examples demonstrate how to use the Flux Operator to deploy the flux-appx
application.
- A Kubernetes cluster with the Flux Operator installed.
- A FluxInstance running in the cluster.
Helm release per opened pull request labeled with deploy/flux-preview
:
apiVersion: v1
kind: Namespace
metadata:
name: apps-preview
---
apiVersion: fluxcd.controlplane.io/v1
kind: ResourceSetInputProvider
metadata:
name: flux-appx-prs
namespace: apps-preview
annotations:
fluxcd.controlplane.io/reconcile: "enabled"
fluxcd.controlplane.io/reconcileEvery: "5m"
fluxcd.controlplane.io/reconcileTimeout: "1m"
spec:
type: GitHubPullRequest
url: https://github.com/controlplaneio-fluxcd/flux-appx
filter:
labels:
- "deploy/flux-preview"
defaultValues:
chart: "charts/flux-appx"
image: "ghcr.io/controlplaneio-fluxcd/flux-appx"
---
apiVersion: fluxcd.controlplane.io/v1
kind: ResourceSet
metadata:
name: flux-appx
namespace: apps-preview
spec:
inputsFrom:
- apiVersion: fluxcd.controlplane.io/v1
kind: ResourceSetInputProvider
name: flux-appx-prs
resources:
- apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: flux-appx-<< inputs.id >>
namespace: apps-preview
spec:
interval: 1h
url: https://github.com/controlplaneio-fluxcd/flux-appx
ref:
commit: << inputs.sha >>
- apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: flux-appx-<< inputs.id >>
namespace: apps-preview
annotations:
event.toolkit.fluxcd.io/branch: << inputs.branch | quote >>
event.toolkit.fluxcd.io/commit: << inputs.sha | quote >>
event.toolkit.fluxcd.io/author: << inputs.author | quote >>
spec:
interval: 1h
releaseName: flux-appx-<< inputs.id >>
chart:
spec:
chart: << inputs.chart | quote >>
reconcileStrategy: Revision
sourceRef:
kind: GitRepository
name: flux-appx-<< inputs.id >>
values:
image:
repository: << inputs.image | quote >>
tag: pr-<< inputs.id >>-<< inputs.sha | trunc 7 >>