Flux sources such as GitRepos and Buckets can contain manifests packaged with flux build artifact or with helm package. To allow the reconciliation of such manifests, we should implement a copy strategy that extracts the contents of the archive into the destination artifact. The implementation should use fluxcd/pkg/tar.Untar.
Example
Assuming that in CI we run the following:
flux build artifact --path ./manifests/ -o manifests.tgz
aws s3 cp manifests.tgz s3://my-fleet/clusters/prod-1/manifests.tgz
We can define a generator that extracts the manifests from the tarball and places them in the root of the generated artifact:
apiVersion: source.extensions.fluxcd.io/v1beta1
kind: ArtifactGenerator
metadata:
name: cluster-config-unpack
namespace: flux-system
spec:
sources:
- alias: bucket
kind: Bucket
name: fleet
artifacts:
- name: cluster-config
originRevision: "@bucket"
copy:
- from: "@bucket/clusters/prod-1/manifests.tgz"
to: "@artifact/"
strategy: Extract
To reconcile the manifests with a Flux Kustomization:
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: cluster-sync
namespace: flux-system
spec:
interval: 15m
sourceRef:
kind: ExternalArtifact
name: cluster-config
path: "./"
prune: true
Flux sources such as GitRepos and Buckets can contain manifests packaged with
flux build artifactor withhelm package. To allow the reconciliation of such manifests, we should implement a copy strategy that extracts the contents of the archive into the destination artifact. The implementation should usefluxcd/pkg/tar.Untar.Example
Assuming that in CI we run the following:
We can define a generator that extracts the manifests from the tarball and places them in the root of the generated artifact:
To reconcile the manifests with a Flux Kustomization: