Compare commits
86 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d110cdfb1 | ||
|
|
d015895caa | ||
|
|
64e76a23c6 | ||
|
|
f5006aa239 | ||
|
|
4bd06771ae | ||
|
|
4643f8383e | ||
|
|
b82759b35a | ||
|
|
0343575146 | ||
|
|
e7847b75db | ||
|
|
bb1078d610 | ||
|
|
6f6c097980 | ||
|
|
73692df272 | ||
|
|
138cba6e57 | ||
|
|
2abf932ee4 | ||
|
|
939a75115c | ||
|
|
9f41efb6f7 | ||
|
|
c3d7cad53e | ||
|
|
463f9fbc64 | ||
|
|
4a51b111e6 | ||
|
|
63ebd7fd09 | ||
|
|
c31367909e | ||
|
|
0f0649a674 | ||
|
|
09cbf348a7 | ||
|
|
287bc520b1 | ||
|
|
65a2ceec5c | ||
|
|
516399bf81 | ||
|
|
4ea70765af | ||
|
|
d6372e396b | ||
|
|
7b20ad5dd2 | ||
|
|
3d962136a8 | ||
|
|
f3386505cf | ||
|
|
f4c8da35e8 | ||
|
|
cc3f2c7bde | ||
|
|
80b87729b6 | ||
|
|
2282223592 | ||
|
|
f6c96aea48 | ||
|
|
1fa48bf916 | ||
|
|
d49b77c8d2 | ||
|
|
91132e9c87 | ||
|
|
4680abe951 | ||
|
|
2963708a6c | ||
|
|
1f57cf3d31 | ||
|
|
80611ec70e | ||
|
|
d37bb42995 | ||
|
|
1bf63a94c2 | ||
|
|
cad251444c | ||
|
|
358c6d38b7 | ||
|
|
b8fd46d0df | ||
|
|
6a1ba3c545 | ||
|
|
33a874800b | ||
|
|
f417352370 | ||
|
|
72d90b5692 | ||
|
|
d7dadb4425 | ||
|
|
348408e16e | ||
|
|
04de52044a | ||
|
|
45a00a0170 | ||
|
|
1ac380a7f9 | ||
|
|
2971d34a13 | ||
|
|
90f0d81532 | ||
|
|
d5262404f3 | ||
|
|
03c3cb860a | ||
|
|
a1faa1d965 | ||
|
|
c40d290e46 | ||
|
|
5106a71e6a | ||
|
|
491acf57ad | ||
|
|
0694a9582f | ||
|
|
0c817378cf | ||
|
|
ec2aa13165 | ||
|
|
c921cf0d54 | ||
|
|
11dd0d918c | ||
|
|
467969de0f | ||
|
|
bdc5ae4573 | ||
|
|
1eb4b67013 | ||
|
|
e777947539 | ||
|
|
70b906cae2 | ||
|
|
c57afa1e56 | ||
|
|
73668d19d9 | ||
|
|
82f847e21d | ||
|
|
753b2e6eda | ||
|
|
7b95e90a33 | ||
|
|
7824229d7b | ||
|
|
20557f9f15 | ||
|
|
6430f2b4b0 | ||
|
|
92e136ed54 | ||
|
|
e79b008878 | ||
|
|
43cdea01d6 |
7
.github/dependabot.yml
vendored
Normal file
7
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
version: 2
|
||||||
|
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
50
.github/workflows/README.md
vendored
Normal file
50
.github/workflows/README.md
vendored
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
# Flux GitHub Workflows
|
||||||
|
|
||||||
|
## End-to-end Testing
|
||||||
|
|
||||||
|
The e2e workflows run a series of tests to ensure that the Flux CLI and
|
||||||
|
the GitOps Toolkit controllers work well all together.
|
||||||
|
The tests are written in Go, Bash, Make and Terraform.
|
||||||
|
|
||||||
|
| Workflow | Jobs | Runner | Role |
|
||||||
|
|--------------------|----------------------|----------------|-----------------------------------------------|
|
||||||
|
| e2e.yaml | e2e-amd64-kubernetes | GitHub Ubuntu | integration testing with Kubernetes Kind<br/> |
|
||||||
|
| e2e-arm64.yaml | e2e-arm64-kubernetes | Equinix Ubuntu | integration testing with Kubernetes Kind<br/> |
|
||||||
|
| e2e-bootstrap.yaml | e2e-boostrap-github | GitHub Ubuntu | integration testing with GitHub API<br/> |
|
||||||
|
| e2e-azure.yaml | e2e-amd64-aks | GitHub Ubuntu | integration testing with Azure API<br/> |
|
||||||
|
| scan.yaml | scan-fossa | GitHub Ubuntu | license scanning<br/> |
|
||||||
|
| scan.yaml | scan-snyk | GitHub Ubuntu | vulnerability scanning<br/> |
|
||||||
|
| scan.yaml | scan-codeql | GitHub Ubuntu | vulnerability scanning<br/> |
|
||||||
|
|
||||||
|
## Components Update
|
||||||
|
|
||||||
|
The components update workflow scans the GitOps Toolkit controller repositories for new releases,
|
||||||
|
amd when it finds a new controller version, the workflow performs the following steps:
|
||||||
|
- Updates the controller API package version in `go.mod`.
|
||||||
|
- Patches the controller CRDs version in the `manifests/crds` overlay.
|
||||||
|
- Patches the controller Deployment version in `manifests/bases` overlay.
|
||||||
|
- Opens a Pull Request against the `main` branch.
|
||||||
|
- Triggers the e2e test suite to run for the opened PR.
|
||||||
|
|
||||||
|
|
||||||
|
| Workflow | Jobs | Runner | Role |
|
||||||
|
|-------------|-------------------|---------------|-----------------------------------------------------|
|
||||||
|
| update.yaml | update-components | GitHub Ubuntu | update the GitOps Toolkit APIs and controllers<br/> |
|
||||||
|
|
||||||
|
## Release
|
||||||
|
|
||||||
|
The release workflow is triggered by a semver Git tag and performs the following steps:
|
||||||
|
- Generates the Flux install manifests (YAML).
|
||||||
|
- Generates the OpenAPI validation schemas for the GitOps Toolkit CRDs (JSON).
|
||||||
|
- Generates a Software Bill of Materials (SPDX JSON).
|
||||||
|
- Builds the Flux CLI binaries and the multi-arch container images.
|
||||||
|
- Pushes the container images to GitHub Container Registry and DockerHub.
|
||||||
|
- Signs the sbom, the binaries checksum and the container images with Cosign and GitHub OIDC.
|
||||||
|
- Uploads the sbom, binaries, checksums and install manifests to GitHub Releases.
|
||||||
|
- Pushes the install manifests as OCI artifacts to GitHub Container Registry and DockerHub.
|
||||||
|
- Signs the OCI artifacts with Cosign and GitHub OIDC.
|
||||||
|
|
||||||
|
| Workflow | Jobs | Runner | Role |
|
||||||
|
|--------------|------------------------|---------------|------------------------------------------------------|
|
||||||
|
| release.yaml | release-flux-cli | GitHub Ubuntu | build, push and sign the CLI release artifacts<br/> |
|
||||||
|
| release.yaml | release-flux-manifests | GitHub Ubuntu | build, push and sign the Flux install manifests<br/> |
|
||||||
7
.github/workflows/e2e-arm64.yaml
vendored
7
.github/workflows/e2e-arm64.yaml
vendored
@@ -5,8 +5,11 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches: [ main, update-components ]
|
branches: [ main, update-components ]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
e2e-arm64-kubernetes:
|
||||||
# Hosted on Equinix
|
# Hosted on Equinix
|
||||||
# Docs: https://github.com/fluxcd/flux2/tree/main/.github/runners
|
# Docs: https://github.com/fluxcd/flux2/tree/main/.github/runners
|
||||||
runs-on: [self-hosted, Linux, ARM64, equinix]
|
runs-on: [self-hosted, Linux, ARM64, equinix]
|
||||||
@@ -16,7 +19,7 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: 1.18.x
|
go-version: 1.19.x
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
id: prep
|
id: prep
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
20
.github/workflows/e2e-azure.yaml
vendored
20
.github/workflows/e2e-azure.yaml
vendored
@@ -7,9 +7,12 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches: [ azure* ]
|
branches: [ azure* ]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
e2e:
|
e2e-amd64-aks:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -23,15 +26,12 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: 1.18.x
|
go-version: 1.19.x
|
||||||
- name: Install libgit2
|
- name: Install libgit2
|
||||||
run: |
|
run: |
|
||||||
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138
|
echo "deb http://archive.ubuntu.com/ubuntu/ kinetic universe" | sudo tee -a /etc/apt/sources.list
|
||||||
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 update
|
||||||
sudo apt-get install -y --allow-downgrades libgit2-dev/unstable zlib1g-dev/unstable libssh2-1-dev/unstable libpcre3-dev/unstable
|
sudo apt-get install -y -t kinetic libgit2-dev=1.3.0+dfsg.1-3ubuntu1
|
||||||
- name: Setup Flux CLI
|
- name: Setup Flux CLI
|
||||||
run: |
|
run: |
|
||||||
make build
|
make build
|
||||||
@@ -44,9 +44,9 @@ jobs:
|
|||||||
mkdir -p $HOME/.local/bin
|
mkdir -p $HOME/.local/bin
|
||||||
mv sops-v3.7.1.linux $HOME/.local/bin/sops
|
mv sops-v3.7.1.linux $HOME/.local/bin/sops
|
||||||
- name: Setup Terraform
|
- name: Setup Terraform
|
||||||
uses: hashicorp/setup-terraform@v1
|
uses: hashicorp/setup-terraform@v2.0.2
|
||||||
with:
|
with:
|
||||||
terraform_version: 1.0.7
|
terraform_version: 1.2.8
|
||||||
terraform_wrapper: false
|
terraform_wrapper: false
|
||||||
- name: Setup Azure CLI
|
- name: Setup Azure CLI
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -1,15 +1,19 @@
|
|||||||
name: bootstrap
|
name: e2e-bootstrap
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
github:
|
e2e-boostrap-github:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
|
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -23,12 +27,12 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: 1.18.x
|
go-version: 1.19.x
|
||||||
- name: Setup Kubernetes
|
- name: Setup Kubernetes
|
||||||
uses: engineerd/setup-kind@v0.5.0
|
uses: engineerd/setup-kind@v0.5.0
|
||||||
with:
|
with:
|
||||||
version: v0.11.1
|
version: v0.16.0
|
||||||
image: kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6
|
image: kindest/node:v1.25.2@sha256:9be91e9e9cdf116809841fc77ebdb8845443c4c72fe5218f3ae9eb57fdb4bace
|
||||||
- name: Setup Kustomize
|
- name: Setup Kustomize
|
||||||
uses: fluxcd/pkg//actions/kustomize@main
|
uses: fluxcd/pkg//actions/kustomize@main
|
||||||
- name: Build
|
- name: Build
|
||||||
8
.github/workflows/e2e.yaml
vendored
8
.github/workflows/e2e.yaml
vendored
@@ -1,13 +1,17 @@
|
|||||||
name: e2e
|
name: e2e
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main, oci ]
|
branches: [ main, oci ]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
kind:
|
e2e-amd64-kubernetes:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
services:
|
services:
|
||||||
registry:
|
registry:
|
||||||
@@ -27,7 +31,7 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: 1.18.x
|
go-version: 1.19.x
|
||||||
- name: Setup Kubernetes
|
- name: Setup Kubernetes
|
||||||
uses: engineerd/setup-kind@v0.5.0
|
uses: engineerd/setup-kind@v0.5.0
|
||||||
with:
|
with:
|
||||||
|
|||||||
78
.github/workflows/release.yaml
vendored
78
.github/workflows/release.yaml
vendored
@@ -5,13 +5,15 @@ on:
|
|||||||
tags: [ 'v*' ]
|
tags: [ 'v*' ]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write # needed to write releases
|
contents: read
|
||||||
id-token: write # needed for keyless signing
|
|
||||||
packages: write # needed for ghcr access
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
goreleaser:
|
release-flux-cli:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write # needed to write releases
|
||||||
|
id-token: write # needed for keyless signing
|
||||||
|
packages: write # needed for ghcr access
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -20,7 +22,7 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: 1.18.x
|
go-version: 1.19.x
|
||||||
- name: Setup QEMU
|
- name: Setup QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v2
|
||||||
- name: Setup Docker Buildx
|
- name: Setup Docker Buildx
|
||||||
@@ -81,3 +83,69 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
|
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||||
AUR_BOT_SSH_PRIVATE_KEY: ${{ secrets.AUR_BOT_SSH_PRIVATE_KEY }}
|
AUR_BOT_SSH_PRIVATE_KEY: ${{ secrets.AUR_BOT_SSH_PRIVATE_KEY }}
|
||||||
|
release-flux-manifests:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: release-flux-cli
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
packages: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Setup Kustomize
|
||||||
|
uses: fluxcd/pkg/actions/kustomize@main
|
||||||
|
- name: Setup Flux CLI
|
||||||
|
uses: ./action/
|
||||||
|
- name: Prepare
|
||||||
|
id: prep
|
||||||
|
run: |
|
||||||
|
VERSION=$(flux version --client | awk '{ print $NF }')
|
||||||
|
echo ::set-output name=VERSION::${VERSION}
|
||||||
|
- name: Login to GHCR
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: fluxcdbot
|
||||||
|
password: ${{ secrets.GHCR_TOKEN }}
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: fluxcdbot
|
||||||
|
password: ${{ secrets.DOCKER_FLUXCD_PASSWORD }}
|
||||||
|
- name: Push manifests to GHCR
|
||||||
|
run: |
|
||||||
|
mkdir -p ./ghcr.io/flux-system
|
||||||
|
flux install --registry=ghcr.io/fluxcd \
|
||||||
|
--components-extra=image-reflector-controller,image-automation-controller \
|
||||||
|
--export > ./ghcr.io/flux-system/gotk-components.yaml
|
||||||
|
|
||||||
|
cd ./ghcr.io && flux push artifact \
|
||||||
|
oci://ghcr.io/fluxcd/flux-manifests:${{ steps.prep.outputs.VERSION }} \
|
||||||
|
--path="./flux-system" \
|
||||||
|
--source=${{ github.repositoryUrl }} \
|
||||||
|
--revision="${{ github.ref_name }}/${{ github.sha }}"
|
||||||
|
- name: Push manifests to DockerHub
|
||||||
|
run: |
|
||||||
|
mkdir -p ./docker.io/flux-system
|
||||||
|
flux install --registry=docker.io/fluxcd \
|
||||||
|
--components-extra=image-reflector-controller,image-automation-controller \
|
||||||
|
--export > ./docker.io/flux-system/gotk-components.yaml
|
||||||
|
|
||||||
|
cd ./docker.io && flux push artifact \
|
||||||
|
oci://docker.io/fluxcd/flux-manifests:${{ steps.prep.outputs.VERSION }} \
|
||||||
|
--path="./flux-system" \
|
||||||
|
--source=${{ github.repositoryUrl }} \
|
||||||
|
--revision="${{ github.ref_name }}/${{ github.sha }}"
|
||||||
|
- uses: sigstore/cosign-installer@main
|
||||||
|
- name: Sign manifests
|
||||||
|
env:
|
||||||
|
COSIGN_EXPERIMENTAL: 1
|
||||||
|
run: |
|
||||||
|
cosign sign ghcr.io/fluxcd/flux-manifests:${{ steps.prep.outputs.VERSION }}
|
||||||
|
cosign sign docker.io/fluxcd/flux-manifests:${{ steps.prep.outputs.VERSION }}
|
||||||
|
- name: Tag manifests
|
||||||
|
run: |
|
||||||
|
flux tag artifact oci://ghcr.io/fluxcd/flux-manifests:${{ steps.prep.outputs.VERSION }} \
|
||||||
|
--tag latest
|
||||||
|
|
||||||
|
flux tag artifact oci://docker.io/fluxcd/flux-manifests:${{ steps.prep.outputs.VERSION }} \
|
||||||
|
--tag latest
|
||||||
|
|||||||
27
.github/workflows/scan.yaml
vendored
27
.github/workflows/scan.yaml
vendored
@@ -1,6 +1,7 @@
|
|||||||
name: scan
|
name: scan
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -9,13 +10,12 @@ on:
|
|||||||
- cron: '18 10 * * 3'
|
- cron: '18 10 * * 3'
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read # for actions/checkout to fetch code
|
contents: read
|
||||||
security-events: write # for codeQL to write security events
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
fossa:
|
scan-fossa:
|
||||||
name: FOSSA
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: github.actor != 'dependabot[bot]'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Run FOSSA scan and upload build data
|
- name: Run FOSSA scan and upload build data
|
||||||
@@ -25,10 +25,11 @@ jobs:
|
|||||||
fossa-api-key: 5ee8bf422db1471e0bcf2bcb289185de
|
fossa-api-key: 5ee8bf422db1471e0bcf2bcb289185de
|
||||||
github-token: ${{ github.token }}
|
github-token: ${{ github.token }}
|
||||||
|
|
||||||
snyk:
|
scan-snyk:
|
||||||
name: Snyk
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
|
permissions:
|
||||||
|
security-events: write
|
||||||
|
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Setup Kustomize
|
- name: Setup Kustomize
|
||||||
@@ -44,16 +45,22 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
args: --sarif-file-output=snyk.sarif
|
args: --sarif-file-output=snyk.sarif
|
||||||
- name: Upload result to GitHub Code Scanning
|
- name: Upload result to GitHub Code Scanning
|
||||||
uses: github/codeql-action/upload-sarif@v1
|
uses: github/codeql-action/upload-sarif@v2
|
||||||
with:
|
with:
|
||||||
sarif_file: snyk.sarif
|
sarif_file: snyk.sarif
|
||||||
|
|
||||||
codeql:
|
scan-codeql:
|
||||||
name: CodeQL
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
security-events: write
|
||||||
|
if: github.actor != 'dependabot[bot]'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: 1.19.x
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v2
|
||||||
with:
|
with:
|
||||||
|
|||||||
12
.github/workflows/update.yaml
vendored
12
.github/workflows/update.yaml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Update Components
|
name: update
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@@ -7,16 +7,22 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-components:
|
update-components:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: 1.18.x
|
go-version: 1.19.x
|
||||||
- name: Update component versions
|
- name: Update component versions
|
||||||
id: update
|
id: update
|
||||||
run: |
|
run: |
|
||||||
@@ -69,7 +75,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
id: cpr
|
id: cpr
|
||||||
uses: peter-evans/create-pull-request@v3
|
uses: peter-evans/create-pull-request@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||||
commit-message: |
|
commit-message: |
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ This project is composed of:
|
|||||||
### Understanding the code
|
### Understanding the code
|
||||||
|
|
||||||
To get started with developing controllers, you might want to review
|
To get started with developing controllers, you might want to review
|
||||||
[our guide](https://fluxcd.io/docs/gitops-toolkit/source-watcher/) which
|
[our guide](https://fluxcd.io/flux/gitops-toolkit/source-watcher/) which
|
||||||
walks you through writing a short and concise controller that watches out
|
walks you through writing a short and concise controller that watches out
|
||||||
for source changes.
|
for source changes.
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ for source changes.
|
|||||||
|
|
||||||
Prerequisites:
|
Prerequisites:
|
||||||
|
|
||||||
* go >= 1.17
|
* go >= 1.19
|
||||||
* kubectl >= 1.20
|
* kubectl >= 1.20
|
||||||
* kustomize >= 4.4
|
* kustomize >= 4.4
|
||||||
* coreutils (on Mac OS)
|
* coreutils (on Mac OS)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ FROM alpine:3.16 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.25.0
|
ARG KUBECTL_VER=1.25.3
|
||||||
|
|
||||||
RUN curl -sL https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VER}/bin/${ARCH}/kubectl \
|
RUN curl -sL https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VER}/bin/${ARCH}/kubectl \
|
||||||
-o /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl && \
|
-o /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl && \
|
||||||
|
|||||||
4
Makefile
4
Makefile
@@ -17,8 +17,8 @@ rwildcard=$(foreach d,$(wildcard $(addsuffix *,$(1))),$(call rwildcard,$(d)/,$(2
|
|||||||
all: test build
|
all: test build
|
||||||
|
|
||||||
tidy:
|
tidy:
|
||||||
go mod tidy -compat=1.18
|
go mod tidy -compat=1.19
|
||||||
cd tests/azure && go mod tidy -compat=1.18
|
cd tests/azure && go mod tidy -compat=1.19
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
go fmt ./...
|
go fmt ./...
|
||||||
|
|||||||
75
README.md
75
README.md
@@ -1,14 +1,13 @@
|
|||||||
# Flux version 2
|
# Flux version 2
|
||||||
|
|
||||||
[](https://bestpractices.coreinfrastructure.org/projects/4782)
|
|
||||||
[](https://github.com/fluxcd/flux2/actions)
|
|
||||||
[](https://goreportcard.com/report/github.com/fluxcd/flux2)
|
|
||||||
[](https://github.com/fluxcd/flux2/blob/main/LICENSE)
|
|
||||||
[](https://github.com/fluxcd/flux2/releases)
|
[](https://github.com/fluxcd/flux2/releases)
|
||||||
|
[](https://bestpractices.coreinfrastructure.org/projects/4782)
|
||||||
|
[](https://app.fossa.com/projects/custom%2B162%2Fgithub.com%2Ffluxcd%2Fflux2?ref=badge_shield)
|
||||||
|
[](https://artifacthub.io/packages/helm/fluxcd-community/flux2)
|
||||||
|
|
||||||
Flux is a tool for keeping Kubernetes clusters in sync with sources of
|
Flux is a tool for keeping Kubernetes clusters in sync with sources of
|
||||||
configuration (like Git repositories), and automating updates to
|
configuration (like Git repositories and OCI artifacts),
|
||||||
configuration when there is new code to deploy.
|
and automating updates to configuration when there is new code to deploy.
|
||||||
|
|
||||||
Flux version 2 ("v2") is built from the ground up to use Kubernetes'
|
Flux version 2 ("v2") is built from the ground up to use Kubernetes'
|
||||||
API extension system, and to integrate with Prometheus and other core
|
API extension system, and to integrate with Prometheus and other core
|
||||||
@@ -20,18 +19,19 @@ Flux v2 is constructed with the [GitOps Toolkit](#gitops-toolkit), a
|
|||||||
set of composable APIs and specialized tools for building Continuous
|
set of composable APIs and specialized tools for building Continuous
|
||||||
Delivery on top of Kubernetes.
|
Delivery on top of Kubernetes.
|
||||||
|
|
||||||
Flux is a Cloud Native Computing Foundation ([CNCF](https://www.cncf.io/)) project.
|
Flux is a Cloud Native Computing Foundation ([CNCF](https://www.cncf.io/)) project, used in
|
||||||
|
production by various [organisations](https://fluxcd.io/adopters) and [cloud providers](https://fluxcd.io/ecosystem).
|
||||||
|
|
||||||
## Quickstart and documentation
|
## Quickstart and documentation
|
||||||
|
|
||||||
To get started check out this [guide](https://fluxcd.io/docs/get-started/)
|
To get started check out this [guide](https://fluxcd.io/flux/get-started/)
|
||||||
on how to bootstrap Flux on Kubernetes and deploy a sample application in a GitOps manner.
|
on how to bootstrap Flux on Kubernetes and deploy a sample application in a GitOps manner.
|
||||||
|
|
||||||
For more comprehensive documentation, see the following guides:
|
For more comprehensive documentation, see the following guides:
|
||||||
- [Ways of structuring your repositories](https://fluxcd.io/docs/guides/repository-structure/)
|
- [Ways of structuring your repositories](https://fluxcd.io/flux/guides/repository-structure/)
|
||||||
- [Manage Helm Releases](https://fluxcd.io/docs/guides/helmreleases/)
|
- [Manage Helm Releases](https://fluxcd.io/flux/guides/helmreleases/)
|
||||||
- [Automate image updates to Git](https://fluxcd.io/docs/guides/image-update/)
|
- [Automate image updates to Git](https://fluxcd.io/flux/guides/image-update/)
|
||||||
- [Manage Kubernetes secrets with Mozilla SOPS](https://fluxcd.io/docs/guides/mozilla-sops/)
|
- [Manage Kubernetes secrets with Mozilla SOPS](https://fluxcd.io/flux/guides/mozilla-sops/)
|
||||||
|
|
||||||
If you need help, please refer to our **[Support page](https://fluxcd.io/support/)**.
|
If you need help, please refer to our **[Support page](https://fluxcd.io/support/)**.
|
||||||
|
|
||||||
@@ -46,28 +46,28 @@ automation tooling.
|
|||||||
|
|
||||||
You can use the toolkit to extend Flux, or to build your own systems
|
You can use the toolkit to extend Flux, or to build your own systems
|
||||||
for continuous delivery -- see [the developer
|
for continuous delivery -- see [the developer
|
||||||
guides](https://fluxcd.io/docs/gitops-toolkit/source-watcher/).
|
guides](https://fluxcd.io/flux/gitops-toolkit/source-watcher/).
|
||||||
|
|
||||||
### Components
|
### Components
|
||||||
|
|
||||||
- [Source Controller](https://fluxcd.io/docs/components/source/)
|
- [Source Controller](https://fluxcd.io/flux/components/source/)
|
||||||
- [GitRepository CRD](https://fluxcd.io/docs/components/source/gitrepositories/)
|
- [GitRepository CRD](https://fluxcd.io/flux/components/source/gitrepositories/)
|
||||||
- [OCIRepository CRD](https://fluxcd.io/docs/components/source/ocirepositories/)
|
- [OCIRepository CRD](https://fluxcd.io/flux/components/source/ocirepositories/)
|
||||||
- [HelmRepository CRD](https://fluxcd.io/docs/components/source/helmrepositories/)
|
- [HelmRepository CRD](https://fluxcd.io/flux/components/source/helmrepositories/)
|
||||||
- [HelmChart CRD](https://fluxcd.io/docs/components/source/helmcharts/)
|
- [HelmChart CRD](https://fluxcd.io/flux/components/source/helmcharts/)
|
||||||
- [Bucket CRD](https://fluxcd.io/docs/components/source/buckets/)
|
- [Bucket CRD](https://fluxcd.io/flux/components/source/buckets/)
|
||||||
- [Kustomize Controller](https://fluxcd.io/docs/components/kustomize/)
|
- [Kustomize Controller](https://fluxcd.io/flux/components/kustomize/)
|
||||||
- [Kustomization CRD](https://fluxcd.io/docs/components/kustomize/kustomization/)
|
- [Kustomization CRD](https://fluxcd.io/flux/components/kustomize/kustomization/)
|
||||||
- [Helm Controller](https://fluxcd.io/docs/components/helm/)
|
- [Helm Controller](https://fluxcd.io/flux/components/helm/)
|
||||||
- [HelmRelease CRD](https://fluxcd.io/docs/components/helm/helmreleases/)
|
- [HelmRelease CRD](https://fluxcd.io/flux/components/helm/helmreleases/)
|
||||||
- [Notification Controller](https://fluxcd.io/docs/components/notification/)
|
- [Notification Controller](https://fluxcd.io/flux/components/notification/)
|
||||||
- [Provider CRD](https://fluxcd.io/docs/components/notification/provider/)
|
- [Provider CRD](https://fluxcd.io/flux/components/notification/provider/)
|
||||||
- [Alert CRD](https://fluxcd.io/docs/components/notification/alert/)
|
- [Alert CRD](https://fluxcd.io/flux/components/notification/alert/)
|
||||||
- [Receiver CRD](https://fluxcd.io/docs/components/notification/receiver/)
|
- [Receiver CRD](https://fluxcd.io/flux/components/notification/receiver/)
|
||||||
- [Image Automation Controllers](https://fluxcd.io/docs/components/image/)
|
- [Image Automation Controllers](https://fluxcd.io/flux/components/image/)
|
||||||
- [ImageRepository CRD](https://fluxcd.io/docs/components/image/imagerepositories/)
|
- [ImageRepository CRD](https://fluxcd.io/flux/components/image/imagerepositories/)
|
||||||
- [ImagePolicy CRD](https://fluxcd.io/docs/components/image/imagepolicies/)
|
- [ImagePolicy CRD](https://fluxcd.io/flux/components/image/imagepolicies/)
|
||||||
- [ImageUpdateAutomation CRD](https://fluxcd.io/docs/components/image/imageupdateautomations/)
|
- [ImageUpdateAutomation CRD](https://fluxcd.io/flux/components/image/imageupdateautomations/)
|
||||||
|
|
||||||
## Community
|
## Community
|
||||||
|
|
||||||
@@ -75,18 +75,19 @@ Need help or want to contribute? Please see the links below. The Flux project is
|
|||||||
new contributors and there are a multitude of ways to get involved.
|
new contributors and there are a multitude of ways to get involved.
|
||||||
|
|
||||||
- Getting Started?
|
- Getting Started?
|
||||||
- Look at our [Get Started guide](https://fluxcd.io/docs/get-started/) and give us feedback
|
- Look at our [Get Started guide](https://fluxcd.io/flux/get-started/) and give us feedback
|
||||||
- Need help?
|
- Need help?
|
||||||
- First: Ask questions on our [GH Discussions page](https://github.com/fluxcd/flux2/discussions)
|
- First: Ask questions on our [GH Discussions page](https://github.com/fluxcd/flux2/discussions).
|
||||||
- Second: Talk to us in the #flux channel on [CNCF Slack](https://slack.cncf.io/)
|
- Second: Talk to us in the #flux channel on [CNCF Slack](https://slack.cncf.io/).
|
||||||
- Please follow our [Support Guidelines](https://fluxcd.io/support/)
|
- Please follow our [Support Guidelines](https://fluxcd.io/support/)
|
||||||
(in short: be nice, be respectful of volunteers' time, understand that maintainers and
|
(in short: be nice, be respectful of volunteers' time, understand that maintainers and
|
||||||
contributors cannot respond to all DMs, and keep discussions in the public #flux channel as much as possible).
|
contributors cannot respond to all DMs, and keep discussions in the public #flux channel as much as possible).
|
||||||
- Have feature proposals or want to contribute?
|
- Have feature proposals or want to contribute?
|
||||||
- Propose features on our [GH Discussions page](https://github.com/fluxcd/flux2/discussions)
|
- Propose features on our [GitHub Discussions page](https://github.com/fluxcd/flux2/discussions).
|
||||||
- Join our upcoming dev meetings ([meeting access and agenda](https://docs.google.com/document/d/1l_M0om0qUEN_NNiGgpqJ2tvsF2iioHkaARDeh6b70B0/view))
|
- Join our upcoming dev meetings ([meeting access and agenda](https://docs.google.com/document/d/1l_M0om0qUEN_NNiGgpqJ2tvsF2iioHkaARDeh6b70B0/view)).
|
||||||
- [Join the flux-dev mailing list](https://lists.cncf.io/g/cncf-flux-dev).
|
- [Join the flux-dev mailing list](https://lists.cncf.io/g/cncf-flux-dev).
|
||||||
- Check out [how to contribute](CONTRIBUTING.md) to the project
|
- Check out [how to contribute](CONTRIBUTING.md) to the project.
|
||||||
|
- Check out the [project roadmap](https://fluxcd.io/roadmap/).
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ import (
|
|||||||
"github.com/go-git/go-git/v5/plumbing/transport/http"
|
"github.com/go-git/go-git/v5/plumbing/transport/http"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/fluxcd/flux2/internal/bootstrap"
|
|
||||||
"github.com/fluxcd/flux2/internal/bootstrap/git/gogit"
|
|
||||||
"github.com/fluxcd/flux2/internal/bootstrap/provider"
|
|
||||||
"github.com/fluxcd/flux2/internal/flags"
|
"github.com/fluxcd/flux2/internal/flags"
|
||||||
"github.com/fluxcd/flux2/internal/utils"
|
"github.com/fluxcd/flux2/internal/utils"
|
||||||
|
"github.com/fluxcd/flux2/pkg/bootstrap"
|
||||||
|
"github.com/fluxcd/flux2/pkg/bootstrap/git/gogit"
|
||||||
|
"github.com/fluxcd/flux2/pkg/bootstrap/provider"
|
||||||
"github.com/fluxcd/flux2/pkg/manifestgen"
|
"github.com/fluxcd/flux2/pkg/manifestgen"
|
||||||
"github.com/fluxcd/flux2/pkg/manifestgen/install"
|
"github.com/fluxcd/flux2/pkg/manifestgen/install"
|
||||||
"github.com/fluxcd/flux2/pkg/manifestgen/sourcesecret"
|
"github.com/fluxcd/flux2/pkg/manifestgen/sourcesecret"
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
|
||||||
"github.com/fluxcd/flux2/internal/bootstrap"
|
|
||||||
"github.com/fluxcd/flux2/internal/bootstrap/git/gogit"
|
|
||||||
"github.com/fluxcd/flux2/internal/flags"
|
"github.com/fluxcd/flux2/internal/flags"
|
||||||
"github.com/fluxcd/flux2/internal/utils"
|
"github.com/fluxcd/flux2/internal/utils"
|
||||||
|
"github.com/fluxcd/flux2/pkg/bootstrap"
|
||||||
|
"github.com/fluxcd/flux2/pkg/bootstrap/git/gogit"
|
||||||
"github.com/fluxcd/flux2/pkg/manifestgen"
|
"github.com/fluxcd/flux2/pkg/manifestgen"
|
||||||
"github.com/fluxcd/flux2/pkg/manifestgen/install"
|
"github.com/fluxcd/flux2/pkg/manifestgen/install"
|
||||||
"github.com/fluxcd/flux2/pkg/manifestgen/sourcesecret"
|
"github.com/fluxcd/flux2/pkg/manifestgen/sourcesecret"
|
||||||
@@ -192,7 +192,9 @@ func bootstrapGitCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
// Configure repository URL to match auth config for sync.
|
// Configure repository URL to match auth config for sync.
|
||||||
repositoryURL.User = nil
|
repositoryURL.User = nil
|
||||||
repositoryURL.Scheme = "https"
|
if !gitArgs.insecureHttpAllowed {
|
||||||
|
repositoryURL.Scheme = "https"
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
secretOpts.PrivateKeyAlgorithm = sourcesecret.PrivateKeyAlgorithm(bootstrapArgs.keyAlgorithm)
|
secretOpts.PrivateKeyAlgorithm = sourcesecret.PrivateKeyAlgorithm(bootstrapArgs.keyAlgorithm)
|
||||||
secretOpts.Password = gitArgs.password
|
secretOpts.Password = gitArgs.password
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ import (
|
|||||||
"github.com/go-git/go-git/v5/plumbing/transport/http"
|
"github.com/go-git/go-git/v5/plumbing/transport/http"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/fluxcd/flux2/internal/bootstrap"
|
|
||||||
"github.com/fluxcd/flux2/internal/bootstrap/git/gogit"
|
|
||||||
"github.com/fluxcd/flux2/internal/bootstrap/provider"
|
|
||||||
"github.com/fluxcd/flux2/internal/flags"
|
"github.com/fluxcd/flux2/internal/flags"
|
||||||
"github.com/fluxcd/flux2/internal/utils"
|
"github.com/fluxcd/flux2/internal/utils"
|
||||||
|
"github.com/fluxcd/flux2/pkg/bootstrap"
|
||||||
|
"github.com/fluxcd/flux2/pkg/bootstrap/git/gogit"
|
||||||
|
"github.com/fluxcd/flux2/pkg/bootstrap/provider"
|
||||||
"github.com/fluxcd/flux2/pkg/manifestgen"
|
"github.com/fluxcd/flux2/pkg/manifestgen"
|
||||||
"github.com/fluxcd/flux2/pkg/manifestgen/install"
|
"github.com/fluxcd/flux2/pkg/manifestgen/install"
|
||||||
"github.com/fluxcd/flux2/pkg/manifestgen/sourcesecret"
|
"github.com/fluxcd/flux2/pkg/manifestgen/sourcesecret"
|
||||||
|
|||||||
@@ -27,11 +27,11 @@ import (
|
|||||||
"github.com/go-git/go-git/v5/plumbing/transport/http"
|
"github.com/go-git/go-git/v5/plumbing/transport/http"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/fluxcd/flux2/internal/bootstrap"
|
|
||||||
"github.com/fluxcd/flux2/internal/bootstrap/git/gogit"
|
|
||||||
"github.com/fluxcd/flux2/internal/bootstrap/provider"
|
|
||||||
"github.com/fluxcd/flux2/internal/flags"
|
"github.com/fluxcd/flux2/internal/flags"
|
||||||
"github.com/fluxcd/flux2/internal/utils"
|
"github.com/fluxcd/flux2/internal/utils"
|
||||||
|
"github.com/fluxcd/flux2/pkg/bootstrap"
|
||||||
|
"github.com/fluxcd/flux2/pkg/bootstrap/git/gogit"
|
||||||
|
"github.com/fluxcd/flux2/pkg/bootstrap/provider"
|
||||||
"github.com/fluxcd/flux2/pkg/manifestgen"
|
"github.com/fluxcd/flux2/pkg/manifestgen"
|
||||||
"github.com/fluxcd/flux2/pkg/manifestgen/install"
|
"github.com/fluxcd/flux2/pkg/manifestgen/install"
|
||||||
"github.com/fluxcd/flux2/pkg/manifestgen/sourcesecret"
|
"github.com/fluxcd/flux2/pkg/manifestgen/sourcesecret"
|
||||||
|
|||||||
@@ -30,10 +30,13 @@ import (
|
|||||||
var buildArtifactCmd = &cobra.Command{
|
var buildArtifactCmd = &cobra.Command{
|
||||||
Use: "artifact",
|
Use: "artifact",
|
||||||
Short: "Build artifact",
|
Short: "Build artifact",
|
||||||
Long: `The build artifact command creates a tgz file with the manifests from the given directory.`,
|
Long: `The build artifact command creates a tgz file with the manifests from the given directory or a single manifest file.`,
|
||||||
Example: ` # Build the given manifests directory into an artifact
|
Example: ` # Build the given manifests directory into an artifact
|
||||||
flux build artifact --path ./path/to/local/manifests --output ./path/to/artifact.tgz
|
flux build artifact --path ./path/to/local/manifests --output ./path/to/artifact.tgz
|
||||||
|
|
||||||
|
# Build the given single manifest file into an artifact
|
||||||
|
flux build artifact --path ./path/to/local/manifest.yaml --output ./path/to/artifact.tgz
|
||||||
|
|
||||||
# List the files bundled in the artifact
|
# List the files bundled in the artifact
|
||||||
tar -ztvf ./path/to/artifact.tgz
|
tar -ztvf ./path/to/artifact.tgz
|
||||||
`,
|
`,
|
||||||
@@ -63,8 +66,8 @@ func buildArtifactCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
return fmt.Errorf("invalid path %q", buildArtifactArgs.path)
|
return fmt.Errorf("invalid path %q", buildArtifactArgs.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
if fs, err := os.Stat(buildArtifactArgs.path); err != nil || !fs.IsDir() {
|
if _, err := os.Stat(buildArtifactArgs.path); err != nil {
|
||||||
return fmt.Errorf("invalid path '%s', must point to an existing directory", buildArtifactArgs.path)
|
return fmt.Errorf("invalid path '%s', must point to an existing directory or file", buildArtifactArgs.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Actionf("building artifact from %s", buildArtifactArgs.path)
|
logger.Actionf("building artifact from %s", buildArtifactArgs.path)
|
||||||
|
|||||||
@@ -79,12 +79,12 @@ type upsertable interface {
|
|||||||
// want to update. The mutate function is nullary -- you mutate a
|
// want to update. The mutate function is nullary -- you mutate a
|
||||||
// value in the closure, e.g., by doing this:
|
// value in the closure, e.g., by doing this:
|
||||||
//
|
//
|
||||||
// var existing Value
|
// var existing Value
|
||||||
// existing.Name = name
|
// existing.Name = name
|
||||||
// existing.Namespace = ns
|
// existing.Namespace = ns
|
||||||
// upsert(ctx, client, valueAdapter{&value}, func() error {
|
// upsert(ctx, client, valueAdapter{&value}, func() error {
|
||||||
// value.Spec = onePreparedEarlier
|
// value.Spec = onePreparedEarlier
|
||||||
// })
|
// })
|
||||||
func (names apiType) upsert(ctx context.Context, kubeClient client.Client, object upsertable, mutate func() error) (types.NamespacedName, error) {
|
func (names apiType) upsert(ctx context.Context, kubeClient client.Client, object upsertable, mutate func() error) (types.NamespacedName, error) {
|
||||||
nsname := types.NamespacedName{
|
nsname := types.NamespacedName{
|
||||||
Namespace: object.GetNamespace(),
|
Namespace: object.GetNamespace(),
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ func createKsCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if kustomizationArgs.kubeConfigSecretRef != "" {
|
if kustomizationArgs.kubeConfigSecretRef != "" {
|
||||||
kustomization.Spec.KubeConfig = &kustomizev1.KubeConfig{
|
kustomization.Spec.KubeConfig = &meta.KubeConfigReference{
|
||||||
SecretRef: meta.SecretKeyReference{
|
SecretRef: meta.SecretKeyReference{
|
||||||
Name: kustomizationArgs.kubeConfigSecretRef,
|
Name: kustomizationArgs.kubeConfigSecretRef,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ type sourceOCIRepositoryFlags struct {
|
|||||||
certSecretRef string
|
certSecretRef string
|
||||||
ignorePaths []string
|
ignorePaths []string
|
||||||
provider flags.SourceOCIProvider
|
provider flags.SourceOCIProvider
|
||||||
|
insecure bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var sourceOCIRepositoryArgs = newSourceOCIFlags()
|
var sourceOCIRepositoryArgs = newSourceOCIFlags()
|
||||||
@@ -80,6 +81,7 @@ func init() {
|
|||||||
createSourceOCIRepositoryCmd.Flags().StringVar(&sourceOCIRepositoryArgs.serviceAccount, "service-account", "", "the name of the Kubernetes service account that refers to an image pull secret")
|
createSourceOCIRepositoryCmd.Flags().StringVar(&sourceOCIRepositoryArgs.serviceAccount, "service-account", "", "the name of the Kubernetes service account that refers to an image pull secret")
|
||||||
createSourceOCIRepositoryCmd.Flags().StringVar(&sourceOCIRepositoryArgs.certSecretRef, "cert-ref", "", "the name of a secret to use for TLS certificates")
|
createSourceOCIRepositoryCmd.Flags().StringVar(&sourceOCIRepositoryArgs.certSecretRef, "cert-ref", "", "the name of a secret to use for TLS certificates")
|
||||||
createSourceOCIRepositoryCmd.Flags().StringSliceVar(&sourceOCIRepositoryArgs.ignorePaths, "ignore-paths", nil, "set paths to ignore resources (can specify multiple paths with commas: path1,path2)")
|
createSourceOCIRepositoryCmd.Flags().StringSliceVar(&sourceOCIRepositoryArgs.ignorePaths, "ignore-paths", nil, "set paths to ignore resources (can specify multiple paths with commas: path1,path2)")
|
||||||
|
createSourceOCIRepositoryCmd.Flags().BoolVar(&sourceOCIRepositoryArgs.insecure, "insecure", false, "for when connecting to a non-TLS registries over plain HTTP")
|
||||||
|
|
||||||
createSourceCmd.AddCommand(createSourceOCIRepositoryCmd)
|
createSourceCmd.AddCommand(createSourceOCIRepositoryCmd)
|
||||||
}
|
}
|
||||||
@@ -115,6 +117,7 @@ func createSourceOCIRepositoryCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
Spec: sourcev1.OCIRepositorySpec{
|
Spec: sourcev1.OCIRepositorySpec{
|
||||||
Provider: sourceOCIRepositoryArgs.provider.String(),
|
Provider: sourceOCIRepositoryArgs.provider.String(),
|
||||||
URL: sourceOCIRepositoryArgs.url,
|
URL: sourceOCIRepositoryArgs.url,
|
||||||
|
Insecure: sourceOCIRepositoryArgs.insecure,
|
||||||
Interval: metav1.Duration{
|
Interval: metav1.Duration{
|
||||||
Duration: createArgs.interval,
|
Duration: createArgs.interval,
|
||||||
},
|
},
|
||||||
|
|||||||
111
cmd/flux/diff_artifact.go
Normal file
111
cmd/flux/diff_artifact.go
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2022 The Flux authors
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/fluxcd/flux2/internal/flags"
|
||||||
|
oci "github.com/fluxcd/pkg/oci/client"
|
||||||
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
var diffArtifactCmd = &cobra.Command{
|
||||||
|
Use: "artifact",
|
||||||
|
Short: "Diff Artifact",
|
||||||
|
Long: `The diff artifact command computes the diff between the remote OCI artifact and a local directory or file`,
|
||||||
|
Example: `# Check if local files differ from remote
|
||||||
|
flux diff artifact oci://ghcr.io/stefanprodan/manifests:podinfo:6.2.0 --path=./kustomize`,
|
||||||
|
RunE: diffArtifactCmdRun,
|
||||||
|
}
|
||||||
|
|
||||||
|
type diffArtifactFlags struct {
|
||||||
|
path string
|
||||||
|
creds string
|
||||||
|
provider flags.SourceOCIProvider
|
||||||
|
ignorePaths []string
|
||||||
|
}
|
||||||
|
|
||||||
|
var diffArtifactArgs = newDiffArtifactArgs()
|
||||||
|
|
||||||
|
func newDiffArtifactArgs() diffArtifactFlags {
|
||||||
|
return diffArtifactFlags{
|
||||||
|
provider: flags.SourceOCIProvider(sourcev1.GenericOCIProvider),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
diffArtifactCmd.Flags().StringVar(&diffArtifactArgs.path, "path", "", "path to the directory where the Kubernetes manifests are located")
|
||||||
|
diffArtifactCmd.Flags().StringVar(&diffArtifactArgs.creds, "creds", "", "credentials for OCI registry in the format <username>[:<password>] if --provider is generic")
|
||||||
|
diffArtifactCmd.Flags().Var(&diffArtifactArgs.provider, "provider", sourceOCIRepositoryArgs.provider.Description())
|
||||||
|
diffArtifactCmd.Flags().StringSliceVar(&diffArtifactArgs.ignorePaths, "ignore-paths", excludeOCI, "set paths to ignore in .gitignore format")
|
||||||
|
diffCmd.AddCommand(diffArtifactCmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
func diffArtifactCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
|
if len(args) < 1 {
|
||||||
|
return fmt.Errorf("artifact URL is required")
|
||||||
|
}
|
||||||
|
ociURL := args[0]
|
||||||
|
|
||||||
|
if diffArtifactArgs.path == "" {
|
||||||
|
return fmt.Errorf("invalid path %q", diffArtifactArgs.path)
|
||||||
|
}
|
||||||
|
|
||||||
|
url, err := oci.ParseArtifactURL(ociURL)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := os.Stat(diffArtifactArgs.path); err != nil {
|
||||||
|
return fmt.Errorf("invalid path '%s', must point to an existing directory or file", diffArtifactArgs.path)
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
ociClient := oci.NewLocalClient()
|
||||||
|
|
||||||
|
if diffArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && diffArtifactArgs.creds != "" {
|
||||||
|
logger.Actionf("logging in to registry with credentials")
|
||||||
|
if err := ociClient.LoginWithCredentials(diffArtifactArgs.creds); err != nil {
|
||||||
|
return fmt.Errorf("could not login with credentials: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if diffArtifactArgs.provider.String() != sourcev1.GenericOCIProvider {
|
||||||
|
logger.Actionf("logging in to registry with provider credentials")
|
||||||
|
ociProvider, err := diffArtifactArgs.provider.ToOCIProvider()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("provider not supported: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := ociClient.LoginWithProvider(ctx, url, ociProvider); err != nil {
|
||||||
|
return fmt.Errorf("error during login with provider: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := ociClient.Diff(ctx, url, diffArtifactArgs.path, diffArtifactArgs.ignorePaths); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.Successf("no changes detected")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
109
cmd/flux/diff_artifact_test.go
Normal file
109
cmd/flux/diff_artifact_test.go
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
//go:build unit
|
||||||
|
// +build unit
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright 2021 The Flux authors
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/distribution/distribution/v3/configuration"
|
||||||
|
"github.com/distribution/distribution/v3/registry"
|
||||||
|
_ "github.com/distribution/distribution/v3/registry/auth/htpasswd"
|
||||||
|
_ "github.com/distribution/distribution/v3/registry/storage/driver/inmemory"
|
||||||
|
"github.com/phayes/freeport"
|
||||||
|
ctrl "sigs.k8s.io/controller-runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
var dockerReg string
|
||||||
|
|
||||||
|
func setupRegistryServer(ctx context.Context) error {
|
||||||
|
// Registry config
|
||||||
|
config := &configuration.Configuration{}
|
||||||
|
port, err := freeport.GetFreePort()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to get free port: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
dockerReg = fmt.Sprintf("localhost:%d", port)
|
||||||
|
config.HTTP.Addr = fmt.Sprintf("127.0.0.1:%d", port)
|
||||||
|
config.HTTP.DrainTimeout = time.Duration(10) * time.Second
|
||||||
|
config.Storage = map[string]configuration.Parameters{"inmemory": map[string]interface{}{}}
|
||||||
|
dockerRegistry, err := registry.NewRegistry(ctx, config)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to create docker registry: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start Docker registry
|
||||||
|
go dockerRegistry.ListenAndServe()
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestDiffArtifact(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
url string
|
||||||
|
argsTpl string
|
||||||
|
pushFile string
|
||||||
|
diffFile string
|
||||||
|
assert assertFunc
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "should not fail if there is no diff",
|
||||||
|
url: "oci://%s/podinfo:1.0.0",
|
||||||
|
argsTpl: "diff artifact %s --path=%s",
|
||||||
|
pushFile: "./testdata/diff-artifact/deployment.yaml",
|
||||||
|
diffFile: "./testdata/diff-artifact/deployment.yaml",
|
||||||
|
assert: assertGoldenFile("testdata/diff-artifact/success.golden"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "should fail if there is a diff",
|
||||||
|
url: "oci://%s/podinfo:2.0.0",
|
||||||
|
argsTpl: "diff artifact %s --path=%s",
|
||||||
|
pushFile: "./testdata/diff-artifact/deployment.yaml",
|
||||||
|
diffFile: "./testdata/diff-artifact/deployment-diff.yaml",
|
||||||
|
assert: assertError("the remote artifact contents differs from the local one"),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx := ctrl.SetupSignalHandler()
|
||||||
|
err := setupRegistryServer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Sprintf("failed to start docker registry: %s", err))
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
tt.url = fmt.Sprintf(tt.url, dockerReg)
|
||||||
|
_, err := executeCommand("push artifact " + tt.url + " --path=" + tt.pushFile + " --source=test --revision=test")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf(fmt.Errorf("failed to push image: %w", err).Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd := cmdTestCase{
|
||||||
|
args: fmt.Sprintf(tt.argsTpl, tt.url, tt.diffFile),
|
||||||
|
assert: tt.assert,
|
||||||
|
}
|
||||||
|
cmd.runTestCmd(t)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,7 +28,6 @@ import (
|
|||||||
|
|
||||||
const fmTemplate = `---
|
const fmTemplate = `---
|
||||||
title: "%s"
|
title: "%s"
|
||||||
importedDoc: true
|
|
||||||
---
|
---
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|||||||
@@ -214,7 +214,6 @@ func getRowsToPrint(getAll bool, list summarisable) ([][]string, error) {
|
|||||||
return rows, nil
|
return rows, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// watch starts a client-side watch of one or more resources.
|
// watch starts a client-side watch of one or more resources.
|
||||||
func (get *getCommand) watch(ctx context.Context, kubeClient client.WithWatch, cmd *cobra.Command, args []string, listOpts []client.ListOption) error {
|
func (get *getCommand) watch(ctx context.Context, kubeClient client.WithWatch, cmd *cobra.Command, args []string, listOpts []client.ListOption) error {
|
||||||
w, err := kubeClient.Watch(ctx, get.list.asClientList(), listOpts...)
|
w, err := kubeClient.Watch(ctx, get.list.asClientList(), listOpts...)
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/fluxcd/flux2/internal/flags"
|
||||||
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
oci "github.com/fluxcd/pkg/oci/client"
|
oci "github.com/fluxcd/pkg/oci/client"
|
||||||
@@ -30,15 +32,23 @@ import (
|
|||||||
type listArtifactFlags struct {
|
type listArtifactFlags struct {
|
||||||
semverFilter string
|
semverFilter string
|
||||||
regexFilter string
|
regexFilter string
|
||||||
|
creds string
|
||||||
|
provider flags.SourceOCIProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
var listArtifactArgs listArtifactFlags
|
var listArtifactArgs = newListArtifactFlags()
|
||||||
|
|
||||||
|
func newListArtifactFlags() listArtifactFlags {
|
||||||
|
return listArtifactFlags{
|
||||||
|
provider: flags.SourceOCIProvider(sourcev1.GenericOCIProvider),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var listArtifactsCmd = &cobra.Command{
|
var listArtifactsCmd = &cobra.Command{
|
||||||
Use: "artifacts",
|
Use: "artifacts",
|
||||||
Short: "list artifacts",
|
Short: "list artifacts",
|
||||||
Long: `The list command fetches the tags and their metadata from a remote OCI repository.
|
Long: `The list command fetches the tags and their metadata from a remote OCI repository.
|
||||||
The command uses the credentials from '~/.docker/config.json'.`,
|
The command can read the credentials from '~/.docker/config.json' but they can also be passed with --creds. It can also login to a supported provider with the --provider flag.`,
|
||||||
Example: ` # List the artifacts stored in an OCI repository
|
Example: ` # List the artifacts stored in an OCI repository
|
||||||
flux list artifact oci://ghcr.io/org/config/app
|
flux list artifact oci://ghcr.io/org/config/app
|
||||||
`,
|
`,
|
||||||
@@ -48,6 +58,8 @@ The command uses the credentials from '~/.docker/config.json'.`,
|
|||||||
func init() {
|
func init() {
|
||||||
listArtifactsCmd.Flags().StringVar(&listArtifactArgs.semverFilter, "filter-semver", "", "filter tags returned from the oci repository using semver")
|
listArtifactsCmd.Flags().StringVar(&listArtifactArgs.semverFilter, "filter-semver", "", "filter tags returned from the oci repository using semver")
|
||||||
listArtifactsCmd.Flags().StringVar(&listArtifactArgs.regexFilter, "filter-regex", "", "filter tags returned from the oci repository using regex")
|
listArtifactsCmd.Flags().StringVar(&listArtifactArgs.regexFilter, "filter-regex", "", "filter tags returned from the oci repository using regex")
|
||||||
|
listArtifactsCmd.Flags().StringVar(&listArtifactArgs.creds, "creds", "", "credentials for OCI registry in the format <username>[:<password>] if --provider is generic")
|
||||||
|
listArtifactsCmd.Flags().Var(&listArtifactArgs.provider, "provider", listArtifactArgs.provider.Description())
|
||||||
|
|
||||||
listCmd.AddCommand(listArtifactsCmd)
|
listCmd.AddCommand(listArtifactsCmd)
|
||||||
}
|
}
|
||||||
@@ -61,12 +73,32 @@ func listArtifactsCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
|
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
ociClient := oci.NewLocalClient()
|
|
||||||
url, err := oci.ParseArtifactURL(ociURL)
|
url, err := oci.ParseArtifactURL(ociURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ociClient := oci.NewLocalClient()
|
||||||
|
|
||||||
|
if listArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && listArtifactArgs.creds != "" {
|
||||||
|
logger.Actionf("logging in to registry with credentials")
|
||||||
|
if err := ociClient.LoginWithCredentials(listArtifactArgs.creds); err != nil {
|
||||||
|
return fmt.Errorf("could not login with credentials: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if listArtifactArgs.provider.String() != sourcev1.GenericOCIProvider {
|
||||||
|
logger.Actionf("logging in to registry with provider credentials")
|
||||||
|
ociProvider, err := listArtifactArgs.provider.ToOCIProvider()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("provider not supported: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := ociClient.LoginWithProvider(ctx, url, ociProvider); err != nil {
|
||||||
|
return fmt.Errorf("error during login with provider: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
opts := oci.ListOptions{
|
opts := oci.ListOptions{
|
||||||
RegexFilter: listArtifactArgs.regexFilter,
|
RegexFilter: listArtifactArgs.regexFilter,
|
||||||
SemverFilter: listArtifactArgs.semverFilter,
|
SemverFilter: listArtifactArgs.semverFilter,
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ func logRequest(ctx context.Context, request rest.ResponseWrapper, w io.Writer)
|
|||||||
|
|
||||||
scanner := bufio.NewScanner(stream)
|
scanner := bufio.NewScanner(stream)
|
||||||
|
|
||||||
const logTmpl = "{{.Timestamp}} {{.Level}} {{.Kind}}{{if .Name}}/{{.Name}}.{{.Namespace}}{{end}} - {{.Message}} {{.Error}}\n"
|
const logTmpl = "{{.Timestamp}} {{.Level}} {{or .Kind .ControllerKind}}{{if .Name}}/{{.Name}}.{{.Namespace}}{{end}} - {{.Message}} {{.Error}}\n"
|
||||||
t, err := template.New("log").Parse(logTmpl)
|
t, err := template.New("log").Parse(logTmpl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to create template, err: %s", err)
|
return fmt.Errorf("unable to create template, err: %s", err)
|
||||||
@@ -278,7 +278,7 @@ func logRequest(ctx context.Context, request rest.ResponseWrapper, w io.Writer)
|
|||||||
|
|
||||||
func filterPrintLog(t *template.Template, l *ControllerLogEntry, w io.Writer) {
|
func filterPrintLog(t *template.Template, l *ControllerLogEntry, w io.Writer) {
|
||||||
if (logsArgs.logLevel == "" || logsArgs.logLevel == l.Level) &&
|
if (logsArgs.logLevel == "" || logsArgs.logLevel == l.Level) &&
|
||||||
(logsArgs.kind == "" || strings.EqualFold(logsArgs.kind, l.Kind)) &&
|
(logsArgs.kind == "" || strings.EqualFold(logsArgs.kind, l.Kind) || strings.EqualFold(logsArgs.kind, l.ControllerKind)) &&
|
||||||
(logsArgs.name == "" || strings.EqualFold(logsArgs.name, l.Name)) &&
|
(logsArgs.name == "" || strings.EqualFold(logsArgs.name, l.Name)) &&
|
||||||
(logsArgs.allNamespaces || strings.EqualFold(*kubeconfigArgs.Namespace, l.Namespace)) {
|
(logsArgs.allNamespaces || strings.EqualFold(*kubeconfigArgs.Namespace, l.Namespace)) {
|
||||||
err := t.Execute(w, l)
|
err := t.Execute(w, l)
|
||||||
@@ -289,12 +289,13 @@ func filterPrintLog(t *template.Template, l *ControllerLogEntry, w io.Writer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ControllerLogEntry struct {
|
type ControllerLogEntry struct {
|
||||||
Timestamp string `json:"ts"`
|
Timestamp string `json:"ts"`
|
||||||
Level flags.LogLevel `json:"level"`
|
Level flags.LogLevel `json:"level"`
|
||||||
Message string `json:"msg"`
|
Message string `json:"msg"`
|
||||||
Error string `json:"error,omitempty"`
|
Error string `json:"error,omitempty"`
|
||||||
Logger string `json:"logger"`
|
Logger string `json:"logger"`
|
||||||
Kind string `json:"reconciler kind,omitempty"`
|
Kind string `json:"reconciler kind,omitempty"`
|
||||||
Name string `json:"name,omitempty"`
|
ControllerKind string `json:"controllerKind,omitempty"`
|
||||||
Namespace string `json:"namespace,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
|
Namespace string `json:"namespace,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,12 +170,13 @@ func TestLogRequest(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var testPodLogs = `{"level":"info","ts":"2022-08-02T12:55:34.419Z","logger":"controller.gitrepository","msg":"no changes since last reconcilation: observed revision","reconciler group":"source.toolkit.fluxcd.io","reconciler kind":"GitRepository","name":"podinfo","namespace":"default"}
|
var testPodLogs = `{"level":"info","ts":"2022-08-02T12:55:34.419Z","msg":"no changes since last reconcilation: observed revision","controller":"gitrepository","controllerGroup":"source.toolkit.fluxcd.io","controllerKind":"GitRepository","gitRepository":{"name":"podinfo","namespace":"default"},"namespace":"default","name":"podinfo","reconcileID":"5ef9b2ef-4ea5-47b7-b887-a247cafc1bce"}
|
||||||
{"level":"error","ts":"2022-08-02T12:56:04.679Z","logger":"controller.gitrepository","msg":"no changes since last reconcilation: observed revision","reconciler group":"source.toolkit.fluxcd.io","reconciler kind":"GitRepository","name":"flux-system","namespace":"flux-system"}
|
{"level":"error","ts":"2022-08-02T12:56:04.679Z","logger":"controller.gitrepository","msg":"no changes since last reconcilation: observed revision","controllerGroup":"source.toolkit.fluxcd.io","controllerKind":"GitRepository","gitRepository":{"name":"podinfo","namespace":"flux-system"},"name":"flux-system","namespace":"flux-system","reconcileID":"543ef9b2ef-4ea5-47b7-b887-a247cafc1bce"}
|
||||||
{"level":"error","ts":"2022-08-02T12:56:34.961Z","logger":"controller.kustomization","msg":"no changes since last reconcilation: observed revision","reconciler group":"kustomize.toolkit.fluxcd.io","reconciler kind":"Kustomization","name":"flux-system","namespace":"flux-system"}
|
{"level":"error","ts":"2022-08-02T12:56:34.961Z","logger":"controller.kustomization","msg":"no changes since last reconcilation: observed revision","reconciler group":"kustomize.toolkit.fluxcd.io","reconciler kind":"Kustomization","name":"flux-system","namespace":"flux-system"}
|
||||||
{"level":"info","ts":"2022-08-02T12:56:34.961Z","logger":"controller.kustomization","msg":"no changes since last reconcilation: observed revision","reconciler group":"kustomize.toolkit.fluxcd.io","reconciler kind":"Kustomization","name":"podinfo","namespace":"default"}
|
{"level":"info","ts":"2022-08-02T12:56:34.961Z","logger":"controller.kustomization","msg":"no changes since last reconcilation: observed revision","reconciler group":"kustomize.toolkit.fluxcd.io","reconciler kind":"Kustomization","name":"podinfo","namespace":"default"}
|
||||||
{"level":"info","ts":"2022-08-02T12:56:34.961Z","logger":"controller.gitrepository","msg":"no changes since last reconcilation: observed revision","reconciler group":"source.toolkit.fluxcd.io","reconciler kind":"GitRepository","name":"podinfo","namespace":"default"}
|
{"level":"info","ts":"2022-08-02T12:56:34.961Z","logger":"controller.gitrepository","msg":"no changes since last reconcilation: observed revision","reconciler group":"source.toolkit.fluxcd.io","reconciler kind":"GitRepository","name":"podinfo","namespace":"default"}
|
||||||
{"level":"error","ts":"2022-08-02T12:56:34.961Z","logger":"controller.kustomization","msg":"no changes since last reconcilation: observed revision","reconciler group":"kustomize.toolkit.fluxcd.io","reconciler kind":"Kustomization","name":"podinfo","namespace":"flux-system"}`
|
{"level":"error","ts":"2022-08-02T12:56:34.961Z","logger":"controller.kustomization","msg":"no changes since last reconcilation: observed revision","reconciler group":"kustomize.toolkit.fluxcd.io","reconciler kind":"Kustomization","name":"podinfo","namespace":"flux-system"}
|
||||||
|
`
|
||||||
|
|
||||||
type testResponseMapper struct {
|
type testResponseMapper struct {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/fluxcd/flux2/internal/flags"
|
||||||
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
oci "github.com/fluxcd/pkg/oci/client"
|
oci "github.com/fluxcd/pkg/oci/client"
|
||||||
@@ -30,7 +32,7 @@ var pullArtifactCmd = &cobra.Command{
|
|||||||
Use: "artifact",
|
Use: "artifact",
|
||||||
Short: "Pull artifact",
|
Short: "Pull artifact",
|
||||||
Long: `The pull artifact command downloads and extracts the OCI artifact content to the given path.
|
Long: `The pull artifact command downloads and extracts the OCI artifact content to the given path.
|
||||||
The pull command uses the credentials from '~/.docker/config.json'.`,
|
The command can read the credentials from '~/.docker/config.json' but they can also be passed with --creds. It can also login to a supported provider with the --provider flag.`,
|
||||||
Example: ` # Pull an OCI artifact created by flux from GHCR
|
Example: ` # Pull an OCI artifact created by flux from GHCR
|
||||||
flux pull artifact oci://ghcr.io/org/manifests/app:v0.0.1 --output ./path/to/local/manifests
|
flux pull artifact oci://ghcr.io/org/manifests/app:v0.0.1 --output ./path/to/local/manifests
|
||||||
`,
|
`,
|
||||||
@@ -38,13 +40,23 @@ The pull command uses the credentials from '~/.docker/config.json'.`,
|
|||||||
}
|
}
|
||||||
|
|
||||||
type pullArtifactFlags struct {
|
type pullArtifactFlags struct {
|
||||||
output string
|
output string
|
||||||
|
creds string
|
||||||
|
provider flags.SourceOCIProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
var pullArtifactArgs pullArtifactFlags
|
var pullArtifactArgs = newPullArtifactFlags()
|
||||||
|
|
||||||
|
func newPullArtifactFlags() pullArtifactFlags {
|
||||||
|
return pullArtifactFlags{
|
||||||
|
provider: flags.SourceOCIProvider(sourcev1.GenericOCIProvider),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
pullArtifactCmd.Flags().StringVarP(&pullArtifactArgs.output, "output", "o", "", "path where the artifact content should be extracted.")
|
pullArtifactCmd.Flags().StringVarP(&pullArtifactArgs.output, "output", "o", "", "path where the artifact content should be extracted.")
|
||||||
|
pullArtifactCmd.Flags().StringVar(&pullArtifactArgs.creds, "creds", "", "credentials for OCI registry in the format <username>[:<password>] if --provider is generic")
|
||||||
|
pullArtifactCmd.Flags().Var(&pullArtifactArgs.provider, "provider", sourceOCIRepositoryArgs.provider.Description())
|
||||||
pullCmd.AddCommand(pullArtifactCmd)
|
pullCmd.AddCommand(pullArtifactCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +74,6 @@ func pullArtifactCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
return fmt.Errorf("invalid output path %s", pullArtifactArgs.output)
|
return fmt.Errorf("invalid output path %s", pullArtifactArgs.output)
|
||||||
}
|
}
|
||||||
|
|
||||||
ociClient := oci.NewLocalClient()
|
|
||||||
url, err := oci.ParseArtifactURL(ociURL)
|
url, err := oci.ParseArtifactURL(ociURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -71,6 +82,27 @@ func pullArtifactCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
|
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
|
ociClient := oci.NewLocalClient()
|
||||||
|
|
||||||
|
if pullArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && pullArtifactArgs.creds != "" {
|
||||||
|
logger.Actionf("logging in to registry with credentials")
|
||||||
|
if err := ociClient.LoginWithCredentials(pullArtifactArgs.creds); err != nil {
|
||||||
|
return fmt.Errorf("could not login with credentials: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if pullArtifactArgs.provider.String() != sourcev1.GenericOCIProvider {
|
||||||
|
logger.Actionf("logging in to registry with provider credentials")
|
||||||
|
ociProvider, err := pullArtifactArgs.provider.ToOCIProvider()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("provider not supported: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := ociClient.LoginWithProvider(ctx, url, ociProvider); err != nil {
|
||||||
|
return fmt.Errorf("error during login with provider: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
logger.Actionf("pulling artifact from %s", url)
|
logger.Actionf("pulling artifact from %s", url)
|
||||||
|
|
||||||
meta, err := ociClient.Pull(ctx, url, pullArtifactArgs.output)
|
meta, err := ociClient.Pull(ctx, url, pullArtifactArgs.output)
|
||||||
|
|||||||
@@ -19,17 +19,20 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/spf13/cobra"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/fluxcd/flux2/internal/flags"
|
||||||
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
oci "github.com/fluxcd/pkg/oci/client"
|
oci "github.com/fluxcd/pkg/oci/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
var pushArtifactCmd = &cobra.Command{
|
var pushArtifactCmd = &cobra.Command{
|
||||||
Use: "artifact",
|
Use: "artifact",
|
||||||
Short: "Push artifact",
|
Short: "Push artifact",
|
||||||
Long: `The push artifact command creates a tarball from the given directory and uploads the artifact to an OCI repository.
|
Long: `The push artifact command creates a tarball from the given directory or the single file and uploads the artifact to an OCI repository.
|
||||||
The command uses the credentials from '~/.docker/config.json'.`,
|
The command can read the credentials from '~/.docker/config.json' but they can also be passed with --creds. It can also login to a supported provider with the --provider flag.`,
|
||||||
Example: ` # Push manifests to GHCR using the short Git SHA as the OCI artifact tag
|
Example: ` # Push manifests to GHCR using the short Git SHA as the OCI artifact tag
|
||||||
echo $GITHUB_PAT | docker login ghcr.io --username flux --password-stdin
|
echo $GITHUB_PAT | docker login ghcr.io --username flux --password-stdin
|
||||||
flux push artifact oci://ghcr.io/org/config/app:$(git rev-parse --short HEAD) \
|
flux push artifact oci://ghcr.io/org/config/app:$(git rev-parse --short HEAD) \
|
||||||
@@ -37,12 +40,35 @@ The command uses the credentials from '~/.docker/config.json'.`,
|
|||||||
--source="$(git config --get remote.origin.url)" \
|
--source="$(git config --get remote.origin.url)" \
|
||||||
--revision="$(git branch --show-current)/$(git rev-parse HEAD)"
|
--revision="$(git branch --show-current)/$(git rev-parse HEAD)"
|
||||||
|
|
||||||
|
# Push single manifest file to GHCR using the short Git SHA as the OCI artifact tag
|
||||||
|
echo $GITHUB_PAT | docker login ghcr.io --username flux --password-stdin
|
||||||
|
flux push artifact oci://ghcr.io/org/config/app:$(git rev-parse --short HEAD) \
|
||||||
|
--path="./path/to/local/manifest.yaml" \
|
||||||
|
--source="$(git config --get remote.origin.url)" \
|
||||||
|
--revision="$(git branch --show-current)/$(git rev-parse HEAD)"
|
||||||
|
|
||||||
# Push manifests to Docker Hub using the Git tag as the OCI artifact tag
|
# Push manifests to Docker Hub using the Git tag as the OCI artifact tag
|
||||||
echo $DOCKER_PAT | docker login --username flux --password-stdin
|
echo $DOCKER_PAT | docker login --username flux --password-stdin
|
||||||
flux push artifact oci://docker.io/org/app-config:$(git tag --points-at HEAD) \
|
flux push artifact oci://docker.io/org/app-config:$(git tag --points-at HEAD) \
|
||||||
--path="./path/to/local/manifests" \
|
--path="./path/to/local/manifests" \
|
||||||
--source="$(git config --get remote.origin.url)" \
|
--source="$(git config --get remote.origin.url)" \
|
||||||
--revision="$(git tag --points-at HEAD)/$(git rev-parse HEAD)"
|
--revision="$(git tag --points-at HEAD)/$(git rev-parse HEAD)"
|
||||||
|
|
||||||
|
# Login directly to the registry provider
|
||||||
|
# You might need to export the following variable if you use local config files for AWS:
|
||||||
|
# export AWS_SDK_LOAD_CONFIG=1
|
||||||
|
flux push artifact oci://<account>.dkr.ecr.<region>.amazonaws.com/foo:v1:$(git tag --points-at HEAD) \
|
||||||
|
--path="./path/to/local/manifests" \
|
||||||
|
--source="$(git config --get remote.origin.url)" \
|
||||||
|
--revision="$(git tag --points-at HEAD)/$(git rev-parse HEAD)" \
|
||||||
|
--provider aws
|
||||||
|
|
||||||
|
# Or pass credentials directly
|
||||||
|
flux push artifact oci://docker.io/org/app-config:$(git tag --points-at HEAD) \
|
||||||
|
--path="./path/to/local/manifests" \
|
||||||
|
--source="$(git config --get remote.origin.url)" \
|
||||||
|
--revision="$(git tag --points-at HEAD)/$(git rev-parse HEAD)" \
|
||||||
|
--creds flux:$DOCKER_PAT
|
||||||
`,
|
`,
|
||||||
RunE: pushArtifactCmdRun,
|
RunE: pushArtifactCmdRun,
|
||||||
}
|
}
|
||||||
@@ -51,15 +77,25 @@ type pushArtifactFlags struct {
|
|||||||
path string
|
path string
|
||||||
source string
|
source string
|
||||||
revision string
|
revision string
|
||||||
|
creds string
|
||||||
|
provider flags.SourceOCIProvider
|
||||||
ignorePaths []string
|
ignorePaths []string
|
||||||
}
|
}
|
||||||
|
|
||||||
var pushArtifactArgs pushArtifactFlags
|
var pushArtifactArgs = newPushArtifactFlags()
|
||||||
|
|
||||||
|
func newPushArtifactFlags() pushArtifactFlags {
|
||||||
|
return pushArtifactFlags{
|
||||||
|
provider: flags.SourceOCIProvider(sourcev1.GenericOCIProvider),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.path, "path", "", "path to the directory where the Kubernetes manifests are located")
|
pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.path, "path", "", "path to the directory where the Kubernetes manifests are located")
|
||||||
pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.source, "source", "", "the source address, e.g. the Git URL")
|
pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.source, "source", "", "the source address, e.g. the Git URL")
|
||||||
pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.revision, "revision", "", "the source revision in the format '<branch|tag>/<commit-sha>'")
|
pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.revision, "revision", "", "the source revision in the format '<branch|tag>/<commit-sha>'")
|
||||||
|
pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.creds, "creds", "", "credentials for OCI registry in the format <username>[:<password>] if --provider is generic")
|
||||||
|
pushArtifactCmd.Flags().Var(&pushArtifactArgs.provider, "provider", pushArtifactArgs.provider.Description())
|
||||||
pushArtifactCmd.Flags().StringSliceVar(&pushArtifactArgs.ignorePaths, "ignore-paths", excludeOCI, "set paths to ignore in .gitignore format")
|
pushArtifactCmd.Flags().StringSliceVar(&pushArtifactArgs.ignorePaths, "ignore-paths", excludeOCI, "set paths to ignore in .gitignore format")
|
||||||
|
|
||||||
pushCmd.AddCommand(pushArtifactCmd)
|
pushCmd.AddCommand(pushArtifactCmd)
|
||||||
@@ -83,14 +119,13 @@ func pushArtifactCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
return fmt.Errorf("invalid path %q", pushArtifactArgs.path)
|
return fmt.Errorf("invalid path %q", pushArtifactArgs.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
ociClient := oci.NewLocalClient()
|
|
||||||
url, err := oci.ParseArtifactURL(ociURL)
|
url, err := oci.ParseArtifactURL(ociURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if fs, err := os.Stat(pushArtifactArgs.path); err != nil || !fs.IsDir() {
|
if _, err := os.Stat(pushArtifactArgs.path); err != nil {
|
||||||
return fmt.Errorf("invalid path %q", pushArtifactArgs.path)
|
return fmt.Errorf("invalid path '%s', must point to an existing directory or file", buildArtifactArgs.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
meta := oci.Metadata{
|
meta := oci.Metadata{
|
||||||
@@ -101,6 +136,27 @@ func pushArtifactCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
|
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
|
ociClient := oci.NewLocalClient()
|
||||||
|
|
||||||
|
if pushArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && pushArtifactArgs.creds != "" {
|
||||||
|
logger.Actionf("logging in to registry with credentials")
|
||||||
|
if err := ociClient.LoginWithCredentials(pushArtifactArgs.creds); err != nil {
|
||||||
|
return fmt.Errorf("could not login with credentials: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if pushArtifactArgs.provider.String() != sourcev1.GenericOCIProvider {
|
||||||
|
logger.Actionf("logging in to registry with provider credentials")
|
||||||
|
ociProvider, err := pushArtifactArgs.provider.ToOCIProvider()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("provider not supported: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := ociClient.LoginWithProvider(ctx, url, ociProvider); err != nil {
|
||||||
|
return fmt.Errorf("error during login with provider: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
logger.Actionf("pushing artifact to %s", url)
|
logger.Actionf("pushing artifact to %s", url)
|
||||||
|
|
||||||
digest, err := ociClient.Push(ctx, url, pushArtifactArgs.path, meta, pushArtifactArgs.ignorePaths)
|
digest, err := ociClient.Push(ctx, url, pushArtifactArgs.path, meta, pushArtifactArgs.ignorePaths)
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/fluxcd/flux2/internal/flags"
|
||||||
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
oci "github.com/fluxcd/pkg/oci/client"
|
oci "github.com/fluxcd/pkg/oci/client"
|
||||||
@@ -29,7 +31,7 @@ var tagArtifactCmd = &cobra.Command{
|
|||||||
Use: "artifact",
|
Use: "artifact",
|
||||||
Short: "Tag artifact",
|
Short: "Tag artifact",
|
||||||
Long: `The tag artifact command creates tags for the given OCI artifact.
|
Long: `The tag artifact command creates tags for the given OCI artifact.
|
||||||
The command uses the credentials from '~/.docker/config.json'.`,
|
The command can read the credentials from '~/.docker/config.json' but they can also be passed with --creds. It can also login to a supported provider with the --provider flag.`,
|
||||||
Example: ` # Tag an artifact version as latest
|
Example: ` # Tag an artifact version as latest
|
||||||
flux tag artifact oci://ghcr.io/org/manifests/app:v0.0.1 --tag latest
|
flux tag artifact oci://ghcr.io/org/manifests/app:v0.0.1 --tag latest
|
||||||
`,
|
`,
|
||||||
@@ -37,13 +39,23 @@ The command uses the credentials from '~/.docker/config.json'.`,
|
|||||||
}
|
}
|
||||||
|
|
||||||
type tagArtifactFlags struct {
|
type tagArtifactFlags struct {
|
||||||
tags []string
|
tags []string
|
||||||
|
creds string
|
||||||
|
provider flags.SourceOCIProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
var tagArtifactArgs tagArtifactFlags
|
var tagArtifactArgs = newTagArtifactFlags()
|
||||||
|
|
||||||
|
func newTagArtifactFlags() tagArtifactFlags {
|
||||||
|
return tagArtifactFlags{
|
||||||
|
provider: flags.SourceOCIProvider(sourcev1.GenericOCIProvider),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
tagArtifactCmd.Flags().StringSliceVar(&tagArtifactArgs.tags, "tag", nil, "tag name")
|
tagArtifactCmd.Flags().StringSliceVar(&tagArtifactArgs.tags, "tag", nil, "tag name")
|
||||||
|
tagArtifactCmd.Flags().StringVar(&tagArtifactArgs.creds, "creds", "", "credentials for OCI registry in the format <username>[:<password>] if --provider is generic")
|
||||||
|
tagArtifactCmd.Flags().Var(&tagArtifactArgs.provider, "provider", tagArtifactArgs.provider.Description())
|
||||||
tagCmd.AddCommand(tagArtifactCmd)
|
tagCmd.AddCommand(tagArtifactCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +69,6 @@ func tagArtifactCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
return fmt.Errorf("--tag is required")
|
return fmt.Errorf("--tag is required")
|
||||||
}
|
}
|
||||||
|
|
||||||
ociClient := oci.NewLocalClient()
|
|
||||||
url, err := oci.ParseArtifactURL(ociURL)
|
url, err := oci.ParseArtifactURL(ociURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -66,6 +77,27 @@ func tagArtifactCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
|
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
|
ociClient := oci.NewLocalClient()
|
||||||
|
|
||||||
|
if tagArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && tagArtifactArgs.creds != "" {
|
||||||
|
logger.Actionf("logging in to registry with credentials")
|
||||||
|
if err := ociClient.LoginWithCredentials(tagArtifactArgs.creds); err != nil {
|
||||||
|
return fmt.Errorf("could not login with credentials: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if tagArtifactArgs.provider.String() != sourcev1.GenericOCIProvider {
|
||||||
|
logger.Actionf("logging in to registry with provider credentials")
|
||||||
|
ociProvider, err := tagArtifactArgs.provider.ToOCIProvider()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("provider not supported: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := ociClient.LoginWithProvider(ctx, url, ociProvider); err != nil {
|
||||||
|
return fmt.Errorf("error during login with provider: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
logger.Actionf("tagging artifact")
|
logger.Actionf("tagging artifact")
|
||||||
|
|
||||||
for _, tag := range tagArtifactArgs.tags {
|
for _, tag := range tagArtifactArgs.tags {
|
||||||
|
|||||||
78
cmd/flux/testdata/diff-artifact/deployment-diff.yaml
vendored
Normal file
78
cmd/flux/testdata/diff-artifact/deployment-diff.yaml
vendored
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
kustomize.toolkit.fluxcd.io/name: podinfo
|
||||||
|
kustomize.toolkit.fluxcd.io/namespace: {{ .fluxns }}
|
||||||
|
name: podinfo-diff
|
||||||
|
namespace: default
|
||||||
|
spec:
|
||||||
|
minReadySeconds: 3
|
||||||
|
revisionHistoryLimit: 5
|
||||||
|
progressDeadlineSeconds: 60
|
||||||
|
strategy:
|
||||||
|
rollingUpdate:
|
||||||
|
maxUnavailable: 0
|
||||||
|
type: RollingUpdate
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: podinfo
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
prometheus.io/scrape: "true"
|
||||||
|
prometheus.io/port: "9797"
|
||||||
|
labels:
|
||||||
|
app: podinfo
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: podinfod
|
||||||
|
image: ghcr.io/stefanprodan/podinfo:6.0.10
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
containerPort: 9898
|
||||||
|
protocol: TCP
|
||||||
|
- name: http-metrics
|
||||||
|
containerPort: 9797
|
||||||
|
protocol: TCP
|
||||||
|
- name: grpc
|
||||||
|
containerPort: 9999
|
||||||
|
protocol: TCP
|
||||||
|
command:
|
||||||
|
- ./podinfo
|
||||||
|
- --port=9898
|
||||||
|
- --port-metrics=9797
|
||||||
|
- --grpc-port=9999
|
||||||
|
- --grpc-service-name=podinfo
|
||||||
|
- --level=info
|
||||||
|
- --random-delay=false
|
||||||
|
- --random-error=false
|
||||||
|
env:
|
||||||
|
- name: PODINFO_UI_COLOR
|
||||||
|
value: "#34577c"
|
||||||
|
livenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- podcli
|
||||||
|
- check
|
||||||
|
- http
|
||||||
|
- localhost:9898/healthz
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
timeoutSeconds: 5
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- podcli
|
||||||
|
- check
|
||||||
|
- http
|
||||||
|
- localhost:9898/readyz
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
timeoutSeconds: 5
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 2000m
|
||||||
|
memory: 512Mi
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 64Mi
|
||||||
78
cmd/flux/testdata/diff-artifact/deployment.yaml
vendored
Normal file
78
cmd/flux/testdata/diff-artifact/deployment.yaml
vendored
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
kustomize.toolkit.fluxcd.io/name: podinfo
|
||||||
|
kustomize.toolkit.fluxcd.io/namespace: {{ .fluxns }}
|
||||||
|
name: podinfo
|
||||||
|
namespace: default
|
||||||
|
spec:
|
||||||
|
minReadySeconds: 3
|
||||||
|
revisionHistoryLimit: 5
|
||||||
|
progressDeadlineSeconds: 60
|
||||||
|
strategy:
|
||||||
|
rollingUpdate:
|
||||||
|
maxUnavailable: 0
|
||||||
|
type: RollingUpdate
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: podinfo
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
prometheus.io/scrape: "true"
|
||||||
|
prometheus.io/port: "9797"
|
||||||
|
labels:
|
||||||
|
app: podinfo
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: podinfod
|
||||||
|
image: ghcr.io/stefanprodan/podinfo:6.0.10
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
containerPort: 9898
|
||||||
|
protocol: TCP
|
||||||
|
- name: http-metrics
|
||||||
|
containerPort: 9797
|
||||||
|
protocol: TCP
|
||||||
|
- name: grpc
|
||||||
|
containerPort: 9999
|
||||||
|
protocol: TCP
|
||||||
|
command:
|
||||||
|
- ./podinfo
|
||||||
|
- --port=9898
|
||||||
|
- --port-metrics=9797
|
||||||
|
- --grpc-port=9999
|
||||||
|
- --grpc-service-name=podinfo
|
||||||
|
- --level=info
|
||||||
|
- --random-delay=false
|
||||||
|
- --random-error=false
|
||||||
|
env:
|
||||||
|
- name: PODINFO_UI_COLOR
|
||||||
|
value: "#34577c"
|
||||||
|
livenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- podcli
|
||||||
|
- check
|
||||||
|
- http
|
||||||
|
- localhost:9898/healthz
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
timeoutSeconds: 5
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- podcli
|
||||||
|
- check
|
||||||
|
- http
|
||||||
|
- localhost:9898/readyz
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
timeoutSeconds: 5
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 2000m
|
||||||
|
memory: 512Mi
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 64Mi
|
||||||
1
cmd/flux/testdata/diff-artifact/success.golden
vendored
Normal file
1
cmd/flux/testdata/diff-artifact/success.golden
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
✔ no changes detected
|
||||||
@@ -2,4 +2,4 @@
|
|||||||
✔ OCIRepository created
|
✔ OCIRepository created
|
||||||
◎ waiting for OCIRepository reconciliation
|
◎ waiting for OCIRepository reconciliation
|
||||||
✔ OCIRepository reconciliation completed
|
✔ OCIRepository reconciliation completed
|
||||||
✔ fetched revision: dbdb109711ffb3be77504d2670dbe13c24dd63d8d7f1fb489d350e5bfe930dd3
|
✔ fetched revision: 6.1.6/dbdb109711ffb3be77504d2670dbe13c24dd63d8d7f1fb489d350e5bfe930dd3
|
||||||
|
|||||||
4
cmd/flux/testdata/oci/get_oci.golden
vendored
4
cmd/flux/testdata/oci/get_oci.golden
vendored
@@ -1,2 +1,2 @@
|
|||||||
NAME REVISION SUSPENDED READY MESSAGE
|
NAME REVISION SUSPENDED READY MESSAGE
|
||||||
thrfg dbdb109711ffb3be77504d2670dbe13c24dd63d8d7f1fb489d350e5bfe930dd3 False True stored artifact for digest 'dbdb109711ffb3be77504d2670dbe13c24dd63d8d7f1fb489d350e5bfe930dd3'
|
thrfg 6.1.6/dbdb109711ffb3be77504d2670dbe13c24dd63d8d7f1fb489d350e5bfe930dd3 False True stored artifact for digest '6.1.6/dbdb109711ffb3be77504d2670dbe13c24dd63d8d7f1fb489d350e5bfe930dd3'
|
||||||
|
|||||||
2
cmd/flux/testdata/oci/reconcile_oci.golden
vendored
2
cmd/flux/testdata/oci/reconcile_oci.golden
vendored
@@ -1,4 +1,4 @@
|
|||||||
► annotating OCIRepository thrfg in {{ .ns }} namespace
|
► annotating OCIRepository thrfg in {{ .ns }} namespace
|
||||||
✔ OCIRepository annotated
|
✔ OCIRepository annotated
|
||||||
◎ waiting for OCIRepository reconciliation
|
◎ waiting for OCIRepository reconciliation
|
||||||
✔ fetched revision dbdb109711ffb3be77504d2670dbe13c24dd63d8d7f1fb489d350e5bfe930dd3
|
✔ fetched revision 6.1.6/dbdb109711ffb3be77504d2670dbe13c24dd63d8d7f1fb489d350e5bfe930dd3
|
||||||
|
|||||||
2
cmd/flux/testdata/oci/resume_oci.golden
vendored
2
cmd/flux/testdata/oci/resume_oci.golden
vendored
@@ -2,4 +2,4 @@
|
|||||||
✔ source oci resumed
|
✔ source oci resumed
|
||||||
◎ waiting for OCIRepository reconciliation
|
◎ waiting for OCIRepository reconciliation
|
||||||
✔ OCIRepository reconciliation completed
|
✔ OCIRepository reconciliation completed
|
||||||
✔ fetched revision dbdb109711ffb3be77504d2670dbe13c24dd63d8d7f1fb489d350e5bfe930dd3
|
✔ fetched revision 6.1.6/dbdb109711ffb3be77504d2670dbe13c24dd63d8d7f1fb489d350e5bfe930dd3
|
||||||
|
|||||||
@@ -22,21 +22,9 @@ import (
|
|||||||
|
|
||||||
"github.com/manifoldco/promptui"
|
"github.com/manifoldco/promptui"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
appsv1 "k8s.io/api/apps/v1"
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
|
||||||
networkingv1 "k8s.io/api/networking/v1"
|
|
||||||
rbacv1 "k8s.io/api/rbac/v1"
|
|
||||||
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
|
||||||
|
|
||||||
"github.com/fluxcd/flux2/internal/utils"
|
"github.com/fluxcd/flux2/internal/utils"
|
||||||
"github.com/fluxcd/flux2/pkg/manifestgen"
|
"github.com/fluxcd/flux2/pkg/uninstall"
|
||||||
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
|
|
||||||
autov1 "github.com/fluxcd/image-automation-controller/api/v1beta1"
|
|
||||||
imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta1"
|
|
||||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var uninstallCmd = &cobra.Command{
|
var uninstallCmd = &cobra.Command{
|
||||||
@@ -90,265 +78,18 @@ func uninstallCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logger.Actionf("deleting components in %s namespace", *kubeconfigArgs.Namespace)
|
logger.Actionf("deleting components in %s namespace", *kubeconfigArgs.Namespace)
|
||||||
uninstallComponents(ctx, kubeClient, *kubeconfigArgs.Namespace, uninstallArgs.dryRun)
|
uninstall.Components(ctx, logger, kubeClient, *kubeconfigArgs.Namespace, uninstallArgs.dryRun)
|
||||||
|
|
||||||
logger.Actionf("deleting toolkit.fluxcd.io finalizers in all namespaces")
|
logger.Actionf("deleting toolkit.fluxcd.io finalizers in all namespaces")
|
||||||
uninstallFinalizers(ctx, kubeClient, uninstallArgs.dryRun)
|
uninstall.Finalizers(ctx, logger, kubeClient, uninstallArgs.dryRun)
|
||||||
|
|
||||||
logger.Actionf("deleting toolkit.fluxcd.io custom resource definitions")
|
logger.Actionf("deleting toolkit.fluxcd.io custom resource definitions")
|
||||||
uninstallCustomResourceDefinitions(ctx, kubeClient, uninstallArgs.dryRun)
|
uninstall.CustomResourceDefinitions(ctx, logger, kubeClient, uninstallArgs.dryRun)
|
||||||
|
|
||||||
if !uninstallArgs.keepNamespace {
|
if !uninstallArgs.keepNamespace {
|
||||||
uninstallNamespace(ctx, kubeClient, *kubeconfigArgs.Namespace, uninstallArgs.dryRun)
|
uninstall.Namespace(ctx, logger, kubeClient, *kubeconfigArgs.Namespace, uninstallArgs.dryRun)
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Successf("uninstall finished")
|
logger.Successf("uninstall finished")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func uninstallComponents(ctx context.Context, kubeClient client.Client, namespace string, dryRun bool) {
|
|
||||||
opts, dryRunStr := getDeleteOptions(dryRun)
|
|
||||||
selector := client.MatchingLabels{manifestgen.PartOfLabelKey: manifestgen.PartOfLabelValue}
|
|
||||||
{
|
|
||||||
var list appsv1.DeploymentList
|
|
||||||
if err := kubeClient.List(ctx, &list, client.InNamespace(namespace), selector); err == nil {
|
|
||||||
for _, r := range list.Items {
|
|
||||||
if err := kubeClient.Delete(ctx, &r, opts); err != nil {
|
|
||||||
logger.Failuref("Deployment/%s/%s deletion failed: %s", r.Namespace, r.Name, err.Error())
|
|
||||||
} else {
|
|
||||||
logger.Successf("Deployment/%s/%s deleted %s", r.Namespace, r.Name, dryRunStr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
var list corev1.ServiceList
|
|
||||||
if err := kubeClient.List(ctx, &list, client.InNamespace(namespace), selector); err == nil {
|
|
||||||
for _, r := range list.Items {
|
|
||||||
if err := kubeClient.Delete(ctx, &r, opts); err != nil {
|
|
||||||
logger.Failuref("Service/%s/%s deletion failed: %s", r.Namespace, r.Name, err.Error())
|
|
||||||
} else {
|
|
||||||
logger.Successf("Service/%s/%s deleted %s", r.Namespace, r.Name, dryRunStr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
var list networkingv1.NetworkPolicyList
|
|
||||||
if err := kubeClient.List(ctx, &list, client.InNamespace(namespace), selector); err == nil {
|
|
||||||
for _, r := range list.Items {
|
|
||||||
if err := kubeClient.Delete(ctx, &r, opts); err != nil {
|
|
||||||
logger.Failuref("NetworkPolicy/%s/%s deletion failed: %s", r.Namespace, r.Name, err.Error())
|
|
||||||
} else {
|
|
||||||
logger.Successf("NetworkPolicy/%s/%s deleted %s", r.Namespace, r.Name, dryRunStr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
var list corev1.ServiceAccountList
|
|
||||||
if err := kubeClient.List(ctx, &list, client.InNamespace(namespace), selector); err == nil {
|
|
||||||
for _, r := range list.Items {
|
|
||||||
if err := kubeClient.Delete(ctx, &r, opts); err != nil {
|
|
||||||
logger.Failuref("ServiceAccount/%s/%s deletion failed: %s", r.Namespace, r.Name, err.Error())
|
|
||||||
} else {
|
|
||||||
logger.Successf("ServiceAccount/%s/%s deleted %s", r.Namespace, r.Name, dryRunStr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
var list rbacv1.ClusterRoleList
|
|
||||||
if err := kubeClient.List(ctx, &list, selector); err == nil {
|
|
||||||
for _, r := range list.Items {
|
|
||||||
if err := kubeClient.Delete(ctx, &r, opts); err != nil {
|
|
||||||
logger.Failuref("ClusterRole/%s deletion failed: %s", r.Name, err.Error())
|
|
||||||
} else {
|
|
||||||
logger.Successf("ClusterRole/%s deleted %s", r.Name, dryRunStr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
var list rbacv1.ClusterRoleBindingList
|
|
||||||
if err := kubeClient.List(ctx, &list, selector); err == nil {
|
|
||||||
for _, r := range list.Items {
|
|
||||||
if err := kubeClient.Delete(ctx, &r, opts); err != nil {
|
|
||||||
logger.Failuref("ClusterRoleBinding/%s deletion failed: %s", r.Name, err.Error())
|
|
||||||
} else {
|
|
||||||
logger.Successf("ClusterRoleBinding/%s deleted %s", r.Name, dryRunStr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func uninstallFinalizers(ctx context.Context, kubeClient client.Client, dryRun bool) {
|
|
||||||
opts, dryRunStr := getUpdateOptions(dryRun)
|
|
||||||
{
|
|
||||||
var list sourcev1.GitRepositoryList
|
|
||||||
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
|
||||||
for _, r := range list.Items {
|
|
||||||
r.Finalizers = []string{}
|
|
||||||
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
|
||||||
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
|
||||||
} else {
|
|
||||||
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
var list sourcev1.HelmRepositoryList
|
|
||||||
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
|
||||||
for _, r := range list.Items {
|
|
||||||
r.Finalizers = []string{}
|
|
||||||
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
|
||||||
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
|
||||||
} else {
|
|
||||||
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
var list sourcev1.HelmChartList
|
|
||||||
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
|
||||||
for _, r := range list.Items {
|
|
||||||
r.Finalizers = []string{}
|
|
||||||
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
|
||||||
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
|
||||||
} else {
|
|
||||||
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
var list sourcev1.BucketList
|
|
||||||
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
|
||||||
for _, r := range list.Items {
|
|
||||||
r.Finalizers = []string{}
|
|
||||||
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
|
||||||
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
|
||||||
} else {
|
|
||||||
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
var list kustomizev1.KustomizationList
|
|
||||||
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
|
||||||
for _, r := range list.Items {
|
|
||||||
r.Finalizers = []string{}
|
|
||||||
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
|
||||||
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
|
||||||
} else {
|
|
||||||
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
var list helmv2.HelmReleaseList
|
|
||||||
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
|
||||||
for _, r := range list.Items {
|
|
||||||
r.Finalizers = []string{}
|
|
||||||
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
|
||||||
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
|
||||||
} else {
|
|
||||||
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
var list imagev1.ImagePolicyList
|
|
||||||
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
|
||||||
for _, r := range list.Items {
|
|
||||||
r.Finalizers = []string{}
|
|
||||||
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
|
||||||
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
|
||||||
} else {
|
|
||||||
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
var list imagev1.ImageRepositoryList
|
|
||||||
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
|
||||||
for _, r := range list.Items {
|
|
||||||
r.Finalizers = []string{}
|
|
||||||
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
|
||||||
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
|
||||||
} else {
|
|
||||||
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
var list autov1.ImageUpdateAutomationList
|
|
||||||
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
|
||||||
for _, r := range list.Items {
|
|
||||||
r.Finalizers = []string{}
|
|
||||||
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
|
||||||
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
|
||||||
} else {
|
|
||||||
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func uninstallCustomResourceDefinitions(ctx context.Context, kubeClient client.Client, dryRun bool) {
|
|
||||||
opts, dryRunStr := getDeleteOptions(dryRun)
|
|
||||||
selector := client.MatchingLabels{manifestgen.PartOfLabelKey: manifestgen.PartOfLabelValue}
|
|
||||||
{
|
|
||||||
var list apiextensionsv1.CustomResourceDefinitionList
|
|
||||||
if err := kubeClient.List(ctx, &list, selector); err == nil {
|
|
||||||
for _, r := range list.Items {
|
|
||||||
if err := kubeClient.Delete(ctx, &r, opts); err != nil {
|
|
||||||
logger.Failuref("CustomResourceDefinition/%s deletion failed: %s", r.Name, err.Error())
|
|
||||||
} else {
|
|
||||||
logger.Successf("CustomResourceDefinition/%s deleted %s", r.Name, dryRunStr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func uninstallNamespace(ctx context.Context, kubeClient client.Client, namespace string, dryRun bool) {
|
|
||||||
opts, dryRunStr := getDeleteOptions(dryRun)
|
|
||||||
ns := corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: namespace}}
|
|
||||||
if err := kubeClient.Delete(ctx, &ns, opts); err != nil {
|
|
||||||
logger.Failuref("Namespace/%s deletion failed: %s", namespace, err.Error())
|
|
||||||
} else {
|
|
||||||
logger.Successf("Namespace/%s deleted %s", namespace, dryRunStr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func getDeleteOptions(dryRun bool) (*client.DeleteOptions, string) {
|
|
||||||
opts := &client.DeleteOptions{}
|
|
||||||
var dryRunStr string
|
|
||||||
if dryRun {
|
|
||||||
client.DryRunAll.ApplyToDelete(opts)
|
|
||||||
dryRunStr = "(dry run)"
|
|
||||||
}
|
|
||||||
|
|
||||||
return opts, dryRunStr
|
|
||||||
}
|
|
||||||
|
|
||||||
func getUpdateOptions(dryRun bool) (*client.UpdateOptions, string) {
|
|
||||||
opts := &client.UpdateOptions{}
|
|
||||||
var dryRunStr string
|
|
||||||
if dryRun {
|
|
||||||
client.DryRunAll.ApplyToUpdate(opts)
|
|
||||||
dryRunStr = "(dry run)"
|
|
||||||
}
|
|
||||||
|
|
||||||
return opts, dryRunStr
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
# individual rules
|
# individual rules
|
||||||
/core-concepts https://fluxcd.io/docs/concepts 301!
|
/core-concepts https://fluxcd.io/flux/concepts 301!
|
||||||
/contributing https://fluxcd.io/contributing 301!
|
/contributing https://fluxcd.io/contributing 301!
|
||||||
/install.sh https://fluxcd.io/install.sh 301!
|
/install.sh https://fluxcd.io/install.sh 301!
|
||||||
|
|
||||||
# refer to https://github.com/fluxcd/flux2/discussions/367
|
# refer to https://github.com/fluxcd/flux2/discussions/367
|
||||||
/dev-guides/* https://fluxcd.io/docs/gitops-toolkit/:splat 301!
|
/dev-guides/* https://fluxcd.io/flux/gitops-toolkit/:splat 301!
|
||||||
|
|
||||||
|
|
||||||
# this is how things looked in the navbar anyway..?
|
# this is how things looked in the navbar anyway..?
|
||||||
/guides/faq-migration https://fluxcd.io/docs/migration/faq-migration 301!
|
/guides/faq-migration https://fluxcd.io/flux/migration/faq-migration 301!
|
||||||
/guides/flux-v1-automation-migration https://fluxcd.io/docs/migration/flux-v1-automation-migration 301!
|
/guides/flux-v1-automation-migration https://fluxcd.io/flux/migration/flux-v1-automation-migration 301!
|
||||||
/guides/flux-v1-migration https://fluxcd.io/docs/migration/flux-v1-migration 301!
|
/guides/flux-v1-migration https://fluxcd.io/flux/migration/flux-v1-migration 301!
|
||||||
/guides/helm-operator-migration https://fluxcd.io/docs/migration/helm-operator-migration 301!
|
/guides/helm-operator-migration https://fluxcd.io/flux/migration/helm-operator-migration 301!
|
||||||
|
|
||||||
|
|
||||||
# catch all
|
# catch all
|
||||||
/* https://fluxcd.io/docs/:splat 301!
|
/* https://fluxcd.io/flux/:splat 301!
|
||||||
|
|||||||
126
go.mod
126
go.mod
@@ -4,59 +4,67 @@ go 1.18
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Masterminds/semver/v3 v3.1.1
|
github.com/Masterminds/semver/v3 v3.1.1
|
||||||
github.com/ProtonMail/go-crypto v0.0.0-20220824120805-4b6e5c587895
|
github.com/ProtonMail/go-crypto v0.0.0-20220930113650-c6815a8c17ad
|
||||||
github.com/cyphar/filepath-securejoin v0.2.3
|
github.com/cyphar/filepath-securejoin v0.2.3
|
||||||
github.com/fluxcd/go-git-providers v0.8.0
|
github.com/distribution/distribution/v3 v3.0.0-20221021092657-c47a966fded8
|
||||||
github.com/fluxcd/helm-controller/api v0.23.1
|
github.com/fluxcd/go-git-providers v0.9.0
|
||||||
github.com/fluxcd/image-automation-controller/api v0.24.2
|
github.com/fluxcd/helm-controller/api v0.26.0
|
||||||
github.com/fluxcd/image-reflector-controller/api v0.20.1
|
github.com/fluxcd/image-automation-controller/api v0.26.1
|
||||||
github.com/fluxcd/kustomize-controller/api v0.27.1
|
github.com/fluxcd/image-reflector-controller/api v0.22.1
|
||||||
github.com/fluxcd/notification-controller/api v0.25.2
|
github.com/fluxcd/kustomize-controller/api v0.30.0
|
||||||
github.com/fluxcd/pkg/apis/meta v0.15.0
|
github.com/fluxcd/notification-controller/api v0.28.0
|
||||||
github.com/fluxcd/pkg/kustomize v0.6.0
|
github.com/fluxcd/pkg/apis/meta v0.17.0
|
||||||
github.com/fluxcd/pkg/oci v0.7.0
|
github.com/fluxcd/pkg/kustomize v0.8.0
|
||||||
github.com/fluxcd/pkg/runtime v0.17.0
|
github.com/fluxcd/pkg/oci v0.14.0
|
||||||
|
github.com/fluxcd/pkg/runtime v0.22.0
|
||||||
github.com/fluxcd/pkg/sourceignore v0.2.0
|
github.com/fluxcd/pkg/sourceignore v0.2.0
|
||||||
github.com/fluxcd/pkg/ssa v0.18.0
|
github.com/fluxcd/pkg/ssa v0.21.0
|
||||||
github.com/fluxcd/pkg/ssh v0.6.0
|
github.com/fluxcd/pkg/ssh v0.6.0
|
||||||
github.com/fluxcd/pkg/untar v0.2.0
|
github.com/fluxcd/pkg/untar v0.2.0
|
||||||
github.com/fluxcd/pkg/version v0.2.0
|
github.com/fluxcd/pkg/version v0.2.0
|
||||||
github.com/fluxcd/source-controller/api v0.28.0
|
github.com/fluxcd/source-controller/api v0.31.0
|
||||||
github.com/go-git/go-git/v5 v5.4.2
|
github.com/go-git/go-git/v5 v5.4.2
|
||||||
github.com/gonvenience/bunt v1.3.4
|
github.com/gonvenience/bunt v1.3.4
|
||||||
github.com/gonvenience/ytbx v1.4.4
|
github.com/gonvenience/ytbx v1.4.4
|
||||||
github.com/google/go-cmp v0.5.8
|
github.com/google/go-cmp v0.5.9
|
||||||
github.com/google/go-containerregistry v0.11.0
|
github.com/google/go-containerregistry v0.12.0
|
||||||
github.com/hashicorp/go-multierror v1.1.1
|
github.com/hashicorp/go-multierror v1.1.1
|
||||||
github.com/homeport/dyff v1.5.5
|
github.com/homeport/dyff v1.5.6
|
||||||
github.com/lucasb-eyer/go-colorful v1.2.0
|
github.com/lucasb-eyer/go-colorful v1.2.0
|
||||||
github.com/manifoldco/promptui v0.9.0
|
github.com/manifoldco/promptui v0.9.0
|
||||||
github.com/mattn/go-shellwords v1.0.12
|
github.com/mattn/go-shellwords v1.0.12
|
||||||
github.com/olekukonko/tablewriter v0.0.5
|
github.com/olekukonko/tablewriter v0.0.5
|
||||||
github.com/onsi/gomega v1.20.1
|
github.com/onsi/gomega v1.22.1
|
||||||
github.com/spf13/cobra v1.5.0
|
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5
|
||||||
|
github.com/spf13/cobra v1.6.0
|
||||||
github.com/spf13/pflag v1.0.5
|
github.com/spf13/pflag v1.0.5
|
||||||
github.com/theckman/yacspin v0.13.12
|
github.com/theckman/yacspin v0.13.12
|
||||||
golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d
|
golang.org/x/crypto v0.1.0
|
||||||
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035
|
golang.org/x/term v0.1.0
|
||||||
k8s.io/api v0.25.0
|
k8s.io/api v0.25.3
|
||||||
k8s.io/apiextensions-apiserver v0.25.0
|
k8s.io/apiextensions-apiserver v0.25.3
|
||||||
k8s.io/apimachinery v0.25.0
|
k8s.io/apimachinery v0.25.3
|
||||||
k8s.io/cli-runtime v0.25.0
|
k8s.io/cli-runtime v0.25.3
|
||||||
k8s.io/client-go v0.25.0
|
k8s.io/client-go v0.25.3
|
||||||
k8s.io/kubectl v0.25.0
|
k8s.io/kubectl v0.25.3
|
||||||
sigs.k8s.io/cli-utils v0.33.0
|
sigs.k8s.io/cli-utils v0.33.0
|
||||||
sigs.k8s.io/controller-runtime v0.11.2
|
sigs.k8s.io/controller-runtime v0.13.0
|
||||||
sigs.k8s.io/kustomize/api v0.12.1
|
sigs.k8s.io/kustomize/api v0.12.1
|
||||||
sigs.k8s.io/kustomize/kyaml v0.13.9
|
sigs.k8s.io/kustomize/kyaml v0.13.9
|
||||||
sigs.k8s.io/yaml v1.3.0
|
sigs.k8s.io/yaml v1.3.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Fix CVE-2022-32149
|
||||||
|
replace golang.org/x/text => golang.org/x/text v0.4.0
|
||||||
|
|
||||||
// Fix CVE-2022-28948
|
// Fix CVE-2022-28948
|
||||||
replace gopkg.in/yaml.v3 => gopkg.in/yaml.v3 v3.0.1
|
replace gopkg.in/yaml.v3 => gopkg.in/yaml.v3 v3.0.1
|
||||||
|
|
||||||
require (
|
require (
|
||||||
cloud.google.com/go v0.99.0 // indirect
|
cloud.google.com/go v0.99.0 // indirect
|
||||||
|
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.3 // indirect
|
||||||
|
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 // indirect
|
||||||
|
github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect
|
||||||
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
|
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
|
||||||
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
|
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
|
||||||
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
|
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
|
||||||
@@ -64,31 +72,44 @@ require (
|
|||||||
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
|
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
|
||||||
github.com/Azure/go-autorest/logger v0.2.1 // indirect
|
github.com/Azure/go-autorest/logger v0.2.1 // indirect
|
||||||
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
|
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
|
||||||
|
github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect
|
||||||
github.com/BurntSushi/toml v1.0.0 // indirect
|
github.com/BurntSushi/toml v1.0.0 // indirect
|
||||||
github.com/MakeNowJust/heredoc v1.0.0 // indirect
|
github.com/MakeNowJust/heredoc v1.0.0 // indirect
|
||||||
github.com/Microsoft/go-winio v0.5.2 // indirect
|
github.com/Microsoft/go-winio v0.6.0 // indirect
|
||||||
|
github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d // indirect
|
||||||
github.com/acomagu/bufpipe v1.0.3 // indirect
|
github.com/acomagu/bufpipe v1.0.3 // indirect
|
||||||
|
github.com/aws/aws-sdk-go v1.44.105 // indirect
|
||||||
github.com/beorn7/perks v1.0.1 // indirect
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
|
github.com/bshuster-repo/logrus-logstash-hook v1.0.0 // indirect
|
||||||
|
github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd // indirect
|
||||||
|
github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b // indirect
|
||||||
|
github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0 // indirect
|
||||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||||
github.com/chai2010/gettext-go v1.0.2 // indirect
|
github.com/chai2010/gettext-go v1.0.2 // indirect
|
||||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
|
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
|
||||||
github.com/cloudflare/circl v1.1.0 // indirect
|
github.com/cloudflare/circl v1.1.0 // indirect
|
||||||
github.com/containerd/stargz-snapshotter/estargz v0.12.0 // indirect
|
github.com/containerd/stargz-snapshotter/estargz v0.12.1 // indirect
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
|
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/docker/cli v20.10.17+incompatible // indirect
|
github.com/docker/cli v20.10.20+incompatible // indirect
|
||||||
github.com/docker/distribution v2.8.1+incompatible // indirect
|
github.com/docker/distribution v2.8.1+incompatible // indirect
|
||||||
github.com/docker/docker v20.10.17+incompatible // indirect
|
github.com/docker/docker v20.10.20+incompatible // indirect
|
||||||
github.com/docker/docker-credential-helpers v0.6.4 // indirect
|
github.com/docker/docker-credential-helpers v0.7.0 // indirect
|
||||||
|
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
|
||||||
|
github.com/docker/go-metrics v0.0.1 // indirect
|
||||||
|
github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1 // indirect
|
||||||
github.com/drone/envsubst/v2 v2.0.0-20210730161058-179042472c46 // indirect
|
github.com/drone/envsubst/v2 v2.0.0-20210730161058-179042472c46 // indirect
|
||||||
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
|
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
|
||||||
github.com/emirpasic/gods v1.12.0 // indirect
|
github.com/emirpasic/gods v1.12.0 // indirect
|
||||||
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
|
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
|
||||||
|
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
|
||||||
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
|
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
|
||||||
github.com/fatih/color v1.13.0 // indirect
|
github.com/fatih/color v1.13.0 // indirect
|
||||||
|
github.com/felixge/httpsnoop v1.0.1 // indirect
|
||||||
github.com/fluxcd/pkg/apis/acl v0.1.0 // indirect
|
github.com/fluxcd/pkg/apis/acl v0.1.0 // indirect
|
||||||
github.com/fluxcd/pkg/apis/kustomize v0.5.0 // indirect
|
github.com/fluxcd/pkg/apis/kustomize v0.6.0 // indirect
|
||||||
github.com/fsnotify/fsnotify v1.5.1 // indirect
|
github.com/fluxcd/pkg/tar v0.2.0 // indirect
|
||||||
|
github.com/fsnotify/fsnotify v1.5.4 // indirect
|
||||||
github.com/go-errors/errors v1.0.1 // indirect
|
github.com/go-errors/errors v1.0.1 // indirect
|
||||||
github.com/go-git/gcfg v1.5.0 // indirect
|
github.com/go-git/gcfg v1.5.0 // indirect
|
||||||
github.com/go-git/go-billy/v5 v5.3.1 // indirect
|
github.com/go-git/go-billy/v5 v5.3.1 // indirect
|
||||||
@@ -97,31 +118,38 @@ require (
|
|||||||
github.com/go-openapi/jsonreference v0.20.0 // indirect
|
github.com/go-openapi/jsonreference v0.20.0 // indirect
|
||||||
github.com/go-openapi/swag v0.21.1 // indirect
|
github.com/go-openapi/swag v0.21.1 // indirect
|
||||||
github.com/gogo/protobuf v1.3.2 // indirect
|
github.com/gogo/protobuf v1.3.2 // indirect
|
||||||
|
github.com/golang-jwt/jwt v3.2.1+incompatible // indirect
|
||||||
github.com/golang-jwt/jwt/v4 v4.4.1 // indirect
|
github.com/golang-jwt/jwt/v4 v4.4.1 // indirect
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||||
github.com/golang/protobuf v1.5.2 // indirect
|
github.com/golang/protobuf v1.5.2 // indirect
|
||||||
|
github.com/gomodule/redigo v1.8.2 // indirect
|
||||||
github.com/gonvenience/neat v1.3.11 // indirect
|
github.com/gonvenience/neat v1.3.11 // indirect
|
||||||
github.com/gonvenience/term v1.0.2 // indirect
|
github.com/gonvenience/term v1.0.2 // indirect
|
||||||
github.com/gonvenience/text v1.0.7 // indirect
|
github.com/gonvenience/text v1.0.7 // indirect
|
||||||
github.com/gonvenience/wrap v1.1.2 // indirect
|
github.com/gonvenience/wrap v1.1.2 // indirect
|
||||||
github.com/google/btree v1.0.1 // indirect
|
github.com/google/btree v1.0.1 // indirect
|
||||||
github.com/google/gnostic v0.6.9 // indirect
|
github.com/google/gnostic v0.6.9 // indirect
|
||||||
github.com/google/go-github/v45 v45.2.0 // indirect
|
github.com/google/go-github/v47 v47.0.0 // indirect
|
||||||
github.com/google/go-querystring v1.1.0 // indirect
|
github.com/google/go-querystring v1.1.0 // indirect
|
||||||
github.com/google/gofuzz v1.2.0 // indirect
|
github.com/google/gofuzz v1.2.0 // indirect
|
||||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
||||||
github.com/google/uuid v1.3.0 // indirect
|
github.com/google/uuid v1.3.0 // indirect
|
||||||
|
github.com/gorilla/handlers v1.5.1 // indirect
|
||||||
|
github.com/gorilla/mux v1.8.0 // indirect
|
||||||
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
|
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
|
||||||
github.com/hashicorp/errwrap v1.0.0 // indirect
|
github.com/hashicorp/errwrap v1.0.0 // indirect
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||||
github.com/hashicorp/go-retryablehttp v0.7.1 // indirect
|
github.com/hashicorp/go-retryablehttp v0.7.1 // indirect
|
||||||
|
github.com/hashicorp/golang-lru v0.5.4 // indirect
|
||||||
github.com/imdario/mergo v0.3.12 // indirect
|
github.com/imdario/mergo v0.3.12 // indirect
|
||||||
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
github.com/inconshreveable/mousetrap v1.0.1 // indirect
|
||||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||||
|
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||||
github.com/josharian/intern v1.0.0 // indirect
|
github.com/josharian/intern v1.0.0 // indirect
|
||||||
github.com/json-iterator/go v1.1.12 // indirect
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
|
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
|
||||||
github.com/klauspost/compress v1.15.8 // indirect
|
github.com/klauspost/compress v1.15.11 // indirect
|
||||||
|
github.com/kylelemons/godebug v1.1.0 // indirect
|
||||||
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
|
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
|
||||||
github.com/mailru/easyjson v0.7.7 // indirect
|
github.com/mailru/easyjson v0.7.7 // indirect
|
||||||
github.com/mattn/go-ciede2000 v0.0.0-20170301095244-782e8c62fec3 // indirect
|
github.com/mattn/go-ciede2000 v0.0.0-20170301095244-782e8c62fec3 // indirect
|
||||||
@@ -140,8 +168,9 @@ require (
|
|||||||
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
|
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
|
||||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||||
github.com/opencontainers/go-digest v1.0.0 // indirect
|
github.com/opencontainers/go-digest v1.0.0 // indirect
|
||||||
github.com/opencontainers/image-spec v1.0.3-0.20220114050600-8b9d41f48198 // indirect
|
github.com/opencontainers/image-spec v1.1.0-rc2 // indirect
|
||||||
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
|
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
|
||||||
|
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/prometheus/client_golang v1.13.0 // indirect
|
github.com/prometheus/client_golang v1.13.0 // indirect
|
||||||
github.com/prometheus/client_model v0.2.0 // indirect
|
github.com/prometheus/client_model v0.2.0 // indirect
|
||||||
@@ -155,16 +184,21 @@ require (
|
|||||||
github.com/texttheater/golang-levenshtein v1.0.1 // indirect
|
github.com/texttheater/golang-levenshtein v1.0.1 // indirect
|
||||||
github.com/vbatts/tar-split v0.11.2 // indirect
|
github.com/vbatts/tar-split v0.11.2 // indirect
|
||||||
github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 // indirect
|
github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 // indirect
|
||||||
github.com/xanzy/go-gitlab v0.69.0 // indirect
|
github.com/xanzy/go-gitlab v0.73.1 // indirect
|
||||||
github.com/xanzy/ssh-agent v0.3.0 // indirect
|
github.com/xanzy/ssh-agent v0.3.0 // indirect
|
||||||
github.com/xlab/treeprint v1.1.0 // indirect
|
github.com/xlab/treeprint v1.1.0 // indirect
|
||||||
|
github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43 // indirect
|
||||||
|
github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50 // indirect
|
||||||
|
github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f // indirect
|
||||||
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
|
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
|
||||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
|
golang.org/x/mod v0.6.0 // indirect
|
||||||
golang.org/x/oauth2 v0.0.0-20220722155238-128564f6959c // indirect
|
golang.org/x/net v0.1.0 // indirect
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
|
golang.org/x/oauth2 v0.1.0 // indirect
|
||||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
|
golang.org/x/sync v0.1.0 // indirect
|
||||||
golang.org/x/text v0.3.7 // indirect
|
golang.org/x/sys v0.1.0 // indirect
|
||||||
|
golang.org/x/text v0.4.0 // indirect
|
||||||
golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect
|
golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect
|
||||||
|
golang.org/x/tools v0.1.12 // indirect
|
||||||
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
|
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
|
||||||
google.golang.org/appengine v1.6.7 // indirect
|
google.golang.org/appengine v1.6.7 // indirect
|
||||||
google.golang.org/protobuf v1.28.1 // indirect
|
google.golang.org/protobuf v1.28.1 // indirect
|
||||||
@@ -172,8 +206,8 @@ require (
|
|||||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
k8s.io/component-base v0.25.0 // indirect
|
k8s.io/component-base v0.25.3 // indirect
|
||||||
k8s.io/klog/v2 v2.70.1 // indirect
|
k8s.io/klog/v2 v2.80.1 // indirect
|
||||||
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
|
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
|
||||||
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
|
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
|
||||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
|
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/fluxcd/flux2/internal/utils"
|
"github.com/fluxcd/flux2/internal/utils"
|
||||||
|
"github.com/fluxcd/pkg/oci"
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -31,6 +32,13 @@ var supportedSourceOCIProviders = []string{
|
|||||||
sourcev1.GoogleOCIProvider,
|
sourcev1.GoogleOCIProvider,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sourceOCIProvidersToOCIProvider = map[string]oci.Provider{
|
||||||
|
sourcev1.GenericOCIProvider: oci.ProviderGeneric,
|
||||||
|
sourcev1.AmazonOCIProvider: oci.ProviderAWS,
|
||||||
|
sourcev1.AzureOCIProvider: oci.ProviderAzure,
|
||||||
|
sourcev1.GoogleOCIProvider: oci.ProviderGCP,
|
||||||
|
}
|
||||||
|
|
||||||
type SourceOCIProvider string
|
type SourceOCIProvider string
|
||||||
|
|
||||||
func (p *SourceOCIProvider) String() string {
|
func (p *SourceOCIProvider) String() string {
|
||||||
@@ -60,3 +68,12 @@ func (p *SourceOCIProvider) Description() string {
|
|||||||
strings.Join(supportedSourceOCIProviders, ", "),
|
strings.Join(supportedSourceOCIProviders, ", "),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *SourceOCIProvider) ToOCIProvider() (oci.Provider, error) {
|
||||||
|
value, ok := sourceOCIProvidersToOCIProvider[p.String()]
|
||||||
|
if !ok {
|
||||||
|
return 0, fmt.Errorf("no mapping between source OCI provider %s and OCI provider", p.String())
|
||||||
|
}
|
||||||
|
|
||||||
|
return value, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- https://github.com/fluxcd/helm-controller/releases/download/v0.23.1/helm-controller.crds.yaml
|
- https://github.com/fluxcd/helm-controller/releases/download/v0.26.0/helm-controller.crds.yaml
|
||||||
- https://github.com/fluxcd/helm-controller/releases/download/v0.23.1/helm-controller.deployment.yaml
|
- https://github.com/fluxcd/helm-controller/releases/download/v0.26.0/helm-controller.deployment.yaml
|
||||||
- account.yaml
|
- account.yaml
|
||||||
|
transformers:
|
||||||
|
- labels.yaml
|
||||||
patchesJson6902:
|
patchesJson6902:
|
||||||
- target:
|
- target:
|
||||||
group: apps
|
group: apps
|
||||||
|
|||||||
9
manifests/bases/helm-controller/labels.yaml
Normal file
9
manifests/bases/helm-controller/labels.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
apiVersion: builtin
|
||||||
|
kind: LabelTransformer
|
||||||
|
metadata:
|
||||||
|
name: labels
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/component: helm-controller
|
||||||
|
fieldSpecs:
|
||||||
|
- path: metadata/labels
|
||||||
|
create: true
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- https://github.com/fluxcd/image-automation-controller/releases/download/v0.24.2/image-automation-controller.crds.yaml
|
- https://github.com/fluxcd/image-automation-controller/releases/download/v0.26.1/image-automation-controller.crds.yaml
|
||||||
- https://github.com/fluxcd/image-automation-controller/releases/download/v0.24.2/image-automation-controller.deployment.yaml
|
- https://github.com/fluxcd/image-automation-controller/releases/download/v0.26.1/image-automation-controller.deployment.yaml
|
||||||
- account.yaml
|
- account.yaml
|
||||||
|
transformers:
|
||||||
|
- labels.yaml
|
||||||
patchesJson6902:
|
patchesJson6902:
|
||||||
- target:
|
- target:
|
||||||
group: apps
|
group: apps
|
||||||
|
|||||||
9
manifests/bases/image-automation-controller/labels.yaml
Normal file
9
manifests/bases/image-automation-controller/labels.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
apiVersion: builtin
|
||||||
|
kind: LabelTransformer
|
||||||
|
metadata:
|
||||||
|
name: labels
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/component: image-automation-controller
|
||||||
|
fieldSpecs:
|
||||||
|
- path: metadata/labels
|
||||||
|
create: true
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- https://github.com/fluxcd/image-reflector-controller/releases/download/v0.20.1/image-reflector-controller.crds.yaml
|
- https://github.com/fluxcd/image-reflector-controller/releases/download/v0.22.1/image-reflector-controller.crds.yaml
|
||||||
- https://github.com/fluxcd/image-reflector-controller/releases/download/v0.20.1/image-reflector-controller.deployment.yaml
|
- https://github.com/fluxcd/image-reflector-controller/releases/download/v0.22.1/image-reflector-controller.deployment.yaml
|
||||||
- account.yaml
|
- account.yaml
|
||||||
|
transformers:
|
||||||
|
- labels.yaml
|
||||||
patchesJson6902:
|
patchesJson6902:
|
||||||
- target:
|
- target:
|
||||||
group: apps
|
group: apps
|
||||||
|
|||||||
9
manifests/bases/image-reflector-controller/labels.yaml
Normal file
9
manifests/bases/image-reflector-controller/labels.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
apiVersion: builtin
|
||||||
|
kind: LabelTransformer
|
||||||
|
metadata:
|
||||||
|
name: labels
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/component: image-reflector-controller
|
||||||
|
fieldSpecs:
|
||||||
|
- path: metadata/labels
|
||||||
|
create: true
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- https://github.com/fluxcd/kustomize-controller/releases/download/v0.27.1/kustomize-controller.crds.yaml
|
- https://github.com/fluxcd/kustomize-controller/releases/download/v0.30.0/kustomize-controller.crds.yaml
|
||||||
- https://github.com/fluxcd/kustomize-controller/releases/download/v0.27.1/kustomize-controller.deployment.yaml
|
- https://github.com/fluxcd/kustomize-controller/releases/download/v0.30.0/kustomize-controller.deployment.yaml
|
||||||
- account.yaml
|
- account.yaml
|
||||||
|
transformers:
|
||||||
|
- labels.yaml
|
||||||
patchesJson6902:
|
patchesJson6902:
|
||||||
- target:
|
- target:
|
||||||
group: apps
|
group: apps
|
||||||
@@ -11,4 +13,3 @@ patchesJson6902:
|
|||||||
kind: Deployment
|
kind: Deployment
|
||||||
name: kustomize-controller
|
name: kustomize-controller
|
||||||
path: patch.yaml
|
path: patch.yaml
|
||||||
|
|
||||||
|
|||||||
9
manifests/bases/kustomize-controller/labels.yaml
Normal file
9
manifests/bases/kustomize-controller/labels.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
apiVersion: builtin
|
||||||
|
kind: LabelTransformer
|
||||||
|
metadata:
|
||||||
|
name: labels
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/component: kustomize-controller
|
||||||
|
fieldSpecs:
|
||||||
|
- path: metadata/labels
|
||||||
|
create: true
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- https://github.com/fluxcd/notification-controller/releases/download/v0.25.2/notification-controller.crds.yaml
|
- https://github.com/fluxcd/notification-controller/releases/download/v0.28.0/notification-controller.crds.yaml
|
||||||
- https://github.com/fluxcd/notification-controller/releases/download/v0.25.2/notification-controller.deployment.yaml
|
- https://github.com/fluxcd/notification-controller/releases/download/v0.28.0/notification-controller.deployment.yaml
|
||||||
- account.yaml
|
- account.yaml
|
||||||
|
transformers:
|
||||||
|
- labels.yaml
|
||||||
patchesJson6902:
|
patchesJson6902:
|
||||||
- target:
|
- target:
|
||||||
group: apps
|
group: apps
|
||||||
|
|||||||
9
manifests/bases/notification-controller/labels.yaml
Normal file
9
manifests/bases/notification-controller/labels.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
apiVersion: builtin
|
||||||
|
kind: LabelTransformer
|
||||||
|
metadata:
|
||||||
|
name: labels
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/component: notification-controller
|
||||||
|
fieldSpecs:
|
||||||
|
- path: metadata/labels
|
||||||
|
create: true
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- https://github.com/fluxcd/source-controller/releases/download/v0.28.0/source-controller.crds.yaml
|
- https://github.com/fluxcd/source-controller/releases/download/v0.31.0/source-controller.crds.yaml
|
||||||
- https://github.com/fluxcd/source-controller/releases/download/v0.28.0/source-controller.deployment.yaml
|
- https://github.com/fluxcd/source-controller/releases/download/v0.31.0/source-controller.deployment.yaml
|
||||||
- account.yaml
|
- account.yaml
|
||||||
|
transformers:
|
||||||
|
- labels.yaml
|
||||||
patchesJson6902:
|
patchesJson6902:
|
||||||
- target:
|
- target:
|
||||||
group: apps
|
group: apps
|
||||||
@@ -11,4 +13,3 @@ patchesJson6902:
|
|||||||
kind: Deployment
|
kind: Deployment
|
||||||
name: source-controller
|
name: source-controller
|
||||||
path: patch.yaml
|
path: patch.yaml
|
||||||
|
|
||||||
|
|||||||
9
manifests/bases/source-controller/labels.yaml
Normal file
9
manifests/bases/source-controller/labels.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
apiVersion: builtin
|
||||||
|
kind: LabelTransformer
|
||||||
|
metadata:
|
||||||
|
name: labels
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/component: source-controller
|
||||||
|
fieldSpecs:
|
||||||
|
- path: metadata/labels
|
||||||
|
create: true
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- https://github.com/fluxcd/source-controller/releases/download/v0.28.0/source-controller.crds.yaml
|
- https://github.com/fluxcd/source-controller/releases/download/v0.31.0/source-controller.crds.yaml
|
||||||
- https://github.com/fluxcd/kustomize-controller/releases/download/v0.27.1/kustomize-controller.crds.yaml
|
- https://github.com/fluxcd/kustomize-controller/releases/download/v0.30.0/kustomize-controller.crds.yaml
|
||||||
- https://github.com/fluxcd/helm-controller/releases/download/v0.23.1/helm-controller.crds.yaml
|
- https://github.com/fluxcd/helm-controller/releases/download/v0.26.0/helm-controller.crds.yaml
|
||||||
- https://github.com/fluxcd/notification-controller/releases/download/v0.25.2/notification-controller.crds.yaml
|
- https://github.com/fluxcd/notification-controller/releases/download/v0.28.0/notification-controller.crds.yaml
|
||||||
- https://github.com/fluxcd/image-reflector-controller/releases/download/v0.20.1/image-reflector-controller.crds.yaml
|
- https://github.com/fluxcd/image-reflector-controller/releases/download/v0.22.1/image-reflector-controller.crds.yaml
|
||||||
- https://github.com/fluxcd/image-automation-controller/releases/download/v0.24.2/image-automation-controller.crds.yaml
|
- https://github.com/fluxcd/image-automation-controller/releases/download/v0.26.1/image-automation-controller.crds.yaml
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ metadata:
|
|||||||
type: Opaque
|
type: Opaque
|
||||||
# This is just a example secret, you should never store secrets in git.
|
# This is just a example secret, you should never store secrets in git.
|
||||||
# One way forward can be to use sealed-secrets or SOPS
|
# One way forward can be to use sealed-secrets or SOPS
|
||||||
# https://fluxcd.io/docs/guides/sealed-secrets/
|
# https://fluxcd.io/flux/guides/sealed-secrets/
|
||||||
# https://fluxcd.io/docs/guides/mozilla-sops/
|
# https://fluxcd.io/flux/guides/mozilla-sops/
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ metadata:
|
|||||||
## If not using IRSA, set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables
|
## If not using IRSA, set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables
|
||||||
## Store these values in a Secret and load them in the container using envFrom.
|
## Store these values in a Secret and load them in the container using envFrom.
|
||||||
## For managing this secret via GitOps, consider using SOPS or SealedSecrets and add that manifest in a resource file for this kustomize build.
|
## For managing this secret via GitOps, consider using SOPS or SealedSecrets and add that manifest in a resource file for this kustomize build.
|
||||||
## https://fluxcd.io/docs/guides/mozilla-sops/
|
## https://fluxcd.io/flux/guides/mozilla-sops/
|
||||||
## https://fluxcd.io/docs/guides/sealed-secrets/
|
## https://fluxcd.io/flux/guides/sealed-secrets/
|
||||||
# ---
|
# ---
|
||||||
# apiVersion: apps/v1
|
# apiVersion: apps/v1
|
||||||
# kind: Deployment
|
# kind: Deployment
|
||||||
|
|||||||
@@ -548,7 +548,7 @@
|
|||||||
"steppedLine": false,
|
"steppedLine": false,
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"expr": "rate(go_memstats_alloc_bytes_total{namespace=\"$namespace\",pod=~\".*-controller-.*\"}[1m])",
|
"expr": "sum(container_memory_working_set_bytes{namespace=\"$namespace\",container!=\"POD\",container!=\"\",pod=~\".*-controller-.*\"}) by (pod)",
|
||||||
"hide": false,
|
"hide": false,
|
||||||
"interval": "",
|
"interval": "",
|
||||||
"legendFormat": "{{pod}}",
|
"legendFormat": "{{pod}}",
|
||||||
|
|||||||
@@ -23,3 +23,8 @@ spec:
|
|||||||
- image-reflector-controller
|
- image-reflector-controller
|
||||||
podMetricsEndpoints:
|
podMetricsEndpoints:
|
||||||
- port: http-prom
|
- port: http-prom
|
||||||
|
relabelings:
|
||||||
|
# https://github.com/prometheus-operator/prometheus-operator/issues/4816
|
||||||
|
- sourceLabels: [__meta_kubernetes_pod_phase]
|
||||||
|
action: keep
|
||||||
|
regex: Running
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ import (
|
|||||||
"github.com/fluxcd/pkg/kustomize/filesys"
|
"github.com/fluxcd/pkg/kustomize/filesys"
|
||||||
runclient "github.com/fluxcd/pkg/runtime/client"
|
runclient "github.com/fluxcd/pkg/runtime/client"
|
||||||
|
|
||||||
"github.com/fluxcd/flux2/internal/bootstrap/git"
|
|
||||||
"github.com/fluxcd/flux2/internal/utils"
|
"github.com/fluxcd/flux2/internal/utils"
|
||||||
|
"github.com/fluxcd/flux2/pkg/bootstrap/git"
|
||||||
"github.com/fluxcd/flux2/pkg/log"
|
"github.com/fluxcd/flux2/pkg/log"
|
||||||
"github.com/fluxcd/flux2/pkg/manifestgen/install"
|
"github.com/fluxcd/flux2/pkg/manifestgen/install"
|
||||||
"github.com/fluxcd/flux2/pkg/manifestgen/kustomization"
|
"github.com/fluxcd/flux2/pkg/manifestgen/kustomization"
|
||||||
@@ -29,8 +29,8 @@ import (
|
|||||||
|
|
||||||
"github.com/fluxcd/go-git-providers/gitprovider"
|
"github.com/fluxcd/go-git-providers/gitprovider"
|
||||||
|
|
||||||
"github.com/fluxcd/flux2/internal/bootstrap/git"
|
"github.com/fluxcd/flux2/pkg/bootstrap/git"
|
||||||
"github.com/fluxcd/flux2/internal/bootstrap/provider"
|
"github.com/fluxcd/flux2/pkg/bootstrap/provider"
|
||||||
"github.com/fluxcd/flux2/pkg/manifestgen/sourcesecret"
|
"github.com/fluxcd/flux2/pkg/manifestgen/sourcesecret"
|
||||||
"github.com/fluxcd/flux2/pkg/manifestgen/sync"
|
"github.com/fluxcd/flux2/pkg/manifestgen/sync"
|
||||||
)
|
)
|
||||||
@@ -298,11 +298,8 @@ func (b *GitProviderBootstrapper) reconcileOrgRepository(ctx context.Context) (g
|
|||||||
|
|
||||||
var changed bool
|
var changed bool
|
||||||
if b.reconcile {
|
if b.reconcile {
|
||||||
// Set default branch before calling Reconcile due to bug described
|
|
||||||
// above.
|
|
||||||
repoInfo.DefaultBranch = repo.Get().DefaultBranch
|
|
||||||
if err = retry(1, 2*time.Second, func() (err error) {
|
if err = retry(1, 2*time.Second, func() (err error) {
|
||||||
repo, changed, err = b.provider.OrgRepositories().Reconcile(ctx, repoRef, repoInfo)
|
changed, err = repo.Reconcile(ctx)
|
||||||
return
|
return
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return nil, fmt.Errorf("failed to reconcile Git repository %q: %w", repoRef.String(), err)
|
return nil, fmt.Errorf("failed to reconcile Git repository %q: %w", repoRef.String(), err)
|
||||||
@@ -373,12 +370,9 @@ func (b *GitProviderBootstrapper) reconcileUserRepository(ctx context.Context) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if b.reconcile {
|
if b.reconcile {
|
||||||
// Set default branch before calling Reconcile due to bug described
|
|
||||||
// above.
|
|
||||||
repoInfo.DefaultBranch = repo.Get().DefaultBranch
|
|
||||||
var changed bool
|
var changed bool
|
||||||
if err = retry(1, 2*time.Second, func() (err error) {
|
if err = retry(1, 2*time.Second, func() (err error) {
|
||||||
repo, changed, err = b.provider.UserRepositories().Reconcile(ctx, repoRef, repoInfo)
|
changed, err = repo.Reconcile(ctx)
|
||||||
return
|
return
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return nil, fmt.Errorf("failed to reconcile Git repository %q: %w", repoRef.String(), err)
|
return nil, fmt.Errorf("failed to reconcile Git repository %q: %w", repoRef.String(), err)
|
||||||
@@ -32,7 +32,7 @@ import (
|
|||||||
"github.com/go-git/go-git/v5/plumbing/object"
|
"github.com/go-git/go-git/v5/plumbing/object"
|
||||||
"github.com/go-git/go-git/v5/plumbing/transport"
|
"github.com/go-git/go-git/v5/plumbing/transport"
|
||||||
|
|
||||||
"github.com/fluxcd/flux2/internal/bootstrap/git"
|
"github.com/fluxcd/flux2/pkg/bootstrap/git"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GoGit struct {
|
type GoGit struct {
|
||||||
@@ -6,7 +6,7 @@ package gogit
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/fluxcd/flux2/internal/bootstrap/git"
|
"github.com/fluxcd/flux2/pkg/bootstrap/git"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetOpenPgpEntity(t *testing.T) {
|
func TestGetOpenPgpEntity(t *testing.T) {
|
||||||
@@ -21,7 +21,7 @@ import (
|
|||||||
|
|
||||||
runclient "github.com/fluxcd/pkg/runtime/client"
|
runclient "github.com/fluxcd/pkg/runtime/client"
|
||||||
|
|
||||||
"github.com/fluxcd/flux2/internal/bootstrap/git"
|
"github.com/fluxcd/flux2/pkg/bootstrap/git"
|
||||||
"github.com/fluxcd/flux2/pkg/log"
|
"github.com/fluxcd/flux2/pkg/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
31
pkg/log/nop.go
Normal file
31
pkg/log/nop.go
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2022 The Flux authors
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package log
|
||||||
|
|
||||||
|
type NopLogger struct{}
|
||||||
|
|
||||||
|
func (NopLogger) Actionf(format string, a ...interface{}) {}
|
||||||
|
|
||||||
|
func (NopLogger) Generatef(format string, a ...interface{}) {}
|
||||||
|
|
||||||
|
func (NopLogger) Waitingf(format string, a ...interface{}) {}
|
||||||
|
|
||||||
|
func (NopLogger) Successf(format string, a ...interface{}) {}
|
||||||
|
|
||||||
|
func (NopLogger) Warningf(format string, a ...interface{}) {}
|
||||||
|
|
||||||
|
func (NopLogger) Failuref(format string, a ...interface{}) {}
|
||||||
341
pkg/uninstall/uninstall.go
Normal file
341
pkg/uninstall/uninstall.go
Normal file
@@ -0,0 +1,341 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2022 The Flux authors
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package uninstall
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
appsv1 "k8s.io/api/apps/v1"
|
||||||
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
networkingv1 "k8s.io/api/networking/v1"
|
||||||
|
rbacv1 "k8s.io/api/rbac/v1"
|
||||||
|
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
|
|
||||||
|
"github.com/fluxcd/flux2/pkg/log"
|
||||||
|
"github.com/fluxcd/flux2/pkg/manifestgen"
|
||||||
|
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
|
||||||
|
autov1 "github.com/fluxcd/image-automation-controller/api/v1beta1"
|
||||||
|
imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta1"
|
||||||
|
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
|
||||||
|
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
|
||||||
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Components removes all Kubernetes components that are part of Flux excluding the CRDs and namespace.
|
||||||
|
func Components(ctx context.Context, logger log.Logger, kubeClient client.Client, namespace string, dryRun bool) {
|
||||||
|
opts, dryRunStr := getDeleteOptions(dryRun)
|
||||||
|
selector := client.MatchingLabels{manifestgen.PartOfLabelKey: manifestgen.PartOfLabelValue}
|
||||||
|
{
|
||||||
|
var list appsv1.DeploymentList
|
||||||
|
if err := kubeClient.List(ctx, &list, client.InNamespace(namespace), selector); err == nil {
|
||||||
|
for _, r := range list.Items {
|
||||||
|
if err := kubeClient.Delete(ctx, &r, opts); err != nil {
|
||||||
|
logger.Failuref("Deployment/%s/%s deletion failed: %s", r.Namespace, r.Name, err.Error())
|
||||||
|
} else {
|
||||||
|
logger.Successf("Deployment/%s/%s deleted %s", r.Namespace, r.Name, dryRunStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var list corev1.ServiceList
|
||||||
|
if err := kubeClient.List(ctx, &list, client.InNamespace(namespace), selector); err == nil {
|
||||||
|
for _, r := range list.Items {
|
||||||
|
if err := kubeClient.Delete(ctx, &r, opts); err != nil {
|
||||||
|
logger.Failuref("Service/%s/%s deletion failed: %s", r.Namespace, r.Name, err.Error())
|
||||||
|
} else {
|
||||||
|
logger.Successf("Service/%s/%s deleted %s", r.Namespace, r.Name, dryRunStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var list networkingv1.NetworkPolicyList
|
||||||
|
if err := kubeClient.List(ctx, &list, client.InNamespace(namespace), selector); err == nil {
|
||||||
|
for _, r := range list.Items {
|
||||||
|
if err := kubeClient.Delete(ctx, &r, opts); err != nil {
|
||||||
|
logger.Failuref("NetworkPolicy/%s/%s deletion failed: %s", r.Namespace, r.Name, err.Error())
|
||||||
|
} else {
|
||||||
|
logger.Successf("NetworkPolicy/%s/%s deleted %s", r.Namespace, r.Name, dryRunStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var list corev1.ServiceAccountList
|
||||||
|
if err := kubeClient.List(ctx, &list, client.InNamespace(namespace), selector); err == nil {
|
||||||
|
for _, r := range list.Items {
|
||||||
|
if err := kubeClient.Delete(ctx, &r, opts); err != nil {
|
||||||
|
logger.Failuref("ServiceAccount/%s/%s deletion failed: %s", r.Namespace, r.Name, err.Error())
|
||||||
|
} else {
|
||||||
|
logger.Successf("ServiceAccount/%s/%s deleted %s", r.Namespace, r.Name, dryRunStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var list rbacv1.ClusterRoleList
|
||||||
|
if err := kubeClient.List(ctx, &list, selector); err == nil {
|
||||||
|
for _, r := range list.Items {
|
||||||
|
if err := kubeClient.Delete(ctx, &r, opts); err != nil {
|
||||||
|
logger.Failuref("ClusterRole/%s deletion failed: %s", r.Name, err.Error())
|
||||||
|
} else {
|
||||||
|
logger.Successf("ClusterRole/%s deleted %s", r.Name, dryRunStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var list rbacv1.ClusterRoleBindingList
|
||||||
|
if err := kubeClient.List(ctx, &list, selector); err == nil {
|
||||||
|
for _, r := range list.Items {
|
||||||
|
if err := kubeClient.Delete(ctx, &r, opts); err != nil {
|
||||||
|
logger.Failuref("ClusterRoleBinding/%s deletion failed: %s", r.Name, err.Error())
|
||||||
|
} else {
|
||||||
|
logger.Successf("ClusterRoleBinding/%s deleted %s", r.Name, dryRunStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Finalizers removes all finalizes on Kubernetes components that have been added by a Flux controller.
|
||||||
|
func Finalizers(ctx context.Context, logger log.Logger, kubeClient client.Client, dryRun bool) {
|
||||||
|
opts, dryRunStr := getUpdateOptions(dryRun)
|
||||||
|
{
|
||||||
|
var list sourcev1.GitRepositoryList
|
||||||
|
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
||||||
|
for _, r := range list.Items {
|
||||||
|
r.Finalizers = []string{}
|
||||||
|
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
||||||
|
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
||||||
|
} else {
|
||||||
|
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var list sourcev1.OCIRepositoryList
|
||||||
|
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
||||||
|
for _, r := range list.Items {
|
||||||
|
r.Finalizers = []string{}
|
||||||
|
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
||||||
|
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
||||||
|
} else {
|
||||||
|
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var list sourcev1.HelmRepositoryList
|
||||||
|
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
||||||
|
for _, r := range list.Items {
|
||||||
|
r.Finalizers = []string{}
|
||||||
|
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
||||||
|
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
||||||
|
} else {
|
||||||
|
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var list sourcev1.HelmChartList
|
||||||
|
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
||||||
|
for _, r := range list.Items {
|
||||||
|
r.Finalizers = []string{}
|
||||||
|
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
||||||
|
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
||||||
|
} else {
|
||||||
|
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var list sourcev1.BucketList
|
||||||
|
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
||||||
|
for _, r := range list.Items {
|
||||||
|
r.Finalizers = []string{}
|
||||||
|
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
||||||
|
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
||||||
|
} else {
|
||||||
|
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var list kustomizev1.KustomizationList
|
||||||
|
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
||||||
|
for _, r := range list.Items {
|
||||||
|
r.Finalizers = []string{}
|
||||||
|
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
||||||
|
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
||||||
|
} else {
|
||||||
|
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var list helmv2.HelmReleaseList
|
||||||
|
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
||||||
|
for _, r := range list.Items {
|
||||||
|
r.Finalizers = []string{}
|
||||||
|
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
||||||
|
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
||||||
|
} else {
|
||||||
|
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var list notificationv1.AlertList
|
||||||
|
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
||||||
|
for _, r := range list.Items {
|
||||||
|
r.Finalizers = []string{}
|
||||||
|
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
||||||
|
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
||||||
|
} else {
|
||||||
|
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var list notificationv1.ProviderList
|
||||||
|
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
||||||
|
for _, r := range list.Items {
|
||||||
|
r.Finalizers = []string{}
|
||||||
|
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
||||||
|
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
||||||
|
} else {
|
||||||
|
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var list notificationv1.ReceiverList
|
||||||
|
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
||||||
|
for _, r := range list.Items {
|
||||||
|
r.Finalizers = []string{}
|
||||||
|
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
||||||
|
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
||||||
|
} else {
|
||||||
|
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var list imagev1.ImagePolicyList
|
||||||
|
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
||||||
|
for _, r := range list.Items {
|
||||||
|
r.Finalizers = []string{}
|
||||||
|
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
||||||
|
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
||||||
|
} else {
|
||||||
|
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var list imagev1.ImageRepositoryList
|
||||||
|
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
||||||
|
for _, r := range list.Items {
|
||||||
|
r.Finalizers = []string{}
|
||||||
|
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
||||||
|
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
||||||
|
} else {
|
||||||
|
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var list autov1.ImageUpdateAutomationList
|
||||||
|
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
||||||
|
for _, r := range list.Items {
|
||||||
|
r.Finalizers = []string{}
|
||||||
|
if err := kubeClient.Update(ctx, &r, opts); err != nil {
|
||||||
|
logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error())
|
||||||
|
} else {
|
||||||
|
logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CustomResourceDefinitions removes all Kubernetes CRDs that are a part of Flux.
|
||||||
|
func CustomResourceDefinitions(ctx context.Context, logger log.Logger, kubeClient client.Client, dryRun bool) {
|
||||||
|
opts, dryRunStr := getDeleteOptions(dryRun)
|
||||||
|
selector := client.MatchingLabels{manifestgen.PartOfLabelKey: manifestgen.PartOfLabelValue}
|
||||||
|
{
|
||||||
|
var list apiextensionsv1.CustomResourceDefinitionList
|
||||||
|
if err := kubeClient.List(ctx, &list, selector); err == nil {
|
||||||
|
for _, r := range list.Items {
|
||||||
|
if err := kubeClient.Delete(ctx, &r, opts); err != nil {
|
||||||
|
logger.Failuref("CustomResourceDefinition/%s deletion failed: %s", r.Name, err.Error())
|
||||||
|
} else {
|
||||||
|
logger.Successf("CustomResourceDefinition/%s deleted %s", r.Name, dryRunStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Namespace removes the namespace Flux is installed in.
|
||||||
|
func Namespace(ctx context.Context, logger log.Logger, kubeClient client.Client, namespace string, dryRun bool) {
|
||||||
|
opts, dryRunStr := getDeleteOptions(dryRun)
|
||||||
|
ns := corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: namespace}}
|
||||||
|
if err := kubeClient.Delete(ctx, &ns, opts); err != nil {
|
||||||
|
logger.Failuref("Namespace/%s deletion failed: %s", namespace, err.Error())
|
||||||
|
} else {
|
||||||
|
logger.Successf("Namespace/%s deleted %s", namespace, dryRunStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func getDeleteOptions(dryRun bool) (*client.DeleteOptions, string) {
|
||||||
|
opts := &client.DeleteOptions{}
|
||||||
|
var dryRunStr string
|
||||||
|
if dryRun {
|
||||||
|
client.DryRunAll.ApplyToDelete(opts)
|
||||||
|
dryRunStr = "(dry run)"
|
||||||
|
}
|
||||||
|
|
||||||
|
return opts, dryRunStr
|
||||||
|
}
|
||||||
|
|
||||||
|
func getUpdateOptions(dryRun bool) (*client.UpdateOptions, string) {
|
||||||
|
opts := &client.UpdateOptions{}
|
||||||
|
var dryRunStr string
|
||||||
|
if dryRun {
|
||||||
|
client.DryRunAll.ApplyToUpdate(opts)
|
||||||
|
dryRunStr = "(dry run)"
|
||||||
|
}
|
||||||
|
|
||||||
|
return opts, dryRunStr
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
**Creation date:** 2022-03-30
|
**Creation date:** 2022-03-30
|
||||||
|
|
||||||
**Last update:** 2022-08-24
|
**Last update:** 2022-10-20
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
@@ -22,6 +22,7 @@ they do today for container images.
|
|||||||
### Goals
|
### Goals
|
||||||
|
|
||||||
- Add support for fetching Helm charts stored as OCI artifacts with minimal API changes to Flux.
|
- Add support for fetching Helm charts stored as OCI artifacts with minimal API changes to Flux.
|
||||||
|
- Add support for verifying the authenticity of Helm OCI charts signed with Cosign.
|
||||||
- Make it easy for users to switch from [HTTP/S Helm repositories](https://github.com/helm/helm-www/blob/416fabea6ffab8dc156b6a0c5eb5e8df5f5ef7dc/content/en/docs/topics/chart_repository.md)
|
- Make it easy for users to switch from [HTTP/S Helm repositories](https://github.com/helm/helm-www/blob/416fabea6ffab8dc156b6a0c5eb5e8df5f5ef7dc/content/en/docs/topics/chart_repository.md)
|
||||||
to OCI repositories.
|
to OCI repositories.
|
||||||
|
|
||||||
@@ -37,10 +38,9 @@ When the `spec.type` field is set to `oci`, the `spec.url` field must be prefixe
|
|||||||
For `oci://` URLs, source-controller will use the Helm SDK and the `oras` library to connect to the OCI remote storage.
|
For `oci://` URLs, source-controller will use the Helm SDK and the `oras` library to connect to the OCI remote storage.
|
||||||
|
|
||||||
Introduce an optional field called `provider` for
|
Introduce an optional field called `provider` for
|
||||||
[context-based authorization](https://fluxcd.io/docs/security/contextual-authorization/)
|
[context-based authorization](https://fluxcd.io/flux/security/contextual-authorization/)
|
||||||
to AWS, Azure and Google Cloud. The `spec.provider` is ignored when `spec.type` is set to `default`.
|
to AWS, Azure and Google Cloud. The `spec.provider` is ignored when `spec.type` is set to `default`.
|
||||||
|
|
||||||
|
|
||||||
### Pull charts from private repositories
|
### Pull charts from private repositories
|
||||||
|
|
||||||
#### Basic auth
|
#### Basic auth
|
||||||
@@ -92,6 +92,51 @@ controller will use a specific cloud SDK for authentication purposes.
|
|||||||
If both `spec.secretRef` and a non-generic provider are present in the definition,
|
If both `spec.secretRef` and a non-generic provider are present in the definition,
|
||||||
the controller will use the static credentials from the referenced secret.
|
the controller will use the static credentials from the referenced secret.
|
||||||
|
|
||||||
|
### Verify Helm charts
|
||||||
|
|
||||||
|
To verify the authenticity of the Helm OCI charts, Flux will use the Sigstore Go SDK and implement verification
|
||||||
|
for artifacts which were either signed with keys generated by Cosign or signed using the Cosign
|
||||||
|
[keyless method](https://github.com/sigstore/cosign/blob/main/KEYLESS.md).
|
||||||
|
|
||||||
|
To enable signature verification, the Cosign public keys can be supplied with:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: source.toolkit.fluxcd.io/v1beta2
|
||||||
|
kind: HelmChart
|
||||||
|
metadata:
|
||||||
|
name: <chart-name>
|
||||||
|
spec:
|
||||||
|
verify:
|
||||||
|
provider: cosign
|
||||||
|
secretRef:
|
||||||
|
name: cosign-public-keys
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that the Kubernetes secret containing the Cosign public keys, must use `.pub` extension:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: cosign-public-keys
|
||||||
|
type: Opaque
|
||||||
|
stringData:
|
||||||
|
key1.pub: <pub-key-1>
|
||||||
|
key2.pub: <pub-key-2>
|
||||||
|
```
|
||||||
|
|
||||||
|
For verifying public Helm charts which are signed using the keyless method,
|
||||||
|
the `spec.verify.secretRef` field must be omitted:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
spec:
|
||||||
|
verify:
|
||||||
|
provider: cosign
|
||||||
|
```
|
||||||
|
|
||||||
|
When using the keyless method, Flux will verify the signatures in the Rekor
|
||||||
|
transparency log instance hosted at [rekor.sigstore.dev](https://rekor.sigstore.dev/).
|
||||||
|
|
||||||
### User Stories
|
### User Stories
|
||||||
|
|
||||||
#### Story 1
|
#### Story 1
|
||||||
@@ -230,8 +275,9 @@ The feature is enabled by default.
|
|||||||
* **2022-05-19** Partially implemented by [source-controller#690](https://github.com/fluxcd/source-controller/pull/690)
|
* **2022-05-19** Partially implemented by [source-controller#690](https://github.com/fluxcd/source-controller/pull/690)
|
||||||
* **2022-06-06** First implementation released with [flux2 v0.31.0](https://github.com/fluxcd/flux2/releases/tag/v0.31.0)
|
* **2022-06-06** First implementation released with [flux2 v0.31.0](https://github.com/fluxcd/flux2/releases/tag/v0.31.0)
|
||||||
* **2022-08-11** Resolve chart dependencies from OCI released with [flux2 v0.32.0](https://github.com/fluxcd/flux2/releases/tag/v0.32.0)
|
* **2022-08-11** Resolve chart dependencies from OCI released with [flux2 v0.32.0](https://github.com/fluxcd/flux2/releases/tag/v0.32.0)
|
||||||
|
* **2022-08-29** Contextual login for AWS, Azure and GCP released with [flux2 v0.33.0](https://github.com/fluxcd/flux2/releases/tag/v0.33.0)
|
||||||
|
* **2022-10-21** Verifying Helm charts with Cosign released with [flux2 v0.36.0](https://github.com/fluxcd/flux2/releases/tag/v0.36.0)
|
||||||
|
|
||||||
### TODOs
|
### TODOs
|
||||||
|
|
||||||
* [Add support for container registries with self-signed TLS certs](https://github.com/fluxcd/source-controller/issues/723)
|
* [Add support for container registries with self-signed TLS certs](https://github.com/fluxcd/source-controller/issues/723)
|
||||||
* [Enable contextual login in OCI HelmRepository](https://github.com/fluxcd/source-controller/pull/873)
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
# RFC-0003 Flux OCI support for Kubernetes manifests
|
# RFC-0003 Flux OCI support for Kubernetes manifests
|
||||||
|
|
||||||
**Status:** implemented (partially)
|
**Status:** implemented
|
||||||
|
|
||||||
**Creation date:** 2022-03-31
|
**Creation date:** 2022-03-31
|
||||||
|
|
||||||
**Last update:** 2022-08-22
|
**Last update:** 2022-09-29
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
@@ -124,16 +124,6 @@ spec:
|
|||||||
semver: "6.0.x"
|
semver: "6.0.x"
|
||||||
```
|
```
|
||||||
|
|
||||||
To verify the authenticity of an artifact, the Sigstore cosign public key can be supplied with:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
spec:
|
|
||||||
verify:
|
|
||||||
provider: cosign
|
|
||||||
secretRef:
|
|
||||||
name: cosign-key
|
|
||||||
```
|
|
||||||
|
|
||||||
### Layer selection
|
### Layer selection
|
||||||
|
|
||||||
By default, Flux assumes that the first layer of the OCI artifact contains the Kubernetes configuration.
|
By default, Flux assumes that the first layer of the OCI artifact contains the Kubernetes configuration.
|
||||||
@@ -224,6 +214,34 @@ controller will use a specific cloud SDK for authentication purposes. If both `s
|
|||||||
a non-generic provider are present in the definition, the controller will use the static credentials
|
a non-generic provider are present in the definition, the controller will use the static credentials
|
||||||
from the referenced secret.
|
from the referenced secret.
|
||||||
|
|
||||||
|
### Verify artifacts
|
||||||
|
|
||||||
|
To verify the authenticity of the OCI artifacts, Flux will use the Sigstore Go SDK and implement verification
|
||||||
|
for artifacts which were either signed with keys generated by Cosign or signed using the Cosign
|
||||||
|
[keyless method](https://github.com/sigstore/cosign/blob/main/KEYLESS.md).
|
||||||
|
|
||||||
|
To enable signature verification, the Cosign public key can be supplied with:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
spec:
|
||||||
|
verify:
|
||||||
|
provider: cosign
|
||||||
|
secretRef:
|
||||||
|
name: cosign-key
|
||||||
|
```
|
||||||
|
|
||||||
|
For verifying public artifacts which are signed using the keyless method,
|
||||||
|
the `spec.verify.secretRef` field must be omitted:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
spec:
|
||||||
|
verify:
|
||||||
|
provider: cosign
|
||||||
|
```
|
||||||
|
|
||||||
|
When using the keyless method, Flux will verify the signatures in the Rekor
|
||||||
|
transparency log instance hosted at [rekor.sigstore.dev](https://rekor.sigstore.dev/).
|
||||||
|
|
||||||
### Reconcile artifacts
|
### Reconcile artifacts
|
||||||
|
|
||||||
The `OCIRepository` can be used as a drop-in replacement for `GitRepository` and `Bucket` sources.
|
The `OCIRepository` can be used as a drop-in replacement for `GitRepository` and `Bucket` sources.
|
||||||
@@ -455,9 +473,6 @@ The feature is enabled by default.
|
|||||||
## Implementation History
|
## Implementation History
|
||||||
|
|
||||||
* **2022-08-08** Partially implemented by [source-controller#788](https://github.com/fluxcd/source-controller/pull/788)
|
* **2022-08-08** Partially implemented by [source-controller#788](https://github.com/fluxcd/source-controller/pull/788)
|
||||||
* **2022-06-06** First implementation released with [flux2 v0.32.0](https://github.com/fluxcd/flux2/releases/tag/v0.32.0)
|
* **2022-08-11** First implementation released with [flux2 v0.32.0](https://github.com/fluxcd/flux2/releases/tag/v0.32.0)
|
||||||
|
* **2022-08-29** Select layer by OCI media type released with [flux2 v0.33.0](https://github.com/fluxcd/flux2/releases/tag/v0.33.0)
|
||||||
### TODOs
|
* **2022-09-29** Verifying OCI artifacts with Cosign released with [flux2 v0.35.0](https://github.com/fluxcd/flux2/releases/tag/v0.35.0)
|
||||||
|
|
||||||
* [Add support for verifying the OCI artifacts with cosign](https://github.com/fluxcd/source-controller/issues/863)
|
|
||||||
* [Select layer by OCI media type](https://github.com/fluxcd/source-controller/pull/871)
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import (
|
|||||||
"github.com/hashicorp/hc-install/product"
|
"github.com/hashicorp/hc-install/product"
|
||||||
"github.com/hashicorp/hc-install/src"
|
"github.com/hashicorp/hc-install/src"
|
||||||
"github.com/hashicorp/terraform-exec/tfexec"
|
"github.com/hashicorp/terraform-exec/tfexec"
|
||||||
git2go "github.com/libgit2/git2go/v31"
|
git2go "github.com/libgit2/git2go/v33"
|
||||||
"github.com/microsoft/azure-devops-go-api/azuredevops"
|
"github.com/microsoft/azure-devops-go-api/azuredevops"
|
||||||
"github.com/microsoft/azure-devops-go-api/azuredevops/git"
|
"github.com/microsoft/azure-devops-go-api/azuredevops/git"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|||||||
@@ -1,43 +1,43 @@
|
|||||||
module github.com/fluxcd/flux2/tests/azure
|
module github.com/fluxcd/flux2/tests/azure
|
||||||
|
|
||||||
go 1.17
|
go 1.18
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Azure/azure-event-hubs-go/v3 v3.3.18
|
github.com/Azure/azure-event-hubs-go/v3 v3.3.18
|
||||||
github.com/fluxcd/helm-controller/api v0.22.1
|
github.com/fluxcd/helm-controller/api v0.26.0
|
||||||
github.com/fluxcd/image-automation-controller/api v0.23.2
|
github.com/fluxcd/image-automation-controller/api v0.26.1
|
||||||
github.com/fluxcd/image-reflector-controller/api v0.19.1
|
github.com/fluxcd/image-reflector-controller/api v0.22.1
|
||||||
github.com/fluxcd/kustomize-controller/api v0.26.1
|
github.com/fluxcd/kustomize-controller/api v0.30.0
|
||||||
github.com/fluxcd/notification-controller/api v0.24.0
|
github.com/fluxcd/notification-controller/api v0.28.0
|
||||||
github.com/fluxcd/pkg/apis/meta v0.14.2
|
github.com/fluxcd/pkg/apis/meta v0.17.0
|
||||||
github.com/fluxcd/pkg/runtime v0.16.2
|
github.com/fluxcd/pkg/runtime v0.22.0
|
||||||
github.com/fluxcd/source-controller/api v0.25.5
|
github.com/fluxcd/source-controller/api v0.31.0
|
||||||
github.com/hashicorp/hc-install v0.4.0
|
github.com/hashicorp/hc-install v0.4.0
|
||||||
github.com/hashicorp/terraform-exec v0.16.1
|
github.com/hashicorp/terraform-exec v0.17.3
|
||||||
github.com/libgit2/git2go/v31 v31.7.9
|
github.com/libgit2/git2go/v33 v33.0.9
|
||||||
github.com/microsoft/azure-devops-go-api/azuredevops v1.0.0-b5
|
github.com/microsoft/azure-devops-go-api/azuredevops v1.0.0-b5
|
||||||
github.com/stretchr/testify v1.7.1
|
github.com/stretchr/testify v1.8.0
|
||||||
github.com/whilp/git-urls v1.0.0
|
github.com/whilp/git-urls v1.0.0
|
||||||
go.uber.org/multierr v1.8.0
|
go.uber.org/multierr v1.8.0
|
||||||
k8s.io/api v0.24.1
|
k8s.io/api v0.25.3
|
||||||
k8s.io/apimachinery v0.24.1
|
k8s.io/apimachinery v0.25.3
|
||||||
k8s.io/client-go v0.24.1
|
k8s.io/client-go v0.25.3
|
||||||
sigs.k8s.io/controller-runtime v0.11.2
|
sigs.k8s.io/controller-runtime v0.13.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Fix CVE-2022-32149
|
||||||
|
replace golang.org/x/text => golang.org/x/text v0.4.0
|
||||||
|
|
||||||
// Fix CVE-2022-28948
|
// Fix CVE-2022-28948
|
||||||
replace gopkg.in/yaml.v3 => gopkg.in/yaml.v3 v3.0.1
|
replace gopkg.in/yaml.v3 => gopkg.in/yaml.v3 v3.0.1
|
||||||
|
|
||||||
// Fix CVE-2022-26945
|
|
||||||
replace github.com/hashicorp/go-getter => github.com/hashicorp/go-getter v1.6.1
|
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Azure/azure-amqp-common-go/v3 v3.2.3 // indirect
|
github.com/Azure/azure-amqp-common-go/v3 v3.2.3 // indirect
|
||||||
github.com/Azure/azure-sdk-for-go v51.1.0+incompatible // indirect
|
github.com/Azure/azure-sdk-for-go v51.1.0+incompatible // indirect
|
||||||
github.com/Azure/go-amqp v0.17.0 // indirect
|
github.com/Azure/go-amqp v0.17.0 // indirect
|
||||||
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
|
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
|
||||||
github.com/Azure/go-autorest/autorest v0.11.18 // indirect
|
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
|
||||||
github.com/Azure/go-autorest/autorest/adal v0.9.13 // indirect
|
github.com/Azure/go-autorest/autorest/adal v0.9.20 // indirect
|
||||||
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
|
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
|
||||||
github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect
|
github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect
|
||||||
github.com/Azure/go-autorest/autorest/validation v0.3.1 // indirect
|
github.com/Azure/go-autorest/autorest/validation v0.3.1 // indirect
|
||||||
@@ -49,30 +49,30 @@ require (
|
|||||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/devigned/tab v0.1.1 // indirect
|
github.com/devigned/tab v0.1.1 // indirect
|
||||||
github.com/emicklei/go-restful v2.9.5+incompatible // indirect
|
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
|
||||||
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
|
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
|
||||||
github.com/fluxcd/pkg/apis/acl v0.0.3 // indirect
|
github.com/fluxcd/pkg/apis/acl v0.1.0 // indirect
|
||||||
github.com/fluxcd/pkg/apis/kustomize v0.4.2 // indirect
|
github.com/fluxcd/pkg/apis/kustomize v0.6.0 // indirect
|
||||||
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
|
github.com/fsnotify/fsnotify v1.5.4 // indirect
|
||||||
github.com/fsnotify/fsnotify v1.5.1 // indirect
|
|
||||||
github.com/go-logr/logr v1.2.3 // indirect
|
github.com/go-logr/logr v1.2.3 // indirect
|
||||||
github.com/go-logr/zapr v1.2.0 // indirect
|
github.com/go-logr/zapr v1.2.3 // indirect
|
||||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||||
github.com/go-openapi/jsonreference v0.19.5 // indirect
|
github.com/go-openapi/jsonreference v0.19.5 // indirect
|
||||||
github.com/go-openapi/swag v0.19.14 // indirect
|
github.com/go-openapi/swag v0.19.14 // indirect
|
||||||
github.com/gogo/protobuf v1.3.2 // indirect
|
github.com/gogo/protobuf v1.3.2 // indirect
|
||||||
|
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||||
github.com/golang/protobuf v1.5.2 // indirect
|
github.com/golang/protobuf v1.5.2 // indirect
|
||||||
github.com/google/gnostic v0.5.7-v3refs // indirect
|
github.com/google/gnostic v0.5.7-v3refs // indirect
|
||||||
github.com/google/go-cmp v0.5.8 // indirect
|
github.com/google/go-cmp v0.5.9 // indirect
|
||||||
github.com/google/gofuzz v1.2.0 // indirect
|
github.com/google/gofuzz v1.2.0 // indirect
|
||||||
github.com/google/uuid v1.3.0 // indirect
|
github.com/google/uuid v1.3.0 // indirect
|
||||||
github.com/hashicorp/errwrap v1.0.0 // indirect
|
github.com/hashicorp/errwrap v1.0.0 // indirect
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||||
github.com/hashicorp/go-retryablehttp v0.7.1 // indirect
|
github.com/hashicorp/go-retryablehttp v0.7.1 // indirect
|
||||||
github.com/hashicorp/go-version v1.5.0 // indirect
|
github.com/hashicorp/go-version v1.6.0 // indirect
|
||||||
github.com/hashicorp/terraform-json v0.13.0 // indirect
|
github.com/hashicorp/terraform-json v0.14.0 // indirect
|
||||||
github.com/imdario/mergo v0.3.12 // indirect
|
github.com/imdario/mergo v0.3.12 // indirect
|
||||||
github.com/josharian/intern v1.0.0 // indirect
|
github.com/josharian/intern v1.0.0 // indirect
|
||||||
github.com/jpillora/backoff v1.0.0 // indirect
|
github.com/jpillora/backoff v1.0.0 // indirect
|
||||||
@@ -85,34 +85,34 @@ require (
|
|||||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
github.com/prometheus/client_golang v1.12.1 // indirect
|
github.com/prometheus/client_golang v1.13.0 // indirect
|
||||||
github.com/prometheus/client_model v0.2.0 // indirect
|
github.com/prometheus/client_model v0.2.0 // indirect
|
||||||
github.com/prometheus/common v0.32.1 // indirect
|
github.com/prometheus/common v0.37.0 // indirect
|
||||||
github.com/prometheus/procfs v0.7.3 // indirect
|
github.com/prometheus/procfs v0.8.0 // indirect
|
||||||
github.com/spf13/pflag v1.0.5 // indirect
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
github.com/zclconf/go-cty v1.10.0 // indirect
|
github.com/zclconf/go-cty v1.11.0 // indirect
|
||||||
go.uber.org/atomic v1.7.0 // indirect
|
go.uber.org/atomic v1.7.0 // indirect
|
||||||
go.uber.org/zap v1.21.0 // indirect
|
go.uber.org/zap v1.23.0 // indirect
|
||||||
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
|
golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd // indirect
|
||||||
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
|
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
|
||||||
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
|
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
|
||||||
golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e // indirect
|
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
|
||||||
golang.org/x/text v0.3.7 // indirect
|
golang.org/x/text v0.4.0 // indirect
|
||||||
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
|
golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
|
||||||
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
|
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
|
||||||
google.golang.org/appengine v1.6.7 // indirect
|
google.golang.org/appengine v1.6.7 // indirect
|
||||||
google.golang.org/protobuf v1.27.1 // indirect
|
google.golang.org/protobuf v1.28.1 // indirect
|
||||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
k8s.io/apiextensions-apiserver v0.24.1 // indirect
|
k8s.io/apiextensions-apiserver v0.25.3 // indirect
|
||||||
k8s.io/component-base v0.24.1 // indirect
|
k8s.io/component-base v0.25.3 // indirect
|
||||||
k8s.io/klog/v2 v2.60.1 // indirect
|
k8s.io/klog/v2 v2.80.1 // indirect
|
||||||
k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 // indirect
|
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
|
||||||
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
|
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
|
||||||
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
|
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
|
||||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
|
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
|
||||||
sigs.k8s.io/yaml v1.3.0 // indirect
|
sigs.k8s.io/yaml v1.3.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
115
tests/azure/terraform/aks/.terraform.lock.hcl
generated
115
tests/azure/terraform/aks/.terraform.lock.hcl
generated
@@ -2,77 +2,80 @@
|
|||||||
# Manual edits may be lost in future updates.
|
# Manual edits may be lost in future updates.
|
||||||
|
|
||||||
provider "registry.terraform.io/hashicorp/azuread" {
|
provider "registry.terraform.io/hashicorp/azuread" {
|
||||||
version = "1.6.0"
|
version = "2.28.0"
|
||||||
constraints = "1.6.0"
|
constraints = "2.28.0"
|
||||||
hashes = [
|
hashes = [
|
||||||
"h1:BlO53mX+Y2W//YqlCKvoxzofegFQk636XlKtmZYH0PY=",
|
"h1:22zcPLrP6T0FAGzhkx44Oc3SreGpzttng34JSYhoknE=",
|
||||||
"zh:0db70045a464d325fdb3d71809f0467844c3e2fcf1349e568bc51ad5035c99d9",
|
"zh:0e8b008417d74f7d7f931effe48c0719f20789440c9c5932c2b1cf4110348f41",
|
||||||
"zh:3629f1d7b4eba48d744b24c7cf7fe878d5ef5910a36b525507bd3d588010ccec",
|
"zh:1c3e89cf19118fc07d7b04257251fc9897e722c16e0a0df7b07fcd261f8c12e7",
|
||||||
"zh:5a73a45b6d1ff353810cc9b00d7c90a2fb328ba0a9ef3d24392b1500fb98741a",
|
"zh:2a2e4408fc1dc902553ff6a5751924c5e9a59df30f0668b55aa6c07264537c03",
|
||||||
"zh:7a6a9c390cf1bf752321abb8d0643c9f623e8c2ad871dfb378d64c9d90fada2d",
|
"zh:2ab09b735888a7402bdd8e74f75a053ac102e0a01b876b0608a0c240dff57b2e",
|
||||||
"zh:7d6de55d326b046dabc16bd7b655f008ff780c36ffc884b139a7c7da37b446d5",
|
"zh:2ac1f45bb1597726ff6822e1f9a7bc7227179c10b0b51533849b44ab278a05ed",
|
||||||
"zh:8d725c618396ccae290e411296c892e08e776c3e9e5a82b0ef1f633a917146ec",
|
"zh:601a7821c7fbef870a1a2165a684e4fb4f4c84f6b85e0ce51ef7783a581cf594",
|
||||||
"zh:a206d1d8042bf66ca12b97334bbd6fcdf12fd6131f8cb4547c82b9fa7a701612",
|
"zh:7f8e4dd03a3d4259e06b498ed0b04c6911aa99cf5f01018e2092899cd135c6e5",
|
||||||
"zh:b03ab4ff07dcb5ed8be8b0619c6ec9fb0da0c83594ccb0a1bff72f346083b530",
|
"zh:8408143a24baaf4ad527aeecfaf11dfcd0fb6f25648958f2c94464717f776206",
|
||||||
"zh:b6131f9d438b340a4016c770b569139ec7ac2532358a8ab783234e8c93d141d5",
|
"zh:bc836c1389f7b01537eb71ec709ea9d1cb4180814b70992ce3004356ce28d173",
|
||||||
"zh:ce9372d38e9e62accfd54f4669753000d3dcbae4b45686d74630eb63eb879f37",
|
"zh:d4b5571c96c2bafdf79494265f508dbe569f6fb16a5ddc41f22da22e9be029e9",
|
||||||
"zh:df9a607c333d464d8bdeb248b1ff41e493c1d0661453a1e1ce396b89952a74ee",
|
"zh:f1c2a1a13fe3725ba84b57a418adb1bd8c93db09dd880658a468cbd4832f9224",
|
||||||
|
"zh:f39b090d45674395fecb39add1260dd4565661e38eb40c4017c3fd84c8af1717",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "registry.terraform.io/hashicorp/azurerm" {
|
provider "registry.terraform.io/hashicorp/azurerm" {
|
||||||
version = "2.76.0"
|
version = "3.20.0"
|
||||||
constraints = "2.76.0"
|
constraints = "3.20.0"
|
||||||
hashes = [
|
hashes = [
|
||||||
"h1:kF+u0s0DPnE5gMKhzQACWRUIdwZG1Ax4atXt9hk1J8M=",
|
"h1:heH/4bYgajEFQ+fwSV9Zduvpyb7eTCQUv+gl201EFg8=",
|
||||||
"zh:137eb7c07d3d3c9fe123e74381c108c4442efba9fc051faa2ca603503ff2840f",
|
"zh:0d534bb2fed67b5b58d3adb2b0be7a9986f62b34f40eae450dafc9454fb54db8",
|
||||||
"zh:142a354dffd59a1d6b7f1614ab66a468ace3636d95933589a8d704ee8dbc4ea6",
|
"zh:19f6d5f196a35500e0f1ae9d9baee44f49b90858524338a7b8aaec06d3e3a047",
|
||||||
"zh:4c343b4da8b86e4213c1b11f73337cec73a55b1fa95a0e0e0c79f34597d37cc3",
|
"zh:1d042648d2eaffde8858a8006b944374599c5e8c2f834ae74b97adedd1468142",
|
||||||
"zh:75d3109d48726fdbaad840d2fa294ec3362b32a3628c261af00f5c5608427521",
|
"zh:278ebac38cf3c1e6df4bc5de00e931bfc04298607f428aa84a932bbf26dee421",
|
||||||
"zh:7b1e78c144c6ad2beebc798abb9e76c725bf34ced41df36dc0120a0f2426e801",
|
"zh:48f29b802e2de7e6dd2452a012c633686fce5d7ad3eadb490a7b8c0967a9ebfa",
|
||||||
"zh:981235b01c3d4acf94c78cdd96624fd01d0a3622bc06b5c62aef3e788f1481c3",
|
"zh:731bf2e97c4a519723682beb2e85e065bf0bf53b2f50e2ff7b15b39ea74e37ff",
|
||||||
"zh:bad819efae7293ce371409e1ed34197c3e879f61d3e44893af0ce68e6aaffde7",
|
"zh:7c8187ebca19ca8f6ef82d3d79a418ccfa6574bb99e63cc930fa46ff938a7921",
|
||||||
"zh:c8008967722929deccfec9695754ae55028ce12311c321ae7a7c753dde162a44",
|
"zh:82fdb2052601f6fa925195e77506fb609ce8bb4a6f6e94cf6a5058252ef570d4",
|
||||||
"zh:d38513d1138864269b2ff333b08a64a7949630d489f18e660630bbaff3b7ebb8",
|
"zh:995ca23bb3765a16c6b3138b468d920acff5742b22492324c836579e3344ea40",
|
||||||
"zh:e1f64d2d91b5f5cba6a9c5d35278a4918d332d7385a87f8e3466aaadb782a90f",
|
"zh:a970131232ad41203382f6fa3f0014a22767cbfe28cd7562346184ea6e678d63",
|
||||||
"zh:e93a377a1e823df69718686703b07f1712046eeb742006022e982f2e8a594161",
|
"zh:bf5036675a7f0b8691fe393e2782a76c7943ba17eec7255e16a31c7547436a48",
|
||||||
|
"zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "registry.terraform.io/hashicorp/random" {
|
provider "registry.terraform.io/hashicorp/random" {
|
||||||
version = "3.1.0"
|
version = "3.4.3"
|
||||||
hashes = [
|
hashes = [
|
||||||
"h1:BZMEPucF+pbu9gsPk0G0BHx7YP04+tKdq2MrRDF1EDM=",
|
"h1:xZGZf18JjMS06pFa4NErzANI98qi59SEcBsOcS2P2yQ=",
|
||||||
"zh:2bbb3339f0643b5daa07480ef4397bd23a79963cc364cdfbb4e86354cb7725bc",
|
"zh:41c53ba47085d8261590990f8633c8906696fa0a3c4b384ff6a7ecbf84339752",
|
||||||
"zh:3cd456047805bf639fbf2c761b1848880ea703a054f76db51852008b11008626",
|
"zh:59d98081c4475f2ad77d881c4412c5129c56214892f490adf11c7e7a5a47de9b",
|
||||||
"zh:4f251b0eda5bb5e3dc26ea4400dba200018213654b69b4a5f96abee815b4f5ff",
|
"zh:686ad1ee40b812b9e016317e7f34c0d63ef837e084dea4a1f578f64a6314ad53",
|
||||||
"zh:7011332745ea061e517fe1319bd6c75054a314155cb2c1199a5b01fe1889a7e2",
|
"zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3",
|
||||||
"zh:738ed82858317ccc246691c8b85995bc125ac3b4143043219bd0437adc56c992",
|
"zh:84103eae7251384c0d995f5a257c72b0096605048f757b749b7b62107a5dccb3",
|
||||||
"zh:7dbe52fac7bb21227acd7529b487511c91f4107db9cc4414f50d04ffc3cab427",
|
"zh:8ee974b110adb78c7cd18aae82b2729e5124d8f115d484215fd5199451053de5",
|
||||||
"zh:a3a9251fb15f93e4cfc1789800fc2d7414bbc18944ad4c5c98f466e6477c42bc",
|
"zh:9dd4561e3c847e45de603f17fa0c01ae14cae8c4b7b4e6423c9ef3904b308dda",
|
||||||
"zh:a543ec1a3a8c20635cf374110bd2f87c07374cf2c50617eee2c669b3ceeeaa9f",
|
"zh:bb07bb3c2c0296beba0beec629ebc6474c70732387477a65966483b5efabdbc6",
|
||||||
"zh:d9ab41d556a48bd7059f0810cf020500635bfc696c9fc3adab5ea8915c1d886b",
|
"zh:e891339e96c9e5a888727b45b2e1bb3fcbdfe0fd7c5b4396e4695459b38c8cb1",
|
||||||
"zh:d9e13427a7d011dbd654e591b0337e6074eef8c3b9bb11b2e39eaaf257044fd7",
|
"zh:ea4739860c24dfeaac6c100b2a2e357106a89d18751f7693f3c31ecf6a996f8d",
|
||||||
"zh:f7605bd1437752114baf601bdf6931debe6dc6bfe3006eb7e9bb9080931dca8a",
|
"zh:f0c76ac303fd0ab59146c39bc121c5d7d86f878e9a69294e29444d4c653786f8",
|
||||||
|
"zh:f143a9a5af42b38fed328a161279906759ff39ac428ebcfe55606e05e1518b93",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "registry.terraform.io/microsoft/azuredevops" {
|
provider "registry.terraform.io/microsoft/azuredevops" {
|
||||||
version = "0.1.7"
|
version = "0.2.2"
|
||||||
constraints = "0.1.7"
|
constraints = "0.2.2"
|
||||||
hashes = [
|
hashes = [
|
||||||
"h1:AWNWqJ3XhlKp3xdJF+3WKdK1zVoCFYInQvi06exsBzg=",
|
"h1:oKfPQ5Tp9WNeacY08gMifP3G9I//o3LW6qTLsveJwi0=",
|
||||||
"zh:0c024992f2282ef73d4829e487ec8482dd98e9272b903f2e5979f5f62567ee4e",
|
"zh:016142d26ec662949ba95b6c84672b243b54bbdca04cf8714fe0b4318783a72d",
|
||||||
"zh:47fef8f57dfdca6aebe5a907b4866880007512019d9bec29805fc83501412309",
|
"zh:0337b3c4e023bb56b23a5d2d9abe917f197eed378fa69803e9d0b11a36211e15",
|
||||||
"zh:692736c501c6b987a4a74c69fb7702a54969180706d1f67eff13e6ed2a0f9fec",
|
"zh:240c9636660292eeb99bd892602eafe2e5c22b469b082de6963e31dab9e0092e",
|
||||||
"zh:6c3c4339206f5dcbc9d10fb2fe343652e7e14255223dcece5bf79ef9030858ef",
|
"zh:439151590a489a7c0cde50ee701fdbf254e67bdbeaa2acd2a99d005c4051d518",
|
||||||
"zh:77dfc63377b8d8fe24cbbe479ead18bfd1c7ded067fd694b6532434d6305ad31",
|
"zh:6086f5eab87662678eef7bc83041eab5667e92189eb3089b966aeb2cdb58d299",
|
||||||
"zh:93dba26dbade208a1cba43333f104a64252ca2404636ab033702da29648bfaaa",
|
"zh:94a64223905bb3cef2c38e163ae56ef841422e6511a79f8e60272edd7f8fc67f",
|
||||||
"zh:952d28b3e6c137de9b8700d2b748e5a4a2aa53ed07005f0f7abdd66b84cc63fe",
|
"zh:9d9545445607c5ba6482da0137464d5de4c3459ae1671e6ff94e337e5943c0eb",
|
||||||
"zh:a7b8238b8b2f04ad2d720a207377bfc2066d54b1d9d7285f2535afc43ff80fdb",
|
"zh:a53bfdea73985ed31acbadd200b295745662a4a54e8c37f050faf71dab7deb8b",
|
||||||
"zh:bb23d8fc3cdd3c01d7620dadb2ba7b724706f2112d7738e135d1be1455682f5e",
|
"zh:aa6943db7093b2556fcc2ee5b8b5a8a48e625ded2b063183fbc5a52c94d133f2",
|
||||||
"zh:cb4da640beb5fc59296479c201a03351789496c04aaa57ae1530a7aac9095b92",
|
"zh:af4729e8fe8ec255e4c4ca0e6dd4cf43d855bfe4c45b2aa6e47d8c35be55813d",
|
||||||
"zh:ede6fb7ab598081fdddac56d470bae14448271dfd43a645bc02d136643391ebe",
|
"zh:bdf8752a6cd12ba3a33597bf7519825000a498b655c72be8c8df504bb9f70fe5",
|
||||||
"zh:fd8291e6dc9118323a744660326a0f11de2a475c4a358e50f480feed1f3bb080",
|
"zh:c760fa7bc5c62d56c54ef41b4b03b0ae391149f46f36c8c8a55d2511e7f8e599",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,9 +16,7 @@ resource "azurerm_kubernetes_cluster" "this" {
|
|||||||
type = "SystemAssigned"
|
type = "SystemAssigned"
|
||||||
}
|
}
|
||||||
|
|
||||||
role_based_access_control {
|
role_based_access_control_enabled = true
|
||||||
enabled = true
|
|
||||||
}
|
|
||||||
|
|
||||||
network_profile {
|
network_profile {
|
||||||
network_plugin = "kubenet"
|
network_plugin = "kubenet"
|
||||||
|
|||||||
@@ -6,20 +6,20 @@ terraform {
|
|||||||
key = "prod.terraform.tfstate"
|
key = "prod.terraform.tfstate"
|
||||||
}
|
}
|
||||||
|
|
||||||
required_version = "1.0.7"
|
required_version = "1.2.8"
|
||||||
|
|
||||||
required_providers {
|
required_providers {
|
||||||
azurerm = {
|
azurerm = {
|
||||||
source = "hashicorp/azurerm"
|
source = "hashicorp/azurerm"
|
||||||
version = "2.76.0"
|
version = "3.20.0"
|
||||||
}
|
}
|
||||||
azuread = {
|
azuread = {
|
||||||
source = "hashicorp/azuread"
|
source = "hashicorp/azuread"
|
||||||
version = "1.6.0"
|
version = "2.28.0"
|
||||||
}
|
}
|
||||||
azuredevops = {
|
azuredevops = {
|
||||||
source = "microsoft/azuredevops"
|
source = "microsoft/azuredevops"
|
||||||
version = "0.1.7"
|
version = "0.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,18 +5,22 @@ output "aks_kube_config" {
|
|||||||
|
|
||||||
output "aks_host" {
|
output "aks_host" {
|
||||||
value = azurerm_kubernetes_cluster.this.kube_config[0].host
|
value = azurerm_kubernetes_cluster.this.kube_config[0].host
|
||||||
|
sensitive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
output "aks_client_certificate" {
|
output "aks_client_certificate" {
|
||||||
value = base64decode(azurerm_kubernetes_cluster.this.kube_config[0].client_certificate)
|
value = base64decode(azurerm_kubernetes_cluster.this.kube_config[0].client_certificate)
|
||||||
|
sensitive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
output "aks_client_key" {
|
output "aks_client_key" {
|
||||||
value = base64decode(azurerm_kubernetes_cluster.this.kube_config[0].client_key)
|
value = base64decode(azurerm_kubernetes_cluster.this.kube_config[0].client_key)
|
||||||
|
sensitive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
output "aks_cluster_ca_certificate" {
|
output "aks_cluster_ca_certificate" {
|
||||||
value = base64decode(azurerm_kubernetes_cluster.this.kube_config[0].cluster_ca_certificate)
|
value = base64decode(azurerm_kubernetes_cluster.this.kube_config[0].cluster_ca_certificate)
|
||||||
|
sensitive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
output "shared_pat" {
|
output "shared_pat" {
|
||||||
|
|||||||
85
tests/azure/terraform/shared/.terraform.lock.hcl
generated
85
tests/azure/terraform/shared/.terraform.lock.hcl
generated
@@ -2,57 +2,60 @@
|
|||||||
# Manual edits may be lost in future updates.
|
# Manual edits may be lost in future updates.
|
||||||
|
|
||||||
provider "registry.terraform.io/hashicorp/azuread" {
|
provider "registry.terraform.io/hashicorp/azuread" {
|
||||||
version = "1.6.0"
|
version = "2.28.0"
|
||||||
constraints = "1.6.0"
|
constraints = "2.28.0"
|
||||||
hashes = [
|
hashes = [
|
||||||
"h1:BlO53mX+Y2W//YqlCKvoxzofegFQk636XlKtmZYH0PY=",
|
"h1:22zcPLrP6T0FAGzhkx44Oc3SreGpzttng34JSYhoknE=",
|
||||||
"zh:0db70045a464d325fdb3d71809f0467844c3e2fcf1349e568bc51ad5035c99d9",
|
"zh:0e8b008417d74f7d7f931effe48c0719f20789440c9c5932c2b1cf4110348f41",
|
||||||
"zh:3629f1d7b4eba48d744b24c7cf7fe878d5ef5910a36b525507bd3d588010ccec",
|
"zh:1c3e89cf19118fc07d7b04257251fc9897e722c16e0a0df7b07fcd261f8c12e7",
|
||||||
"zh:5a73a45b6d1ff353810cc9b00d7c90a2fb328ba0a9ef3d24392b1500fb98741a",
|
"zh:2a2e4408fc1dc902553ff6a5751924c5e9a59df30f0668b55aa6c07264537c03",
|
||||||
"zh:7a6a9c390cf1bf752321abb8d0643c9f623e8c2ad871dfb378d64c9d90fada2d",
|
"zh:2ab09b735888a7402bdd8e74f75a053ac102e0a01b876b0608a0c240dff57b2e",
|
||||||
"zh:7d6de55d326b046dabc16bd7b655f008ff780c36ffc884b139a7c7da37b446d5",
|
"zh:2ac1f45bb1597726ff6822e1f9a7bc7227179c10b0b51533849b44ab278a05ed",
|
||||||
"zh:8d725c618396ccae290e411296c892e08e776c3e9e5a82b0ef1f633a917146ec",
|
"zh:601a7821c7fbef870a1a2165a684e4fb4f4c84f6b85e0ce51ef7783a581cf594",
|
||||||
"zh:a206d1d8042bf66ca12b97334bbd6fcdf12fd6131f8cb4547c82b9fa7a701612",
|
"zh:7f8e4dd03a3d4259e06b498ed0b04c6911aa99cf5f01018e2092899cd135c6e5",
|
||||||
"zh:b03ab4ff07dcb5ed8be8b0619c6ec9fb0da0c83594ccb0a1bff72f346083b530",
|
"zh:8408143a24baaf4ad527aeecfaf11dfcd0fb6f25648958f2c94464717f776206",
|
||||||
"zh:b6131f9d438b340a4016c770b569139ec7ac2532358a8ab783234e8c93d141d5",
|
"zh:bc836c1389f7b01537eb71ec709ea9d1cb4180814b70992ce3004356ce28d173",
|
||||||
"zh:ce9372d38e9e62accfd54f4669753000d3dcbae4b45686d74630eb63eb879f37",
|
"zh:d4b5571c96c2bafdf79494265f508dbe569f6fb16a5ddc41f22da22e9be029e9",
|
||||||
"zh:df9a607c333d464d8bdeb248b1ff41e493c1d0661453a1e1ce396b89952a74ee",
|
"zh:f1c2a1a13fe3725ba84b57a418adb1bd8c93db09dd880658a468cbd4832f9224",
|
||||||
|
"zh:f39b090d45674395fecb39add1260dd4565661e38eb40c4017c3fd84c8af1717",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "registry.terraform.io/hashicorp/azurerm" {
|
provider "registry.terraform.io/hashicorp/azurerm" {
|
||||||
version = "2.76.0"
|
version = "3.20.0"
|
||||||
constraints = "2.76.0"
|
constraints = "3.20.0"
|
||||||
hashes = [
|
hashes = [
|
||||||
"h1:kF+u0s0DPnE5gMKhzQACWRUIdwZG1Ax4atXt9hk1J8M=",
|
"h1:heH/4bYgajEFQ+fwSV9Zduvpyb7eTCQUv+gl201EFg8=",
|
||||||
"zh:137eb7c07d3d3c9fe123e74381c108c4442efba9fc051faa2ca603503ff2840f",
|
"zh:0d534bb2fed67b5b58d3adb2b0be7a9986f62b34f40eae450dafc9454fb54db8",
|
||||||
"zh:142a354dffd59a1d6b7f1614ab66a468ace3636d95933589a8d704ee8dbc4ea6",
|
"zh:19f6d5f196a35500e0f1ae9d9baee44f49b90858524338a7b8aaec06d3e3a047",
|
||||||
"zh:4c343b4da8b86e4213c1b11f73337cec73a55b1fa95a0e0e0c79f34597d37cc3",
|
"zh:1d042648d2eaffde8858a8006b944374599c5e8c2f834ae74b97adedd1468142",
|
||||||
"zh:75d3109d48726fdbaad840d2fa294ec3362b32a3628c261af00f5c5608427521",
|
"zh:278ebac38cf3c1e6df4bc5de00e931bfc04298607f428aa84a932bbf26dee421",
|
||||||
"zh:7b1e78c144c6ad2beebc798abb9e76c725bf34ced41df36dc0120a0f2426e801",
|
"zh:48f29b802e2de7e6dd2452a012c633686fce5d7ad3eadb490a7b8c0967a9ebfa",
|
||||||
"zh:981235b01c3d4acf94c78cdd96624fd01d0a3622bc06b5c62aef3e788f1481c3",
|
"zh:731bf2e97c4a519723682beb2e85e065bf0bf53b2f50e2ff7b15b39ea74e37ff",
|
||||||
"zh:bad819efae7293ce371409e1ed34197c3e879f61d3e44893af0ce68e6aaffde7",
|
"zh:7c8187ebca19ca8f6ef82d3d79a418ccfa6574bb99e63cc930fa46ff938a7921",
|
||||||
"zh:c8008967722929deccfec9695754ae55028ce12311c321ae7a7c753dde162a44",
|
"zh:82fdb2052601f6fa925195e77506fb609ce8bb4a6f6e94cf6a5058252ef570d4",
|
||||||
"zh:d38513d1138864269b2ff333b08a64a7949630d489f18e660630bbaff3b7ebb8",
|
"zh:995ca23bb3765a16c6b3138b468d920acff5742b22492324c836579e3344ea40",
|
||||||
"zh:e1f64d2d91b5f5cba6a9c5d35278a4918d332d7385a87f8e3466aaadb782a90f",
|
"zh:a970131232ad41203382f6fa3f0014a22767cbfe28cd7562346184ea6e678d63",
|
||||||
"zh:e93a377a1e823df69718686703b07f1712046eeb742006022e982f2e8a594161",
|
"zh:bf5036675a7f0b8691fe393e2782a76c7943ba17eec7255e16a31c7547436a48",
|
||||||
|
"zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "registry.terraform.io/hashicorp/random" {
|
provider "registry.terraform.io/hashicorp/random" {
|
||||||
version = "3.1.0"
|
version = "3.3.2"
|
||||||
hashes = [
|
hashes = [
|
||||||
"h1:BZMEPucF+pbu9gsPk0G0BHx7YP04+tKdq2MrRDF1EDM=",
|
"h1:H5V+7iXol/EHB2+BUMzGlpIiCOdV74H8YjzCxnSAWcg=",
|
||||||
"zh:2bbb3339f0643b5daa07480ef4397bd23a79963cc364cdfbb4e86354cb7725bc",
|
"zh:038293aebfede983e45ee55c328e3fde82ae2e5719c9bd233c324cfacc437f9c",
|
||||||
"zh:3cd456047805bf639fbf2c761b1848880ea703a054f76db51852008b11008626",
|
"zh:07eaeab03a723d83ac1cc218f3a59fceb7bbf301b38e89a26807d1c93c81cef8",
|
||||||
"zh:4f251b0eda5bb5e3dc26ea4400dba200018213654b69b4a5f96abee815b4f5ff",
|
"zh:427611a4ce9d856b1c73bea986d841a969e4c2799c8ac7c18798d0cc42b78d32",
|
||||||
"zh:7011332745ea061e517fe1319bd6c75054a314155cb2c1199a5b01fe1889a7e2",
|
"zh:49718d2da653c06a70ba81fd055e2b99dfd52dcb86820a6aeea620df22cd3b30",
|
||||||
"zh:738ed82858317ccc246691c8b85995bc125ac3b4143043219bd0437adc56c992",
|
"zh:5574828d90b19ab762604c6306337e6cd430e65868e13ef6ddb4e25ddb9ad4c0",
|
||||||
"zh:7dbe52fac7bb21227acd7529b487511c91f4107db9cc4414f50d04ffc3cab427",
|
"zh:7222e16f7833199dabf1bc5401c56d708ec052b2a5870988bc89ff85b68a5388",
|
||||||
"zh:a3a9251fb15f93e4cfc1789800fc2d7414bbc18944ad4c5c98f466e6477c42bc",
|
"zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3",
|
||||||
"zh:a543ec1a3a8c20635cf374110bd2f87c07374cf2c50617eee2c669b3ceeeaa9f",
|
"zh:b1b2d7d934784d2aee98b0f8f07a8ccfc0410de63493ae2bf2222c165becf938",
|
||||||
"zh:d9ab41d556a48bd7059f0810cf020500635bfc696c9fc3adab5ea8915c1d886b",
|
"zh:b8f85b6a20bd264fcd0814866f415f0a368d1123cd7879c8ebbf905d370babc8",
|
||||||
"zh:d9e13427a7d011dbd654e591b0337e6074eef8c3b9bb11b2e39eaaf257044fd7",
|
"zh:c3813133acc02bbebddf046d9942e8ba5c35fc99191e3eb057957dafc2929912",
|
||||||
"zh:f7605bd1437752114baf601bdf6931debe6dc6bfe3006eb7e9bb9080931dca8a",
|
"zh:e7a41dbc919d1de800689a81c240c27eec6b9395564630764ebb323ea82ac8a9",
|
||||||
|
"zh:ee6d23208449a8eaa6c4f203e33f5176fa795b4b9ecf32903dffe6e2574732c2",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ resource "azurerm_container_registry" "this" {
|
|||||||
name = "acrapps${random_pet.suffix.id}"
|
name = "acrapps${random_pet.suffix.id}"
|
||||||
resource_group_name = azurerm_resource_group.this.name
|
resource_group_name = azurerm_resource_group.this.name
|
||||||
location = azurerm_resource_group.this.location
|
location = azurerm_resource_group.this.location
|
||||||
sku = "standard"
|
sku = "Standard"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,16 +6,16 @@ terraform {
|
|||||||
key = "prod.terraform.tfstate"
|
key = "prod.terraform.tfstate"
|
||||||
}
|
}
|
||||||
|
|
||||||
required_version = "1.0.7"
|
required_version = "1.2.8"
|
||||||
|
|
||||||
required_providers {
|
required_providers {
|
||||||
azurerm = {
|
azurerm = {
|
||||||
source = "hashicorp/azurerm"
|
source = "hashicorp/azurerm"
|
||||||
version = "2.76.0"
|
version = "3.20.0"
|
||||||
}
|
}
|
||||||
azuread = {
|
azuread = {
|
||||||
source = "hashicorp/azuread"
|
source = "hashicorp/azuread"
|
||||||
version = "1.6.0"
|
version = "2.28.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
git2go "github.com/libgit2/git2go/v31"
|
git2go "github.com/libgit2/git2go/v33"
|
||||||
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
||||||
@@ -313,12 +313,15 @@ func getRepository(url, branchName string, overrideBranch bool, password string)
|
|||||||
return nil, "", err
|
return nil, "", err
|
||||||
}
|
}
|
||||||
repo, err := git2go.Clone(url, tmpDir, &git2go.CloneOptions{
|
repo, err := git2go.Clone(url, tmpDir, &git2go.CloneOptions{
|
||||||
FetchOptions: &git2go.FetchOptions{
|
FetchOptions: git2go.FetchOptions{
|
||||||
RemoteCallbacks: git2go.RemoteCallbacks{
|
RemoteCallbacks: git2go.RemoteCallbacks{
|
||||||
CredentialsCallback: credentialCallback("git", password),
|
CredentialsCallback: credentialCallback("git", password),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
CheckoutBranch: checkoutBranch,
|
CheckoutBranch: checkoutBranch,
|
||||||
|
CheckoutOptions: git2go.CheckoutOpts{
|
||||||
|
Strategy: git2go.CheckoutSafe,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", err
|
return nil, "", err
|
||||||
|
|||||||
Reference in New Issue
Block a user