Advanced source management: GitRepository references, large repo optimization, HelmRepository and OCIRepository, Bucket for S3, GCS, and Azure, and GPG and Cosign signature verification.

In episode 8 you referenced Helm charts as a source. This episode opens up every source type Flux supports and its advanced features. This matters because sources are the heart of GitOps: anything that enters the cluster passes through the Source Controller.
We'll dissect advanced GitRepository, HelmRepository, OCIRepository, Bucket, and then how to verify source authenticity with GPG and Cosign.
Beyond branch, ref can point to a tag, commit, or semver:
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: webapp
namespace: flux-system
spec:
interval: 5m
ref:
tag: v1.2.0
# or commit:
# ref:
# commit: 3f4a8c9d21e0b4a1
# or semver:
# ref:
# semver: ">=1.0.0 <2.0.0"
url: https://github.com/arman/webapp-manifests.gittag — points to a specific release version; stable for production.commit — pins to a commit hash; the most deterministic.semver — Flux selects the highest tag matching the range, then automatically moves up when a new tag appears.Large repos can be slimmed down in two ways. First, enable submodules:
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: fleet
namespace: flux-system
spec:
interval: 5m
url: https://github.com/arman/fleet.git
ref:
branch: main
gitImplementation: go-git
recurseSubmodules: trueSecond, limit which files get copied via include and exclude (gitignore patterns). This reduces clone load and speeds up reconciliation for very large repos:
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: fleet
namespace: flux-system
spec:
interval: 5m
url: https://github.com/arman/fleet.git
ref:
branch: main
ignore: |
.github
docs/
**/*.mdTip
Advanced optimization: use the --depth=1 flag during bootstrap for a shallow clone, and for gigantic repos consider an OCIRepository using lighter artifacts — covered shortly.
To make sure a commit really comes from a legitimate author, enable GPG verification:
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: webapp
namespace: flux-system
spec:
interval: 5m
url: https://github.com/arman/webapp-manifests.git
ref:
branch: main
verify:
mode: head
secretRef:
name: gpg-public-keysA HelmRepository is essentially one of two things: a directory containing an index.yaml, or an OCI registry. For a regular HTTP repo, Flux downloads index.yaml then fetches the charts it needs.
Authentication is similar to GitRepository — via a basic auth or token Secret:
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository
metadata:
name: internal
namespace: flux-system
spec:
interval: 1h
url: https://helm.internal.acme.com/charts
secretRef:
name: helm-auth
timeout: 60s
passCredentials: truepassCredentials — sends credentials to all requests, not just the main host. Useful when charts are hosted in object storage that requires per-request auth.certSecretRef — mounts a custom CA for TLS.insecure: true — turns off TLS verification, lab only.Warning
Don't enable insecure in production. If you use an internal registry with self-signed certificates, create a Secret containing the CA and reference it via certSecretRef.
OCIRepository is a generic source for OCI artifacts: charts, images, or manifests packaged as OCI layers. It's lighter than a Git clone and great for large repos or distributing charts to many clusters.
apiVersion: source.toolkit.fluxcd.io/v1
kind: OCIRepository
metadata:
name: webapp-chart
namespace: flux-system
spec:
interval: 10m
url: oci://registry.internal.acme.com/charts/webapp
ref:
tag: 1.2.0
secretRef:
name: registry-auth
layerSelector:
mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzipAuthentication uses a dockerconfigjson type Secret:
flux create secret oci registry-auth \
--url=oci://registry.internal.acme.com/charts \
--username=arman \
--password=$REGISTRY_PASSWORDThe most common use cases: distributing manifests to many clusters without cloning Git, and distributing internal charts already scanned and approved by the security team.
For static artifacts (S3-compatible, GCS, Azure Blob), Flux has Bucket. This source downloads files from object storage periodically:
apiVersion: source.toolkit.fluxcd.io/v1
kind: Bucket
metadata:
name: manifests
namespace: flux-system
spec:
interval: 10m
provider: generic
bucketName: my-app-manifests
endpoint: https://s3.ap-southeast-1.amazonaws.com
region: ap-southeast-1
secretRef:
name: s3-credentialsFor GCS and Azure, just change provider:
| Provider | provider value |
|---|---|
| S3 / S3-compatible | generic (or aws for IAM) |
| Google Cloud Storage | gcp |
| Azure Blob | azure |
Bucket is useful when manifests are produced by a CI pipeline (e.g. build output) and uploaded to storage, so the cluster doesn't need Git access.
Note
Bucket credentials always go through a Secret: accesskey and secretkey for S3, serviceaccount for GCP, accountkey for Azure. Flux reads the keys according to the provider.
Beyond GPG in Git, Flux verifies OCI artifacts with Cosign. Create an OCIRepository with a verify block:
apiVersion: source.toolkit.fluxcd.io/v1
kind: OCIRepository
metadata:
name: webapp
namespace: flux-system
spec:
interval: 10m
url: oci://registry.internal.acme.com/apps/webapp
verify:
provider: cosign
secretRef:
name: cosign-public-keysPublic keys for GPG and Cosign are stored in a Secret in flux-system; the Source Controller also uses a Key Management Service (e.g. AWS KMS or Azure Key Vault) for cloud-managed keys. There are two behavioral modes:
failOnVerificationFailure: true — verification is mandatory; unsigned artifacts are rejected.ignoreNotVerified — verifies only, does not reject unsigned artifacts.Important
Source verification is the last line of defense before a manifest touches the cluster. Combine it with signed commits and a policy engine in later episodes for a strong supply chain.
All configuration entry paths are now open:
passCredentials.Your sources are now diverse. In episode 10 we'll manage orchestration: dependsOn, health checks, deploy ordering strategies, and complex scenarios like database before application. See you!