Compare commits
202 Commits
v2.0.0-rc.
...
v2.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b3162495c | ||
|
|
61d85ff30e | ||
|
|
2c199c66be | ||
|
|
5875aac92e | ||
|
|
dab51524be | ||
|
|
fb07dfee85 | ||
|
|
7842c7f2d6 | ||
|
|
b385c248b0 | ||
|
|
a0929969ef | ||
|
|
6b3580e16c | ||
|
|
6cd7722539 | ||
|
|
71ea90524b | ||
|
|
9ea0a535ea | ||
|
|
25d2a3cdf1 | ||
|
|
9fa59df798 | ||
|
|
93c0467f91 | ||
|
|
c377fe7651 | ||
|
|
9ed24522bb | ||
|
|
ddcabbf95d | ||
|
|
5c58b45340 | ||
|
|
5690b639cd | ||
|
|
22d0ff8173 | ||
|
|
8e61fe805c | ||
|
|
5356436c94 | ||
|
|
8ca8b92f92 | ||
|
|
7c98f20e11 | ||
|
|
1a8798a5d4 | ||
|
|
926842a216 | ||
|
|
9e11b860ec | ||
|
|
5abf1ee817 | ||
|
|
4e78e80619 | ||
|
|
33be9840f0 | ||
|
|
33fdaee399 | ||
|
|
91660a98d5 | ||
|
|
8d5c4492d8 | ||
|
|
29ad52bb46 | ||
|
|
590b7b7682 | ||
|
|
ea06d9614f | ||
|
|
41ba55634a | ||
|
|
f09616e780 | ||
|
|
a4d7e35cdd | ||
|
|
346e0ea734 | ||
|
|
ce854236cf | ||
|
|
1588663358 | ||
|
|
68fdc0a2b6 | ||
|
|
d335f8f981 | ||
|
|
b4efd15afd | ||
|
|
0e6f9da761 | ||
|
|
02b34f05c8 | ||
|
|
f26800eb85 | ||
|
|
d2cc01169b | ||
|
|
d8924cd8a9 | ||
|
|
25af5d2968 | ||
|
|
3580d4ff85 | ||
|
|
42607aadc3 | ||
|
|
2fe86a4cde | ||
|
|
db0256e0f7 | ||
|
|
224e808c21 | ||
|
|
6ed6b937f8 | ||
|
|
99b940f56f | ||
|
|
66a417a3ee | ||
|
|
761762bdc0 | ||
|
|
bd8ada9e4a | ||
|
|
ba5c7e4fc3 | ||
|
|
903284fe59 | ||
|
|
cf7ee0081c | ||
|
|
e6a1d8156b | ||
|
|
b850f51ef5 | ||
|
|
4e57de4776 | ||
|
|
0a2945e7f1 | ||
|
|
4f9beae49d | ||
|
|
15a49334d8 | ||
|
|
cf5e7c39e0 | ||
|
|
173ee5fcdc | ||
|
|
67968dff7e | ||
|
|
c596c70d42 | ||
|
|
d30c3aef32 | ||
|
|
f7e5101753 | ||
|
|
597b13d1b3 | ||
|
|
2b8385a874 | ||
|
|
ddcc301ab6 | ||
|
|
ab983c678f | ||
|
|
79dfbec910 | ||
|
|
6bf439d4ce | ||
|
|
063c5ee328 | ||
|
|
19137b8e8c | ||
|
|
95aa30ad41 | ||
|
|
55aa96a33a | ||
|
|
5460348450 | ||
|
|
0d1a68ecb4 | ||
|
|
98466220c7 | ||
|
|
6d2dd076dc | ||
|
|
5e07bcb79a | ||
|
|
9c81a74743 | ||
|
|
a3f2b1d829 | ||
|
|
cbdd71e44e | ||
|
|
f01cf5e04c | ||
|
|
bbb3063cb2 | ||
|
|
c0fa6e6939 | ||
|
|
0337362eec | ||
|
|
fb3013cb95 | ||
|
|
833fec3d21 | ||
|
|
007b79c729 | ||
|
|
09f55955e8 | ||
|
|
29c2c72d8f | ||
|
|
ae9b541ce2 | ||
|
|
8d86637d3f | ||
|
|
390ff1bcf7 | ||
|
|
aa65589391 | ||
|
|
9ee23a9086 | ||
|
|
41cdd3dcf7 | ||
|
|
aba5741450 | ||
|
|
cb5eb417c5 | ||
|
|
9f8b8b624b | ||
|
|
8728b07e85 | ||
|
|
e1ffd83b64 | ||
|
|
020a494f3f | ||
|
|
96ed1e1372 | ||
|
|
860682e476 | ||
|
|
2903b4910c | ||
|
|
c07e33eff0 | ||
|
|
a5b1b04915 | ||
|
|
799848c2a0 | ||
|
|
7e6cd34071 | ||
|
|
b8c24f906d | ||
|
|
e678738ded | ||
|
|
9000be6daa | ||
|
|
13ff4afaa4 | ||
|
|
40b9c07641 | ||
|
|
0ce5117715 | ||
|
|
526d154172 | ||
|
|
9e422576b8 | ||
|
|
069bca29d1 | ||
|
|
34ac124b6b | ||
|
|
e475a22435 | ||
|
|
d1ec628d6c | ||
|
|
d13227b277 | ||
|
|
fcb992240e | ||
|
|
cf5eb6a0bc | ||
|
|
2aa38baa35 | ||
|
|
84d046ab2a | ||
|
|
29b08fc306 | ||
|
|
a7153a0ff5 | ||
|
|
bc67308f85 | ||
|
|
6e93a87265 | ||
|
|
6fd1f794f9 | ||
|
|
5942e65b1c | ||
|
|
77d670c224 | ||
|
|
70546e5dfe | ||
|
|
fec7dfefa4 | ||
|
|
9a8944df94 | ||
|
|
ace242fca2 | ||
|
|
96d4034a74 | ||
|
|
2e3624d636 | ||
|
|
cb54bbcd97 | ||
|
|
847e78541a | ||
|
|
ad3eebcf63 | ||
|
|
86df468c3f | ||
|
|
2cf2486a2b | ||
|
|
4d443d614b | ||
|
|
50968ec1a6 | ||
|
|
38ada0b998 | ||
|
|
0b0f9827b9 | ||
|
|
88b5e3f71b | ||
|
|
bc608dc130 | ||
|
|
961c237d33 | ||
|
|
73e2f56ff5 | ||
|
|
a122ceb09b | ||
|
|
b30d7cb3dc | ||
|
|
cd81362781 | ||
|
|
63abf0b840 | ||
|
|
56d265ae11 | ||
|
|
c0c76da4c8 | ||
|
|
3edfff49a2 | ||
|
|
f9be835288 | ||
|
|
86e542e524 | ||
|
|
f28e189cf5 | ||
|
|
2538b6921f | ||
|
|
83525807a2 | ||
|
|
c6a61c1b92 | ||
|
|
0257171cf5 | ||
|
|
f431f9858c | ||
|
|
71e9230789 | ||
|
|
08859f1588 | ||
|
|
d0a255c84a | ||
|
|
ec6f341497 | ||
|
|
811b26275f | ||
|
|
107894eccf | ||
|
|
cb8387cba6 | ||
|
|
6700aac4a4 | ||
|
|
3d1173a2cd | ||
|
|
52c7cca3fc | ||
|
|
9a59a90187 | ||
|
|
08370cb3a6 | ||
|
|
2dce1f23b0 | ||
|
|
a52f5aaa75 | ||
|
|
ef5f7bca64 | ||
|
|
1435c71d9c | ||
|
|
0d2517b96d | ||
|
|
48a1c0f5d4 | ||
|
|
64fb04b77b | ||
|
|
2696a93ee0 |
8
.github/aur/flux-bin/.SRCINFO.template
vendored
8
.github/aur/flux-bin/.SRCINFO.template
vendored
@@ -10,13 +10,13 @@ pkgbase = flux-bin
|
||||
license = APACHE
|
||||
optdepends = bash-completion: auto-completion for flux in Bash
|
||||
optdepends = zsh-completions: auto-completion for flux in ZSH
|
||||
source_x86_64 = ${PKGNAME}-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${PKGVER}/flux_${PKGVER}_linux_amd64.tar.gz
|
||||
source_x86_64 = flux-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${VERSION}/flux_${VERSION}_linux_amd64.tar.gz
|
||||
sha256sums_x86_64 = ${SHA256SUM_AMD64}
|
||||
source_armv6h = ${PKGNAME}-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${PKGVER}/flux_${PKGVER}_linux_arm.tar.gz
|
||||
source_armv6h = flux-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${VERSION}/flux_${VERSION}_linux_arm.tar.gz
|
||||
sha256sums_armv6h = ${SHA256SUM_ARM}
|
||||
source_armv7h = ${PKGNAME}-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${PKGVER}/flux_${PKGVER}_linux_arm.tar.gz
|
||||
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}
|
||||
source_aarch64 = ${PKGNAME}-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${PKGVER}/flux_${PKGVER}_linux_arm64.tar.gz
|
||||
source_aarch64 = flux-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${VERSION}/flux_${VERSION}_linux_arm64.tar.gz
|
||||
sha256sums_aarch64 = ${SHA256SUM_ARM64}
|
||||
|
||||
pkgname = flux-bin
|
||||
|
||||
11
.github/aur/flux-bin/PKGBUILD.template
vendored
11
.github/aur/flux-bin/PKGBUILD.template
vendored
@@ -4,6 +4,8 @@
|
||||
pkgname=flux-bin
|
||||
pkgver=${PKGVER}
|
||||
pkgrel=${PKGREL}
|
||||
_srcname=flux
|
||||
_srcver=${VERSION}
|
||||
pkgdesc="Open and extensible continuous delivery solution for Kubernetes"
|
||||
url="https://fluxcd.io/"
|
||||
arch=("x86_64" "armv6h" "armv7h" "aarch64")
|
||||
@@ -11,16 +13,16 @@ license=("APACHE")
|
||||
optdepends=('bash-completion: auto-completion for flux in Bash'
|
||||
'zsh-completions: auto-completion for flux in ZSH')
|
||||
source_x86_64=(
|
||||
"${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${pkgver}/flux_${pkgver}_linux_amd64.tar.gz"
|
||||
"${pkgname}-${pkgver}.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${pkgver}/flux_${pkgver}_linux_arm.tar.gz"
|
||||
"${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${_srcver}/flux_${_srcver}_linux_arm.tar.gz"
|
||||
)
|
||||
source_armv7h=(
|
||||
"${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${pkgver}/flux_${pkgver}_linux_arm.tar.gz"
|
||||
"${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${_srcver}/flux_${_srcver}_linux_arm.tar.gz"
|
||||
)
|
||||
source_aarch64=(
|
||||
"${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${pkgver}/flux_${pkgver}_linux_arm64.tar.gz"
|
||||
"${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${_srcver}/flux_${_srcver}_linux_arm64.tar.gz"
|
||||
)
|
||||
sha256sums_x86_64=(
|
||||
${SHA256SUM_AMD64}
|
||||
@@ -34,7 +36,6 @@ sha256sums_armv7h=(
|
||||
sha256sums_aarch64=(
|
||||
${SHA256SUM_ARM64}
|
||||
)
|
||||
_srcname=flux
|
||||
|
||||
package() {
|
||||
install -Dm755 ${_srcname} "${pkgdir}/usr/bin/${_srcname}"
|
||||
|
||||
11
.github/aur/flux-bin/publish.sh
vendored
11
.github/aur/flux-bin/publish.sh
vendored
@@ -28,6 +28,7 @@ git clone aur@aur.archlinux.org:$PKGNAME $GITDIR 2>&1
|
||||
CURRENT_PKGVER=$(cat $GITDIR/.SRCINFO | grep pkgver | awk '{ print $3 }')
|
||||
CURRENT_PKGREL=$(cat $GITDIR/.SRCINFO | grep pkgrel | awk '{ print $3 }')
|
||||
|
||||
# Transform pre-release to AUR compatible version format
|
||||
export PKGVER=${VERSION/-/}
|
||||
|
||||
if [[ "${CURRENT_PKGVER}" == "${PKGVER}" ]]; then
|
||||
@@ -36,12 +37,12 @@ else
|
||||
export PKGREL=1
|
||||
fi
|
||||
|
||||
export SHA256SUM_ARM=$(sha256sum ${ROOT}/dist/flux_${PKGVER}_linux_arm.tar.gz | awk '{ print $1 }')
|
||||
export SHA256SUM_ARM64=$(sha256sum ${ROOT}/dist/flux_${PKGVER}_linux_arm64.tar.gz | awk '{ print $1 }')
|
||||
export SHA256SUM_AMD64=$(sha256sum ${ROOT}/dist/flux_${PKGVER}_linux_amd64.tar.gz | awk '{ print $1 }')
|
||||
export SHA256SUM_ARM=$(sha256sum ${ROOT}/dist/flux_${VERSION}_linux_arm.tar.gz | awk '{ print $1 }')
|
||||
export SHA256SUM_ARM64=$(sha256sum ${ROOT}/dist/flux_${VERSION}_linux_arm64.tar.gz | awk '{ print $1 }')
|
||||
export SHA256SUM_AMD64=$(sha256sum ${ROOT}/dist/flux_${VERSION}_linux_amd64.tar.gz | awk '{ print $1 }')
|
||||
|
||||
envsubst '$PKGVER $PKGREL $SHA256SUM_AMD64 $SHA256SUM_ARM $SHA256SUM_ARM64' < .SRCINFO.template > $GITDIR/.SRCINFO
|
||||
envsubst '$PKGVER $PKGREL $SHA256SUM_AMD64 $SHA256SUM_ARM $SHA256SUM_ARM64' < PKGBUILD.template > $GITDIR/PKGBUILD
|
||||
envsubst '$VERSION $PKGVER $PKGREL $SHA256SUM_AMD64 $SHA256SUM_ARM $SHA256SUM_ARM64' < .SRCINFO.template > $GITDIR/.SRCINFO
|
||||
envsubst '$VERSION $PKGVER $PKGREL $SHA256SUM_AMD64 $SHA256SUM_ARM $SHA256SUM_ARM64' < PKGBUILD.template > $GITDIR/PKGBUILD
|
||||
|
||||
cd $GITDIR
|
||||
git config user.name "fluxcdbot"
|
||||
|
||||
2
.github/aur/flux-go/.SRCINFO.template
vendored
2
.github/aur/flux-go/.SRCINFO.template
vendored
@@ -13,6 +13,6 @@ pkgbase = flux-go
|
||||
provides = flux-bin
|
||||
conflicts = flux-bin
|
||||
replaces = flux-cli
|
||||
source = flux-go-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/archive/v${PKGVER}.tar.gz
|
||||
source = flux-go-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/archive/v${VERSION}.tar.gz
|
||||
|
||||
pkgname = flux-go
|
||||
|
||||
15
.github/aur/flux-go/PKGBUILD.template
vendored
15
.github/aur/flux-go/PKGBUILD.template
vendored
@@ -4,6 +4,8 @@
|
||||
pkgname=flux-go
|
||||
pkgver=${PKGVER}
|
||||
pkgrel=${PKGREL}
|
||||
_srcname=flux
|
||||
_srcver=${VERSION}
|
||||
pkgdesc="Open and extensible continuous delivery solution for Kubernetes"
|
||||
url="https://fluxcd.io/"
|
||||
arch=("x86_64" "armv6h" "armv7h" "aarch64")
|
||||
@@ -12,30 +14,29 @@ provides=("flux-bin")
|
||||
conflicts=("flux-bin")
|
||||
replaces=("flux-cli")
|
||||
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',
|
||||
'zsh-completions: auto-completion for flux in ZSH')
|
||||
source=(
|
||||
"${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/archive/v${pkgver}.tar.gz"
|
||||
"${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/archive/v${_srcver}.tar.gz"
|
||||
)
|
||||
sha256sums=(
|
||||
${SHA256SUM}
|
||||
)
|
||||
_srcname=flux
|
||||
|
||||
build() {
|
||||
cd "flux2-${pkgver}"
|
||||
cd "flux2-${_srcver}"
|
||||
export CGO_LDFLAGS="$LDFLAGS"
|
||||
export CGO_CFLAGS="$CFLAGS"
|
||||
export CGO_CXXFLAGS="$CXXFLAGS"
|
||||
export CGO_CPPFLAGS="$CPPFLAGS"
|
||||
export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
|
||||
make cmd/flux/.manifests.done
|
||||
go build -ldflags "-linkmode=external -X main.VERSION=${pkgver}" -o ${_srcname} ./cmd/flux
|
||||
go build -ldflags "-linkmode=external -X main.VERSION=${_srcver}" -o ${_srcname} ./cmd/flux
|
||||
}
|
||||
|
||||
check() {
|
||||
cd "flux2-${pkgver}"
|
||||
cd "flux2-${_srcver}"
|
||||
case $CARCH in
|
||||
aarch64)
|
||||
export ENVTEST_ARCH=arm64
|
||||
@@ -48,7 +49,7 @@ check() {
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "flux2-${pkgver}"
|
||||
cd "flux2-${_srcver}"
|
||||
install -Dm755 ${_srcname} "${pkgdir}/usr/bin/${_srcname}"
|
||||
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
|
||||
|
||||
|
||||
7
.github/aur/flux-go/publish.sh
vendored
7
.github/aur/flux-go/publish.sh
vendored
@@ -28,6 +28,7 @@ git clone aur@aur.archlinux.org:$PKGNAME $GITDIR 2>&1
|
||||
CURRENT_PKGVER=$(cat $GITDIR/.SRCINFO | grep pkgver | awk '{ print $3 }')
|
||||
CURRENT_PKGREL=$(cat $GITDIR/.SRCINFO | grep pkgrel | awk '{ print $3 }')
|
||||
|
||||
# Transform pre-release to AUR compatible version format
|
||||
export PKGVER=${VERSION/-/}
|
||||
|
||||
if [[ "${CURRENT_PKGVER}" == "${PKGVER}" ]]; then
|
||||
@@ -36,10 +37,10 @@ else
|
||||
export PKGREL=1
|
||||
fi
|
||||
|
||||
export SHA256SUM=$(curl -sL https://github.com/fluxcd/flux2/archive/v$PKGVER.tar.gz | sha256sum | awk '{ print $1 }')
|
||||
export SHA256SUM=$(curl -sL https://github.com/fluxcd/flux2/archive/v${VERSION}.tar.gz | sha256sum | awk '{ print $1 }')
|
||||
|
||||
envsubst '$PKGVER $PKGREL $SHA256SUM' < .SRCINFO.template > $GITDIR/.SRCINFO
|
||||
envsubst '$PKGVER $PKGREL $SHA256SUM' < PKGBUILD.template > $GITDIR/PKGBUILD
|
||||
envsubst '$VERSION $PKGVER $PKGREL $SHA256SUM' < .SRCINFO.template > $GITDIR/.SRCINFO
|
||||
envsubst '$VERSION $PKGVER $PKGREL $SHA256SUM' < PKGBUILD.template > $GITDIR/PKGBUILD
|
||||
|
||||
cd $GITDIR
|
||||
git config user.name "fluxcdbot"
|
||||
|
||||
4
.github/aur/flux-scm/PKGBUILD.template
vendored
4
.github/aur/flux-scm/PKGBUILD.template
vendored
@@ -4,6 +4,7 @@
|
||||
pkgname=flux-scm
|
||||
pkgver=${PKGVER}
|
||||
pkgrel=${PKGREL}
|
||||
_srcname=flux
|
||||
pkgdesc="Open and extensible continuous delivery solution for Kubernetes"
|
||||
url="https://fluxcd.io/"
|
||||
arch=("x86_64" "armv6h" "armv7h" "aarch64")
|
||||
@@ -11,14 +12,13 @@ license=("APACHE")
|
||||
provides=("flux-bin")
|
||||
conflicts=("flux-bin")
|
||||
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',
|
||||
'zsh-completions: auto-completion for flux in ZSH')
|
||||
source=(
|
||||
"git+https://github.com/fluxcd/flux2.git"
|
||||
)
|
||||
md5sums=('SKIP')
|
||||
_srcname=flux
|
||||
|
||||
pkgver() {
|
||||
cd "flux2"
|
||||
|
||||
1
.github/aur/flux-scm/publish.sh
vendored
1
.github/aur/flux-scm/publish.sh
vendored
@@ -28,6 +28,7 @@ git clone aur@aur.archlinux.org:$PKGNAME $GITDIR 2>&1
|
||||
CURRENT_PKGVER=$(cat $GITDIR/.SRCINFO | grep pkgver | awk '{ print $3 }')
|
||||
CURRENT_PKGREL=$(cat $GITDIR/.SRCINFO | grep pkgrel | awk '{ print $3 }')
|
||||
|
||||
# Transform pre-release to AUR compatible version format
|
||||
export PKGVER=${VERSION/-/}
|
||||
|
||||
if [[ "${CURRENT_PKGVER}" == "${PKGVER}" ]]; then
|
||||
|
||||
11
.github/dependabot.yml
vendored
11
.github/dependabot.yml
vendored
@@ -3,7 +3,14 @@ version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
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:
|
||||
# by default this will be on a monday.
|
||||
# By default, this will be on a monday.
|
||||
interval: "weekly"
|
||||
|
||||
49
.github/labels.yaml
vendored
Normal file
49
.github/labels.yaml
vendored
Normal 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'
|
||||
31
.github/workflows/backport.yaml
vendored
Normal file
31
.github/workflows/backport.yaml
vendored
Normal 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@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Create backport PRs
|
||||
uses: korthout/backport-action@bf5fdd624b35f95d5b85991a728bd5744e8c6cf2 # v1.3.1
|
||||
# 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}.
|
||||
8
.github/workflows/e2e-arm64.yaml
vendored
8
.github/workflows/e2e-arm64.yaml
vendored
@@ -3,7 +3,7 @@ name: e2e-arm64
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [ main, update-components, release-* ]
|
||||
branches: [ 'main', 'update-components', 'e2e-*', 'release/**' ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -17,12 +17,12 @@ jobs:
|
||||
matrix:
|
||||
# Keep this list up-to-date with https://endoflife.date/kubernetes
|
||||
# Check which versions are available on DockerHub with 'crane ls kindest/node'
|
||||
KUBERNETES_VERSION: [ 1.24.7, 1.25.3, 1.26.0 ]
|
||||
KUBERNETES_VERSION: [ 1.25.8, 1.26.3, 1.27.3 ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
|
||||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
||||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
|
||||
with:
|
||||
go-version: 1.20.x
|
||||
cache-dependency-path: |
|
||||
|
||||
17
.github/workflows/e2e-azure.yaml
vendored
17
.github/workflows/e2e-azure.yaml
vendored
@@ -5,7 +5,17 @@ on:
|
||||
schedule:
|
||||
- cron: '0 6 * * *'
|
||||
push:
|
||||
branches: [ azure* ]
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'tests/**'
|
||||
- '.github/workflows/e2e-azure.yaml'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'tests/**'
|
||||
- '.github/workflows/e2e-azure.yaml'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -13,11 +23,12 @@ permissions:
|
||||
jobs:
|
||||
e2e-amd64-aks:
|
||||
runs-on: ubuntu-22.04
|
||||
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
|
||||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
||||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
|
||||
with:
|
||||
go-version: 1.20.x
|
||||
cache-dependency-path: |
|
||||
|
||||
18
.github/workflows/e2e-bootstrap.yaml
vendored
18
.github/workflows/e2e-bootstrap.yaml
vendored
@@ -3,9 +3,10 @@ name: e2e-bootstrap
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [ main, release-* ]
|
||||
branches: [ 'main', 'release/**' ]
|
||||
pull_request:
|
||||
branches: [ main, release-* ]
|
||||
branches: [ 'main', 'release/**' ]
|
||||
paths-ignore: [ 'docs/**', 'rfcs/**' ]
|
||||
|
||||
permissions:
|
||||
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]'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
|
||||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
||||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
|
||||
with:
|
||||
go-version: 1.20.x
|
||||
cache-dependency-path: |
|
||||
**/go.sum
|
||||
**/go.mod
|
||||
- name: Setup Kubernetes
|
||||
uses: helm/kind-action@d8ccf8fb623ce1bb360ae2f45f323d9d5c5e9f00 # v1.5.0
|
||||
uses: helm/kind-action@fa81e57adff234b2908110485695db0f181f3c67 # v1.7.0
|
||||
with:
|
||||
version: v0.17.0
|
||||
version: v0.20.0
|
||||
cluster_name: kind
|
||||
# The versions below should target the newest Kubernetes version
|
||||
# Keep this up-to-date with https://endoflife.date/kubernetes
|
||||
node_image: kindest/node:v1.26.0
|
||||
kubectl_version: v1.26.2
|
||||
node_image: kindest/node:v1.27.3@sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72
|
||||
kubectl_version: v1.27.3
|
||||
- name: Setup Kustomize
|
||||
uses: fluxcd/pkg/actions/kustomize@main
|
||||
- name: Build
|
||||
@@ -98,7 +99,6 @@ jobs:
|
||||
--path=test-cluster \
|
||||
--read-write-key
|
||||
/tmp/flux reconcile image repository podinfo
|
||||
/tmp/flux reconcile image update flux-system
|
||||
/tmp/flux get images all
|
||||
|
||||
retries=10
|
||||
|
||||
17
.github/workflows/e2e.yaml
vendored
17
.github/workflows/e2e.yaml
vendored
@@ -3,9 +3,10 @@ name: e2e
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [ main, release-* ]
|
||||
branches: [ 'main', 'release/**' ]
|
||||
pull_request:
|
||||
branches: [ main, release-* ]
|
||||
branches: [ 'main', 'release/**' ]
|
||||
paths-ignore: [ 'docs/**', 'rfcs/**' ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -20,24 +21,24 @@ jobs:
|
||||
- 5000:5000
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
|
||||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
||||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
|
||||
with:
|
||||
go-version: 1.20.x
|
||||
cache-dependency-path: |
|
||||
**/go.sum
|
||||
**/go.mod
|
||||
- name: Setup Kubernetes
|
||||
uses: helm/kind-action@d8ccf8fb623ce1bb360ae2f45f323d9d5c5e9f00 # v1.5.0
|
||||
uses: helm/kind-action@fa81e57adff234b2908110485695db0f181f3c67 # v1.7.0
|
||||
with:
|
||||
version: v0.17.0
|
||||
version: v0.20.0
|
||||
cluster_name: kind
|
||||
config: .github/kind/config.yaml # disable KIND-net
|
||||
# The versions below should target the newest Kubernetes version
|
||||
# Keep this up-to-date with https://endoflife.date/kubernetes
|
||||
node_image: kindest/node:v1.26.0
|
||||
kubectl_version: v1.26.2
|
||||
node_image: kindest/node:v1.27.3@sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72
|
||||
kubectl_version: v1.27.3
|
||||
- name: Setup Calico for network policy
|
||||
run: |
|
||||
kubectl apply -f https://docs.projectcalico.org/v3.25/manifests/calico.yaml
|
||||
|
||||
39
.github/workflows/ossf.yaml
vendored
Normal file
39
.github/workflows/ossf.yaml
vendored
Normal 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@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
||||
- 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
|
||||
87
.github/workflows/release.yaml
vendored
87
.github/workflows/release.yaml
vendored
@@ -9,6 +9,10 @@ permissions:
|
||||
|
||||
jobs:
|
||||
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
|
||||
permissions:
|
||||
contents: write # needed to write releases
|
||||
@@ -16,33 +20,33 @@ jobs:
|
||||
packages: write # needed for ghcr access
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
|
||||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
||||
- name: Unshallow
|
||||
run: git fetch --prune --unshallow
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
||||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
|
||||
with:
|
||||
go-version: 1.20.x
|
||||
cache: false
|
||||
- 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
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2.5.0
|
||||
uses: docker/setup-buildx-action@16c0bc4a6e6ada2cfd8afd41d22d95379cf7c32a # v2.8.0
|
||||
- name: Setup Syft
|
||||
uses: anchore/sbom-action/download-syft@422cb34a0f8b599678c41b21163ea6088edb2624 # v0.14.1
|
||||
uses: anchore/sbom-action/download-syft@78fc58e266e87a38d4194b2137a3d4e9bcaf7ca1 # v0.14.3
|
||||
- name: Setup Cosign
|
||||
uses: sigstore/cosign-installer@c3667d99424e7e6047999fb6246c0da843953c65 # v3.0.1
|
||||
uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 # v3.1.1
|
||||
- name: Setup Kustomize
|
||||
uses: fluxcd/pkg/actions/kustomize@main
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
|
||||
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: fluxcdbot
|
||||
password: ${{ secrets.GHCR_TOKEN }}
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
|
||||
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
|
||||
with:
|
||||
username: fluxcdbot
|
||||
password: ${{ secrets.DOCKER_FLUXCD_PASSWORD }}
|
||||
@@ -74,7 +78,8 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0
|
||||
id: run-goreleaser
|
||||
uses: goreleaser/goreleaser-action@336e29918d653399e599bfca99fadc1d7ffbc9f7 # v4.3.0
|
||||
with:
|
||||
version: latest
|
||||
args: release --release-notes=output/notes.md --skip-validate
|
||||
@@ -82,6 +87,22 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
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:
|
||||
runs-on: ubuntu-latest
|
||||
needs: release-flux-cli
|
||||
@@ -89,7 +110,7 @@ jobs:
|
||||
id-token: write
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
|
||||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
||||
- name: Setup Kustomize
|
||||
uses: fluxcd/pkg/actions/kustomize@main
|
||||
- name: Setup Flux CLI
|
||||
@@ -100,13 +121,13 @@ jobs:
|
||||
VERSION=$(flux version --client | awk '{ print $NF }')
|
||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
|
||||
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: fluxcdbot
|
||||
password: ${{ secrets.GHCR_TOKEN }}
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
|
||||
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
|
||||
with:
|
||||
username: fluxcdbot
|
||||
password: ${{ secrets.DOCKER_FLUXCD_PASSWORD }}
|
||||
@@ -134,7 +155,7 @@ jobs:
|
||||
--path="./flux-system" \
|
||||
--source=${{ github.repositoryUrl }} \
|
||||
--revision="${{ github.ref_name }}@sha1:${{ github.sha }}"
|
||||
- uses: sigstore/cosign-installer@c3667d99424e7e6047999fb6246c0da843953c65 # v3.0.1
|
||||
- uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 # v3.1.1
|
||||
- name: Sign manifests
|
||||
env:
|
||||
COSIGN_EXPERIMENTAL: 1
|
||||
@@ -148,3 +169,43 @@ jobs:
|
||||
|
||||
flux tag artifact oci://docker.io/fluxcd/flux-manifests:${{ steps.prep.outputs.version }} \
|
||||
--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.7.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.7.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.7.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 }}
|
||||
|
||||
24
.github/workflows/scan.yaml
vendored
24
.github/workflows/scan.yaml
vendored
@@ -3,9 +3,9 @@ name: scan
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [ main ]
|
||||
branches: [ 'main', 'release/**' ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
branches: [ 'main', 'release/**' ]
|
||||
schedule:
|
||||
- cron: '18 10 * * 3'
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.actor != 'dependabot[bot]'
|
||||
steps:
|
||||
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
|
||||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
||||
- name: Run FOSSA scan and upload build data
|
||||
uses: fossa-contrib/fossa-action@6728dc6fe9a068c648d080c33829ffbe56565023 # v2.0.0
|
||||
with:
|
||||
@@ -31,11 +31,11 @@ jobs:
|
||||
security-events: write
|
||||
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]'
|
||||
steps:
|
||||
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
|
||||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
||||
- name: Setup Kustomize
|
||||
uses: fluxcd/pkg/actions/kustomize@main
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
||||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
|
||||
with:
|
||||
go-version: 1.20.x
|
||||
cache-dependency-path: |
|
||||
@@ -45,7 +45,7 @@ jobs:
|
||||
run: |
|
||||
make tidy
|
||||
make cmd/flux/.manifests.done
|
||||
- uses: snyk/actions/setup@806182742461562b67788a64410098c9d9b96adb
|
||||
- uses: snyk/actions/setup@b98d498629f1c368650224d6d212bf7dfa89e4bf
|
||||
- name: Run Snyk to check for vulnerabilities
|
||||
continue-on-error: true
|
||||
run: |
|
||||
@@ -53,7 +53,7 @@ jobs:
|
||||
env:
|
||||
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
|
||||
- name: Upload result to GitHub Code Scanning
|
||||
uses: github/codeql-action/upload-sarif@04df1262e6247151b5ac09cd2c303ac36ad3f62b # v2.2.9
|
||||
uses: github/codeql-action/upload-sarif@cdcdbb579706841c47f7063dda365e292e5cad7a # v2.13.4
|
||||
with:
|
||||
sarif_file: snyk.sarif
|
||||
|
||||
@@ -64,19 +64,19 @@ jobs:
|
||||
if: github.actor != 'dependabot[bot]'
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
|
||||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
||||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
|
||||
with:
|
||||
go-version: 1.20.x
|
||||
cache-dependency-path: |
|
||||
**/go.sum
|
||||
**/go.mod
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@04df1262e6247151b5ac09cd2c303ac36ad3f62b # v2.2.9
|
||||
uses: github/codeql-action/init@cdcdbb579706841c47f7063dda365e292e5cad7a # v2.13.4
|
||||
with:
|
||||
languages: go
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@04df1262e6247151b5ac09cd2c303ac36ad3f62b # v2.2.9
|
||||
uses: github/codeql-action/autobuild@cdcdbb579706841c47f7063dda365e292e5cad7a # v2.13.4
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@04df1262e6247151b5ac09cd2c303ac36ad3f62b # v2.2.9
|
||||
uses: github/codeql-action/analyze@cdcdbb579706841c47f7063dda365e292e5cad7a # v2.13.4
|
||||
|
||||
28
.github/workflows/sync-labels.yaml
vendored
Normal file
28
.github/workflows/sync-labels.yaml
vendored
Normal 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@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
||||
- 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
|
||||
8
.github/workflows/update.yaml
vendored
8
.github/workflows/update.yaml
vendored
@@ -18,9 +18,9 @@ jobs:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
|
||||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
||||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
|
||||
with:
|
||||
go-version: 1.20.x
|
||||
cache-dependency-path: |
|
||||
@@ -84,7 +84,7 @@ jobs:
|
||||
|
||||
- name: Create Pull Request
|
||||
id: cpr
|
||||
uses: peter-evans/create-pull-request@38e0b6e68b4c852a5500a94740f0e535e0d7ba54 # v4.2.4
|
||||
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2
|
||||
with:
|
||||
token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
commit-message: |
|
||||
@@ -99,7 +99,7 @@ jobs:
|
||||
body: |
|
||||
${{ steps.update.outputs.pr_body }}
|
||||
labels: |
|
||||
area/build
|
||||
dependencies
|
||||
reviewers: ${{ secrets.ASSIGNEES }}
|
||||
|
||||
- name: Check output
|
||||
|
||||
@@ -83,14 +83,7 @@ brews:
|
||||
install: |
|
||||
bin.install "flux"
|
||||
|
||||
bash_output = Utils.safe_popen_read(bin/"flux", "completion", "bash")
|
||||
(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
|
||||
generate_completions_from_executable(bin/"flux", "completion")
|
||||
test: |
|
||||
system "#{bin}/flux --version"
|
||||
publishers:
|
||||
|
||||
@@ -68,8 +68,8 @@ for source changes.
|
||||
Prerequisites:
|
||||
|
||||
* go >= 1.20
|
||||
* kubectl >= 1.20
|
||||
* kustomize >= 4.4
|
||||
* kubectl >= 1.24
|
||||
* kustomize >= 5.0
|
||||
* coreutils (on Mac OS)
|
||||
|
||||
Install the [controller-runtime/envtest](https://github.com/kubernetes-sigs/controller-runtime/tree/master/tools/setup-envtest) binaries with:
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
FROM alpine:3.17 as builder
|
||||
FROM alpine:3.18 as builder
|
||||
|
||||
RUN apk add --no-cache ca-certificates curl
|
||||
|
||||
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 \
|
||||
-o /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl && \
|
||||
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
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
[](https://github.com/fluxcd/flux2/releases)
|
||||
[](https://bestpractices.coreinfrastructure.org/projects/4782)
|
||||
[](https://api.securityscorecards.dev/projects/github.com/fluxcd/flux2)
|
||||
[](https://app.fossa.com/projects/custom%2B162%2Fgithub.com%2Ffluxcd%2Fflux2?ref=badge_shield)
|
||||
[](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
|
||||
automation tooling.
|
||||
|
||||

|
||||

|
||||
|
||||
You can use the toolkit to extend Flux, or to build your own systems
|
||||
for continuous delivery -- see [the developer
|
||||
|
||||
@@ -134,7 +134,7 @@ func bootstrapGitCmdRun(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
}
|
||||
if repositoryURL.Scheme == string(git.HTTPS) && !bootstrapArgs.tokenAuth {
|
||||
return fmt.Errorf("--token-auth=true must be specified for using a HTTPS AWS CodeCommit url")
|
||||
return fmt.Errorf("--token-auth=true must be specified for using an HTTPS AWS CodeCommit url")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ func buildArtifactCmdRun(cmd *cobra.Command, args []string) error {
|
||||
|
||||
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 {
|
||||
return fmt.Errorf("bulding artifact failed, error: %w", err)
|
||||
}
|
||||
|
||||
@@ -159,6 +159,7 @@ spec:
|
||||
tmpl := map[string]string{
|
||||
"fluxns": allocateNamespace("flux-system"),
|
||||
}
|
||||
setup(t, tmpl)
|
||||
|
||||
testEnv.CreateObjectFile("./testdata/build-kustomization/podinfo-source.yaml", tmpl, t)
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ type checkFlags struct {
|
||||
}
|
||||
|
||||
var kubernetesConstraints = []string{
|
||||
">=1.20.6-0",
|
||||
">=1.24.0-0",
|
||||
}
|
||||
|
||||
var checkArgs checkFlags
|
||||
|
||||
@@ -83,9 +83,9 @@ var createHelmReleaseCmd = &cobra.Command{
|
||||
|
||||
# Create a HelmRelease with a custom release name
|
||||
flux create hr podinfo \
|
||||
--release-name=podinfo-dev
|
||||
--release-name=podinfo-dev \
|
||||
--source=HelmRepository/podinfo \
|
||||
--chart=podinfo \
|
||||
--chart=podinfo
|
||||
|
||||
# Create a HelmRelease targeting another namespace than the resource
|
||||
flux create hr podinfo \
|
||||
|
||||
@@ -145,7 +145,7 @@ func createReceiverCmdRun(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
logger.Successf("Receiver %s is ready", name)
|
||||
|
||||
logger.Successf("generated webhook URL %s", receiver.Status.URL)
|
||||
logger.Successf("generated webhook URL %s", receiver.Status.WebhookPath)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -64,13 +64,13 @@ For private Helm repositories, the basic authentication credentials are stored i
|
||||
|
||||
# Create a source for an OCI Helm repository
|
||||
flux create source helm podinfo \
|
||||
--url=oci://ghcr.io/stefanprodan/charts/podinfo
|
||||
--url=oci://ghcr.io/stefanprodan/charts/podinfo \
|
||||
--username=username \
|
||||
--password=password
|
||||
|
||||
# Create a source for an OCI Helm repository using an existing secret with basic auth or dockerconfig credentials
|
||||
flux create source helm podinfo \
|
||||
--url=oci://ghcr.io/stefanprodan/charts/podinfo
|
||||
--url=oci://ghcr.io/stefanprodan/charts/podinfo \
|
||||
--secret-ref=docker-config`,
|
||||
RunE: createSourceHelmCmdRun,
|
||||
}
|
||||
@@ -83,6 +83,7 @@ type sourceHelmFlags struct {
|
||||
keyFile string
|
||||
caFile string
|
||||
secretRef string
|
||||
ociProvider string
|
||||
passCredentials bool
|
||||
}
|
||||
|
||||
@@ -96,6 +97,7 @@ func init() {
|
||||
createSourceHelmCmd.Flags().StringVar(&sourceHelmArgs.keyFile, "key-file", "", "TLS authentication key file path")
|
||||
createSourceHelmCmd.Flags().StringVar(&sourceHelmArgs.caFile, "ca-file", "", "TLS authentication CA file path")
|
||||
createSourceHelmCmd.Flags().StringVarP(&sourceHelmArgs.secretRef, "secret-ref", "", "", "the name of an existing secret containing TLS, basic auth or docker-config credentials")
|
||||
createSourceHelmCmd.Flags().StringVar(&sourceHelmArgs.ociProvider, "oci-provider", "", "OCI provider for authentication")
|
||||
createSourceHelmCmd.Flags().BoolVarP(&sourceHelmArgs.passCredentials, "pass-credentials", "", false, "pass credentials to all domains")
|
||||
|
||||
createSourceCmd.AddCommand(createSourceHelmCmd)
|
||||
@@ -143,6 +145,7 @@ func createSourceHelmCmdRun(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
if url.Scheme == sourcev1.HelmRepositoryTypeOCI {
|
||||
helmRepository.Spec.Type = sourcev1.HelmRepositoryTypeOCI
|
||||
helmRepository.Spec.Provider = sourceHelmArgs.ociProvider
|
||||
}
|
||||
|
||||
if createSourceArgs.fetchTimeout > 0 {
|
||||
|
||||
@@ -21,10 +21,11 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/flags"
|
||||
oci "github.com/fluxcd/pkg/oci/client"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/flags"
|
||||
)
|
||||
|
||||
var diffArtifactCmd = &cobra.Command{
|
||||
@@ -81,7 +82,7 @@ func diffArtifactCmdRun(cmd *cobra.Command, args []string) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
|
||||
defer cancel()
|
||||
|
||||
ociClient := oci.NewLocalClient()
|
||||
ociClient := oci.NewClient(oci.DefaultOptions())
|
||||
|
||||
if diffArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && diffArtifactArgs.creds != "" {
|
||||
logger.Actionf("logging in to registry with credentials")
|
||||
|
||||
@@ -18,6 +18,7 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
@@ -27,6 +28,7 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/discovery"
|
||||
watchtools "k8s.io/client-go/tools/watch"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
@@ -66,6 +68,7 @@ type GetFlags struct {
|
||||
allNamespaces bool
|
||||
noHeader bool
|
||||
statusSelector string
|
||||
labelSelector string
|
||||
watch bool
|
||||
}
|
||||
|
||||
@@ -78,6 +81,8 @@ func init() {
|
||||
getCmd.PersistentFlags().BoolVarP(&getArgs.watch, "watch", "w", false, "After listing/getting the requested object, watch for changes.")
|
||||
getCmd.PersistentFlags().StringVar(&getArgs.statusSelector, "status-selector", "",
|
||||
"specify the status condition name and the desired state to filter the get result, e.g. ready=false")
|
||||
getCmd.PersistentFlags().StringVarP(&getArgs.labelSelector, "label-selector", "l", "",
|
||||
"filter objects by label selector")
|
||||
rootCmd.AddCommand(getCmd)
|
||||
}
|
||||
|
||||
@@ -150,6 +155,21 @@ func (get getCommand) run(cmd *cobra.Command, args []string) error {
|
||||
listOpts = append(listOpts, client.MatchingFields{"metadata.name": args[0]})
|
||||
}
|
||||
|
||||
if getArgs.labelSelector != "" {
|
||||
label, err := metav1.ParseToLabelSelector(getArgs.labelSelector)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to parse label selector: %w", err)
|
||||
}
|
||||
|
||||
sel, err := metav1.LabelSelectorAsSelector(label)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
listOpts = append(listOpts, client.MatchingLabelsSelector{
|
||||
Selector: sel,
|
||||
})
|
||||
}
|
||||
|
||||
getAll := cmd.Use == "all"
|
||||
|
||||
if getArgs.watch {
|
||||
@@ -158,6 +178,10 @@ func (get getCommand) run(cmd *cobra.Command, args []string) error {
|
||||
|
||||
err = kubeClient.List(ctx, get.list.asClientList(), listOpts...)
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,6 @@ limitations under the License.
|
||||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
autov1 "github.com/fluxcd/image-automation-controller/api/v1beta1"
|
||||
@@ -57,9 +55,7 @@ var getImageAllCmd = &cobra.Command{
|
||||
|
||||
for _, c := range allImageCmd {
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
61
cmd/flux/get_test.go
Normal file
61
cmd/flux/get_test.go
Normal file
@@ -0,0 +1,61 @@
|
||||
//go:build unit
|
||||
// +build unit
|
||||
|
||||
/*
|
||||
Copyright 2023 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 Test_GetCmd(t *testing.T) {
|
||||
tmpl := map[string]string{
|
||||
"fluxns": allocateNamespace("flux-system"),
|
||||
}
|
||||
testEnv.CreateObjectFile("./testdata/get/objects.yaml", tmpl, t)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
args string
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
name: "no label selector",
|
||||
expected: "testdata/get/get.golden",
|
||||
},
|
||||
{
|
||||
name: "equal label selector",
|
||||
args: "-l sharding.fluxcd.io/key=shard1",
|
||||
expected: "testdata/get/get_label_one.golden",
|
||||
},
|
||||
{
|
||||
name: "notin label selector",
|
||||
args: `-l "sharding.fluxcd.io/key notin (shard1, shard2)"`,
|
||||
expected: "testdata/get/get_label_two.golden",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
cmd := cmdTestCase{
|
||||
args: "get sources git " + tt.args + " -n " + tmpl["fluxns"],
|
||||
assert: assertGoldenTemplateFile(tt.expected, nil),
|
||||
}
|
||||
|
||||
cmd.runTestCmd(t)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -61,11 +61,26 @@ func TestKustomizationFromGit(t *testing.T) {
|
||||
"testdata/kustomization/suspend_kustomization_from_git.golden",
|
||||
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",
|
||||
"testdata/kustomization/resume_kustomization_from_git.golden",
|
||||
tmpl,
|
||||
},
|
||||
{
|
||||
"resume kustomization tkfg tkfg",
|
||||
"testdata/kustomization/resume_kustomization_from_git_multiple_args.golden",
|
||||
tmpl,
|
||||
},
|
||||
{
|
||||
"delete kustomization tkfg --silent",
|
||||
"testdata/kustomization/delete_kustomization_from_git.golden",
|
||||
|
||||
@@ -78,7 +78,7 @@ func listArtifactsCmdRun(cmd *cobra.Command, args []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
ociClient := oci.NewLocalClient()
|
||||
ociClient := oci.NewClient(oci.DefaultOptions())
|
||||
|
||||
if listArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && listArtifactArgs.creds != "" {
|
||||
logger.Actionf("logging in to registry with credentials")
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"bufio"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
@@ -76,7 +77,7 @@ type logsFlags struct {
|
||||
sinceSeconds time.Duration
|
||||
}
|
||||
|
||||
var logsArgs = &logsFlags{
|
||||
var logsArgs = logsFlags{
|
||||
tail: -1,
|
||||
}
|
||||
|
||||
@@ -115,7 +116,7 @@ func logsCmdRun(cmd *cobra.Command, args []string) error {
|
||||
return fmt.Errorf("no argument required")
|
||||
}
|
||||
|
||||
pods, err := getPods(ctx, clientset, fluxSelector)
|
||||
pods, err := getPods(ctx, clientset, logsArgs.fluxNamespace, fluxSelector)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -163,13 +164,16 @@ func logsCmdRun(cmd *cobra.Command, args []string) error {
|
||||
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
|
||||
|
||||
opts := metav1.ListOptions{
|
||||
LabelSelector: label,
|
||||
}
|
||||
deployList, err := c.AppsV1().Deployments(logsArgs.fluxNamespace).List(ctx, opts)
|
||||
deployList, err := c.AppsV1().Deployments(ns).List(ctx, opts)
|
||||
if err != nil {
|
||||
return ret, err
|
||||
}
|
||||
@@ -179,7 +183,7 @@ func getPods(ctx context.Context, c *kubernetes.Clientset, label string) ([]core
|
||||
opts := metav1.ListOptions{
|
||||
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 {
|
||||
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
|
||||
}
|
||||
|
||||
func parallelPodLogs(ctx context.Context, requests []rest.ResponseWrapper) error {
|
||||
reader, writer := io.Pipe()
|
||||
errReader, errWriter := io.Pipe()
|
||||
wg := &sync.WaitGroup{}
|
||||
wg.Add(len(requests))
|
||||
|
||||
@@ -208,7 +217,7 @@ func parallelPodLogs(ctx context.Context, requests []rest.ResponseWrapper) error
|
||||
go func(req rest.ResponseWrapper) {
|
||||
defer wg.Done()
|
||||
if err := logRequest(ctx, req, writer); err != nil {
|
||||
writer.CloseWithError(err)
|
||||
fmt.Fprintf(errWriter, "failed getting logs: %s\n", err)
|
||||
return
|
||||
}
|
||||
}(request)
|
||||
@@ -217,20 +226,40 @@ func parallelPodLogs(ctx context.Context, requests []rest.ResponseWrapper) error
|
||||
go func() {
|
||||
wg.Wait()
|
||||
writer.Close()
|
||||
errWriter.Close()
|
||||
}()
|
||||
|
||||
_, err := io.Copy(os.Stdout, reader)
|
||||
return err
|
||||
stdoutErrCh := asyncCopy(os.Stdout, reader)
|
||||
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 {
|
||||
var retErr error
|
||||
for _, req := range requests {
|
||||
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 {
|
||||
|
||||
88
cmd/flux/logs_e2e_test.go
Normal file
88
cmd/flux/logs_e2e_test.go
Normal 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)
|
||||
}
|
||||
@@ -30,73 +30,17 @@ import (
|
||||
. "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) {
|
||||
mapper := &testResponseMapper{}
|
||||
tests := []struct {
|
||||
name string
|
||||
namespace string
|
||||
flags *logsFlags
|
||||
flags logsFlags
|
||||
assertFile string
|
||||
}{
|
||||
{
|
||||
name: "all logs",
|
||||
flags: &logsFlags{
|
||||
flags: logsFlags{
|
||||
tail: -1,
|
||||
allNamespaces: true,
|
||||
},
|
||||
@@ -105,14 +49,14 @@ func TestLogRequest(t *testing.T) {
|
||||
{
|
||||
name: "filter by namespace",
|
||||
namespace: "default",
|
||||
flags: &logsFlags{
|
||||
flags: logsFlags{
|
||||
tail: -1,
|
||||
},
|
||||
assertFile: "testdata/logs/namespace.txt",
|
||||
},
|
||||
{
|
||||
name: "filter by kind and namespace",
|
||||
flags: &logsFlags{
|
||||
flags: logsFlags{
|
||||
tail: -1,
|
||||
kind: "Kustomization",
|
||||
},
|
||||
@@ -120,7 +64,7 @@ func TestLogRequest(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "filter by loglevel",
|
||||
flags: &logsFlags{
|
||||
flags: logsFlags{
|
||||
tail: -1,
|
||||
logLevel: "error",
|
||||
allNamespaces: true,
|
||||
@@ -130,7 +74,7 @@ func TestLogRequest(t *testing.T) {
|
||||
{
|
||||
name: "filter by namespace, name, loglevel and kind",
|
||||
namespace: "flux-system",
|
||||
flags: &logsFlags{
|
||||
flags: logsFlags{
|
||||
tail: -1,
|
||||
logLevel: "error",
|
||||
kind: "Kustomization",
|
||||
@@ -163,7 +107,7 @@ func TestLogRequest(t *testing.T) {
|
||||
|
||||
// reset flags to default
|
||||
*kubeconfigArgs.Namespace = rootArgs.defaults.Namespace
|
||||
logsArgs = &logsFlags{
|
||||
logsArgs = logsFlags{
|
||||
tail: -1,
|
||||
}
|
||||
})
|
||||
@@ -24,12 +24,14 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-logr/logr"
|
||||
"github.com/spf13/cobra"
|
||||
"golang.org/x/term"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/util/validation"
|
||||
"k8s.io/cli-runtime/pkg/genericclioptions"
|
||||
_ "k8s.io/client-go/plugin/pkg/client/auth"
|
||||
ctrllog "sigs.k8s.io/controller-runtime/pkg/log"
|
||||
|
||||
runclient "github.com/fluxcd/pkg/runtime/client"
|
||||
|
||||
@@ -170,6 +172,15 @@ func NewRootFlags() rootFlags {
|
||||
|
||||
func main() {
|
||||
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, ok := err.(*RequestError); ok {
|
||||
|
||||
@@ -365,6 +365,12 @@ func executeTemplate(content string, templateValues map[string]string) (string,
|
||||
// Run the command and return the captured output.
|
||||
func executeCommand(cmd string) (string, error) {
|
||||
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)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -392,6 +398,10 @@ func resetCmdArgs() {
|
||||
alertProviderArgs = alertProviderFlags{}
|
||||
bootstrapArgs = NewBootstrapFlags()
|
||||
bServerArgs = bServerFlags{}
|
||||
logsArgs = logsFlags{
|
||||
tail: -1,
|
||||
fluxNamespace: rootArgs.defaults.Namespace,
|
||||
}
|
||||
buildKsArgs = buildKsFlags{}
|
||||
checkArgs = checkFlags{}
|
||||
createArgs = createFlags{}
|
||||
|
||||
@@ -47,7 +47,7 @@ type copyable interface {
|
||||
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
|
||||
// objects and lists.
|
||||
type listAdapter interface {
|
||||
|
||||
@@ -21,10 +21,11 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/flags"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/flags"
|
||||
|
||||
oci "github.com/fluxcd/pkg/oci/client"
|
||||
)
|
||||
|
||||
@@ -67,11 +68,11 @@ func pullArtifactCmdRun(cmd *cobra.Command, args []string) error {
|
||||
ociURL := args[0]
|
||||
|
||||
if pullArtifactArgs.output == "" {
|
||||
return fmt.Errorf("invalid output path %s", pullArtifactArgs.output)
|
||||
return fmt.Errorf("output path cannot be empty")
|
||||
}
|
||||
|
||||
if fs, err := os.Stat(pullArtifactArgs.output); err != nil || !fs.IsDir() {
|
||||
return fmt.Errorf("invalid output path %s", pullArtifactArgs.output)
|
||||
return fmt.Errorf("invalid output path %q: %w", pullArtifactArgs.output, err)
|
||||
}
|
||||
|
||||
url, err := oci.ParseArtifactURL(ociURL)
|
||||
@@ -82,7 +83,7 @@ func pullArtifactCmdRun(cmd *cobra.Command, args []string) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
|
||||
defer cancel()
|
||||
|
||||
ociClient := oci.NewLocalClient()
|
||||
ociClient := oci.NewClient(oci.DefaultOptions())
|
||||
|
||||
if pullArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && pullArtifactArgs.creds != "" {
|
||||
logger.Actionf("logging in to registry with credentials")
|
||||
|
||||
@@ -22,14 +22,24 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/flags"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
"github.com/google/go-containerregistry/pkg/authn"
|
||||
"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"
|
||||
"github.com/google/go-containerregistry/pkg/v1/remote"
|
||||
"github.com/google/go-containerregistry/pkg/v1/remote/transport"
|
||||
"github.com/spf13/cobra"
|
||||
"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{
|
||||
@@ -79,7 +89,7 @@ The command can read the credentials from '~/.docker/config.json' but they can a
|
||||
# Login directly to the registry provider
|
||||
# You might need to export the following variable if you use local config files for AWS:
|
||||
# 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" \
|
||||
--source="$(git config --get remote.origin.url)" \
|
||||
--revision="$(git tag --points-at HEAD)@sha1:$(git rev-parse HEAD)" \
|
||||
@@ -104,6 +114,7 @@ type pushArtifactFlags struct {
|
||||
ignorePaths []string
|
||||
annotations []string
|
||||
output string
|
||||
debug bool
|
||||
}
|
||||
|
||||
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().StringVarP(&pushArtifactArgs.output, "output", "o", "",
|
||||
"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)
|
||||
}
|
||||
@@ -146,7 +158,12 @@ func pushArtifactCmdRun(cmd *cobra.Command, args []string) error {
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
@@ -174,7 +191,13 @@ func pushArtifactCmdRun(cmd *cobra.Command, args []string) error {
|
||||
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,
|
||||
Revision: pushArtifactArgs.revision,
|
||||
Annotations: annotations,
|
||||
@@ -183,13 +206,15 @@ func pushArtifactCmdRun(cmd *cobra.Command, args []string) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
|
||||
defer cancel()
|
||||
|
||||
ociClient := oci.NewLocalClient()
|
||||
|
||||
var auth authn.Authenticator
|
||||
opts := client.DefaultOptions()
|
||||
if pushArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && pushArtifactArgs.creds != "" {
|
||||
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)
|
||||
}
|
||||
opts = append(opts, crane.WithAuth(auth))
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
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 == "" {
|
||||
logger.Actionf("pushing artifact to %s", url)
|
||||
}
|
||||
|
||||
ociClient := client.NewClient(opts)
|
||||
digestURL, err := ociClient.Push(ctx, url, path, meta, pushArtifactArgs.ignorePaths)
|
||||
if err != nil {
|
||||
return fmt.Errorf("pushing artifact failed: %w", err)
|
||||
@@ -255,3 +308,16 @@ func pushArtifactCmdRun(cmd *cobra.Command, args []string) error {
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@@ -17,11 +17,12 @@ limitations under the License.
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
)
|
||||
|
||||
@@ -63,28 +64,20 @@ func (obj helmReleaseAdapter) reconcileSource() bool {
|
||||
return rhrArgs.syncHrWithSource
|
||||
}
|
||||
|
||||
func (obj helmReleaseAdapter) getSource() (reconcileCommand, types.NamespacedName) {
|
||||
var cmd reconcileCommand
|
||||
switch obj.Spec.Chart.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{}},
|
||||
}
|
||||
func (obj helmReleaseAdapter) getSource() (reconcileSource, types.NamespacedName) {
|
||||
cmd := reconcileWithSourceCommand{
|
||||
apiType: helmChartType,
|
||||
object: helmChartAdapter{&sourcev1b2.HelmChart{}},
|
||||
force: true,
|
||||
}
|
||||
|
||||
ns := obj.Spec.Chart.Spec.SourceRef.Namespace
|
||||
if ns == "" {
|
||||
ns = obj.Namespace
|
||||
}
|
||||
|
||||
return cmd, types.NamespacedName{
|
||||
Name: obj.Spec.Chart.Spec.SourceRef.Name,
|
||||
Namespace: obj.Spec.Chart.Spec.SourceRef.Namespace,
|
||||
Name: fmt.Sprintf("%s-%s", obj.Namespace, obj.Name),
|
||||
Namespace: ns,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ var reconcileImageRepositoryCmd = &cobra.Command{
|
||||
Long: `The reconcile image repository command triggers a reconciliation of an ImageRepository resource and waits for it to finish.`,
|
||||
Example: ` # Trigger an scan for an existing image repository
|
||||
flux reconcile image repository alpine`,
|
||||
ValidArgsFunction: resourceNamesCompletionFunc(imagev1.GroupVersion.WithKind(imagev1.ImagePolicyKind)),
|
||||
ValidArgsFunction: resourceNamesCompletionFunc(imagev1.GroupVersion.WithKind(imagev1.ImageRepositoryKind)),
|
||||
RunE: reconcileCommand{
|
||||
apiType: imageRepositoryType,
|
||||
object: imageRepositoryAdapter{&imagev1.ImageRepository{}},
|
||||
|
||||
@@ -63,7 +63,7 @@ func (obj kustomizationAdapter) reconcileSource() bool {
|
||||
return rksArgs.syncKsWithSource
|
||||
}
|
||||
|
||||
func (obj kustomizationAdapter) getSource() (reconcileCommand, types.NamespacedName) {
|
||||
func (obj kustomizationAdapter) getSource() (reconcileSource, types.NamespacedName) {
|
||||
var cmd reconcileCommand
|
||||
switch obj.Spec.SourceRef.Kind {
|
||||
case sourcev1b2.OCIRepositoryKind:
|
||||
|
||||
87
cmd/flux/reconcile_source_chart.go
Normal file
87
cmd/flux/reconcile_source_chart.go
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
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"
|
||||
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
|
||||
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(helmv2.GroupVersion.WithKind(helmv2.HelmReleaseKind)),
|
||||
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,
|
||||
}
|
||||
}
|
||||
@@ -18,12 +18,17 @@ type reconcileWithSource interface {
|
||||
adapter
|
||||
reconcilable
|
||||
reconcileSource() bool
|
||||
getSource() (reconcileCommand, types.NamespacedName)
|
||||
getSource() (reconcileSource, types.NamespacedName)
|
||||
}
|
||||
|
||||
type reconcileSource interface {
|
||||
run(cmd *cobra.Command, args []string) error
|
||||
}
|
||||
|
||||
type reconcileWithSourceCommand struct {
|
||||
apiType
|
||||
object reconcileWithSource
|
||||
force bool
|
||||
}
|
||||
|
||||
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")
|
||||
}
|
||||
|
||||
if reconcile.object.reconcileSource() {
|
||||
if reconcile.object.reconcileSource() || reconcile.force {
|
||||
reconcileCmd, nsName := reconcile.object.getSource()
|
||||
nsCopy := *kubeconfigArgs.Namespace
|
||||
if nsName.Namespace != "" {
|
||||
|
||||
@@ -19,6 +19,8 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
@@ -59,8 +61,10 @@ type resumable interface {
|
||||
|
||||
type resumeCommand struct {
|
||||
apiType
|
||||
object resumable
|
||||
list listResumable
|
||||
client client.WithWatch
|
||||
list listResumable
|
||||
namespace string
|
||||
shouldReconcile bool
|
||||
}
|
||||
|
||||
type listResumable interface {
|
||||
@@ -68,6 +72,11 @@ type listResumable interface {
|
||||
resumeItem(i int) resumable
|
||||
}
|
||||
|
||||
type reconcileResponse struct {
|
||||
resumable
|
||||
err error
|
||||
}
|
||||
|
||||
func (resume resumeCommand) run(cmd *cobra.Command, args []string) error {
|
||||
if len(args) < 1 && !resumeArgs.all {
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
resume.client = kubeClient
|
||||
resume.namespace = *kubeconfigArgs.Namespace
|
||||
|
||||
var listOpts []client.ListOption
|
||||
listOpts = append(listOpts, client.InNamespace(*kubeconfigArgs.Namespace))
|
||||
if len(args) > 0 {
|
||||
listOpts = append(listOpts, client.MatchingFields{
|
||||
"metadata.name": args[0],
|
||||
})
|
||||
}
|
||||
// require waiting for the object(s) if the user has not provided the --wait flag and gave exactly
|
||||
// one object to resume. This is necessary to maintain backwards compatibility with prior versions
|
||||
// of this command. Otherwise just follow the value of the --wait flag (including its default).
|
||||
resume.shouldReconcile = !resumeCmd.PersistentFlags().Changed("wait") && len(args) == 1 || resumeArgs.wait
|
||||
|
||||
err = kubeClient.List(ctx, resume.list.asClientList(), listOpts...)
|
||||
resumables, err := resume.getPatchedResumables(ctx, args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if resume.list.len() == 0 {
|
||||
logger.Failuref("no %s objects found in %s namespace", resume.kind, *kubeconfigArgs.Namespace)
|
||||
return nil
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(len(resumables))
|
||||
|
||||
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++ {
|
||||
logger.Actionf("resuming %s %s in %s namespace", resume.humanKind, resume.list.resumeItem(i).asClientObject().GetName(), *kubeconfigArgs.Namespace)
|
||||
obj := resume.list.resumeItem(i)
|
||||
patch := client.MergeFrom(obj.deepCopyClientObject())
|
||||
obj.setUnsuspended()
|
||||
if err := kubeClient.Patch(ctx, obj.asClientObject(), patch); err != nil {
|
||||
return err
|
||||
}
|
||||
go func() {
|
||||
defer close(resultChan)
|
||||
wg.Wait()
|
||||
}()
|
||||
|
||||
logger.Successf("%s resumed", resume.humanKind)
|
||||
|
||||
if resumeArgs.wait || !resumeArgs.all {
|
||||
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())
|
||||
}
|
||||
reconcileResps := make([]reconcileResponse, 0, len(resumables))
|
||||
for c := range resultChan {
|
||||
reconcileResps = append(reconcileResps, c)
|
||||
}
|
||||
|
||||
resume.printMessage(reconcileResps)
|
||||
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
finish the apply.`,
|
||||
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)),
|
||||
RunE: resumeCommand{
|
||||
apiType: alertType,
|
||||
object: alertAdapter{¬ificationv1.Alert{}},
|
||||
list: &alertListAdapter{¬ificationv1.AlertList{}},
|
||||
}.run,
|
||||
}
|
||||
|
||||
@@ -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
|
||||
finish the apply.`,
|
||||
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)),
|
||||
RunE: resumeCommand{
|
||||
apiType: helmReleaseType,
|
||||
object: helmReleaseAdapter{&helmv2.HelmRelease{}},
|
||||
list: helmReleaseListAdapter{&helmv2.HelmReleaseList{}},
|
||||
}.run,
|
||||
}
|
||||
|
||||
@@ -27,11 +27,13 @@ var resumeImageRepositoryCmd = &cobra.Command{
|
||||
Short: "Resume a suspended ImageRepository",
|
||||
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
|
||||
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)),
|
||||
RunE: resumeCommand{
|
||||
apiType: imageRepositoryType,
|
||||
object: imageRepositoryAdapter{&imagev1.ImageRepository{}},
|
||||
list: imageRepositoryListAdapter{&imagev1.ImageRepositoryList{}},
|
||||
}.run,
|
||||
}
|
||||
|
||||
@@ -27,11 +27,13 @@ var resumeImageUpdateCmd = &cobra.Command{
|
||||
Short: "Resume a suspended ImageUpdateAutomation",
|
||||
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
|
||||
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)),
|
||||
RunE: resumeCommand{
|
||||
apiType: imageUpdateAutomationType,
|
||||
object: imageUpdateAutomationAdapter{&autov1.ImageUpdateAutomation{}},
|
||||
list: imageUpdateAutomationListAdapter{&autov1.ImageUpdateAutomationList{}},
|
||||
}.run,
|
||||
}
|
||||
|
||||
@@ -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
|
||||
finish the apply.`,
|
||||
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)),
|
||||
RunE: resumeCommand{
|
||||
apiType: kustomizationType,
|
||||
object: kustomizationAdapter{&kustomizev1.Kustomization{}},
|
||||
list: kustomizationListAdapter{&kustomizev1.KustomizationList{}},
|
||||
}.run,
|
||||
}
|
||||
|
||||
@@ -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
|
||||
finish the apply.`,
|
||||
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)),
|
||||
RunE: resumeCommand{
|
||||
apiType: receiverType,
|
||||
object: receiverAdapter{¬ificationv1.Receiver{}},
|
||||
list: receiverListAdapter{¬ificationv1.ReceiverList{}},
|
||||
}.run,
|
||||
}
|
||||
|
||||
@@ -27,11 +27,13 @@ var resumeSourceBucketCmd = &cobra.Command{
|
||||
Short: "Resume a suspended Bucket",
|
||||
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
|
||||
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)),
|
||||
RunE: resumeCommand{
|
||||
apiType: bucketType,
|
||||
object: bucketAdapter{&sourcev1.Bucket{}},
|
||||
list: bucketListAdapter{&sourcev1.BucketList{}},
|
||||
}.run,
|
||||
}
|
||||
|
||||
@@ -29,11 +29,13 @@ var resumeSourceHelmChartCmd = &cobra.Command{
|
||||
Short: "Resume a suspended HelmChart",
|
||||
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
|
||||
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)),
|
||||
RunE: resumeCommand{
|
||||
apiType: helmChartType,
|
||||
object: &helmChartAdapter{&sourcev1.HelmChart{}},
|
||||
list: &helmChartListAdapter{&sourcev1.HelmChartList{}},
|
||||
}.run,
|
||||
}
|
||||
|
||||
@@ -27,11 +27,13 @@ var resumeSourceGitCmd = &cobra.Command{
|
||||
Short: "Resume a suspended GitRepository",
|
||||
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
|
||||
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)),
|
||||
RunE: resumeCommand{
|
||||
apiType: gitRepositoryType,
|
||||
object: gitRepositoryAdapter{&sourcev1.GitRepository{}},
|
||||
list: gitRepositoryListAdapter{&sourcev1.GitRepositoryList{}},
|
||||
}.run,
|
||||
}
|
||||
|
||||
@@ -27,11 +27,13 @@ var resumeSourceHelmCmd = &cobra.Command{
|
||||
Short: "Resume a suspended HelmRepository",
|
||||
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
|
||||
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)),
|
||||
RunE: resumeCommand{
|
||||
apiType: helmRepositoryType,
|
||||
object: helmRepositoryAdapter{&sourcev1.HelmRepository{}},
|
||||
list: helmRepositoryListAdapter{&sourcev1.HelmRepositoryList{}},
|
||||
}.run,
|
||||
}
|
||||
|
||||
@@ -27,11 +27,13 @@ var resumeSourceOCIRepositoryCmd = &cobra.Command{
|
||||
Short: "Resume a suspended OCIRepository",
|
||||
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
|
||||
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)),
|
||||
RunE: resumeCommand{
|
||||
apiType: ociRepositoryType,
|
||||
object: ociRepositoryAdapter{&sourcev1.OCIRepository{}},
|
||||
list: ociRepositoryListAdapter{&sourcev1.OCIRepositoryList{}},
|
||||
}.run,
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
@@ -75,22 +76,53 @@ func (suspend suspendCommand) run(cmd *cobra.Command, args []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
var listOpts []client.ListOption
|
||||
listOpts = append(listOpts, client.InNamespace(*kubeconfigArgs.Namespace))
|
||||
if len(args) > 0 {
|
||||
listOpts = append(listOpts, client.MatchingFields{
|
||||
"metadata.name": args[0],
|
||||
})
|
||||
if len(args) < 1 && suspendArgs.all {
|
||||
listOpts := []client.ListOption{
|
||||
client.InNamespace(*kubeconfigArgs.Namespace),
|
||||
}
|
||||
|
||||
if err := suspend.patch(ctx, kubeClient, listOpts); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
err = kubeClient.List(ctx, suspend.list.asClientList(), listOpts...)
|
||||
if err != nil {
|
||||
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{}{}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
if suspend.list.len() == 0 {
|
||||
logger.Failuref("no %s objects found in %s namespace", suspend.kind, *kubeconfigArgs.Namespace)
|
||||
return nil
|
||||
return ErrNoObjectsFound
|
||||
}
|
||||
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
logger.Successf("%s suspended", suspend.humanKind)
|
||||
|
||||
logger.Successf("%s suspended", suspend.humanKind)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -27,7 +27,10 @@ var suspendAlertCmd = &cobra.Command{
|
||||
Short: "Suspend reconciliation of Alert",
|
||||
Long: `The suspend command disables the reconciliation of a Alert resource.`,
|
||||
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)),
|
||||
RunE: suspendCommand{
|
||||
apiType: alertType,
|
||||
|
||||
@@ -28,7 +28,10 @@ var suspendHrCmd = &cobra.Command{
|
||||
Short: "Suspend reconciliation of HelmRelease",
|
||||
Long: `The suspend command disables the reconciliation of a HelmRelease resource.`,
|
||||
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)),
|
||||
RunE: suspendCommand{
|
||||
apiType: helmReleaseType,
|
||||
|
||||
@@ -27,7 +27,10 @@ var suspendImageRepositoryCmd = &cobra.Command{
|
||||
Short: "Suspend reconciliation of an ImageRepository",
|
||||
Long: `The suspend image repository command disables the reconciliation of a ImageRepository resource.`,
|
||||
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)),
|
||||
RunE: suspendCommand{
|
||||
apiType: imageRepositoryType,
|
||||
|
||||
@@ -27,7 +27,10 @@ var suspendImageUpdateCmd = &cobra.Command{
|
||||
Short: "Suspend reconciliation of an ImageUpdateAutomation",
|
||||
Long: `The suspend image update command disables the reconciliation of a ImageUpdateAutomation resource.`,
|
||||
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)),
|
||||
RunE: suspendCommand{
|
||||
apiType: imageUpdateAutomationType,
|
||||
|
||||
@@ -28,7 +28,10 @@ var suspendKsCmd = &cobra.Command{
|
||||
Short: "Suspend reconciliation of Kustomization",
|
||||
Long: `The suspend command disables the reconciliation of a Kustomization resource.`,
|
||||
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)),
|
||||
RunE: suspendCommand{
|
||||
apiType: kustomizationType,
|
||||
|
||||
@@ -27,7 +27,10 @@ var suspendReceiverCmd = &cobra.Command{
|
||||
Short: "Suspend reconciliation of Receiver",
|
||||
Long: `The suspend command disables the reconciliation of a Receiver resource.`,
|
||||
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)),
|
||||
RunE: suspendCommand{
|
||||
apiType: receiverType,
|
||||
|
||||
@@ -27,7 +27,10 @@ var suspendSourceBucketCmd = &cobra.Command{
|
||||
Short: "Suspend reconciliation of a Bucket",
|
||||
Long: `The suspend command disables the reconciliation of a Bucket resource.`,
|
||||
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)),
|
||||
RunE: suspendCommand{
|
||||
apiType: bucketType,
|
||||
|
||||
@@ -27,7 +27,10 @@ var suspendSourceHelmChartCmd = &cobra.Command{
|
||||
Short: "Suspend reconciliation of a HelmChart",
|
||||
Long: `The suspend command disables the reconciliation of a HelmChart resource.`,
|
||||
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)),
|
||||
RunE: suspendCommand{
|
||||
apiType: helmChartType,
|
||||
|
||||
@@ -27,7 +27,10 @@ var suspendSourceGitCmd = &cobra.Command{
|
||||
Short: "Suspend reconciliation of a GitRepository",
|
||||
Long: `The suspend command disables the reconciliation of a GitRepository resource.`,
|
||||
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)),
|
||||
RunE: suspendCommand{
|
||||
apiType: gitRepositoryType,
|
||||
|
||||
@@ -27,7 +27,10 @@ var suspendSourceHelmCmd = &cobra.Command{
|
||||
Short: "Suspend reconciliation of a HelmRepository",
|
||||
Long: `The suspend command disables the reconciliation of a HelmRepository resource.`,
|
||||
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)),
|
||||
RunE: suspendCommand{
|
||||
apiType: helmRepositoryType,
|
||||
|
||||
@@ -27,7 +27,10 @@ var suspendSourceOCIRepositoryCmd = &cobra.Command{
|
||||
Short: "Suspend reconciliation of an OCIRepository",
|
||||
Long: `The suspend command disables the reconciliation of an OCIRepository resource.`,
|
||||
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)),
|
||||
RunE: suspendCommand{
|
||||
apiType: ociRepositoryType,
|
||||
|
||||
@@ -78,7 +78,7 @@ func tagArtifactCmdRun(cmd *cobra.Command, args []string) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
|
||||
defer cancel()
|
||||
|
||||
ociClient := oci.NewLocalClient()
|
||||
ociClient := oci.NewClient(oci.DefaultOptions())
|
||||
|
||||
if tagArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && tagArtifactArgs.creds != "" {
|
||||
logger.Actionf("logging in to registry with credentials")
|
||||
|
||||
2
cmd/flux/testdata/check/check_pre.golden
vendored
2
cmd/flux/testdata/check/check_pre.golden
vendored
@@ -1,3 +1,3 @@
|
||||
► checking prerequisites
|
||||
✔ Kubernetes {{ .serverVersion }} >=1.20.6-0
|
||||
✔ Kubernetes {{ .serverVersion }} >=1.24.0-0
|
||||
✔ prerequisites checks passed
|
||||
|
||||
4
cmd/flux/testdata/get/get.golden
vendored
Normal file
4
cmd/flux/testdata/get/get.golden
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
NAME REVISION SUSPENDED READY MESSAGE
|
||||
podinfo main@sha1:696f056d False True Fetched revision: main@sha1:696f056d
|
||||
podinfo-shard1 main@sha1:696f056d False True Fetched revision: main@sha1:696f056d
|
||||
podinfo-shard2 main@sha1:696f056d False True Fetched revision: main@sha1:696f056d
|
||||
2
cmd/flux/testdata/get/get_label_one.golden
vendored
Normal file
2
cmd/flux/testdata/get/get_label_one.golden
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
NAME REVISION SUSPENDED READY MESSAGE
|
||||
podinfo-shard1 main@sha1:696f056d False True Fetched revision: main@sha1:696f056d
|
||||
2
cmd/flux/testdata/get/get_label_two.golden
vendored
Normal file
2
cmd/flux/testdata/get/get_label_two.golden
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
NAME REVISION SUSPENDED READY MESSAGE
|
||||
podinfo main@sha1:696f056d False True Fetched revision: main@sha1:696f056d
|
||||
91
cmd/flux/testdata/get/objects.yaml
vendored
Normal file
91
cmd/flux/testdata/get/objects.yaml
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: {{ .fluxns }}
|
||||
---
|
||||
apiVersion: source.toolkit.fluxcd.io/v1
|
||||
kind: GitRepository
|
||||
metadata:
|
||||
labels:
|
||||
kustomize.toolkit.fluxcd.io/name: flux-system
|
||||
kustomize.toolkit.fluxcd.io/namespace: {{ .fluxns }}
|
||||
name: podinfo
|
||||
namespace: {{ .fluxns }}
|
||||
spec:
|
||||
ref:
|
||||
branch: main
|
||||
secretRef:
|
||||
name: flux-system
|
||||
url: ssh://git@github.com/example/repo
|
||||
interval: 5m
|
||||
status:
|
||||
artifact:
|
||||
lastUpdateTime: "2021-08-01T04:28:42Z"
|
||||
revision: main@sha1:696f056df216eea4f9401adbee0ff744d4df390f
|
||||
path: "example"
|
||||
url: "example"
|
||||
conditions:
|
||||
- lastTransitionTime: "2021-07-20T00:48:16Z"
|
||||
message: 'Fetched revision: main@sha1:696f056df216eea4f9401adbee0ff744d4df390f'
|
||||
reason: GitOperationSucceed
|
||||
status: "True"
|
||||
type: Ready
|
||||
---
|
||||
apiVersion: source.toolkit.fluxcd.io/v1
|
||||
kind: GitRepository
|
||||
metadata:
|
||||
labels:
|
||||
kustomize.toolkit.fluxcd.io/name: flux-system
|
||||
kustomize.toolkit.fluxcd.io/namespace: {{ .fluxns }}
|
||||
sharding.fluxcd.io/key: shard1
|
||||
name: podinfo-shard1
|
||||
namespace: {{ .fluxns }}
|
||||
spec:
|
||||
ref:
|
||||
branch: main
|
||||
secretRef:
|
||||
name: flux-system
|
||||
url: ssh://git@github.com/example/repo
|
||||
interval: 5m
|
||||
status:
|
||||
artifact:
|
||||
lastUpdateTime: "2021-08-01T04:28:42Z"
|
||||
revision: main@sha1:696f056df216eea4f9401adbee0ff744d4df390f
|
||||
path: "example"
|
||||
url: "example"
|
||||
conditions:
|
||||
- lastTransitionTime: "2021-07-20T00:48:16Z"
|
||||
message: 'Fetched revision: main@sha1:696f056df216eea4f9401adbee0ff744d4df390f'
|
||||
reason: GitOperationSucceed
|
||||
status: "True"
|
||||
type: Ready
|
||||
---
|
||||
apiVersion: source.toolkit.fluxcd.io/v1
|
||||
kind: GitRepository
|
||||
metadata:
|
||||
labels:
|
||||
kustomize.toolkit.fluxcd.io/name: flux-system
|
||||
kustomize.toolkit.fluxcd.io/namespace: {{ .fluxns }}
|
||||
sharding.fluxcd.io/key: shard2
|
||||
name: podinfo-shard2
|
||||
namespace: {{ .fluxns }}
|
||||
spec:
|
||||
ref:
|
||||
branch: main
|
||||
secretRef:
|
||||
name: flux-system
|
||||
url: ssh://git@github.com/example/repo
|
||||
interval: 5m
|
||||
status:
|
||||
artifact:
|
||||
lastUpdateTime: "2021-08-01T04:28:42Z"
|
||||
revision: main@sha1:696f056df216eea4f9401adbee0ff744d4df390f
|
||||
path: "example"
|
||||
url: "example"
|
||||
conditions:
|
||||
- lastTransitionTime: "2021-07-20T00:48:16Z"
|
||||
message: 'Fetched revision: main@sha1:696f056df216eea4f9401adbee0ff744d4df390f'
|
||||
reason: GitOperationSucceed
|
||||
status: "True"
|
||||
type: Ready
|
||||
@@ -2,6 +2,10 @@
|
||||
✔ GitRepository annotated
|
||||
◎ waiting for GitRepository reconciliation
|
||||
✔ 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
|
||||
✔ HelmRelease annotated
|
||||
◎ waiting for HelmRelease reconciliation
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
► resuming helmrelease thrfg in {{ .ns }} namespace
|
||||
✔ helmrelease resumed
|
||||
◎ waiting for HelmRelease reconciliation
|
||||
✔ HelmRelease reconciliation completed
|
||||
✔ HelmRelease thrfg reconciliation completed
|
||||
✔ applied revision 6.3.5
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
► resuming kustomization tkfg in {{ .ns }} namespace
|
||||
✔ kustomization resumed
|
||||
◎ waiting for Kustomization reconciliation
|
||||
✔ Kustomization reconciliation completed
|
||||
✔ Kustomization tkfg reconciliation completed
|
||||
✔ applied revision 6.3.5@sha1:67e2c98a60dc92283531412a9e604dd4bae005a9
|
||||
|
||||
2
cmd/flux/testdata/kustomization/resume_kustomization_from_git_multiple_args.golden
vendored
Normal file
2
cmd/flux/testdata/kustomization/resume_kustomization_from_git_multiple_args.golden
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
► resuming kustomization tkfg in {{ .ns }} namespace
|
||||
✔ kustomization resumed
|
||||
6
cmd/flux/testdata/kustomization/resume_kustomization_from_git_multiple_args_wait.golden
vendored
Normal file
6
cmd/flux/testdata/kustomization/resume_kustomization_from_git_multiple_args_wait.golden
vendored
Normal 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
|
||||
4
cmd/flux/testdata/kustomization/suspend_kustomization_from_git_multiple_args.golden
vendored
Normal file
4
cmd/flux/testdata/kustomization/suspend_kustomization_from_git_multiple_args.golden
vendored
Normal 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
|
||||
2
cmd/flux/testdata/oci/resume_oci.golden
vendored
2
cmd/flux/testdata/oci/resume_oci.golden
vendored
@@ -1,5 +1,5 @@
|
||||
► resuming source oci thrfg in {{ .ns }} namespace
|
||||
✔ source oci resumed
|
||||
◎ waiting for OCIRepository reconciliation
|
||||
✔ OCIRepository reconciliation completed
|
||||
✔ OCIRepository thrfg reconciliation completed
|
||||
✔ fetched revision 6.3.5@sha256:6c959c51ccbb952e5fe4737563338a0aaf975675dcf812912cf09e5463181871
|
||||
|
||||
@@ -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 |
@@ -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!
|
||||
@@ -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
|
||||
```
|
||||
|
||||
@@ -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))
|
||||
9
docs/release/README.md
Normal file
9
docs/release/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Flux Dev Documentation
|
||||
|
||||
## Release specifications
|
||||
|
||||
- [Flux distribution](https://fluxcd.io/flux/releases/)
|
||||
- [Flux APIs and controllers](https://fluxcd.io/flux/releases/controllers/)
|
||||
- [Flux shared packages](https://fluxcd.io/flux/releases/packages/)
|
||||
- [Flux release procedures](https://fluxcd.io/flux/releases/procedure/)
|
||||
- [Flux release notes template](release-notes-template.md)
|
||||
72
docs/release/release-notes-template.md
Normal file
72
docs/release/release-notes-template.md
Normal file
@@ -0,0 +1,72 @@
|
||||
# Flux release note template
|
||||
|
||||
This is a template for release notes. It is intended to be used as a
|
||||
starting point for writing release notes for a new release. It should be copied
|
||||
to a temporary file, and then edited to reflect the changes in the release.
|
||||
|
||||
Once the release notes are complete, you can tag the release and push it to
|
||||
GitHub.
|
||||
|
||||
After the release is tagged, the CI will build the release artifacts and upload
|
||||
them to the GitHub release page. The release notes can then be copied from the
|
||||
temporary file to the GitHub release page.
|
||||
|
||||
The release notes should be formatted using [Markdown](https://guides.github.com/features/mastering-markdown/),
|
||||
and not make use of line breaks unless they function as paragraph breaks.
|
||||
|
||||
For examples of release notes, including language and formatting of the release
|
||||
highlights, see the [Flux release notes](https://github.com/fluxcd/flux2/releases).
|
||||
|
||||
## GitHub release template
|
||||
|
||||
The following template can be used for the GitHub release page:
|
||||
|
||||
```markdown
|
||||
## Highlights
|
||||
|
||||
<!-- Text describing the most important changes in this release -->
|
||||
|
||||
### Fixes and improvements
|
||||
|
||||
<!-- List of fixes and improvements to the controllers and CLI -->
|
||||
|
||||
## New documentation
|
||||
|
||||
<!-- List of new documentation pages, if applicable -->
|
||||
|
||||
## Components changelog
|
||||
|
||||
- <name>-controller [v<version>](https://github.com/fluxcd/<name>-controller/blob/<version>/CHANGELOG.md
|
||||
|
||||
## CLI changelog
|
||||
|
||||
<!-- auto-generated list of pull requests to the CLI starts here -->
|
||||
```
|
||||
|
||||
In some scenarios, you may want to include specific information about API
|
||||
changes and/or upgrade procedures. Consult [the formatting of
|
||||
`v2.0.0-rc.1`](https://github.com/fluxcd/flux2/releases/tag/v2.0.0-rc.1) for
|
||||
such an example.
|
||||
|
||||
## Slack message template
|
||||
|
||||
The following template can be used for the Slack release message:
|
||||
|
||||
```markdown
|
||||
:sparkles: *We are pleased to announce the release of Flux [<version>](https://github.com/fluxcd/flux2/releases/tag/<version>/)!*
|
||||
|
||||
<!-- Brief description of most important changes to this release -->
|
||||
|
||||
:hammer_and_pick: *Fixes and improvements*
|
||||
|
||||
<!-- List of fixes and improvements as in the GitHub release template -->
|
||||
|
||||
:books: Documentation
|
||||
|
||||
<!-- List of new documentation pages, if applicable -->
|
||||
|
||||
:heart: Big thanks to all the Flux contributors that helped us with this release!
|
||||
```
|
||||
|
||||
For more concrete examples, see the pinned messages in the [Flux Slack
|
||||
channel](https://cloud-native.slack.com/archives/CLAJ40HV3).
|
||||
197
go.mod
197
go.mod
@@ -1,58 +1,62 @@
|
||||
module github.com/fluxcd/flux2/v2
|
||||
|
||||
go 1.18
|
||||
go 1.20
|
||||
|
||||
// Replace go-git to unreleased v5.8.0 to improve support for Git v2.41+.
|
||||
replace github.com/go-git/go-git/v5 => github.com/go-git/go-git/v5 v5.7.1-0.20230702134234-dd4e2b7f4b01
|
||||
|
||||
require (
|
||||
github.com/Masterminds/semver/v3 v3.2.0
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20230331115716-d34776aa93ec
|
||||
github.com/Masterminds/semver/v3 v3.2.1
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20230710112148-e01326fd72eb
|
||||
github.com/cyphar/filepath-securejoin v0.2.3
|
||||
github.com/distribution/distribution/v3 v3.0.0-20230327091844-0c958010ace2
|
||||
github.com/fluxcd/go-git-providers v0.15.0
|
||||
github.com/fluxcd/go-git/v5 v5.0.0-20221219190809-2e5c9d01cfc4
|
||||
github.com/fluxcd/helm-controller/api v0.32.1
|
||||
github.com/fluxcd/image-automation-controller/api v0.32.0
|
||||
github.com/fluxcd/image-reflector-controller/api v0.27.0
|
||||
github.com/fluxcd/kustomize-controller/api v1.0.0-rc.1
|
||||
github.com/fluxcd/notification-controller/api v1.0.0-rc.1
|
||||
github.com/fluxcd/pkg/apis/event v0.4.1
|
||||
github.com/fluxcd/pkg/apis/meta v1.0.0
|
||||
github.com/fluxcd/pkg/git v0.11.0
|
||||
github.com/fluxcd/pkg/git/gogit v0.8.1
|
||||
github.com/fluxcd/pkg/kustomize v1.1.1
|
||||
github.com/fluxcd/pkg/oci v0.22.0
|
||||
github.com/fluxcd/pkg/runtime v0.35.0
|
||||
github.com/fluxcd/pkg/sourceignore v0.3.3
|
||||
github.com/fluxcd/pkg/ssa v0.27.0
|
||||
github.com/fluxcd/pkg/ssh v0.7.3
|
||||
github.com/fluxcd/pkg/untar v0.2.0
|
||||
github.com/fluxcd/pkg/version v0.2.1
|
||||
github.com/fluxcd/source-controller/api v1.0.0-rc.1
|
||||
github.com/distribution/distribution/v3 v3.0.0-20230711080520-40ef2353fa4f
|
||||
github.com/fluxcd/go-git-providers v0.18.0
|
||||
github.com/fluxcd/helm-controller/api v0.35.0
|
||||
github.com/fluxcd/image-automation-controller/api v0.35.0
|
||||
github.com/fluxcd/image-reflector-controller/api v0.29.1
|
||||
github.com/fluxcd/kustomize-controller/api v1.0.1
|
||||
github.com/fluxcd/notification-controller/api v1.0.0
|
||||
github.com/fluxcd/pkg/apis/event v0.5.1
|
||||
github.com/fluxcd/pkg/apis/meta v1.1.1
|
||||
github.com/fluxcd/pkg/git v0.12.3
|
||||
github.com/fluxcd/pkg/git/gogit v0.12.1
|
||||
github.com/fluxcd/pkg/kustomize v1.3.4
|
||||
github.com/fluxcd/pkg/oci v0.29.0
|
||||
github.com/fluxcd/pkg/runtime v0.40.0
|
||||
github.com/fluxcd/pkg/sourceignore v0.3.4
|
||||
github.com/fluxcd/pkg/ssa v0.28.2
|
||||
github.com/fluxcd/pkg/ssh v0.8.0
|
||||
github.com/fluxcd/pkg/tar v0.2.0
|
||||
github.com/fluxcd/pkg/version v0.2.2
|
||||
github.com/fluxcd/source-controller/api v1.0.1
|
||||
github.com/go-git/go-git/v5 v5.7.0
|
||||
github.com/go-logr/logr v1.2.4
|
||||
github.com/gonvenience/bunt v1.3.5
|
||||
github.com/gonvenience/ytbx v1.4.4
|
||||
github.com/google/go-cmp v0.5.9
|
||||
github.com/google/go-containerregistry v0.14.0
|
||||
github.com/homeport/dyff v1.5.6
|
||||
github.com/google/go-containerregistry v0.15.2
|
||||
github.com/homeport/dyff v1.5.8
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0
|
||||
github.com/manifoldco/promptui v0.9.0
|
||||
github.com/mattn/go-shellwords v1.0.12
|
||||
github.com/olekukonko/tablewriter v0.0.5
|
||||
github.com/onsi/gomega v1.27.6
|
||||
github.com/onsi/gomega v1.27.8
|
||||
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5
|
||||
github.com/spf13/cobra v1.7.0
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/theckman/yacspin v0.13.12
|
||||
golang.org/x/crypto v0.7.0
|
||||
golang.org/x/term v0.7.0
|
||||
k8s.io/api v0.26.3
|
||||
k8s.io/apiextensions-apiserver v0.26.3
|
||||
k8s.io/apimachinery v0.26.3
|
||||
k8s.io/cli-runtime v0.26.3
|
||||
k8s.io/client-go v0.26.3
|
||||
k8s.io/kubectl v0.26.3
|
||||
golang.org/x/crypto v0.11.0
|
||||
golang.org/x/term v0.10.0
|
||||
k8s.io/api v0.27.3
|
||||
k8s.io/apiextensions-apiserver v0.27.3
|
||||
k8s.io/apimachinery v0.27.3
|
||||
k8s.io/cli-runtime v0.27.3
|
||||
k8s.io/client-go v0.27.3
|
||||
k8s.io/kubectl v0.27.3
|
||||
sigs.k8s.io/cli-utils v0.34.0
|
||||
sigs.k8s.io/controller-runtime v0.14.6
|
||||
sigs.k8s.io/kustomize/api v0.12.1
|
||||
sigs.k8s.io/kustomize/kyaml v0.13.9
|
||||
sigs.k8s.io/controller-runtime v0.15.0
|
||||
sigs.k8s.io/kustomize/api v0.13.4
|
||||
sigs.k8s.io/kustomize/kyaml v0.14.2
|
||||
sigs.k8s.io/yaml v1.3.0
|
||||
)
|
||||
|
||||
@@ -60,44 +64,44 @@ require (
|
||||
replace gopkg.in/yaml.v3 => gopkg.in/yaml.v3 v3.0.1
|
||||
|
||||
require (
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.5.0-beta.1 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0-beta.4 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect
|
||||
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect
|
||||
github.com/BurntSushi/toml v1.0.0 // indirect
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect
|
||||
github.com/BurntSushi/toml v1.3.2 // indirect
|
||||
github.com/MakeNowJust/heredoc v1.0.0 // indirect
|
||||
github.com/Microsoft/go-winio v0.6.0 // indirect
|
||||
github.com/Microsoft/go-winio v0.6.1 // indirect
|
||||
github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d // indirect
|
||||
github.com/acomagu/bufpipe v1.0.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2 v1.17.7 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/config v1.18.19 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.13.18 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.31 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.25 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.32 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ecr v1.18.7 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.25 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.12.6 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.6 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.18.7 // indirect
|
||||
github.com/acomagu/bufpipe v1.0.4 // indirect
|
||||
github.com/aws/aws-sdk-go-v2 v1.18.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/config v1.18.27 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.13.26 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.4 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.34 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.28 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.35 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ecr v1.18.13 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.28 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.12.12 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.12 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.19.2 // indirect
|
||||
github.com/aws/smithy-go v1.13.5 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bshuster-repo/logrus-logstash-hook v1.0.0 // indirect
|
||||
github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd // indirect
|
||||
github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b // indirect
|
||||
github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/chai2010/gettext-go v1.0.2 // indirect
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
|
||||
github.com/cloudflare/circl v1.3.2 // indirect
|
||||
github.com/cloudflare/circl v1.3.3 // indirect
|
||||
github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/docker/cli v23.0.1+incompatible // indirect
|
||||
github.com/docker/distribution v2.8.1+incompatible // indirect
|
||||
github.com/docker/docker v23.0.3+incompatible // indirect
|
||||
github.com/docker/cli v23.0.5+incompatible // indirect
|
||||
github.com/docker/distribution v2.8.2+incompatible // indirect
|
||||
github.com/docker/docker v23.0.5+incompatible // indirect
|
||||
github.com/docker/docker-credential-helpers v0.7.0 // indirect
|
||||
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
|
||||
github.com/docker/go-metrics v0.0.1 // indirect
|
||||
@@ -111,29 +115,26 @@ require (
|
||||
github.com/fatih/color v1.13.0 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.3 // indirect
|
||||
github.com/fluxcd/pkg/apis/acl v0.1.0 // indirect
|
||||
github.com/fluxcd/pkg/apis/kustomize v1.0.0 // indirect
|
||||
github.com/fluxcd/pkg/tar v0.2.0 // indirect
|
||||
github.com/fluxcd/pkg/apis/kustomize v1.1.1 // indirect
|
||||
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
||||
github.com/go-errors/errors v1.4.2 // indirect
|
||||
github.com/go-git/gcfg v1.5.0 // indirect
|
||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.4.1 // indirect
|
||||
github.com/go-git/go-git/v5 v5.4.2 // indirect
|
||||
github.com/go-logr/logr v1.2.4 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.19.6 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.1 // indirect
|
||||
github.com/go-openapi/swag v0.22.3 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.4.3 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/gomodule/redigo v1.8.2 // indirect
|
||||
github.com/gonvenience/neat v1.3.11 // indirect
|
||||
github.com/gonvenience/neat v1.3.12 // indirect
|
||||
github.com/gonvenience/term v1.0.2 // indirect
|
||||
github.com/gonvenience/text v1.0.7 // indirect
|
||||
github.com/gonvenience/wrap v1.1.2 // indirect
|
||||
github.com/google/btree v1.1.2 // indirect
|
||||
github.com/google/gnostic v0.6.9 // indirect
|
||||
github.com/google/go-github/v49 v49.1.0 // indirect
|
||||
github.com/google/go-github/v52 v52.0.0 // indirect
|
||||
github.com/google/go-querystring v1.1.0 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
||||
@@ -144,22 +145,22 @@ require (
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-retryablehttp v0.7.2 // indirect
|
||||
github.com/hashicorp/go-retryablehttp v0.7.4 // indirect
|
||||
github.com/hashicorp/golang-lru v0.5.4 // indirect
|
||||
github.com/imdario/mergo v0.3.13 // indirect
|
||||
github.com/imdario/mergo v0.3.15 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
||||
github.com/klauspost/compress v1.16.0 // indirect
|
||||
github.com/klauspost/compress v1.16.5 // indirect
|
||||
github.com/kylelemons/godebug v1.1.0 // indirect
|
||||
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattn/go-ciede2000 v0.0.0-20170301095244-782e8c62fec3 // indirect
|
||||
github.com/mattn/go-colorable v0.1.12 // indirect
|
||||
github.com/mattn/go-isatty v0.0.18 // indirect
|
||||
github.com/mattn/go-isatty v0.0.19 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.13 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
@@ -167,55 +168,55 @@ require (
|
||||
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
|
||||
github.com/mitchellh/hashstructure v1.1.0 // indirect
|
||||
github.com/moby/spdystream v0.2.0 // indirect
|
||||
github.com/moby/term v0.0.0-20221105221325-4eb28fa6025c // indirect
|
||||
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/opencontainers/go-digest v1.0.0 // indirect
|
||||
github.com/opencontainers/image-spec v1.1.0-rc2 // indirect
|
||||
github.com/opencontainers/image-spec v1.1.0-rc3 // indirect
|
||||
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
|
||||
github.com/pjbgf/sha1cd v0.2.3 // indirect
|
||||
github.com/pjbgf/sha1cd v0.3.0 // indirect
|
||||
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/prometheus/client_golang v1.14.0 // indirect
|
||||
github.com/prometheus/client_model v0.3.0 // indirect
|
||||
github.com/prometheus/common v0.37.0 // indirect
|
||||
github.com/prometheus/procfs v0.8.0 // indirect
|
||||
github.com/prometheus/client_golang v1.16.0 // indirect
|
||||
github.com/prometheus/client_model v0.4.0 // indirect
|
||||
github.com/prometheus/common v0.42.0 // indirect
|
||||
github.com/prometheus/procfs v0.10.1 // indirect
|
||||
github.com/rivo/uniseg v0.2.0 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/sergi/go-diff v1.3.1 // indirect
|
||||
github.com/sirupsen/logrus v1.9.0 // indirect
|
||||
github.com/skeema/knownhosts v1.1.0 // indirect
|
||||
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||
github.com/skeema/knownhosts v1.1.1 // indirect
|
||||
github.com/texttheater/golang-levenshtein v1.0.1 // indirect
|
||||
github.com/vbatts/tar-split v0.11.2 // indirect
|
||||
github.com/vbatts/tar-split v0.11.3 // indirect
|
||||
github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 // indirect
|
||||
github.com/xanzy/go-gitlab v0.81.0 // indirect
|
||||
github.com/xanzy/go-gitlab v0.83.0 // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
||||
github.com/xlab/treeprint v1.1.0 // indirect
|
||||
github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43 // indirect
|
||||
github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50 // indirect
|
||||
github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f // indirect
|
||||
go.starlark.net v0.0.0-20221028183056-acb66ad56dd2 // indirect
|
||||
golang.org/x/mod v0.9.0 // indirect
|
||||
golang.org/x/net v0.8.0 // indirect
|
||||
golang.org/x/oauth2 v0.6.0 // indirect
|
||||
golang.org/x/sync v0.1.0 // indirect
|
||||
golang.org/x/sys v0.7.0 // indirect
|
||||
golang.org/x/text v0.8.0 // indirect
|
||||
golang.org/x/mod v0.11.0 // indirect
|
||||
golang.org/x/net v0.11.0 // indirect
|
||||
golang.org/x/oauth2 v0.7.0 // indirect
|
||||
golang.org/x/sync v0.3.0 // indirect
|
||||
golang.org/x/sys v0.10.0 // indirect
|
||||
golang.org/x/text v0.11.0 // indirect
|
||||
golang.org/x/time v0.3.0 // indirect
|
||||
golang.org/x/tools v0.7.0 // indirect
|
||||
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
|
||||
golang.org/x/tools v0.10.0 // indirect
|
||||
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/protobuf v1.29.1 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/component-base v0.26.3 // indirect
|
||||
k8s.io/klog/v2 v2.90.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20230109183929-3758b55a6596 // indirect
|
||||
k8s.io/utils v0.0.0-20230313181309-38a27ef9d749 // indirect
|
||||
k8s.io/component-base v0.27.3 // indirect
|
||||
k8s.io/klog/v2 v2.100.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
|
||||
k8s.io/utils v0.0.0-20230505201702-9f6742963106 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
|
||||
)
|
||||
|
||||
@@ -204,19 +204,36 @@ func NewBuilder(name, resources string, opts ...BuilderOptionFunc) (*Builder, er
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func (b *Builder) resolveKustomization(liveKus *kustomizev1.Kustomization) (k *kustomizev1.Kustomization, err error) {
|
||||
// local kustomization file takes precedence over live kustomization
|
||||
if b.kustomizationFile != "" {
|
||||
k, err = b.unMarshallKustomization()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if !b.dryRun && liveKus != nil && liveKus.Status.Inventory != nil {
|
||||
// merge the live kustomization status with the local kustomization in order to get the
|
||||
// live resources status
|
||||
k.Status = *liveKus.Status.DeepCopy()
|
||||
}
|
||||
} else {
|
||||
k = liveKus
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (b *Builder) getKustomization(ctx context.Context) (*kustomizev1.Kustomization, error) {
|
||||
liveKus := &kustomizev1.Kustomization{}
|
||||
namespacedName := types.NamespacedName{
|
||||
Namespace: b.namespace,
|
||||
Name: b.name,
|
||||
}
|
||||
|
||||
k := &kustomizev1.Kustomization{}
|
||||
err := b.client.Get(ctx, namespacedName, k)
|
||||
err := b.client.Get(ctx, namespacedName, liveKus)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return k, nil
|
||||
return liveKus, nil
|
||||
}
|
||||
|
||||
// Build builds the yaml manifests from the kustomization object
|
||||
@@ -251,19 +268,18 @@ func (b *Builder) build() (m resmap.ResMap, err error) {
|
||||
defer cancel()
|
||||
|
||||
// Get the kustomization object
|
||||
var k *kustomizev1.Kustomization
|
||||
if b.kustomizationFile != "" {
|
||||
k, err = b.unMarshallKustomization()
|
||||
liveKus := &kustomizev1.Kustomization{}
|
||||
if !b.dryRun {
|
||||
liveKus, err = b.getKustomization(ctx)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
k, err = b.getKustomization(ctx)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("failed to get kustomization object: %w", err)
|
||||
return
|
||||
return nil, fmt.Errorf("failed to get kustomization object: %w", err)
|
||||
}
|
||||
}
|
||||
k, err := b.resolveKustomization(liveKus)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("failed to get kustomization object: %w", err)
|
||||
return
|
||||
}
|
||||
|
||||
// store the kustomization object
|
||||
b.kustomization = k
|
||||
@@ -419,7 +435,7 @@ func maskSopsData(res *resource.Resource) error {
|
||||
res.PipeE(yaml.FieldClearer{Name: "sops"})
|
||||
|
||||
secretType, err := res.GetFieldValue(typeField)
|
||||
// If the intented type is Opaque, then it can be omitted from the manifest, since it's the default
|
||||
// If the intended type is Opaque, then it can be omitted from the manifest, since it's the default
|
||||
// Ref: https://kubernetes.io/docs/concepts/configuration/secret/#opaque-secrets
|
||||
if errors.As(err, &yaml.NoFieldError{}) {
|
||||
secretType = "Opaque"
|
||||
|
||||
@@ -17,10 +17,15 @@ limitations under the License.
|
||||
package build
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1"
|
||||
"github.com/fluxcd/pkg/apis/meta"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"sigs.k8s.io/kustomize/api/resource"
|
||||
"sigs.k8s.io/kustomize/kyaml/yaml"
|
||||
)
|
||||
@@ -215,3 +220,135 @@ func Test_unMarshallKustomization(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_ResolveKustomization(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
localKsFile string
|
||||
liveKustomization *kustomizev1.Kustomization
|
||||
dryrun bool
|
||||
}{
|
||||
{
|
||||
name: "valid kustomization",
|
||||
localKsFile: "testdata/local-kustomization/valid.yaml",
|
||||
},
|
||||
{
|
||||
name: "local and live kustomization",
|
||||
localKsFile: "testdata/local-kustomization/valid.yaml",
|
||||
liveKustomization: &kustomizev1.Kustomization{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "podinfo",
|
||||
Namespace: "flux-system",
|
||||
},
|
||||
Spec: kustomizev1.KustomizationSpec{
|
||||
Interval: metav1.Duration{Duration: time.Minute * 5},
|
||||
Path: "./testdata/local-kustomization/valid.yaml",
|
||||
},
|
||||
Status: kustomizev1.KustomizationStatus{
|
||||
Conditions: []metav1.Condition{
|
||||
{
|
||||
Type: meta.ReadyCondition,
|
||||
Status: metav1.ConditionTrue,
|
||||
},
|
||||
},
|
||||
Inventory: &kustomizev1.ResourceInventory{
|
||||
Entries: []kustomizev1.ResourceRef{
|
||||
{
|
||||
ID: "flux-system_podinfo_v1_service_podinfo",
|
||||
Version: "v1",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "local and live kustomization with dryrun",
|
||||
localKsFile: "testdata/local-kustomization/valid.yaml",
|
||||
liveKustomization: &kustomizev1.Kustomization{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "podinfo",
|
||||
Namespace: "flux-system",
|
||||
},
|
||||
Spec: kustomizev1.KustomizationSpec{
|
||||
Interval: metav1.Duration{Duration: time.Minute * 5},
|
||||
Path: "./testdata/local-kustomization/valid.yaml",
|
||||
},
|
||||
Status: kustomizev1.KustomizationStatus{
|
||||
Conditions: []metav1.Condition{
|
||||
{
|
||||
Type: meta.ReadyCondition,
|
||||
Status: metav1.ConditionTrue,
|
||||
},
|
||||
},
|
||||
Inventory: &kustomizev1.ResourceInventory{
|
||||
Entries: []kustomizev1.ResourceRef{
|
||||
{
|
||||
ID: "flux-system_podinfo_v1_service_podinfo",
|
||||
Version: "v1",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
dryrun: true,
|
||||
},
|
||||
{
|
||||
name: "live kustomization",
|
||||
liveKustomization: &kustomizev1.Kustomization{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "podinfo",
|
||||
Namespace: "flux-system",
|
||||
},
|
||||
Spec: kustomizev1.KustomizationSpec{
|
||||
Interval: metav1.Duration{Duration: time.Minute * 5},
|
||||
Path: "./testdata/local-kustomization/valid.yaml",
|
||||
},
|
||||
Status: kustomizev1.KustomizationStatus{
|
||||
Conditions: []metav1.Condition{
|
||||
{
|
||||
Type: meta.ReadyCondition,
|
||||
Status: metav1.ConditionTrue,
|
||||
},
|
||||
},
|
||||
Inventory: &kustomizev1.ResourceInventory{
|
||||
Entries: []kustomizev1.ResourceRef{
|
||||
{
|
||||
ID: "flux-system_podinfo_v1_service_podinfo",
|
||||
Version: "v1",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
b := &Builder{}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
b.kustomizationFile = tt.localKsFile
|
||||
b.dryRun = tt.dryrun
|
||||
ks, err := b.resolveKustomization(tt.liveKustomization)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected err '%s'", err)
|
||||
}
|
||||
if !tt.dryrun {
|
||||
if b.kustomizationFile == "" {
|
||||
if cmp.Diff(ks, tt.liveKustomization) != "" {
|
||||
t.Errorf("expected kustomization to match live kustomization")
|
||||
}
|
||||
} else {
|
||||
if tt.liveKustomization != nil && cmp.Diff(ks.Status, tt.liveKustomization.Status) != "" {
|
||||
t.Errorf("expected kustomization status to match live kustomization status")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ks.Status.Inventory != nil {
|
||||
fmt.Println(ks.Status.Inventory)
|
||||
t.Errorf("expected kustomization status to be nil")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,11 +136,14 @@ func (b *Builder) Diff() (string, bool, error) {
|
||||
if b.kustomization.Spec.Prune && len(diffErrs) == 0 {
|
||||
oldStatus := b.kustomization.Status.DeepCopy()
|
||||
if oldStatus.Inventory != nil {
|
||||
diffObjects, err := diffInventory(oldStatus.Inventory, newInventory)
|
||||
staleObjects, err := diffInventory(oldStatus.Inventory, newInventory)
|
||||
if err != nil {
|
||||
return "", createdOrDrifted, err
|
||||
}
|
||||
for _, object := range diffObjects {
|
||||
if len(staleObjects) > 0 {
|
||||
createdOrDrifted = true
|
||||
}
|
||||
for _, object := range staleObjects {
|
||||
output.WriteString(writeString(fmt.Sprintf("► %s deleted\n", ssa.FmtUnstructured(object)), bunt.OrangeRed))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- https://github.com/fluxcd/helm-controller/releases/download/v0.32.1/helm-controller.crds.yaml
|
||||
- https://github.com/fluxcd/helm-controller/releases/download/v0.32.1/helm-controller.deployment.yaml
|
||||
- https://github.com/fluxcd/helm-controller/releases/download/v0.35.0/helm-controller.crds.yaml
|
||||
- https://github.com/fluxcd/helm-controller/releases/download/v0.35.0/helm-controller.deployment.yaml
|
||||
- account.yaml
|
||||
transformers:
|
||||
- labels.yaml
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user