1
0
mirror of synced 2026-03-01 19:26:55 +00:00

Compare commits

...

231 Commits

Author SHA1 Message Date
Stefan Prodan
a18d4f3450 Merge pull request #4327 from fluxcd/backport-4284-to-release/v2.1.x
[release/v2.1.x] Make `flux pull` work for OCI artifacts produced by other tools
2023-10-12 16:30:07 +03:00
Ilya Dmitrichenko
95c5c5ab30 Print artifact source and revision only when available
Signed-off-by: Ilya Dmitrichenko <errordeveloper@gmail.com>
(cherry picked from commit b46e298b4d)
2023-10-12 13:15:10 +00:00
Ilya Dmitrichenko
51532e75b2 Upgrade github.com/fluxcd/pkg/oci
Signed-off-by: Ilya Dmitrichenko <errordeveloper@gmail.com>
(cherry picked from commit e9d4b42b12)
2023-10-12 13:15:10 +00:00
Hidde Beydals
cef3eef641 Merge pull request #4326 from fluxcd/backport-4296-to-release/v2.1.x
[release/v2.1.x] fix: only wait for changeset if the result is not empty
2023-10-12 14:25:35 +02:00
Gergely Brautigam
5e412ee73d fix: only wait for changeset if the result is not empty
Signed-off-by: Gergely Brautigam <182850+Skarlso@users.noreply.github.com>
(cherry picked from commit a51ede681f)
2023-10-12 12:12:21 +00:00
Stefan Prodan
b3e432cd8e Merge pull request #4325 from fluxcd/backport-4324-to-release/v2.1.x
[release/v2.1.x] bootstrap: Fix error msg when the Git token doesn't match the repo owner
2023-10-12 14:43:11 +03:00
Somtochi Onyekwere
62d65edddf Update go-git-providers to v0.19.1
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
(cherry picked from commit 08cb3858ed)
2023-10-12 11:03:48 +00:00
Stefan Prodan
47da5290ce Merge pull request #4322 from fluxcd/backport-4318-to-release/v2.1.x
[release/v2.1.x] build(deps): bump golang.org/x/net from 0.15.0 to 0.17.0
2023-10-12 09:45:08 +03:00
dependabot[bot]
23f9492707 build(deps): bump golang.org/x/net from 0.15.0 to 0.17.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.15.0 to 0.17.0.
- [Commits](https://github.com/golang/net/compare/v0.15.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
(cherry picked from commit 8f7ed74913)
2023-10-12 06:26:22 +00:00
Stefan Prodan
cd16ff4aa4 Merge pull request #4315 from fluxcd/backport-4313-to-release/v2.1.x
[release/v2.1.x] Update toolkit components
2023-10-11 18:41:50 +03:00
fluxcdbot
a0d2c2520c Update toolkit components
- helm-controller to v0.36.2
  https://github.com/fluxcd/helm-controller/blob/v0.36.2/CHANGELOG.md
- kustomize-controller to v1.1.1
  https://github.com/fluxcd/kustomize-controller/blob/v1.1.1/CHANGELOG.md
- source-controller to v1.1.2
  https://github.com/fluxcd/source-controller/blob/v1.1.2/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
(cherry picked from commit 084fb6318d)
2023-10-11 15:24:18 +00:00
Hidde Beydals
026ab61ba7 Merge pull request #4258 from fluxcd/backport-4228-to-release/v2.1.x
[release/v2.1.x] Improve AUR package templates
2023-09-19 13:08:23 +02:00
Son Bui
8da931aed4 Improve AUR package templates
- remove armv6h #4224
- unique source name #4224
- improve pkgver/_srcver #4224
- fix source name in .SRCINFO

Signed-off-by: Son Bui <sonbv00@gmail.com>
(cherry picked from commit f9e7190a04)
2023-09-19 10:47:55 +00:00
Hidde Beydals
24c0de031a Merge pull request #4257 from fluxcd/backport-4233-to-release/v2.1.x
[release/v2.1.x] chore: remove support armv6h for aur package
2023-09-19 12:44:22 +02:00
Son Bui
df60d40f91 chore: remove support armv6h for aur package #4224
Signed-off-by: Son Bui <sonbv00@gmail.com>
(cherry picked from commit bc90e7cf01)
2023-09-19 10:24:21 +00:00
Hidde Beydals
188ce1bad1 Merge pull request #4256 from fluxcd/backport-4255-to-release/v2.1.x
[release/v2.1.x] tests/azure: update controller dependencies
2023-09-19 12:03:16 +02:00
Hidde Beydals
88bad4b7ae tests/azure: update controller dependencies
- github.com/fluxcd/helm-controller/api to v0.36.1
- github.com/fluxcd/image-automation-controller/api to v0.36.1
- github.com/fluxcd/source-controller/api to v1.1.1

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
(cherry picked from commit 1cba3e4476)
2023-09-19 09:33:32 +00:00
Stefan Prodan
4fc2df7b57 Merge pull request #4254 from fluxcd/backport-4251-to-release/v2.1.x
[release/v2.1.x] Update toolkit components
2023-09-19 12:02:11 +03:00
fluxcdbot
0fd975bf66 Update toolkit components
- helm-controller to v0.36.1
  https://github.com/fluxcd/helm-controller/blob/v0.36.1/CHANGELOG.md
- source-controller to v1.1.1
  https://github.com/fluxcd/source-controller/blob/v1.1.1/CHANGELOG.md
- image-automation-controller to v0.36.1
  https://github.com/fluxcd/image-automation-controller/blob/v0.36.1/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
(cherry picked from commit 0c47d738a9)
2023-09-19 08:02:40 +00:00
Stefan Prodan
40992037da Merge pull request #4250 from fluxcd/backport-4226-to-release/v2.1.x
[release/v2.1.x] Update description of kubeconfig specific flag
2023-09-18 13:47:49 +03:00
Somtochi Onyekwere
f94acd5ef3 update description of kubeconfig flags
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
(cherry picked from commit 1654791feb)
2023-09-18 10:32:29 +00:00
Max Jonas Werner
c87f48fdea Merge pull request #4249 from fluxcd/backport-4238-to-release/v2.1.x
[release/v2.1.x] Upgrade github.com/fluxcd/pkg/{git,git/gogit}
2023-09-18 11:34:14 +02:00
Max Jonas Werner
68ff588910 Upgrade github.com/fluxcd/pkg/{git,git/gogit}
This allows us to get rid of the replace directive consuming the
filepath-securejoin fork.

Signed-off-by: Max Jonas Werner <mail@makk.es>
(cherry picked from commit c721474e0b)
2023-09-18 11:18:08 +02:00
Stefan Prodan
f420cfbf7c Merge pull request #4196 from fluxcd/backport-4195-to-release/v2.1.x
[release/v2.1.x] build(deps): bump the ci group with 2 updates
2023-08-28 11:56:17 +03:00
dependabot[bot]
f3e99a6cfa build(deps): bump the ci group with 2 updates
Bumps the ci group with 2 updates: [actions/checkout](https://github.com/actions/checkout) and [slsa-framework/slsa-github-generator](https://github.com/slsa-framework/slsa-github-generator).

Updates `actions/checkout` from 3.5.3 to 3.6.0
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](c85c95e3d7...f43a0e5ff2)

Updates `slsa-framework/slsa-github-generator` from 1.8.0 to 1.9.0
- [Release notes](https://github.com/slsa-framework/slsa-github-generator/releases)
- [Changelog](https://github.com/slsa-framework/slsa-github-generator/blob/main/CHANGELOG.md)
- [Commits](https://github.com/slsa-framework/slsa-github-generator/compare/v1.8.0...v1.9.0)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: slsa-framework/slsa-github-generator
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
(cherry picked from commit 29f77d2cb3)
2023-08-28 08:25:56 +00:00
Stefan Prodan
22cf986a79 Merge pull request #4169 from fluxcd/monitoring-deprecation
Add monitoring configuration deprecation notice
2023-08-24 12:35:06 +03:00
Sunny
d80b697fbd Add monitoring configuration deprecation notice
Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-08-24 14:51:15 +05:30
Stefan Prodan
8b9aaad20a Merge pull request #4189 from fluxcd/update-deps
Update dependencies
2023-08-24 12:15:41 +03:00
Hidde Beydals
4080d5807a tests/azure: update dependencies
- github.com/Azure/azure-event-hubs-go/v3 to v3.6.1
- github.com/fluxcd/helm-controller/api to v0.36.0
- github.com/fluxcd/image-automation-controller/api to v0.36.0
- github.com/fluxcd/image-reflector-controller/api to v0.30.0
- github.com/fluxcd/kustomize-controller/api to v1.1.0
- github.com/fluxcd/notification-controller/api to v1.1.0
- github.com/fluxcd/pkg/apis/event to v0.5.2
- github.com/fluxcd/pkg/apis/meta to v1.1.2
- github.com/fluxcd/pkg/git to v0.13.0
- github.com/fluxcd/pkg/git/gogit to v0.13.0
- github.com/fluxcd/source-controller/api to v1.1.0
- github.com/go-git/go-git/v5 to v5.8.1
- k8s.io/api to v0.27.4
- k8s.io/apimachinery to v0.27.4
- k8s.io/client-go to v0.27.4
- sigs.k8s.io/controller-runtime to v0.15.1

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-24 10:56:11 +02:00
Hidde Beydals
7c2072eed1 Update dependencies
- github.com/ProtonMail/go-crypto to v0.0.0-20230717121422-5aa5874ade95
- github.com/distribution/distribution/v3 to v3.0.0-20230823142118-4f7424c8eb41
- github.com/fluxcd/pkg/apis/event to v0.5.2
- github.com/fluxcd/pkg/git to v0.13.0
- github.com/fluxcd/pkg/git/gogit to v0.13.0
- github.com/fluxcd/pkg/oci to v0.31.0
- github.com/fluxcd/pkg/runtime to v0.42.0
- github.com/fluxcd/pkg/sourceignore to v0.3.5
- github.com/fluxcd/pkg/ssa to v0.32.0
- github.com/fluxcd/pkg/ssh to v0.8.2
- github.com/go-git/go-git/v5 to v5.8.1
- github.com/google/go-containerregistry to v0.16.1
- github.com/onsi/gomega to v1.27.10
- golang.org/x/crypto to v0.12.0
- golang.org/x/term to v0.11.0
- k8s.io/cli-runtime to v0.27.4
- k8s.io/kubectl to v0.27.4
- sigs.k8s.io/cli-utils to v0.35.0

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-24 10:54:40 +02:00
Stefan Prodan
d21e779b9f Merge pull request #4186 from fluxcd/update-components
Update toolkit components
2023-08-24 11:19:58 +03:00
fluxcdbot
f7e5223533 Update toolkit components
- helm-controller to v0.36.0
  https://github.com/fluxcd/helm-controller/blob/v0.36.0/CHANGELOG.md
- kustomize-controller to v1.1.0
  https://github.com/fluxcd/kustomize-controller/blob/v1.1.0/CHANGELOG.md
- source-controller to v1.1.0
  https://github.com/fluxcd/source-controller/blob/v1.1.0/CHANGELOG.md
- notification-controller to v1.1.0
  https://github.com/fluxcd/notification-controller/blob/v1.1.0/CHANGELOG.md
- image-reflector-controller to v0.30.0
  https://github.com/fluxcd/image-reflector-controller/blob/v0.30.0/CHANGELOG.md
- image-automation-controller to v0.36.0
  https://github.com/fluxcd/image-automation-controller/blob/v0.36.0/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
2023-08-24 08:02:17 +00:00
Sanskar Jaiswal
525bd21cd1 Merge pull request #4147 from fluxcd/tls-flags
Adopt Kubernetes style TLS Secrets and add relevant flags
2023-08-23 15:09:40 +05:30
Sanskar Jaiswal
8df27d8c3a modify flux create secret tls to create secrets of type TLS
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-08-23 14:44:10 +05:30
Sanskar Jaiswal
6464d6c7b4 add deprecation warning per secret key field and constant
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-08-23 14:44:09 +05:30
Sanskar Jaiswal
2fc9d73c5f add flag --ca-crt-file to flux create secret git
Add flag `--ca-crt-file` to `flux create secret git` to specify the path
to CA certificate. It takes precedence over `--ca-file` and uses the
key `ca.crt` in the generated Secret.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-08-23 14:44:09 +05:30
Sanskar Jaiswal
b32051df53 deprecate TLS flags for flux create secret helm
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-08-23 14:44:09 +05:30
Sanskar Jaiswal
bf36a29ca2 add support for Kubernetes TLS keys for flux create secret tls
Add support for using `tls.key`, `tls.crt` and `ca.crt` keys while
generating a Secret, using the `--tls-key-file`, `--tls-crt-file` and
`--ca-crt-file` flags respectively.
Mark the flags `--key-file`, `--cert-file` and `--ca-file` as
deprecated.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-08-23 14:44:09 +05:30
Stefan Prodan
a2ac94b625 Merge pull request #4183 from somtochiama/fix-auto-complete
Fix autocompletion for helm chart
2023-08-22 16:57:34 +03:00
Somtochi Onyekwere
c81afa6993 fix autocompletion for helm chart
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-08-22 14:19:08 +01:00
Hidde Beydals
4fa93ec4d6 Merge pull request #4182 from fluxcd/clean-http-client
manifestgen/install: use clean default HTTP client
2023-08-22 14:20:17 +02:00
Hidde Beydals
00c6ac81b9 manifestgen/install: use clean default HTTP client
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-22 14:05:12 +02:00
Hidde Beydals
8801031f06 Merge pull request #4181 from fluxcd/cmd-events-err-fix
cmd/events: handle error value
2023-08-22 13:57:56 +02:00
Hidde Beydals
2a033215a4 cmd/events: handle error value
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-22 13:39:39 +02:00
Stefan Prodan
8214fefde6 Merge pull request #4180 from fluxcd/fix-version-info
Fix controller version info
2023-08-22 12:56:14 +03:00
Stefan Prodan
4cdb75b74d Fix controller version info
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-08-22 12:36:58 +03:00
Stefan Prodan
eac82585ad Merge pull request #4177 from fluxcd/min-rsa-size
Set min value for the `--ssh-rsa-bits` flag
2023-08-22 11:59:35 +03:00
Stefan Prodan
2c76c70205 Set min value for the --ssh-rsa-bits flag
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-08-22 11:42:33 +03:00
Hidde Beydals
a9e09b856f Merge pull request #4176 from fluxcd/e2e-improvements
ci: disable fail-fast for ARM end-to-end
2023-08-21 17:40:59 +02:00
Hidde Beydals
c03a0b7f87 ci: disable fail-fast for ARM end-to-end
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-21 17:17:02 +02:00
Hidde Beydals
0ab8740832 cmd: address typo in end-to-end tests
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-21 17:17:02 +02:00
Hidde Beydals
aa1eae22c7 Merge pull request #4175 from fluxcd/update-securejoin
build: update securejoin dependency
2023-08-21 16:58:23 +02:00
Hidde Beydals
4f3b34f86b build: update securejoin dependency
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-21 16:36:52 +02:00
Stefan Prodan
8435cb8df9 Merge pull request #4167 from fluxcd/dependabot/github_actions/ci-ab6beeed51
build(deps): bump the ci group with 2 updates
2023-08-18 12:16:37 +03:00
dependabot[bot]
0d457d6d11 build(deps): bump the ci group with 2 updates
Bumps the ci group with 2 updates: [korthout/backport-action](https://github.com/korthout/backport-action) and [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action).


Updates `korthout/backport-action` from 1.3.1 to 1.4.0
- [Release notes](https://github.com/korthout/backport-action/releases)
- [Commits](bf5fdd624b...bd68141f07)

Updates `goreleaser/goreleaser-action` from 4.3.0 to 4.4.0
- [Release notes](https://github.com/goreleaser/goreleaser-action/releases)
- [Commits](336e29918d...3fa32b8bb5)

---
updated-dependencies:
- dependency-name: korthout/backport-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: goreleaser/goreleaser-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-17 09:50:14 +00:00
Stefan Prodan
484015ceea Merge pull request #4166 from fluxcd/e2e-kube-1.28.0
e2e: Add Kubernetes v1.28.0 to conformance tests
2023-08-17 12:47:35 +03:00
Stefan Prodan
1b5c4245df e2e: Add Kubernetes v1.28.0 to conformance tests
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-08-17 11:45:36 +03:00
Stefan Prodan
ce68a06436 Merge pull request #4142 from fluxcd/dependabot/github_actions/ci-a9a55711ae
build(deps): bump the ci group with 2 updates
2023-08-10 12:00:07 +03:00
dependabot[bot]
7273059cb9 build(deps): bump the ci group with 2 updates
Bumps the ci group with 2 updates: [actions/setup-go](https://github.com/actions/setup-go) and [slsa-framework/slsa-github-generator](https://github.com/slsa-framework/slsa-github-generator).


Updates `actions/setup-go` from 4.0.1 to 4.1.0
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](fac708d667...93397bea11)

Updates `slsa-framework/slsa-github-generator` from 1.7.0 to 1.8.0
- [Release notes](https://github.com/slsa-framework/slsa-github-generator/releases)
- [Changelog](https://github.com/slsa-framework/slsa-github-generator/blob/main/CHANGELOG.md)
- [Commits](https://github.com/slsa-framework/slsa-github-generator/compare/v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: slsa-framework/slsa-github-generator
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-09 16:35:22 +00:00
Hidde Beydals
a03ea8ace3 Merge pull request #4151 from fluxcd/enable-codeql-quality
ci: enable security-and-quality CodeQL query
2023-08-09 18:32:15 +02:00
Hidde Beydals
d6cbfa39f8 ci: enable security-and-quality CodeQL query
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-09 18:14:39 +02:00
Sunny
a2e4cbbfe2 Merge pull request #4134 from sestegra/monitor
monitoring: add OCIRepository in cluster dashboard and new source panels in control-plane dashboard
2023-08-09 14:42:35 +05:30
Stéphane Este-Gracias
23518953d0 monitoring: add Sources Stats panels
Signed-off-by: Stéphane Este-Gracias <sestegra@gmail.com>
2023-08-09 14:22:33 +05:30
Stéphane Este-Gracias
2716ca449e monitoring: add OCIRepository in cluster dashboard panels
Signed-off-by: Stéphane Este-Gracias <sestegra@gmail.com>
2023-08-09 14:21:49 +05:30
Hidde Beydals
ecb1ad6ca5 Merge pull request #4140 from somtochiama/disable-test 2023-08-08 20:48:09 +02:00
Somtochi Onyekwere
3fa7af12e0 disable e2e test
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-08-08 16:35:47 +01:00
Stefan Prodan
12efb1967e Merge pull request #4131 from mraerino/fix/diff-with-multiobj
Fix selection of kustomization resource from multi doc yaml
2023-08-07 14:04:32 +03:00
Marcus Weiner
56b1e80758 Fix selection of kustomization resource from multi doc yaml
Signed-off-by: Marcus Weiner <marcus.weiner@gmail.com>
2023-08-07 12:05:29 +02:00
Stefan Prodan
baf874ea67 Merge pull request #4126 from fluxcd/min-kube-1.25
Set Kubernetes min version to 1.25
2023-08-03 13:39:24 +03:00
Stefan Prodan
28262f59d3 Set Kubernetes min version to 1.25
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-08-02 14:17:30 +03:00
Stefan Prodan
44d69d6fc0 Merge pull request #4077 from fluxcd/dependabot/github_actions/ci-f6f7181596
build(deps): bump the ci group with 2 updates
2023-07-17 18:24:01 +03:00
dependabot[bot]
4d76ff4e6a build(deps): bump the ci group with 2 updates
Bumps the ci group with 2 updates: [helm/kind-action](https://github.com/helm/kind-action) and [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action).


Updates `helm/kind-action` from 1.7.0 to 1.8.0
- [Release notes](https://github.com/helm/kind-action/releases)
- [Commits](fa81e57adf...dda0770415)

Updates `docker/setup-buildx-action` from 2.8.0 to 2.9.1
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](16c0bc4a6e...4c0219f9ac)

---
updated-dependencies:
- dependency-name: helm/kind-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-17 00:37:57 +00:00
Stefan Prodan
1eaf259e52 Merge pull request #4068 from fluxcd/up-deps-tests
Update dependencies
2023-07-11 14:51:19 +03:00
Stefan Prodan
bca1fa0968 Update dependencies
- bump the APIs packages in tests
- bump golang crypto and term to latest

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-11 14:14:27 +03:00
Hidde Beydals
bd79884d84 Merge pull request #4065 from fluxcd/action-toolcache
action: support `openssl` and `sha256sum`
2023-07-11 11:11:11 +02:00
Hidde Beydals
3b42b200d3 action: support openssl and sha256sum
As availability may be limited in some edge cases.

When a job is for example running within a container, `openssl` is not
always available. However, when running on a macOS or Windows runner,
the actual opposite is true.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-07-11 11:10:08 +02:00
souleb
dad4a20fa7 Merge pull request #4062 from souleb/fix-diff-kustomization
diff: Take into account the server-side inventory for local Flux Kustomizations
2023-07-11 10:32:38 +02:00
Soule BA
90d95988aa Take into account the server-side inventory for local diff
If implemented users will be able to use a local kustomization file while
retrieving status from the live kustomization file.

Signed-off-by: Soule BA <soule@weave.works>
2023-07-11 10:19:12 +02:00
Hidde Beydals
e88577fe52 Merge pull request #4061 from fluxcd/action-toolcache
action: re-allow configuration of non-default token
2023-07-10 16:39:52 +02:00
Hidde Beydals
6fa495b843 action: re-allow configuration of non-default token
To allow usage of action on GitHub Enterprise instances.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-07-10 16:25:36 +02:00
Stefan Prodan
3311bfd3ca Merge pull request #4057 from fluxcd/update-components
Update toolkit components
2023-07-10 15:32:15 +03:00
fluxcdbot
cfd4d285da Update toolkit components
- kustomize-controller to v1.0.1
  https://github.com/fluxcd/kustomize-controller/blob/v1.0.1/CHANGELOG.md
- source-controller to v1.0.1
  https://github.com/fluxcd/source-controller/blob/v1.0.1/CHANGELOG.md
- image-reflector-controller to v0.29.1
  https://github.com/fluxcd/image-reflector-controller/blob/v0.29.1/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
2023-07-10 12:02:21 +00:00
Stefan Prodan
c751bf6bdb Merge pull request #4052 from fluxcd/docs-gh-action
docs: Link to the Flux GitHub Action documentation
2023-07-07 18:10:17 +03:00
Stefan Prodan
6f94844a35 docs: Link to the Flux GitHub Action documentation
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-07 17:45:51 +03:00
Hidde Beydals
f74d097837 Merge pull request #4051 from fluxcd/action-toolcache
action: use `$RUNNER_TOOL_CACHE`, support MacOS and Windows, validate checksum
2023-07-07 12:08:57 +02:00
Hidde Beydals
0a58b0cdad ci: add workflow to test action
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-07-07 11:56:00 +02:00
Hidde Beydals
6f94ec728f action: rewrite action to use $RUNNER_TOOL_CACHE
Plus the verification of the SHA256 of the archive, as advertised in
the checksum file published together with the release.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-07-07 11:50:33 +02:00
Stefan Prodan
e3747209eb Merge pull request #4043 from fluxcd/ci-release-fix-slsa-tag
ci: release: extract the image tag from GITHUB_REF
2023-07-06 11:11:01 +03:00
Stefan Prodan
36b39a50a4 ci: release: extract the image tag from GITHUB_REF
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-06 10:40:50 +03:00
Hidde Beydals
d9c7ff8685 Merge pull request #4046 from fluxcd/fix-backport
ci: backport: set write permissions
2023-07-06 09:35:23 +02:00
Stefan Prodan
625d865625 ci: backport: set write permissions
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-06 10:21:16 +03:00
Hidde Beydals
00c6bd0240 Merge pull request #4041 from fluxcd/ci-release-fix-slsa
ci: release: disable interpretation backslash esc
2023-07-05 17:21:54 +02:00
Hidde Beydals
506da2466b ci: release: disable interpretation backslash esc
This ensures `jq` can properly parse the given `ARTIFACTS` JSON blob,
as it contains escaped newlines in for example the Brew formula.

This should address the issue with the generation of SLSA metadata.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-07-05 17:07:03 +02:00
Stefan Prodan
9ea0a535ea Merge pull request #4035 from fluxcd/up-go-deps
Update dependencies
2023-07-04 18:03:22 +03:00
Stefan Prodan
25d2a3cdf1 Bump kubectl to v1.27.3
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-04 17:37:10 +03:00
Stefan Prodan
9fa59df798 Update dependencies
- k8s.io/* v0.27.3
- github.com/fluxcd/go-git-providers v0.18.0
- github.com/fluxcd/pkg/git v0.12.3
- github.com/fluxcd/pkg/oci v0.28.0
- github.com/fluxcd/pkg/runtime v0.40.0
- github.com/fluxcd/pkg/ssa v0.28.2
- github.com/fluxcd/pkg/ssh v0.8.0
- github.com/homeport/dyff v1.5.8
- golang.org/x/crypto v0.10.0

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-04 17:35:34 +03:00
Stefan Prodan
93c0467f91 Merge pull request #4006 from fluxcd/update-components
Update toolkit components
2023-07-04 17:22:34 +03:00
fluxcdbot
c377fe7651 Update toolkit components
- helm-controller to v0.35.0
  https://github.com/fluxcd/helm-controller/blob/v0.35.0/CHANGELOG.md
- kustomize-controller to v1.0.0
  https://github.com/fluxcd/kustomize-controller/blob/v1.0.0/CHANGELOG.md
- source-controller to v1.0.0
  https://github.com/fluxcd/source-controller/blob/v1.0.0/CHANGELOG.md
- notification-controller to v1.0.0
  https://github.com/fluxcd/notification-controller/blob/v1.0.0/CHANGELOG.md
- image-reflector-controller to v0.29.0
  https://github.com/fluxcd/image-reflector-controller/blob/v0.29.0/CHANGELOG.md
- image-automation-controller to v0.35.0
  https://github.com/fluxcd/image-automation-controller/blob/v0.35.0/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
2023-07-04 12:26:47 +00:00
Stefan Prodan
9ed24522bb Merge pull request #4033 from fluxcd/docs-release-links
docs: link to releases spec from website
2023-07-04 15:26:15 +03:00
Stefan Prodan
ddcabbf95d docs: link to releases spec from website
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-04 15:13:06 +03:00
Stefan Prodan
5c58b45340 Merge pull request #4031 from fluxcd/ci-e2e-k8s
Run conformance tests for Kubernetes v1.27.3
2023-07-04 14:59:55 +03:00
Stefan Prodan
5690b639cd Run conformance tests for Kubernetes v1.27.3
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-04 14:46:43 +03:00
Stefan Prodan
22d0ff8173 Merge pull request #4029 from fluxcd/ci-release-workflows
Run e2e tests on release branches
2023-07-04 14:11:03 +03:00
Stefan Prodan
8e61fe805c ci: group all GH action updates under the same PR
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-04 13:43:22 +03:00
Stefan Prodan
5356436c94 ci: enable workflows for release/** branches
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-04 13:27:33 +03:00
Stefan Prodan
8ca8b92f92 ci: run backport under fluxcdbot account
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-04 12:21:22 +03:00
Stefan Prodan
7c98f20e11 Merge pull request #3254 from fluxcd/docs-release-spec
Flux GA release spec and long term support pledge
2023-07-03 16:57:09 +03:00
Stefan Prodan
1a8798a5d4 Link to release cadence from minor section
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-03 16:41:11 +03:00
Hidde Beydals
926842a216 Address review comment section titles
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-07-03 16:41:08 +03:00
Hidde Beydals
9e11b860ec Address release procedure review nits
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-07-03 16:41:08 +03:00
Hidde Beydals
5abf1ee817 Address various nits
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-07-03 16:41:08 +03:00
Hidde Beydals
4e78e80619 Document various release procedures
This lacks documentation for the Terraform provider repository, which
is a higher level component than anything documented here.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-07-03 16:41:08 +03:00
Stefan Prodan
33be9840f0 Apply suggestions from code review
Co-authored-by: Max Jonas Werner <makkes@users.noreply.github.com>
Co-authored-by: Aurel Canciu <aurelcanciu@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-03 16:41:08 +03:00
Stefan Prodan
33fdaee399 Move the release procedures to dedicated doc
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-03 16:41:07 +03:00
Stefan Prodan
91660a98d5 Add SLSA provenance to release artifacts
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-03 16:41:07 +03:00
Stefan Prodan
8d5c4492d8 Apply suggestions from code review
Co-authored-by: Aurel Canciu <aurelcanciu@gmail.com>
Co-authored-by: Hidde Beydals <hiddeco@users.noreply.github.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-03 16:41:07 +03:00
Stefan Prodan
29ad52bb46 Add Flux release spec
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-03 16:41:07 +03:00
Stefan Prodan
590b7b7682 Add controller release artifacts spec
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-03 16:41:07 +03:00
Stefan Prodan
ea06d9614f Add API versioning spec
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-03 16:41:07 +03:00
Stefan Prodan
41ba55634a Add controller release spec
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-03 16:41:07 +03:00
Stefan Prodan
f09616e780 Add shared packages release spec
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-03 16:41:07 +03:00
Stefan Prodan
a4d7e35cdd Cleanup internal docs
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-03 16:41:06 +03:00
Stefan Prodan
346e0ea734 Merge pull request #4028 from fluxcd/prefix-ggp-error
Annotate errors from go-git-providers
2023-07-03 16:38:58 +03:00
Max Jonas Werner
ce854236cf Annotate errors from go-git-providers
closes #3623

Signed-off-by: Max Jonas Werner <mail@makk.es>
2023-07-03 13:55:53 +02:00
Hidde Beydals
1588663358 Merge pull request #4027 from fluxcd/bump-gogit
Update go-git to unreleased v5.8.0
2023-07-03 13:39:53 +02:00
Hidde Beydals
68fdc0a2b6 Update go-git to unreleased v5.8.0
To improve support for Git >=v2.41.0.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-07-03 12:55:59 +02:00
Stefan Prodan
d335f8f981 Merge pull request #4025 from fluxcd/dependabot/github_actions/docker/setup-buildx-action-2.8.0
build(deps): bump docker/setup-buildx-action from 2.7.0 to 2.8.0
2023-06-30 18:01:28 +03:00
dependabot[bot]
b4efd15afd build(deps): bump docker/setup-buildx-action from 2.7.0 to 2.8.0
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2.7.0 to 2.8.0.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](ecf95283f0...16c0bc4a6e)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-30 14:47:48 +00:00
Stefan Prodan
0e6f9da761 Merge pull request #4024 from fluxcd/dependabot/github_actions/sigstore/cosign-installer-3.1.1
build(deps): bump sigstore/cosign-installer from 3.1.0 to 3.1.1
2023-06-30 17:47:07 +03:00
dependabot[bot]
02b34f05c8 build(deps): bump sigstore/cosign-installer from 3.1.0 to 3.1.1
Bumps [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) from 3.1.0 to 3.1.1.
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](d13028333d...6e04d228eb)

---
updated-dependencies:
- dependency-name: sigstore/cosign-installer
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-30 14:29:43 +00:00
Stefan Prodan
f26800eb85 Merge pull request #4023 from fluxcd/backport-automation
Add backport GitHub Action workflow
2023-06-30 17:29:19 +03:00
Stefan Prodan
d2cc01169b Declaratively define (and sync) labels
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-06-30 17:04:12 +03:00
Stefan Prodan
d8924cd8a9 Add backport GitHub Action workflow
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-06-30 16:55:54 +03:00
Stefan Prodan
25af5d2968 Merge pull request #3755 from rishinair11/add_multiple_args
Allow multiple arguments for "flux suspend/resume"
2023-06-29 11:20:12 +03:00
Rishikesh Nair
3580d4ff85 Add examples for resuming/suspending multiple objects
Signed-off-by: Rishikesh Nair <alienware505@gmail.com>
2023-06-29 12:50:38 +05:30
Rishikesh Nair
42607aadc3 Add support for passing multiple objects to suspend/resume commands
This change adds support for running `suspend/resume` on multiple
supported resources at the same time. This improves the user
experience by converting

```
flux suspend ks operator && \
flux suspend ks database && \
flux suspend ks app
```

to

```
flux suspend ks operator database app
```

This works for all types of resources (Kustomizations, Sources, etc.)
since it has been implemented at the `suspend.go` and `resume.go`
level.

When the `--wait` flag is passed to the `resume` command, then Flux
will wait for all resources in parallel within a goroutine each.

Each object is only processed once, even if user provided its name
more than once.

If suspension or resuming fails for one object, it is still carried
out for the remaining objects.

As a special case, the old behaviour of `resume` is retained, i.e.
when only one object name is provided, `resume` waits for the object
to become ready even if the `--wait` flag is not provided. In all
other cases the `--wait` flag is always considered.

closes #3746
closes #3793

Co-Authored-By: Max Jonas Werner <mail@makk.es>
Signed-off-by: Rishikesh Nair <alienware505@gmail.com>
Signed-off-by: Max Jonas Werner <mail@makk.es>
2023-06-29 08:23:13 +02:00
Stefan Prodan
2fe86a4cde Merge pull request #4020 from fluxcd/min-kube-1.24
Set minimum supported version to Kubernetes 1.24.0
2023-06-28 18:33:19 +03:00
Stefan Prodan
db0256e0f7 Set minimum supported version to Kubernetes 1.24.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-06-28 17:36:04 +03:00
Stefan Prodan
224e808c21 Merge pull request #4018 from fluxcd/fix-push-aws-doc
docs: Fix the `flux push` example for ECR
2023-06-27 17:59:45 +03:00
Stefan Prodan
6ed6b937f8 Fix the flux push example for ECR
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-06-27 16:33:40 +03:00
Stefan Prodan
99b940f56f Merge pull request #4015 from fluxcd/go.mod-1.20
Align `go.mod` version with Kubernetes (Go 1.20)
2023-06-27 08:35:52 +03:00
Stefan Prodan
66a417a3ee Bump Go to 1.20 in aur deps
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-06-26 19:52:26 +03:00
Stefan Prodan
761762bdc0 Align go.mod version with Kubernetes (Go 1.20)
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-06-26 19:36:20 +03:00
Sanskar Jaiswal
bd8ada9e4a Merge pull request #3990 from fluxcd/rfc-insecure-http
RFC-0004: add section about proxy
2023-06-26 19:27:50 +05:30
Sanskar Jaiswal
ba5c7e4fc3 RFC-0004: add section about proxy
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-06-26 19:07:18 +05:30
Stefan Prodan
903284fe59 Merge pull request #4008 from fluxcd/slsa3
Add SLSA3 generators to release workflow
2023-06-26 13:21:01 +03:00
Stefan Prodan
cf7ee0081c Add SLSA3 generators to release workflow
Generate SLSA level 3 provenance attestations for the release assets and for the multi-arch container images.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-06-26 12:40:35 +03:00
Hidde Beydals
e6a1d8156b Merge pull request #4012 from fluxcd/dependabot/github_actions/ossf/scorecard-action-2.2.0
build(deps): bump ossf/scorecard-action from 2.1.3 to 2.2.0
2023-06-26 10:56:52 +02:00
dependabot[bot]
b850f51ef5 build(deps): bump ossf/scorecard-action from 2.1.3 to 2.2.0
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.1.3 to 2.2.0.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](80e868c13c...08b4669551)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-26 08:40:29 +00:00
Hidde Beydals
4e57de4776 Merge pull request #4011 from fluxcd/dependabot/github_actions/sigstore/cosign-installer-3.1.0
build(deps): bump sigstore/cosign-installer from 3.0.5 to 3.1.0
2023-06-26 10:39:50 +02:00
dependabot[bot]
0a2945e7f1 build(deps): bump sigstore/cosign-installer from 3.0.5 to 3.1.0
Bumps [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) from 3.0.5 to 3.1.0.
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](dd6b2e2b61...d13028333d)

---
updated-dependencies:
- dependency-name: sigstore/cosign-installer
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-26 08:27:20 +00:00
Hidde Beydals
4f9beae49d Merge pull request #4010 from fluxcd/dependabot/github_actions/anchore/sbom-action-0.14.3
build(deps): bump anchore/sbom-action from 0.14.2 to 0.14.3
2023-06-26 09:58:53 +02:00
dependabot[bot]
15a49334d8 build(deps): bump anchore/sbom-action from 0.14.2 to 0.14.3
Bumps [anchore/sbom-action](https://github.com/anchore/sbom-action) from 0.14.2 to 0.14.3.
- [Release notes](https://github.com/anchore/sbom-action/releases)
- [Commits](4d571ad103...78fc58e266)

---
updated-dependencies:
- dependency-name: anchore/sbom-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-26 01:16:48 +00:00
Max Jonas Werner
cf5e7c39e0 Merge pull request #4002 from fluxcd/fix-get-all
Don't log errors with missing CRDs for "get * all" commands
2023-06-22 18:40:27 +02:00
Max Jonas Werner
173ee5fcdc Don't log errors with missing CRDs for "get * all" commands
Whenever an API type is not available then both, `flux get all` and
`flux get image all` will just skip over that type instead of logging
an error message.

Before:

```
$ flux get all
✗ failed to get API group resources: unable to retrieve the complete
list of server APIs: source.toolkit.fluxcd.io/v1beta2: the server
could not find the requested resource
[...]
✗ failed to get API group resources: unable to retrieve the complete
list of server APIs: image.toolkit.fluxcd.io/v1beta2: the server could
not find the requested resource
✗ failed to get API group resources: unable to retrieve the complete
list of server APIs: image.toolkit.fluxcd.io/v1beta2: the server could
not find the requested resource
[...]
$ echo $?
0
```

After:

```
$ flux get all
$ echo $?
0
```
closes #3973

Signed-off-by: Max Jonas Werner <mail@makk.es>
2023-06-22 18:03:38 +02:00
Stefan Prodan
67968dff7e Merge pull request #3981 from fluxcd/dependabot/github_actions/docker/setup-buildx-action-2.7.0
build(deps): bump docker/setup-buildx-action from 2.6.0 to 2.7.0
2023-06-19 14:30:15 +03:00
dependabot[bot]
c596c70d42 build(deps): bump docker/setup-buildx-action from 2.6.0 to 2.7.0
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2.6.0 to 2.7.0.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](6a58db7e0d...ecf95283f0)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-19 11:07:15 +00:00
Max Jonas Werner
d30c3aef32 Merge pull request #3983 from fluxcd/dependabot/github_actions/peter-evans/create-pull-request-5.0.2
build(deps): bump peter-evans/create-pull-request from 5.0.1 to 5.0.2
2023-06-19 12:58:51 +02:00
dependabot[bot]
f7e5101753 build(deps): bump peter-evans/create-pull-request from 5.0.1 to 5.0.2
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 5.0.1 to 5.0.2.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](284f54f989...153407881e)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-19 10:37:22 +00:00
Stefan Prodan
597b13d1b3 Merge pull request #3982 from fluxcd/dependabot/github_actions/goreleaser/goreleaser-action-4.3.0
build(deps): bump goreleaser/goreleaser-action from 4.2.0 to 4.3.0
2023-06-19 13:36:38 +03:00
dependabot[bot]
2b8385a874 build(deps): bump goreleaser/goreleaser-action from 4.2.0 to 4.3.0
Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 4.2.0 to 4.3.0.
- [Release notes](https://github.com/goreleaser/goreleaser-action/releases)
- [Commits](f82d6c1c34...336e29918d)

---
updated-dependencies:
- dependency-name: goreleaser/goreleaser-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-19 01:17:57 +00:00
Hidde Beydals
ddcc301ab6 Merge pull request #3976 from darklore/brew-completion
Use equivalent and shorter way to generate shell completions
2023-06-14 22:00:11 +02:00
Katsunori Tanaka
ab983c678f Use equivalent and shorter way to generate shell completions
Signed-off-by: Katsunori Tanaka <958690+darklore@users.noreply.github.com>
2023-06-15 01:18:18 +09:00
Sunny
79dfbec910 Merge pull request #3955 from somtochiama/fix-kustomize-deprecated
Fix 'patchesJson6902' is deprecated' warning
2023-06-14 21:18:14 +05:30
Somtochi Onyekwere
6bf439d4ce fix 'patchesJson6902' is deprecated' warning
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-06-14 16:32:27 +01:00
Max Jonas Werner
063c5ee328 Merge pull request #3967 from fluxcd/dependabot/github_actions/docker/login-action-2.2.0
build(deps): bump docker/login-action from 2.1.0 to 2.2.0
2023-06-12 12:44:58 +02:00
dependabot[bot]
19137b8e8c build(deps): bump docker/login-action from 2.1.0 to 2.2.0
Bumps [docker/login-action](https://github.com/docker/login-action) from 2.1.0 to 2.2.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](f4ef78c080...465a07811f)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-12 10:10:29 +00:00
Max Jonas Werner
95aa30ad41 Merge pull request #3966 from fluxcd/dependabot/github_actions/docker/setup-qemu-action-2.2.0
build(deps): bump docker/setup-qemu-action from 2.1.0 to 2.2.0
2023-06-12 12:09:21 +02:00
dependabot[bot]
55aa96a33a build(deps): bump docker/setup-qemu-action from 2.1.0 to 2.2.0
Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 2.1.0 to 2.2.0.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](e81a89b173...2b82ce82d5)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-12 09:53:46 +00:00
Max Jonas Werner
5460348450 Merge pull request #3965 from fluxcd/dependabot/github_actions/actions/checkout-3.5.3
build(deps): bump actions/checkout from 3.5.2 to 3.5.3
2023-06-12 11:53:08 +02:00
dependabot[bot]
0d1a68ecb4 build(deps): bump actions/checkout from 3.5.2 to 3.5.3
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.2 to 3.5.3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](8e5e7e5ab8...c85c95e3d7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-12 09:39:54 +00:00
Max Jonas Werner
98466220c7 Merge pull request #3964 from fluxcd/dependabot/github_actions/docker/setup-buildx-action-2.6.0
build(deps): bump docker/setup-buildx-action from 2.5.0 to 2.6.0
2023-06-12 11:39:14 +02:00
dependabot[bot]
6d2dd076dc build(deps): bump docker/setup-buildx-action from 2.5.0 to 2.6.0
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2.5.0 to 2.6.0.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](4b4e9c3e2d...6a58db7e0d)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-12 09:25:10 +00:00
Max Jonas Werner
5e07bcb79a Merge pull request #3968 from fluxcd/dependabot/github_actions/github/codeql-action-2.13.4
build(deps): bump github/codeql-action from 2.3.6 to 2.13.4
2023-06-12 11:24:32 +02:00
dependabot[bot]
9c81a74743 build(deps): bump github/codeql-action from 2.3.6 to 2.13.4
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.3.6 to 2.13.4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](83f0fe6c49...cdcdbb5797)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-12 01:20:41 +00:00
Max Jonas Werner
a3f2b1d829 Merge pull request #3945 from fluxcd/lenient-logs-cmd
Make `flux logs` more lenient
2023-06-05 10:19:54 +02:00
Max Jonas Werner
cbdd71e44e Make flux logs more lenient
UX changes:

- Only print an error when a pod doesn't have a matching container
  instead of exiting early.
- Return a non-zero status code when no pod is found at all.

Details:

In certain situations there might be 3rd-party pods running in the
Flux namespace that cause the command to fail streaming logs, e.g.
when they have multiple containers but none of them is called
`manager` (which all Flux-maintained pods do). An example of such a
situation is when Flux is installed with the 3rd-party Flux extension
on AKS.

The `logs` command is now more forgiving and merely logs an error in
these situations instead of completely bailing out. It still returns a
non-zero exit code.

For the parallel log streaming with `-f` the code is now a little more
complex so that errors are now written to stderr in parallel with all
other logs written to stdout. That's what `asyncCopy` is for.

refs #3944

Signed-off-by: Max Jonas Werner <mail@makk.es>
2023-06-05 10:07:38 +02:00
Max Jonas Werner
f01cf5e04c Merge pull request #3952 from fluxcd/dependabot/github_actions/github/codeql-action-2.3.6
build(deps): bump github/codeql-action from 2.3.5 to 2.3.6
2023-06-05 08:29:33 +02:00
dependabot[bot]
bbb3063cb2 build(deps): bump github/codeql-action from 2.3.5 to 2.3.6
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.3.5 to 2.3.6.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](0225834cc5...83f0fe6c49)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-05 01:19:20 +00:00
Hidde Beydals
c0fa6e6939 Merge pull request #3940 from somtochiama/fix-azure
Set controller runtime logger in Azure e2e tests
2023-06-01 13:04:50 +02:00
Somtochi Onyekwere
0337362eec return clone error
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-06-01 12:49:09 +02:00
Somtochi Onyekwere
fb3013cb95 set logger for controller runtime
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-06-01 12:49:09 +02:00
Hidde Beydals
833fec3d21 Merge pull request #3943 from fluxcd/update-components
Update toolkit components
2023-06-01 12:48:44 +02:00
Hidde Beydals
007b79c729 Update github.com/fluxcd/pkg/git/gogit to v0.12.0
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-06-01 12:28:52 +02:00
Hidde Beydals
09f55955e8 tests/azure: update dependencies
- github.com/Azure/azure-event-hubs-go/v3 to v3.6.0
- github.com/fluxcd/helm-controller/api to v0.34.1
- github.com/fluxcd/image-automation-controller/api to v0.34.1
- github.com/fluxcd/pkg/git/gogit to v0.12.0
- github.com/fluxcd/source-controller/api to v1.0.0-rc.5
- github.com/stretchr/testify to v1.8.4

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-06-01 12:07:58 +02:00
fluxcdbot
29c2c72d8f Update toolkit components
- helm-controller to v0.34.1
  https://github.com/fluxcd/helm-controller/blob/v0.34.1/CHANGELOG.md
- source-controller to v1.0.0-rc.5
  https://github.com/fluxcd/source-controller/blob/v1.0.0-rc.5/CHANGELOG.md
- image-automation-controller to v0.34.1
  https://github.com/fluxcd/image-automation-controller/blob/v0.34.1/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
2023-06-01 10:01:54 +00:00
Sanskar Jaiswal
ae9b541ce2 Merge pull request #3938 from fluxcd/e2e-azure-main
e2e: Run e2e Azure tests for PRs to main if tests or wofklow changes
2023-05-31 21:34:20 +05:30
Sanskar Jaiswal
8d86637d3f e2e: run e2e Azure tests for PRs to main if tests or wofklow changes
Run e2e Azure tests for PRs and commits to main if the `tests` directory
or the Azure workflow itself changes.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-05-31 18:07:40 +05:30
Sanskar Jaiswal
390ff1bcf7 Merge pull request #3932 from aryan9600/null-logger
Set `controller-runtime` logger to a null logger
2023-05-30 15:23:57 +05:30
Sanskar Jaiswal
aa65589391 set controller-runtime logger to a null logger
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
error. Ref: 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.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-05-30 14:40:17 +05:30
Stefan Prodan
9ee23a9086 Merge pull request #3929 from fluxcd/up-git-pkg
Update Git packages
2023-05-29 14:29:50 +03:00
Stefan Prodan
41cdd3dcf7 Update Git packages
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-29 14:13:56 +03:00
Stefan Prodan
aba5741450 Merge pull request #3922 from fluxcd/update-components
Update toolkit components
2023-05-29 13:33:08 +03:00
fluxcdbot
cb5eb417c5 Update toolkit components
- helm-controller to v0.34.0
  https://github.com/fluxcd/helm-controller/blob/v0.34.0/CHANGELOG.md
- kustomize-controller to v1.0.0-rc.4
  https://github.com/fluxcd/kustomize-controller/blob/v1.0.0-rc.4/CHANGELOG.md
- source-controller to v1.0.0-rc.4
  https://github.com/fluxcd/source-controller/blob/v1.0.0-rc.4/CHANGELOG.md
- notification-controller to v1.0.0-rc.4
  https://github.com/fluxcd/notification-controller/blob/v1.0.0-rc.4/CHANGELOG.md
- image-reflector-controller to v0.28.0
  https://github.com/fluxcd/image-reflector-controller/blob/v0.28.0/CHANGELOG.md
- image-automation-controller to v0.34.0
  https://github.com/fluxcd/image-automation-controller/blob/v0.34.0/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
2023-05-29 10:04:34 +00:00
Stefan Prodan
9f8b8b624b Merge pull request #3928 from fluxcd/k8s-1.27.2
Update kubectl to v1.27.2 in flux-cli image
2023-05-29 13:03:52 +03:00
Stefan Prodan
8728b07e85 Update kubectl to v1.27.2 in flux-cli image
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-29 12:47:54 +03:00
Stefan Prodan
e1ffd83b64 Merge pull request #3918 from somtochiama/retry-oci-push
Retry oci push operations
2023-05-29 12:14:24 +03:00
Somtochi Onyekwere
020a494f3f Retry oci push operations
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-05-29 09:59:47 +01:00
Stefan Prodan
96ed1e1372 Merge pull request #3927 from fluxcd/dependabot/github_actions/github/codeql-action-2.3.5
build(deps): bump github/codeql-action from 2.3.3 to 2.3.5
2023-05-29 10:54:54 +03:00
dependabot[bot]
860682e476 build(deps): bump github/codeql-action from 2.3.3 to 2.3.5
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.3.3 to 2.3.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](29b1f65c5e...0225834cc5)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-29 07:24:59 +00:00
Stefan Prodan
2903b4910c Merge pull request #3926 from fluxcd/dependabot/github_actions/snyk/actions-b98d498629f1c368650224d6d212bf7dfa89e4bf
build(deps): bump snyk/actions from 806182742461562b67788a64410098c9d9b96adb to b98d498629f1c368650224d6d212bf7dfa89e4bf
2023-05-29 10:24:22 +03:00
dependabot[bot]
c07e33eff0 build(deps): bump snyk/actions
Bumps [snyk/actions](https://github.com/snyk/actions) from 806182742461562b67788a64410098c9d9b96adb to b98d498629f1c368650224d6d212bf7dfa89e4bf.
- [Release notes](https://github.com/snyk/actions/releases)
- [Commits](8061827424...b98d498629)

---
updated-dependencies:
- dependency-name: snyk/actions
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-29 01:21:22 +00:00
Stefan Prodan
a5b1b04915 Merge pull request #3924 from hgranillo/main
Fix break lines in create helmrelease and source
2023-05-26 17:21:31 +03:00
Horacio Granillo
799848c2a0 Fix break lines in create helmrelease and source
Signed-off-by: Horacio Granillo <horacio.granillo@smarttra.de>
2023-05-26 15:37:55 +02:00
Stefan Prodan
7e6cd34071 Merge pull request #3675 from raffis/feat-reconcilechart
feat: add reconcile source chart command
2023-05-25 15:05:08 +03:00
Raffael Sahli
b8c24f906d fix: support reconcile recursive source tree hr => chart => repo
Signed-off-by: Raffael Sahli <raffael.sahli@doodle.com>
2023-05-25 13:40:21 +02:00
Raffael Sahli
e678738ded feat: add reconcile source chart command
Signed-off-by: Raffael Sahli <raffael.sahli@doodle.com>
2023-05-25 13:40:21 +02:00
Stefan Prodan
9000be6daa Merge pull request #3910 from fluxcd/k8s-1.27
Update Kubernetes to v1.27 and Kustomize to v5.0
2023-05-24 10:29:58 +03:00
Stefan Prodan
13ff4afaa4 Update Kubernetes to v1.27 and Kustomize to v5.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-23 18:49:47 +03:00
Hidde Beydals
40b9c07641 Merge pull request #3903 from fluxcd/dependabot/github_actions/sigstore/cosign-installer-3.0.5
build(deps): bump sigstore/cosign-installer from 3.0.3 to 3.0.5
2023-05-22 09:36:11 +02:00
dependabot[bot]
0ce5117715 build(deps): bump sigstore/cosign-installer from 3.0.3 to 3.0.5
Bumps [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) from 3.0.3 to 3.0.5.
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](204a51a57a...dd6b2e2b61)

---
updated-dependencies:
- dependency-name: sigstore/cosign-installer
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-22 07:17:20 +00:00
Hidde Beydals
526d154172 Merge pull request #3902 from fluxcd/dependabot/github_actions/actions/setup-go-4.0.1 2023-05-22 09:16:32 +02:00
dependabot[bot]
9e422576b8 build(deps): bump actions/setup-go from 4.0.0 to 4.0.1
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](4d34df0c23...fac708d667)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-22 07:06:34 +00:00
Stefan Prodan
069bca29d1 Merge pull request #3901 from fluxcd/dependabot/github_actions/helm/kind-action-1.7.0
build(deps): bump helm/kind-action from 1.5.0 to 1.7.0
2023-05-22 09:59:42 +03:00
dependabot[bot]
34ac124b6b build(deps): bump helm/kind-action from 1.5.0 to 1.7.0
Bumps [helm/kind-action](https://github.com/helm/kind-action) from 1.5.0 to 1.7.0.
- [Release notes](https://github.com/helm/kind-action/releases)
- [Commits](d8ccf8fb62...fa81e57adf)

---
updated-dependencies:
- dependency-name: helm/kind-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-22 01:22:42 +00:00
Stefan Prodan
e475a22435 Merge pull request #3883 from fluxcd/update-az-deps
e2e: Update dependencies
2023-05-12 15:37:08 +03:00
Stefan Prodan
d1ec628d6c e2e: Update dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-12 15:12:25 +03:00
Stefan Prodan
d13227b277 Merge pull request #3882 from fluxcd/update-components
Update toolkit components
2023-05-12 15:07:41 +03:00
fluxcdbot
fcb992240e Update toolkit components
- helm-controller to v0.33.0
  https://github.com/fluxcd/helm-controller/blob/v0.33.0/CHANGELOG.md
- kustomize-controller to v1.0.0-rc.3
  https://github.com/fluxcd/kustomize-controller/blob/v1.0.0-rc.3/CHANGELOG.md
- source-controller to v1.0.0-rc.3
  https://github.com/fluxcd/source-controller/blob/v1.0.0-rc.3/CHANGELOG.md
- notification-controller to v1.0.0-rc.3
  https://github.com/fluxcd/notification-controller/blob/v1.0.0-rc.3/CHANGELOG.md
- image-reflector-controller to v0.27.2
  https://github.com/fluxcd/image-reflector-controller/blob/v0.27.2/CHANGELOG.md
- image-automation-controller to v0.33.1
  https://github.com/fluxcd/image-automation-controller/blob/v0.33.1/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
2023-05-12 11:46:20 +00:00
Stefan Prodan
cf5eb6a0bc Merge pull request #3879 from fluxcd/resourcequota
Add ResourceQuota for critical pods
2023-05-12 12:12:08 +03:00
Stefan Prodan
2aa38baa35 Add ResourceQuota for critical pods
Fixes insufficient quota error on GKE

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-12 11:34:54 +03:00
Stefan Prodan
84d046ab2a Merge pull request #3880 from fluxcd/ossf-scorecard
Add OSSF Scorecard
2023-05-12 10:56:42 +03:00
Stefan Prodan
29b08fc306 Add OSSF Scorecard
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-12 10:42:46 +03:00
Stefan Prodan
a7153a0ff5 Merge pull request #3876 from fluxcd/dependabot/go_modules/tests/azure/github.com/cloudflare/circl-1.3.3
build(deps): bump github.com/cloudflare/circl from 1.3.2 to 1.3.3 in /tests/azure
2023-05-12 09:07:47 +03:00
dependabot[bot]
bc67308f85 build(deps): bump github.com/cloudflare/circl in /tests/azure
Bumps [github.com/cloudflare/circl](https://github.com/cloudflare/circl) from 1.3.2 to 1.3.3.
- [Release notes](https://github.com/cloudflare/circl/releases)
- [Commits](https://github.com/cloudflare/circl/compare/v1.3.2...v1.3.3)

---
updated-dependencies:
- dependency-name: github.com/cloudflare/circl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-12 05:47:08 +00:00
Stefan Prodan
6e93a87265 Merge pull request #3875 from fluxcd/dependabot/go_modules/github.com/cloudflare/circl-1.3.3
build(deps): bump github.com/cloudflare/circl from 1.3.2 to 1.3.3
2023-05-12 08:46:00 +03:00
dependabot[bot]
6fd1f794f9 build(deps): bump github.com/cloudflare/circl from 1.3.2 to 1.3.3
Bumps [github.com/cloudflare/circl](https://github.com/cloudflare/circl) from 1.3.2 to 1.3.3.
- [Release notes](https://github.com/cloudflare/circl/releases)
- [Commits](https://github.com/cloudflare/circl/compare/v1.3.2...v1.3.3)

---
updated-dependencies:
- dependency-name: github.com/cloudflare/circl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-12 05:30:40 +00:00
Stefan Prodan
5942e65b1c Merge pull request #3877 from fluxcd/dependabot/go_modules/github.com/docker/distribution-2.8.2incompatible
build(deps): bump github.com/docker/distribution from 2.8.1+incompatible to 2.8.2+incompatible
2023-05-12 08:29:33 +03:00
dependabot[bot]
77d670c224 build(deps): bump github.com/docker/distribution
Bumps [github.com/docker/distribution](https://github.com/docker/distribution) from 2.8.1+incompatible to 2.8.2+incompatible.
- [Release notes](https://github.com/docker/distribution/releases)
- [Commits](https://github.com/docker/distribution/compare/v2.8.1...v2.8.2)

---
updated-dependencies:
- dependency-name: github.com/docker/distribution
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-11 20:48:22 +00:00
Hidde Beydals
70546e5dfe Merge pull request #3866 from onedr0p/main
Update Alpine to 3.18
2023-05-10 17:32:15 +02:00
Devin Buhl
fec7dfefa4 Update Alpine to 3.18
This change would be nice to get in because MUSL finally implemented TCP fallback in their DNS resolver.

alpinelinux.org/posts/Alpine-3.18.0-released.html

Signed-off-by: Devin Buhl <devin@buhl.casa>
2023-05-10 09:47:59 -04:00
137 changed files with 2760 additions and 2078 deletions

View File

@@ -4,19 +4,16 @@ pkgbase = flux-bin
pkgrel = ${PKGREL} pkgrel = ${PKGREL}
url = https://fluxcd.io/ url = https://fluxcd.io/
arch = x86_64 arch = x86_64
arch = armv6h
arch = armv7h arch = armv7h
arch = aarch64 arch = aarch64
license = APACHE license = APACHE
optdepends = bash-completion: auto-completion for flux in Bash optdepends = bash-completion: auto-completion for flux in Bash
optdepends = zsh-completions: auto-completion for flux in ZSH optdepends = zsh-completions: auto-completion for flux in ZSH
source_x86_64 = flux-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${VERSION}/flux_${VERSION}_linux_amd64.tar.gz source_x86_64 = flux-bin-${PKGVER}_linux_amd64.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${VERSION}/flux_${VERSION}_linux_amd64.tar.gz
sha256sums_x86_64 = ${SHA256SUM_AMD64} sha256sums_x86_64 = ${SHA256SUM_AMD64}
source_armv6h = flux-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${VERSION}/flux_${VERSION}_linux_arm.tar.gz source_armv7h = flux-bin-${PKGVER}_linux_arm.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${VERSION}/flux_${VERSION}_linux_arm.tar.gz
sha256sums_armv6h = ${SHA256SUM_ARM}
source_armv7h = flux-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${VERSION}/flux_${VERSION}_linux_arm.tar.gz
sha256sums_armv7h = ${SHA256SUM_ARM} sha256sums_armv7h = ${SHA256SUM_ARM}
source_aarch64 = flux-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${VERSION}/flux_${VERSION}_linux_arm64.tar.gz source_aarch64 = flux-bin-${PKGVER}_linux_arm64.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${VERSION}/flux_${VERSION}_linux_arm64.tar.gz
sha256sums_aarch64 = ${SHA256SUM_ARM64} sha256sums_aarch64 = ${SHA256SUM_ARM64}
pkgname = flux-bin pkgname = flux-bin

View File

@@ -8,28 +8,22 @@ _srcname=flux
_srcver=${VERSION} _srcver=${VERSION}
pkgdesc="Open and extensible continuous delivery solution for Kubernetes" pkgdesc="Open and extensible continuous delivery solution for Kubernetes"
url="https://fluxcd.io/" url="https://fluxcd.io/"
arch=("x86_64" "armv6h" "armv7h" "aarch64") arch=("x86_64" "armv7h" "aarch64")
license=("APACHE") license=("APACHE")
optdepends=('bash-completion: auto-completion for flux in Bash' optdepends=('bash-completion: auto-completion for flux in Bash'
'zsh-completions: auto-completion for flux in ZSH') 'zsh-completions: auto-completion for flux in ZSH')
source_x86_64=( source_x86_64=(
"${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${_srcver}/flux_${_srcver}_linux_amd64.tar.gz" "${pkgname}-${pkgver}_linux_amd64.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${_srcver}/flux_${_srcver}_linux_amd64.tar.gz"
)
source_armv6h=(
"${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${_srcver}/flux_${_srcver}_linux_arm.tar.gz"
) )
source_armv7h=( source_armv7h=(
"${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${_srcver}/flux_${_srcver}_linux_arm.tar.gz" "${pkgname}-${pkgver}_linux_arm.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${_srcver}/flux_${_srcver}_linux_arm.tar.gz"
) )
source_aarch64=( source_aarch64=(
"${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${_srcver}/flux_${_srcver}_linux_arm64.tar.gz" "${pkgname}-${pkgver}_linux_arm64.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${_srcver}/flux_${_srcver}_linux_arm64.tar.gz"
) )
sha256sums_x86_64=( sha256sums_x86_64=(
${SHA256SUM_AMD64} ${SHA256SUM_AMD64}
) )
sha256sums_armv6h=(
${SHA256SUM_ARM}
)
sha256sums_armv7h=( sha256sums_armv7h=(
${SHA256SUM_ARM} ${SHA256SUM_ARM}
) )

View File

@@ -4,7 +4,6 @@ pkgbase = flux-go
pkgrel = ${PKGREL} pkgrel = ${PKGREL}
url = https://fluxcd.io/ url = https://fluxcd.io/
arch = x86_64 arch = x86_64
arch = armv6h
arch = armv7h arch = armv7h
arch = aarch64 arch = aarch64
license = APACHE license = APACHE

View File

@@ -8,13 +8,13 @@ _srcname=flux
_srcver=${VERSION} _srcver=${VERSION}
pkgdesc="Open and extensible continuous delivery solution for Kubernetes" pkgdesc="Open and extensible continuous delivery solution for Kubernetes"
url="https://fluxcd.io/" url="https://fluxcd.io/"
arch=("x86_64" "armv6h" "armv7h" "aarch64") arch=("x86_64" "armv7h" "aarch64")
license=("APACHE") license=("APACHE")
provides=("flux-bin") provides=("flux-bin")
conflicts=("flux-bin") conflicts=("flux-bin")
replaces=("flux-cli") replaces=("flux-cli")
depends=("glibc") depends=("glibc")
makedepends=('go>=1.17', 'kustomize>=3.0') makedepends=('go>=1.20', 'kustomize>=5.0')
optdepends=('bash-completion: auto-completion for flux in Bash', optdepends=('bash-completion: auto-completion for flux in Bash',
'zsh-completions: auto-completion for flux in ZSH') 'zsh-completions: auto-completion for flux in ZSH')
source=( source=(
@@ -41,7 +41,7 @@ check() {
aarch64) aarch64)
export ENVTEST_ARCH=arm64 export ENVTEST_ARCH=arm64
;; ;;
armv6h|armv7h) armv7h)
export ENVTEST_ARCH=arm export ENVTEST_ARCH=arm
;; ;;
esac esac

View File

@@ -4,7 +4,6 @@ pkgbase = flux-scm
pkgrel = ${PKGREL} pkgrel = ${PKGREL}
url = https://fluxcd.io/ url = https://fluxcd.io/
arch = x86_64 arch = x86_64
arch = armv6h
arch = armv7h arch = armv7h
arch = aarch64 arch = aarch64
license = APACHE license = APACHE

View File

@@ -7,12 +7,12 @@ pkgrel=${PKGREL}
_srcname=flux _srcname=flux
pkgdesc="Open and extensible continuous delivery solution for Kubernetes" pkgdesc="Open and extensible continuous delivery solution for Kubernetes"
url="https://fluxcd.io/" url="https://fluxcd.io/"
arch=("x86_64" "armv6h" "armv7h" "aarch64") arch=("x86_64" "armv7h" "aarch64")
license=("APACHE") license=("APACHE")
provides=("flux-bin") provides=("flux-bin")
conflicts=("flux-bin") conflicts=("flux-bin")
depends=("glibc") depends=("glibc")
makedepends=('go>=1.17', 'kustomize>=3.0', 'git') makedepends=('go>=1.20', 'kustomize>=5.0', 'git')
optdepends=('bash-completion: auto-completion for flux in Bash', optdepends=('bash-completion: auto-completion for flux in Bash',
'zsh-completions: auto-completion for flux in ZSH') 'zsh-completions: auto-completion for flux in ZSH')
source=( source=(
@@ -42,7 +42,7 @@ check() {
aarch64) aarch64)
export ENVTEST_ARCH=arm64 export ENVTEST_ARCH=arm64
;; ;;
armv6h|armv7h) armv7h)
export ENVTEST_ARCH=arm export ENVTEST_ARCH=arm
;; ;;
esac esac

View File

@@ -3,7 +3,14 @@ version: 2
updates: updates:
- package-ecosystem: "github-actions" - package-ecosystem: "github-actions"
directory: "/" directory: "/"
labels: ["area/build"] labels: ["area/ci", "dependencies"]
groups:
# Group all updates together, so that they are all applied in a single PR.
# Grouped updates are currently in beta and is subject to change.
# xref: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#groups
ci:
patterns:
- "*"
schedule: schedule:
# by default this will be on a monday. # By default, this will be on a monday.
interval: "weekly" interval: "weekly"

49
.github/labels.yaml vendored Normal file
View File

@@ -0,0 +1,49 @@
# Configuration file to declaratively configure labels
# Ref: https://github.com/EndBug/label-sync#Config-files
- name: area/bootstrap
description: Bootstrap related issues and pull requests
color: '#86efc9'
- name: area/install
description: Install and uninstall related issues and pull requests
color: '#86efc9'
- name: area/diff
description: Diff related issues and pull requests
color: '#BA4192'
- name: area/bucket
description: Bucket related issues and pull requests
color: '#00b140'
- name: area/git
description: Git related issues and pull requests
color: '#863faf'
- name: area/oci
description: OCI related issues and pull requests
color: '#c739ff'
- name: area/kustomization
description: Kustomization related issues and pull requests
color: '#00e54d'
- name: area/helm
description: Helm related issues and pull requests
color: '#1673b6'
- name: area/image-automation
description: Automated image updates related issues and pull requests
color: '#c5def5'
- name: area/monitoring
description: Monitoring related issues and pull requests
color: '#dd75ae'
- name: area/multi-tenancy
description: Multi-tenancy related issues and pull requests
color: '#72CDBD'
- name: area/notification
description: Notification API related issues and pull requests
color: '#434ec1'
- name: area/source
description: Source API related issues and pull requests
color: '#863faf'
- name: area/rfc
description: Feature request proposals in the RFC format
color: '#D621C3'
aliases: ['area/RFC']
- name: backport:release/v2.0.x
description: To be backported to release/v2.0.x
color: '#ffd700'

29
.github/workflows/action.yaml vendored Normal file
View File

@@ -0,0 +1,29 @@
name: test-gh-action
on:
pull_request:
paths:
- 'action/**'
push:
paths:
- 'action/**'
branches:
- 'main'
- 'release/**'
permissions: read-all
jobs:
actions:
strategy:
fail-fast: false
matrix:
version: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.version }}
name: action on ${{ matrix.version }}
steps:
- name: Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Setup flux
uses: ./action

31
.github/workflows/backport.yaml vendored Normal file
View File

@@ -0,0 +1,31 @@
name: backport
on:
pull_request_target:
types: [closed, labeled]
jobs:
pull-request:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
if: github.event.pull_request.state == 'closed' && github.event.pull_request.merged && (github.event_name != 'labeled' || startsWith('backport:', github.event.label.name))
steps:
- name: Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Create backport PRs
uses: korthout/backport-action@bd68141f079bd036e45ea8149bc9d174d5a04703 # v1.4.0
# xref: https://github.com/korthout/backport-action#inputs
with:
# Use token to allow workflows to be triggered for the created PR
github_token: ${{ secrets.BOT_GITHUB_TOKEN }}
# Match labels with a pattern `backport:<target-branch>`
label_pattern: '^backport:([^ ]+)$'
# A bit shorter pull-request title than the default
pull_title: '[${target_branch}] ${pull_title}'
# Simpler PR description than default
pull_description: |-
Automated backport to `${target_branch}`, triggered by a label in #${pull_number}.

View File

@@ -3,7 +3,7 @@ name: e2e-arm64
on: on:
workflow_dispatch: workflow_dispatch:
push: push:
branches: [ main, update-components, e2e-*, release-* ] branches: [ 'main', 'update-components', 'e2e-*', 'release/**' ]
permissions: permissions:
contents: read contents: read
@@ -17,12 +17,13 @@ jobs:
matrix: matrix:
# Keep this list up-to-date with https://endoflife.date/kubernetes # Keep this list up-to-date with https://endoflife.date/kubernetes
# Check which versions are available on DockerHub with 'crane ls kindest/node' # Check which versions are available on DockerHub with 'crane ls kindest/node'
KUBERNETES_VERSION: [ 1.25.8, 1.26.3, 1.27.1 ] KUBERNETES_VERSION: [ 1.25.11, 1.26.6, 1.27.3, 1.28.0 ]
fail-fast: false
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Setup Go - name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with: with:
go-version: 1.20.x go-version: 1.20.x
cache-dependency-path: | cache-dependency-path: |

View File

@@ -5,7 +5,17 @@ on:
schedule: schedule:
- cron: '0 6 * * *' - cron: '0 6 * * *'
push: push:
branches: [ azure* ] branches:
- main
paths:
- 'tests/**'
- '.github/workflows/e2e-azure.yaml'
pull_request:
branches:
- main
paths:
- 'tests/**'
- '.github/workflows/e2e-azure.yaml'
permissions: permissions:
contents: read contents: read
@@ -13,11 +23,13 @@ permissions:
jobs: jobs:
e2e-amd64-aks: e2e-amd64-aks:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
# This job is currently disabled since if always evaluates to false. Remove the false check when Azure subscription is enabled
if: false && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]'
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Setup Go - name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with: with:
go-version: 1.20.x go-version: 1.20.x
cache-dependency-path: | cache-dependency-path: |

View File

@@ -3,9 +3,10 @@ name: e2e-bootstrap
on: on:
workflow_dispatch: workflow_dispatch:
push: push:
branches: [ main, release-* ] branches: [ 'main', 'release/**' ]
pull_request: pull_request:
branches: [ main, release-* ] branches: [ 'main', 'release/**' ]
paths-ignore: [ 'docs/**', 'rfcs/**' ]
permissions: permissions:
contents: read contents: read
@@ -16,23 +17,23 @@ jobs:
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]' if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]'
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Setup Go - name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with: with:
go-version: 1.20.x go-version: 1.20.x
cache-dependency-path: | cache-dependency-path: |
**/go.sum **/go.sum
**/go.mod **/go.mod
- name: Setup Kubernetes - name: Setup Kubernetes
uses: helm/kind-action@d8ccf8fb623ce1bb360ae2f45f323d9d5c5e9f00 # v1.5.0 uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0
with: with:
version: v0.17.0 version: v0.20.0
cluster_name: kind cluster_name: kind
# The versions below should target the newest Kubernetes version # The versions below should target the newest Kubernetes version
# Keep this up-to-date with https://endoflife.date/kubernetes # Keep this up-to-date with https://endoflife.date/kubernetes
node_image: kindest/node:v1.26.0 node_image: kindest/node:v1.28.0@sha256:9f3ff58f19dcf1a0611d11e8ac989fdb30a28f40f236f59f0bea31fb956ccf5c
kubectl_version: v1.26.2 kubectl_version: v1.28.0
- name: Setup Kustomize - name: Setup Kustomize
uses: fluxcd/pkg/actions/kustomize@main uses: fluxcd/pkg/actions/kustomize@main
- name: Build - name: Build
@@ -98,7 +99,6 @@ jobs:
--path=test-cluster \ --path=test-cluster \
--read-write-key --read-write-key
/tmp/flux reconcile image repository podinfo /tmp/flux reconcile image repository podinfo
/tmp/flux reconcile image update flux-system
/tmp/flux get images all /tmp/flux get images all
retries=10 retries=10

View File

@@ -3,9 +3,10 @@ name: e2e
on: on:
workflow_dispatch: workflow_dispatch:
push: push:
branches: [ main, release-* ] branches: [ 'main', 'release/**' ]
pull_request: pull_request:
branches: [ main, release-* ] branches: [ 'main', 'release/**' ]
paths-ignore: [ 'docs/**', 'rfcs/**' ]
permissions: permissions:
contents: read contents: read
@@ -20,24 +21,24 @@ jobs:
- 5000:5000 - 5000:5000
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Setup Go - name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with: with:
go-version: 1.20.x go-version: 1.20.x
cache-dependency-path: | cache-dependency-path: |
**/go.sum **/go.sum
**/go.mod **/go.mod
- name: Setup Kubernetes - name: Setup Kubernetes
uses: helm/kind-action@d8ccf8fb623ce1bb360ae2f45f323d9d5c5e9f00 # v1.5.0 uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0
with: with:
version: v0.17.0 version: v0.20.0
cluster_name: kind cluster_name: kind
config: .github/kind/config.yaml # disable KIND-net config: .github/kind/config.yaml # disable KIND-net
# The versions below should target the newest Kubernetes version # The versions below should target the newest Kubernetes version
# Keep this up-to-date with https://endoflife.date/kubernetes # Keep this up-to-date with https://endoflife.date/kubernetes
node_image: kindest/node:v1.26.0 node_image: kindest/node:v1.28.0@sha256:9f3ff58f19dcf1a0611d11e8ac989fdb30a28f40f236f59f0bea31fb956ccf5c
kubectl_version: v1.26.2 kubectl_version: v1.28.0
- name: Setup Calico for network policy - name: Setup Calico for network policy
run: | run: |
kubectl apply -f https://docs.projectcalico.org/v3.25/manifests/calico.yaml kubectl apply -f https://docs.projectcalico.org/v3.25/manifests/calico.yaml

39
.github/workflows/ossf.yaml vendored Normal file
View File

@@ -0,0 +1,39 @@
name: ossf
on:
workflow_dispatch:
push:
branches:
- main
schedule:
# Weekly on Saturdays.
- cron: '30 1 * * 6'
permissions: read-all
jobs:
scorecard:
runs-on: ubuntu-latest
permissions:
security-events: write
id-token: write
actions: read
contents: read
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Run analysis
uses: ossf/scorecard-action@08b4669551908b1024bb425080c797723083c031 # v2.2.0
with:
results_file: results.sarif
results_format: sarif
repo_token: ${{ secrets.GITHUB_TOKEN }}
publish_results: true
- name: Upload artifact
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: SARIF file
path: results.sarif
retention-days: 5
- name: Upload SARIF results
uses: github/codeql-action/upload-sarif@cdcdbb579706841c47f7063dda365e292e5cad7a # v2.13.4
with:
sarif_file: results.sarif

View File

@@ -9,6 +9,10 @@ permissions:
jobs: jobs:
release-flux-cli: release-flux-cli:
outputs:
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: ubuntu-latest
permissions: permissions:
contents: write # needed to write releases contents: write # needed to write releases
@@ -16,33 +20,33 @@ jobs:
packages: write # needed for ghcr access packages: write # needed for ghcr access
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Unshallow - name: Unshallow
run: git fetch --prune --unshallow run: git fetch --prune --unshallow
- name: Setup Go - name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with: with:
go-version: 1.20.x go-version: 1.20.x
cache: false cache: false
- name: Setup QEMU - name: Setup QEMU
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0 uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0
- name: Setup Docker Buildx - name: Setup Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2.5.0 uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 # v2.9.1
- name: Setup Syft - name: Setup Syft
uses: anchore/sbom-action/download-syft@4d571ad1038a9cc29d676154ef265ab8f9027042 # v0.14.2 uses: anchore/sbom-action/download-syft@78fc58e266e87a38d4194b2137a3d4e9bcaf7ca1 # v0.14.3
- name: Setup Cosign - name: Setup Cosign
uses: sigstore/cosign-installer@204a51a57a74d190b284a0ce69b44bc37201f343 # v3.0.3 uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 # v3.1.1
- name: Setup Kustomize - name: Setup Kustomize
uses: fluxcd/pkg/actions/kustomize@main uses: fluxcd/pkg/actions/kustomize@main
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with: with:
registry: ghcr.io registry: ghcr.io
username: fluxcdbot username: fluxcdbot
password: ${{ secrets.GHCR_TOKEN }} password: ${{ secrets.GHCR_TOKEN }}
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with: with:
username: fluxcdbot username: fluxcdbot
password: ${{ secrets.DOCKER_FLUXCD_PASSWORD }} password: ${{ secrets.DOCKER_FLUXCD_PASSWORD }}
@@ -74,7 +78,8 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser - name: Run GoReleaser
uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0 id: run-goreleaser
uses: goreleaser/goreleaser-action@3fa32b8bb5620a2c1afe798654bbad59f9da4906 # v4.4.0
with: with:
version: latest version: latest
args: release --release-notes=output/notes.md --skip-validate args: release --release-notes=output/notes.md --skip-validate
@@ -82,6 +87,22 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
AUR_BOT_SSH_PRIVATE_KEY: ${{ secrets.AUR_BOT_SSH_PRIVATE_KEY }} AUR_BOT_SSH_PRIVATE_KEY: ${{ secrets.AUR_BOT_SSH_PRIVATE_KEY }}
- name: Generate SLSA metadata
id: slsa
env:
ARTIFACTS: "${{ steps.run-goreleaser.outputs.artifacts }}"
run: |
set -euo pipefail
hashes=$(echo -E $ARTIFACTS | jq --raw-output '.[] | {name, "digest": (.extra.Digest // .extra.Checksum)} | select(.digest) | {digest} + {name} | join(" ") | sub("^sha256:";"")' | base64 -w0)
echo "hashes=$hashes" >> $GITHUB_OUTPUT
image_url=fluxcd/flux-cli:$GITHUB_REF_NAME
echo "image_url=$image_url" >> $GITHUB_OUTPUT
image_digest=$(docker buildx imagetools inspect ${image_url} --format '{{json .}}' | jq -r .manifest.digest)
echo "image_digest=$image_digest" >> $GITHUB_OUTPUT
release-flux-manifests: release-flux-manifests:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: release-flux-cli needs: release-flux-cli
@@ -89,7 +110,7 @@ jobs:
id-token: write id-token: write
packages: write packages: write
steps: steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Setup Kustomize - name: Setup Kustomize
uses: fluxcd/pkg/actions/kustomize@main uses: fluxcd/pkg/actions/kustomize@main
- name: Setup Flux CLI - name: Setup Flux CLI
@@ -100,13 +121,13 @@ jobs:
VERSION=$(flux version --client | awk '{ print $NF }') VERSION=$(flux version --client | awk '{ print $NF }')
echo "version=${VERSION}" >> $GITHUB_OUTPUT echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Login to GHCR - name: Login to GHCR
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with: with:
registry: ghcr.io registry: ghcr.io
username: fluxcdbot username: fluxcdbot
password: ${{ secrets.GHCR_TOKEN }} password: ${{ secrets.GHCR_TOKEN }}
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with: with:
username: fluxcdbot username: fluxcdbot
password: ${{ secrets.DOCKER_FLUXCD_PASSWORD }} password: ${{ secrets.DOCKER_FLUXCD_PASSWORD }}
@@ -134,7 +155,7 @@ jobs:
--path="./flux-system" \ --path="./flux-system" \
--source=${{ github.repositoryUrl }} \ --source=${{ github.repositoryUrl }} \
--revision="${{ github.ref_name }}@sha1:${{ github.sha }}" --revision="${{ github.ref_name }}@sha1:${{ github.sha }}"
- uses: sigstore/cosign-installer@204a51a57a74d190b284a0ce69b44bc37201f343 # v3.0.3 - uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 # v3.1.1
- name: Sign manifests - name: Sign manifests
env: env:
COSIGN_EXPERIMENTAL: 1 COSIGN_EXPERIMENTAL: 1
@@ -148,3 +169,43 @@ jobs:
flux tag artifact oci://docker.io/fluxcd/flux-manifests:${{ steps.prep.outputs.version }} \ flux tag artifact oci://docker.io/fluxcd/flux-manifests:${{ steps.prep.outputs.version }} \
--tag latest --tag latest
release-provenance:
needs: [release-flux-cli]
permissions:
actions: read # for detecting the Github Actions environment.
id-token: write # for creating OIDC tokens for signing.
contents: write # for uploading attestations to GitHub releases.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.9.0
with:
provenance-name: "provenance.intoto.jsonl"
base64-subjects: "${{ needs.release-flux-cli.outputs.hashes }}"
upload-assets: true
dockerhub-provenance:
needs: [release-flux-cli]
permissions:
actions: read # for detecting the Github Actions environment.
id-token: write # for creating OIDC tokens for signing.
packages: write # for uploading attestations.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v1.9.0
with:
image: ${{ needs.release-flux-cli.outputs.image_url }}
digest: ${{ needs.release-flux-cli.outputs.image_digest }}
registry-username: fluxcdbot
secrets:
registry-password: ${{ secrets.DOCKER_FLUXCD_PASSWORD }}
ghcr-provenance:
needs: [release-flux-cli]
permissions:
actions: read # for detecting the Github Actions environment.
id-token: write # for creating OIDC tokens for signing.
packages: write # for uploading attestations.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v1.9.0
with:
image: ghcr.io/${{ needs.release-flux-cli.outputs.image_url }}
digest: ${{ needs.release-flux-cli.outputs.image_digest }}
registry-username: fluxcdbot
secrets:
registry-password: ${{ secrets.GHCR_TOKEN }}

View File

@@ -3,9 +3,9 @@ name: scan
on: on:
workflow_dispatch: workflow_dispatch:
push: push:
branches: [ main ] branches: [ 'main', 'release/**' ]
pull_request: pull_request:
branches: [ main ] branches: [ 'main', 'release/**' ]
schedule: schedule:
- cron: '18 10 * * 3' - cron: '18 10 * * 3'
@@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]' if: github.actor != 'dependabot[bot]'
steps: steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Run FOSSA scan and upload build data - name: Run FOSSA scan and upload build data
uses: fossa-contrib/fossa-action@6728dc6fe9a068c648d080c33829ffbe56565023 # v2.0.0 uses: fossa-contrib/fossa-action@6728dc6fe9a068c648d080c33829ffbe56565023 # v2.0.0
with: with:
@@ -31,11 +31,11 @@ jobs:
security-events: write security-events: write
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]' if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]'
steps: steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Setup Kustomize - name: Setup Kustomize
uses: fluxcd/pkg/actions/kustomize@main uses: fluxcd/pkg/actions/kustomize@main
- name: Setup Go - name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with: with:
go-version: 1.20.x go-version: 1.20.x
cache-dependency-path: | cache-dependency-path: |
@@ -45,7 +45,7 @@ jobs:
run: | run: |
make tidy make tidy
make cmd/flux/.manifests.done make cmd/flux/.manifests.done
- uses: snyk/actions/setup@806182742461562b67788a64410098c9d9b96adb - uses: snyk/actions/setup@b98d498629f1c368650224d6d212bf7dfa89e4bf
- name: Run Snyk to check for vulnerabilities - name: Run Snyk to check for vulnerabilities
continue-on-error: true continue-on-error: true
run: | run: |
@@ -53,7 +53,7 @@ jobs:
env: env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
- name: Upload result to GitHub Code Scanning - name: Upload result to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@29b1f65c5e92e24fe6b6647da1eaabe529cec70f # v2.3.3 uses: github/codeql-action/upload-sarif@cdcdbb579706841c47f7063dda365e292e5cad7a # v2.13.4
with: with:
sarif_file: snyk.sarif sarif_file: snyk.sarif
@@ -64,19 +64,22 @@ jobs:
if: github.actor != 'dependabot[bot]' if: github.actor != 'dependabot[bot]'
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Setup Go - name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with: with:
go-version: 1.20.x go-version: 1.20.x
cache-dependency-path: | cache-dependency-path: |
**/go.sum **/go.sum
**/go.mod **/go.mod
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@29b1f65c5e92e24fe6b6647da1eaabe529cec70f # v2.3.3 uses: github/codeql-action/init@cdcdbb579706841c47f7063dda365e292e5cad7a # v2.13.4
with: with:
languages: go languages: go
# xref: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# xref: https://codeql.github.com/codeql-query-help/go/
queries: security-and-quality
- name: Autobuild - name: Autobuild
uses: github/codeql-action/autobuild@29b1f65c5e92e24fe6b6647da1eaabe529cec70f # v2.3.3 uses: github/codeql-action/autobuild@cdcdbb579706841c47f7063dda365e292e5cad7a # v2.13.4
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@29b1f65c5e92e24fe6b6647da1eaabe529cec70f # v2.3.3 uses: github/codeql-action/analyze@cdcdbb579706841c47f7063dda365e292e5cad7a # v2.13.4

28
.github/workflows/sync-labels.yaml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: sync-labels
on:
workflow_dispatch:
push:
branches:
- main
paths:
- .github/labels.yaml
permissions:
contents: read
jobs:
labels:
name: Run sync
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: EndBug/label-sync@da00f2c11fdb78e4fae44adac2fdd713778ea3e8 # v2.3.2
with:
# Configuration file
config-file: |
https://raw.githubusercontent.com/fluxcd/community/main/.github/standard-labels.yaml
.github/labels.yaml
# Strictly declarative
delete-other-labels: true

View File

@@ -18,9 +18,9 @@ jobs:
pull-requests: write pull-requests: write
steps: steps:
- name: Check out code - name: Check out code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Setup Go - name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with: with:
go-version: 1.20.x go-version: 1.20.x
cache-dependency-path: | cache-dependency-path: |
@@ -84,7 +84,7 @@ jobs:
- name: Create Pull Request - name: Create Pull Request
id: cpr id: cpr
uses: peter-evans/create-pull-request@284f54f989303d2699d373481a0cfa13ad5a6666 # v5.0.1 uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2
with: with:
token: ${{ secrets.BOT_GITHUB_TOKEN }} token: ${{ secrets.BOT_GITHUB_TOKEN }}
commit-message: | commit-message: |
@@ -99,7 +99,7 @@ jobs:
body: | body: |
${{ steps.update.outputs.pr_body }} ${{ steps.update.outputs.pr_body }}
labels: | labels: |
area/build dependencies
reviewers: ${{ secrets.ASSIGNEES }} reviewers: ${{ secrets.ASSIGNEES }}
- name: Check output - name: Check output

View File

@@ -83,14 +83,7 @@ brews:
install: | install: |
bin.install "flux" bin.install "flux"
bash_output = Utils.safe_popen_read(bin/"flux", "completion", "bash") generate_completions_from_executable(bin/"flux", "completion")
(bash_completion/"flux").write bash_output
zsh_output = Utils.safe_popen_read(bin/"flux", "completion", "zsh")
(zsh_completion/"_flux").write zsh_output
fish_output = Utils.safe_popen_read(bin/"flux", "completion", "fish")
(fish_completion/"flux.fish").write fish_output
test: | test: |
system "#{bin}/flux --version" system "#{bin}/flux --version"
publishers: publishers:

View File

@@ -68,8 +68,8 @@ for source changes.
Prerequisites: Prerequisites:
* go >= 1.20 * go >= 1.20
* kubectl >= 1.20 * kubectl >= 1.24
* kustomize >= 4.4 * kustomize >= 5.0
* coreutils (on Mac OS) * coreutils (on Mac OS)
Install the [controller-runtime/envtest](https://github.com/kubernetes-sigs/controller-runtime/tree/master/tools/setup-envtest) binaries with: Install the [controller-runtime/envtest](https://github.com/kubernetes-sigs/controller-runtime/tree/master/tools/setup-envtest) binaries with:

View File

@@ -1,15 +1,15 @@
FROM alpine:3.17 as builder FROM alpine:3.18 as builder
RUN apk add --no-cache ca-certificates curl RUN apk add --no-cache ca-certificates curl
ARG ARCH=linux/amd64 ARG ARCH=linux/amd64
ARG KUBECTL_VER=1.26.2 ARG KUBECTL_VER=1.27.3
RUN curl -sL https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VER}/bin/${ARCH}/kubectl \ RUN curl -sL https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VER}/bin/${ARCH}/kubectl \
-o /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl && \ -o /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl && \
kubectl version --client=true kubectl version --client=true
FROM alpine:3.17 as flux-cli FROM alpine:3.18 as flux-cli
RUN apk add --no-cache ca-certificates RUN apk add --no-cache ca-certificates

View File

@@ -2,6 +2,7 @@
[![release](https://img.shields.io/github/release/fluxcd/flux2/all.svg)](https://github.com/fluxcd/flux2/releases) [![release](https://img.shields.io/github/release/fluxcd/flux2/all.svg)](https://github.com/fluxcd/flux2/releases)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/4782/badge)](https://bestpractices.coreinfrastructure.org/projects/4782) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/4782/badge)](https://bestpractices.coreinfrastructure.org/projects/4782)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/fluxcd/flux2/badge)](https://api.securityscorecards.dev/projects/github.com/fluxcd/flux2)
[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B162%2Fgithub.com%2Ffluxcd%2Fflux2.svg?type=shield)](https://app.fossa.com/projects/custom%2B162%2Fgithub.com%2Ffluxcd%2Fflux2?ref=badge_shield) [![FOSSA Status](https://app.fossa.com/api/projects/custom%2B162%2Fgithub.com%2Ffluxcd%2Fflux2.svg?type=shield)](https://app.fossa.com/projects/custom%2B162%2Fgithub.com%2Ffluxcd%2Fflux2?ref=badge_shield)
[![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/flux2)](https://artifacthub.io/packages/helm/fluxcd-community/flux2) [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/flux2)](https://artifacthub.io/packages/helm/fluxcd-community/flux2)
@@ -42,7 +43,7 @@ runtime for Flux v2. The APIs comprise Kubernetes custom resources,
which can be created and updated by a cluster user, or by other which can be created and updated by a cluster user, or by other
automation tooling. automation tooling.
![overview](docs/_files/gitops-toolkit.png) ![overview](https://fluxcd.io/img/diagrams/gitops-toolkit.png)
You can use the toolkit to extend Flux, or to build your own systems You can use the toolkit to extend Flux, or to build your own systems
for continuous delivery -- see [the developer for continuous delivery -- see [the developer

View File

@@ -1,216 +1,22 @@
# Flux GitHub Action # Flux GitHub Action
Usage: To install the latest Flux CLI on Linux, macOS or Windows GitHub runners:
```yaml ```yaml
steps: steps:
- name: Setup Flux CLI - name: Setup Flux CLI
uses: fluxcd/flux2/action@main uses: fluxcd/flux2/action@main
- name: Run Flux commands with:
run: flux -v version: 'latest'
- name: Run Flux CLI
run: flux version --client
``` ```
The latest stable version of the `flux` binary is downloaded from The Flux GitHub Action can be used to automate various tasks in CI, such as:
GitHub [releases](https://github.com/fluxcd/flux2/releases)
and placed at `/usr/local/bin/flux`.
Note that this action can only be used on GitHub **Linux** runners. - [Automate Flux upgrades on clusters via Pull Requests](https://fluxcd.io/flux/flux-gh-action/#automate-flux-updates)
You can change the arch (defaults to `amd64`) with: - [Push Kubernetes manifests to container registries](https://fluxcd.io/flux/flux-gh-action/#push-kubernetes-manifests-to-container-registries)
- [Run end-to-end testing with Flux and Kubernetes Kind](https://fluxcd.io/flux/flux-gh-action/#end-to-end-testing)
```yaml For more information, please see the [Flux GitHub Action documentation](/flux/flux-gh-action.md).
steps:
- name: Setup Flux CLI
uses: fluxcd/flux2/action@main
with:
arch: arm64 # can be amd64, arm64 or arm
```
You can download a specific version with:
```yaml
steps:
- name: Setup Flux CLI
uses: fluxcd/flux2/action@main
with:
version: 0.32.0
```
You can also authenticate against the GitHub API using GitHub Actions' `GITHUB_TOKEN` secret.
For more information, please [read about the GitHub token secret](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret).
```yaml
steps:
- name: Setup Flux CLI
uses: fluxcd/flux2/action@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
```
This is useful if you are seeing failures on shared runners, those failures are usually API limits being hit.
### Automate Flux updates
Example workflow for updating Flux's components generated with `flux bootstrap --path=clusters/production`:
```yaml
name: update-flux
on:
workflow_dispatch:
schedule:
- cron: "0 * * * *"
permissions:
contents: write
pull-requests: write
jobs:
components:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Setup Flux CLI
uses: fluxcd/flux2/action@main
- name: Check for updates
id: update
run: |
flux install \
--export > ./clusters/production/flux-system/gotk-components.yaml
VERSION="$(flux -v)"
echo "flux_version=$VERSION" >> $GITHUB_OUTPUT
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: update-flux
commit-message: Update to ${{ steps.update.outputs.flux_version }}
title: Update to ${{ steps.update.outputs.flux_version }}
body: |
${{ steps.update.outputs.flux_version }}
```
### Push Kubernetes manifests to container registries
Example workflow for publishing Kubernetes manifests bundled as OCI artifacts to GitHub Container Registry:
```yaml
name: push-artifact-staging
on:
push:
branches:
- 'main'
permissions:
packages: write # needed for ghcr.io access
env:
OCI_REPO: "oci://ghcr.io/my-org/manifests/${{ github.event.repository.name }}"
jobs:
kubernetes:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Flux CLI
uses: fluxcd/flux2/action@main
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate manifests
run: |
kustomize build ./manifests/staging > ./deploy/app.yaml
- name: Push manifests
run: |
flux push artifact $OCI_REPO:$(git rev-parse --short HEAD) \
--path="./deploy" \
--source="$(git config --get remote.origin.url)" \
--revision="$(git branch --show-current)@sha1:$(git rev-parse HEAD)"
- name: Deploy manifests to staging
run: |
flux tag artifact $OCI_REPO:$(git rev-parse --short HEAD) --tag staging
```
### Push and sign Kubernetes manifests to container registries
Example workflow for publishing Kubernetes manifests bundled as OCI artifacts
which are signed with Cosign and GitHub OIDC:
```yaml
name: push-sign-artifact
on:
push:
branches:
- 'main'
permissions:
packages: write # needed for ghcr.io access
id-token: write # needed for keyless signing
env:
OCI_REPO: "oci://ghcr.io/my-org/manifests/${{ github.event.repository.name }}"
jobs:
kubernetes:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Flux CLI
uses: fluxcd/flux2/action@main
- name: Setup Cosign
uses: sigstore/cosign-installer@main
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push and sign manifests
run: |
digest_url=$(flux push artifact \
$OCI_REPO:$(git rev-parse --short HEAD) \
--path="./manifests" \
--source="$(git config --get remote.origin.url)" \
--revision="$(git branch --show-current)@sha1:$(git rev-parse HEAD)" |\
jq -r '. | .repository + "@" + .digest')
cosign sign $digest_url
```
### End-to-end testing
Example workflow for running Flux in Kubernetes Kind:
```yaml
name: e2e
on:
push:
branches:
- '*'
jobs:
kubernetes:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Flux CLI
uses: fluxcd/flux2/action@main
- name: Setup Kubernetes Kind
uses: engineerd/setup-kind@v0.5.0
- name: Install Flux in Kubernetes Kind
run: flux install
```
A complete e2e testing workflow is available here
[flux2-kustomize-helm-example](https://github.com/fluxcd/flux2-kustomize-helm-example/blob/main/.github/workflows/e2e.yaml)

View File

@@ -1,64 +1,120 @@
name: Setup Flux CLI name: Setup Flux CLI
description: A GitHub Action for running Flux commands description: A GitHub Action for installing the Flux CLI
author: Stefan Prodan author: Flux project
branding: branding:
color: blue color: blue
icon: command icon: command
inputs: inputs:
version: version:
description: "Flux version e.g. 0.8.0 (defaults to latest stable release)" description: "Flux version e.g. 2.0.0 (defaults to latest stable release)"
required: false required: false
arch: arch:
description: "arch can be amd64, arm64 or arm" description: "arch can be amd64, arm64 or arm"
required: true required: false
default: "amd64" deprecationMessage: "No longer required, action will now detect runner arch."
bindir: bindir:
description: "Optional location of the Flux binary. Will not use sudo if set. Updates System Path." description: "Alternative location for the Flux binary, defaults to path relative to $RUNNER_TOOL_CACHE."
required: false required: false
token: token:
description: "GitHub Token used to authentication against the API (generally only needed to prevent quota limit errors)" description: "Token used to authentication against the GitHub.com API. Defaults to the token from the GitHub context of the workflow."
required: false required: false
runs: runs:
using: composite using: composite
steps: steps:
- name: "Download flux binary to tmp" - name: "Download the binary to the runner's cache dir"
shell: bash shell: bash
run: | run: |
ARCH=${{ inputs.arch }}
VERSION=${{ inputs.version }} VERSION=${{ inputs.version }}
TOKEN=${{ inputs.token }}
if [ -z "${VERSION}" ]; then TOKEN=${{ inputs.token }}
if [ -n "${TOKEN}" ]; then if [[ -z "$TOKEN" ]]; then
VERSION_SLUG=$(curl https://api.github.com/repos/fluxcd/flux2/releases/latest --silent --location --header "Authorization: token ${TOKEN}" | grep tag_name) TOKEN=${{ github.token }}
else fi
# With no GITHUB_TOKEN you will experience occasional failures due to rate limiting
# Ref: https://github.com/fluxcd/flux2/issues/3509#issuecomment-1400820992 if [[ -z "$VERSION" ]] || [[ "$VERSION" = "latest" ]]; then
VERSION_SLUG=$(curl https://api.github.com/repos/fluxcd/flux2/releases/latest --silent --location | grep tag_name) VERSION=$(curl -fsSL -H "Authorization: token ${TOKEN}" https://api.github.com/repos/fluxcd/flux2/releases/latest | grep tag_name | cut -d '"' -f 4)
fi
if [[ -z "$VERSION" ]]; then
echo "Unable to determine Flux CLI version"
exit 1
fi
if [[ $VERSION = v* ]]; then
VERSION="${VERSION:1}"
fi
OS=$(echo "${RUNNER_OS}" | tr '[:upper:]' '[:lower:]')
if [[ "$OS" == "macos" ]]; then
OS="darwin"
fi
ARCH=$(echo "${RUNNER_ARCH}" | tr '[:upper:]' '[:lower:]')
if [[ "$ARCH" == "x64" ]]; then
ARCH="amd64"
elif [[ "$ARCH" == "x86" ]]; then
ARCH="386"
fi
FLUX_EXEC_FILE="flux"
if [[ "$OS" == "windows" ]]; then
FLUX_EXEC_FILE="${FLUX_EXEC_FILE}.exe"
fi
FLUX_TOOL_DIR=${{ inputs.bindir }}
if [[ -z "$FLUX_TOOL_DIR" ]]; then
FLUX_TOOL_DIR="${RUNNER_TOOL_CACHE}/flux2/${VERSION}/${OS}/${ARCH}"
fi
if [[ ! -x "$FLUX_TOOL_DIR/FLUX_EXEC_FILE" ]]; then
DL_DIR="$(mktemp -dt flux2-XXXXXX)"
trap 'rm -rf $DL_DIR' EXIT
echo "Downloading flux ${VERSION} for ${OS}/${ARCH}"
FLUX_TARGET_FILE="flux_${VERSION}_${OS}_${ARCH}.tar.gz"
if [[ "$OS" == "windows" ]]; then
FLUX_TARGET_FILE="flux_${VERSION}_${OS}_${ARCH}.zip"
fi fi
VERSION=$(echo "${VERSION_SLUG}" | sed -E 's/.*"([^"]+)".*/\1/' | cut -c 2-) FLUX_CHECKSUMS_FILE="flux_${VERSION}_checksums.txt"
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"
echo "Verifying checksum"
sum=""
if command -v openssl > /dev/null; then
sum=$(openssl sha256 "$DL_DIR/$FLUX_TARGET_FILE" | awk '{print $2}')
elif command -v sha256sum > /dev/null; then
sum=$(sha256sum "$DL_DIR/$FLUX_TARGET_FILE" | awk '{print $1}')
fi
if [[ -z "$sum" ]]; then
echo "Neither openssl nor sha256sum found. Cannot calculate checksum."
exit 1
fi
expected_sum=$(grep " $FLUX_TARGET_FILE\$" "$DL_DIR/$FLUX_CHECKSUMS_FILE" | awk '{print $1}')
if [ "$sum" != "$expected_sum" ]; then
echo "SHA sum of ${FLUX_TARGET_FILE} does not match. Aborting."
exit 1
fi
echo "Installing flux to ${FLUX_TOOL_DIR}"
mkdir -p "$FLUX_TOOL_DIR"
if [[ "$OS" == "windows" ]]; then
unzip "$DL_DIR/$FLUX_TARGET_FILE" "$FLUX_EXEC_FILE" -d "$FLUX_TOOL_DIR"
else
tar xzf "$DL_DIR/$FLUX_TARGET_FILE" -C "$FLUX_TOOL_DIR" $FLUX_EXEC_FILE
fi
chmod +x "$FLUX_TOOL_DIR/$FLUX_EXEC_FILE"
fi fi
BIN_URL="https://github.com/fluxcd/flux2/releases/download/v${VERSION}/flux_${VERSION}_linux_${ARCH}.tar.gz" echo "Adding flux to path"
curl --silent --fail --location "${BIN_URL}" --output /tmp/flux.tar.gz echo "$FLUX_TOOL_DIR" >> "$GITHUB_PATH"
mkdir -p /tmp/flux
tar -C /tmp/flux/ -zxvf /tmp/flux.tar.gz - name: "Print installed flux version"
- name: "Copy Flux binary to execute location"
shell: bash
run: |
BINDIR=${{ inputs.bindir }}
if [ -z "${BINDIR}" ]; then
sudo cp /tmp/flux/flux /usr/local/bin
else
cp /tmp/flux/flux "${BINDIR}"
echo "${BINDIR}" >> $GITHUB_PATH
fi
- name: "Cleanup tmp"
shell: bash
run: |
rm -rf /tmp/flux/ /tmp/flux.tar.gz
- name: "Verify correct installation of binary"
shell: bash shell: bash
run: | run: |
flux -v flux -v

View File

@@ -87,7 +87,7 @@ func buildArtifactCmdRun(cmd *cobra.Command, args []string) error {
logger.Actionf("building artifact from %s", path) logger.Actionf("building artifact from %s", path)
ociClient := oci.NewLocalClient() ociClient := oci.NewClient(oci.DefaultOptions())
if err := ociClient.Build(buildArtifactArgs.output, path, buildArtifactArgs.ignorePaths); err != nil { if err := ociClient.Build(buildArtifactArgs.output, path, buildArtifactArgs.ignorePaths); err != nil {
return fmt.Errorf("bulding artifact failed, error: %w", err) return fmt.Errorf("bulding artifact failed, error: %w", err)
} }

View File

@@ -159,6 +159,7 @@ spec:
tmpl := map[string]string{ tmpl := map[string]string{
"fluxns": allocateNamespace("flux-system"), "fluxns": allocateNamespace("flux-system"),
} }
setup(t, tmpl)
testEnv.CreateObjectFile("./testdata/build-kustomization/podinfo-source.yaml", tmpl, t) testEnv.CreateObjectFile("./testdata/build-kustomization/podinfo-source.yaml", tmpl, t)

View File

@@ -57,7 +57,7 @@ type checkFlags struct {
} }
var kubernetesConstraints = []string{ var kubernetesConstraints = []string{
">=1.20.6-0", ">=1.25.0-0",
} }
var checkArgs checkFlags var checkArgs checkFlags

View File

@@ -83,9 +83,9 @@ var createHelmReleaseCmd = &cobra.Command{
# Create a HelmRelease with a custom release name # Create a HelmRelease with a custom release name
flux create hr podinfo \ flux create hr podinfo \
--release-name=podinfo-dev --release-name=podinfo-dev \
--source=HelmRepository/podinfo \ --source=HelmRepository/podinfo \
--chart=podinfo \ --chart=podinfo
# Create a HelmRelease targeting another namespace than the resource # Create a HelmRelease targeting another namespace than the resource
flux create hr podinfo \ flux create hr podinfo \

View File

@@ -88,6 +88,7 @@ type secretGitFlags struct {
rsaBits flags.RSAKeyBits rsaBits flags.RSAKeyBits
ecdsaCurve flags.ECDSACurve ecdsaCurve flags.ECDSACurve
caFile string caFile string
caCrtFile string
privateKeyFile string privateKeyFile string
bearerToken string bearerToken string
} }
@@ -102,6 +103,7 @@ func init() {
createSecretGitCmd.Flags().Var(&secretGitArgs.rsaBits, "ssh-rsa-bits", secretGitArgs.rsaBits.Description()) createSecretGitCmd.Flags().Var(&secretGitArgs.rsaBits, "ssh-rsa-bits", secretGitArgs.rsaBits.Description())
createSecretGitCmd.Flags().Var(&secretGitArgs.ecdsaCurve, "ssh-ecdsa-curve", secretGitArgs.ecdsaCurve.Description()) createSecretGitCmd.Flags().Var(&secretGitArgs.ecdsaCurve, "ssh-ecdsa-curve", secretGitArgs.ecdsaCurve.Description())
createSecretGitCmd.Flags().StringVar(&secretGitArgs.caFile, "ca-file", "", "path to TLS CA file used for validating self-signed certificates") createSecretGitCmd.Flags().StringVar(&secretGitArgs.caFile, "ca-file", "", "path to TLS CA file used for validating self-signed certificates")
createSecretGitCmd.Flags().StringVar(&secretGitArgs.caCrtFile, "ca-crt-file", "", "path to TLS CA certificate file used for validating self-signed certificates; takes precedence over --ca-file")
createSecretGitCmd.Flags().StringVar(&secretGitArgs.privateKeyFile, "private-key-file", "", "path to a passwordless private key file used for authenticating to the Git SSH server") createSecretGitCmd.Flags().StringVar(&secretGitArgs.privateKeyFile, "private-key-file", "", "path to a passwordless private key file used for authenticating to the Git SSH server")
createSecretGitCmd.Flags().StringVar(&secretGitArgs.bearerToken, "bearer-token", "", "bearer authentication token") createSecretGitCmd.Flags().StringVar(&secretGitArgs.bearerToken, "bearer-token", "", "bearer authentication token")
@@ -160,12 +162,18 @@ func createSecretGitCmdRun(cmd *cobra.Command, args []string) error {
if secretGitArgs.username != "" && secretGitArgs.password != "" && secretGitArgs.bearerToken != "" { if secretGitArgs.username != "" && secretGitArgs.password != "" && secretGitArgs.bearerToken != "" {
return fmt.Errorf("user credentials and bearer token cannot be used together") return fmt.Errorf("user credentials and bearer token cannot be used together")
} }
if secretGitArgs.caFile != "" {
caBundle, err := os.ReadFile(secretGitArgs.caFile) // --ca-crt-file takes precedence over --ca-file.
if secretGitArgs.caCrtFile != "" {
opts.CACrt, err = os.ReadFile(secretGitArgs.caCrtFile)
if err != nil {
return fmt.Errorf("unable to read TLS CA file: %w", err)
}
} else if secretGitArgs.caFile != "" {
opts.CAFile, err = os.ReadFile(secretGitArgs.caFile)
if err != nil { if err != nil {
return fmt.Errorf("unable to read TLS CA file: %w", err) return fmt.Errorf("unable to read TLS CA file: %w", err)
} }
opts.CAFile = caBundle
} }
default: default:
return fmt.Errorf("git URL scheme '%s' not supported, can be: ssh, http and https", u.Scheme) return fmt.Errorf("git URL scheme '%s' not supported, can be: ssh, http and https", u.Scheme)

View File

@@ -1,10 +1,21 @@
package main package main
import ( import (
"fmt"
"os"
"testing" "testing"
) )
func TestCreateGitSecret(t *testing.T) { func TestCreateGitSecret(t *testing.T) {
file, err := os.CreateTemp(t.TempDir(), "ca-crt")
if err != nil {
t.Fatal("could not create CA certificate file")
}
_, err = file.Write([]byte("ca-data"))
if err != nil {
t.Fatal("could not write to CA certificate file")
}
tests := []struct { tests := []struct {
name string name string
args string args string
@@ -35,6 +46,11 @@ func TestCreateGitSecret(t *testing.T) {
args: "create secret git bearer-token-auth --url=https://github.com/stefanprodan/podinfo --bearer-token=ghp_baR2qnFF0O41WlucePL3udt2N9vVZS4R0hAS --namespace=my-namespace --export", args: "create secret git bearer-token-auth --url=https://github.com/stefanprodan/podinfo --bearer-token=ghp_baR2qnFF0O41WlucePL3udt2N9vVZS4R0hAS --namespace=my-namespace --export",
assert: assertGoldenFile("testdata/create_secret/git/git-bearer-token.yaml"), assert: assertGoldenFile("testdata/create_secret/git/git-bearer-token.yaml"),
}, },
{
name: "git authentication with CA certificate",
args: fmt.Sprintf("create secret git ca-crt --url=https://github.com/stefanprodan/podinfo --password=my-password --username=my-username --ca-crt-file=%s --namespace=my-namespace --export", file.Name()),
assert: assertGoldenFile("testdata/create_secret/git/secret-ca-crt.yaml"),
},
{ {
name: "git authentication with basic auth and bearer token", name: "git authentication with basic auth and bearer token",
args: "create secret git podinfo-auth --url=https://github.com/stefanprodan/podinfo --username=aaa --password=zzzz --bearer-token=aaaa --namespace=my-namespace --export", args: "create secret git podinfo-auth --url=https://github.com/stefanprodan/podinfo --username=aaa --password=zzzz --bearer-token=aaaa --namespace=my-namespace --export",

View File

@@ -41,15 +41,8 @@ var createSecretHelmCmd = &cobra.Command{
--export > repo-auth.yaml --export > repo-auth.yaml
sops --encrypt --encrypted-regex '^(data|stringData)$' \ sops --encrypt --encrypted-regex '^(data|stringData)$' \
--in-place repo-auth.yaml --in-place repo-auth.yaml`,
# Create a Helm authentication secret using a custom TLS cert
flux create secret helm repo-auth \
--username=username \
--password=password \
--cert-file=./cert.crt \
--key-file=./key.crt \
--ca-file=./ca.crt`,
RunE: createSecretHelmCmdRun, RunE: createSecretHelmCmdRun,
} }
@@ -62,9 +55,16 @@ type secretHelmFlags struct {
var secretHelmArgs secretHelmFlags var secretHelmArgs secretHelmFlags
func init() { func init() {
createSecretHelmCmd.Flags().StringVarP(&secretHelmArgs.username, "username", "u", "", "basic authentication username") flags := createSecretHelmCmd.Flags()
createSecretHelmCmd.Flags().StringVarP(&secretHelmArgs.password, "password", "p", "", "basic authentication password") flags.StringVarP(&secretHelmArgs.username, "username", "u", "", "basic authentication username")
initSecretTLSFlags(createSecretHelmCmd.Flags(), &secretHelmArgs.secretTLSFlags) flags.StringVarP(&secretHelmArgs.password, "password", "p", "", "basic authentication password")
initSecretDeprecatedTLSFlags(flags, &secretHelmArgs.secretTLSFlags)
deprecationMsg := "please use the command `flux create secret tls` to generate TLS secrets"
flags.MarkDeprecated("cert-file", deprecationMsg)
flags.MarkDeprecated("key-file", deprecationMsg)
flags.MarkDeprecated("ca-file", deprecationMsg)
createSecretCmd.AddCommand(createSecretHelmCmd) createSecretCmd.AddCommand(createSecretHelmCmd)
} }

View File

@@ -38,8 +38,9 @@ var createSecretTLSCmd = &cobra.Command{
# Files are expected to be PEM-encoded. # Files are expected to be PEM-encoded.
flux create secret tls certs \ flux create secret tls certs \
--namespace=my-namespace \ --namespace=my-namespace \
--cert-file=./client.crt \ --tls-crt-file=./client.crt \
--key-file=./client.key \ --tls-key-file=./client.key \
--ca-crt-file=./ca.crt \
--export > certs.yaml --export > certs.yaml
sops --encrypt --encrypted-regex '^(data|stringData)$' \ sops --encrypt --encrypted-regex '^(data|stringData)$' \
@@ -48,22 +49,37 @@ var createSecretTLSCmd = &cobra.Command{
} }
type secretTLSFlags struct { type secretTLSFlags struct {
certFile string certFile string
keyFile string keyFile string
caFile string caFile string
caCrtFile string
tlsKeyFile string
tlsCrtFile string
} }
var secretTLSArgs secretTLSFlags var secretTLSArgs secretTLSFlags
func initSecretTLSFlags(flags *pflag.FlagSet, args *secretTLSFlags) { func initSecretDeprecatedTLSFlags(flags *pflag.FlagSet, args *secretTLSFlags) {
flags.StringVar(&args.certFile, "cert-file", "", "TLS authentication cert file path") flags.StringVar(&args.certFile, "cert-file", "", "TLS authentication cert file path")
flags.StringVar(&args.keyFile, "key-file", "", "TLS authentication key file path") flags.StringVar(&args.keyFile, "key-file", "", "TLS authentication key file path")
flags.StringVar(&args.caFile, "ca-file", "", "TLS authentication CA file path") flags.StringVar(&args.caFile, "ca-file", "", "TLS authentication CA file path")
} }
func initSecretTLSFlags(flags *pflag.FlagSet, args *secretTLSFlags) {
flags.StringVar(&args.tlsCrtFile, "tls-crt-file", "", "TLS authentication cert file path")
flags.StringVar(&args.tlsKeyFile, "tls-key-file", "", "TLS authentication key file path")
flags.StringVar(&args.caCrtFile, "ca-crt-file", "", "TLS authentication CA file path")
}
func init() { func init() {
flags := createSecretTLSCmd.Flags() flags := createSecretTLSCmd.Flags()
initSecretDeprecatedTLSFlags(flags, &secretTLSArgs)
initSecretTLSFlags(flags, &secretTLSArgs) initSecretTLSFlags(flags, &secretTLSArgs)
flags.MarkDeprecated("cert-file", "please use --tls-crt-file instead")
flags.MarkDeprecated("key-file", "please use --tls-key-file instead")
flags.MarkDeprecated("ca-file", "please use --ca-crt-file instead")
createSecretCmd.AddCommand(createSecretTLSCmd) createSecretCmd.AddCommand(createSecretTLSCmd)
} }
@@ -75,33 +91,40 @@ func createSecretTLSCmdRun(cmd *cobra.Command, args []string) error {
return err return err
} }
caBundle := []byte{} opts := sourcesecret.Options{
if secretTLSArgs.caFile != "" { Name: name,
var err error Namespace: *kubeconfigArgs.Namespace,
caBundle, err = os.ReadFile(secretTLSArgs.caFile) Labels: labels,
}
if secretTLSArgs.caCrtFile != "" {
opts.CACrt, err = os.ReadFile(secretTLSArgs.caCrtFile)
if err != nil {
return fmt.Errorf("unable to read TLS CA file: %w", err)
}
} else if secretTLSArgs.caFile != "" {
opts.CAFile, err = os.ReadFile(secretTLSArgs.caFile)
if err != nil { if err != nil {
return fmt.Errorf("unable to read TLS CA file: %w", err) return fmt.Errorf("unable to read TLS CA file: %w", err)
} }
} }
var certFile, keyFile []byte if secretTLSArgs.tlsCrtFile != "" && secretTLSArgs.tlsKeyFile != "" {
if secretTLSArgs.certFile != "" && secretTLSArgs.keyFile != "" { if opts.TLSCrt, err = os.ReadFile(secretTLSArgs.tlsCrtFile); err != nil {
if certFile, err = os.ReadFile(secretTLSArgs.certFile); err != nil {
return fmt.Errorf("failed to read cert file: %w", err) return fmt.Errorf("failed to read cert file: %w", err)
} }
if keyFile, err = os.ReadFile(secretTLSArgs.keyFile); err != nil { if opts.TLSKey, err = os.ReadFile(secretTLSArgs.tlsKeyFile); err != nil {
return fmt.Errorf("failed to read key file: %w", err)
}
} else if secretTLSArgs.certFile != "" && secretTLSArgs.keyFile != "" {
if opts.CertFile, err = os.ReadFile(secretTLSArgs.certFile); err != nil {
return fmt.Errorf("failed to read cert file: %w", err)
}
if opts.KeyFile, err = os.ReadFile(secretTLSArgs.keyFile); err != nil {
return fmt.Errorf("failed to read key file: %w", err) return fmt.Errorf("failed to read key file: %w", err)
} }
} }
opts := sourcesecret.Options{
Name: name,
Namespace: *kubeconfigArgs.Namespace,
Labels: labels,
CAFile: caBundle,
CertFile: certFile,
KeyFile: keyFile,
}
secret, err := sourcesecret.Generate(opts) secret, err := sourcesecret.Generate(opts)
if err != nil { if err != nil {
return err return err

View File

@@ -4,7 +4,7 @@ import (
"testing" "testing"
) )
func TestCreateTlsSecretNoArgs(t *testing.T) { func TestCreateTlsSecret(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
args string args string
@@ -15,9 +15,13 @@ func TestCreateTlsSecretNoArgs(t *testing.T) {
assert: assertError("name is required"), assert: assertError("name is required"),
}, },
{ {
args: "create secret tls certs --namespace=my-namespace --cert-file=./testdata/create_secret/tls/test-cert.pem --key-file=./testdata/create_secret/tls/test-key.pem --export", args: "create secret tls certs --namespace=my-namespace --tls-crt-file=./testdata/create_secret/tls/test-cert.pem --tls-key-file=./testdata/create_secret/tls/test-key.pem --ca-crt-file=./testdata/create_secret/tls/test-ca.pem --export",
assert: assertGoldenFile("testdata/create_secret/tls/secret-tls.yaml"), assert: assertGoldenFile("testdata/create_secret/tls/secret-tls.yaml"),
}, },
{
args: "create secret tls certs --namespace=my-namespace --cert-file=./testdata/create_secret/tls/test-cert.pem --key-file=./testdata/create_secret/tls/test-key.pem --ca-file=./testdata/create_secret/tls/test-ca.pem --export",
assert: assertGoldenFile("testdata/create_secret/tls/deprecated-secret-tls.yaml"),
},
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {

View File

@@ -64,13 +64,13 @@ For private Helm repositories, the basic authentication credentials are stored i
# Create a source for an OCI Helm repository # Create a source for an OCI Helm repository
flux create source helm podinfo \ flux create source helm podinfo \
--url=oci://ghcr.io/stefanprodan/charts/podinfo --url=oci://ghcr.io/stefanprodan/charts/podinfo \
--username=username \ --username=username \
--password=password --password=password
# Create a source for an OCI Helm repository using an existing secret with basic auth or dockerconfig credentials # Create a source for an OCI Helm repository using an existing secret with basic auth or dockerconfig credentials
flux create source helm podinfo \ flux create source helm podinfo \
--url=oci://ghcr.io/stefanprodan/charts/podinfo --url=oci://ghcr.io/stefanprodan/charts/podinfo \
--secret-ref=docker-config`, --secret-ref=docker-config`,
RunE: createSourceHelmCmdRun, RunE: createSourceHelmCmdRun,
} }

View File

@@ -21,10 +21,11 @@ import (
"fmt" "fmt"
"os" "os"
"github.com/fluxcd/flux2/v2/internal/flags"
oci "github.com/fluxcd/pkg/oci/client" oci "github.com/fluxcd/pkg/oci/client"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/fluxcd/flux2/v2/internal/flags"
) )
var diffArtifactCmd = &cobra.Command{ var diffArtifactCmd = &cobra.Command{
@@ -81,7 +82,7 @@ func diffArtifactCmdRun(cmd *cobra.Command, args []string) error {
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout) ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
defer cancel() defer cancel()
ociClient := oci.NewLocalClient() ociClient := oci.NewClient(oci.DefaultOptions())
if diffArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && diffArtifactArgs.creds != "" { if diffArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && diffArtifactArgs.creds != "" {
logger.Actionf("logging in to registry with credentials") logger.Actionf("logging in to registry with credentials")

View File

@@ -91,6 +91,12 @@ func TestDiffKustomization(t *testing.T) {
objectFile: "./testdata/diff-kustomization/stringdata-sops-secret.yaml", objectFile: "./testdata/diff-kustomization/stringdata-sops-secret.yaml",
assert: assertGoldenFile("./testdata/diff-kustomization/diff-with-drifted-stringdata-sops-secret.golden"), assert: assertGoldenFile("./testdata/diff-kustomization/diff-with-drifted-stringdata-sops-secret.golden"),
}, },
{
name: "diff where kustomization file has multiple objects with the same name",
args: "diff kustomization podinfo --path ./testdata/build-kustomization/podinfo --progress-bar=false --kustomization-file ./testdata/diff-kustomization/flux-kustomization-multiobj.yaml",
objectFile: "",
assert: assertGoldenFile("./testdata/diff-kustomization/nothing-is-deployed.golden"),
},
} }
tmpl := map[string]string{ tmpl := map[string]string{

View File

@@ -127,6 +127,9 @@ func eventsCmdRun(cmd *cobra.Command, args []string) error {
} }
rows, err := getRows(ctx, kubeclient, clientListOpts, refListOpts, showNamespace) rows, err := getRows(ctx, kubeclient, clientListOpts, refListOpts, showNamespace)
if err != nil {
return err
}
if len(rows) == 0 { if len(rows) == 0 {
if eventArgs.allNamespaces { if eventArgs.allNamespaces {
logger.Failuref("No events found.") logger.Failuref("No events found.")

View File

@@ -18,6 +18,7 @@ package main
import ( import (
"context" "context"
"errors"
"fmt" "fmt"
"os" "os"
"strings" "strings"
@@ -27,6 +28,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch" "k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/discovery"
watchtools "k8s.io/client-go/tools/watch" watchtools "k8s.io/client-go/tools/watch"
"sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client"
@@ -176,6 +178,10 @@ func (get getCommand) run(cmd *cobra.Command, args []string) error {
err = kubeClient.List(ctx, get.list.asClientList(), listOpts...) err = kubeClient.List(ctx, get.list.asClientList(), listOpts...)
if err != nil { if err != nil {
var discErr *discovery.ErrGroupDiscoveryFailed
if getAll && (strings.Contains(err.Error(), "no matches for kind") || errors.As(err, &discErr)) {
return nil
}
return err return err
} }

View File

@@ -17,8 +17,6 @@ limitations under the License.
package main package main
import ( import (
"strings"
"github.com/spf13/cobra" "github.com/spf13/cobra"
autov1 "github.com/fluxcd/image-automation-controller/api/v1beta1" autov1 "github.com/fluxcd/image-automation-controller/api/v1beta1"
@@ -57,9 +55,7 @@ var getImageAllCmd = &cobra.Command{
for _, c := range allImageCmd { for _, c := range allImageCmd {
if err := c.run(cmd, args); err != nil { if err := c.run(cmd, args); err != nil {
if !strings.Contains(err.Error(), "no matches for kind") { logger.Failuref(err.Error())
logger.Failuref(err.Error())
}
} }
} }

View File

@@ -61,11 +61,26 @@ func TestKustomizationFromGit(t *testing.T) {
"testdata/kustomization/suspend_kustomization_from_git.golden", "testdata/kustomization/suspend_kustomization_from_git.golden",
tmpl, tmpl,
}, },
{
"suspend kustomization tkfg foo tkfg bar",
"testdata/kustomization/suspend_kustomization_from_git_multiple_args.golden",
tmpl,
},
{
"resume kustomization tkfg foo --wait",
"testdata/kustomization/resume_kustomization_from_git_multiple_args_wait.golden",
tmpl,
},
{ {
"resume kustomization tkfg", "resume kustomization tkfg",
"testdata/kustomization/resume_kustomization_from_git.golden", "testdata/kustomization/resume_kustomization_from_git.golden",
tmpl, tmpl,
}, },
{
"resume kustomization tkfg tkfg",
"testdata/kustomization/resume_kustomization_from_git_multiple_args.golden",
tmpl,
},
{ {
"delete kustomization tkfg --silent", "delete kustomization tkfg --silent",
"testdata/kustomization/delete_kustomization_from_git.golden", "testdata/kustomization/delete_kustomization_from_git.golden",

View File

@@ -78,7 +78,7 @@ func listArtifactsCmdRun(cmd *cobra.Command, args []string) error {
return err return err
} }
ociClient := oci.NewLocalClient() ociClient := oci.NewClient(oci.DefaultOptions())
if listArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && listArtifactArgs.creds != "" { if listArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && listArtifactArgs.creds != "" {
logger.Actionf("logging in to registry with credentials") logger.Actionf("logging in to registry with credentials")

View File

@@ -20,6 +20,7 @@ import (
"bufio" "bufio"
"context" "context"
"encoding/json" "encoding/json"
"errors"
"fmt" "fmt"
"io" "io"
"os" "os"
@@ -76,7 +77,7 @@ type logsFlags struct {
sinceSeconds time.Duration sinceSeconds time.Duration
} }
var logsArgs = &logsFlags{ var logsArgs = logsFlags{
tail: -1, tail: -1,
} }
@@ -115,7 +116,7 @@ func logsCmdRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("no argument required") return fmt.Errorf("no argument required")
} }
pods, err := getPods(ctx, clientset, fluxSelector) pods, err := getPods(ctx, clientset, logsArgs.fluxNamespace, fluxSelector)
if err != nil { if err != nil {
return err return err
} }
@@ -163,13 +164,16 @@ func logsCmdRun(cmd *cobra.Command, args []string) error {
return podLogs(ctx, requests) return podLogs(ctx, requests)
} }
func getPods(ctx context.Context, c *kubernetes.Clientset, label string) ([]corev1.Pod, error) { // getPods searches for all Deployments in the given namespace that match the given label and returns a list of Pods
// from these Deployments. For each Deployment a single Pod is chosen (based on various factors such as the running
// state). If no Pod is found, an error is returned.
func getPods(ctx context.Context, c *kubernetes.Clientset, ns string, label string) ([]corev1.Pod, error) {
var ret []corev1.Pod var ret []corev1.Pod
opts := metav1.ListOptions{ opts := metav1.ListOptions{
LabelSelector: label, LabelSelector: label,
} }
deployList, err := c.AppsV1().Deployments(logsArgs.fluxNamespace).List(ctx, opts) deployList, err := c.AppsV1().Deployments(ns).List(ctx, opts)
if err != nil { if err != nil {
return ret, err return ret, err
} }
@@ -179,7 +183,7 @@ func getPods(ctx context.Context, c *kubernetes.Clientset, label string) ([]core
opts := metav1.ListOptions{ opts := metav1.ListOptions{
LabelSelector: createLabelStringFromMap(label), LabelSelector: createLabelStringFromMap(label),
} }
podList, err := c.CoreV1().Pods(logsArgs.fluxNamespace).List(ctx, opts) podList, err := c.CoreV1().Pods(ns).List(ctx, opts)
if err != nil { if err != nil {
return ret, err return ret, err
} }
@@ -196,11 +200,16 @@ func getPods(ctx context.Context, c *kubernetes.Clientset, label string) ([]core
} }
} }
if len(ret) == 0 {
return nil, fmt.Errorf("no Flux pods found in namespace %q", ns)
}
return ret, nil return ret, nil
} }
func parallelPodLogs(ctx context.Context, requests []rest.ResponseWrapper) error { func parallelPodLogs(ctx context.Context, requests []rest.ResponseWrapper) error {
reader, writer := io.Pipe() reader, writer := io.Pipe()
errReader, errWriter := io.Pipe()
wg := &sync.WaitGroup{} wg := &sync.WaitGroup{}
wg.Add(len(requests)) wg.Add(len(requests))
@@ -208,7 +217,7 @@ func parallelPodLogs(ctx context.Context, requests []rest.ResponseWrapper) error
go func(req rest.ResponseWrapper) { go func(req rest.ResponseWrapper) {
defer wg.Done() defer wg.Done()
if err := logRequest(ctx, req, writer); err != nil { if err := logRequest(ctx, req, writer); err != nil {
writer.CloseWithError(err) fmt.Fprintf(errWriter, "failed getting logs: %s\n", err)
return return
} }
}(request) }(request)
@@ -217,20 +226,40 @@ func parallelPodLogs(ctx context.Context, requests []rest.ResponseWrapper) error
go func() { go func() {
wg.Wait() wg.Wait()
writer.Close() writer.Close()
errWriter.Close()
}() }()
_, err := io.Copy(os.Stdout, reader) stdoutErrCh := asyncCopy(os.Stdout, reader)
return err stderrErrCh := asyncCopy(os.Stderr, errReader)
return errors.Join(<-stdoutErrCh, <-stderrErrCh)
}
// asyncCopy copies all data from from dst to src asynchronously and returns a channel for reading an error value.
// This is basically an asynchronous wrapper around `io.Copy`. The returned channel is unbuffered and always is sent
// a value (either nil or the error from `io.Copy`) as soon as `io.Copy` returns.
// This function lets you copy from multiple sources into multiple destinations in parallel.
func asyncCopy(dst io.Writer, src io.Reader) <-chan error {
errCh := make(chan error)
go func(errCh chan error) {
_, err := io.Copy(dst, src)
errCh <- err
}(errCh)
return errCh
} }
func podLogs(ctx context.Context, requests []rest.ResponseWrapper) error { func podLogs(ctx context.Context, requests []rest.ResponseWrapper) error {
var retErr error
for _, req := range requests { for _, req := range requests {
if err := logRequest(ctx, req, os.Stdout); err != nil { if err := logRequest(ctx, req, os.Stdout); err != nil {
return err fmt.Fprintf(os.Stderr, "failed getting logs: %s\n", err)
retErr = fmt.Errorf("failed to collect logs from all Flux pods")
continue
} }
} }
return nil return retErr
} }
func createLabelStringFromMap(m map[string]string) string { func createLabelStringFromMap(m map[string]string) string {

88
cmd/flux/logs_e2e_test.go Normal file
View File

@@ -0,0 +1,88 @@
//go:build e2e
// +build e2e
/*
Copyright 2021 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 (
"testing"
)
func TestLogsNoArgs(t *testing.T) {
cmd := cmdTestCase{
args: "logs",
assert: assertSuccess(),
}
cmd.runTestCmd(t)
}
func TestLogsWrongNamespace(t *testing.T) {
cmd := cmdTestCase{
args: "logs --flux-namespace=default",
assert: assertError(`no Flux pods found in namespace "default"`),
}
cmd.runTestCmd(t)
}
func TestLogsAllNamespaces(t *testing.T) {
cmd := cmdTestCase{
args: "logs --all-namespaces",
assert: assertSuccess(),
}
cmd.runTestCmd(t)
}
func TestLogsSince(t *testing.T) {
cmd := cmdTestCase{
args: "logs --since=2m",
assert: assertSuccess(),
}
cmd.runTestCmd(t)
}
func TestLogsSinceInvalid(t *testing.T) {
cmd := cmdTestCase{
args: "logs --since=XXX",
assert: assertError(`invalid argument "XXX" for "--since" flag: time: invalid duration "XXX"`),
}
cmd.runTestCmd(t)
}
func TestLogsSinceTime(t *testing.T) {
cmd := cmdTestCase{
args: "logs --since-time=2021-08-06T14:26:25.546Z",
assert: assertSuccess(),
}
cmd.runTestCmd(t)
}
func TestLogsSinceTimeInvalid(t *testing.T) {
cmd := cmdTestCase{
args: "logs --since-time=XXX",
assert: assertError("XXX is not a valid (RFC3339) time"),
}
cmd.runTestCmd(t)
}
func TestLogsSinceOnlyOneAllowed(t *testing.T) {
cmd := cmdTestCase{
args: "logs --since=2m --since-time=2021-08-06T14:26:25.546Z",
assert: assertError("at most one of `sinceTime` or `sinceSeconds` may be specified"),
}
cmd.runTestCmd(t)
}

View File

@@ -30,73 +30,17 @@ import (
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
) )
func TestLogsNoArgs(t *testing.T) {
cmd := cmdTestCase{
args: "logs",
assert: assertSuccess(),
}
cmd.runTestCmd(t)
}
func TestLogsAllNamespaces(t *testing.T) {
cmd := cmdTestCase{
args: "logs --all-namespaces",
assert: assertSuccess(),
}
cmd.runTestCmd(t)
}
func TestLogsSince(t *testing.T) {
cmd := cmdTestCase{
args: "logs --since=2m",
assert: assertSuccess(),
}
cmd.runTestCmd(t)
}
func TestLogsSinceInvalid(t *testing.T) {
cmd := cmdTestCase{
args: "logs --since=XXX",
assert: assertError(`invalid argument "XXX" for "--since" flag: time: invalid duration "XXX"`),
}
cmd.runTestCmd(t)
}
func TestLogsSinceTime(t *testing.T) {
cmd := cmdTestCase{
args: "logs --since-time=2021-08-06T14:26:25.546Z",
assert: assertSuccess(),
}
cmd.runTestCmd(t)
}
func TestLogsSinceTimeInvalid(t *testing.T) {
cmd := cmdTestCase{
args: "logs --since-time=XXX",
assert: assertError("XXX is not a valid (RFC3339) time"),
}
cmd.runTestCmd(t)
}
func TestLogsSinceOnlyOneAllowed(t *testing.T) {
cmd := cmdTestCase{
args: "logs --since=2m --since-time=2021-08-06T14:26:25.546Z",
assert: assertError("at most one of `sinceTime` or `sinceSeconds` may be specified"),
}
cmd.runTestCmd(t)
}
func TestLogRequest(t *testing.T) { func TestLogRequest(t *testing.T) {
mapper := &testResponseMapper{} mapper := &testResponseMapper{}
tests := []struct { tests := []struct {
name string name string
namespace string namespace string
flags *logsFlags flags logsFlags
assertFile string assertFile string
}{ }{
{ {
name: "all logs", name: "all logs",
flags: &logsFlags{ flags: logsFlags{
tail: -1, tail: -1,
allNamespaces: true, allNamespaces: true,
}, },
@@ -105,14 +49,14 @@ func TestLogRequest(t *testing.T) {
{ {
name: "filter by namespace", name: "filter by namespace",
namespace: "default", namespace: "default",
flags: &logsFlags{ flags: logsFlags{
tail: -1, tail: -1,
}, },
assertFile: "testdata/logs/namespace.txt", assertFile: "testdata/logs/namespace.txt",
}, },
{ {
name: "filter by kind and namespace", name: "filter by kind and namespace",
flags: &logsFlags{ flags: logsFlags{
tail: -1, tail: -1,
kind: "Kustomization", kind: "Kustomization",
}, },
@@ -120,7 +64,7 @@ func TestLogRequest(t *testing.T) {
}, },
{ {
name: "filter by loglevel", name: "filter by loglevel",
flags: &logsFlags{ flags: logsFlags{
tail: -1, tail: -1,
logLevel: "error", logLevel: "error",
allNamespaces: true, allNamespaces: true,
@@ -130,7 +74,7 @@ func TestLogRequest(t *testing.T) {
{ {
name: "filter by namespace, name, loglevel and kind", name: "filter by namespace, name, loglevel and kind",
namespace: "flux-system", namespace: "flux-system",
flags: &logsFlags{ flags: logsFlags{
tail: -1, tail: -1,
logLevel: "error", logLevel: "error",
kind: "Kustomization", kind: "Kustomization",
@@ -163,7 +107,7 @@ func TestLogRequest(t *testing.T) {
// reset flags to default // reset flags to default
*kubeconfigArgs.Namespace = rootArgs.defaults.Namespace *kubeconfigArgs.Namespace = rootArgs.defaults.Namespace
logsArgs = &logsFlags{ logsArgs = logsFlags{
tail: -1, tail: -1,
} }
}) })

View File

@@ -24,12 +24,14 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-logr/logr"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"golang.org/x/term" "golang.org/x/term"
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/validation" "k8s.io/apimachinery/pkg/util/validation"
"k8s.io/cli-runtime/pkg/genericclioptions" "k8s.io/cli-runtime/pkg/genericclioptions"
_ "k8s.io/client-go/plugin/pkg/client/auth" _ "k8s.io/client-go/plugin/pkg/client/auth"
ctrllog "sigs.k8s.io/controller-runtime/pkg/log"
runclient "github.com/fluxcd/pkg/runtime/client" runclient "github.com/fluxcd/pkg/runtime/client"
@@ -149,6 +151,11 @@ func init() {
apiServer := "" apiServer := ""
kubeconfigArgs.APIServer = &apiServer kubeconfigArgs.APIServer = &apiServer
rootCmd.PersistentFlags().StringVar(kubeconfigArgs.APIServer, "server", *kubeconfigArgs.APIServer, "The address and port of the Kubernetes API server") rootCmd.PersistentFlags().StringVar(kubeconfigArgs.APIServer, "server", *kubeconfigArgs.APIServer, "The address and port of the Kubernetes API server")
// Update the description for kubeconfig TLS flags so that user's don't mistake it for a Flux specific flag
rootCmd.Flag("insecure-skip-tls-verify").Usage = "If true, the Kubernetes API server's certificate will not be checked for validity. This will make your HTTPS connections insecure"
rootCmd.Flag("client-certificate").Usage = "Path to a client certificate file for TLS authentication to the Kubernetes API server"
rootCmd.Flag("certificate-authority").Usage = "Path to a cert file for the certificate authority to authenticate the Kubernetes API server"
rootCmd.Flag("client-key").Usage = "Path to a client key file for TLS authentication to the Kubernetes API server"
kubeclientOptions.BindFlags(rootCmd.PersistentFlags()) kubeclientOptions.BindFlags(rootCmd.PersistentFlags())
@@ -170,6 +177,15 @@ func NewRootFlags() rootFlags {
func main() { func main() {
log.SetFlags(0) log.SetFlags(0)
// 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
// 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.
ctrllog.SetLogger(logr.New(ctrllog.NullLogSink{}))
if err := rootCmd.Execute(); err != nil { if err := rootCmd.Execute(); err != nil {
if err, ok := err.(*RequestError); ok { if err, ok := err.(*RequestError); ok {

View File

@@ -41,7 +41,7 @@ func TestMain(m *testing.M) {
// Install Flux. // Install Flux.
output, err := executeCommand("install --components-extra=image-reflector-controller,image-automation-controller") output, err := executeCommand("install --components-extra=image-reflector-controller,image-automation-controller")
if err != nil { if err != nil {
panic(fmt.Errorf("install falied: %s error:'%w'", output, err)) panic(fmt.Errorf("install failed: %s error:'%w'", output, err))
} }
// Run tests // Run tests
@@ -50,7 +50,7 @@ func TestMain(m *testing.M) {
// Uninstall Flux // Uninstall Flux
output, err = executeCommand("uninstall -s --keep-namespace") output, err = executeCommand("uninstall -s --keep-namespace")
if err != nil { if err != nil {
panic(fmt.Errorf("uninstall falied: %s error:'%w'", output, err)) panic(fmt.Errorf("uninstall failed: %s error:'%w'", output, err))
} }
// Delete namespace and wait for finalisation // Delete namespace and wait for finalisation

View File

@@ -365,6 +365,12 @@ func executeTemplate(content string, templateValues map[string]string) (string,
// Run the command and return the captured output. // Run the command and return the captured output.
func executeCommand(cmd string) (string, error) { func executeCommand(cmd string) (string, error) {
defer resetCmdArgs() defer resetCmdArgs()
defer func() {
// need to set this explicitly because apparently its value isn't changed
// in subsequent executions which causes tests to fail that rely on the value
// of "Changed".
resumeCmd.PersistentFlags().Lookup("wait").Changed = false
}()
args, err := shellwords.Parse(cmd) args, err := shellwords.Parse(cmd)
if err != nil { if err != nil {
return "", err return "", err
@@ -392,6 +398,10 @@ func resetCmdArgs() {
alertProviderArgs = alertProviderFlags{} alertProviderArgs = alertProviderFlags{}
bootstrapArgs = NewBootstrapFlags() bootstrapArgs = NewBootstrapFlags()
bServerArgs = bServerFlags{} bServerArgs = bServerFlags{}
logsArgs = logsFlags{
tail: -1,
fluxNamespace: rootArgs.defaults.Namespace,
}
buildKsArgs = buildKsFlags{} buildKsArgs = buildKsFlags{}
checkArgs = checkFlags{} checkArgs = checkFlags{}
createArgs = createFlags{} createArgs = createFlags{}

View File

@@ -47,7 +47,7 @@ type copyable interface {
deepCopyClientObject() client.Object deepCopyClientObject() client.Object
} }
// listAdapater is the analogue to adapter, but for lists; the // listAdapter is the analogue to adapter, but for lists; the
// controller runtime distinguishes between methods dealing with // controller runtime distinguishes between methods dealing with
// objects and lists. // objects and lists.
type listAdapter interface { type listAdapter interface {

View File

@@ -21,10 +21,11 @@ import (
"fmt" "fmt"
"os" "os"
"github.com/fluxcd/flux2/v2/internal/flags"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/fluxcd/flux2/v2/internal/flags"
oci "github.com/fluxcd/pkg/oci/client" oci "github.com/fluxcd/pkg/oci/client"
) )
@@ -82,7 +83,7 @@ func pullArtifactCmdRun(cmd *cobra.Command, args []string) error {
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout) ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
defer cancel() defer cancel()
ociClient := oci.NewLocalClient() ociClient := oci.NewClient(oci.DefaultOptions())
if pullArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && pullArtifactArgs.creds != "" { if pullArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && pullArtifactArgs.creds != "" {
logger.Actionf("logging in to registry with credentials") logger.Actionf("logging in to registry with credentials")
@@ -110,8 +111,12 @@ func pullArtifactCmdRun(cmd *cobra.Command, args []string) error {
return err return err
} }
logger.Successf("source %s", meta.Source) if meta.Source != "" {
logger.Successf("revision %s", meta.Revision) logger.Successf("source %s", meta.Source)
}
if meta.Revision != "" {
logger.Successf("revision %s", meta.Revision)
}
logger.Successf("digest %s", meta.Digest) logger.Successf("digest %s", meta.Digest)
logger.Successf("artifact content extracted to %s", pullArtifactArgs.output) logger.Successf("artifact content extracted to %s", pullArtifactArgs.output)

View File

@@ -22,14 +22,24 @@ import (
"fmt" "fmt"
"os" "os"
"strings" "strings"
"time"
"github.com/fluxcd/flux2/v2/internal/flags" "github.com/google/go-containerregistry/pkg/authn"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" "github.com/google/go-containerregistry/pkg/crane"
"github.com/google/go-containerregistry/pkg/logs"
"github.com/google/go-containerregistry/pkg/name"
reg "github.com/google/go-containerregistry/pkg/name" reg "github.com/google/go-containerregistry/pkg/name"
"github.com/google/go-containerregistry/pkg/v1/remote"
"github.com/google/go-containerregistry/pkg/v1/remote/transport"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"sigs.k8s.io/yaml" "sigs.k8s.io/yaml"
oci "github.com/fluxcd/pkg/oci/client" "github.com/fluxcd/pkg/oci"
"github.com/fluxcd/pkg/oci/auth/login"
"github.com/fluxcd/pkg/oci/client"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
"github.com/fluxcd/flux2/v2/internal/flags"
) )
var pushArtifactCmd = &cobra.Command{ var pushArtifactCmd = &cobra.Command{
@@ -79,7 +89,7 @@ The command can read the credentials from '~/.docker/config.json' but they can a
# Login directly to the registry provider # Login directly to the registry provider
# You might need to export the following variable if you use local config files for AWS: # You might need to export the following variable if you use local config files for AWS:
# export AWS_SDK_LOAD_CONFIG=1 # export AWS_SDK_LOAD_CONFIG=1
flux push artifact oci://<account>.dkr.ecr.<region>.amazonaws.com/foo:v1:$(git tag --points-at HEAD) \ flux push artifact oci://<account>.dkr.ecr.<region>.amazonaws.com/app-config:$(git tag --points-at HEAD) \
--path="./path/to/local/manifests" \ --path="./path/to/local/manifests" \
--source="$(git config --get remote.origin.url)" \ --source="$(git config --get remote.origin.url)" \
--revision="$(git tag --points-at HEAD)@sha1:$(git rev-parse HEAD)" \ --revision="$(git tag --points-at HEAD)@sha1:$(git rev-parse HEAD)" \
@@ -104,6 +114,7 @@ type pushArtifactFlags struct {
ignorePaths []string ignorePaths []string
annotations []string annotations []string
output string output string
debug bool
} }
var pushArtifactArgs = newPushArtifactFlags() var pushArtifactArgs = newPushArtifactFlags()
@@ -124,6 +135,7 @@ func init() {
pushArtifactCmd.Flags().StringArrayVarP(&pushArtifactArgs.annotations, "annotations", "a", nil, "Set custom OCI annotations in the format '<key>=<value>'") pushArtifactCmd.Flags().StringArrayVarP(&pushArtifactArgs.annotations, "annotations", "a", nil, "Set custom OCI annotations in the format '<key>=<value>'")
pushArtifactCmd.Flags().StringVarP(&pushArtifactArgs.output, "output", "o", "", pushArtifactCmd.Flags().StringVarP(&pushArtifactArgs.output, "output", "o", "",
"the format in which the artifact digest should be printed, can be 'json' or 'yaml'") "the format in which the artifact digest should be printed, can be 'json' or 'yaml'")
pushArtifactCmd.Flags().BoolVarP(&pushArtifactArgs.debug, "debug", "", false, "display logs from underlying library")
pushCmd.AddCommand(pushArtifactCmd) pushCmd.AddCommand(pushArtifactCmd)
} }
@@ -146,7 +158,12 @@ func pushArtifactCmdRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("invalid path %q", pushArtifactArgs.path) return fmt.Errorf("invalid path %q", pushArtifactArgs.path)
} }
url, err := oci.ParseArtifactURL(ociURL) url, err := client.ParseArtifactURL(ociURL)
if err != nil {
return err
}
ref, err := name.ParseReference(url)
if err != nil { if err != nil {
return err return err
} }
@@ -174,7 +191,13 @@ func pushArtifactCmdRun(cmd *cobra.Command, args []string) error {
annotations[kv[0]] = kv[1] annotations[kv[0]] = kv[1]
} }
meta := oci.Metadata{ if pushArtifactArgs.debug {
// direct logs from crane library to stderr
// this can be useful to figure out things happening underneath e.g when the library is retrying a request
logs.Warn.SetOutput(os.Stderr)
}
meta := client.Metadata{
Source: pushArtifactArgs.source, Source: pushArtifactArgs.source,
Revision: pushArtifactArgs.revision, Revision: pushArtifactArgs.revision,
Annotations: annotations, Annotations: annotations,
@@ -183,13 +206,15 @@ func pushArtifactCmdRun(cmd *cobra.Command, args []string) error {
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout) ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
defer cancel() defer cancel()
ociClient := oci.NewLocalClient() var auth authn.Authenticator
opts := client.DefaultOptions()
if pushArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && pushArtifactArgs.creds != "" { if pushArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && pushArtifactArgs.creds != "" {
logger.Actionf("logging in to registry with credentials") logger.Actionf("logging in to registry with credentials")
if err := ociClient.LoginWithCredentials(pushArtifactArgs.creds); err != nil { auth, err = client.GetAuthFromCredentials(pushArtifactArgs.creds)
if err != nil {
return fmt.Errorf("could not login with credentials: %w", err) return fmt.Errorf("could not login with credentials: %w", err)
} }
opts = append(opts, crane.WithAuth(auth))
} }
if pushArtifactArgs.provider.String() != sourcev1.GenericOCIProvider { if pushArtifactArgs.provider.String() != sourcev1.GenericOCIProvider {
@@ -199,15 +224,43 @@ func pushArtifactCmdRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("provider not supported: %w", err) return fmt.Errorf("provider not supported: %w", err)
} }
if err := ociClient.LoginWithProvider(ctx, url, ociProvider); err != nil { auth, err = login.NewManager().Login(ctx, url, ref, getProviderLoginOption(ociProvider))
if err != nil {
return fmt.Errorf("error during login with provider: %w", err) return fmt.Errorf("error during login with provider: %w", err)
} }
opts = append(opts, crane.WithAuth(auth))
}
if rootArgs.timeout != 0 {
backoff := remote.Backoff{
Duration: 1.0 * time.Second,
Factor: 3,
Jitter: 0.1,
// timeout happens when the cap is exceeded or number of steps is reached
// 10 steps is big enough that most reasonable cap(under 30min) will be exceeded before
// the number of steps are completed.
Steps: 10,
Cap: rootArgs.timeout,
}
if auth == nil {
auth, err = authn.DefaultKeychain.Resolve(ref.Context())
if err != nil {
return err
}
}
transportOpts, err := client.WithRetryTransport(ctx, ref, auth, backoff, []string{ref.Context().Scope(transport.PushScope)})
if err != nil {
return fmt.Errorf("error setting up transport: %w", err)
}
opts = append(opts, transportOpts, client.WithRetryBackOff(backoff))
} }
if pushArtifactArgs.output == "" { if pushArtifactArgs.output == "" {
logger.Actionf("pushing artifact to %s", url) logger.Actionf("pushing artifact to %s", url)
} }
ociClient := client.NewClient(opts)
digestURL, err := ociClient.Push(ctx, url, path, meta, pushArtifactArgs.ignorePaths) digestURL, err := ociClient.Push(ctx, url, path, meta, pushArtifactArgs.ignorePaths)
if err != nil { if err != nil {
return fmt.Errorf("pushing artifact failed: %w", err) return fmt.Errorf("pushing artifact failed: %w", err)
@@ -255,3 +308,16 @@ func pushArtifactCmdRun(cmd *cobra.Command, args []string) error {
return nil return nil
} }
func getProviderLoginOption(provider oci.Provider) login.ProviderOptions {
var opts login.ProviderOptions
switch provider {
case oci.ProviderAzure:
opts.AzureAutoLogin = true
case oci.ProviderAWS:
opts.AwsAutoLogin = true
case oci.ProviderGCP:
opts.GcpAutoLogin = true
}
return opts
}

View File

@@ -17,11 +17,12 @@ limitations under the License.
package main package main
import ( import (
"fmt"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1" helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2" sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
) )
@@ -63,28 +64,20 @@ func (obj helmReleaseAdapter) reconcileSource() bool {
return rhrArgs.syncHrWithSource return rhrArgs.syncHrWithSource
} }
func (obj helmReleaseAdapter) getSource() (reconcileCommand, types.NamespacedName) { func (obj helmReleaseAdapter) getSource() (reconcileSource, types.NamespacedName) {
var cmd reconcileCommand cmd := reconcileWithSourceCommand{
switch obj.Spec.Chart.Spec.SourceRef.Kind { apiType: helmChartType,
case sourcev1b2.HelmRepositoryKind: object: helmChartAdapter{&sourcev1b2.HelmChart{}},
cmd = reconcileCommand{ force: true,
apiType: helmRepositoryType, }
object: helmRepositoryAdapter{&sourcev1b2.HelmRepository{}},
} ns := obj.Spec.Chart.Spec.SourceRef.Namespace
case sourcev1.GitRepositoryKind: if ns == "" {
cmd = reconcileCommand{ ns = obj.Namespace
apiType: gitRepositoryType,
object: gitRepositoryAdapter{&sourcev1.GitRepository{}},
}
case sourcev1b2.BucketKind:
cmd = reconcileCommand{
apiType: bucketType,
object: bucketAdapter{&sourcev1b2.Bucket{}},
}
} }
return cmd, types.NamespacedName{ return cmd, types.NamespacedName{
Name: obj.Spec.Chart.Spec.SourceRef.Name, Name: fmt.Sprintf("%s-%s", obj.Namespace, obj.Name),
Namespace: obj.Spec.Chart.Spec.SourceRef.Namespace, Namespace: ns,
} }
} }

View File

@@ -63,7 +63,7 @@ func (obj kustomizationAdapter) reconcileSource() bool {
return rksArgs.syncKsWithSource return rksArgs.syncKsWithSource
} }
func (obj kustomizationAdapter) getSource() (reconcileCommand, types.NamespacedName) { func (obj kustomizationAdapter) getSource() (reconcileSource, types.NamespacedName) {
var cmd reconcileCommand var cmd reconcileCommand
switch obj.Spec.SourceRef.Kind { switch obj.Spec.SourceRef.Kind {
case sourcev1b2.OCIRepositoryKind: case sourcev1b2.OCIRepositoryKind:

View File

@@ -0,0 +1,86 @@
/*
Copyright 2020 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"
"k8s.io/apimachinery/pkg/types"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
)
var reconcileSourceHelmChartCmd = &cobra.Command{
Use: "chart [name]",
Short: "Reconcile a HelmChart source",
Long: `The reconcile source command triggers a reconciliation of a HelmChart resource and waits for it to finish.`,
Example: ` # Trigger a reconciliation for an existing source
flux reconcile source chart podinfo
# Trigger a reconciliation of the HelmCharts's source and apply changes
flux reconcile helmchart podinfo --with-source`,
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1b2.GroupVersion.WithKind(sourcev1b2.HelmChartKind)),
RunE: reconcileWithSourceCommand{
apiType: helmChartType,
object: helmChartAdapter{&sourcev1b2.HelmChart{}},
}.run,
}
func init() {
reconcileSourceHelmChartCmd.Flags().BoolVar(&rhcArgs.syncHrWithSource, "with-source", false, "reconcile HelmChart source")
reconcileSourceCmd.AddCommand(reconcileSourceHelmChartCmd)
}
func (obj helmChartAdapter) lastHandledReconcileRequest() string {
return obj.Status.GetLastHandledReconcileRequest()
}
type reconcileHelmChartFlags struct {
syncHrWithSource bool
}
var rhcArgs reconcileHelmChartFlags
func (obj helmChartAdapter) reconcileSource() bool {
return rhcArgs.syncHrWithSource
}
func (obj helmChartAdapter) getSource() (reconcileSource, types.NamespacedName) {
var cmd reconcileCommand
switch obj.Spec.SourceRef.Kind {
case sourcev1b2.HelmRepositoryKind:
cmd = reconcileCommand{
apiType: helmRepositoryType,
object: helmRepositoryAdapter{&sourcev1b2.HelmRepository{}},
}
case sourcev1.GitRepositoryKind:
cmd = reconcileCommand{
apiType: gitRepositoryType,
object: gitRepositoryAdapter{&sourcev1.GitRepository{}},
}
case sourcev1b2.BucketKind:
cmd = reconcileCommand{
apiType: bucketType,
object: bucketAdapter{&sourcev1b2.Bucket{}},
}
}
return cmd, types.NamespacedName{
Name: obj.Spec.SourceRef.Name,
Namespace: obj.Namespace,
}
}

View File

@@ -18,12 +18,17 @@ type reconcileWithSource interface {
adapter adapter
reconcilable reconcilable
reconcileSource() bool reconcileSource() bool
getSource() (reconcileCommand, types.NamespacedName) getSource() (reconcileSource, types.NamespacedName)
}
type reconcileSource interface {
run(cmd *cobra.Command, args []string) error
} }
type reconcileWithSourceCommand struct { type reconcileWithSourceCommand struct {
apiType apiType
object reconcileWithSource object reconcileWithSource
force bool
} }
func (reconcile reconcileWithSourceCommand) run(cmd *cobra.Command, args []string) error { func (reconcile reconcileWithSourceCommand) run(cmd *cobra.Command, args []string) error {
@@ -54,7 +59,7 @@ func (reconcile reconcileWithSourceCommand) run(cmd *cobra.Command, args []strin
return fmt.Errorf("resource is suspended") return fmt.Errorf("resource is suspended")
} }
if reconcile.object.reconcileSource() { if reconcile.object.reconcileSource() || reconcile.force {
reconcileCmd, nsName := reconcile.object.getSource() reconcileCmd, nsName := reconcile.object.getSource()
nsCopy := *kubeconfigArgs.Namespace nsCopy := *kubeconfigArgs.Namespace
if nsName.Namespace != "" { if nsName.Namespace != "" {

View File

@@ -19,6 +19,8 @@ package main
import ( import (
"context" "context"
"fmt" "fmt"
"sort"
"sync"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
@@ -59,8 +61,10 @@ type resumable interface {
type resumeCommand struct { type resumeCommand struct {
apiType apiType
object resumable client client.WithWatch
list listResumable list listResumable
namespace string
shouldReconcile bool
} }
type listResumable interface { type listResumable interface {
@@ -68,6 +72,11 @@ type listResumable interface {
resumeItem(i int) resumable resumeItem(i int) resumable
} }
type reconcileResponse struct {
resumable
err error
}
func (resume resumeCommand) run(cmd *cobra.Command, args []string) error { func (resume resumeCommand) run(cmd *cobra.Command, args []string) error {
if len(args) < 1 && !resumeArgs.all { if len(args) < 1 && !resumeArgs.all {
return fmt.Errorf("%s name is required", resume.humanKind) return fmt.Errorf("%s name is required", resume.humanKind)
@@ -80,52 +89,162 @@ func (resume resumeCommand) run(cmd *cobra.Command, args []string) error {
if err != nil { if err != nil {
return err return err
} }
resume.client = kubeClient
resume.namespace = *kubeconfigArgs.Namespace
var listOpts []client.ListOption // require waiting for the object(s) if the user has not provided the --wait flag and gave exactly
listOpts = append(listOpts, client.InNamespace(*kubeconfigArgs.Namespace)) // one object to resume. This is necessary to maintain backwards compatibility with prior versions
if len(args) > 0 { // of this command. Otherwise just follow the value of the --wait flag (including its default).
listOpts = append(listOpts, client.MatchingFields{ resume.shouldReconcile = !resumeCmd.PersistentFlags().Changed("wait") && len(args) == 1 || resumeArgs.wait
"metadata.name": args[0],
})
}
err = kubeClient.List(ctx, resume.list.asClientList(), listOpts...) resumables, err := resume.getPatchedResumables(ctx, args)
if err != nil { if err != nil {
return err return err
} }
if resume.list.len() == 0 { var wg sync.WaitGroup
logger.Failuref("no %s objects found in %s namespace", resume.kind, *kubeconfigArgs.Namespace) wg.Add(len(resumables))
return nil
resultChan := make(chan reconcileResponse, len(resumables))
for _, r := range resumables {
go func(res resumable) {
defer wg.Done()
resultChan <- resume.reconcile(ctx, res)
}(r)
} }
for i := 0; i < resume.list.len(); i++ { go func() {
logger.Actionf("resuming %s %s in %s namespace", resume.humanKind, resume.list.resumeItem(i).asClientObject().GetName(), *kubeconfigArgs.Namespace) defer close(resultChan)
obj := resume.list.resumeItem(i) wg.Wait()
patch := client.MergeFrom(obj.deepCopyClientObject()) }()
obj.setUnsuspended()
if err := kubeClient.Patch(ctx, obj.asClientObject(), patch); err != nil {
return err
}
logger.Successf("%s resumed", resume.humanKind) reconcileResps := make([]reconcileResponse, 0, len(resumables))
for c := range resultChan {
if resumeArgs.wait || !resumeArgs.all { reconcileResps = append(reconcileResps, c)
namespacedName := types.NamespacedName{
Name: resume.list.resumeItem(i).asClientObject().GetName(),
Namespace: *kubeconfigArgs.Namespace,
}
logger.Waitingf("waiting for %s reconciliation", resume.kind)
if err := wait.PollImmediate(rootArgs.pollInterval, rootArgs.timeout,
isReady(ctx, kubeClient, namespacedName, resume.list.resumeItem(i))); err != nil {
logger.Failuref(err.Error())
continue
}
logger.Successf("%s reconciliation completed", resume.kind)
logger.Successf(resume.list.resumeItem(i).successMessage())
}
} }
resume.printMessage(reconcileResps)
return nil return nil
} }
// getPatchedResumables returns a list of the given resumable objects that have been patched to be resumed.
// If the args slice is empty, it patches all resumable objects in the given namespace.
func (resume *resumeCommand) getPatchedResumables(ctx context.Context, args []string) ([]resumable, error) {
if len(args) < 1 {
objs, err := resume.patch(ctx, []client.ListOption{
client.InNamespace(resume.namespace),
})
if err != nil {
return nil, fmt.Errorf("failed patching objects: %w", err)
}
return objs, nil
}
var resumables []resumable
processed := make(map[string]struct{}, len(args))
for _, arg := range args {
if _, has := processed[arg]; has {
continue // skip object that user might have provided more than once
}
processed[arg] = struct{}{}
objs, err := resume.patch(ctx, []client.ListOption{
client.InNamespace(resume.namespace),
client.MatchingFields{
"metadata.name": arg,
},
})
if err != nil {
return nil, err
}
resumables = append(resumables, objs...)
}
return resumables, nil
}
// Patches resumable objects by setting their status to unsuspended.
// Returns a slice of resumables that have been patched and any error encountered during patching.
func (resume resumeCommand) patch(ctx context.Context, listOpts []client.ListOption) ([]resumable, error) {
if err := resume.client.List(ctx, resume.list.asClientList(), listOpts...); err != nil {
return nil, err
}
if resume.list.len() == 0 {
logger.Failuref("no %s objects found in %s namespace", resume.kind, resume.namespace)
return nil, nil
}
var resumables []resumable
for i := 0; i < resume.list.len(); i++ {
obj := resume.list.resumeItem(i)
logger.Actionf("resuming %s %s in %s namespace", resume.humanKind, obj.asClientObject().GetName(), resume.namespace)
patch := client.MergeFrom(obj.deepCopyClientObject())
obj.setUnsuspended()
if err := resume.client.Patch(ctx, obj.asClientObject(), patch); err != nil {
return nil, err
}
resumables = append(resumables, obj)
logger.Successf("%s resumed", resume.humanKind)
}
return resumables, nil
}
// Waits for resumable object to be reconciled and returns the object and any error encountered while waiting.
// Returns an empty reconcileResponse, if shouldReconcile is false.
func (resume resumeCommand) reconcile(ctx context.Context, res resumable) reconcileResponse {
if !resume.shouldReconcile {
return reconcileResponse{}
}
namespacedName := types.NamespacedName{
Name: res.asClientObject().GetName(),
Namespace: resume.namespace,
}
logger.Waitingf("waiting for %s reconciliation", resume.kind)
if err := wait.PollImmediate(rootArgs.pollInterval, rootArgs.timeout,
isReady(ctx, resume.client, namespacedName, res)); err != nil {
return reconcileResponse{
resumable: res,
err: err,
}
}
return reconcileResponse{
resumable: res,
err: nil,
}
}
// Sorts the given reconcileResponses by resumable name and prints the success/error message for each response.
func (resume resumeCommand) printMessage(responses []reconcileResponse) {
sort.Slice(responses, func(i, j int) bool {
r1, r2 := responses[i], responses[j]
if r1.resumable == nil || r2.resumable == nil {
return false
}
return r1.asClientObject().GetName() <= r2.asClientObject().GetName()
})
// Print success/error message.
for _, r := range responses {
if r.resumable == nil {
continue
}
if r.err != nil {
logger.Failuref(r.err.Error())
}
logger.Successf("%s %s reconciliation completed", resume.kind, r.asClientObject().GetName())
logger.Successf(r.successMessage())
}
}

View File

@@ -28,11 +28,13 @@ var resumeAlertCmd = &cobra.Command{
Long: `The resume command marks a previously suspended Alert resource for reconciliation and waits for it to Long: `The resume command marks a previously suspended Alert resource for reconciliation and waits for it to
finish the apply.`, finish the apply.`,
Example: ` # Resume reconciliation for an existing Alert Example: ` # Resume reconciliation for an existing Alert
flux resume alert main`, flux resume alert main
# Resume reconciliation for multiple Alerts
flux resume alert main-1 main-2`,
ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.AlertKind)), ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.AlertKind)),
RunE: resumeCommand{ RunE: resumeCommand{
apiType: alertType, apiType: alertType,
object: alertAdapter{&notificationv1.Alert{}},
list: &alertListAdapter{&notificationv1.AlertList{}}, list: &alertListAdapter{&notificationv1.AlertList{}},
}.run, }.run,
} }

View File

@@ -31,11 +31,13 @@ var resumeHrCmd = &cobra.Command{
Long: `The resume command marks a previously suspended HelmRelease resource for reconciliation and waits for it to Long: `The resume command marks a previously suspended HelmRelease resource for reconciliation and waits for it to
finish the apply.`, finish the apply.`,
Example: ` # Resume reconciliation for an existing Helm release Example: ` # Resume reconciliation for an existing Helm release
flux resume hr podinfo`, flux resume hr podinfo
# Resume reconciliation for multiple Helm releases
flux resume hr podinfo-1 podinfo-2`,
ValidArgsFunction: resourceNamesCompletionFunc(helmv2.GroupVersion.WithKind(helmv2.HelmReleaseKind)), ValidArgsFunction: resourceNamesCompletionFunc(helmv2.GroupVersion.WithKind(helmv2.HelmReleaseKind)),
RunE: resumeCommand{ RunE: resumeCommand{
apiType: helmReleaseType, apiType: helmReleaseType,
object: helmReleaseAdapter{&helmv2.HelmRelease{}},
list: helmReleaseListAdapter{&helmv2.HelmReleaseList{}}, list: helmReleaseListAdapter{&helmv2.HelmReleaseList{}},
}.run, }.run,
} }

View File

@@ -27,11 +27,13 @@ var resumeImageRepositoryCmd = &cobra.Command{
Short: "Resume a suspended ImageRepository", Short: "Resume a suspended ImageRepository",
Long: `The resume command marks a previously suspended ImageRepository resource for reconciliation and waits for it to finish.`, Long: `The resume command marks a previously suspended ImageRepository resource for reconciliation and waits for it to finish.`,
Example: ` # Resume reconciliation for an existing ImageRepository Example: ` # Resume reconciliation for an existing ImageRepository
flux resume image repository alpine`, flux resume image repository alpine
# Resume reconciliation for multiple ImageRepositories
flux resume image repository alpine-1 alpine-2`,
ValidArgsFunction: resourceNamesCompletionFunc(imagev1.GroupVersion.WithKind(imagev1.ImageRepositoryKind)), ValidArgsFunction: resourceNamesCompletionFunc(imagev1.GroupVersion.WithKind(imagev1.ImageRepositoryKind)),
RunE: resumeCommand{ RunE: resumeCommand{
apiType: imageRepositoryType, apiType: imageRepositoryType,
object: imageRepositoryAdapter{&imagev1.ImageRepository{}},
list: imageRepositoryListAdapter{&imagev1.ImageRepositoryList{}}, list: imageRepositoryListAdapter{&imagev1.ImageRepositoryList{}},
}.run, }.run,
} }

View File

@@ -27,11 +27,13 @@ var resumeImageUpdateCmd = &cobra.Command{
Short: "Resume a suspended ImageUpdateAutomation", Short: "Resume a suspended ImageUpdateAutomation",
Long: `The resume command marks a previously suspended ImageUpdateAutomation resource for reconciliation and waits for it to finish.`, Long: `The resume command marks a previously suspended ImageUpdateAutomation resource for reconciliation and waits for it to finish.`,
Example: ` # Resume reconciliation for an existing ImageUpdateAutomation Example: ` # Resume reconciliation for an existing ImageUpdateAutomation
flux resume image update latest-images`, flux resume image update latest-images
# Resume reconciliation for multiple ImageUpdateAutomations
flux resume image update latest-images-1 latest-images-2`,
ValidArgsFunction: resourceNamesCompletionFunc(autov1.GroupVersion.WithKind(autov1.ImageUpdateAutomationKind)), ValidArgsFunction: resourceNamesCompletionFunc(autov1.GroupVersion.WithKind(autov1.ImageUpdateAutomationKind)),
RunE: resumeCommand{ RunE: resumeCommand{
apiType: imageUpdateAutomationType, apiType: imageUpdateAutomationType,
object: imageUpdateAutomationAdapter{&autov1.ImageUpdateAutomation{}},
list: imageUpdateAutomationListAdapter{&autov1.ImageUpdateAutomationList{}}, list: imageUpdateAutomationListAdapter{&autov1.ImageUpdateAutomationList{}},
}.run, }.run,
} }

View File

@@ -31,11 +31,13 @@ var resumeKsCmd = &cobra.Command{
Long: `The resume command marks a previously suspended Kustomization resource for reconciliation and waits for it to Long: `The resume command marks a previously suspended Kustomization resource for reconciliation and waits for it to
finish the apply.`, finish the apply.`,
Example: ` # Resume reconciliation for an existing Kustomization Example: ` # Resume reconciliation for an existing Kustomization
flux resume ks podinfo`, flux resume ks podinfo
# Resume reconciliation for multiple Kustomizations
flux resume ks podinfo-1 podinfo-2`,
ValidArgsFunction: resourceNamesCompletionFunc(kustomizev1.GroupVersion.WithKind(kustomizev1.KustomizationKind)), ValidArgsFunction: resourceNamesCompletionFunc(kustomizev1.GroupVersion.WithKind(kustomizev1.KustomizationKind)),
RunE: resumeCommand{ RunE: resumeCommand{
apiType: kustomizationType, apiType: kustomizationType,
object: kustomizationAdapter{&kustomizev1.Kustomization{}},
list: kustomizationListAdapter{&kustomizev1.KustomizationList{}}, list: kustomizationListAdapter{&kustomizev1.KustomizationList{}},
}.run, }.run,
} }

View File

@@ -28,11 +28,13 @@ var resumeReceiverCmd = &cobra.Command{
Long: `The resume command marks a previously suspended Receiver resource for reconciliation and waits for it to Long: `The resume command marks a previously suspended Receiver resource for reconciliation and waits for it to
finish the apply.`, finish the apply.`,
Example: ` # Resume reconciliation for an existing Receiver Example: ` # Resume reconciliation for an existing Receiver
flux resume receiver main`, flux resume receiver main
# Resume reconciliation for multiple Receivers
flux resume receiver main-1 main-2`,
ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.ReceiverKind)), ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.ReceiverKind)),
RunE: resumeCommand{ RunE: resumeCommand{
apiType: receiverType, apiType: receiverType,
object: receiverAdapter{&notificationv1.Receiver{}},
list: receiverListAdapter{&notificationv1.ReceiverList{}}, list: receiverListAdapter{&notificationv1.ReceiverList{}},
}.run, }.run,
} }

View File

@@ -27,11 +27,13 @@ var resumeSourceBucketCmd = &cobra.Command{
Short: "Resume a suspended Bucket", Short: "Resume a suspended Bucket",
Long: `The resume command marks a previously suspended Bucket resource for reconciliation and waits for it to finish.`, Long: `The resume command marks a previously suspended Bucket resource for reconciliation and waits for it to finish.`,
Example: ` # Resume reconciliation for an existing Bucket Example: ` # Resume reconciliation for an existing Bucket
flux resume source bucket podinfo`, flux resume source bucket podinfo
# Resume reconciliation for multiple Buckets
flux resume source bucket podinfo-1 podinfo-2`,
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.BucketKind)), ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.BucketKind)),
RunE: resumeCommand{ RunE: resumeCommand{
apiType: bucketType, apiType: bucketType,
object: bucketAdapter{&sourcev1.Bucket{}},
list: bucketListAdapter{&sourcev1.BucketList{}}, list: bucketListAdapter{&sourcev1.BucketList{}},
}.run, }.run,
} }

View File

@@ -29,11 +29,13 @@ var resumeSourceHelmChartCmd = &cobra.Command{
Short: "Resume a suspended HelmChart", Short: "Resume a suspended HelmChart",
Long: `The resume command marks a previously suspended HelmChart resource for reconciliation and waits for it to finish.`, Long: `The resume command marks a previously suspended HelmChart resource for reconciliation and waits for it to finish.`,
Example: ` # Resume reconciliation for an existing HelmChart Example: ` # Resume reconciliation for an existing HelmChart
flux resume source chart podinfo`, flux resume source chart podinfo
# Resume reconciliation for multiple HelmCharts
flux resume source chart podinfo-1 podinfo-2`,
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmChartKind)), ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmChartKind)),
RunE: resumeCommand{ RunE: resumeCommand{
apiType: helmChartType, apiType: helmChartType,
object: &helmChartAdapter{&sourcev1.HelmChart{}},
list: &helmChartListAdapter{&sourcev1.HelmChartList{}}, list: &helmChartListAdapter{&sourcev1.HelmChartList{}},
}.run, }.run,
} }

View File

@@ -27,11 +27,13 @@ var resumeSourceGitCmd = &cobra.Command{
Short: "Resume a suspended GitRepository", Short: "Resume a suspended GitRepository",
Long: `The resume command marks a previously suspended GitRepository resource for reconciliation and waits for it to finish.`, Long: `The resume command marks a previously suspended GitRepository resource for reconciliation and waits for it to finish.`,
Example: ` # Resume reconciliation for an existing GitRepository Example: ` # Resume reconciliation for an existing GitRepository
flux resume source git podinfo`, flux resume source git podinfo
# Resume reconciliation for multiple GitRepositories
flux resume source git podinfo-1 podinfo-2`,
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.GitRepositoryKind)), ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.GitRepositoryKind)),
RunE: resumeCommand{ RunE: resumeCommand{
apiType: gitRepositoryType, apiType: gitRepositoryType,
object: gitRepositoryAdapter{&sourcev1.GitRepository{}},
list: gitRepositoryListAdapter{&sourcev1.GitRepositoryList{}}, list: gitRepositoryListAdapter{&sourcev1.GitRepositoryList{}},
}.run, }.run,
} }

View File

@@ -27,11 +27,13 @@ var resumeSourceHelmCmd = &cobra.Command{
Short: "Resume a suspended HelmRepository", Short: "Resume a suspended HelmRepository",
Long: `The resume command marks a previously suspended HelmRepository resource for reconciliation and waits for it to finish.`, Long: `The resume command marks a previously suspended HelmRepository resource for reconciliation and waits for it to finish.`,
Example: ` # Resume reconciliation for an existing HelmRepository Example: ` # Resume reconciliation for an existing HelmRepository
flux resume source helm bitnami`, flux resume source helm bitnami
# Resume reconciliation for multiple HelmRepositories
flux resume source helm bitnami-1 bitnami-2`,
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmRepositoryKind)), ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmRepositoryKind)),
RunE: resumeCommand{ RunE: resumeCommand{
apiType: helmRepositoryType, apiType: helmRepositoryType,
object: helmRepositoryAdapter{&sourcev1.HelmRepository{}},
list: helmRepositoryListAdapter{&sourcev1.HelmRepositoryList{}}, list: helmRepositoryListAdapter{&sourcev1.HelmRepositoryList{}},
}.run, }.run,
} }

View File

@@ -27,11 +27,13 @@ var resumeSourceOCIRepositoryCmd = &cobra.Command{
Short: "Resume a suspended OCIRepository", Short: "Resume a suspended OCIRepository",
Long: `The resume command marks a previously suspended OCIRepository resource for reconciliation and waits for it to finish.`, Long: `The resume command marks a previously suspended OCIRepository resource for reconciliation and waits for it to finish.`,
Example: ` # Resume reconciliation for an existing OCIRepository Example: ` # Resume reconciliation for an existing OCIRepository
flux resume source oci podinfo`, flux resume source oci podinfo
# Resume reconciliation for multiple OCIRepositories
flux resume source oci podinfo-1 podinfo-2`,
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.OCIRepositoryKind)), ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.OCIRepositoryKind)),
RunE: resumeCommand{ RunE: resumeCommand{
apiType: ociRepositoryType, apiType: ociRepositoryType,
object: ociRepositoryAdapter{&sourcev1.OCIRepository{}},
list: ociRepositoryListAdapter{&sourcev1.OCIRepositoryList{}}, list: ociRepositoryListAdapter{&sourcev1.OCIRepositoryList{}},
}.run, }.run,
} }

View File

@@ -18,6 +18,7 @@ package main
import ( import (
"context" "context"
"errors"
"fmt" "fmt"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@@ -75,22 +76,53 @@ func (suspend suspendCommand) run(cmd *cobra.Command, args []string) error {
return err return err
} }
var listOpts []client.ListOption if len(args) < 1 && suspendArgs.all {
listOpts = append(listOpts, client.InNamespace(*kubeconfigArgs.Namespace)) listOpts := []client.ListOption{
if len(args) > 0 { client.InNamespace(*kubeconfigArgs.Namespace),
listOpts = append(listOpts, client.MatchingFields{ }
"metadata.name": args[0],
}) if err := suspend.patch(ctx, kubeClient, listOpts); err != nil {
return err
}
return nil
} }
err = kubeClient.List(ctx, suspend.list.asClientList(), listOpts...) processed := make(map[string]struct{}, len(args))
if err != nil { for _, arg := range args {
if _, has := processed[arg]; has {
continue // skip object that user might have provided more than once
}
processed[arg] = struct{}{}
listOpts := []client.ListOption{
client.InNamespace(*kubeconfigArgs.Namespace),
client.MatchingFields{
"metadata.name": arg,
},
}
if err := suspend.patch(ctx, kubeClient, listOpts); err != nil {
if err == ErrNoObjectsFound {
logger.Failuref("%s %s not found in %s namespace", suspend.kind, arg, *kubeconfigArgs.Namespace)
} else {
logger.Failuref("failed suspending %s %s in %s namespace: %s", suspend.kind, arg, *kubeconfigArgs.Namespace, err.Error())
}
}
}
return nil
}
var ErrNoObjectsFound = errors.New("no objects found")
func (suspend suspendCommand) patch(ctx context.Context, kubeClient client.WithWatch, listOpts []client.ListOption) error {
if err := kubeClient.List(ctx, suspend.list.asClientList(), listOpts...); err != nil {
return err return err
} }
if suspend.list.len() == 0 { if suspend.list.len() == 0 {
logger.Failuref("no %s objects found in %s namespace", suspend.kind, *kubeconfigArgs.Namespace) return ErrNoObjectsFound
return nil
} }
for i := 0; i < suspend.list.len(); i++ { for i := 0; i < suspend.list.len(); i++ {
@@ -102,8 +134,8 @@ func (suspend suspendCommand) run(cmd *cobra.Command, args []string) error {
if err := kubeClient.Patch(ctx, obj.asClientObject(), patch); err != nil { if err := kubeClient.Patch(ctx, obj.asClientObject(), patch); err != nil {
return err return err
} }
logger.Successf("%s suspended", suspend.humanKind)
logger.Successf("%s suspended", suspend.humanKind)
} }
return nil return nil

View File

@@ -27,7 +27,10 @@ var suspendAlertCmd = &cobra.Command{
Short: "Suspend reconciliation of Alert", Short: "Suspend reconciliation of Alert",
Long: `The suspend command disables the reconciliation of a Alert resource.`, Long: `The suspend command disables the reconciliation of a Alert resource.`,
Example: ` # Suspend reconciliation for an existing Alert Example: ` # Suspend reconciliation for an existing Alert
flux suspend alert main`, flux suspend alert main
# Suspend reconciliation for multiple Alerts
flux suspend alert main-1 main-2`,
ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.AlertKind)), ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.AlertKind)),
RunE: suspendCommand{ RunE: suspendCommand{
apiType: alertType, apiType: alertType,

View File

@@ -28,7 +28,10 @@ var suspendHrCmd = &cobra.Command{
Short: "Suspend reconciliation of HelmRelease", Short: "Suspend reconciliation of HelmRelease",
Long: `The suspend command disables the reconciliation of a HelmRelease resource.`, Long: `The suspend command disables the reconciliation of a HelmRelease resource.`,
Example: ` # Suspend reconciliation for an existing Helm release Example: ` # Suspend reconciliation for an existing Helm release
flux suspend hr podinfo`, flux suspend hr podinfo
# Suspend reconciliation for multiple Helm releases
flux suspend hr podinfo-1 podinfo-2 `,
ValidArgsFunction: resourceNamesCompletionFunc(helmv2.GroupVersion.WithKind(helmv2.HelmReleaseKind)), ValidArgsFunction: resourceNamesCompletionFunc(helmv2.GroupVersion.WithKind(helmv2.HelmReleaseKind)),
RunE: suspendCommand{ RunE: suspendCommand{
apiType: helmReleaseType, apiType: helmReleaseType,

View File

@@ -27,7 +27,10 @@ var suspendImageRepositoryCmd = &cobra.Command{
Short: "Suspend reconciliation of an ImageRepository", Short: "Suspend reconciliation of an ImageRepository",
Long: `The suspend image repository command disables the reconciliation of a ImageRepository resource.`, Long: `The suspend image repository command disables the reconciliation of a ImageRepository resource.`,
Example: ` # Suspend reconciliation for an existing ImageRepository Example: ` # Suspend reconciliation for an existing ImageRepository
flux suspend image repository alpine`, flux suspend image repository alpine
# Suspend reconciliation for multiple ImageRepositories
flux suspend image repository alpine-1 alpine-2`,
ValidArgsFunction: resourceNamesCompletionFunc(imagev1.GroupVersion.WithKind(imagev1.ImageRepositoryKind)), ValidArgsFunction: resourceNamesCompletionFunc(imagev1.GroupVersion.WithKind(imagev1.ImageRepositoryKind)),
RunE: suspendCommand{ RunE: suspendCommand{
apiType: imageRepositoryType, apiType: imageRepositoryType,

View File

@@ -27,7 +27,10 @@ var suspendImageUpdateCmd = &cobra.Command{
Short: "Suspend reconciliation of an ImageUpdateAutomation", Short: "Suspend reconciliation of an ImageUpdateAutomation",
Long: `The suspend image update command disables the reconciliation of a ImageUpdateAutomation resource.`, Long: `The suspend image update command disables the reconciliation of a ImageUpdateAutomation resource.`,
Example: ` # Suspend reconciliation for an existing ImageUpdateAutomation Example: ` # Suspend reconciliation for an existing ImageUpdateAutomation
flux suspend image update latest-images`, flux suspend image update latest-images
# Suspend reconciliation for multiple ImageUpdateAutomations
flux suspend image update latest-images-1 latest-images-2`,
ValidArgsFunction: resourceNamesCompletionFunc(autov1.GroupVersion.WithKind(autov1.ImageUpdateAutomationKind)), ValidArgsFunction: resourceNamesCompletionFunc(autov1.GroupVersion.WithKind(autov1.ImageUpdateAutomationKind)),
RunE: suspendCommand{ RunE: suspendCommand{
apiType: imageUpdateAutomationType, apiType: imageUpdateAutomationType,

View File

@@ -28,7 +28,10 @@ var suspendKsCmd = &cobra.Command{
Short: "Suspend reconciliation of Kustomization", Short: "Suspend reconciliation of Kustomization",
Long: `The suspend command disables the reconciliation of a Kustomization resource.`, Long: `The suspend command disables the reconciliation of a Kustomization resource.`,
Example: ` # Suspend reconciliation for an existing Kustomization Example: ` # Suspend reconciliation for an existing Kustomization
flux suspend ks podinfo`, flux suspend ks podinfo
# Suspend reconciliation for multiple Kustomizations
flux suspend ks podinfo-1 podinfo-2`,
ValidArgsFunction: resourceNamesCompletionFunc(kustomizev1.GroupVersion.WithKind(kustomizev1.KustomizationKind)), ValidArgsFunction: resourceNamesCompletionFunc(kustomizev1.GroupVersion.WithKind(kustomizev1.KustomizationKind)),
RunE: suspendCommand{ RunE: suspendCommand{
apiType: kustomizationType, apiType: kustomizationType,

View File

@@ -27,7 +27,10 @@ var suspendReceiverCmd = &cobra.Command{
Short: "Suspend reconciliation of Receiver", Short: "Suspend reconciliation of Receiver",
Long: `The suspend command disables the reconciliation of a Receiver resource.`, Long: `The suspend command disables the reconciliation of a Receiver resource.`,
Example: ` # Suspend reconciliation for an existing Receiver Example: ` # Suspend reconciliation for an existing Receiver
flux suspend receiver main`, flux suspend receiver main
# Suspend reconciliation for multiple Receivers
flux suspend receiver main-1 main-2`,
ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.ReceiverKind)), ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.ReceiverKind)),
RunE: suspendCommand{ RunE: suspendCommand{
apiType: receiverType, apiType: receiverType,

View File

@@ -27,7 +27,10 @@ var suspendSourceBucketCmd = &cobra.Command{
Short: "Suspend reconciliation of a Bucket", Short: "Suspend reconciliation of a Bucket",
Long: `The suspend command disables the reconciliation of a Bucket resource.`, Long: `The suspend command disables the reconciliation of a Bucket resource.`,
Example: ` # Suspend reconciliation for an existing Bucket Example: ` # Suspend reconciliation for an existing Bucket
flux suspend source bucket podinfo`, flux suspend source bucket podinfo
# Suspend reconciliation for multiple Buckets
flux suspend source bucket podinfo-1 podinfo-2`,
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.BucketKind)), ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.BucketKind)),
RunE: suspendCommand{ RunE: suspendCommand{
apiType: bucketType, apiType: bucketType,

View File

@@ -27,7 +27,10 @@ var suspendSourceHelmChartCmd = &cobra.Command{
Short: "Suspend reconciliation of a HelmChart", Short: "Suspend reconciliation of a HelmChart",
Long: `The suspend command disables the reconciliation of a HelmChart resource.`, Long: `The suspend command disables the reconciliation of a HelmChart resource.`,
Example: ` # Suspend reconciliation for an existing HelmChart Example: ` # Suspend reconciliation for an existing HelmChart
flux suspend source chart podinfo`, flux suspend source chart podinfo
# Suspend reconciliation for multiple HelmCharts
flux suspend source chart podinfo-1 podinfo-2`,
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmChartKind)), ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmChartKind)),
RunE: suspendCommand{ RunE: suspendCommand{
apiType: helmChartType, apiType: helmChartType,

View File

@@ -27,7 +27,10 @@ var suspendSourceGitCmd = &cobra.Command{
Short: "Suspend reconciliation of a GitRepository", Short: "Suspend reconciliation of a GitRepository",
Long: `The suspend command disables the reconciliation of a GitRepository resource.`, Long: `The suspend command disables the reconciliation of a GitRepository resource.`,
Example: ` # Suspend reconciliation for an existing GitRepository Example: ` # Suspend reconciliation for an existing GitRepository
flux suspend source git podinfo`, flux suspend source git podinfo
# Suspend reconciliation for multiple GitRepositories
flux suspend source git podinfo-1 podinfo-2`,
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.GitRepositoryKind)), ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.GitRepositoryKind)),
RunE: suspendCommand{ RunE: suspendCommand{
apiType: gitRepositoryType, apiType: gitRepositoryType,

View File

@@ -27,7 +27,10 @@ var suspendSourceHelmCmd = &cobra.Command{
Short: "Suspend reconciliation of a HelmRepository", Short: "Suspend reconciliation of a HelmRepository",
Long: `The suspend command disables the reconciliation of a HelmRepository resource.`, Long: `The suspend command disables the reconciliation of a HelmRepository resource.`,
Example: ` # Suspend reconciliation for an existing HelmRepository Example: ` # Suspend reconciliation for an existing HelmRepository
flux suspend source helm bitnami`, flux suspend source helm bitnami
# Suspend reconciliation for multiple HelmRepositories
flux suspend source helm bitnami-1 bitnami-2 `,
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmRepositoryKind)), ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmRepositoryKind)),
RunE: suspendCommand{ RunE: suspendCommand{
apiType: helmRepositoryType, apiType: helmRepositoryType,

View File

@@ -27,7 +27,10 @@ var suspendSourceOCIRepositoryCmd = &cobra.Command{
Short: "Suspend reconciliation of an OCIRepository", Short: "Suspend reconciliation of an OCIRepository",
Long: `The suspend command disables the reconciliation of an OCIRepository resource.`, Long: `The suspend command disables the reconciliation of an OCIRepository resource.`,
Example: ` # Suspend reconciliation for an existing OCIRepository Example: ` # Suspend reconciliation for an existing OCIRepository
flux suspend source oci podinfo`, flux suspend source oci podinfo
# Suspend reconciliation for multiple OCIRepositories
flux suspend source oci podinfo-1 podinfo-2`,
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.OCIRepositoryKind)), ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.OCIRepositoryKind)),
RunE: suspendCommand{ RunE: suspendCommand{
apiType: ociRepositoryType, apiType: ociRepositoryType,

View File

@@ -78,7 +78,7 @@ func tagArtifactCmdRun(cmd *cobra.Command, args []string) error {
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout) ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
defer cancel() defer cancel()
ociClient := oci.NewLocalClient() ociClient := oci.NewClient(oci.DefaultOptions())
if tagArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && tagArtifactArgs.creds != "" { if tagArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && tagArtifactArgs.creds != "" {
logger.Actionf("logging in to registry with credentials") logger.Actionf("logging in to registry with credentials")

View File

@@ -1,3 +1,3 @@
► checking prerequisites ► checking prerequisites
✔ Kubernetes {{ .serverVersion }} >=1.20.6-0 ✔ Kubernetes {{ .serverVersion }} >=1.25.0-0
✔ prerequisites checks passed ✔ prerequisites checks passed

View File

@@ -0,0 +1,11 @@
---
apiVersion: v1
kind: Secret
metadata:
name: ca-crt
namespace: my-namespace
stringData:
ca.crt: ca-data
password: my-password
username: my-username

View File

@@ -0,0 +1,107 @@
Flag --cert-file has been deprecated, please use --tls-crt-file instead
Flag --key-file has been deprecated, please use --tls-key-file instead
Flag --ca-file has been deprecated, please use --ca-crt-file instead
---
apiVersion: v1
kind: Secret
metadata:
name: certs
namespace: my-namespace
stringData:
caFile: |
-----BEGIN CERTIFICATE-----
MIIBhzCCAS2gAwIBAgIUdsAtiX3gN0uk7ddxASWYE/tdv0wwCgYIKoZIzj0EAwIw
GTEXMBUGA1UEAxMOZXhhbXBsZS5jb20gQ0EwHhcNMjAwNDE3MDgxODAwWhcNMjUw
NDE2MDgxODAwWjAZMRcwFQYDVQQDEw5leGFtcGxlLmNvbSBDQTBZMBMGByqGSM49
AgEGCCqGSM49AwEHA0IABK7h/5D8bV93MmEdhu02JsS6ugB8s6PzRl3PV4xs3Sbr
RNkkM59+x3b0iWx/i76qPYpNLoiVUVXQmA9Y+4DbMxijUzBRMA4GA1UdDwEB/wQE
AwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBQGyUiU1QEZiMAqjsnIYTwZ
4yp5wzAPBgNVHREECDAGhwR/AAABMAoGCCqGSM49BAMCA0gAMEUCIQDzdtvKdE8O
1+WRTZ9MuSiFYcrEz7Zne7VXouDEKqKEigIgM4WlbDeuNCKbqhqj+xZV0pa3rweb
OD8EjjCMY69RMO0=
-----END CERTIFICATE-----
certFile: |
-----BEGIN CERTIFICATE-----
MIIFazCCA1OgAwIBAgIUT84jeO/ncOrqI+FY05Fzbg8Ed7MwDQYJKoZIhvcNAQEL
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMTA4MDgxNDQyMzVaFw0yMjA4
MDgxNDQyMzVaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw
HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggIiMA0GCSqGSIb3DQEB
AQUAA4ICDwAwggIKAoICAQDn/rPsZ74oypiwCzLlx57zplTiCi/WLSF+MmLGuTvM
EQnV+OND2zFgvDIV/vFs3brkd6rLVI4NcdgSj4YKULCMwwOl45hQPdCTEPJvUhCm
M+FuQ0czmEEJSjZtdLFz1B7QB/JemNnbfigxM9mlg58AlBhVJqn8q64wd/kC/W/K
JTLJuBiVf12ZiPoPfO4WSxAqD3opZ8gdbmK0KYQAhKjEto6ZrYGisfwU1gt3l8M7
sCJSpEkOkpuQgJ8D+xzJS36VXBJQMMP9nAPps+x/rGFplsPMsXEFFiwvR1+FJZwz
lg2sJ91bLGZQ7vn74MfsGrxpiJwllRThJyT7C9V0sjb5trT2lEqZlP2dRSJYt7aJ
1crEcdGSl6RIKgxSV6Hk8dh/ZaTjrTwaKxVkPo2IeEXy5xrR7DyonOQ6Yes0KOCm
JB5yHkFlIVEnLm/HZXEtm3bPHsFgTZuInyBCOMXpUESuVZIw8YK+Vd6AExGPPwZ4
n5I/sCDxWII9owIj3LeLzdUG6JoroahhGmo8rgpbJpPnS+VgryQ/raUQjqDzDCuE
9vKXKBlSUqK6H9A+NMc0mme7M8/GX7T7ewFGUB/xsdrcO4yXjqHnAe0yLf8epDjC
hh76bYqwwinVrmfcNcRxFVJZW2z0gGdgkOkOLaVVb9ggPV2SNAHbN4A+St/iRYR5
awIDAQABo1MwUTAdBgNVHQ4EFgQUzMaCqVM30EZFfTeNUIJ5fNPAhaQwHwYDVR0j
BBgwFoAUzMaCqVM30EZFfTeNUIJ5fNPAhaQwDwYDVR0TAQH/BAUwAwEB/zANBgkq
hkiG9w0BAQsFAAOCAgEAVmk1rXtVkYR1Vs2Va/xrUaGXlFznhPU/Fft44kiEkkLp
mLVelWyAqvXYioqssZwuZnTjGz0DQPqzJjqwuGy4CHwPLmhCtfHplrbWo8a0ivYC
cL20KfZsG941siUh7LGBjTsq6mWBf2ytlFmg/fg93SgmqcEUAUcdps0JpZD8lgWB
ZMstfr6E3jaEus3OsvDD6hJNYZ5clJ5+ynLoWZ99A9JC0U46hmIZpRjbdSvasKpD
XrXTdpzyL/Do3znXE/yfoHv4//Rj2CpPHJLYRCIzvuf1mo1fWd53FjHvrbUvaHFz
CGuZROd4dC4Rx5nZw2ogIYvJ8m6HpIDkL3pBNSQJtIsvAYEQcotJoa5D/e9fu2Wr
+og37oCY4OXzViEBQvyxKD4cajNco1fgGKEaFROADwr3JceGI7Anq5W+xdUvAGNM
QuGeCueqNyrJ0CbQ1zEhwgpk/VYfB0u9m0bjMellRlKMdojby+FDCJtAJesx9no4
SQXyx+aNHhj3qReysjGNwZvBk1IHL04HAT+ogNiYhTl1J/YON4MB5UN6Y2PxP6uG
KvJGPigx4fAwfR/d78o5ngwoH9m+8FUg8+qllJ8XgIbl/VXKTk3G4ceOm4eBmrel
DwWuBhELSjtXWPWhMlkiebgejDbAear53Lia2Cc43zx/KuhMHBTlKY/vY4F2YiI=
-----END CERTIFICATE-----
keyFile: |
-----BEGIN PRIVATE KEY-----
MIIJRAIBADANBgkqhkiG9w0BAQEFAASCCS4wggkqAgEAAoICAQDn/rPsZ74oypiw
CzLlx57zplTiCi/WLSF+MmLGuTvMEQnV+OND2zFgvDIV/vFs3brkd6rLVI4NcdgS
j4YKULCMwwOl45hQPdCTEPJvUhCmM+FuQ0czmEEJSjZtdLFz1B7QB/JemNnbfigx
M9mlg58AlBhVJqn8q64wd/kC/W/KJTLJuBiVf12ZiPoPfO4WSxAqD3opZ8gdbmK0
KYQAhKjEto6ZrYGisfwU1gt3l8M7sCJSpEkOkpuQgJ8D+xzJS36VXBJQMMP9nAPp
s+x/rGFplsPMsXEFFiwvR1+FJZwzlg2sJ91bLGZQ7vn74MfsGrxpiJwllRThJyT7
C9V0sjb5trT2lEqZlP2dRSJYt7aJ1crEcdGSl6RIKgxSV6Hk8dh/ZaTjrTwaKxVk
Po2IeEXy5xrR7DyonOQ6Yes0KOCmJB5yHkFlIVEnLm/HZXEtm3bPHsFgTZuInyBC
OMXpUESuVZIw8YK+Vd6AExGPPwZ4n5I/sCDxWII9owIj3LeLzdUG6JoroahhGmo8
rgpbJpPnS+VgryQ/raUQjqDzDCuE9vKXKBlSUqK6H9A+NMc0mme7M8/GX7T7ewFG
UB/xsdrcO4yXjqHnAe0yLf8epDjChh76bYqwwinVrmfcNcRxFVJZW2z0gGdgkOkO
LaVVb9ggPV2SNAHbN4A+St/iRYR5awIDAQABAoICAQCTxuixQ/wbW8IbEWcgeyHD
LkaPndGO6jyVeF73GvL+MDRFuj558NvpNLfqzvTWVf9AnQGMd5Xs9oGegRHu7Csp
3ucp+moBYv7DT14+jtXQKOgGJpDqSqfS1RUKb/TBRXNDLGy02UScziWoAdE33zmf
UraVNwW8z1crxKA3yVw2Na++UqhGQlVLAbfXucqnJLVtNWKpkVQlezUgcfmFovsm
Iut+9MjI6/sZAqdXTLKuCKo0XjWzNKwnRecE0CYsCwzc80MvFYEiwQi1C0kwoouC
iOi8MKM/jDok+5/a3nQ7X+/ho5sbApNCJpfSXAK9YOJ3ju93+RjNuvORfp4/sW3W
OGXw6X30Ym7WS/7oYuwEILyqdyNOvKU7a+17d/W/YA60NOdA4iJI3aTfYFMD3l14
Da+D/wkTlEN3Ye7GN21A9AsZwWWiT9G5FOxWWVv7nTPG+Ix5ewehQWt/3DxhSizR
inMBizL5xpwx9LRWHnXX277lChYmPFAAMXINl1hnX6s0EY9pSDHN0IddibJkNKBD
m1CN37rqxoXQz4zoAyJGfQVkakqe16ayqI9yuQwO6AUkZcD5DYQdz9QYOTnYrQc6
6haC3D0Fmqg1s4v+6gpxZA/qTri0gVl/v/NN4Mk2/qWtK33imOedgD+5LXhZdBgJ
Mqn53AErG/AT622jvSb5UQKCAQEA/DTGLh0Ct97PCm+c+PxRFyieaHNJLWENKyxp
HoWGHfp2Bvt2Vphoi7GpRCM/yta4vCZgZmeWTQ0yBg6iPVPRA6Ho5hqh9OkUYVoh
prL3JsIU20jTutYjo2aefO4qXnJfkkXxNO2FElUHDTwtWdlGJQKvlUJwTv6xO19v
bQQkhZSpri6gIpi5Nkm2SGEtDofRJ+F6ThbQibEatL6DR00dh39MYQz+tZP5olzn
kX5bHEBWB7gy+YxTGF8FdlCSQTBBtNSKsAv3Cxj4qEHm+fu09vnH6fOZKenT2nXD
5QE/RpgQzLV1TumCjqLzqwp7bbzH+4mjsXpF3KHBZwnhMnDIRwKCAQEA63wYzjBy
no0GBBz0hOWrOwQ/AjUHfi47o3Xvl4RBjZclM171HKH7oMCnQvVKTNq8jvakCZjc
UI6i+H4R6aokiFS2xGbC2H3ZlSMFNwhb2xUs/C4Nr7JSOWZBtDy5QBspUsp26f7m
9VNVRzCmnxWV9be/1TxHDzDhslNlL5TMejbMorWnrtNG41KWwGtwvv2gApr3894j
eJNOh0WGfsMkXUM6+4v4WcCGrdV8Cr6Nvu96ZZe2PWu2dANtAfnxqogXXCoFE6r1
vie7hFSfJ2QR/vEbanED4pYGTtGYP1oseScx0u0hLhGLGccVBUNZlRbox4rIOELI
v9MLuiOL4YX7vQKCAQAGzMl3HtMe8AP3DRFXaT4qeK7ktA8KCS7YtibTatg14LXj
9E25gfx3n7+nlae3qVhrwkEhIbPcuflaTnSzYJonFet4oMkzGEGzakG0A+lEA0Ga
s/j5daKaWj71sVo1F7JZ+EbLnYfT+bTp93BllsUcZFkllhf/GUDgD++qKc1uSJbW
mm044ZNE0nH2u6ACX0kVYS/yAQ14WO0WaHiTqJGeQKFnkHkhni7B4O1hb923AkkP
hjjhn5Xx90Xnbb6zwUBURtLCcmAjzXWO29AFd3Lmoc9xEF9V0PckUb6JYyI4ngr9
6fqSuRsLC3u0ZeD0EX322zwtodVWYIodZBfNS1srAoIBAQCjTUPGeUKDQTjS0WGg
Z8T/AErRtQSlNFqXWMn2QPlUv2RE460HVi2xpOhZPtFvyqDIY7IOFbtzAfdya7rw
V9VN1bGJMdodV+jzy31qVJmerGit2SIUnYz30TnvS80L78oQZ+dfDi4MIuYYoFxs
JgQAipS1wz9kAXoCuGKLRJ0og6gVjfPjARE/w55XgiqFyEyWgfFBZOMkUsM6e7Rx
Y9Jr+puEpeRsGV9MXafPq6WQq3It0a/HmFLG0TlfDX3RzN6mQ12R7hTM8bDQa/6S
yorQSVPB1O3kzDVDo4X5KQd+XPfoVhmUYQYdsjmZlMMi6Og0uMFwgp/Epw6S3uO6
WbfhAoIBAQCOp4iIc87GyxWL8u6HrJaqmFlqkfou0hI+y9h6FfzsBYU6y3+gRYdF
wr2S9EUAb80kEQ1v0pt9417NOGc1pmYjKCZmDZ7qeGCGk2PR0U59+xJetXBWWhbq
5JxcwdRYoHyrmC/LINxzzqYOQbQevbW0zcEskeKfJsOtj9WJt6U9B1YZbE8pu2QV
xjvb+YekD2R+n/umV6eiaGfDau+EWudYVTqY0mR7y9hTiFR/KnqSsy2BUjljpacS
XBQO4ig7vY8+1+L3w2xpTN95/rXAvB4BbO/DLea9ArikePoSJ+bVTj0YwrKBghep
kOvbvVANrpsunlSAcpXm1qkV+G+xPnyJ
-----END PRIVATE KEY-----

View File

@@ -5,7 +5,19 @@ metadata:
name: certs name: certs
namespace: my-namespace namespace: my-namespace
stringData: stringData:
certFile: | ca.crt: |
-----BEGIN CERTIFICATE-----
MIIBhzCCAS2gAwIBAgIUdsAtiX3gN0uk7ddxASWYE/tdv0wwCgYIKoZIzj0EAwIw
GTEXMBUGA1UEAxMOZXhhbXBsZS5jb20gQ0EwHhcNMjAwNDE3MDgxODAwWhcNMjUw
NDE2MDgxODAwWjAZMRcwFQYDVQQDEw5leGFtcGxlLmNvbSBDQTBZMBMGByqGSM49
AgEGCCqGSM49AwEHA0IABK7h/5D8bV93MmEdhu02JsS6ugB8s6PzRl3PV4xs3Sbr
RNkkM59+x3b0iWx/i76qPYpNLoiVUVXQmA9Y+4DbMxijUzBRMA4GA1UdDwEB/wQE
AwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBQGyUiU1QEZiMAqjsnIYTwZ
4yp5wzAPBgNVHREECDAGhwR/AAABMAoGCCqGSM49BAMCA0gAMEUCIQDzdtvKdE8O
1+WRTZ9MuSiFYcrEz7Zne7VXouDEKqKEigIgM4WlbDeuNCKbqhqj+xZV0pa3rweb
OD8EjjCMY69RMO0=
-----END CERTIFICATE-----
tls.crt: |
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIFazCCA1OgAwIBAgIUT84jeO/ncOrqI+FY05Fzbg8Ed7MwDQYJKoZIhvcNAQEL MIIFazCCA1OgAwIBAgIUT84jeO/ncOrqI+FY05Fzbg8Ed7MwDQYJKoZIhvcNAQEL
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
@@ -37,7 +49,7 @@ stringData:
KvJGPigx4fAwfR/d78o5ngwoH9m+8FUg8+qllJ8XgIbl/VXKTk3G4ceOm4eBmrel KvJGPigx4fAwfR/d78o5ngwoH9m+8FUg8+qllJ8XgIbl/VXKTk3G4ceOm4eBmrel
DwWuBhELSjtXWPWhMlkiebgejDbAear53Lia2Cc43zx/KuhMHBTlKY/vY4F2YiI= DwWuBhELSjtXWPWhMlkiebgejDbAear53Lia2Cc43zx/KuhMHBTlKY/vY4F2YiI=
-----END CERTIFICATE----- -----END CERTIFICATE-----
keyFile: | tls.key: |
-----BEGIN PRIVATE KEY----- -----BEGIN PRIVATE KEY-----
MIIJRAIBADANBgkqhkiG9w0BAQEFAASCCS4wggkqAgEAAoICAQDn/rPsZ74oypiw MIIJRAIBADANBgkqhkiG9w0BAQEFAASCCS4wggkqAgEAAoICAQDn/rPsZ74oypiw
CzLlx57zplTiCi/WLSF+MmLGuTvMEQnV+OND2zFgvDIV/vFs3brkd6rLVI4NcdgS CzLlx57zplTiCi/WLSF+MmLGuTvMEQnV+OND2zFgvDIV/vFs3brkd6rLVI4NcdgS
@@ -90,3 +102,4 @@ stringData:
XBQO4ig7vY8+1+L3w2xpTN95/rXAvB4BbO/DLea9ArikePoSJ+bVTj0YwrKBghep XBQO4ig7vY8+1+L3w2xpTN95/rXAvB4BbO/DLea9ArikePoSJ+bVTj0YwrKBghep
kOvbvVANrpsunlSAcpXm1qkV+G+xPnyJ kOvbvVANrpsunlSAcpXm1qkV+G+xPnyJ
-----END PRIVATE KEY----- -----END PRIVATE KEY-----
type: kubernetes.io/tls

View File

@@ -0,0 +1,11 @@
-----BEGIN CERTIFICATE-----
MIIBhzCCAS2gAwIBAgIUdsAtiX3gN0uk7ddxASWYE/tdv0wwCgYIKoZIzj0EAwIw
GTEXMBUGA1UEAxMOZXhhbXBsZS5jb20gQ0EwHhcNMjAwNDE3MDgxODAwWhcNMjUw
NDE2MDgxODAwWjAZMRcwFQYDVQQDEw5leGFtcGxlLmNvbSBDQTBZMBMGByqGSM49
AgEGCCqGSM49AwEHA0IABK7h/5D8bV93MmEdhu02JsS6ugB8s6PzRl3PV4xs3Sbr
RNkkM59+x3b0iWx/i76qPYpNLoiVUVXQmA9Y+4DbMxijUzBRMA4GA1UdDwEB/wQE
AwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBQGyUiU1QEZiMAqjsnIYTwZ
4yp5wzAPBgNVHREECDAGhwR/AAABMAoGCCqGSM49BAMCA0gAMEUCIQDzdtvKdE8O
1+WRTZ9MuSiFYcrEz7Zne7VXouDEKqKEigIgM4WlbDeuNCKbqhqj+xZV0pa3rweb
OD8EjjCMY69RMO0=
-----END CERTIFICATE-----

View File

@@ -0,0 +1,19 @@
apiVersion: v1
kind: Namespace
metadata:
name: podinfo
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: podinfo
spec:
interval: 5m0s
path: ./kustomize
force: true
prune: true
sourceRef:
kind: GitRepository
name: podinfo
targetNamespace: default

View File

@@ -2,6 +2,10 @@
✔ GitRepository annotated ✔ GitRepository annotated
◎ waiting for GitRepository reconciliation ◎ waiting for GitRepository reconciliation
✔ fetched revision 6.3.5@sha1:67e2c98a60dc92283531412a9e604dd4bae005a9 ✔ fetched revision 6.3.5@sha1:67e2c98a60dc92283531412a9e604dd4bae005a9
► annotating HelmChart {{ .ns }}-thrfg in {{ .ns }} namespace
✔ HelmChart annotated
◎ waiting for HelmChart reconciliation
✔ fetched revision 6.3.5
► annotating HelmRelease thrfg in {{ .ns }} namespace ► annotating HelmRelease thrfg in {{ .ns }} namespace
✔ HelmRelease annotated ✔ HelmRelease annotated
◎ waiting for HelmRelease reconciliation ◎ waiting for HelmRelease reconciliation

View File

@@ -1,5 +1,5 @@
► resuming helmrelease thrfg in {{ .ns }} namespace ► resuming helmrelease thrfg in {{ .ns }} namespace
✔ helmrelease resumed ✔ helmrelease resumed
◎ waiting for HelmRelease reconciliation ◎ waiting for HelmRelease reconciliation
✔ HelmRelease reconciliation completed ✔ HelmRelease thrfg reconciliation completed
✔ applied revision 6.3.5 ✔ applied revision 6.3.5

View File

@@ -1,5 +1,5 @@
► resuming kustomization tkfg in {{ .ns }} namespace ► resuming kustomization tkfg in {{ .ns }} namespace
✔ kustomization resumed ✔ kustomization resumed
◎ waiting for Kustomization reconciliation ◎ waiting for Kustomization reconciliation
✔ Kustomization reconciliation completed ✔ Kustomization tkfg reconciliation completed
✔ applied revision 6.3.5@sha1:67e2c98a60dc92283531412a9e604dd4bae005a9 ✔ applied revision 6.3.5@sha1:67e2c98a60dc92283531412a9e604dd4bae005a9

View File

@@ -0,0 +1,2 @@
► resuming kustomization tkfg in {{ .ns }} namespace
✔ kustomization resumed

View File

@@ -0,0 +1,6 @@
► resuming kustomization tkfg in {{ .ns }} namespace
✔ kustomization resumed
✗ no Kustomization objects found in {{ .ns }} namespace
◎ waiting for Kustomization reconciliation
✔ Kustomization tkfg reconciliation completed
✔ applied revision 6.3.5@sha1:67e2c98a60dc92283531412a9e604dd4bae005a9

View File

@@ -0,0 +1,4 @@
► suspending kustomization tkfg in {{ .ns }} namespace
✔ kustomization suspended
✗ Kustomization foo not found in {{ .ns }} namespace
✗ Kustomization bar not found in {{ .ns }} namespace

View File

@@ -1,5 +1,5 @@
► resuming source oci thrfg in {{ .ns }} namespace ► resuming source oci thrfg in {{ .ns }} namespace
✔ source oci resumed ✔ source oci resumed
◎ waiting for OCIRepository reconciliation ◎ waiting for OCIRepository reconciliation
✔ OCIRepository reconciliation completed ✔ OCIRepository thrfg reconciliation completed
✔ fetched revision 6.3.5@sha256:6c959c51ccbb952e5fe4737563338a0aaf975675dcf812912cf09e5463181871 ✔ fetched revision 6.3.5@sha256:6c959c51ccbb952e5fe4737563338a0aaf975675dcf812912cf09e5463181871

View File

@@ -22,6 +22,7 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/google/go-containerregistry/pkg/name"
"github.com/spf13/cobra" "github.com/spf13/cobra"
v1 "k8s.io/api/apps/v1" v1 "k8s.io/api/apps/v1"
"sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client"
@@ -119,12 +120,19 @@ func versionCmdRun(cmd *cobra.Command, args []string) error {
} }
func splitImageStr(image string) (string, string, error) { func splitImageStr(image string) (string, string, error) {
imageArr := strings.Split(image, ":") ref, err := name.ParseReference(image)
if len(imageArr) < 2 { if err != nil {
return "", "", fmt.Errorf("parsing image '%s' failed: %w", image, err)
}
reg := ref.Context().RegistryStr()
repo := strings.TrimPrefix(image, reg)
parts := strings.Split(repo, ":")
if len(parts) < 2 {
return "", "", fmt.Errorf("missing image tag in image %s", image) return "", "", fmt.Errorf("missing image tag in image %s", image)
} }
name, tag := imageArr[0], imageArr[1] n, t := parts[0], strings.TrimPrefix(repo, parts[0]+":")
nameArr := strings.Split(name, "/") nameArr := strings.Split(n, "/")
return nameArr[len(nameArr)-1], tag, nil return nameArr[len(nameArr)-1], t, nil
} }

60
cmd/flux/version_test.go Normal file
View File

@@ -0,0 +1,60 @@
/*
Copyright 2021 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 (
"testing"
. "github.com/onsi/gomega"
)
func TestSplitImageStr(t *testing.T) {
tests := []struct {
url string
expectedName string
expectedTag string
}{
{
url: "fluxcd/notification-controller:v1.0.0",
expectedName: "notification-controller",
expectedTag: "v1.0.0",
},
{
url: "ghcr.io/fluxcd/kustomize-controller:v1.0.0",
expectedName: "kustomize-controller",
expectedTag: "v1.0.0",
},
{
url: "reg.internal:8080/fluxcd/source-controller:v1.0.0",
expectedName: "source-controller",
expectedTag: "v1.0.0",
},
{
url: "fluxcd/source-controller:v1.0.1@sha256:49921d1c7b100650dd654a32df1f6e626b54dfe9707d7bb7bdf43fb7c81f1baf",
expectedName: "source-controller",
expectedTag: "v1.0.1@sha256:49921d1c7b100650dd654a32df1f6e626b54dfe9707d7bb7bdf43fb7c81f1baf",
},
}
for _, tt := range tests {
g := NewWithT(t)
n, t, err := splitImageStr(tt.url)
g.Expect(err).To(Not(HaveOccurred()))
g.Expect(n).To(BeEquivalentTo(tt.expectedName))
g.Expect(t).To(BeEquivalentTo(tt.expectedTag))
}
}

View File

@@ -1,17 +0,0 @@
# Flux v2 Documentation
The documentation for `flux2` has moved to this repository: <https://github.com/fluxcd/website>.
[The Website's README](https://github.com/fluxcd/website/#readme) has information on how to
- modify and extend documentation
- run the site <https://fluxcd.io> locally
- publish changes
and where all the individual pieces of content come from.
It will be easier for us to maintain a coherent web presences (and merge all of Flux documentation) in one central repository. This was partly discussed in <https://github.com/fluxcd/flux2/discussions/367>.
## toolkit.fluxcd.io
For historical reasons we are keeping a `_redirects` file in this directory. It defines how redirects from the old site `toolkit.fluxcd.io` to our new website <https://fluxcd.io> work. Changes to this file need to be merged and a manual build triggered in the Netlify App.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

View File

@@ -1,18 +0,0 @@
# individual rules
/core-concepts https://fluxcd.io/flux/concepts 301!
/contributing https://fluxcd.io/contributing 301!
/install.sh https://fluxcd.io/install.sh 301!
# refer to https://github.com/fluxcd/flux2/discussions/367
/dev-guides/* https://fluxcd.io/flux/gitops-toolkit/:splat 301!
# this is how things looked in the navbar anyway..?
/guides/faq-migration https://fluxcd.io/flux/migration/faq-migration 301!
/guides/flux-v1-automation-migration https://fluxcd.io/flux/migration/flux-v1-automation-migration 301!
/guides/flux-v1-migration https://fluxcd.io/flux/migration/flux-v1-migration 301!
/guides/helm-operator-migration https://fluxcd.io/flux/migration/helm-operator-migration 301!
# catch all
/* https://fluxcd.io/flux/:splat 301!

View File

@@ -1,83 +0,0 @@
# Flux Diagrams
## Cluster sync from Git
```mermaid
sequenceDiagram
actor me
participant git as Git<br><br>repository
participant sc as Flux<br><br>source-controller
participant kc as Flux<br><br>kustomize-controller
participant kube as Kubernetes<br><br>api-server
participant nc as Flux<br><br>notification-controller
me->>git: 1. git push
sc->>git: 2. git pull
sc->>sc: 3. build artifact for revision
sc->>kube: 4. update status for revision
sc-->>nc: 5. emit events
kube->>kc: 6. notify about new revision
kc->>sc: 7. fetch artifact for revision
kc->>kc: 8. build manifests to objects
kc-->>kc: 9. decrypt secrets
kc->>kube: 10. validate objects
kc->>kube: 11. apply objects
kc-->>kube: 12. delete objects
kc-->>kube: 13. wait for readiness
kc->>kube: 14. update status for revision
kc-->>nc: 15. emit events
nc-->>me: 16. send alerts for revision
```
## Helm release upgrade from Git
```mermaid
sequenceDiagram
actor me
participant git as Git<br><br>repository
participant sc as Flux<br><br>source-controller
participant hc as Flux<br><br>helm-controller
participant kube as Kubernetes<br><br>api-server
participant nc as Flux<br><br>notification-controller
me->>git: 1. git push
sc->>git: 2. git pull
sc->>sc: 3. build chart for revision
sc->>kube: 4. update chart status
sc-->>nc: 5. emit events
kube->>hc: 6. notify about new revision
hc->>sc: 7. fetch chart
hc->>kube: 8. get values
hc->>hc: 9. render and customize manifests
hc-->>kube: 10. apply CRDs
hc->>kube: 11. upgrade release
hc-->>kube: 12. run tests
hc-->>kube: 13. wait for readiness
hc->>kube: 14. update status
hc-->>nc: 15. emit events
nc-->>me: 16. send alerts
```
## Image update to Git
```mermaid
sequenceDiagram
actor me
participant oci as Image<br><br>repository
participant irc as Flux<br><br>image-reflector-controller
participant iac as Flux<br><br>image-automation-controller
participant kube as Kubernetes<br><br>api-server
participant nc as Flux<br><br>notification-controller
participant git as Git<br><br>repository
me->>oci: 1. docker push
irc->>oci: 2. list tags
irc->>irc: 3. match tags to policies
irc->>kube: 4. update status
irc-->>nc: 5. emit events
kube->>iac: 6. notify about new tags
iac->>git: 7. git clone
iac->>iac: 8. patch manifests with new tags
iac->>git: 9. git push
iac->>kube: 10. update status
iac-->>nc: 11. emit events
nc-->>me: 12. send alerts
```

View File

@@ -1,139 +0,0 @@
# Flux release procedure
The Flux Go modules and the GitOps Toolkit controllers are released by following the [semver](https://semver.org) conventions.
Repositories subject to semver releases:
1. [fluxcd/pkg](https://github.com/fluxcd/pkg)
- modules: `apis/meta`, `runtime`, various utilities
- dependencies: `k8s.io/*`, `sigs.k8s.io/controller-runtime`
1. [fluxcd/source-controller](https://github.com/fluxcd/source-controller)
- modules: `api`
- dependencies: `github.com/fluxcd/pkg/*`
1. [fluxcd/kustomize-controller](https://github.com/fluxcd/kustomize-controller)
- modules: `api`
- dependencies: `github.com/fluxcd/source-controller/api`, `github.com/fluxcd/pkg/*`
1. [fluxcd/helm-controller](https://github.com/fluxcd/helm-controller)
- modules: `api`
- dependencies: `github.com/fluxcd/source-controller/api`, `github.com/fluxcd/pkg/*`
1. [fluxcd/image-reflector-controller](https://github.com/fluxcd/image-reflector-controller)
- modules: `api`
- dependencies: `github.com/fluxcd/pkg/*`
1. [fluxcd/image-automation-controller](https://github.com/fluxcd/image-automation-controller)
- modules: `api`
- dependencies: `github.com/fluxcd/source-controller/api`, `github.com/fluxcd/image-reflector-controller/api`, `github.com/fluxcd/pkg/*`
1. [fluxcd/notification-controller](https://github.com/fluxcd/notification-controller)
- modules: `api`
- dependencies: `github.com/fluxcd/pkg/*`
1. [fluxcd/flux2](https://github.com/fluxcd/flux2)
- modules: `manifestgen`
- dependencies: `github.com/fluxcd/source-controller/api`, `github.com/fluxcd/kustomize-controller/api`, `github.com/fluxcd/helm-controller/api`, `github.com/fluxcd/image-reflector-controller/api`, `github.com/fluxcd/image-automation-controller/api`, `github.com/fluxcd/notification-controller/api`, `github.com/fluxcd/pkg/*`
1. [fluxcd/terraform-provider-flux](https://github.com/fluxcd/terraform-provider-flux)
- dependencies: `github.com/fluxcd/flux2/pkg/manifestgen`
## Release procedure
### Go packages
The Go packages in [fluxcd/pkg](https://github.com/fluxcd/pkg) are dedicated modules,
each module has its own set of dependencies and release cycle.
Release procedure for a package:
1. Checkout the `main` branch and pull changes from remote.
1. Run `make release-<package name> VER=<next semver>`.
### Controllers
A toolkit controller has a dedicated module for its API, the API module
has its own set of dependencies.
Release procedure for a controller and its API:
1. Checkout the `main` branch and pull changes from remote.
1. Create a `api/<next semver>` tag and push it to remote.
1. Create a new branch from `main` i.e. `release-<next semver>`. This
will function as your release preparation branch.
1. Update the `github.com/fluxcd/<NAME>-controller/api` version in `go.mod`
1. Add an entry to the `CHANGELOG.md` for the new release and change the
`newTag` value in ` config/manager/kustomization.yaml` to that of the
semver release you are going to make. Commit and push your changes.
1. Create a PR for your release branch and get it merged into `main`.
1. Create a `<next semver>` tag for the merge commit in `main` and
push it to remote.
1. Confirm CI builds and releases the newly tagged version.
### Flux
Release procedure for Flux:
1. Checkout the `main` branch and pull changes from remote.
1. Create a `<next semver>` tag form `main` and push it to remote.
1. Confirm CI builds and releases the newly tagged version.
## Upgrade Kubernetes modules
Flux has the following Kubernetes dependencies:
- `k8s.io/api`
- `k8s.io/apiextensions-apiserver`
- `k8s.io/apimachinery`
- `k8s.io/cli-runtime`
- `k8s.io/client-go`
- `sigs.k8s.io/controller-runtime`
**Note** that all `k8s.io/*` packages must have the same version in `go.mod` e.g.:
```
k8s.io/api v0.20.2
k8s.io/apiextensions-apiserver v0.20.2
k8s.io/apimachinery v0.20.2
k8s.io/cli-runtime v0.20.2
k8s.io/client-go v0.20.2
```
The specialised reconcilers depend on:
- kustomize-controller: `sigs.k8s.io/kustomize/api`
- image-automation-controller: `sigs.k8s.io/kustomize/kyaml`
- helm-controller: `helm.sh/helm/v3`
**Note** that the `k8s.io/*` version must be compatible with both `kustomize/api` and `helm/v3`.
If there is a breaking change in `client-go` we have to wait for Kustomize and Helm to upgrade first.
### Upgrade procedure:
`fluxcd/pkg`:
1. Update the `k8s.io/*` version in `pkg/apis/meta/go.mod`
1. Release the `apis/meta` package
1. Update `apis/meta` version in `pkg/runtime/go.mod`
1. Update the `k8s.io/*` version in `pkg/runtime/go.mod`
1. Update `sigs.k8s.io/controller-runtime` version in `pkg/runtime/go.mod`
1. Release the `runtime` package
`fluxcd/source-controller`:
1. Update the `github.com/fluxcd/pkg/apis/meta` version in `source-controller/api/go.mod` and `source-controller/go.mod`
1. Update the `k8s.io/*` version in `source-controller/api/go.mod` and `source-controller/go.mod`
1. Update the `sigs.k8s.io/controller-runtime` version in `source-controller/api/go.mod` and `source-controller/go.mod`
1. Update the `github.com/fluxcd/pkg/runtime` version in `source-controller/go.mod`
1. Release the `api` package
`fluxcd/<kustomize|helm|notification|image-automation>-controller`:
1. Update the `github.com/fluxcd/source-controller/api` version in `<NAME>-controller/api/go.mod` and `<NAME>-controller/go.mod`
1. Update the `github.com/fluxcd/pkg/apis/meta` version in `<NAME>-controller/api/go.mod` and `<NAME>-controller/go.mod`
1. Update the `k8s.io/*` version in `<NAME>-controller/api/go.mod` and `<NAME>-controller/go.mod`
1. Update the `github.com/fluxcd/pkg/runtime` version in `<NAME>-controller/go.mod`
1. Release the `api` package
`fluxcd/flux2`:
1. Update the `github.com/fluxcd/*-controller/api` version in `flux2/go.mod` (automated with [GitHub Actions](../../.github/workflows/update.yaml))
1. Update the `github.com/fluxcd/pkg/*` version in `flux2/go.mod`
1. Update the `k8s.io/*` and `github.com/fluxcd/pkg/runtime` version in `flux2/go.mod`
`fluxcd/terraform-provider-flux`:
1. Update the `github.com/fluxcd/flux2` version in `terraform-provider-flux/go.mod` (automated with [GitHub Actions](https://github.com/fluxcd/terraform-provider-flux/blob/main/.github/workflows/update.yaml))

Some files were not shown because too many files have changed in this diff Show More