Compare commits

..

69 Commits
v2.7.5 ... main

Author SHA1 Message Date
Stefan Prodan f2f7d59577
Merge pull request #5663 from fluxcd/conform-k8s-1.35
Run conformance tests for Kubernetes 1.35.0
3 weeks ago
Stefan Prodan 7459e457bf
Run conformance tests for Kubernetes 1.35.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
3 weeks ago
Stefan Prodan 145f98b53a
ci: Move release to large runners
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
3 weeks ago
Stefan Prodan 6c58ea576e
Merge pull request #5659 from ivan-munteanu/retry-pulling-the-binary
Added retry logic with delays to the Flux CLI download
4 weeks ago
ivan-munteanu 580ef30c8f Added retry logic to install.sh
What Changed:
- Downloads now retry up to 5 times with 5-second delays between attempts
- Applied to both the Flux binary and checksums file downloads
- Clear feedback on retry attempts and failures

Why This Matters
- Improves Reliability: Network hiccups, rate limiting, or temporary outages no longer cause immediate failures. The action automatically recovers from transient issues.

Signed-off-by: ivan-munteanu <148127170+ivan-munteanu@users.noreply.github.com>
4 weeks ago
Matheus Pimenta 94e9af6b2a
Merge pull request #5656 from jaxels10/main
fix: #5654 by checking if both --chart and --chart-ref are set
1 month ago
Jesper Axelsen 3fb05a604f fix: #5654 by check if both --chart and --chart-ref are set
Signed-off-by: Jesper Axelsen <jesperbaxelsen@gmail.com>
1 month ago
Matheus Pimenta 9b76ba19a8
Merge pull request #5648 from fluxcd/update-components
Update toolkit components
1 month ago
fluxcdbot 1e7dd5dfd8 Update toolkit components
- helm-controller to v1.4.5
  https://github.com/fluxcd/helm-controller/blob/v1.4.5/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
1 month ago
Stefan Prodan d6dec730d8
Merge pull request #5597 from anshuishere/skip-tenant-ns-create
Allow option to skip tenant namespace creation
2 months ago
Anshuman Singh 0ba28f3f91
Allow option to skip tenant namespace creation
Add --skip-namespace flag to the 'create tenant' command to skip automatic
namespace creation when the namespace already exists.

Signed-off-by: Anshuman Singh <anshumanchauhan9@gmail.com>
2 months ago
Matheus Pimenta 55936e9366
Merge pull request #5639 from fluxcd/update-components
Update toolkit components
2 months ago
fluxcdbot 6ecad4783f Update toolkit components
- helm-controller to v1.4.4
  https://github.com/fluxcd/helm-controller/blob/v1.4.4/CHANGELOG.md
- kustomize-controller to v1.7.3
  https://github.com/fluxcd/kustomize-controller/blob/v1.7.3/CHANGELOG.md
- source-controller to v1.7.4
  https://github.com/fluxcd/source-controller/blob/v1.7.4/CHANGELOG.md
- notification-controller to v1.7.5
  https://github.com/fluxcd/notification-controller/blob/v1.7.5/CHANGELOG.md
- image-reflector-controller to v1.0.4
  https://github.com/fluxcd/image-reflector-controller/blob/v1.0.4/CHANGELOG.md
- image-automation-controller to v1.0.4
  https://github.com/fluxcd/image-automation-controller/blob/v1.0.4/CHANGELOG.md
- source-watcher to v2.0.3
  https://github.com/fluxcd/source-watcher/blob/v2.0.3/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
2 months ago
Matheus Pimenta 5759d08473
Merge pull request #5625 from hown3d/report-diff-skip
diff: report if object is skipped
2 months ago
Lukas Hoehl 5048de80f0
diff: report if object is skipped
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
2 months ago
Matheus Pimenta 97a437d059
Merge pull request #5633 from fluxcd/upgrade-deps
Upgrade k8s to 1.34.2, c-r to 0.22.4 and helm to 3.19.2
2 months ago
Matheus Pimenta cfb28ffdc0
Upgrade k8s to 1.34.2, c-r to 0.22.4 and helm to 3.19.2
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2 months ago
Matheus Pimenta ae9ef62f39
Merge pull request #5630 from fluxcd/fix-5629
Fix panic on reconcile with source of ExternalArtifact kind
2 months ago
Matheus Pimenta 69feb7214a
Fix panic on reconcile with source of ExternalArtifact kind
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2 months ago
Matheus Pimenta e95da82f5a
Merge pull request #5627 from fluxcd/fix-5626
Add source.extensions.fluxcd.io group to aggregated RBAC roles
2 months ago
Matheus Pimenta 7c5f9befb4
Add source.extensions.fluxcd.io group to aggregated RBAC roles
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2 months ago
Stefan Prodan 26a8d0c1c7
Merge pull request #5614 from fluxcd/conform-source-watcher
ci: Include source-watcher in the e2e test suite
2 months ago
Stefan Prodan 833815c71d
ci: Include source-watcher in the e2e test suite
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 months ago
Matheus Pimenta 31287b9b27
Merge pull request #5602 from jaxels10/main
fix: return accepted values for flags when calling Values.Type()
2 months ago
Jesper Axelsen 28f5b553a2
fix: return supported values for flags when calling Values.Type()
Signed-off-by: Jesper Axelsen <jesperbaxelsen@gmail.com>
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2 months ago
Matheus Pimenta b33f173670
Merge pull request #5603 from fluxcd/update-components
Update toolkit components
2 months ago
Matheus Pimenta d8c6ee167c
Fix bootstrap e2e test for image policy
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2 months ago
fluxcdbot e288cb2771 Update toolkit components
- helm-controller to v1.4.3
  https://github.com/fluxcd/helm-controller/blob/v1.4.3/CHANGELOG.md
- kustomize-controller to v1.7.2
  https://github.com/fluxcd/kustomize-controller/blob/v1.7.2/CHANGELOG.md
- source-controller to v1.7.3
  https://github.com/fluxcd/source-controller/blob/v1.7.3/CHANGELOG.md
- notification-controller to v1.7.4
  https://github.com/fluxcd/notification-controller/blob/v1.7.4/CHANGELOG.md
- image-reflector-controller to v1.0.3
  https://github.com/fluxcd/image-reflector-controller/blob/v1.0.3/CHANGELOG.md
- image-automation-controller to v1.0.3
  https://github.com/fluxcd/image-automation-controller/blob/v1.0.3/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
2 months ago
Stefan Prodan 5f2a6ebc2b
Merge pull request #5583 from dgunzy/add-export-source-external
[RFC-0012] Add command `flux export source external`
2 months ago
Daniel Guns cdc37c304a
Adding export source external
Signed-off-by: Daniel Guns <danbguns@gmail.com>
3 months ago
Matheus Pimenta 60e4d99b57
Merge pull request #5594 from fluxcd/pin-cosign-v2.6.1
Pin cosign to v2.6.1
3 months ago
Matheus Pimenta 8229ffb674
Pin cosign to v2.6.1
xref: https://github.com/fluxcd/source-controller/issues/1923
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
3 months ago
Stefan Prodan 9b944da896
Merge pull request #5589 from akshatsinha0/fix/check-prompt-write-error
fix: handle error when writing password prompt to stdout
3 months ago
Akshat Sinha 5b37a6b04b fix(cli): handle error when writing password prompt and correct spelling (i) Add error handling for fmt.Fprint when writing password prompt to stdout (ii) Fixed : initalization to initialization in the commented region
Signed-off-by: Akshat Sinha <akshatsinhasramhardy@gmail.com>
3 months ago
Stefan Prodan 9f18062d43
Merge pull request #5555 from dgunzy/add-get-source-external-artifact
[RFC-0012] Add command `flux get source external`
3 months ago
Daniel Guns 1055f28524 Adding get source external-artifact
Signed-off-by: Daniel Guns <danbguns@gmail.com>
3 months ago
Matheus Pimenta 7b0021c1a8
Merge pull request #5581 from fluxcd/restore-github-pat-for-backports
Restore GitHub PAT for backports
3 months ago
Matheus Pimenta ba997449aa
Restore GitHub PAT for backports
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
3 months ago
Matheus Pimenta ca2f0205c4
Merge pull request #5578 from fluxcd/update-components
Update toolkit components
3 months ago
fluxcdbot 058525fe37 Update toolkit components
- helm-controller to v1.4.2
  https://github.com/fluxcd/helm-controller/blob/v1.4.2/CHANGELOG.md
- kustomize-controller to v1.7.1
  https://github.com/fluxcd/kustomize-controller/blob/v1.7.1/CHANGELOG.md
- source-controller to v1.7.2
  https://github.com/fluxcd/source-controller/blob/v1.7.2/CHANGELOG.md
- notification-controller to v1.7.3
  https://github.com/fluxcd/notification-controller/blob/v1.7.3/CHANGELOG.md
- image-reflector-controller to v1.0.2
  https://github.com/fluxcd/image-reflector-controller/blob/v1.0.2/CHANGELOG.md
- image-automation-controller to v1.0.2
  https://github.com/fluxcd/image-automation-controller/blob/v1.0.2/CHANGELOG.md
- source-watcher to v2.0.2
  https://github.com/fluxcd/source-watcher/blob/v2.0.2/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
3 months ago
Stefan Prodan 686ee31f8a
Merge pull request #5576 from fluxcd/k8s-1.34.1
Update dependencies to Kubernetes v1.34.1 and Go 1.25.2
3 months ago
Stefan Prodan 767f235f94
Update dependencies to Kubernetes v1.34.1 and Go 1.25.2
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
3 months ago
Stefan Prodan d5a2c66746
Merge pull request #5574 from fluxcd/fix-manifestgen
Fix manifest generation for `--storage-adv-addr` and `--events-addr` flags
3 months ago
Stefan Prodan f2ff083b8e
Use `RUNTIME_NAMESPACE` when setting `--events-addr`
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
3 months ago
Stefan Prodan 8c45f25f33
Fix `--storage-adv-addr` for source-watcher
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
3 months ago
Stefan Prodan f85cbfa9c8
Merge pull request #5570 from fluxcd/remove-aur-pkgs
Disable AUR publishing
3 months ago
Stefan Prodan 71a3dad213
Disable AUR publishing
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
3 months ago
Matheus Pimenta 72e0535958
Merge pull request #5568 from fluxcd/update-components
Update toolkit components
3 months ago
fluxcdbot 4f2d1c3a2a Update toolkit components
- helm-controller to v1.4.1
  https://github.com/fluxcd/helm-controller/blob/v1.4.1/CHANGELOG.md
- source-controller to v1.7.1
  https://github.com/fluxcd/source-controller/blob/v1.7.1/CHANGELOG.md
- notification-controller to v1.7.2
  https://github.com/fluxcd/notification-controller/blob/v1.7.2/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
3 months ago
Stefan Prodan 8e99cf7c93
Merge pull request #5566 from ramasai1/refactor-variable-sub
refactor: convert `Kustomization` resource into unstructured map only once during variable substitution
3 months ago
Ramasai Venkatsitarambhaskar Tadepalli 2bb7f38603
refactor: convert `Kustomization` resource into unstructured map only once during variable substitution
Signed-off-by: Ramasai Venkatsitarambhaskar Tadepalli <ramasai.tadepalli@mongodb.com>
3 months ago
Matheus Pimenta 0fe4449870
Merge pull request #5563 from fluxcd/fix-migrate-f
Fix `flux migrate -f` not considering kind comments
3 months ago
Matheus Pimenta 7c5fb2297c
Fix flux migrate -f not considering kind comments
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
3 months ago
Stefan Prodan f4a811fbd3
Merge pull request #5562 from fluxcd/source-watcher-links
Add source-watcher to docs
3 months ago
Stefan Prodan bb3726bb87
Add source-watcher to docs
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
3 months ago
Matheus Pimenta 333c8fe704
Merge pull request #5560 from fluxcd/fix-migrate-files
Fix `flux migrate -f` command to work with comments
3 months ago
Matheus Pimenta 83213ce83f
Fix migrate -f command to work with comments
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
3 months ago
Stefan Prodan 69718599ac
Merge pull request #5558 from fluxcd/improve-flux-migrate
Improve `flux migrate` for live cluster migrations
3 months ago
Stefan Prodan 0255957dd7
Improve `flux migrate` for live cluster migrations
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
3 months ago
Stefan Prodan 69b4b85cd9
Merge pull request #5554 from fluxcd/migrate-dir
Extend `flux migrate` to work with local files
3 months ago
Matheus Pimenta a9b5be7ff4
Extend flux migrate to work with local files
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
3 months ago
Matheus Pimenta 1b46056e7d
Merge pull request #5551 from fluxcd/fix-5549
Fix `flux push artifact` not working with `--provider`
3 months ago
Matheus Pimenta 039d79b3c2
Fix flux push artifact not working with --provider
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
3 months ago
Stefan Prodan 66b8aca399
Merge pull request #5548 from fluxcd/dependabot/github_actions/ci-b5b9679c22
build(deps): bump the ci group across 1 directory with 3 updates
3 months ago
dependabot[bot] 41c413e178
build(deps): bump the ci group across 1 directory with 3 updates
Bumps the ci group with 3 updates in the / directory: [docker/login-action](https://github.com/docker/login-action), [ossf/scorecard-action](https://github.com/ossf/scorecard-action) and [github/codeql-action](https://github.com/github/codeql-action).


Updates `docker/login-action` from 3.5.0 to 3.6.0
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](184bdaa072...5e57cd1181)

Updates `ossf/scorecard-action` from 2.4.2 to 2.4.3
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](05b42c6244...4eaacf0543)

Updates `github/codeql-action` from 3.30.3 to 3.30.5
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](192325c861...3599b3baa1)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-version: 3.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: ossf/scorecard-action
  dependency-version: 2.4.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-version: 3.30.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
3 months ago
Matheus Pimenta d5f8720c4d
Merge pull request #5550 from fluxcd/update-labels
Add backport label for Flux 2.7
3 months ago
Matheus Pimenta e6eb9d79e3
Add backport label for Flux 2.7
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
3 months ago
Stefan Prodan b90d1738a9
Merge pull request #5547 from fluxcd/ci-fix-release-flux-manifests
ci: Set `GITHUB_TOKEN` in the `release-flux-manifests` workflow
3 months ago
Stefan Prodan f9e66dee9e
ci: Set `GITHUB_TOKEN` in the `release-flux-manifests` workflow
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
3 months ago

@ -44,12 +44,12 @@
description: Feature request proposals in the RFC format
color: '#D621C3'
aliases: ['area/RFC']
- name: backport:release/v2.4.x
description: To be backported to release/v2.4.x
color: '#ffd700'
- name: backport:release/v2.5.x
description: To be backported to release/v2.5.x
color: '#ffd700'
- name: backport:release/v2.6.x
description: To be backported to release/v2.6.x
color: '#ffd700'
- name: backport:release/v2.7.x
description: To be backported to release/v2.7.x
color: '#ffd700'

@ -10,4 +10,4 @@ jobs:
pull-requests: write # for creating pull requests against release branches.
uses: fluxcd/gha-workflows/.github/workflows/backport.yaml@v0.4.0
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
github-token: ${{ secrets.BOT_GITHUB_TOKEN }}

@ -19,7 +19,7 @@ jobs:
matrix:
# Keep this list up-to-date with https://endoflife.date/kubernetes
# Build images with https://github.com/fluxcd/flux-benchmark/actions/workflows/build-kind.yaml
KUBERNETES_VERSION: [1.32.1, 1.33.0, 1.34.1]
KUBERNETES_VERSION: [1.33.0, 1.34.1, 1.35.0]
fail-fast: false
steps:
- name: Checkout

@ -13,7 +13,9 @@ jobs:
hashes: ${{ steps.slsa.outputs.hashes }}
image_url: ${{ steps.slsa.outputs.image_url }}
image_digest: ${{ steps.slsa.outputs.image_digest }}
runs-on: ubuntu-latest
runs-on:
group: "Default Larger Runners"
labels: ubuntu-latest-16-cores
permissions:
contents: write # needed to write releases
id-token: write # needed for keyless signing

@ -49,7 +49,8 @@ you might want to take a look at the [introductory talk and demo](https://www.yo
This project is composed of:
- [flux2](https://github.com/fluxcd/flux2): The Flux CLI
- [source-manager](https://github.com/fluxcd/source-controller): Kubernetes operator for managing sources (Git and Helm repositories, S3-compatible Buckets)
- [source-controller](https://github.com/fluxcd/source-controller): Kubernetes operator for managing sources (Git, OCI and Helm repositories, S3-compatible Buckets)
- [source-watcher](https://github.com/fluxcd/source-watcher): Kubernetes operator for advanced source composition and decomposition patterns
- [kustomize-controller](https://github.com/fluxcd/kustomize-controller): Kubernetes operator for building GitOps pipelines with Kustomize
- [helm-controller](https://github.com/fluxcd/helm-controller): Kubernetes operator for building GitOps pipelines with Helm
- [notification-controller](https://github.com/fluxcd/notification-controller): Kubernetes operator for handling inbound and outbound events
@ -67,10 +68,9 @@ for source changes.
Prerequisites:
* go >= 1.24
* go >= 1.25
* kubectl >= 1.30
* kustomize >= 5.0
* coreutils (on Mac OS)
Install the [controller-runtime/envtest](https://github.com/kubernetes-sigs/controller-runtime/tree/master/tools/setup-envtest) binaries with:

@ -52,12 +52,14 @@ guides](https://fluxcd.io/flux/gitops-toolkit/source-watcher/).
### Components
- [Source Controller](https://fluxcd.io/flux/components/source/)
- [Source Controllers](https://fluxcd.io/flux/components/source/)
- [GitRepository CRD](https://fluxcd.io/flux/components/source/gitrepositories/)
- [OCIRepository CRD](https://fluxcd.io/flux/components/source/ocirepositories/)
- [HelmRepository CRD](https://fluxcd.io/flux/components/source/helmrepositories/)
- [HelmChart CRD](https://fluxcd.io/flux/components/source/helmcharts/)
- [Bucket CRD](https://fluxcd.io/flux/components/source/buckets/)
- [ExternalArtifact CRD](https://fluxcd.io/flux/components/source/externalartifacts/)
- [ArtifactGenerator CRD](https://fluxcd.io/flux/components/source/artifactgenerators/)
- [Kustomize Controller](https://fluxcd.io/flux/components/kustomize/)
- [Kustomization CRD](https://fluxcd.io/flux/components/kustomize/kustomizations/)
- [Helm Controller](https://fluxcd.io/flux/components/helm/)

@ -77,8 +77,36 @@ runs:
FLUX_DOWNLOAD_URL="https://github.com/fluxcd/flux2/releases/download/v${VERSION}/"
curl -fsSL -o "$DL_DIR/$FLUX_TARGET_FILE" "$FLUX_DOWNLOAD_URL/$FLUX_TARGET_FILE"
curl -fsSL -o "$DL_DIR/$FLUX_CHECKSUMS_FILE" "$FLUX_DOWNLOAD_URL/$FLUX_CHECKSUMS_FILE"
MAX_RETRIES=5
RETRY_DELAY=5
for i in $(seq 1 $MAX_RETRIES); do
echo "Downloading flux binary (attempt $i/$MAX_RETRIES)"
if curl -fsSL -o "$DL_DIR/$FLUX_TARGET_FILE" "$FLUX_DOWNLOAD_URL/$FLUX_TARGET_FILE"; then
break
fi
if [ $i -lt $MAX_RETRIES ]; then
echo "Download failed, retrying in ${RETRY_DELAY} seconds..."
sleep $RETRY_DELAY
else
echo "Failed to download flux binary after $MAX_RETRIES attempts"
exit 1
fi
done
for i in $(seq 1 $MAX_RETRIES); do
echo "Downloading checksums file (attempt $i/$MAX_RETRIES)"
if curl -fsSL -o "$DL_DIR/$FLUX_CHECKSUMS_FILE" "$FLUX_DOWNLOAD_URL/$FLUX_CHECKSUMS_FILE"; then
break
fi
if [ $i -lt $MAX_RETRIES ]; then
echo "Download failed, retrying in ${RETRY_DELAY} seconds..."
sleep $RETRY_DELAY
else
echo "Failed to download checksums file after $MAX_RETRIES attempts"
exit 1
fi
done
echo "Verifying checksum"
sum=""

@ -182,6 +182,10 @@ func createHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("chart or chart-ref is required")
}
if helmReleaseArgs.chart != "" && helmReleaseArgs.chartRef != "" {
return fmt.Errorf("cannot use --chart in combination with --chart-ref")
}
sourceLabels, err := parseLabels()
if err != nil {
return err

@ -42,6 +42,11 @@ func TestCreateHelmRelease(t *testing.T) {
args: "create helmrelease podinfo --export",
assert: assertError("chart or chart-ref is required"),
},
{
name: "chart and chartRef used in combination",
args: "create helmrelease podinfo --chart podinfo --chart-ref foobar/podinfo --export",
assert: assertError("cannot use --chart in combination with --chart-ref"),
},
{
name: "unknown source kind",
args: "create helmrelease podinfo --source foobar/podinfo --chart podinfo --export",

@ -0,0 +1,84 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
)
var exportSourceExternalCmd = &cobra.Command{
Use: "external [name]",
Short: "Export ExternalArtifact sources in YAML format",
Long: "The export source external command exports one or all ExternalArtifact sources in YAML format.",
Example: ` # Export all ExternalArtifact sources
flux export source external --all > sources.yaml
# Export a specific ExternalArtifact
flux export source external my-artifact > source.yaml`,
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.ExternalArtifactKind)),
RunE: exportWithSecretCommand{
list: externalArtifactListAdapter{&sourcev1.ExternalArtifactList{}},
object: externalArtifactAdapter{&sourcev1.ExternalArtifact{}},
}.run,
}
func init() {
exportSourceCmd.AddCommand(exportSourceExternalCmd)
}
func exportExternalArtifact(source *sourcev1.ExternalArtifact) any {
gvk := sourcev1.GroupVersion.WithKind(sourcev1.ExternalArtifactKind)
export := sourcev1.ExternalArtifact{
TypeMeta: metav1.TypeMeta{
Kind: gvk.Kind,
APIVersion: gvk.GroupVersion().String(),
},
ObjectMeta: metav1.ObjectMeta{
Name: source.Name,
Namespace: source.Namespace,
Labels: source.Labels,
Annotations: source.Annotations,
},
Spec: source.Spec,
}
return export
}
func getExternalArtifactSecret(source *sourcev1.ExternalArtifact) *types.NamespacedName {
// ExternalArtifact does not have a secretRef in its spec, this satisfies the interface
return nil
}
func (ex externalArtifactAdapter) secret() *types.NamespacedName {
return getExternalArtifactSecret(ex.ExternalArtifact)
}
func (ex externalArtifactListAdapter) secretItem(i int) *types.NamespacedName {
return getExternalArtifactSecret(&ex.ExternalArtifactList.Items[i])
}
func (ex externalArtifactAdapter) export() any {
return exportExternalArtifact(ex.ExternalArtifact)
}
func (ex externalArtifactListAdapter) exportItem(i int) any {
return exportExternalArtifact(&ex.ExternalArtifactList.Items[i])
}

@ -110,6 +110,12 @@ func TestExport(t *testing.T) {
"testdata/export/bucket.yaml",
tmpl,
},
{
"source external",
"export source external flux-system",
"testdata/export/external-artifact.yaml",
tmpl,
},
}
for _, tt := range cases {

@ -59,6 +59,10 @@ var getSourceAllCmd = &cobra.Command{
apiType: helmChartType,
list: &helmChartListAdapter{&sourcev1.HelmChartList{}},
},
{
apiType: externalArtifactType,
list: &externalArtifactListAdapter{&sourcev1.ExternalArtifactList{}},
},
}
for _, c := range allSourceCmd {

@ -0,0 +1,108 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"fmt"
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/runtime"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
"github.com/fluxcd/flux2/v2/internal/utils"
)
var getSourceExternalCmd = &cobra.Command{
Use: "external",
Short: "Get ExternalArtifact source statuses",
Long: `The get sources external command prints the status of the ExternalArtifact sources.`,
Example: ` # List all ExternalArtifacts and their status
flux get sources external
# List ExternalArtifacts from all namespaces
flux get sources external --all-namespaces`,
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.ExternalArtifactKind)),
RunE: func(cmd *cobra.Command, args []string) error {
get := getCommand{
apiType: externalArtifactType,
list: &externalArtifactListAdapter{&sourcev1.ExternalArtifactList{}},
funcMap: make(typeMap),
}
err := get.funcMap.registerCommand(get.apiType.kind, func(obj runtime.Object) (summarisable, error) {
o, ok := obj.(*sourcev1.ExternalArtifact)
if !ok {
return nil, fmt.Errorf("impossible to cast type %#v to ExternalArtifact", obj)
}
sink := &externalArtifactListAdapter{&sourcev1.ExternalArtifactList{
Items: []sourcev1.ExternalArtifact{
*o,
}}}
return sink, nil
})
if err != nil {
return err
}
if err := get.run(cmd, args); err != nil {
return err
}
return nil
},
}
func init() {
getSourceCmd.AddCommand(getSourceExternalCmd)
}
func (a *externalArtifactListAdapter) summariseItem(i int, includeNamespace bool, includeKind bool) []string {
item := a.Items[i]
var revision string
if item.Status.Artifact != nil {
revision = item.Status.Artifact.Revision
}
status, msg := statusAndMessage(item.Status.Conditions)
revision = utils.TruncateHex(revision)
msg = utils.TruncateHex(msg)
var source string
if item.Spec.SourceRef != nil {
source = fmt.Sprintf("%s/%s/%s",
item.Spec.SourceRef.Kind,
item.Spec.SourceRef.Namespace,
item.Spec.SourceRef.Name)
}
return append(nameColumns(&item, includeNamespace, includeKind),
revision, source, status, msg)
}
func (a externalArtifactListAdapter) headers(includeNamespace bool) []string {
headers := []string{"Name", "Revision", "Source", "Ready", "Message"}
if includeNamespace {
headers = append([]string{"Namespace"}, headers...)
}
return headers
}
func (a externalArtifactListAdapter) statusSelectorMatches(i int, conditionType, conditionStatus string) bool {
item := a.Items[i]
return statusMatches(conditionType, conditionStatus, item.Status.Conditions)
}

@ -180,7 +180,7 @@ func main() {
// This is required because controller-runtime expects its consumers to
// set a logger through log.SetLogger within 30 seconds of the program's
// initalization. If not set, the entire debug stack is printed as an
// initialization. If not set, the entire debug stack is printed as an
// error, see: https://github.com/kubernetes-sigs/controller-runtime/blob/ed8be90/pkg/log/log.go#L59
// Since we have our own logging and don't care about controller-runtime's
// logger, we configure it's logger to do nothing.
@ -225,7 +225,9 @@ func configureDefaultNamespace() {
func readPasswordFromStdin(prompt string) (string, error) {
var out string
var err error
fmt.Fprint(os.Stdout, prompt)
if _, err := fmt.Fprint(os.Stdout, prompt); err != nil {
return "", fmt.Errorf("failed to write prompt: %w", err)
}
stdinFD := int(os.Stdin.Fd())
if term.IsTerminal(stdinFD) {
var inBytes []byte

@ -195,3 +195,37 @@ func (a helmRepositoryListAdapter) asClientList() client.ObjectList {
func (a helmRepositoryListAdapter) len() int {
return len(a.HelmRepositoryList.Items)
}
// sourcev1.ExternalArtifact
var externalArtifactType = apiType{
kind: sourcev1.ExternalArtifactKind,
humanKind: "source external-artifact",
groupVersion: sourcev1.GroupVersion,
}
type externalArtifactAdapter struct {
*sourcev1.ExternalArtifact
}
func (a externalArtifactAdapter) asClientObject() client.Object {
return a.ExternalArtifact
}
func (a externalArtifactAdapter) deepCopyClientObject() client.Object {
return a.ExternalArtifact.DeepCopy()
}
// sourcev1.ExternalArtifactList
type externalArtifactListAdapter struct {
*sourcev1.ExternalArtifactList
}
func (a externalArtifactListAdapter) asClientList() client.ObjectList {
return a.ExternalArtifactList
}
func (a externalArtifactListAdapter) len() int {
return len(a.ExternalArtifactList.Items)
}

@ -0,0 +1,12 @@
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: ExternalArtifact
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
sourceRef:
apiVersion: source.example.com/v1alpha1
kind: GitHubRelease
name: flux-system
namespace: {{ .fluxns }}

@ -165,3 +165,15 @@ spec:
endpoint: s3.amazonaws.com
region: us-east-1
timeout: 30s
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: ExternalArtifact
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
sourceRef:
apiVersion: source.example.com/v1alpha1
kind: GitHubRelease
name: flux-system
namespace: {{ .fluxns }}

@ -520,30 +520,32 @@ func (b *Builder) do(ctx context.Context, kustomization kustomizev1.Kustomizatio
return nil, fmt.Errorf("kustomize build failed: %w", err)
}
if kustomization.Spec.PostBuild == nil {
return m, nil
}
data, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&kustomization)
if err != nil {
return nil, err
}
for _, res := range m.Resources() {
// run variable substitutions
if kustomization.Spec.PostBuild != nil {
data, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&kustomization)
outRes, err := kustomize.SubstituteVariables(ctx,
b.client,
unstructured.Unstructured{Object: data},
res,
kustomize.SubstituteWithDryRun(b.dryRun),
kustomize.SubstituteWithStrict(b.strictSubst),
)
if err != nil {
return nil, fmt.Errorf("var substitution failed for '%s': %w", res.GetName(), err)
}
if outRes != nil {
_, err = m.Replace(res)
if err != nil {
return nil, err
}
outRes, err := kustomize.SubstituteVariables(ctx,
b.client,
unstructured.Unstructured{Object: data},
res,
kustomize.SubstituteWithDryRun(b.dryRun),
kustomize.SubstituteWithStrict(b.strictSubst),
)
if err != nil {
return nil, fmt.Errorf("var substitution failed for '%s': %w", res.GetName(), err)
}
if outRes != nil {
_, err = m.Replace(res)
if err != nil {
return nil, err
}
}
}
}

Loading…
Cancel
Save