Compare commits
64 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31da363495 | ||
|
|
2ecd99d317 | ||
|
|
59c3d84182 | ||
|
|
641d5378f8 | ||
|
|
08512e5c43 | ||
|
|
8f7f7b23e8 | ||
|
|
2eb6ba5a48 | ||
|
|
03df386f9e | ||
|
|
5e741da69c | ||
|
|
3bea028cc9 | ||
|
|
10475b24c4 | ||
|
|
a5238e867c | ||
|
|
0e747790f9 | ||
|
|
2b4d6150d4 | ||
|
|
e22ad96164 | ||
|
|
f54907e66e | ||
|
|
fb713e9632 | ||
|
|
0b659e3f09 | ||
|
|
4c99117c7c | ||
|
|
83c3e8c2fc | ||
|
|
92277225df | ||
|
|
622ed88a11 | ||
|
|
d9414f25d5 | ||
|
|
5249d17a95 | ||
|
|
25283d357e | ||
|
|
e926321094 | ||
|
|
9c1542c3f3 | ||
|
|
25d06a53bc | ||
|
|
4d904e8216 | ||
|
|
0beab87f5b | ||
|
|
b9ceceada4 | ||
|
|
ac7ccf7b94 | ||
|
|
5aa9ae511f | ||
|
|
dd81ed896b | ||
|
|
e6bbed162d | ||
|
|
3ee8747fdc | ||
|
|
0651064999 | ||
|
|
4661e4519d | ||
|
|
19caeb178f | ||
|
|
d8235ea21b | ||
|
|
5067df179e | ||
|
|
50a1e32da3 | ||
|
|
fb85cafcc5 | ||
|
|
d06a2936cc | ||
|
|
7c77a9723a | ||
|
|
8a3e5790f5 | ||
|
|
dd093a775a | ||
|
|
a096bd2d71 | ||
|
|
2eddcde609 | ||
|
|
1849e1768a | ||
|
|
bbe62d029c | ||
|
|
68a89d3cd4 | ||
|
|
b16f1fc260 | ||
|
|
64f39e160b | ||
|
|
3a76c26822 | ||
|
|
9d9fff5796 | ||
|
|
0a92c61b09 | ||
|
|
546be76f55 | ||
|
|
d770f3f53f | ||
|
|
254cc131ae | ||
|
|
70509ffcb4 | ||
|
|
4cc2326c7f | ||
|
|
0133caaec4 | ||
|
|
7ae4f28920 |
1
.github/aur/flux-bin/.SRCINFO.template
vendored
1
.github/aur/flux-bin/.SRCINFO.template
vendored
@@ -8,7 +8,6 @@ pkgbase = flux-bin
|
|||||||
arch = armv7h
|
arch = armv7h
|
||||||
arch = aarch64
|
arch = aarch64
|
||||||
license = APACHE
|
license = APACHE
|
||||||
optdepends = kubectl
|
|
||||||
source_x86_64 = flux-bin-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v1/flux_${PKGVER}_linux_amd64.tar.gz
|
source_x86_64 = flux-bin-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v1/flux_${PKGVER}_linux_amd64.tar.gz
|
||||||
source_armv6h = flux-bin-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v1/flux_${PKGVER}_linux_arm.tar.gz
|
source_armv6h = flux-bin-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v1/flux_${PKGVER}_linux_arm.tar.gz
|
||||||
source_armv7h = flux-bin-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v1/flux_${PKGVER}_linux_arm.tar.gz
|
source_armv7h = flux-bin-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v1/flux_${PKGVER}_linux_arm.tar.gz
|
||||||
|
|||||||
3
.github/aur/flux-bin/PKGBUILD.template
vendored
3
.github/aur/flux-bin/PKGBUILD.template
vendored
@@ -8,8 +8,7 @@ pkgdesc="Open and extensible continuous delivery solution for Kubernetes"
|
|||||||
url="https://fluxcd.io/"
|
url="https://fluxcd.io/"
|
||||||
arch=("x86_64" "armv6h" "armv7h" "aarch64")
|
arch=("x86_64" "armv6h" "armv7h" "aarch64")
|
||||||
license=("APACHE")
|
license=("APACHE")
|
||||||
optdepends=('kubectl: for apply actions on the Kubernetes cluster',
|
optdepends=('bash-completion: auto-completion for flux in Bash',
|
||||||
'bash-completion: auto-completion for flux in Bash',
|
|
||||||
'zsh-completions: auto-completion for flux in ZSH')
|
'zsh-completions: auto-completion for flux in ZSH')
|
||||||
source_x86_64=(
|
source_x86_64=(
|
||||||
"${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${pkgver}/flux_${pkgver}_linux_amd64.tar.gz"
|
"${pkgname}-${pkgver}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${pkgver}/flux_${pkgver}_linux_amd64.tar.gz"
|
||||||
|
|||||||
1
.github/aur/flux-go/.SRCINFO.template
vendored
1
.github/aur/flux-go/.SRCINFO.template
vendored
@@ -10,7 +10,6 @@ pkgbase = flux-go
|
|||||||
license = APACHE
|
license = APACHE
|
||||||
makedepends = go
|
makedepends = go
|
||||||
depends = glibc
|
depends = glibc
|
||||||
optdepends = kubectl
|
|
||||||
provides = flux-bin
|
provides = flux-bin
|
||||||
conflicts = flux-bin
|
conflicts = flux-bin
|
||||||
replaces = flux-cli
|
replaces = flux-cli
|
||||||
|
|||||||
3
.github/aur/flux-go/PKGBUILD.template
vendored
3
.github/aur/flux-go/PKGBUILD.template
vendored
@@ -13,8 +13,7 @@ conflicts=("flux-bin")
|
|||||||
replaces=("flux-cli")
|
replaces=("flux-cli")
|
||||||
depends=("glibc")
|
depends=("glibc")
|
||||||
makedepends=('go>=1.16', 'kustomize>=3.0')
|
makedepends=('go>=1.16', 'kustomize>=3.0')
|
||||||
optdepends=('kubectl: for apply actions on the Kubernetes cluster',
|
optdepends=('bash-completion: auto-completion for flux in Bash',
|
||||||
'bash-completion: auto-completion for flux in Bash',
|
|
||||||
'zsh-completions: auto-completion for flux in ZSH')
|
'zsh-completions: auto-completion for flux in ZSH')
|
||||||
source=(
|
source=(
|
||||||
"${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${pkgver}.tar.gz"
|
||||||
|
|||||||
1
.github/aur/flux-scm/.SRCINFO.template
vendored
1
.github/aur/flux-scm/.SRCINFO.template
vendored
@@ -10,7 +10,6 @@ pkgbase = flux-scm
|
|||||||
license = APACHE
|
license = APACHE
|
||||||
makedepends = go
|
makedepends = go
|
||||||
depends = glibc
|
depends = glibc
|
||||||
optdepends = kubectl
|
|
||||||
provides = flux-bin
|
provides = flux-bin
|
||||||
conflicts = flux-bin
|
conflicts = flux-bin
|
||||||
source = git+https://github.com/fluxcd/flux2.git
|
source = git+https://github.com/fluxcd/flux2.git
|
||||||
|
|||||||
3
.github/aur/flux-scm/PKGBUILD.template
vendored
3
.github/aur/flux-scm/PKGBUILD.template
vendored
@@ -12,8 +12,7 @@ provides=("flux-bin")
|
|||||||
conflicts=("flux-bin")
|
conflicts=("flux-bin")
|
||||||
depends=("glibc")
|
depends=("glibc")
|
||||||
makedepends=('go>=1.16', 'kustomize>=3.0')
|
makedepends=('go>=1.16', 'kustomize>=3.0')
|
||||||
optdepends=('kubectl: for apply actions on the Kubernetes cluster',
|
optdepends=('bash-completion: auto-completion for flux in Bash',
|
||||||
'bash-completion: auto-completion for flux in Bash',
|
|
||||||
'zsh-completions: auto-completion for flux in ZSH')
|
'zsh-completions: auto-completion for flux in ZSH')
|
||||||
source=(
|
source=(
|
||||||
"git+https://github.com/fluxcd/flux2.git"
|
"git+https://github.com/fluxcd/flux2.git"
|
||||||
|
|||||||
2
.github/workflows/bootstrap.yaml
vendored
2
.github/workflows/bootstrap.yaml
vendored
@@ -33,7 +33,7 @@ jobs:
|
|||||||
uses: fluxcd/pkg//actions/kustomize@main
|
uses: fluxcd/pkg//actions/kustomize@main
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
make cmd/flux/manifests
|
make cmd/flux/.manifests.done
|
||||||
go build -o /tmp/flux ./cmd/flux
|
go build -o /tmp/flux ./cmd/flux
|
||||||
- name: Set outputs
|
- name: Set outputs
|
||||||
id: vars
|
id: vars
|
||||||
|
|||||||
66
.github/workflows/e2e-azure.yaml
vendored
Normal file
66
.github/workflows/e2e-azure.yaml
vendored
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
name: e2e-azure
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 6 * * *'
|
||||||
|
push:
|
||||||
|
branches: [ azure* ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
e2e:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Restore Go cache
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/go/pkg/mod
|
||||||
|
key: ${{ runner.os }}-go1.16-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-go1.16-
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: 1.16.x
|
||||||
|
- name: Install libgit2
|
||||||
|
run: |
|
||||||
|
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138
|
||||||
|
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9
|
||||||
|
echo "deb http://deb.debian.org/debian unstable main" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb-src http://deb.debian.org/debian unstable main" | sudo tee -a /etc/apt/sources.list
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y --allow-downgrades libgit2-dev/unstable zlib1g-dev/unstable libssh2-1-dev/unstable libpcre3-dev/unstable
|
||||||
|
- name: Setup Flux CLI
|
||||||
|
run: |
|
||||||
|
make build
|
||||||
|
mkdir -p $HOME/.local/bin
|
||||||
|
mv ./bin/flux $HOME/.local/bin
|
||||||
|
- name: Setup SOPS
|
||||||
|
run: |
|
||||||
|
wget https://github.com/mozilla/sops/releases/download/v3.7.1/sops-v3.7.1.linux
|
||||||
|
chmod +x sops-v3.7.1.linux
|
||||||
|
mkdir -p $HOME/.local/bin
|
||||||
|
mv sops-v3.7.1.linux $HOME/.local/bin/sops
|
||||||
|
- name: Setup Terraform
|
||||||
|
uses: hashicorp/setup-terraform@v1
|
||||||
|
with:
|
||||||
|
terraform_version: 1.0.7
|
||||||
|
terraform_wrapper: false
|
||||||
|
- name: Setup Azure CLI
|
||||||
|
run: |
|
||||||
|
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
|
||||||
|
- name: Run Azure e2e tests
|
||||||
|
env:
|
||||||
|
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
|
||||||
|
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
|
||||||
|
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
|
||||||
|
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
|
||||||
|
run: |
|
||||||
|
echo $HOME
|
||||||
|
echo $PATH
|
||||||
|
ls $HOME/.local/bin
|
||||||
|
az login --service-principal -u ${ARM_CLIENT_ID} -p ${ARM_CLIENT_SECRET} -t ${ARM_TENANT_ID}
|
||||||
|
cd ./tests/azure
|
||||||
|
go test -v -coverprofile cover.out -timeout 60m .
|
||||||
3
.github/workflows/e2e.yaml
vendored
3
.github/workflows/e2e.yaml
vendored
@@ -27,7 +27,7 @@ jobs:
|
|||||||
uses: engineerd/setup-kind@v0.5.0
|
uses: engineerd/setup-kind@v0.5.0
|
||||||
with:
|
with:
|
||||||
version: v0.11.1
|
version: v0.11.1
|
||||||
image: kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6
|
image: kindest/node:v1.19.11@sha256:07db187ae84b4b7de440a73886f008cf903fcf5764ba8106a9fd5243d6f32729
|
||||||
config: .github/kind/config.yaml # disable KIND-net
|
config: .github/kind/config.yaml # disable KIND-net
|
||||||
- name: Setup envtest
|
- name: Setup envtest
|
||||||
uses: fluxcd/pkg/actions/envtest@main
|
uses: fluxcd/pkg/actions/envtest@main
|
||||||
@@ -93,7 +93,6 @@ jobs:
|
|||||||
--path="./deploy/overlays/dev" \
|
--path="./deploy/overlays/dev" \
|
||||||
--prune=true \
|
--prune=true \
|
||||||
--interval=5m \
|
--interval=5m \
|
||||||
--validation=client \
|
|
||||||
--health-check="Deployment/frontend.dev" \
|
--health-check="Deployment/frontend.dev" \
|
||||||
--health-check="Deployment/backend.dev" \
|
--health-check="Deployment/backend.dev" \
|
||||||
--health-check-timeout=3m
|
--health-check-timeout=3m
|
||||||
|
|||||||
2
.github/workflows/release.yaml
vendored
2
.github/workflows/release.yaml
vendored
@@ -50,7 +50,7 @@ jobs:
|
|||||||
uses: fluxcd/pkg//actions/kustomize@main
|
uses: fluxcd/pkg//actions/kustomize@main
|
||||||
- name: Generate manifests
|
- name: Generate manifests
|
||||||
run: |
|
run: |
|
||||||
make cmd/flux/manifests
|
make cmd/flux/.manifests.done
|
||||||
./manifests/scripts/bundle.sh "" ./output manifests.tar.gz
|
./manifests/scripts/bundle.sh "" ./output manifests.tar.gz
|
||||||
kustomize build ./manifests/install > ./output/install.yaml
|
kustomize build ./manifests/install > ./output/install.yaml
|
||||||
- name: Build CRDs
|
- name: Build CRDs
|
||||||
|
|||||||
2
.github/workflows/scan.yaml
vendored
2
.github/workflows/scan.yaml
vendored
@@ -31,7 +31,7 @@ jobs:
|
|||||||
uses: fluxcd/pkg//actions/kustomize@main
|
uses: fluxcd/pkg//actions/kustomize@main
|
||||||
- name: Build manifests
|
- name: Build manifests
|
||||||
run: |
|
run: |
|
||||||
make cmd/flux/manifests
|
make cmd/flux/.manifests.done
|
||||||
- name: Run Snyk to check for vulnerabilities
|
- name: Run Snyk to check for vulnerabilities
|
||||||
uses: snyk/actions/golang@master
|
uses: snyk/actions/golang@master
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -19,6 +19,7 @@ dist/
|
|||||||
bin/
|
bin/
|
||||||
output/
|
output/
|
||||||
cmd/flux/manifests/
|
cmd/flux/manifests/
|
||||||
|
cmd/flux/.manifests.done
|
||||||
|
|
||||||
# Docs
|
# Docs
|
||||||
site/
|
site/
|
||||||
|
|||||||
@@ -49,9 +49,17 @@ brews:
|
|||||||
folder: Formula
|
folder: Formula
|
||||||
homepage: "https://fluxcd.io/"
|
homepage: "https://fluxcd.io/"
|
||||||
description: "Flux CLI"
|
description: "Flux CLI"
|
||||||
dependencies:
|
install: |
|
||||||
- name: kubectl
|
bin.install "flux"
|
||||||
type: optional
|
|
||||||
|
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
|
||||||
test: |
|
test: |
|
||||||
system "#{bin}/flux --version"
|
system "#{bin}/flux --version"
|
||||||
publishers:
|
publishers:
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ FROM alpine:3.13 as builder
|
|||||||
RUN apk add --no-cache ca-certificates curl
|
RUN apk add --no-cache ca-certificates curl
|
||||||
|
|
||||||
ARG ARCH=linux/amd64
|
ARG ARCH=linux/amd64
|
||||||
ARG KUBECTL_VER=1.20.4
|
ARG KUBECTL_VER=1.22.2
|
||||||
|
|
||||||
RUN curl -sL https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VER}/bin/${ARCH}/kubectl \
|
RUN curl -sL https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VER}/bin/${ARCH}/kubectl \
|
||||||
-o /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl && \
|
-o /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl && \
|
||||||
|
|||||||
3
Makefile
3
Makefile
@@ -1,5 +1,5 @@
|
|||||||
VERSION?=$(shell grep 'VERSION' cmd/flux/main.go | awk '{ print $$4 }' | head -n 1 | tr -d '"')
|
VERSION?=$(shell grep 'VERSION' cmd/flux/main.go | awk '{ print $$4 }' | head -n 1 | tr -d '"')
|
||||||
EMBEDDED_MANIFESTS_TARGET=cmd/flux/manifests
|
EMBEDDED_MANIFESTS_TARGET=cmd/flux/.manifests.done
|
||||||
TEST_KUBECONFIG?=/tmp/flux-e2e-test-kubeconfig
|
TEST_KUBECONFIG?=/tmp/flux-e2e-test-kubeconfig
|
||||||
ENVTEST_BIN_VERSION?=latest
|
ENVTEST_BIN_VERSION?=latest
|
||||||
KUBEBUILDER_ASSETS?="$(shell $(SETUP_ENVTEST) use -i $(ENVTEST_BIN_VERSION) -p path)"
|
KUBEBUILDER_ASSETS?="$(shell $(SETUP_ENVTEST) use -i $(ENVTEST_BIN_VERSION) -p path)"
|
||||||
@@ -46,6 +46,7 @@ test-with-kind: setup-envtest
|
|||||||
|
|
||||||
$(EMBEDDED_MANIFESTS_TARGET): $(call rwildcard,manifests/,*.yaml *.json)
|
$(EMBEDDED_MANIFESTS_TARGET): $(call rwildcard,manifests/,*.yaml *.json)
|
||||||
./manifests/scripts/bundle.sh
|
./manifests/scripts/bundle.sh
|
||||||
|
touch $@
|
||||||
|
|
||||||
build: $(EMBEDDED_MANIFESTS_TARGET)
|
build: $(EMBEDDED_MANIFESTS_TARGET)
|
||||||
CGO_ENABLED=0 go build -ldflags="-s -w -X main.VERSION=$(VERSION)" -o ./bin/flux ./cmd/flux
|
CGO_ENABLED=0 go build -ldflags="-s -w -X main.VERSION=$(VERSION)" -o ./bin/flux ./cmd/flux
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import (
|
|||||||
"crypto/elliptic"
|
"crypto/elliptic"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
@@ -67,6 +68,10 @@ type bootstrapFlags struct {
|
|||||||
authorName string
|
authorName string
|
||||||
authorEmail string
|
authorEmail string
|
||||||
|
|
||||||
|
gpgKeyRingPath string
|
||||||
|
gpgPassphrase string
|
||||||
|
gpgKeyID string
|
||||||
|
|
||||||
commitMessageAppendix string
|
commitMessageAppendix string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,6 +123,10 @@ func init() {
|
|||||||
bootstrapCmd.PersistentFlags().StringVar(&bootstrapArgs.authorName, "author-name", "Flux", "author name for Git commits")
|
bootstrapCmd.PersistentFlags().StringVar(&bootstrapArgs.authorName, "author-name", "Flux", "author name for Git commits")
|
||||||
bootstrapCmd.PersistentFlags().StringVar(&bootstrapArgs.authorEmail, "author-email", "", "author email for Git commits")
|
bootstrapCmd.PersistentFlags().StringVar(&bootstrapArgs.authorEmail, "author-email", "", "author email for Git commits")
|
||||||
|
|
||||||
|
bootstrapCmd.PersistentFlags().StringVar(&bootstrapArgs.gpgKeyRingPath, "gpg-key-ring", "", "path to GPG key ring for signing commits")
|
||||||
|
bootstrapCmd.PersistentFlags().StringVar(&bootstrapArgs.gpgPassphrase, "gpg-passphrase", "", "passphrase for decrypting GPG private key")
|
||||||
|
bootstrapCmd.PersistentFlags().StringVar(&bootstrapArgs.gpgKeyID, "gpg-key-id", "", "key id for selecting a particular key")
|
||||||
|
|
||||||
bootstrapCmd.PersistentFlags().StringVar(&bootstrapArgs.commitMessageAppendix, "commit-message-appendix", "", "string to add to the commit messages, e.g. '[ci skip]'")
|
bootstrapCmd.PersistentFlags().StringVar(&bootstrapArgs.commitMessageAppendix, "commit-message-appendix", "", "string to add to the commit messages, e.g. '[ci skip]'")
|
||||||
|
|
||||||
bootstrapCmd.PersistentFlags().Var(&bootstrapArgs.arch, "arch", bootstrapArgs.arch.Description())
|
bootstrapCmd.PersistentFlags().Var(&bootstrapArgs.arch, "arch", bootstrapArgs.arch.Description())
|
||||||
@@ -174,6 +183,10 @@ func mapTeamSlice(s []string, defaultPermission string) map[string]string {
|
|||||||
m := make(map[string]string, len(s))
|
m := make(map[string]string, len(s))
|
||||||
for _, v := range s {
|
for _, v := range s {
|
||||||
m[v] = defaultPermission
|
m[v] = defaultPermission
|
||||||
|
if s := strings.Split(v, ":"); len(s) == 2 {
|
||||||
|
m[s[0]] = s[1]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,8 +171,14 @@ func bootstrapGitCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
secretOpts.RSAKeyBits = int(bootstrapArgs.keyRSABits)
|
secretOpts.RSAKeyBits = int(bootstrapArgs.keyRSABits)
|
||||||
secretOpts.ECDSACurve = bootstrapArgs.keyECDSACurve.Curve
|
secretOpts.ECDSACurve = bootstrapArgs.keyECDSACurve.Curve
|
||||||
|
|
||||||
// Configure repository URL to match auth config for sync.
|
// Configure repository URL to match auth config for sync
|
||||||
repositoryURL.User = url.User(gitArgs.username)
|
|
||||||
|
// Override existing user when user is not already set
|
||||||
|
// or when a username was passed in
|
||||||
|
if repositoryURL.User == nil || gitArgs.username != "git" {
|
||||||
|
repositoryURL.User = url.User(gitArgs.username)
|
||||||
|
}
|
||||||
|
|
||||||
repositoryURL.Scheme = "ssh"
|
repositoryURL.Scheme = "ssh"
|
||||||
if bootstrapArgs.sshHostname != "" {
|
if bootstrapArgs.sshHostname != "" {
|
||||||
repositoryURL.Host = bootstrapArgs.sshHostname
|
repositoryURL.Host = bootstrapArgs.sshHostname
|
||||||
@@ -218,6 +224,7 @@ func bootstrapGitCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
bootstrap.WithPostGenerateSecretFunc(promptPublicKey),
|
bootstrap.WithPostGenerateSecretFunc(promptPublicKey),
|
||||||
bootstrap.WithLogger(logger),
|
bootstrap.WithLogger(logger),
|
||||||
bootstrap.WithCABundle(caBundle),
|
bootstrap.WithCABundle(caBundle),
|
||||||
|
bootstrap.WithGitCommitSigning(bootstrapArgs.gpgKeyRingPath, bootstrapArgs.gpgPassphrase, bootstrapArgs.gpgKeyID),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup bootstrapper with constructed configs
|
// Setup bootstrapper with constructed configs
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ the bootstrap command will perform an upgrade if needed.`,
|
|||||||
# Run bootstrap for a private repository and assign organization teams to it
|
# Run bootstrap for a private repository and assign organization teams to it
|
||||||
flux bootstrap github --owner=<organization> --repository=<repository name> --team=<team1 slug> --team=<team2 slug>
|
flux bootstrap github --owner=<organization> --repository=<repository name> --team=<team1 slug> --team=<team2 slug>
|
||||||
|
|
||||||
|
# Run bootstrap for a private repository and assign organization teams with their access level(e.g maintain, admin) to it
|
||||||
|
flux bootstrap github --owner=<organization> --repository=<repository name> --team=<team1 slug>:<access-level>
|
||||||
|
|
||||||
# Run bootstrap for a repository path
|
# Run bootstrap for a repository path
|
||||||
flux bootstrap github --owner=<organization> --repository=<repository name> --path=dev-cluster
|
flux bootstrap github --owner=<organization> --repository=<repository name> --path=dev-cluster
|
||||||
|
|
||||||
@@ -93,7 +96,7 @@ var githubArgs githubFlags
|
|||||||
func init() {
|
func init() {
|
||||||
bootstrapGitHubCmd.Flags().StringVar(&githubArgs.owner, "owner", "", "GitHub user or organization name")
|
bootstrapGitHubCmd.Flags().StringVar(&githubArgs.owner, "owner", "", "GitHub user or organization name")
|
||||||
bootstrapGitHubCmd.Flags().StringVar(&githubArgs.repository, "repository", "", "GitHub repository name")
|
bootstrapGitHubCmd.Flags().StringVar(&githubArgs.repository, "repository", "", "GitHub repository name")
|
||||||
bootstrapGitHubCmd.Flags().StringSliceVar(&githubArgs.teams, "team", []string{}, "GitHub team to be given maintainer access (also accepts comma-separated values)")
|
bootstrapGitHubCmd.Flags().StringSliceVar(&githubArgs.teams, "team", []string{}, "GitHub team and the access to be given to it(team:maintain). Defaults to maintainer access if no access level is specified (also accepts comma-separated values)")
|
||||||
bootstrapGitHubCmd.Flags().BoolVar(&githubArgs.personal, "personal", false, "if true, the owner is assumed to be a GitHub user; otherwise an org")
|
bootstrapGitHubCmd.Flags().BoolVar(&githubArgs.personal, "personal", false, "if true, the owner is assumed to be a GitHub user; otherwise an org")
|
||||||
bootstrapGitHubCmd.Flags().BoolVar(&githubArgs.private, "private", true, "if true, the repository is setup or configured as private")
|
bootstrapGitHubCmd.Flags().BoolVar(&githubArgs.private, "private", true, "if true, the repository is setup or configured as private")
|
||||||
bootstrapGitHubCmd.Flags().DurationVar(&githubArgs.interval, "interval", time.Minute, "sync interval")
|
bootstrapGitHubCmd.Flags().DurationVar(&githubArgs.interval, "interval", time.Minute, "sync interval")
|
||||||
|
|||||||
@@ -18,15 +18,12 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Masterminds/semver/v3"
|
"github.com/Masterminds/semver/v3"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
v1 "k8s.io/api/apps/v1"
|
v1 "k8s.io/api/apps/v1"
|
||||||
apimachineryversion "k8s.io/apimachinery/pkg/version"
|
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
|
|
||||||
@@ -56,8 +53,11 @@ type checkFlags struct {
|
|||||||
extraComponents []string
|
extraComponents []string
|
||||||
}
|
}
|
||||||
|
|
||||||
type kubectlVersion struct {
|
var kubernetesConstraints = []string{
|
||||||
ClientVersion *apimachineryversion.Info `json:"clientVersion"`
|
">=1.19.0-0",
|
||||||
|
">=1.16.11-0 <=1.16.15-0",
|
||||||
|
">=1.17.7-0 <=1.17.17-0",
|
||||||
|
">=1.18.4-0 <=1.18.20-0",
|
||||||
}
|
}
|
||||||
|
|
||||||
var checkArgs checkFlags
|
var checkArgs checkFlags
|
||||||
@@ -73,19 +73,12 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runCheckCmd(cmd *cobra.Command, args []string) error {
|
func runCheckCmd(cmd *cobra.Command, args []string) error {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
logger.Actionf("checking prerequisites")
|
logger.Actionf("checking prerequisites")
|
||||||
checkFailed := false
|
checkFailed := false
|
||||||
|
|
||||||
fluxCheck()
|
fluxCheck()
|
||||||
|
|
||||||
if !kubectlCheck(ctx, ">=1.18.0-0") {
|
if !kubernetesCheck(kubernetesConstraints) {
|
||||||
checkFailed = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if !kubernetesCheck(">=1.16.0-0") {
|
|
||||||
checkFailed = true
|
checkFailed = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,43 +123,7 @@ func fluxCheck() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func kubectlCheck(ctx context.Context, constraint string) bool {
|
func kubernetesCheck(constraints []string) bool {
|
||||||
_, err := exec.LookPath("kubectl")
|
|
||||||
if err != nil {
|
|
||||||
logger.Failuref("kubectl not found")
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
kubectlArgs := []string{"version", "--client", "--output", "json"}
|
|
||||||
output, err := utils.ExecKubectlCommand(ctx, utils.ModeCapture, rootArgs.kubeconfig, rootArgs.kubecontext, kubectlArgs...)
|
|
||||||
if err != nil {
|
|
||||||
logger.Failuref("kubectl version can't be determined")
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
kv := &kubectlVersion{}
|
|
||||||
if err = json.Unmarshal([]byte(output), kv); err != nil {
|
|
||||||
logger.Failuref("kubectl version output can't be unmarshalled")
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
v, err := version.ParseVersion(kv.ClientVersion.GitVersion)
|
|
||||||
if err != nil {
|
|
||||||
logger.Failuref("kubectl version can't be parsed")
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
c, _ := semver.NewConstraint(constraint)
|
|
||||||
if !c.Check(v) {
|
|
||||||
logger.Failuref("kubectl version %s < %s", v.Original(), constraint)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.Successf("kubectl %s %s", v.String(), constraint)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func kubernetesCheck(constraint string) bool {
|
|
||||||
cfg, err := utils.KubeConfig(rootArgs.kubeconfig, rootArgs.kubecontext)
|
cfg, err := utils.KubeConfig(rootArgs.kubeconfig, rootArgs.kubecontext)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Failuref("Kubernetes client initialization failed: %s", err.Error())
|
logger.Failuref("Kubernetes client initialization failed: %s", err.Error())
|
||||||
@@ -191,13 +148,23 @@ func kubernetesCheck(constraint string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
c, _ := semver.NewConstraint(constraint)
|
var valid bool
|
||||||
if !c.Check(v) {
|
var vrange string
|
||||||
logger.Failuref("Kubernetes version %s < %s", v.Original(), constraint)
|
for _, constraint := range constraints {
|
||||||
|
c, _ := semver.NewConstraint(constraint)
|
||||||
|
if c.Check(v) {
|
||||||
|
valid = true
|
||||||
|
vrange = constraint
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !valid {
|
||||||
|
logger.Failuref("Kubernetes version %s does not match %s", v.Original(), constraints[0])
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Successf("Kubernetes %s %s", v.String(), constraint)
|
logger.Successf("Kubernetes %s %s", v.String(), vrange)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,13 +23,11 @@ func TestCheckPre(t *testing.T) {
|
|||||||
t.Fatalf("Error unmarshalling: %v", err.Error())
|
t.Fatalf("Error unmarshalling: %v", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
clientVersion := strings.TrimPrefix(versions["clientVersion"].GitVersion, "v")
|
|
||||||
serverVersion := strings.TrimPrefix(versions["serverVersion"].GitVersion, "v")
|
serverVersion := strings.TrimPrefix(versions["serverVersion"].GitVersion, "v")
|
||||||
|
|
||||||
cmd := cmdTestCase{
|
cmd := cmdTestCase{
|
||||||
args: "check --pre",
|
args: "check --pre",
|
||||||
assert: assertGoldenTemplateFile("testdata/check/check_pre.golden", map[string]string{
|
assert: assertGoldenTemplateFile("testdata/check/check_pre.golden", map[string]string{
|
||||||
"clientVersion": clientVersion,
|
|
||||||
"serverVersion": serverVersion,
|
"serverVersion": serverVersion,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,18 @@ limitations under the License.
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/fluxcd/flux2/internal/utils"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"k8s.io/apimachinery/pkg/api/meta"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
"k8s.io/client-go/discovery"
|
||||||
|
memory "k8s.io/client-go/discovery/cached"
|
||||||
|
"k8s.io/client-go/dynamic"
|
||||||
|
"k8s.io/client-go/restmapper"
|
||||||
)
|
)
|
||||||
|
|
||||||
var completionCmd = &cobra.Command{
|
var completionCmd = &cobra.Command{
|
||||||
@@ -29,3 +40,77 @@ var completionCmd = &cobra.Command{
|
|||||||
func init() {
|
func init() {
|
||||||
rootCmd.AddCommand(completionCmd)
|
rootCmd.AddCommand(completionCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func contextsCompletionFunc(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||||
|
rawConfig, err := utils.ClientConfig(rootArgs.kubeconfig, rootArgs.kubecontext).RawConfig()
|
||||||
|
if err != nil {
|
||||||
|
return completionError(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var comps []string
|
||||||
|
|
||||||
|
for name := range rawConfig.Contexts {
|
||||||
|
if strings.HasPrefix(name, toComplete) {
|
||||||
|
comps = append(comps, name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return comps, cobra.ShellCompDirectiveNoFileComp
|
||||||
|
}
|
||||||
|
|
||||||
|
func resourceNamesCompletionFunc(gvk schema.GroupVersionKind) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||||
|
return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
cfg, err := utils.KubeConfig(rootArgs.kubeconfig, rootArgs.kubecontext)
|
||||||
|
if err != nil {
|
||||||
|
return completionError(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
dc, err := discovery.NewDiscoveryClientForConfig(cfg)
|
||||||
|
if err != nil {
|
||||||
|
return completionError(err)
|
||||||
|
}
|
||||||
|
mapper := restmapper.NewDeferredDiscoveryRESTMapper(memory.NewMemCacheClient(dc))
|
||||||
|
|
||||||
|
mapping, err := mapper.RESTMapping(gvk.GroupKind(), gvk.Version)
|
||||||
|
if err != nil {
|
||||||
|
return completionError(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
client, err := dynamic.NewForConfig(cfg)
|
||||||
|
if err != nil {
|
||||||
|
return completionError(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var dr dynamic.ResourceInterface
|
||||||
|
if mapping.Scope.Name() == meta.RESTScopeNameNamespace {
|
||||||
|
dr = client.Resource(mapping.Resource).Namespace(rootArgs.namespace)
|
||||||
|
} else {
|
||||||
|
dr = client.Resource(mapping.Resource)
|
||||||
|
}
|
||||||
|
|
||||||
|
list, err := dr.List(ctx, metav1.ListOptions{})
|
||||||
|
if err != nil {
|
||||||
|
return completionError(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var comps []string
|
||||||
|
|
||||||
|
for _, item := range list.Items {
|
||||||
|
name := item.GetName()
|
||||||
|
|
||||||
|
if strings.HasPrefix(name, toComplete) {
|
||||||
|
comps = append(comps, name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return comps, cobra.ShellCompDirectiveNoFileComp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func completionError(err error) ([]string, cobra.ShellCompDirective) {
|
||||||
|
cobra.CompError(err.Error())
|
||||||
|
return nil, cobra.ShellCompDirectiveError
|
||||||
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@@ -27,12 +28,12 @@ var completionZshCmd = &cobra.Command{
|
|||||||
Short: "Generates zsh completion scripts",
|
Short: "Generates zsh completion scripts",
|
||||||
Example: `To load completion run
|
Example: `To load completion run
|
||||||
|
|
||||||
. <(flux completion zsh) && compdef _flux flux
|
. <(flux completion zsh)
|
||||||
|
|
||||||
To configure your zsh shell to load completions for each session add to your zshrc
|
To configure your zsh shell to load completions for each session add to your zshrc
|
||||||
|
|
||||||
# ~/.zshrc or ~/.profile
|
# ~/.zshrc or ~/.profile
|
||||||
command -v flux >/dev/null && . <(flux completion zsh) && compdef _flux flux
|
command -v flux >/dev/null && . <(flux completion zsh)
|
||||||
|
|
||||||
or write a cached file in one of the completion directories in your ${fpath}:
|
or write a cached file in one of the completion directories in your ${fpath}:
|
||||||
|
|
||||||
@@ -43,6 +44,8 @@ mv _flux ~/.oh-my-zsh/completions # oh-my-zsh
|
|||||||
mv _flux ~/.zprezto/modules/completion/external/src/ # zprezto`,
|
mv _flux ~/.zprezto/modules/completion/external/src/ # zprezto`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
rootCmd.GenZshCompletion(os.Stdout)
|
rootCmd.GenZshCompletion(os.Stdout)
|
||||||
|
// Cobra doesn't source zsh completion file, explicitly doing it here
|
||||||
|
fmt.Println("compdef _flux flux")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -182,18 +182,27 @@ func createHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Install: &helmv2.Install{
|
|
||||||
CreateNamespace: helmReleaseArgs.createNamespace,
|
|
||||||
},
|
|
||||||
Suspend: false,
|
Suspend: false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if helmReleaseArgs.createNamespace {
|
||||||
|
if helmRelease.Spec.Install == nil {
|
||||||
|
helmRelease.Spec.Install = &helmv2.Install{}
|
||||||
|
}
|
||||||
|
|
||||||
|
helmRelease.Spec.Install.CreateNamespace = helmReleaseArgs.createNamespace
|
||||||
|
}
|
||||||
|
|
||||||
if helmReleaseArgs.saName != "" {
|
if helmReleaseArgs.saName != "" {
|
||||||
helmRelease.Spec.ServiceAccountName = helmReleaseArgs.saName
|
helmRelease.Spec.ServiceAccountName = helmReleaseArgs.saName
|
||||||
}
|
}
|
||||||
|
|
||||||
if helmReleaseArgs.crds != "" {
|
if helmReleaseArgs.crds != "" {
|
||||||
|
if helmRelease.Spec.Install == nil {
|
||||||
|
helmRelease.Spec.Install = &helmv2.Install{}
|
||||||
|
}
|
||||||
|
|
||||||
helmRelease.Spec.Install.CRDs = helmv2.Create
|
helmRelease.Spec.Install.CRDs = helmv2.Create
|
||||||
helmRelease.Spec.Upgrade = &helmv2.Upgrade{CRDs: helmv2.CRDsPolicy(helmReleaseArgs.crds.String())}
|
helmRelease.Spec.Upgrade = &helmv2.Upgrade{CRDs: helmv2.CRDsPolicy(helmReleaseArgs.crds.String())}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ func createImagePolicyRun(cmd *cobra.Command, args []string) error {
|
|||||||
Labels: labels,
|
Labels: labels,
|
||||||
},
|
},
|
||||||
Spec: imagev1.ImagePolicySpec{
|
Spec: imagev1.ImagePolicySpec{
|
||||||
ImageRepositoryRef: meta.LocalObjectReference{
|
ImageRepositoryRef: meta.NamespacedObjectReference{
|
||||||
Name: imagePolicyArgs.imageRef,
|
Name: imagePolicyArgs.imageRef,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import (
|
|||||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
|
|
||||||
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
|
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
|
||||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
|
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
|
||||||
"github.com/fluxcd/pkg/apis/meta"
|
"github.com/fluxcd/pkg/apis/meta"
|
||||||
|
|
||||||
"github.com/fluxcd/flux2/internal/flags"
|
"github.com/fluxcd/flux2/internal/flags"
|
||||||
@@ -49,7 +49,6 @@ var createKsCmd = &cobra.Command{
|
|||||||
--path="./examples/contour/" \
|
--path="./examples/contour/" \
|
||||||
--prune=true \
|
--prune=true \
|
||||||
--interval=10m \
|
--interval=10m \
|
||||||
--validation=client \
|
|
||||||
--health-check="Deployment/contour.projectcontour" \
|
--health-check="Deployment/contour.projectcontour" \
|
||||||
--health-check="DaemonSet/envoy.projectcontour" \
|
--health-check="DaemonSet/envoy.projectcontour" \
|
||||||
--health-check-timeout=3m
|
--health-check-timeout=3m
|
||||||
@@ -60,8 +59,7 @@ var createKsCmd = &cobra.Command{
|
|||||||
--source=GitRepository/webapp \
|
--source=GitRepository/webapp \
|
||||||
--path="./deploy/overlays/dev" \
|
--path="./deploy/overlays/dev" \
|
||||||
--prune=true \
|
--prune=true \
|
||||||
--interval=5m \
|
--interval=5m
|
||||||
--validation=client
|
|
||||||
|
|
||||||
# Create a Kustomization using a source from a different namespace
|
# Create a Kustomization using a source from a different namespace
|
||||||
flux create kustomization podinfo \
|
flux create kustomization podinfo \
|
||||||
@@ -69,8 +67,7 @@ var createKsCmd = &cobra.Command{
|
|||||||
--source=GitRepository/podinfo.flux-system \
|
--source=GitRepository/podinfo.flux-system \
|
||||||
--path="./deploy/overlays/dev" \
|
--path="./deploy/overlays/dev" \
|
||||||
--prune=true \
|
--prune=true \
|
||||||
--interval=5m \
|
--interval=5m
|
||||||
--validation=client
|
|
||||||
|
|
||||||
# Create a Kustomization resource that references a Bucket
|
# Create a Kustomization resource that references a Bucket
|
||||||
flux create kustomization secrets \
|
flux create kustomization secrets \
|
||||||
@@ -108,6 +105,8 @@ func init() {
|
|||||||
createKsCmd.Flags().Var(&kustomizationArgs.decryptionProvider, "decryption-provider", kustomizationArgs.decryptionProvider.Description())
|
createKsCmd.Flags().Var(&kustomizationArgs.decryptionProvider, "decryption-provider", kustomizationArgs.decryptionProvider.Description())
|
||||||
createKsCmd.Flags().StringVar(&kustomizationArgs.decryptionSecret, "decryption-secret", "", "set the Kubernetes secret name that contains the OpenPGP private keys used for sops decryption")
|
createKsCmd.Flags().StringVar(&kustomizationArgs.decryptionSecret, "decryption-secret", "", "set the Kubernetes secret name that contains the OpenPGP private keys used for sops decryption")
|
||||||
createKsCmd.Flags().StringVar(&kustomizationArgs.targetNamespace, "target-namespace", "", "overrides the namespace of all Kustomization objects reconciled by this Kustomization")
|
createKsCmd.Flags().StringVar(&kustomizationArgs.targetNamespace, "target-namespace", "", "overrides the namespace of all Kustomization objects reconciled by this Kustomization")
|
||||||
|
createKsCmd.Flags().MarkDeprecated("validation", "this arg is no longer used, all resources are validated using server-side apply dry-run")
|
||||||
|
|
||||||
createCmd.AddCommand(createKsCmd)
|
createCmd.AddCommand(createKsCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +157,6 @@ func createKsCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
Namespace: kustomizationArgs.source.Namespace,
|
Namespace: kustomizationArgs.source.Namespace,
|
||||||
},
|
},
|
||||||
Suspend: false,
|
Suspend: false,
|
||||||
Validation: kustomizationArgs.validation,
|
|
||||||
TargetNamespace: kustomizationArgs.targetNamespace,
|
TargetNamespace: kustomizationArgs.targetNamespace,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var deleteAlertCmd = &cobra.Command{
|
|||||||
Long: "The delete alert command removes the given Alert from the cluster.",
|
Long: "The delete alert command removes the given Alert from the cluster.",
|
||||||
Example: ` # Delete an Alert and the Kubernetes resources created by it
|
Example: ` # Delete an Alert and the Kubernetes resources created by it
|
||||||
flux delete alert main`,
|
flux delete alert main`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.AlertKind)),
|
||||||
RunE: deleteCommand{
|
RunE: deleteCommand{
|
||||||
apiType: alertType,
|
apiType: alertType,
|
||||||
object: universalAdapter{¬ificationv1.Alert{}},
|
object: universalAdapter{¬ificationv1.Alert{}},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var deleteAlertProviderCmd = &cobra.Command{
|
|||||||
Long: "The delete alert-provider command removes the given Provider from the cluster.",
|
Long: "The delete alert-provider command removes the given Provider from the cluster.",
|
||||||
Example: ` # Delete a Provider and the Kubernetes resources created by it
|
Example: ` # Delete a Provider and the Kubernetes resources created by it
|
||||||
flux delete alert-provider slack`,
|
flux delete alert-provider slack`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.ProviderKind)),
|
||||||
RunE: deleteCommand{
|
RunE: deleteCommand{
|
||||||
apiType: alertProviderType,
|
apiType: alertProviderType,
|
||||||
object: universalAdapter{¬ificationv1.Provider{}},
|
object: universalAdapter{¬ificationv1.Provider{}},
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ var deleteHelmReleaseCmd = &cobra.Command{
|
|||||||
Long: "The delete helmrelease command removes the given HelmRelease from the cluster.",
|
Long: "The delete helmrelease command removes the given HelmRelease from the cluster.",
|
||||||
Example: ` # Delete a Helm release and the Kubernetes resources created by it
|
Example: ` # Delete a Helm release and the Kubernetes resources created by it
|
||||||
flux delete hr podinfo`,
|
flux delete hr podinfo`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(helmv2.GroupVersion.WithKind(helmv2.HelmReleaseKind)),
|
||||||
RunE: deleteCommand{
|
RunE: deleteCommand{
|
||||||
apiType: helmReleaseType,
|
apiType: helmReleaseType,
|
||||||
object: universalAdapter{&helmv2.HelmRelease{}},
|
object: universalAdapter{&helmv2.HelmRelease{}},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var deleteImagePolicyCmd = &cobra.Command{
|
|||||||
Long: "The delete image policy command deletes the given ImagePolicy from the cluster.",
|
Long: "The delete image policy command deletes the given ImagePolicy from the cluster.",
|
||||||
Example: ` # Delete an image policy
|
Example: ` # Delete an image policy
|
||||||
flux delete image policy alpine3.x`,
|
flux delete image policy alpine3.x`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(imagev1.GroupVersion.WithKind(imagev1.ImagePolicyKind)),
|
||||||
RunE: deleteCommand{
|
RunE: deleteCommand{
|
||||||
apiType: imagePolicyType,
|
apiType: imagePolicyType,
|
||||||
object: universalAdapter{&imagev1.ImagePolicy{}},
|
object: universalAdapter{&imagev1.ImagePolicy{}},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var deleteImageRepositoryCmd = &cobra.Command{
|
|||||||
Long: "The delete image repository command deletes the given ImageRepository from the cluster.",
|
Long: "The delete image repository command deletes the given ImageRepository from the cluster.",
|
||||||
Example: ` # Delete an image repository
|
Example: ` # Delete an image repository
|
||||||
flux delete image repository alpine`,
|
flux delete image repository alpine`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(imagev1.GroupVersion.WithKind(imagev1.ImageRepositoryKind)),
|
||||||
RunE: deleteCommand{
|
RunE: deleteCommand{
|
||||||
apiType: imageRepositoryType,
|
apiType: imageRepositoryType,
|
||||||
object: universalAdapter{&imagev1.ImageRepository{}},
|
object: universalAdapter{&imagev1.ImageRepository{}},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var deleteImageUpdateCmd = &cobra.Command{
|
|||||||
Long: "The delete image update command deletes the given ImageUpdateAutomation from the cluster.",
|
Long: "The delete image update command deletes the given ImageUpdateAutomation from the cluster.",
|
||||||
Example: ` # Delete an image update automation
|
Example: ` # Delete an image update automation
|
||||||
flux delete image update latest-images`,
|
flux delete image update latest-images`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(autov1.GroupVersion.WithKind(autov1.ImageUpdateAutomationKind)),
|
||||||
RunE: deleteCommand{
|
RunE: deleteCommand{
|
||||||
apiType: imageUpdateAutomationType,
|
apiType: imageUpdateAutomationType,
|
||||||
object: universalAdapter{&autov1.ImageUpdateAutomation{}},
|
object: universalAdapter{&autov1.ImageUpdateAutomation{}},
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
|
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var deleteKsCmd = &cobra.Command{
|
var deleteKsCmd = &cobra.Command{
|
||||||
@@ -29,6 +29,7 @@ var deleteKsCmd = &cobra.Command{
|
|||||||
Long: "The delete kustomization command deletes the given Kustomization from the cluster.",
|
Long: "The delete kustomization command deletes the given Kustomization from the cluster.",
|
||||||
Example: ` # Delete a kustomization and the Kubernetes resources created by it
|
Example: ` # Delete a kustomization and the Kubernetes resources created by it
|
||||||
flux delete kustomization podinfo`,
|
flux delete kustomization podinfo`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(kustomizev1.GroupVersion.WithKind(kustomizev1.KustomizationKind)),
|
||||||
RunE: deleteCommand{
|
RunE: deleteCommand{
|
||||||
apiType: kustomizationType,
|
apiType: kustomizationType,
|
||||||
object: universalAdapter{&kustomizev1.Kustomization{}},
|
object: universalAdapter{&kustomizev1.Kustomization{}},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var deleteReceiverCmd = &cobra.Command{
|
|||||||
Long: "The delete receiver command removes the given Receiver from the cluster.",
|
Long: "The delete receiver command removes the given Receiver from the cluster.",
|
||||||
Example: ` # Delete an Receiver and the Kubernetes resources created by it
|
Example: ` # Delete an Receiver and the Kubernetes resources created by it
|
||||||
flux delete receiver main`,
|
flux delete receiver main`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.ReceiverKind)),
|
||||||
RunE: deleteCommand{
|
RunE: deleteCommand{
|
||||||
apiType: receiverType,
|
apiType: receiverType,
|
||||||
object: universalAdapter{¬ificationv1.Receiver{}},
|
object: universalAdapter{¬ificationv1.Receiver{}},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var deleteSourceBucketCmd = &cobra.Command{
|
|||||||
Long: "The delete source bucket command deletes the given Bucket from the cluster.",
|
Long: "The delete source bucket command deletes the given Bucket from the cluster.",
|
||||||
Example: ` # Delete a Bucket source
|
Example: ` # Delete a Bucket source
|
||||||
flux delete source bucket podinfo`,
|
flux delete source bucket podinfo`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.BucketKind)),
|
||||||
RunE: deleteCommand{
|
RunE: deleteCommand{
|
||||||
apiType: bucketType,
|
apiType: bucketType,
|
||||||
object: universalAdapter{&sourcev1.Bucket{}},
|
object: universalAdapter{&sourcev1.Bucket{}},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var deleteSourceGitCmd = &cobra.Command{
|
|||||||
Long: "The delete source git command deletes the given GitRepository from the cluster.",
|
Long: "The delete source git command deletes the given GitRepository from the cluster.",
|
||||||
Example: ` # Delete a Git repository
|
Example: ` # Delete a Git repository
|
||||||
flux delete source git podinfo`,
|
flux delete source git podinfo`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.GitRepositoryKind)),
|
||||||
RunE: deleteCommand{
|
RunE: deleteCommand{
|
||||||
apiType: gitRepositoryType,
|
apiType: gitRepositoryType,
|
||||||
object: universalAdapter{&sourcev1.GitRepository{}},
|
object: universalAdapter{&sourcev1.GitRepository{}},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var deleteSourceHelmCmd = &cobra.Command{
|
|||||||
Long: "The delete source helm command deletes the given HelmRepository from the cluster.",
|
Long: "The delete source helm command deletes the given HelmRepository from the cluster.",
|
||||||
Example: ` # Delete a Helm repository
|
Example: ` # Delete a Helm repository
|
||||||
flux delete source helm podinfo`,
|
flux delete source helm podinfo`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmRepositoryKind)),
|
||||||
RunE: deleteCommand{
|
RunE: deleteCommand{
|
||||||
apiType: helmRepositoryType,
|
apiType: helmRepositoryType,
|
||||||
object: universalAdapter{&sourcev1.HelmRepository{}},
|
object: universalAdapter{&sourcev1.HelmRepository{}},
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ var exportAlertCmd = &cobra.Command{
|
|||||||
|
|
||||||
# Export a Alert
|
# Export a Alert
|
||||||
flux export alert main > main.yaml`,
|
flux export alert main > main.yaml`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.AlertKind)),
|
||||||
RunE: exportCommand{
|
RunE: exportCommand{
|
||||||
object: alertAdapter{¬ificationv1.Alert{}},
|
object: alertAdapter{¬ificationv1.Alert{}},
|
||||||
list: alertListAdapter{¬ificationv1.AlertList{}},
|
list: alertListAdapter{¬ificationv1.AlertList{}},
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ var exportAlertProviderCmd = &cobra.Command{
|
|||||||
|
|
||||||
# Export a Provider
|
# Export a Provider
|
||||||
flux export alert-provider slack > slack.yaml`,
|
flux export alert-provider slack > slack.yaml`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.ProviderKind)),
|
||||||
RunE: exportCommand{
|
RunE: exportCommand{
|
||||||
object: alertProviderAdapter{¬ificationv1.Provider{}},
|
object: alertProviderAdapter{¬ificationv1.Provider{}},
|
||||||
list: alertProviderListAdapter{¬ificationv1.ProviderList{}},
|
list: alertProviderListAdapter{¬ificationv1.ProviderList{}},
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ var exportHelmReleaseCmd = &cobra.Command{
|
|||||||
|
|
||||||
# Export a HelmRelease
|
# Export a HelmRelease
|
||||||
flux export hr my-app > app-release.yaml`,
|
flux export hr my-app > app-release.yaml`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(helmv2.GroupVersion.WithKind(helmv2.HelmReleaseKind)),
|
||||||
RunE: exportCommand{
|
RunE: exportCommand{
|
||||||
object: helmReleaseAdapter{&helmv2.HelmRelease{}},
|
object: helmReleaseAdapter{&helmv2.HelmRelease{}},
|
||||||
list: helmReleaseListAdapter{&helmv2.HelmReleaseList{}},
|
list: helmReleaseListAdapter{&helmv2.HelmReleaseList{}},
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ var exportImagePolicyCmd = &cobra.Command{
|
|||||||
|
|
||||||
# Export a specific policy
|
# Export a specific policy
|
||||||
flux export image policy alpine1x > alpine1x.yaml`,
|
flux export image policy alpine1x > alpine1x.yaml`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(imagev1.GroupVersion.WithKind(imagev1.ImagePolicyKind)),
|
||||||
RunE: exportCommand{
|
RunE: exportCommand{
|
||||||
object: imagePolicyAdapter{&imagev1.ImagePolicy{}},
|
object: imagePolicyAdapter{&imagev1.ImagePolicy{}},
|
||||||
list: imagePolicyListAdapter{&imagev1.ImagePolicyList{}},
|
list: imagePolicyListAdapter{&imagev1.ImagePolicyList{}},
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ var exportImageRepositoryCmd = &cobra.Command{
|
|||||||
|
|
||||||
# Export a specific ImageRepository resource
|
# Export a specific ImageRepository resource
|
||||||
flux export image repository alpine > alpine.yaml`,
|
flux export image repository alpine > alpine.yaml`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(imagev1.GroupVersion.WithKind(imagev1.ImageRepositoryKind)),
|
||||||
RunE: exportCommand{
|
RunE: exportCommand{
|
||||||
object: imageRepositoryAdapter{&imagev1.ImageRepository{}},
|
object: imageRepositoryAdapter{&imagev1.ImageRepository{}},
|
||||||
list: imageRepositoryListAdapter{&imagev1.ImageRepositoryList{}},
|
list: imageRepositoryListAdapter{&imagev1.ImageRepositoryList{}},
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ var exportImageUpdateCmd = &cobra.Command{
|
|||||||
|
|
||||||
# Export a specific automation
|
# Export a specific automation
|
||||||
flux export image update latest-images > latest.yaml`,
|
flux export image update latest-images > latest.yaml`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(autov1.GroupVersion.WithKind(autov1.ImageUpdateAutomationKind)),
|
||||||
RunE: exportCommand{
|
RunE: exportCommand{
|
||||||
object: imageUpdateAutomationAdapter{&autov1.ImageUpdateAutomation{}},
|
object: imageUpdateAutomationAdapter{&autov1.ImageUpdateAutomation{}},
|
||||||
list: imageUpdateAutomationListAdapter{&autov1.ImageUpdateAutomationList{}},
|
list: imageUpdateAutomationListAdapter{&autov1.ImageUpdateAutomationList{}},
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
||||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
|
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var exportKsCmd = &cobra.Command{
|
var exportKsCmd = &cobra.Command{
|
||||||
@@ -33,6 +33,7 @@ var exportKsCmd = &cobra.Command{
|
|||||||
|
|
||||||
# Export a Kustomization
|
# Export a Kustomization
|
||||||
flux export kustomization my-app > kustomization.yaml`,
|
flux export kustomization my-app > kustomization.yaml`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(kustomizev1.GroupVersion.WithKind(kustomizev1.KustomizationKind)),
|
||||||
RunE: exportCommand{
|
RunE: exportCommand{
|
||||||
object: kustomizationAdapter{&kustomizev1.Kustomization{}},
|
object: kustomizationAdapter{&kustomizev1.Kustomization{}},
|
||||||
list: kustomizationListAdapter{&kustomizev1.KustomizationList{}},
|
list: kustomizationListAdapter{&kustomizev1.KustomizationList{}},
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ var exportReceiverCmd = &cobra.Command{
|
|||||||
|
|
||||||
# Export a Receiver
|
# Export a Receiver
|
||||||
flux export receiver main > main.yaml`,
|
flux export receiver main > main.yaml`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.ReceiverKind)),
|
||||||
RunE: exportCommand{
|
RunE: exportCommand{
|
||||||
list: receiverListAdapter{¬ificationv1.ReceiverList{}},
|
list: receiverListAdapter{¬ificationv1.ReceiverList{}},
|
||||||
object: receiverAdapter{¬ificationv1.Receiver{}},
|
object: receiverAdapter{¬ificationv1.Receiver{}},
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ var exportSourceBucketCmd = &cobra.Command{
|
|||||||
|
|
||||||
# Export a Bucket source including the static credentials
|
# Export a Bucket source including the static credentials
|
||||||
flux export source bucket my-bucket --with-credentials > source.yaml`,
|
flux export source bucket my-bucket --with-credentials > source.yaml`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.BucketKind)),
|
||||||
RunE: exportWithSecretCommand{
|
RunE: exportWithSecretCommand{
|
||||||
list: bucketListAdapter{&sourcev1.BucketList{}},
|
list: bucketListAdapter{&sourcev1.BucketList{}},
|
||||||
object: bucketAdapter{&sourcev1.Bucket{}},
|
object: bucketAdapter{&sourcev1.Bucket{}},
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ var exportSourceGitCmd = &cobra.Command{
|
|||||||
|
|
||||||
# Export a GitRepository source including the SSH key pair or basic auth credentials
|
# Export a GitRepository source including the SSH key pair or basic auth credentials
|
||||||
flux export source git my-private-repo --with-credentials > source.yaml`,
|
flux export source git my-private-repo --with-credentials > source.yaml`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.GitRepositoryKind)),
|
||||||
RunE: exportWithSecretCommand{
|
RunE: exportWithSecretCommand{
|
||||||
object: gitRepositoryAdapter{&sourcev1.GitRepository{}},
|
object: gitRepositoryAdapter{&sourcev1.GitRepository{}},
|
||||||
list: gitRepositoryListAdapter{&sourcev1.GitRepositoryList{}},
|
list: gitRepositoryListAdapter{&sourcev1.GitRepositoryList{}},
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ var exportSourceHelmCmd = &cobra.Command{
|
|||||||
|
|
||||||
# Export a HelmRepository source including the basic auth credentials
|
# Export a HelmRepository source including the basic auth credentials
|
||||||
flux export source helm my-private-repo --with-credentials > source.yaml`,
|
flux export source helm my-private-repo --with-credentials > source.yaml`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmRepositoryKind)),
|
||||||
RunE: exportWithSecretCommand{
|
RunE: exportWithSecretCommand{
|
||||||
list: helmRepositoryListAdapter{&sourcev1.HelmRepositoryList{}},
|
list: helmRepositoryListAdapter{&sourcev1.HelmRepositoryList{}},
|
||||||
object: helmRepositoryAdapter{&sourcev1.HelmRepository{}},
|
object: helmRepositoryAdapter{&sourcev1.HelmRepository{}},
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ func (get getCommand) run(cmd *cobra.Command, args []string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
utils.PrintTable(cmd.OutOrStderr(), header, rows)
|
utils.PrintTable(cmd.OutOrStdout(), header, rows)
|
||||||
|
|
||||||
if getAll {
|
if getAll {
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ var getAlertCmd = &cobra.Command{
|
|||||||
Long: "The get alert command prints the statuses of the resources.",
|
Long: "The get alert command prints the statuses of the resources.",
|
||||||
Example: ` # List all Alerts and their status
|
Example: ` # List all Alerts and their status
|
||||||
flux get alerts`,
|
flux get alerts`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.AlertKind)),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
get := getCommand{
|
get := getCommand{
|
||||||
apiType: alertType,
|
apiType: alertType,
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ var getAlertProviderCmd = &cobra.Command{
|
|||||||
Long: "The get alert-provider command prints the statuses of the resources.",
|
Long: "The get alert-provider command prints the statuses of the resources.",
|
||||||
Example: ` # List all Providers and their status
|
Example: ` # List all Providers and their status
|
||||||
flux get alert-providers`,
|
flux get alert-providers`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.ProviderKind)),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
get := getCommand{
|
get := getCommand{
|
||||||
apiType: alertProviderType,
|
apiType: alertProviderType,
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
|
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
|
||||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
|
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
|
||||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
|
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ var getHelmReleaseCmd = &cobra.Command{
|
|||||||
Long: "The get helmreleases command prints the statuses of the resources.",
|
Long: "The get helmreleases command prints the statuses of the resources.",
|
||||||
Example: ` # List all Helm releases and their status
|
Example: ` # List all Helm releases and their status
|
||||||
flux get helmreleases`,
|
flux get helmreleases`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(helmv2.GroupVersion.WithKind(helmv2.HelmReleaseKind)),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
get := getCommand{
|
get := getCommand{
|
||||||
apiType: helmReleaseType,
|
apiType: helmReleaseType,
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ var getImagePolicyCmd = &cobra.Command{
|
|||||||
|
|
||||||
# List image policies from all namespaces
|
# List image policies from all namespaces
|
||||||
flux get image policy --all-namespaces`,
|
flux get image policy --all-namespaces`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(imagev1.GroupVersion.WithKind(imagev1.ImagePolicyKind)),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
get := getCommand{
|
get := getCommand{
|
||||||
apiType: imagePolicyType,
|
apiType: imagePolicyType,
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ var getImageRepositoryCmd = &cobra.Command{
|
|||||||
|
|
||||||
# List image repositories from all namespaces
|
# List image repositories from all namespaces
|
||||||
flux get image repository --all-namespaces`,
|
flux get image repository --all-namespaces`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(imagev1.GroupVersion.WithKind(imagev1.ImageRepositoryKind)),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
get := getCommand{
|
get := getCommand{
|
||||||
apiType: imageRepositoryType,
|
apiType: imageRepositoryType,
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ var getImageUpdateCmd = &cobra.Command{
|
|||||||
|
|
||||||
# List image update automations from all namespaces
|
# List image update automations from all namespaces
|
||||||
flux get image update --all-namespaces`,
|
flux get image update --all-namespaces`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(autov1.GroupVersion.WithKind(autov1.ImageUpdateAutomationKind)),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
get := getCommand{
|
get := getCommand{
|
||||||
apiType: imageUpdateAutomationType,
|
apiType: imageUpdateAutomationType,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
|
||||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
|
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var getKsCmd = &cobra.Command{
|
var getKsCmd = &cobra.Command{
|
||||||
@@ -34,6 +34,7 @@ var getKsCmd = &cobra.Command{
|
|||||||
Long: "The get kustomizations command prints the statuses of the resources.",
|
Long: "The get kustomizations command prints the statuses of the resources.",
|
||||||
Example: ` # List all kustomizations and their status
|
Example: ` # List all kustomizations and their status
|
||||||
flux get kustomizations`,
|
flux get kustomizations`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(kustomizev1.GroupVersion.WithKind(kustomizev1.KustomizationKind)),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
get := getCommand{
|
get := getCommand{
|
||||||
apiType: kustomizationType,
|
apiType: kustomizationType,
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ var getReceiverCmd = &cobra.Command{
|
|||||||
Long: "The get receiver command prints the statuses of the resources.",
|
Long: "The get receiver command prints the statuses of the resources.",
|
||||||
Example: ` # List all Receiver and their status
|
Example: ` # List all Receiver and their status
|
||||||
flux get receivers`,
|
flux get receivers`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.ReceiverKind)),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
get := getCommand{
|
get := getCommand{
|
||||||
apiType: receiverType,
|
apiType: receiverType,
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ var getSourceBucketCmd = &cobra.Command{
|
|||||||
|
|
||||||
# List buckets from all namespaces
|
# List buckets from all namespaces
|
||||||
flux get sources helm --all-namespaces`,
|
flux get sources helm --all-namespaces`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.BucketKind)),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
get := getCommand{
|
get := getCommand{
|
||||||
apiType: bucketType,
|
apiType: bucketType,
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ var getSourceHelmChartCmd = &cobra.Command{
|
|||||||
|
|
||||||
# List Helm charts from all namespaces
|
# List Helm charts from all namespaces
|
||||||
flux get sources chart --all-namespaces`,
|
flux get sources chart --all-namespaces`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmChartKind)),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
get := getCommand{
|
get := getCommand{
|
||||||
apiType: helmChartType,
|
apiType: helmChartType,
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ var getSourceGitCmd = &cobra.Command{
|
|||||||
|
|
||||||
# List Git repositories from all namespaces
|
# List Git repositories from all namespaces
|
||||||
flux get sources git --all-namespaces`,
|
flux get sources git --all-namespaces`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.GitRepositoryKind)),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
get := getCommand{
|
get := getCommand{
|
||||||
apiType: gitRepositoryType,
|
apiType: gitRepositoryType,
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ var getSourceHelmCmd = &cobra.Command{
|
|||||||
|
|
||||||
# List Helm repositories from all namespaces
|
# List Helm repositories from all namespaces
|
||||||
flux get sources helm --all-namespaces`,
|
flux get sources helm --all-namespaces`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmRepositoryKind)),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
get := getCommand{
|
get := getCommand{
|
||||||
apiType: helmRepositoryType,
|
apiType: helmRepositoryType,
|
||||||
|
|||||||
@@ -41,13 +41,13 @@ If a previous version is installed, then an in-place upgrade will be performed.`
|
|||||||
flux install --version=latest --namespace=flux-system
|
flux install --version=latest --namespace=flux-system
|
||||||
|
|
||||||
# Install a specific version and a series of components
|
# Install a specific version and a series of components
|
||||||
flux install --dry-run --version=v0.0.7 --components="source-controller,kustomize-controller"
|
flux install --version=v0.0.7 --components="source-controller,kustomize-controller"
|
||||||
|
|
||||||
# Install Flux onto tainted Kubernetes nodes
|
# Install Flux onto tainted Kubernetes nodes
|
||||||
flux install --toleration-keys=node.kubernetes.io/dedicated-to-flux
|
flux install --toleration-keys=node.kubernetes.io/dedicated-to-flux
|
||||||
|
|
||||||
# Dry-run install with manifests preview
|
# Dry-run install
|
||||||
flux install --dry-run --verbose
|
flux install --export | kubectl apply --dry-run=client -f-
|
||||||
|
|
||||||
# Write install manifests to file
|
# Write install manifests to file
|
||||||
flux install --export > flux-system.yaml`,
|
flux install --export > flux-system.yaml`,
|
||||||
@@ -102,6 +102,7 @@ func init() {
|
|||||||
"list of toleration keys used to schedule the components pods onto nodes with matching taints")
|
"list of toleration keys used to schedule the components pods onto nodes with matching taints")
|
||||||
installCmd.Flags().MarkHidden("manifests")
|
installCmd.Flags().MarkHidden("manifests")
|
||||||
installCmd.Flags().MarkDeprecated("arch", "multi-arch container image is now available for AMD64, ARMv7 and ARM64")
|
installCmd.Flags().MarkDeprecated("arch", "multi-arch container image is now available for AMD64, ARMv7 and ARM64")
|
||||||
|
installCmd.Flags().MarkDeprecated("dry-run", "use 'flux install --export | kubectl apply --dry-run=client -f-'")
|
||||||
rootCmd.AddCommand(installCmd)
|
rootCmd.AddCommand(installCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,25 +189,19 @@ func installCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
logger.Successf("manifests build completed")
|
logger.Successf("manifests build completed")
|
||||||
logger.Actionf("installing components in %s namespace", rootArgs.namespace)
|
logger.Actionf("installing components in %s namespace", rootArgs.namespace)
|
||||||
applyOutput := utils.ModeStderrOS
|
|
||||||
if rootArgs.verbose {
|
|
||||||
applyOutput = utils.ModeOS
|
|
||||||
}
|
|
||||||
|
|
||||||
kubectlArgs := []string{"apply", "-f", filepath.Join(tmpDir, manifest.Path)}
|
|
||||||
if installArgs.dryRun {
|
|
||||||
kubectlArgs = append(kubectlArgs, "--dry-run=client")
|
|
||||||
applyOutput = utils.ModeOS
|
|
||||||
}
|
|
||||||
if _, err := utils.ExecKubectlCommand(ctx, applyOutput, rootArgs.kubeconfig, rootArgs.kubecontext, kubectlArgs...); err != nil {
|
|
||||||
return fmt.Errorf("install failed: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if installArgs.dryRun {
|
if installArgs.dryRun {
|
||||||
logger.Successf("install dry-run finished")
|
logger.Successf("install dry-run finished")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applyOutput, err := utils.Apply(ctx, rootArgs.kubeconfig, rootArgs.kubecontext, filepath.Join(tmpDir, manifest.Path))
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("install failed: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Fprintln(os.Stderr, applyOutput)
|
||||||
|
|
||||||
kubeConfig, err := utils.KubeConfig(rootArgs.kubeconfig, rootArgs.kubecontext)
|
kubeConfig, err := utils.KubeConfig(rootArgs.kubeconfig, rootArgs.kubecontext)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("install failed: %w", err)
|
return fmt.Errorf("install failed: %w", err)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
|
|
||||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
|
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// kustomizev1.Kustomization
|
// kustomizev1.Kustomization
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ func TestKustomizationFromGit(t *testing.T) {
|
|||||||
"testdata/kustomization/create_source_git.golden",
|
"testdata/kustomization/create_source_git.golden",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"create kustomization tkfg --source=tkfg --path=./deploy/overlays/dev --prune=true --interval=5m --validation=client --health-check=Deployment/frontend.dev --health-check=Deployment/backend.dev --health-check-timeout=3m",
|
"create kustomization tkfg --source=tkfg --path=./deploy/overlays/dev --prune=true --interval=5m --health-check=Deployment/frontend.dev --health-check=Deployment/backend.dev --health-check-timeout=3m",
|
||||||
"testdata/kustomization/create_kustomization_from_git.golden",
|
"testdata/kustomization/create_kustomization_from_git.golden",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import (
|
|||||||
"html/template"
|
"html/template"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@@ -34,6 +35,7 @@ import (
|
|||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/client-go/rest"
|
"k8s.io/client-go/rest"
|
||||||
"k8s.io/kubectl/pkg/util"
|
"k8s.io/kubectl/pkg/util"
|
||||||
|
"k8s.io/kubectl/pkg/util/podutils"
|
||||||
|
|
||||||
"github.com/fluxcd/flux2/internal/flags"
|
"github.com/fluxcd/flux2/internal/flags"
|
||||||
"github.com/fluxcd/flux2/internal/utils"
|
"github.com/fluxcd/flux2/internal/utils"
|
||||||
@@ -174,7 +176,17 @@ func getPods(ctx context.Context, c *kubernetes.Clientset, label string) ([]core
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return ret, err
|
return ret, err
|
||||||
}
|
}
|
||||||
ret = append(ret, podList.Items...)
|
pods := []*corev1.Pod{}
|
||||||
|
for i := range podList.Items {
|
||||||
|
pod := podList.Items[i]
|
||||||
|
pods = append(pods, &pod)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(pods) > 0 {
|
||||||
|
// sort pods to prioritize running pods over others
|
||||||
|
sort.Sort(podutils.ByLogging(pods))
|
||||||
|
ret = append(ret, *pods[0])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret, nil
|
return ret, nil
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
corev1 "k8s.io/api/core/v1"
|
||||||
_ "k8s.io/client-go/plugin/pkg/client/auth"
|
_ "k8s.io/client-go/plugin/pkg/client/auth"
|
||||||
|
|
||||||
"github.com/fluxcd/flux2/pkg/manifestgen/install"
|
"github.com/fluxcd/flux2/pkg/manifestgen/install"
|
||||||
@@ -42,7 +43,7 @@ Command line utility for assembling Kubernetes CD pipelines the GitOps way.`,
|
|||||||
flux check --pre
|
flux check --pre
|
||||||
|
|
||||||
# Install the latest version of Flux
|
# Install the latest version of Flux
|
||||||
flux install --version=master
|
flux install
|
||||||
|
|
||||||
# Create a source for a public Git repository
|
# Create a source for a public Git repository
|
||||||
flux create source git webapp-latest \
|
flux create source git webapp-latest \
|
||||||
@@ -65,7 +66,6 @@ Command line utility for assembling Kubernetes CD pipelines the GitOps way.`,
|
|||||||
--path="./deploy/webapp/" \
|
--path="./deploy/webapp/" \
|
||||||
--prune=true \
|
--prune=true \
|
||||||
--interval=5m \
|
--interval=5m \
|
||||||
--validation=client \
|
|
||||||
--health-check="Deployment/backend.webapp" \
|
--health-check="Deployment/backend.webapp" \
|
||||||
--health-check="Deployment/frontend.webapp" \
|
--health-check="Deployment/frontend.webapp" \
|
||||||
--health-check-timeout=2m
|
--health-check-timeout=2m
|
||||||
@@ -108,11 +108,15 @@ var rootArgs = NewRootFlags()
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.PersistentFlags().StringVarP(&rootArgs.namespace, "namespace", "n", rootArgs.defaults.Namespace, "the namespace scope for this operation")
|
rootCmd.PersistentFlags().StringVarP(&rootArgs.namespace, "namespace", "n", rootArgs.defaults.Namespace, "the namespace scope for this operation")
|
||||||
|
rootCmd.RegisterFlagCompletionFunc("namespace", resourceNamesCompletionFunc(corev1.SchemeGroupVersion.WithKind("Namespace")))
|
||||||
|
|
||||||
rootCmd.PersistentFlags().DurationVar(&rootArgs.timeout, "timeout", 5*time.Minute, "timeout for this operation")
|
rootCmd.PersistentFlags().DurationVar(&rootArgs.timeout, "timeout", 5*time.Minute, "timeout for this operation")
|
||||||
rootCmd.PersistentFlags().BoolVar(&rootArgs.verbose, "verbose", false, "print generated objects")
|
rootCmd.PersistentFlags().BoolVar(&rootArgs.verbose, "verbose", false, "print generated objects")
|
||||||
rootCmd.PersistentFlags().StringVarP(&rootArgs.kubeconfig, "kubeconfig", "", "",
|
rootCmd.PersistentFlags().StringVarP(&rootArgs.kubeconfig, "kubeconfig", "", "",
|
||||||
"absolute path to the kubeconfig file")
|
"absolute path to the kubeconfig file")
|
||||||
|
|
||||||
rootCmd.PersistentFlags().StringVarP(&rootArgs.kubecontext, "context", "", "", "kubernetes context to use")
|
rootCmd.PersistentFlags().StringVarP(&rootArgs.kubecontext, "context", "", "", "kubernetes context to use")
|
||||||
|
rootCmd.RegisterFlagCompletionFunc("context", contextsCompletionFunc)
|
||||||
|
|
||||||
rootCmd.DisableAutoGenTag = true
|
rootCmd.DisableAutoGenTag = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,11 +116,13 @@ func (reconcile reconcileCommand) run(cmd *cobra.Command, args []string) error {
|
|||||||
reconciliationHandled(ctx, kubeClient, namespacedName, reconcile.object, lastHandledReconcileAt)); err != nil {
|
reconciliationHandled(ctx, kubeClient, namespacedName, reconcile.object, lastHandledReconcileAt)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
readyCond := apimeta.FindStatusCondition(*reconcile.object.GetStatusConditions(), meta.ReadyCondition)
|
||||||
|
if readyCond == nil {
|
||||||
|
return fmt.Errorf("status can't be determined")
|
||||||
|
}
|
||||||
|
|
||||||
logger.Successf("%s reconciliation completed", reconcile.kind)
|
if readyCond.Status != metav1.ConditionTrue {
|
||||||
|
return fmt.Errorf("%s reconciliation failed: ''%s", reconcile.kind, readyCond.Message)
|
||||||
if apimeta.IsStatusConditionFalse(*reconcile.object.GetStatusConditions(), meta.ReadyCondition) {
|
|
||||||
return fmt.Errorf("%s reconciliation failed", reconcile.kind)
|
|
||||||
}
|
}
|
||||||
logger.Successf(reconcile.object.successMessage())
|
logger.Successf(reconcile.object.successMessage())
|
||||||
return nil
|
return nil
|
||||||
@@ -133,7 +135,9 @@ func reconciliationHandled(ctx context.Context, kubeClient client.Client,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
return obj.lastHandledReconcileRequest() != lastHandledReconcileAt, nil
|
isProgressing := apimeta.IsStatusConditionPresentAndEqual(*obj.GetStatusConditions(),
|
||||||
|
meta.ReadyCondition, metav1.ConditionUnknown)
|
||||||
|
return obj.lastHandledReconcileRequest() != lastHandledReconcileAt && !isProgressing, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var reconcileAlertCmd = &cobra.Command{
|
|||||||
Long: `The reconcile alert command triggers a reconciliation of an Alert resource and waits for it to finish.`,
|
Long: `The reconcile alert command triggers a reconciliation of an Alert resource and waits for it to finish.`,
|
||||||
Example: ` # Trigger a reconciliation for an existing alert
|
Example: ` # Trigger a reconciliation for an existing alert
|
||||||
flux reconcile alert main`,
|
flux reconcile alert main`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.AlertKind)),
|
||||||
RunE: reconcileCommand{
|
RunE: reconcileCommand{
|
||||||
apiType: alertType,
|
apiType: alertType,
|
||||||
object: alertAdapter{¬ificationv1.Alert{}},
|
object: alertAdapter{¬ificationv1.Alert{}},
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ var reconcileAlertProviderCmd = &cobra.Command{
|
|||||||
Long: `The reconcile alert-provider command triggers a reconciliation of a Provider resource and waits for it to finish.`,
|
Long: `The reconcile alert-provider command triggers a reconciliation of a Provider resource and waits for it to finish.`,
|
||||||
Example: ` # Trigger a reconciliation for an existing provider
|
Example: ` # Trigger a reconciliation for an existing provider
|
||||||
flux reconcile alert-provider slack`,
|
flux reconcile alert-provider slack`,
|
||||||
RunE: reconcileAlertProviderCmdRun,
|
ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.ProviderKind)),
|
||||||
|
RunE: reconcileAlertProviderCmdRun,
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ The reconcile kustomization command triggers a reconciliation of a HelmRelease r
|
|||||||
|
|
||||||
# Trigger a reconciliation of the HelmRelease's source and apply changes
|
# Trigger a reconciliation of the HelmRelease's source and apply changes
|
||||||
flux reconcile hr podinfo --with-source`,
|
flux reconcile hr podinfo --with-source`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(helmv2.GroupVersion.WithKind(helmv2.HelmReleaseKind)),
|
||||||
RunE: reconcileWithSourceCommand{
|
RunE: reconcileWithSourceCommand{
|
||||||
apiType: helmReleaseType,
|
apiType: helmReleaseType,
|
||||||
object: helmReleaseAdapter{&helmv2.HelmRelease{}},
|
object: helmReleaseAdapter{&helmv2.HelmRelease{}},
|
||||||
|
|||||||
@@ -30,6 +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.`,
|
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
|
Example: ` # Trigger an scan for an existing image repository
|
||||||
flux reconcile image repository alpine`,
|
flux reconcile image repository alpine`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(imagev1.GroupVersion.WithKind(imagev1.ImagePolicyKind)),
|
||||||
RunE: reconcileCommand{
|
RunE: reconcileCommand{
|
||||||
apiType: imageRepositoryType,
|
apiType: imageRepositoryType,
|
||||||
object: imageRepositoryAdapter{&imagev1.ImageRepository{}},
|
object: imageRepositoryAdapter{&imagev1.ImageRepository{}},
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ var reconcileImageUpdateCmd = &cobra.Command{
|
|||||||
Long: `The reconcile image update command triggers a reconciliation of an ImageUpdateAutomation resource and waits for it to finish.`,
|
Long: `The reconcile image update command triggers a reconciliation of an ImageUpdateAutomation resource and waits for it to finish.`,
|
||||||
Example: ` # Trigger an automation run for an existing image update automation
|
Example: ` # Trigger an automation run for an existing image update automation
|
||||||
flux reconcile image update latest-images`,
|
flux reconcile image update latest-images`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(autov1.GroupVersion.WithKind(autov1.ImageUpdateAutomationKind)),
|
||||||
RunE: reconcileCommand{
|
RunE: reconcileCommand{
|
||||||
apiType: imageUpdateAutomationType,
|
apiType: imageUpdateAutomationType,
|
||||||
object: imageUpdateAutomationAdapter{&autov1.ImageUpdateAutomation{}},
|
object: imageUpdateAutomationAdapter{&autov1.ImageUpdateAutomation{}},
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
|
|
||||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
|
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -35,6 +35,7 @@ The reconcile kustomization command triggers a reconciliation of a Kustomization
|
|||||||
|
|
||||||
# Trigger a sync of the Kustomization's source and apply changes
|
# Trigger a sync of the Kustomization's source and apply changes
|
||||||
flux reconcile kustomization podinfo --with-source`,
|
flux reconcile kustomization podinfo --with-source`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(kustomizev1.GroupVersion.WithKind(kustomizev1.KustomizationKind)),
|
||||||
RunE: reconcileWithSourceCommand{
|
RunE: reconcileWithSourceCommand{
|
||||||
apiType: kustomizationType,
|
apiType: kustomizationType,
|
||||||
object: kustomizationAdapter{&kustomizev1.Kustomization{}},
|
object: kustomizationAdapter{&kustomizev1.Kustomization{}},
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ var reconcileReceiverCmd = &cobra.Command{
|
|||||||
Long: `The reconcile receiver command triggers a reconciliation of a Receiver resource and waits for it to finish.`,
|
Long: `The reconcile receiver command triggers a reconciliation of a Receiver resource and waits for it to finish.`,
|
||||||
Example: ` # Trigger a reconciliation for an existing receiver
|
Example: ` # Trigger a reconciliation for an existing receiver
|
||||||
flux reconcile receiver main`,
|
flux reconcile receiver main`,
|
||||||
RunE: reconcileReceiverCmdRun,
|
ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.ReceiverKind)),
|
||||||
|
RunE: reconcileReceiverCmdRun,
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ var reconcileSourceBucketCmd = &cobra.Command{
|
|||||||
Long: `The reconcile source command triggers a reconciliation of a Bucket resource and waits for it to finish.`,
|
Long: `The reconcile source command triggers a reconciliation of a Bucket resource and waits for it to finish.`,
|
||||||
Example: ` # Trigger a reconciliation for an existing source
|
Example: ` # Trigger a reconciliation for an existing source
|
||||||
flux reconcile source bucket podinfo`,
|
flux reconcile source bucket podinfo`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.BucketKind)),
|
||||||
RunE: reconcileCommand{
|
RunE: reconcileCommand{
|
||||||
apiType: bucketType,
|
apiType: bucketType,
|
||||||
object: bucketAdapter{&sourcev1.Bucket{}},
|
object: bucketAdapter{&sourcev1.Bucket{}},
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ var reconcileSourceGitCmd = &cobra.Command{
|
|||||||
Long: `The reconcile source command triggers a reconciliation of a GitRepository resource and waits for it to finish.`,
|
Long: `The reconcile source command triggers a reconciliation of a GitRepository resource and waits for it to finish.`,
|
||||||
Example: ` # Trigger a git pull for an existing source
|
Example: ` # Trigger a git pull for an existing source
|
||||||
flux reconcile source git podinfo`,
|
flux reconcile source git podinfo`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.GitRepositoryKind)),
|
||||||
RunE: reconcileCommand{
|
RunE: reconcileCommand{
|
||||||
apiType: gitRepositoryType,
|
apiType: gitRepositoryType,
|
||||||
object: gitRepositoryAdapter{&sourcev1.GitRepository{}},
|
object: gitRepositoryAdapter{&sourcev1.GitRepository{}},
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ var reconcileSourceHelmCmd = &cobra.Command{
|
|||||||
Long: `The reconcile source command triggers a reconciliation of a HelmRepository resource and waits for it to finish.`,
|
Long: `The reconcile source command triggers a reconciliation of a HelmRepository resource and waits for it to finish.`,
|
||||||
Example: ` # Trigger a reconciliation for an existing source
|
Example: ` # Trigger a reconciliation for an existing source
|
||||||
flux reconcile source helm podinfo`,
|
flux reconcile source helm podinfo`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmRepositoryKind)),
|
||||||
RunE: reconcileCommand{
|
RunE: reconcileCommand{
|
||||||
apiType: helmRepositoryType,
|
apiType: helmRepositoryType,
|
||||||
object: helmRepositoryAdapter{&sourcev1.HelmRepository{}},
|
object: helmRepositoryAdapter{&sourcev1.HelmRepository{}},
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
|
|
||||||
@@ -68,22 +69,26 @@ func (reconcile reconcileWithSourceCommand) run(cmd *cobra.Command, args []strin
|
|||||||
rootArgs.namespace = nsCopy
|
rootArgs.namespace = nsCopy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastHandledReconcileAt := reconcile.object.lastHandledReconcileRequest()
|
||||||
logger.Actionf("annotating %s %s in %s namespace", reconcile.kind, name, rootArgs.namespace)
|
logger.Actionf("annotating %s %s in %s namespace", reconcile.kind, name, rootArgs.namespace)
|
||||||
if err := requestReconciliation(ctx, kubeClient, namespacedName, reconcile.object); err != nil {
|
if err := requestReconciliation(ctx, kubeClient, namespacedName, reconcile.object); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
logger.Successf("%s annotated", reconcile.kind)
|
logger.Successf("%s annotated", reconcile.kind)
|
||||||
|
|
||||||
lastHandledReconcileAt := reconcile.object.lastHandledReconcileRequest()
|
|
||||||
logger.Waitingf("waiting for %s reconciliation", reconcile.kind)
|
logger.Waitingf("waiting for %s reconciliation", reconcile.kind)
|
||||||
if err := wait.PollImmediate(rootArgs.pollInterval, rootArgs.timeout,
|
if err := wait.PollImmediate(rootArgs.pollInterval, rootArgs.timeout,
|
||||||
reconciliationHandled(ctx, kubeClient, namespacedName, reconcile.object, lastHandledReconcileAt)); err != nil {
|
reconciliationHandled(ctx, kubeClient, namespacedName, reconcile.object, lastHandledReconcileAt)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
logger.Successf("%s reconciliation completed", reconcile.kind)
|
|
||||||
|
|
||||||
if apimeta.IsStatusConditionFalse(*reconcile.object.GetStatusConditions(), meta.ReadyCondition) {
|
readyCond := apimeta.FindStatusCondition(*reconcile.object.GetStatusConditions(), meta.ReadyCondition)
|
||||||
return fmt.Errorf("%s reconciliation failed", reconcile.kind)
|
if readyCond == nil {
|
||||||
|
return fmt.Errorf("status can't be determined")
|
||||||
|
}
|
||||||
|
|
||||||
|
if readyCond.Status != metav1.ConditionTrue {
|
||||||
|
return fmt.Errorf("%s reconciliation failed: %s", reconcile.kind, readyCond.Message)
|
||||||
}
|
}
|
||||||
logger.Successf(reconcile.object.successMessage())
|
logger.Successf(reconcile.object.successMessage())
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ var resumeAlertCmd = &cobra.Command{
|
|||||||
finish the apply.`,
|
finish the apply.`,
|
||||||
Example: ` # Resume reconciliation for an existing Alert
|
Example: ` # Resume reconciliation for an existing Alert
|
||||||
flux resume alert main`,
|
flux resume alert main`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.AlertKind)),
|
||||||
RunE: resumeCommand{
|
RunE: resumeCommand{
|
||||||
apiType: alertType,
|
apiType: alertType,
|
||||||
object: alertAdapter{¬ificationv1.Alert{}},
|
object: alertAdapter{¬ificationv1.Alert{}},
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ var resumeHrCmd = &cobra.Command{
|
|||||||
finish the apply.`,
|
finish the apply.`,
|
||||||
Example: ` # Resume reconciliation for an existing Helm release
|
Example: ` # Resume reconciliation for an existing Helm release
|
||||||
flux resume hr podinfo`,
|
flux resume hr podinfo`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(helmv2.GroupVersion.WithKind(helmv2.HelmReleaseKind)),
|
||||||
RunE: resumeCommand{
|
RunE: resumeCommand{
|
||||||
apiType: helmReleaseType,
|
apiType: helmReleaseType,
|
||||||
object: helmReleaseAdapter{&helmv2.HelmRelease{}},
|
object: helmReleaseAdapter{&helmv2.HelmRelease{}},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var resumeImageRepositoryCmd = &cobra.Command{
|
|||||||
Long: `The resume command marks a previously suspended ImageRepository resource for reconciliation and waits for it to finish.`,
|
Long: `The resume command marks a previously suspended ImageRepository resource for reconciliation and waits for it to finish.`,
|
||||||
Example: ` # Resume reconciliation for an existing ImageRepository
|
Example: ` # Resume reconciliation for an existing ImageRepository
|
||||||
flux resume image repository alpine`,
|
flux resume image repository alpine`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(imagev1.GroupVersion.WithKind(imagev1.ImageRepositoryKind)),
|
||||||
RunE: resumeCommand{
|
RunE: resumeCommand{
|
||||||
apiType: imageRepositoryType,
|
apiType: imageRepositoryType,
|
||||||
object: imageRepositoryAdapter{&imagev1.ImageRepository{}},
|
object: imageRepositoryAdapter{&imagev1.ImageRepository{}},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var resumeImageUpdateCmd = &cobra.Command{
|
|||||||
Long: `The resume command marks a previously suspended ImageUpdateAutomation resource for reconciliation and waits for it to finish.`,
|
Long: `The resume command marks a previously suspended ImageUpdateAutomation resource for reconciliation and waits for it to finish.`,
|
||||||
Example: ` # Resume reconciliation for an existing ImageUpdateAutomation
|
Example: ` # Resume reconciliation for an existing ImageUpdateAutomation
|
||||||
flux resume image update latest-images`,
|
flux resume image update latest-images`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(autov1.GroupVersion.WithKind(autov1.ImageUpdateAutomationKind)),
|
||||||
RunE: resumeCommand{
|
RunE: resumeCommand{
|
||||||
apiType: imageUpdateAutomationType,
|
apiType: imageUpdateAutomationType,
|
||||||
object: imageUpdateAutomationAdapter{&autov1.ImageUpdateAutomation{}},
|
object: imageUpdateAutomationAdapter{&autov1.ImageUpdateAutomation{}},
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import (
|
|||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
|
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var resumeKsCmd = &cobra.Command{
|
var resumeKsCmd = &cobra.Command{
|
||||||
@@ -32,6 +32,7 @@ var resumeKsCmd = &cobra.Command{
|
|||||||
finish the apply.`,
|
finish the apply.`,
|
||||||
Example: ` # Resume reconciliation for an existing Kustomization
|
Example: ` # Resume reconciliation for an existing Kustomization
|
||||||
flux resume ks podinfo`,
|
flux resume ks podinfo`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(kustomizev1.GroupVersion.WithKind(kustomizev1.KustomizationKind)),
|
||||||
RunE: resumeCommand{
|
RunE: resumeCommand{
|
||||||
apiType: kustomizationType,
|
apiType: kustomizationType,
|
||||||
object: kustomizationAdapter{&kustomizev1.Kustomization{}},
|
object: kustomizationAdapter{&kustomizev1.Kustomization{}},
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ var resumeReceiverCmd = &cobra.Command{
|
|||||||
finish the apply.`,
|
finish the apply.`,
|
||||||
Example: ` # Resume reconciliation for an existing Receiver
|
Example: ` # Resume reconciliation for an existing Receiver
|
||||||
flux resume receiver main`,
|
flux resume receiver main`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.ReceiverKind)),
|
||||||
RunE: resumeCommand{
|
RunE: resumeCommand{
|
||||||
apiType: receiverType,
|
apiType: receiverType,
|
||||||
object: receiverAdapter{¬ificationv1.Receiver{}},
|
object: receiverAdapter{¬ificationv1.Receiver{}},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var resumeSourceBucketCmd = &cobra.Command{
|
|||||||
Long: `The resume command marks a previously suspended Bucket resource for reconciliation and waits for it to finish.`,
|
Long: `The resume command marks a previously suspended Bucket resource for reconciliation and waits for it to finish.`,
|
||||||
Example: ` # Resume reconciliation for an existing Bucket
|
Example: ` # Resume reconciliation for an existing Bucket
|
||||||
flux resume source bucket podinfo`,
|
flux resume source bucket podinfo`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.BucketKind)),
|
||||||
RunE: resumeCommand{
|
RunE: resumeCommand{
|
||||||
apiType: bucketType,
|
apiType: bucketType,
|
||||||
object: &bucketAdapter{&sourcev1.Bucket{}},
|
object: &bucketAdapter{&sourcev1.Bucket{}},
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ var resumeSourceHelmChartCmd = &cobra.Command{
|
|||||||
Long: `The resume command marks a previously suspended HelmChart resource for reconciliation and waits for it to finish.`,
|
Long: `The resume command marks a previously suspended HelmChart resource for reconciliation and waits for it to finish.`,
|
||||||
Example: ` # Resume reconciliation for an existing HelmChart
|
Example: ` # Resume reconciliation for an existing HelmChart
|
||||||
flux resume source chart podinfo`,
|
flux resume source chart podinfo`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmChartKind)),
|
||||||
RunE: resumeCommand{
|
RunE: resumeCommand{
|
||||||
apiType: helmChartType,
|
apiType: helmChartType,
|
||||||
object: &helmChartAdapter{&sourcev1.HelmChart{}},
|
object: &helmChartAdapter{&sourcev1.HelmChart{}},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var resumeSourceGitCmd = &cobra.Command{
|
|||||||
Long: `The resume command marks a previously suspended GitRepository resource for reconciliation and waits for it to finish.`,
|
Long: `The resume command marks a previously suspended GitRepository resource for reconciliation and waits for it to finish.`,
|
||||||
Example: ` # Resume reconciliation for an existing GitRepository
|
Example: ` # Resume reconciliation for an existing GitRepository
|
||||||
flux resume source git podinfo`,
|
flux resume source git podinfo`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.GitRepositoryKind)),
|
||||||
RunE: resumeCommand{
|
RunE: resumeCommand{
|
||||||
apiType: gitRepositoryType,
|
apiType: gitRepositoryType,
|
||||||
object: gitRepositoryAdapter{&sourcev1.GitRepository{}},
|
object: gitRepositoryAdapter{&sourcev1.GitRepository{}},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var resumeSourceHelmCmd = &cobra.Command{
|
|||||||
Long: `The resume command marks a previously suspended HelmRepository resource for reconciliation and waits for it to finish.`,
|
Long: `The resume command marks a previously suspended HelmRepository resource for reconciliation and waits for it to finish.`,
|
||||||
Example: ` # Resume reconciliation for an existing HelmRepository
|
Example: ` # Resume reconciliation for an existing HelmRepository
|
||||||
flux resume source helm bitnami`,
|
flux resume source helm bitnami`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmRepositoryKind)),
|
||||||
RunE: resumeCommand{
|
RunE: resumeCommand{
|
||||||
apiType: helmRepositoryType,
|
apiType: helmRepositoryType,
|
||||||
object: helmRepositoryAdapter{&sourcev1.HelmRepository{}},
|
object: helmRepositoryAdapter{&sourcev1.HelmRepository{}},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var suspendAlertCmd = &cobra.Command{
|
|||||||
Long: "The suspend command disables the reconciliation of a Alert resource.",
|
Long: "The suspend command disables the reconciliation of a Alert resource.",
|
||||||
Example: ` # Suspend reconciliation for an existing Alert
|
Example: ` # Suspend reconciliation for an existing Alert
|
||||||
flux suspend alert main`,
|
flux suspend alert main`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.AlertKind)),
|
||||||
RunE: suspendCommand{
|
RunE: suspendCommand{
|
||||||
apiType: alertType,
|
apiType: alertType,
|
||||||
object: &alertAdapter{¬ificationv1.Alert{}},
|
object: &alertAdapter{¬ificationv1.Alert{}},
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ var suspendHrCmd = &cobra.Command{
|
|||||||
Long: "The suspend command disables the reconciliation of a HelmRelease resource.",
|
Long: "The suspend command disables the reconciliation of a HelmRelease resource.",
|
||||||
Example: ` # Suspend reconciliation for an existing Helm release
|
Example: ` # Suspend reconciliation for an existing Helm release
|
||||||
flux suspend hr podinfo`,
|
flux suspend hr podinfo`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(helmv2.GroupVersion.WithKind(helmv2.HelmReleaseKind)),
|
||||||
RunE: suspendCommand{
|
RunE: suspendCommand{
|
||||||
apiType: helmReleaseType,
|
apiType: helmReleaseType,
|
||||||
object: &helmReleaseAdapter{&helmv2.HelmRelease{}},
|
object: &helmReleaseAdapter{&helmv2.HelmRelease{}},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var suspendImageRepositoryCmd = &cobra.Command{
|
|||||||
Long: "The suspend image repository command disables the reconciliation of a ImageRepository resource.",
|
Long: "The suspend image repository command disables the reconciliation of a ImageRepository resource.",
|
||||||
Example: ` # Suspend reconciliation for an existing ImageRepository
|
Example: ` # Suspend reconciliation for an existing ImageRepository
|
||||||
flux suspend image repository alpine`,
|
flux suspend image repository alpine`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(imagev1.GroupVersion.WithKind(imagev1.ImageRepositoryKind)),
|
||||||
RunE: suspendCommand{
|
RunE: suspendCommand{
|
||||||
apiType: imageRepositoryType,
|
apiType: imageRepositoryType,
|
||||||
object: imageRepositoryAdapter{&imagev1.ImageRepository{}},
|
object: imageRepositoryAdapter{&imagev1.ImageRepository{}},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var suspendImageUpdateCmd = &cobra.Command{
|
|||||||
Long: "The suspend image update command disables the reconciliation of a ImageUpdateAutomation resource.",
|
Long: "The suspend image update command disables the reconciliation of a ImageUpdateAutomation resource.",
|
||||||
Example: ` # Suspend reconciliation for an existing ImageUpdateAutomation
|
Example: ` # Suspend reconciliation for an existing ImageUpdateAutomation
|
||||||
flux suspend image update latest-images`,
|
flux suspend image update latest-images`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(autov1.GroupVersion.WithKind(autov1.ImageUpdateAutomationKind)),
|
||||||
RunE: suspendCommand{
|
RunE: suspendCommand{
|
||||||
apiType: imageUpdateAutomationType,
|
apiType: imageUpdateAutomationType,
|
||||||
object: imageUpdateAutomationAdapter{&autov1.ImageUpdateAutomation{}},
|
object: imageUpdateAutomationAdapter{&autov1.ImageUpdateAutomation{}},
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
|
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var suspendKsCmd = &cobra.Command{
|
var suspendKsCmd = &cobra.Command{
|
||||||
@@ -29,6 +29,7 @@ var suspendKsCmd = &cobra.Command{
|
|||||||
Long: "The suspend command disables the reconciliation of a Kustomization resource.",
|
Long: "The suspend command disables the reconciliation of a Kustomization resource.",
|
||||||
Example: ` # Suspend reconciliation for an existing Kustomization
|
Example: ` # Suspend reconciliation for an existing Kustomization
|
||||||
flux suspend ks podinfo`,
|
flux suspend ks podinfo`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(kustomizev1.GroupVersion.WithKind(kustomizev1.KustomizationKind)),
|
||||||
RunE: suspendCommand{
|
RunE: suspendCommand{
|
||||||
apiType: kustomizationType,
|
apiType: kustomizationType,
|
||||||
object: kustomizationAdapter{&kustomizev1.Kustomization{}},
|
object: kustomizationAdapter{&kustomizev1.Kustomization{}},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var suspendReceiverCmd = &cobra.Command{
|
|||||||
Long: "The suspend command disables the reconciliation of a Receiver resource.",
|
Long: "The suspend command disables the reconciliation of a Receiver resource.",
|
||||||
Example: ` # Suspend reconciliation for an existing Receiver
|
Example: ` # Suspend reconciliation for an existing Receiver
|
||||||
flux suspend receiver main`,
|
flux suspend receiver main`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(notificationv1.GroupVersion.WithKind(notificationv1.ReceiverKind)),
|
||||||
RunE: suspendCommand{
|
RunE: suspendCommand{
|
||||||
apiType: receiverType,
|
apiType: receiverType,
|
||||||
object: &receiverAdapter{¬ificationv1.Receiver{}},
|
object: &receiverAdapter{¬ificationv1.Receiver{}},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var suspendSourceBucketCmd = &cobra.Command{
|
|||||||
Long: "The suspend command disables the reconciliation of a Bucket resource.",
|
Long: "The suspend command disables the reconciliation of a Bucket resource.",
|
||||||
Example: ` # Suspend reconciliation for an existing Bucket
|
Example: ` # Suspend reconciliation for an existing Bucket
|
||||||
flux suspend source bucket podinfo`,
|
flux suspend source bucket podinfo`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.BucketKind)),
|
||||||
RunE: suspendCommand{
|
RunE: suspendCommand{
|
||||||
apiType: bucketType,
|
apiType: bucketType,
|
||||||
object: bucketAdapter{&sourcev1.Bucket{}},
|
object: bucketAdapter{&sourcev1.Bucket{}},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var suspendSourceHelmChartCmd = &cobra.Command{
|
|||||||
Long: "The suspend command disables the reconciliation of a HelmChart resource.",
|
Long: "The suspend command disables the reconciliation of a HelmChart resource.",
|
||||||
Example: ` # Suspend reconciliation for an existing HelmChart
|
Example: ` # Suspend reconciliation for an existing HelmChart
|
||||||
flux suspend source chart podinfo`,
|
flux suspend source chart podinfo`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmChartKind)),
|
||||||
RunE: suspendCommand{
|
RunE: suspendCommand{
|
||||||
apiType: helmChartType,
|
apiType: helmChartType,
|
||||||
object: helmChartAdapter{&sourcev1.HelmChart{}},
|
object: helmChartAdapter{&sourcev1.HelmChart{}},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var suspendSourceGitCmd = &cobra.Command{
|
|||||||
Long: "The suspend command disables the reconciliation of a GitRepository resource.",
|
Long: "The suspend command disables the reconciliation of a GitRepository resource.",
|
||||||
Example: ` # Suspend reconciliation for an existing GitRepository
|
Example: ` # Suspend reconciliation for an existing GitRepository
|
||||||
flux suspend source git podinfo`,
|
flux suspend source git podinfo`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.GitRepositoryKind)),
|
||||||
RunE: suspendCommand{
|
RunE: suspendCommand{
|
||||||
apiType: gitRepositoryType,
|
apiType: gitRepositoryType,
|
||||||
object: gitRepositoryAdapter{&sourcev1.GitRepository{}},
|
object: gitRepositoryAdapter{&sourcev1.GitRepository{}},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var suspendSourceHelmCmd = &cobra.Command{
|
|||||||
Long: "The suspend command disables the reconciliation of a HelmRepository resource.",
|
Long: "The suspend command disables the reconciliation of a HelmRepository resource.",
|
||||||
Example: ` # Suspend reconciliation for an existing HelmRepository
|
Example: ` # Suspend reconciliation for an existing HelmRepository
|
||||||
flux suspend source helm bitnami`,
|
flux suspend source helm bitnami`,
|
||||||
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmRepositoryKind)),
|
||||||
RunE: suspendCommand{
|
RunE: suspendCommand{
|
||||||
apiType: helmRepositoryType,
|
apiType: helmRepositoryType,
|
||||||
object: helmRepositoryAdapter{&sourcev1.HelmRepository{}},
|
object: helmRepositoryAdapter{&sourcev1.HelmRepository{}},
|
||||||
|
|||||||
3
cmd/flux/testdata/check/check_pre.golden
vendored
3
cmd/flux/testdata/check/check_pre.golden
vendored
@@ -1,4 +1,3 @@
|
|||||||
► checking prerequisites
|
► checking prerequisites
|
||||||
✔ kubectl {{ .clientVersion }} >=1.18.0-0
|
✔ Kubernetes {{ .serverVersion }} >=1.19.0-0
|
||||||
✔ Kubernetes {{ .serverVersion }} >=1.16.0-0
|
|
||||||
✔ prerequisites checks passed
|
✔ prerequisites checks passed
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
► annotating GitRepository thrfg in {{ .ns }} namespace
|
► annotating GitRepository thrfg in {{ .ns }} namespace
|
||||||
✔ GitRepository annotated
|
✔ GitRepository annotated
|
||||||
◎ waiting for GitRepository reconciliation
|
◎ waiting for GitRepository reconciliation
|
||||||
✔ GitRepository reconciliation completed
|
|
||||||
✔ fetched revision 6.0.0/627d5c4bb67b77185f37e31d734b085019ff2951
|
✔ fetched revision 6.0.0/627d5c4bb67b77185f37e31d734b085019ff2951
|
||||||
► annotating HelmRelease thrfg in {{ .ns }} namespace
|
► annotating HelmRelease thrfg in {{ .ns }} namespace
|
||||||
✔ HelmRelease annotated
|
✔ HelmRelease annotated
|
||||||
◎ waiting for HelmRelease reconciliation
|
◎ waiting for HelmRelease reconciliation
|
||||||
✔ HelmRelease reconciliation completed
|
|
||||||
✔ applied revision 6.0.0
|
✔ applied revision 6.0.0
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user