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

Compare commits

...

138 Commits

Author SHA1 Message Date
Stefan Prodan
36ba8f0fcb Merge pull request #207 from fluxcd/kustomize-controller-v0.0.10
Update kustomize-controller to v0.0.10
2020-09-05 11:19:33 +03:00
stefanprodan
bfb560ec50 Update kustomize-controller to v0.0.10 2020-09-05 11:04:41 +03:00
Stefan Prodan
78bb11dcbf Merge pull request #204 from fluxcd/ghcr
Use GitHub Container Registry for AMD64/ARM64 images
2020-09-04 17:35:25 +03:00
stefanprodan
5c8d00665f Use GitHub Container Registry for AMD64/ARM64 images 2020-09-04 17:18:33 +03:00
Stefan Prodan
f4d78cc08e Merge pull request #202 from fluxcd/arch
Add ARM64 support to install/bootstrap
2020-09-04 16:37:03 +03:00
stefanprodan
2aa395ba12 Update source and helm controllers
helm-controller/api v0.0.7
source-controller/api v0.0.14
2020-09-04 16:23:21 +03:00
Hidde Beydals
ac862e6822 Merge pull request #201 from fluxcd/update-hr-create-docs
Update `gotk create helmrelease` examples
2020-09-04 14:24:37 +02:00
stefanprodan
1b55ead16e Add ARM64 to install docs and script 2020-09-04 15:10:42 +03:00
stefanprodan
b24727ec22 Update kustomize-controller to v0.0.9 2020-09-04 14:28:37 +03:00
stefanprodan
2768926683 Publish gotk linux/arm64 binary 2020-09-04 12:54:26 +03:00
stefanprodan
3f07bd6471 Add arch flag to install/bootstrap 2020-09-04 12:46:08 +03:00
Hidde Beydals
2f861f19c0 Update gotk create helmrelease examples
To better reflect optional fields and highlight specific configuration
options.
2020-09-03 19:31:19 +02:00
Hidde Beydals
6b397cff73 Merge pull request #200 from scottrigby/docs-gotk-create-hr-fix
Docs: fix gotk create helmrelease examples
2020-09-03 17:45:37 +02:00
Scott Rigby
44a3cf86d3 Docs: fix gotk create helmrelease examples
Signed-off-by: Scott Rigby <scott@r6by.com>
2020-09-03 17:39:12 +02:00
Hidde Beydals
dfb0a40293 Merge pull request #199 from fluxcd/docs/helmrelease-git-guide
Document GitRepository source in HelmRelease guide
2020-09-03 16:48:22 +02:00
Hidde Beydals
7719dd378b docs: GitRepository source in HelmRelease guide 2020-09-03 15:09:12 +02:00
Hidde Beydals
c9f8e43681 Merge pull request #191 from phillebaba/feature/git
Add documentation for github commit status
2020-09-03 12:27:48 +02:00
Hidde Beydals
4a7538041d Merge pull request #198 from fluxcd/notification-component-upgrade
Upgrade notification-controller to v0.0.8
2020-09-03 12:23:45 +02:00
Hidde Beydals
dd3b2288e2 Upgrade notification-controller to v0.0.8 2020-09-03 12:16:29 +02:00
Philip Laine
496abc3a98 Add documentation for github commit status 2020-09-03 12:13:53 +02:00
Hidde Beydals
8b9abfb26e Merge pull request #196 from fluxcd/docs/helmrelease-guide-changes 2020-09-03 12:12:25 +02:00
Hidde Beydals
330e21e2ba Merge pull request #197 from fluxcd/update-tk-components 2020-09-03 12:11:00 +02:00
Hidde Beydals
e53d0dadbf Support GitRepository source in HelmRelease cmds 2020-09-03 11:16:57 +02:00
Hidde Beydals
fa56685767 Upgrade Toolkit components and K8S deps
* github.com/fluxcd/helm-controller/api to v0.0.6
* github.com/fluxcd/source-controller/api to v0.0.13

* k8s.io/api to v0.18.8
* k8s.io/apiextensions-apiserver to v0.18.8
* k8s.io/apimachinery to v0.18.8
* k8s.io/client-go to v0.18.8
* sigs.k8s.io/controller-runtime to v0.6.2
2020-09-03 11:16:50 +02:00
Hidde Beydals
2727f4b92d docs: update helm-controller doc 2020-09-03 10:44:04 +02:00
Hidde Beydals
0f74f65af8 docs: update FAQ differences Helm integration 2020-09-03 10:40:33 +02:00
Hidde Beydals
8e03968370 docs: incorporate HelmRelease API changes in guide 2020-09-03 10:40:30 +02:00
Daniel Holbach
969f181f3e Merge pull request #195 from dholbach/update-roadmap
update roadmap
2020-09-02 17:12:43 +02:00
Daniel Holbach
cc18077192 update roadmap 2020-09-02 16:31:35 +02:00
Daniel Holbach
47d07b2326 Merge pull request #193 from dholbach/roadmap-is-settled
Roadmap for Flux v2 is settled for now, remove note.
2020-09-02 16:20:57 +02:00
Daniel Holbach
a96bb72fb8 Roadmap for Flux v2 is settled for now, remove note 2020-09-02 14:20:14 +02:00
Hidde Beydals
75364dd5b4 Merge pull request #180 from fluxcd/rename-tk-to-gotk
Rename `tk` binary to `gotk`
2020-09-01 12:33:09 +02:00
Hidde Beydals
22624ae4d5 Rename tk binary to gotk
To avoid conflicts with the `tk` binary from the Tanka project.
2020-09-01 11:33:49 +02:00
Hidde Beydals
cb23d3ff3c Merge pull request #185 from fluxcd/helmrelease-json-pointer 2020-09-01 11:32:00 +02:00
Hidde Beydals
e751bdc8a9 Change readiness check for HelmRelease
As the HelmRelease injects its own HelmChart, the first reconciliation
will always trigger a `Ready==False` condition while it waits for the
chart to become ready. Given this, we should only take this condition
into account when the `status.LastAttemptedRevision` has been recorded,
as this marks the fact that the chart is available and an action was
attempted.
2020-09-01 11:15:53 +02:00
Hidde Beydals
2078d048a1 Fix: change v1.JSON for HelmRelease to pointer 2020-08-28 15:20:34 +02:00
Hidde Beydals
22ff25269d Merge pull request #184 from fluxcd/update-components
Update toolkit components
2020-08-28 11:18:19 +02:00
hiddeco
1ee9a6a39d Update toolkit components 2020-08-28 07:54:06 +00:00
Hidde Beydals
50efd865d9 Merge pull request #182 from fluxcd/docs-detect-component-versions 2020-08-28 09:48:32 +02:00
Hidde Beydals
d688d3837f build: use mini curl progress bar and error on 404 2020-08-26 12:27:03 +02:00
Hidde Beydals
6cb438440d build: detect current version from kustomize
This allows controller components to be updated when they are not
included as a Go Mod dependency, which is currently the case for the
notification-controller.
2020-08-26 12:22:04 +02:00
Hidde Beydals
2c5771d9e8 build: detect component versions for docs 2020-08-26 12:21:40 +02:00
Hidde Beydals
0ce06116e6 Merge pull request #177 from mberwanger/git-workflow-component-updates 2020-08-26 10:16:14 +02:00
Martin H Berwanger
706bc0fdfe Update PR commit message 2020-08-25 14:52:11 -04:00
Martin H Berwanger
0b5b1ba11a Automate components updates #36
Add component update GitHub action
- check for new controller release
- bump versions in go mod, kustomize, and docs
- create PR for review
2020-08-25 10:34:07 -04:00
Stefan Prodan
0ed8ca961e Merge pull request #173 from fluxcd/include-author-changelog
Include PR author in changelog
2020-08-21 18:15:01 +03:00
stefanprodan
31d4b62bf3 Include author in changelog
Replace kustomize action with fluxcd/pkg/actions
2020-08-21 17:55:11 +03:00
Stefan Prodan
35d6172d06 Merge pull request #172 from fluxcd/ssh-host
Add SSH hostname arg to GitLab bootstrap
2020-08-21 17:50:29 +03:00
stefanprodan
b5ed8f0183 Add SSH hostname arg to GitLab bootstrap 2020-08-21 17:37:44 +03:00
stefanprodan
7cb3bb0d4e Fix Harbor typo 2020-08-21 17:31:56 +03:00
Hidde Beydals
d27d42d9ca Merge pull request #163 from mberwanger/master 2020-08-20 18:07:51 +02:00
Hidde Beydals
e2fd6e8f86 Merge pull request #168 from fluxcd/update-helm-roadmap
Update helm-controller roadmap
2020-08-20 15:59:30 +02:00
Hidde Beydals
a8e534a8a4 Update helm-controller roadmap 2020-08-20 15:52:42 +02:00
Hidde Beydals
479d7575fa Merge pull request #167 from fluxcd/guide-helm-targetpath
Document targetPath in Helm Releases guide
2020-08-20 15:27:58 +02:00
Hidde Beydals
4707a3075e Document targetPath in Helm Releases guide 2020-08-20 15:14:50 +02:00
Hidde Beydals
21a189e0b7 Merge pull request #166 from fluxcd/helm-v0.0.4
Update helm-controller to v0.0.4
2020-08-20 14:38:31 +02:00
Martin H Berwanger
ab7ff6551f Install script improvements #24
- add checksum verification with sha256sum fallback to shasum
- add downloader fallback to wget
- add os and architecture checks
2020-08-20 08:32:04 -04:00
Hidde Beydals
248961d58c Update helm-controller to v0.0.4 2020-08-20 14:27:36 +02:00
Hidde Beydals
473e226883 Merge pull request #162 from fluxcd/components-upgrade 2020-08-18 15:10:42 +02:00
Hidde Beydals
2ebb06d330 Update notification controller docs to v0.0.7 2020-08-18 14:25:19 +02:00
Hidde Beydals
cc88e68c4e Update components
- source-controller to v0.0.10
- kustomize-controller to v0.0.8
- helm-controller to v0.0.3
2020-08-18 14:23:29 +02:00
Hidde Beydals
f8704747d9 Merge pull request #161 from fluxcd/dedicated-pkgs
Switch to dedicated fluxcd/pkg and api modules
2020-08-18 14:01:19 +02:00
Hidde Beydals
0c33df883c Switch to dedicated fluxcd/pkg and api modules 2020-08-18 13:45:48 +02:00
Stefan Prodan
3fbc396bc8 Merge pull request #160 from fluxcd/export-fix
Make export work offline
2020-08-18 14:36:58 +03:00
stefanprodan
17df7a46e2 Make export work offline 2020-08-17 19:58:17 +03:00
Michael Bridgen
925c1d3d8e Merge pull request #158 from fluxcd/add-secrets-to-roadmap
Add roadmap line item for SOPS support
2020-08-13 16:47:16 +01:00
Michael Bridgen
1976d4cc1b Add line item for SOPS support 2020-08-13 16:30:39 +01:00
Stefan Prodan
d98578f260 Merge pull request #157 from fluxcd/helm-v3.3.0
Update controllers for Helm v3.3.0
2020-08-13 15:17:15 +03:00
stefanprodan
8d1dddf205 Update controllers for Helm v3.3.0 2020-08-13 14:28:51 +03:00
Daniel Holbach
2584b6ca5b Merge pull request #149 from dholbach/fix-142
Add initial set of FAQ
2020-08-11 18:11:28 +02:00
Daniel Holbach
70897cebfe Add initial set of FAQ
closes: #142
2020-08-11 18:04:32 +02:00
Stefan Prodan
0e80cd5c44 Merge pull request #148 from fluxcd/monitoring-stack
Add monitoring stack and dashboards
2020-08-05 17:26:03 +03:00
Stefan Prodan
b979e313b2 Merge pull request #150 from fluxcd/notification-0.0.7
Update notification-controller to v0.0.7
2020-08-05 17:24:38 +03:00
stefanprodan
533cb42d29 Update notification-controller to v0.0.7 2020-08-05 17:07:45 +03:00
stefanprodan
35a209903e Add monitoring section to install docs 2020-08-05 16:17:18 +03:00
stefanprodan
824de61579 Filter controllers in control plane dashboard 2020-08-04 18:56:32 +03:00
stefanprodan
17ca3f8ac2 Add control plane dashboard screens 2020-08-04 15:43:17 +03:00
stefanprodan
87a299736e Add control plane Grafana dashboard 2020-08-04 15:41:13 +03:00
stefanprodan
e86286722a Add Prom+Grafana monitoring stack 2020-08-04 15:40:38 +03:00
Daniel Holbach
c4a0724c8d Merge pull request #145 from dholbach/update-contributor-guide
Update contributors guide
2020-08-03 17:27:59 +02:00
Daniel Holbach
17139f34dd Update contributors guide
- point out GH discussions
	- move "understanding GOTK" earlier
	- point out dev-guide
	- update reality on calendar invitations
2020-08-03 15:24:48 +02:00
Stefan Prodan
1779714b0d Merge pull request #144 from fluxcd/docs-installation
Add installation guide
2020-08-03 11:27:47 +03:00
stefanprodan
1ff4495737 Link to installation docs from other guides 2020-08-03 10:43:42 +03:00
stefanprodan
02c0dc1217 Add bootstrap path example to installation 2020-08-03 10:24:25 +03:00
stefanprodan
fb43c194b9 Add installation guide 2020-08-01 13:22:22 +03:00
Hidde Beydals
ae94bb56d9 Merge pull request #141 from fluxcd/enhancement/create-source-helm-certs
Support providing TLS certs for helm source
2020-07-31 16:41:52 +02:00
Hidde Beydals
123433c4ea Support providing TLS certs for helm source 2020-07-31 16:29:52 +02:00
Stefan Prodan
58619076ea Merge pull request #140 from fluxcd/docs-roadmap-update
Mark metrics as completed in roadmap
2020-07-31 14:14:55 +03:00
stefanprodan
a50d1c5784 Update roadmap 2020-07-31 14:07:06 +03:00
Hidde Beydals
91c8cb197f Merge pull request #139 from fluxcd/docs/helm-valuesfrom
docs/helm: guide on values from resources
2020-07-31 13:03:43 +02:00
Hidde Beydals
427c60618f docs/helm: guide on values from resources 2020-07-31 12:56:09 +02:00
Hidde Beydals
2d417f200d Merge pull request #138 from fluxcd/update-components
Update components
2020-07-31 12:17:37 +02:00
Hidde Beydals
54b11e7b25 Update components
- source-controller to v0.0.7
- kustomize-controller to v0.0.7
- helm-controller to v0.0.1
- notification-controller to v0.0.6
2020-07-31 10:24:29 +02:00
Hidde Beydals
50d2eb7d57 Merge pull request #134 from bia/132-beautify-roadmap 2020-07-30 22:50:28 +02:00
bia
dfb20dd1ca docs: progressbar as subtitle 2020-07-30 22:00:01 +02:00
bia
4f22016f13 docs: improve goals styling 2020-07-30 12:12:22 +02:00
bia
430a2d0454 docs: add progressbar and checkmarks to roadmap 2020-07-29 23:54:40 +02:00
Hidde Beydals
db23c8ce9f Merge pull request #131 from mmorejon/update-tk-help-description 2020-07-26 23:38:37 +02:00
Manuel Morejon
ffd4784916 Replace tab by space 2020-07-26 00:35:40 +02:00
Manuel Morejon
750830c302 Replace tk sync example by tk reconcile 2020-07-26 00:24:58 +02:00
Manuel Morejon
d245ef9b39 Remove tk sync example from help command
Signed-off-by: Manuel Morejon <manuel@mmorejon.io>
2020-07-25 14:32:33 +02:00
Stefan Prodan
c8586d1ef4 Merge pull request #130 from fluxcd/kustomize-0.0.6
Update kustomize-controller to v0.0.6
2020-07-25 11:26:44 +03:00
stefanprodan
316cba1cb8 Update kustomize-controller to v0.0.6 2020-07-25 11:13:18 +03:00
Stefan Prodan
13dba62b8d Merge pull request #128 from fluxcd/container-registry
Add container registry and image pull secret as install options
2020-07-23 15:34:27 +03:00
stefanprodan
c2ff169c08 Add image pull secret arg to install/bootstrap 2020-07-23 13:38:32 +03:00
stefanprodan
57a1dbfc6d Add container registry option to install/bootstrap 2020-07-23 13:07:34 +03:00
Stefan Prodan
efb39d6fc6 Merge pull request #127 from fluxcd/node-selector
Add linux/amd64 node selector to controllers
2020-07-23 12:44:34 +03:00
Stefan Prodan
b784234430 Merge pull request #126 from fluxcd/uninstall-crs
Delete custom resources during uninstall
2020-07-23 12:44:18 +03:00
stefanprodan
aebad92426 Add linux/amd64 node selector to controllers
Set nodeSelector to linux/amd64 for clusters with mixed nodes (linux, windows, amd64, arm).
2020-07-23 09:59:45 +03:00
stefanprodan
8e67cfd5c9 Delete custom resources during uninstall
Remove Kustomizations, GitRepositories and HelmRepositories before deleting the toolkit controllers and CRDs.
2020-07-23 09:26:10 +03:00
Stefan Prodan
10cc6d7e08 Merge pull request #124 from fluxcd/helm-beta.4
Update helm-controller to v0.0.1-beta.4
2020-07-22 16:49:11 +03:00
stefanprodan
83c236c829 Update helm-controller to v0.0.1-beta.4 2020-07-22 16:36:59 +03:00
Stefan Prodan
b6ab37691f Merge pull request #120 from fluxcd/sealed-secrets
Add sealed secrets guide
2020-07-22 15:45:00 +03:00
stefanprodan
c85af78025 Add sealed secrets guide 2020-07-22 14:43:55 +03:00
Stefan Prodan
2c2fc6dd97 Merge pull request #123 from fluxcd/optional-notifications
Make notification component optional
2020-07-22 14:41:40 +03:00
stefanprodan
3620b76139 Make notification component optional 2020-07-22 14:30:39 +03:00
Stefan Prodan
ca5732e586 Merge pull request #121 from fluxcd/helm-beta.3
Update helm-controller to v0.0.1-beta.3
2020-07-21 20:31:31 +03:00
stefanprodan
2463d72f3b Update helm-controller to v0.0.1-beta.3 2020-07-21 20:18:23 +03:00
stefanprodan
d6f7474200 Add get/export HelmRelease e2e tests 2020-07-21 14:25:31 +03:00
stefanprodan
0b2bc7ab3f Implement get/export HelmRelease for Helm releases 2020-07-21 14:22:20 +03:00
Stefan Prodan
0a4fac61d4 Merge pull request #118 from fluxcd/hr-cmd
Implement create/delete for Helm releases
2020-07-21 14:10:45 +03:00
stefanprodan
797aec5528 Add create/delete HelmRelease e2e tests 2020-07-21 14:02:29 +03:00
stefanprodan
5f0b95dc59 Implement create/delete for Helm releases 2020-07-21 12:20:41 +03:00
Stefan Prodan
b384c5f14c Merge pull request #116 from fluxcd/helm-repo-cmd
Implement Helm repository commands
2020-07-21 11:09:31 +03:00
stefanprodan
5254dca9d9 Add Helm repository cmd docs 2020-07-21 10:42:05 +03:00
stefanprodan
8534ccbf37 Implement Helm repository commands 2020-07-21 10:39:17 +03:00
stefanprodan
9af874d810 Add examples to all tk commands 2020-07-21 10:38:44 +03:00
Stefan Prodan
4e3dee15ce Merge pull request #114 from fluxcd/fix-kustomize-cmd
Rename kustomization arg from validate to validation
2020-07-20 15:30:00 +03:00
stefanprodan
aaad618e20 Rename kustomization arg from validate to validation
Fix `tk create kustomization` command args inconsistency with the Kustomize API
2020-07-20 15:10:33 +03:00
Stefan Prodan
10bb50bd82 Merge pull request #113 from fluxcd/crd-v1
Drop support for Kubernetes <1.16
2020-07-20 14:56:45 +03:00
stefanprodan
6d2ff6e019 Update controllers and APIs 2020-07-20 14:41:23 +03:00
stefanprodan
670070a879 Drop support for Kubernetes <1.16 2020-07-20 14:37:50 +03:00
Stefan Prodan
dcec8007d4 Merge pull request #88 from luxas/go_git_provider
Add go-git-providers proposal
2020-07-20 11:53:36 +03:00
Lucas Käldström
b1993d2fb7 Add Reconcile methods and TeamAccess struct. Mention ErrNotFound and ErrAlreadyExists. Add List() to TeamAccess. Rename GetTitle() to GetName() 2020-07-14 16:39:31 +03:00
Lucas Käldström
e8096dec88 Rename the Repository Teams and Credential clients 2020-07-14 16:39:25 +03:00
Lucas Käldström
39eee51ec8 Add extra goals of best practices 2020-07-14 16:39:14 +03:00
Lucas Käldström
7bb3a10795 Remove the URLParser, and Provider from the *Ref types 2020-07-14 16:39:02 +03:00
Lucas Käldström
4c684df653 Add go-git-providers proposal 2020-07-14 12:49:29 +03:00
149 changed files with 6112 additions and 1208 deletions

View File

@@ -1,6 +0,0 @@
FROM giantswarm/tiny-tools
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View File

@@ -1,9 +0,0 @@
name: 'kustomize'
description: 'A GitHub Action to run kustomize commands'
author: 'Stefan Prodan'
branding:
icon: 'command'
color: 'blue'
runs:
using: 'docker'
image: 'Dockerfile'

View File

@@ -1,12 +0,0 @@
#!/bin/sh -l
VERSION=3.5.4
curl -sL https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${VERSION}/kustomize_v${VERSION}_linux_amd64.tar.gz | tar xz
mkdir -p $GITHUB_WORKSPACE/bin
cp ./kustomize $GITHUB_WORKSPACE/bin
chmod +x $GITHUB_WORKSPACE/bin/kustomize
ls -lh $GITHUB_WORKSPACE/bin
echo "::add-path::$GITHUB_WORKSPACE/bin"
echo "::add-path::$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)/bin"

View File

@@ -14,29 +14,47 @@ jobs:
uses: actions/checkout@v1
- name: Copy assets
run: |
# source-controller CRDs
curl https://raw.githubusercontent.com/fluxcd/source-controller/master/docs/api/source.md > docs/components/source/api.md
curl https://raw.githubusercontent.com/fluxcd/source-controller/master/docs/spec/v1alpha1/gitrepositories.md > docs/components/source/gitrepositories.md
curl https://raw.githubusercontent.com/fluxcd/source-controller/master/docs/spec/v1alpha1/helmrepositories.md > docs/components/source/helmrepositories.md
curl https://raw.githubusercontent.com/fluxcd/source-controller/master/docs/spec/v1alpha1/helmcharts.md > docs/components/source/helmcharts.md
controller_version() {
sed -n "s/\(.*$1\/.*?ref=\)//p;n" "manifests/bases/$1/kustomization.yaml"
}
# kustomize-controller CRDs
curl https://raw.githubusercontent.com/fluxcd/kustomize-controller/master/docs/api/kustomize.md > docs/components/kustomize/api.md
curl https://raw.githubusercontent.com/fluxcd/kustomize-controller/master/docs/spec/v1alpha1/kustomization.md > docs/components/kustomize/kustomization.md
{
# source-controller CRDs
SOURCE_VER=$(controller_version source-controller)
curl -# -f "https://raw.githubusercontent.com/fluxcd/source-controller/$SOURCE_VER/docs/api/source.md" > docs/components/source/api.md
curl -# -f "https://raw.githubusercontent.com/fluxcd/source-controller/$SOURCE_VER/docs/spec/v1alpha1/gitrepositories.md" > docs/components/source/gitrepositories.md
curl -# -f "https://raw.githubusercontent.com/fluxcd/source-controller/$SOURCE_VER/docs/spec/v1alpha1/helmrepositories.md" > docs/components/source/helmrepositories.md
curl -# -f "https://raw.githubusercontent.com/fluxcd/source-controller/$SOURCE_VER/docs/spec/v1alpha1/helmcharts.md" > docs/components/source/helmcharts.md
}
# helm-controller CRDs
curl https://raw.githubusercontent.com/fluxcd/helm-controller/master/docs/api/helmrelease.md > docs/components/helm/api.md
curl https://raw.githubusercontent.com/fluxcd/helm-controller/master/docs/spec/v2alpha1/helmreleases.md > docs/components/helm/helmreleases.md
{
# kustomize-controller CRDs
KUSTOMIZE_VER=$(controller_version kustomize-controller)
curl -# -f "https://raw.githubusercontent.com/fluxcd/kustomize-controller/$KUSTOMIZE_VER/docs/api/kustomize.md" > docs/components/kustomize/api.md
curl -# -f "https://raw.githubusercontent.com/fluxcd/kustomize-controller/$KUSTOMIZE_VER/docs/spec/v1alpha1/kustomization.md" > docs/components/kustomize/kustomization.md
}
# notification-controller CRDs
curl https://raw.githubusercontent.com/fluxcd/notification-controller/master/docs/api/notification.md > docs/components/notification/api.md
curl https://raw.githubusercontent.com/fluxcd/notification-controller/master/docs/spec/v1alpha1/event.md > docs/components/notification/event.md
curl https://raw.githubusercontent.com/fluxcd/notification-controller/master/docs/spec/v1alpha1/alert.md > docs/components/notification/alert.md
curl https://raw.githubusercontent.com/fluxcd/notification-controller/master/docs/spec/v1alpha1/provider.md > docs/components/notification/provider.md
curl https://raw.githubusercontent.com/fluxcd/notification-controller/master/docs/spec/v1alpha1/receiver.md > docs/components/notification/receiver.md
{
# helm-controller CRDs
HELM_VER=$(controller_version helm-controller)
curl -# -f "https://raw.githubusercontent.com/fluxcd/helm-controller/$HELM_VER/docs/api/helmrelease.md" > docs/components/helm/api.md
curl -# -f "https://raw.githubusercontent.com/fluxcd/helm-controller/$HELM_VER/docs/spec/v2alpha1/helmreleases.md" > docs/components/helm/helmreleases.md
}
# install script
cp install/tk.sh docs/install.sh
{
# notification-controller CRDs
NOTIFICATION_VER=$(controller_version notification-controller)
curl -# -f "https://raw.githubusercontent.com/fluxcd/notification-controller/$NOTIFICATION_VER/docs/api/notification.md" > docs/components/notification/api.md
curl -# -f "https://raw.githubusercontent.com/fluxcd/notification-controller/$NOTIFICATION_VER/docs/spec/v1alpha1/event.md" > docs/components/notification/event.md
curl -# -f "https://raw.githubusercontent.com/fluxcd/notification-controller/$NOTIFICATION_VER/docs/spec/v1alpha1/alert.md" > docs/components/notification/alert.md
curl -# -f "https://raw.githubusercontent.com/fluxcd/notification-controller/$NOTIFICATION_VER/docs/spec/v1alpha1/provider.md" > docs/components/notification/provider.md
curl -# -f "https://raw.githubusercontent.com/fluxcd/notification-controller/$NOTIFICATION_VER/docs/spec/v1alpha1/receiver.md" > docs/components/notification/receiver.md
}
{
# install script
cp install/gotk.sh docs/install.sh
}
- name: Deploy docs
uses: mhausenblas/mkdocs-deploy-gh-pages@master
env:

View File

@@ -24,7 +24,9 @@ jobs:
with:
go-version: 1.14.x
- name: Setup Kubernetes
uses: engineerd/setup-kind@v0.3.0
uses: engineerd/setup-kind@v0.4.0
with:
image: kindest/node:v1.16.9
- name: Run test
run: make test
- name: Check if working tree is dirty
@@ -35,63 +37,95 @@ jobs:
exit 1
fi
- name: Build
run: sudo go build -o ./bin/tk ./cmd/tk
- name: tk check --pre
run: sudo go build -o ./bin/gotk ./cmd/gotk
- name: gotk check --pre
run: |
./bin/tk check --pre
- name: tk install --version
./bin/gotk check --pre
- name: gotk install --version
run: |
./bin/tk install --version=master --namespace=test --verbose --components="source-controller,kustomize-controller"
- name: tk uninstall
./bin/gotk install --version=master --namespace=test --verbose --components="source-controller,kustomize-controller"
- name: gotk uninstall
run: |
./bin/tk uninstall --namespace=test --crds --silent
- name: tk install --manifests
./bin/gotk uninstall --namespace=test --crds --silent
- name: gotk install --manifests
run: |
./bin/tk install --manifests ./manifests/install/ --version=""
- name: tk create source git
./bin/gotk install --manifests ./manifests/install/ --version=""
- name: gotk create source git
run: |
./bin/tk create source git podinfo \
./bin/gotk create source git podinfo \
--url https://github.com/stefanprodan/podinfo \
--tag-semver=">=3.2.3"
- name: tk get sources git
- name: gotk get sources git
run: |
./bin/tk get sources git
- name: tk create kustomization
./bin/gotk get sources git
- name: gotk create kustomization
run: |
./bin/tk create kustomization podinfo \
./bin/gotk create kustomization podinfo \
--source=podinfo \
--path="./deploy/overlays/dev" \
--prune=true \
--interval=5m \
--validate=client \
--validation=client \
--health-check="Deployment/frontend.dev" \
--health-check="Deployment/backend.dev" \
--health-check-timeout=3m
- name: tk sync kustomization --with-source
- name: gotk sync kustomization --with-source
run: |
./bin/tk reconcile kustomization podinfo --with-source
- name: tk get kustomizations
./bin/gotk reconcile kustomization podinfo --with-source
- name: gotk get kustomizations
run: |
./bin/tk get kustomizations
- name: tk suspend kustomization
./bin/gotk get kustomizations
- name: gotk suspend kustomization
run: |
./bin/tk suspend kustomization podinfo
- name: tk resume kustomization
./bin/gotk suspend kustomization podinfo
- name: gotk resume kustomization
run: |
./bin/tk resume kustomization podinfo
- name: tk export
./bin/gotk resume kustomization podinfo
- name: gotk export
run: |
./bin/tk export source git --all
./bin/tk export kustomization --all
- name: tk delete kustomization
./bin/gotk export source git --all
./bin/gotk export kustomization --all
- name: gotk delete kustomization
run: |
./bin/tk delete kustomization podinfo --silent
- name: tk delete source git
./bin/gotk delete kustomization podinfo --silent
- name: gotk create source helm
run: |
./bin/tk delete source git podinfo --silent
- name: tk check
./bin/gotk create source helm podinfo \
--url https://stefanprodan.github.io/podinfo
- name: gotk create helmrelease --source=HelmRepository/podinfo
run: |
./bin/tk check
./bin/gotk create hr podinfo-helm \
--target-namespace=default \
--source=HelmRepository/podinfo \
--chart=podinfo \
--chart-version=">4.0.0 <5.0.0"
- name: gotk create helmrelease --source=GitRepository/podinfo
run: |
./bin/gotk create hr podinfo-git \
--target-namespace=default \
--source=GitRepository/podinfo \
--chart=./charts/podinfo
- name: gotk get helmreleases
run: |
./bin/gotk get helmreleases
- name: gotk export helmrelease
run: |
./bin/gotk export hr --all
- name: gotk delete helmrelease podinfo-helm
run: |
./bin/gotk delete hr podinfo-helm --silent
- name: gotk delete helmrelease podinfo-git
run: |
./bin/gotk delete hr podinfo-git --silent
- name: gotk delete source helm
run: |
./bin/gotk delete source helm podinfo --silent
- name: gotk delete source git
run: |
./bin/gotk delete source git podinfo --silent
- name: gotk check
run: |
./bin/gotk check
- name: Debug failure
if: failure()
run: |

View File

@@ -24,9 +24,9 @@ jobs:
- name: Generate release notes
run: |
echo 'CHANGELOG' > /tmp/release.txt
github-release-notes -org fluxcd -repo toolkit -since-latest-release >> /tmp/release.txt
github-release-notes -org fluxcd -repo toolkit -since-latest-release -include-author >> /tmp/release.txt
- name: Setup Kustomize
uses: ./.github/actions/kustomize
uses: fluxcd/pkg//actions/kustomize@master
- name: Generate manifests tarball
run: |
mkdir -p ./output

73
.github/workflows/update.yml vendored Normal file
View File

@@ -0,0 +1,73 @@
name: Update Components
on:
schedule:
- cron: "*/10 * * * *"
jobs:
update-components:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Update component versions
id: update
run: |
PR_BODY=""
bump_version() {
local RELEASE_VERSION=$(curl -s https://api.github.com/repos/fluxcd/$1/releases | jq -r 'sort_by(.published_at) | .[-1] | .tag_name')
local CURRENT_VERSION=$(sed -n "s/\(.*$1\/.*?ref=\)//p;n" "manifests/bases/$1/kustomization.yaml")
if [[ "${RELEASE_VERSION}" != "${CURRENT_VERSION}" ]]; then
# bump kustomize
sed -i "s/\($1\/.*?ref=\).*/\1${RELEASE_VERSION}/g" "manifests/bases/$1/kustomization.yaml"
if [[ ! -z $(go list -m all | grep "github.com/fluxcd/$1/api" | awk '{print $2}') ]]; then
# bump go mod
go mod edit -require="github.com/fluxcd/$1/api@${RELEASE_VERSION}"
fi
PR_BODY="$PR_BODY- $1 to ${RELEASE_VERSION}%0A"
fi
}
{
# bump controller versions
bump_version helm-controller
bump_version kustomize-controller
bump_version source-controller
bump_version notification-controller
# add missing and remove unused modules
go mod tidy
# diff change
git diff
# export PR_BODY for PR
echo "::set-output name=pr_body::$PR_BODY"
}
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update toolkit components
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
title: Update toolkit components
body: |
${{ steps.update.outputs.pr_body }}
Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
branch: update-components
reviewers: ${{ secrets.ASSIGNEES }}
- name: Check output
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"

View File

@@ -1,13 +1,14 @@
builds:
- main: ./cmd/tk
- main: ./cmd/gotk
ldflags:
- -s -w -X main.VERSION={{ .Version }}
binary: tk
binary: gotk
goos:
- darwin
- linux
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=0
archives:

View File

@@ -18,16 +18,39 @@ organization.
## Communications
The project uses Slack: To join the conversation, simply join the
[CNCF](https://slack.cncf.io/) Slack workspace and use the
For realtime communications we use Slack: To join the conversation, simply
join the [CNCF](https://slack.cncf.io/) Slack workspace and use the
[#flux-dev](https://cloud-native.slack.com/messages/flux-dev/) channel.
The developers use a mailing list to discuss development as well.
Simply subscribe to [flux-dev on cncf.io](https://lists.cncf.io/g/cncf-flux-dev)
to join the conversation (this will also add an invitation to your
Google calendar for our [Flux
To discuss ideas and specifications we use [Github
Discussions](https://github.com/fluxcd/toolkit/discussions).
For announcements we use a mailing list as well. Simply subscribe to
[flux-dev on cncf.io](https://lists.cncf.io/g/cncf-flux-dev)
to join the conversation (there you can also add calendar invites
to your Google calendar for our [Flux
meeting](https://docs.google.com/document/d/1l_M0om0qUEN_NNiGgpqJ2tvsF2iioHkaARDeh6b70B0/edit#)).
## Understanding the GitOps Toolkit
If you are entirely new to the GitOps Toolkit,
you might want to take a look at the [introductory talk and demo](https://www.youtube.com/watch?v=qQBtSkgl7tI).
This project is composed of:
- [/f/toolkit](https://github.com/fluxcd/toolkit): The GitOps Toolkit CLI
- [/f/source-manager](https://github.com/fluxcd/source-controller): Kubernetes operator for managing sources
- [/f/kustomize-controller](https://github.com/fluxcd/kustomize-controller): Kubernetes operator for building GitOps pipelines with Kustomize
- [/f/helm-controller](https://github.com/fluxcd/helm-controller): Kubernetes operator for building GitOps pipelines with Helm
- [/f/notification-controller](https://github.com/fluxcd/notification-controller): Kubernetes operator for handling inbound and outbound events
### Understanding the code
To get started with developing controllers, you might want to review
[our guide](https://toolkit.fluxcd.io/dev-guides/source-watcher/) which
walks you through writing a short and concise controller that watches out
for source changes.
### How to run the test suite
You can run the unit tests by simply doing
@@ -66,16 +89,3 @@ For the GitOps Toolkit controllers we prefer the following rules for good commit
The [following article](https://chris.beams.io/posts/git-commit/#seven-rules)
has some more helpful advice on documenting your work.
## Understanding the GitOps Toolkit
If you are entirely new to the GitOps Toolkit,
you might want to take a look at the [introductory talk and demo](https://www.youtube.com/watch?v=qQBtSkgl7tI).
This project is composed of:
- [/f/toolkit](https://github.com/fluxcd/toolkit): The GitOps Toolkit CLI
- [/f/source-manager](https://github.com/fluxcd/source-controller): Kubernetes operator for managing sources
- [/f/kustomize-controller](https://github.com/fluxcd/kustomize-controller): Kubernetes operator for building GitOps pipelines with Kustomize
- [/f/helm-controller](https://github.com/fluxcd/helm-controller): Kubernetes operator for building GitOps pipelines with Helm
- [/f/notification-controller](https://github.com/fluxcd/notification-controller): Kubernetes operator for handling inbound and outbound events

View File

@@ -1,4 +1,4 @@
VERSION?=$(shell grep 'VERSION' cmd/tk/main.go | awk '{ print $$4 }' | tr -d '"')
VERSION?=$(shell grep 'VERSION' cmd/gotk/main.go | awk '{ print $$4 }' | tr -d '"')
all: test build
@@ -15,14 +15,14 @@ test: tidy fmt vet docs
go test ./... -coverprofile cover.out
build:
CGO_ENABLED=0 go build -o ./bin/tk ./cmd/tk
CGO_ENABLED=0 go build -o ./bin/gotk ./cmd/gotk
install:
go install cmd/tk
go install cmd/gotk
.PHONY: docs
docs:
mkdir -p ./docs/cmd && go run ./cmd/tk/ docgen
mkdir -p ./docs/cmd && go run ./cmd/gotk/ docgen
install-dev:
CGO_ENABLED=0 go build -o /usr/local/bin ./cmd/tk
CGO_ENABLED=0 go build -o /usr/local/bin ./cmd/gotk

View File

@@ -7,6 +7,6 @@
Experimental toolkit for assembling CD pipelines the GitOps way.
![overview](docs/diagrams/tk-feature.png)
![overview](docs/diagrams/gotk-feature.png)
To get started with the toolkit please read the [docs](https://toolkit.fluxcd.io/).

View File

@@ -23,7 +23,6 @@ import (
"os"
"path"
"path/filepath"
"sigs.k8s.io/yaml"
"strings"
"time"
@@ -33,6 +32,7 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/yaml"
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1alpha1"
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
@@ -45,8 +45,11 @@ var bootstrapCmd = &cobra.Command{
}
var (
bootstrapVersion string
bootstrapComponents []string
bootstrapVersion string
bootstrapComponents []string
bootstrapRegistry string
bootstrapImagePullSecret string
bootstrapArch string
)
const (
@@ -61,19 +64,24 @@ func init() {
"toolkit version")
bootstrapCmd.PersistentFlags().StringSliceVar(&bootstrapComponents, "components", defaultComponents,
"list of components, accepts comma-separated values")
bootstrapCmd.PersistentFlags().StringVar(&bootstrapRegistry, "registry", "ghcr.io/fluxcd",
"container registry where the toolkit images are published")
bootstrapCmd.PersistentFlags().StringVar(&bootstrapImagePullSecret, "image-pull-secret", "",
"Kubernetes secret name used for pulling the toolkit images from a private registry")
bootstrapCmd.PersistentFlags().StringVar(&bootstrapArch, "arch", "amd64",
"arch can be amd64 or arm64")
rootCmd.AddCommand(bootstrapCmd)
}
func generateInstallManifests(targetPath, namespace, tmpDir string) (string, error) {
tkDir := path.Join(tmpDir, ".tk")
defer os.RemoveAll(tkDir)
gotkDir := path.Join(tmpDir, ".gotk")
defer os.RemoveAll(gotkDir)
if err := os.MkdirAll(tkDir, os.ModePerm); err != nil {
if err := os.MkdirAll(gotkDir, os.ModePerm); err != nil {
return "", fmt.Errorf("generating manifests failed: %w", err)
}
if err := genInstallManifests(bootstrapVersion, namespace, bootstrapComponents, tkDir); err != nil {
if err := genInstallManifests(bootstrapVersion, namespace, bootstrapComponents, bootstrapRegistry, bootstrapImagePullSecret, bootstrapArch, gotkDir); err != nil {
return "", fmt.Errorf("generating manifests failed: %w", err)
}
@@ -83,7 +91,7 @@ func generateInstallManifests(targetPath, namespace, tmpDir string) (string, err
}
manifest := path.Join(manifestsDir, bootstrapInstallManifest)
if err := buildKustomization(tkDir, manifest); err != nil {
if err := buildKustomization(gotkDir, manifest); err != nil {
return "", fmt.Errorf("build kustomization failed: %w", err)
}

View File

@@ -42,19 +42,19 @@ the bootstrap command will perform an upgrade if needed.`,
export GITHUB_TOKEN=<my-token>
# Run bootstrap for a private repo owned by a GitHub organization
bootstrap github --owner=<organization> --repository=<repo name>
gotk bootstrap github --owner=<organization> --repository=<repo name>
# Run bootstrap for a private repo and assign organization teams to it
bootstrap github --owner=<organization> --repository=<repo name> --team=<team1 slug> --team=<team2 slug>
gotk bootstrap github --owner=<organization> --repository=<repo name> --team=<team1 slug> --team=<team2 slug>
# Run bootstrap for a repository path
bootstrap github --owner=<organization> --repository=<repo name> --path=dev-cluster
gotk bootstrap github --owner=<organization> --repository=<repo name> --path=dev-cluster
# Run bootstrap for a public repository on a personal account
bootstrap github --owner=<user> --repository=<repo name> --private=false --personal=true
gotk bootstrap github --owner=<user> --repository=<repo name> --private=false --personal=true
# Run bootstrap for a private repo hosted on GitHub Enterprise
bootstrap github --owner=<organization> --repository=<repo name> --hostname=<domain>
gotk bootstrap github --owner=<organization> --repository=<repo name> --hostname=<domain>
`,
RunE: bootstrapGitHubCmdRun,
}
@@ -93,7 +93,11 @@ func bootstrapGitHubCmdRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("%s environment variable not found", git.GitHubTokenName)
}
repository, err := git.NewRepository(ghRepository, ghOwner, ghHostname, ghToken, "tk", ghOwner+"@users.noreply.github.com")
if !utils.containsItemString(supportedArch, bootstrapArch) {
return fmt.Errorf("arch %s is not supported, can be %v", bootstrapArch, supportedArch)
}
repository, err := git.NewRepository(ghRepository, ghOwner, ghHostname, ghToken, "gotk", ghOwner+"@users.noreply.github.com")
if err != nil {
return err
}
@@ -194,9 +198,9 @@ func bootstrapGitHubCmdRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("generating deploy key failed: %w", err)
}
keyName := "tk"
keyName := "gotk"
if ghPath != "" {
keyName = fmt.Sprintf("tk-%s", ghPath)
keyName = fmt.Sprintf("gotk-%s", ghPath)
}
if changed, err := provider.AddDeployKey(ctx, repository, key, keyName); err != nil {

View File

@@ -42,28 +42,29 @@ the bootstrap command will perform an upgrade if needed.`,
export GITLAB_TOKEN=<my-token>
# Run bootstrap for a private repo owned by a GitLab group
bootstrap gitlab --owner=<group> --repository=<repo name>
gotk bootstrap gitlab --owner=<group> --repository=<repo name>
# Run bootstrap for a repository path
bootstrap gitlab --owner=<group> --repository=<repo name> --path=dev-cluster
gotk bootstrap gitlab --owner=<group> --repository=<repo name> --path=dev-cluster
# Run bootstrap for a public repository on a personal account
bootstrap gitlab --owner=<user> --repository=<repo name> --private=false --personal=true
gotk bootstrap gitlab --owner=<user> --repository=<repo name> --private=false --personal=true
# Run bootstrap for a private repo hosted on a GitLab server
bootstrap gitlab --owner=<group> --repository=<repo name> --hostname=<domain>
gotk bootstrap gitlab --owner=<group> --repository=<repo name> --hostname=<domain>
`,
RunE: bootstrapGitLabCmdRun,
}
var (
glOwner string
glRepository string
glInterval time.Duration
glPersonal bool
glPrivate bool
glHostname string
glPath string
glOwner string
glRepository string
glInterval time.Duration
glPersonal bool
glPrivate bool
glHostname string
glSSHHostname string
glPath string
)
func init() {
@@ -73,6 +74,7 @@ func init() {
bootstrapGitLabCmd.Flags().BoolVar(&glPrivate, "private", true, "is private repository")
bootstrapGitLabCmd.Flags().DurationVar(&glInterval, "interval", time.Minute, "sync interval")
bootstrapGitLabCmd.Flags().StringVar(&glHostname, "hostname", git.GitLabDefaultHostname, "GitLab hostname")
bootstrapGitLabCmd.Flags().StringVar(&glSSHHostname, "ssh-hostname", "", "GitLab SSH hostname, defaults to hostname if not specified")
bootstrapGitLabCmd.Flags().StringVar(&glPath, "path", "", "repository path, when specified the cluster sync will be scoped to this path")
bootstrapCmd.AddCommand(bootstrapGitLabCmd)
@@ -84,11 +86,19 @@ func bootstrapGitLabCmdRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("%s environment variable not found", git.GitLabTokenName)
}
repository, err := git.NewRepository(glRepository, glOwner, glHostname, glToken, "tk", glOwner+"@users.noreply.gitlab.com")
if !utils.containsItemString(supportedArch, bootstrapArch) {
return fmt.Errorf("arch %s is not supported, can be %v", bootstrapArch, supportedArch)
}
repository, err := git.NewRepository(glRepository, glOwner, glHostname, glToken, "gotk", glOwner+"@users.noreply.gitlab.com")
if err != nil {
return err
}
if glSSHHostname != "" {
repository.SSHHost = glSSHHostname
}
provider := &git.GitLabProvider{
IsPrivate: glPrivate,
IsPersonal: glPersonal,
@@ -172,9 +182,9 @@ func bootstrapGitLabCmdRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("generating deploy key failed: %w", err)
}
keyName := "tk"
keyName := "gotk"
if glPath != "" {
keyName = fmt.Sprintf("tk-%s", glPath)
keyName = fmt.Sprintf("gotk-%s", glPath)
}
if changed, err := provider.AddDeployKey(ctx, repository, key, keyName); err != nil {

View File

@@ -35,10 +35,10 @@ var checkCmd = &cobra.Command{
Long: `The check command will perform a series of checks to validate that
the local environment is configured correctly and if the installed components are healthy.`,
Example: ` # Run pre-installation checks
tk check --pre
gotk check --pre
# Run installation checks
tk check
gotk check
`,
RunE: runCheckCmd,
}
@@ -67,7 +67,7 @@ func runCheckCmd(cmd *cobra.Command, args []string) error {
checkFailed = true
}
if !kubernetesCheck(">=1.14.0") {
if !kubernetesCheck(">=1.16.0") {
checkFailed = true
}

View File

@@ -27,12 +27,12 @@ var completionCmd = &cobra.Command{
Short: "Generates bash completion scripts",
Example: `To load completion run
. <(tk completion)
. <(gotk completion)
To configure your bash shell to load completions for each session add to your bashrc
# ~/.bashrc or ~/.profile
. <(tk completion)
. <(gotk completion)
`,
Run: func(cmd *cobra.Command, args []string) {
rootCmd.GenBashCompletion(os.Stdout)

View File

@@ -0,0 +1,276 @@
/*
Copyright 2020 The Flux CD contributors.
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"
"io/ioutil"
"strings"
"github.com/spf13/cobra"
corev1 "k8s.io/api/core/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/apimachinery/pkg/api/errors"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/yaml"
helmv2 "github.com/fluxcd/helm-controller/api/v2alpha1"
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
)
var createHelmReleaseCmd = &cobra.Command{
Use: "helmrelease [name]",
Aliases: []string{"hr"},
Short: "Create or update a HelmRelease resource",
Long: "The helmrelease create command generates a HelmRelease resource for a given HelmRepository source.",
Example: ` # Create a HelmRelease with a chart from a HelmRepository source
gotk create hr podinfo \
--interval=10m \
--source=HelmRepository/podinfo \
--chart=podinfo \
--chart-version=">4.0.0"
# Create a HelmRelease with a chart from a GitRepository source
gotk create hr podinfo \
--interval=10m \
--source=GitRepository/podinfo \
--chart=./charts/podinfo
# Create a HelmRelease with values from a local YAML file
gotk create hr podinfo \
--source=HelmRepository/podinfo \
--chart=podinfo \
--values=./my-values.yaml
# Create a HelmRelease with a custom release name
gotk create hr podinfo \
--release-name=podinfo-dev
--source=HelmRepository/podinfo \
--chart=podinfo \
# Create a HelmRelease targeting another namespace than the resource
gotk create hr podinfo \
--target-namespace=default \
--source=HelmRepository/podinfo \
--chart=podinfo
# Create a HelmRelease definition on disk without applying it on the cluster
gotk create hr podinfo \
--source=HelmRepository/podinfo \
--chart=podinfo \
--values=./values.yaml \
--export > podinfo-release.yaml
`,
RunE: createHelmReleaseCmdRun,
}
var (
hrName string
hrSource string
hrDependsOn []string
hrChart string
hrChartVersion string
hrTargetNamespace string
hrValuesFile string
)
func init() {
createHelmReleaseCmd.Flags().StringVar(&hrName, "release-name", "", "name used for the Helm release, defaults to a composition of '[<target-namespace>-]<hr-name>'")
createHelmReleaseCmd.Flags().StringVar(&hrSource, "source", "", "source that contains the chart (<kind>/<name>)")
createHelmReleaseCmd.Flags().StringVar(&hrChart, "chart", "", "Helm chart name or path")
createHelmReleaseCmd.Flags().StringVar(&hrChartVersion, "chart-version", "", "Helm chart version, accepts a semver range (ignored for charts from GitRepository sources)")
createHelmReleaseCmd.Flags().StringArrayVar(&hrDependsOn, "depends-on", nil, "HelmReleases that must be ready before this release can be installed")
createHelmReleaseCmd.Flags().StringVar(&hrTargetNamespace, "target-namespace", "", "namespace to install this release, defaults to the HelmRelease namespace")
createHelmReleaseCmd.Flags().StringVar(&hrValuesFile, "values", "", "local path to the values.yaml file")
createCmd.AddCommand(createHelmReleaseCmd)
}
func createHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("release name is required")
}
name := args[0]
if hrSource == "" {
return fmt.Errorf("source is required")
}
hrSourceElements := strings.Split(hrSource, "/")
if len(hrSourceElements) != 2 {
return fmt.Errorf("source must be in format <kind>/<name>")
}
hrSourceKind, hrSourceName := hrSourceElements[0], hrSourceElements[1]
if hrSourceKind != sourcev1.HelmRepositoryKind && hrSourceKind != sourcev1.GitRepositoryKind {
return fmt.Errorf("source kind must be one of: %s", []string{sourcev1.HelmRepositoryKind, sourcev1.GitRepositoryKind})
}
if hrChart == "" {
return fmt.Errorf("chart name or path is required")
}
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
kubeClient, err := utils.kubeClient(kubeconfig)
if err != nil {
return err
}
if !export {
logger.Generatef("generating release")
}
helmRelease := helmv2.HelmRelease{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: namespace,
},
Spec: helmv2.HelmReleaseSpec{
ReleaseName: hrName,
DependsOn: hrDependsOn,
Interval: metav1.Duration{
Duration: interval,
},
TargetNamespace: hrTargetNamespace,
Chart: helmv2.HelmChartTemplate{
Spec: helmv2.HelmChartTemplateSpec{
Chart: hrChart,
Version: hrChartVersion,
SourceRef: helmv2.CrossNamespaceObjectReference{
Kind: hrSourceKind,
Name: hrSourceName,
},
},
},
Suspend: false,
},
}
if hrValuesFile != "" {
data, err := ioutil.ReadFile(hrValuesFile)
if err != nil {
return fmt.Errorf("reading values from %s failed: %w", hrValuesFile, err)
}
json, err := yaml.YAMLToJSON(data)
if err != nil {
return fmt.Errorf("converting values to JSON from %s failed: %w", hrValuesFile, err)
}
helmRelease.Spec.Values = &apiextensionsv1.JSON{Raw: json}
}
if export {
return exportHelmRelease(helmRelease)
}
logger.Actionf("applying release")
if err := upsertHelmRelease(ctx, kubeClient, helmRelease); err != nil {
return err
}
logger.Waitingf("waiting for reconciliation")
chartName := fmt.Sprintf("%s-%s", namespace, name)
if err := wait.PollImmediate(pollInterval, timeout,
isHelmChartReady(ctx, kubeClient, chartName, namespace)); err != nil {
return err
}
if err := wait.PollImmediate(pollInterval, timeout,
isHelmReleaseReady(ctx, kubeClient, name, namespace)); err != nil {
return err
}
logger.Successf("release %s is ready", name)
namespacedName := types.NamespacedName{
Namespace: namespace,
Name: name,
}
err = kubeClient.Get(ctx, namespacedName, &helmRelease)
if err != nil {
return fmt.Errorf("release failed: %w", err)
}
if helmRelease.Status.LastAppliedRevision != "" {
logger.Successf("applied revision %s", helmRelease.Status.LastAppliedRevision)
} else {
return fmt.Errorf("reconciliation failed")
}
return nil
}
func upsertHelmRelease(ctx context.Context, kubeClient client.Client, helmRelease helmv2.HelmRelease) error {
namespacedName := types.NamespacedName{
Namespace: helmRelease.GetNamespace(),
Name: helmRelease.GetName(),
}
var existing helmv2.HelmRelease
err := kubeClient.Get(ctx, namespacedName, &existing)
if err != nil {
if errors.IsNotFound(err) {
if err := kubeClient.Create(ctx, &helmRelease); err != nil {
return err
} else {
logger.Successf("release created")
return nil
}
}
return err
}
existing.Spec = helmRelease.Spec
if err := kubeClient.Update(ctx, &existing); err != nil {
return err
}
logger.Successf("release updated")
return nil
}
func isHelmChartReady(ctx context.Context, kubeClient client.Client, name, namespace string) wait.ConditionFunc {
return func() (bool, error) {
var helmChart sourcev1.HelmChart
namespacedName := types.NamespacedName{
Namespace: namespace,
Name: name,
}
err := kubeClient.Get(ctx, namespacedName, &helmChart)
if err != nil {
if apierrors.IsNotFound(err) {
return false, nil
}
return false, err
}
for _, condition := range helmChart.Status.Conditions {
if condition.Type == helmv2.ReadyCondition {
if condition.Status == corev1.ConditionTrue {
return true, nil
} else if condition.Status == corev1.ConditionFalse {
return false, fmt.Errorf(condition.Message)
}
}
}
return false, nil
}
}

View File

@@ -40,32 +40,32 @@ var createKsCmd = &cobra.Command{
Short: "Create or update a Kustomization resource",
Long: "The kustomization source create command generates a Kustomize resource for a given GitRepository source.",
Example: ` # Create a Kustomization resource from a source at a given path
create kustomization contour \
gotk create kustomization contour \
--source=contour \
--path="./examples/contour/" \
--prune=true \
--interval=10m \
--validate=client \
--validation=client \
--health-check="Deployment/contour.projectcontour" \
--health-check="DaemonSet/envoy.projectcontour" \
--health-check-timeout=3m
# Create a Kustomization resource that depends on the previous one
create kustomization webapp \
gotk create kustomization webapp \
--depends-on=contour \
--source=webapp \
--path="./deploy/overlays/dev" \
--prune=true \
--interval=5m \
--validate=client
--validation=client
# Create a Kustomization resource that runs under a service account
create kustomization webapp \
gotk create kustomization webapp \
--source=webapp \
--path="./deploy/overlays/staging" \
--prune=true \
--interval=5m \
--validate=client \
--validation=client \
--sa-name=reconclier \
--sa-namespace=staging
`,
@@ -77,7 +77,7 @@ var (
ksPath string
ksPrune bool
ksDependsOn []string
ksValidate string
ksValidation string
ksHealthCheck []string
ksHealthTimeout time.Duration
ksSAName string
@@ -90,7 +90,7 @@ func init() {
createKsCmd.Flags().BoolVar(&ksPrune, "prune", false, "enable garbage collection")
createKsCmd.Flags().StringArrayVar(&ksHealthCheck, "health-check", nil, "workload to be included in the health assessment, in the format '<kind>/<name>.<namespace>'")
createKsCmd.Flags().DurationVar(&ksHealthTimeout, "health-check-timeout", 2*time.Minute, "timeout of health checking operations")
createKsCmd.Flags().StringVar(&ksValidate, "validate", "", "validate the manifests before applying them on the cluster, can be 'client' or 'server'")
createKsCmd.Flags().StringVar(&ksValidation, "validation", "", "validate the manifests before applying them on the cluster, can be 'client' or 'server'")
createKsCmd.Flags().StringArrayVar(&ksDependsOn, "depends-on", nil, "Kustomization that must be ready before this Kustomization can be applied")
createKsCmd.Flags().StringVar(&ksSAName, "sa-name", "", "service account name")
createKsCmd.Flags().StringVar(&ksSANamespace, "sa-namespace", "", "service account namespace")
@@ -113,14 +113,6 @@ func createKsCmdRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("path must begin with ./")
}
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
kubeClient, err := utils.kubeClient(kubeconfig)
if err != nil {
return err
}
if !export {
logger.Generatef("generating kustomization")
}
@@ -142,7 +134,7 @@ func createKsCmdRun(cmd *cobra.Command, args []string) error {
Name: ksSource,
},
Suspend: false,
Validation: ksValidate,
Validation: ksValidation,
},
}
@@ -190,6 +182,14 @@ func createKsCmdRun(cmd *cobra.Command, args []string) error {
return exportKs(kustomization)
}
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
kubeClient, err := utils.kubeClient(kubeconfig)
if err != nil {
return err
}
logger.Actionf("applying kustomization")
if err := upsertKustomization(ctx, kubeClient, kustomization); err != nil {
return err

View File

@@ -46,35 +46,35 @@ The create source git command generates a GitRepository resource and waits for i
For Git over SSH, host and SSH keys are automatically generated and stored in a Kubernetes secret.
For private Git repositories, the basic authentication credentials are stored in a Kubernetes secret.`,
Example: ` # Create a source from a public Git repository master branch
create source git podinfo \
gotk create source git podinfo \
--url=https://github.com/stefanprodan/podinfo \
--branch=master
# Create a source from a Git repository pinned to specific git tag
create source git podinfo \
gotk create source git podinfo \
--url=https://github.com/stefanprodan/podinfo \
--tag="3.2.3"
# Create a source from a public Git repository tag that matches a semver range
create source git podinfo \
gotk create source git podinfo \
--url=https://github.com/stefanprodan/podinfo \
--tag-semver=">=3.2.0 <3.3.0"
# Create a source from a Git repository using SSH authentication
create source git podinfo \
gotk create source git podinfo \
--url=ssh://git@github.com/stefanprodan/podinfo \
--branch=master
# Create a source from a Git repository using SSH authentication and an
# ECDSA P-521 curve public key
create source git podinfo \
gotk create source git podinfo \
--url=ssh://git@github.com/stefanprodan/podinfo \
--branch=master \
--ssh-key-algorithm=ecdsa \
--ssh-ecdsa-curve=p521
# Create a source from a Git repository using basic authentication
create source git podinfo \
gotk create source git podinfo \
--url=https://github.com/stefanprodan/podinfo \
--username=username \
--password=password
@@ -115,7 +115,7 @@ func createSourceGitCmdRun(cmd *cobra.Command, args []string) error {
name := args[0]
if sourceGitURL == "" {
return fmt.Errorf("git-url is required")
return fmt.Errorf("url is required")
}
tmpDir, err := ioutil.TempDir("", name)
@@ -129,14 +129,6 @@ func createSourceGitCmdRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("git URL parse failed: %w", err)
}
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
kubeClient, err := utils.kubeClient(kubeconfig)
if err != nil {
return err
}
gitRepository := sourcev1.GitRepository{
ObjectMeta: metav1.ObjectMeta{
Name: name,
@@ -163,6 +155,14 @@ func createSourceGitCmdRun(cmd *cobra.Command, args []string) error {
return exportGit(gitRepository)
}
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
kubeClient, err := utils.kubeClient(kubeconfig)
if err != nil {
return err
}
withAuth := false
// TODO(hidde): move all auth prep to separate func?
if u.Scheme == "ssh" {

View File

@@ -0,0 +1,259 @@
/*
Copyright 2020 The Flux CD contributors.
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"
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
"github.com/spf13/cobra"
"io/ioutil"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"
"net/url"
"os"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/yaml"
)
var createSourceHelmCmd = &cobra.Command{
Use: "helm [name]",
Short: "Create or update a HelmRepository source",
Long: `
The create source helm command generates a HelmRepository resource and waits for it to fetch the index.
For private Helm repositories, the basic authentication credentials are stored in a Kubernetes secret.`,
Example: ` # Create a source from a public Helm repository
gotk create source helm podinfo \
--url=https://stefanprodan.github.io/podinfo \
--interval=10m
# Create a source from a Helm repository using basic authentication
gotk create source helm podinfo \
--url=https://stefanprodan.github.io/podinfo \
--username=username \
--password=password
# Create a source from a Helm repository using TLS authentication
gotk create source helm podinfo \
--url=https://stefanprodan.github.io/podinfo \
--cert-file=./cert.crt \
--key-file=./key.crt \
--ca-file=./ca.crt
`,
RunE: createSourceHelmCmdRun,
}
var (
sourceHelmURL string
sourceHelmUsername string
sourceHelmPassword string
sourceHelmCertFile string
sourceHelmKeyFile string
sourceHelmCAFile string
)
func init() {
createSourceHelmCmd.Flags().StringVar(&sourceHelmURL, "url", "", "Helm repository address")
createSourceHelmCmd.Flags().StringVarP(&sourceHelmUsername, "username", "u", "", "basic authentication username")
createSourceHelmCmd.Flags().StringVarP(&sourceHelmPassword, "password", "p", "", "basic authentication password")
createSourceHelmCmd.Flags().StringVar(&sourceHelmCertFile, "cert-file", "", "TLS authentication cert file path")
createSourceHelmCmd.Flags().StringVar(&sourceHelmKeyFile, "key-file", "", "TLS authentication key file path")
createSourceHelmCmd.Flags().StringVar(&sourceHelmCAFile, "ca-file", "", "TLS authentication CA file path")
createSourceCmd.AddCommand(createSourceHelmCmd)
}
func createSourceHelmCmdRun(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("source name is required")
}
name := args[0]
secretName := fmt.Sprintf("helm-%s", name)
if sourceHelmURL == "" {
return fmt.Errorf("url is required")
}
tmpDir, err := ioutil.TempDir("", name)
if err != nil {
return err
}
defer os.RemoveAll(tmpDir)
if _, err := url.Parse(sourceHelmURL); err != nil {
return fmt.Errorf("url parse failed: %w", err)
}
helmRepository := sourcev1.HelmRepository{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: namespace,
},
Spec: sourcev1.HelmRepositorySpec{
URL: sourceHelmURL,
Interval: metav1.Duration{
Duration: interval,
},
},
}
if export {
return exportHelmRepository(helmRepository)
}
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
kubeClient, err := utils.kubeClient(kubeconfig)
if err != nil {
return err
}
logger.Generatef("generating source")
secret := corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: secretName,
Namespace: namespace,
},
StringData: map[string]string{},
}
if sourceHelmUsername != "" && sourceHelmPassword != "" {
secret.StringData["username"] = sourceHelmUsername
secret.StringData["password"] = sourceHelmPassword
}
if sourceHelmCertFile != "" && sourceHelmKeyFile != "" {
cert, err := ioutil.ReadFile(sourceHelmCertFile)
if err != nil {
return fmt.Errorf("failed to read repository cert file '%s': %w", sourceHelmCertFile, err)
}
secret.StringData["certFile"] = string(cert)
key, err := ioutil.ReadFile(sourceHelmKeyFile)
if err != nil {
return fmt.Errorf("failed to read repository key file '%s': %w", sourceHelmKeyFile, err)
}
secret.StringData["keyFile"] = string(key)
}
if sourceHelmCAFile != "" {
ca, err := ioutil.ReadFile(sourceHelmCAFile)
if err != nil {
return fmt.Errorf("failed to read repository CA file '%s': %w", sourceHelmCAFile, err)
}
secret.StringData["caFile"] = string(ca)
}
if len(secret.StringData) > 0 {
logger.Actionf("applying secret with repository credentials")
if err := upsertSecret(ctx, kubeClient, secret); err != nil {
return err
}
helmRepository.Spec.SecretRef = &corev1.LocalObjectReference{
Name: secretName,
}
logger.Successf("authentication configured")
}
logger.Actionf("applying source")
if err := upsertHelmRepository(ctx, kubeClient, helmRepository); err != nil {
return err
}
logger.Waitingf("waiting for index download")
if err := wait.PollImmediate(pollInterval, timeout,
isHelmRepositoryReady(ctx, kubeClient, name, namespace)); err != nil {
return err
}
logger.Successf("index download completed")
namespacedName := types.NamespacedName{
Namespace: namespace,
Name: name,
}
err = kubeClient.Get(ctx, namespacedName, &helmRepository)
if err != nil {
return fmt.Errorf("helm index failed: %w", err)
}
if helmRepository.Status.Artifact != nil {
logger.Successf("fetched revision: %s", helmRepository.Status.Artifact.Revision)
} else {
return fmt.Errorf("index download failed, artifact not found")
}
return nil
}
func upsertHelmRepository(ctx context.Context, kubeClient client.Client, helmRepository sourcev1.HelmRepository) error {
namespacedName := types.NamespacedName{
Namespace: helmRepository.GetNamespace(),
Name: helmRepository.GetName(),
}
var existing sourcev1.HelmRepository
err := kubeClient.Get(ctx, namespacedName, &existing)
if err != nil {
if errors.IsNotFound(err) {
if err := kubeClient.Create(ctx, &helmRepository); err != nil {
return err
} else {
logger.Successf("source created")
return nil
}
}
return err
}
existing.Spec = helmRepository.Spec
if err := kubeClient.Update(ctx, &existing); err != nil {
return err
}
logger.Successf("source updated")
return nil
}
func exportHelmRepository(source sourcev1.HelmRepository) error {
gvk := sourcev1.GroupVersion.WithKind(sourcev1.HelmRepositoryKind)
export := sourcev1.HelmRepository{
TypeMeta: metav1.TypeMeta{
Kind: gvk.Kind,
APIVersion: gvk.GroupVersion().String(),
},
ObjectMeta: metav1.ObjectMeta{
Name: source.Name,
Namespace: source.Namespace,
},
Spec: source.Spec,
}
data, err := yaml.Marshal(export)
if err != nil {
return err
}
fmt.Println("---")
fmt.Println(string(data))
return nil
}

View File

@@ -0,0 +1,91 @@
/*
Copyright 2020 The Flux CD contributors.
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"
"github.com/manifoldco/promptui"
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/types"
helmv2 "github.com/fluxcd/helm-controller/api/v2alpha1"
)
var deleteHelmReleaseCmd = &cobra.Command{
Use: "helmrelease [name]",
Aliases: []string{"hr"},
Short: "Delete a HelmRelease resource",
Long: "The delete helmrelease command removes the given HelmRelease from the cluster.",
Example: ` # Delete a Helm release and the Kubernetes resources created by it
gotk delete hr podinfo
`,
RunE: deleteHelmReleaseCmdRun,
}
func init() {
deleteCmd.AddCommand(deleteHelmReleaseCmd)
}
func deleteHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("release name is required")
}
name := args[0]
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
kubeClient, err := utils.kubeClient(kubeconfig)
if err != nil {
return err
}
namespacedName := types.NamespacedName{
Namespace: namespace,
Name: name,
}
var helmRelease helmv2.HelmRelease
err = kubeClient.Get(ctx, namespacedName, &helmRelease)
if err != nil {
return err
}
if !deleteSilent {
if !helmRelease.Spec.Suspend {
logger.Waitingf("This action will remove the Kubernetes objects previously applied by the %s Helm release!", name)
}
prompt := promptui.Prompt{
Label: "Are you sure you want to delete this Helm release",
IsConfirm: true,
}
if _, err := prompt.Run(); err != nil {
return fmt.Errorf("aborting")
}
}
logger.Actionf("deleting release %s in %s namespace", name, namespace)
err = kubeClient.Delete(ctx, &helmRelease)
if err != nil {
return err
}
logger.Successf("release deleted")
return nil
}

View File

@@ -31,7 +31,10 @@ var deleteKsCmd = &cobra.Command{
Aliases: []string{"ks"},
Short: "Delete a Kustomization resource",
Long: "The delete kustomization command deletes the given Kustomization from the cluster.",
RunE: deleteKsCmdRun,
Example: ` # Delete a kustomization and the Kubernetes resources created by it
gotk delete kustomization podinfo
`,
RunE: deleteKsCmdRun,
}
func init() {

View File

@@ -30,7 +30,10 @@ var deleteSourceGitCmd = &cobra.Command{
Use: "git [name]",
Short: "Delete a GitRepository source",
Long: "The delete source git command deletes the given GitRepository from the cluster.",
RunE: deleteSourceGitCmdRun,
Example: ` # Delete a Git repository
gotk delete source git podinfo
`,
RunE: deleteSourceGitCmdRun,
}
func init() {

View File

@@ -0,0 +1,86 @@
/*
Copyright 2020 The Flux CD contributors.
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"
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
"github.com/manifoldco/promptui"
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/types"
)
var deleteSourceHelmCmd = &cobra.Command{
Use: "helm [name]",
Short: "Delete a HelmRepository source",
Long: "The delete source helm command deletes the given HelmRepository from the cluster.",
Example: ` # Delete a Helm repository
gotk delete source helm podinfo
`,
RunE: deleteSourceHelmCmdRun,
}
func init() {
deleteSourceCmd.AddCommand(deleteSourceHelmCmd)
}
func deleteSourceHelmCmdRun(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("name is required")
}
name := args[0]
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
kubeClient, err := utils.kubeClient(kubeconfig)
if err != nil {
return err
}
namespacedName := types.NamespacedName{
Namespace: namespace,
Name: name,
}
var helmRepository sourcev1.HelmRepository
err = kubeClient.Get(ctx, namespacedName, &helmRepository)
if err != nil {
return err
}
if !deleteSilent {
prompt := promptui.Prompt{
Label: "Are you sure you want to delete this source",
IsConfirm: true,
}
if _, err := prompt.Run(); err != nil {
return fmt.Errorf("aborting")
}
}
logger.Actionf("deleting source %s in %s namespace", name, namespace)
err = kubeClient.Delete(ctx, &helmRepository)
if err != nil {
return err
}
logger.Successf("source deleted")
return nil
}

View File

@@ -0,0 +1,118 @@
/*
Copyright 2020 The Flux CD contributors.
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"
"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/yaml"
helmv2 "github.com/fluxcd/helm-controller/api/v2alpha1"
)
var exportHelmReleaseCmd = &cobra.Command{
Use: "helmrelease [name]",
Aliases: []string{"hr"},
Short: "Export HelmRelease resources in YAML format",
Long: "The export helmrelease command exports one or all HelmRelease resources in YAML format.",
Example: ` # Export all HelmRelease resources
gotk export helmrelease --all > kustomizations.yaml
# Export a HelmRelease
gotk export hr my-app > app-release.yaml
`,
RunE: exportHelmReleaseCmdRun,
}
func init() {
exportCmd.AddCommand(exportHelmReleaseCmd)
}
func exportHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
if !exportAll && len(args) < 1 {
return fmt.Errorf("name is required")
}
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
kubeClient, err := utils.kubeClient(kubeconfig)
if err != nil {
return err
}
if exportAll {
var list helmv2.HelmReleaseList
err = kubeClient.List(ctx, &list, client.InNamespace(namespace))
if err != nil {
return err
}
if len(list.Items) == 0 {
logger.Failuref("no kustomizations found in %s namespace", namespace)
return nil
}
for _, helmRelease := range list.Items {
if err := exportHelmRelease(helmRelease); err != nil {
return err
}
}
} else {
name := args[0]
namespacedName := types.NamespacedName{
Namespace: namespace,
Name: name,
}
var helmRelease helmv2.HelmRelease
err = kubeClient.Get(ctx, namespacedName, &helmRelease)
if err != nil {
return err
}
return exportHelmRelease(helmRelease)
}
return nil
}
func exportHelmRelease(helmRelease helmv2.HelmRelease) error {
gvk := helmv2.GroupVersion.WithKind(helmv2.HelmReleaseKind)
export := helmv2.HelmRelease{
TypeMeta: metav1.TypeMeta{
Kind: gvk.Kind,
APIVersion: gvk.GroupVersion().String(),
},
ObjectMeta: metav1.ObjectMeta{
Name: helmRelease.Name,
Namespace: helmRelease.Namespace,
},
Spec: helmRelease.Spec,
}
data, err := yaml.Marshal(export)
if err != nil {
return err
}
fmt.Println("---")
fmt.Println(string(data))
return nil
}

View File

@@ -34,10 +34,10 @@ var exportKsCmd = &cobra.Command{
Short: "Export Kustomization resources in YAML format",
Long: "The export kustomization command exports one or all Kustomization resources in YAML format.",
Example: ` # Export all Kustomization resources
export kustomization --all > kustomizations.yaml
gotk export kustomization --all > kustomizations.yaml
# Export a Kustomization
export kustomization my-app > kustomization.yaml
gotk export kustomization my-app > kustomization.yaml
`,
RunE: exportKsCmdRun,
}

View File

@@ -34,10 +34,10 @@ var exportSourceGitCmd = &cobra.Command{
Short: "Export GitRepository sources in YAML format",
Long: "The export source git command exports on or all GitRepository sources in YAML format.",
Example: ` # Export all GitRepository sources
export source git --all > sources.yaml
gotk export source git --all > sources.yaml
# Export a GitRepository source including the SSH key pair or basic auth credentials
export source git my-private-repo --with-credentials > source.yaml
gotk export source git my-private-repo --with-credentials > source.yaml
`,
RunE: exportSourceGitCmdRun,
}
@@ -48,7 +48,7 @@ func init() {
func exportSourceGitCmdRun(cmd *cobra.Command, args []string) error {
if !exportAll && len(args) < 1 {
return fmt.Errorf("kustomization name is required")
return fmt.Errorf("name is required")
}
ctx, cancel := context.WithTimeout(context.Background(), timeout)
@@ -103,7 +103,7 @@ func exportSourceGitCmdRun(cmd *cobra.Command, args []string) error {
}
func exportGit(source sourcev1.GitRepository) error {
gvk := sourcev1.GroupVersion.WithKind("GitRepository")
gvk := sourcev1.GroupVersion.WithKind(sourcev1.GitRepositoryKind)
export := sourcev1.GitRepository{
TypeMeta: metav1.TypeMeta{
Kind: gvk.Kind,

View File

@@ -0,0 +1,139 @@
/*
Copyright 2020 The Flux CD contributors.
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"
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
"github.com/spf13/cobra"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/yaml"
)
var exportSourceHelmCmd = &cobra.Command{
Use: "helm [name]",
Short: "Export HelmRepository sources in YAML format",
Long: "The export source git command exports on or all HelmRepository sources in YAML format.",
Example: ` # Export all HelmRepository sources
gotk export source helm --all > sources.yaml
# Export a HelmRepository source including the basic auth credentials
gotk export source helm my-private-repo --with-credentials > source.yaml
`,
RunE: exportSourceHelmCmdRun,
}
func init() {
exportSourceCmd.AddCommand(exportSourceHelmCmd)
}
func exportSourceHelmCmdRun(cmd *cobra.Command, args []string) error {
if !exportAll && len(args) < 1 {
return fmt.Errorf("name is required")
}
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
kubeClient, err := utils.kubeClient(kubeconfig)
if err != nil {
return err
}
if exportAll {
var list sourcev1.HelmRepositoryList
err = kubeClient.List(ctx, &list, client.InNamespace(namespace))
if err != nil {
return err
}
if len(list.Items) == 0 {
logger.Failuref("no source found in %s namespace", namespace)
return nil
}
for _, repository := range list.Items {
if err := exportHelmRepository(repository); err != nil {
return err
}
if exportSourceWithCred {
if err := exportHelmCredentials(ctx, kubeClient, repository); err != nil {
return err
}
}
}
} else {
name := args[0]
namespacedName := types.NamespacedName{
Namespace: namespace,
Name: name,
}
var repository sourcev1.HelmRepository
err = kubeClient.Get(ctx, namespacedName, &repository)
if err != nil {
return err
}
if err := exportHelmRepository(repository); err != nil {
return err
}
if exportSourceWithCred {
return exportHelmCredentials(ctx, kubeClient, repository)
}
}
return nil
}
func exportHelmCredentials(ctx context.Context, kubeClient client.Client, source sourcev1.HelmRepository) error {
if source.Spec.SecretRef != nil {
namespacedName := types.NamespacedName{
Namespace: source.Namespace,
Name: source.Spec.SecretRef.Name,
}
var cred corev1.Secret
err := kubeClient.Get(ctx, namespacedName, &cred)
if err != nil {
return fmt.Errorf("failed to retrieve secret %s, error: %w", namespacedName.Name, err)
}
exported := corev1.Secret{
TypeMeta: metav1.TypeMeta{
APIVersion: "v1",
Kind: "Secret",
},
ObjectMeta: metav1.ObjectMeta{
Name: namespacedName.Name,
Namespace: namespacedName.Namespace,
},
Data: cred.Data,
Type: cred.Type,
}
data, err := yaml.Marshal(exported)
if err != nil {
return err
}
fmt.Println("---")
fmt.Println(string(data))
}
return nil
}

View File

@@ -0,0 +1,90 @@
/*
Copyright 2020 The Flux CD contributors.
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"
"github.com/spf13/cobra"
corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
helmv2 "github.com/fluxcd/helm-controller/api/v2alpha1"
)
var getHelmReleaseCmd = &cobra.Command{
Use: "helmreleases",
Aliases: []string{"hr"},
Short: "Get HelmRelease statuses",
Long: "The get helmreleases command prints the statuses of the resources.",
Example: ` # List all Helm releases and their status
gotk get helmreleases
`,
RunE: getHelmReleaseCmdRun,
}
func init() {
getCmd.AddCommand(getHelmReleaseCmd)
}
func getHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
kubeClient, err := utils.kubeClient(kubeconfig)
if err != nil {
return err
}
var list helmv2.HelmReleaseList
err = kubeClient.List(ctx, &list, client.InNamespace(namespace))
if err != nil {
return err
}
if len(list.Items) == 0 {
logger.Failuref("no releases found in %s namespace", namespace)
return nil
}
for _, helmRelease := range list.Items {
if helmRelease.Spec.Suspend {
logger.Successf("%s is suspended", helmRelease.GetName())
continue
}
isInitialized := false
for _, condition := range helmRelease.Status.Conditions {
if condition.Type == helmv2.ReadyCondition {
if condition.Status != corev1.ConditionFalse {
if helmRelease.Status.LastAppliedRevision != "" {
logger.Successf("%s last applied revision %s", helmRelease.GetName(), helmRelease.Status.LastAppliedRevision)
} else {
logger.Successf("%s reconciling", helmRelease.GetName())
}
} else {
logger.Failuref("%s %s", helmRelease.GetName(), condition.Message)
}
isInitialized = true
break
}
}
if !isInitialized {
logger.Failuref("%s is not ready", helmRelease.GetName())
}
}
return nil
}

View File

@@ -28,9 +28,12 @@ import (
var getKsCmd = &cobra.Command{
Use: "kustomizations",
Aliases: []string{"ks"},
Short: "Get Kustomization source statuses",
Short: "Get Kustomization statuses",
Long: "The get kustomizations command prints the statuses of the resources.",
RunE: getKsCmdRun,
Example: ` # List all kustomizations and their status
gotk get kustomizations
`,
RunE: getKsCmdRun,
}
func init() {

View File

@@ -29,7 +29,10 @@ var getSourceGitCmd = &cobra.Command{
Use: "git",
Short: "Get GitRepository source statuses",
Long: "The get sources git command prints the status of the GitRepository sources.",
RunE: getSourceGitCmdRun,
Example: ` # List all Git repositories and their status
gotk get sources git
`,
RunE: getSourceGitCmdRun,
}
func init() {

View File

@@ -0,0 +1,80 @@
/*
Copyright 2020 The Flux CD contributors.
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"
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
"github.com/spf13/cobra"
corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
)
var getSourceHelmCmd = &cobra.Command{
Use: "helm",
Short: "Get HelmRepository source statuses",
Long: "The get sources helm command prints the status of the HelmRepository sources.",
Example: ` # List all Helm repositories and their status
gotk get sources helm
`,
RunE: getSourceHelmCmdRun,
}
func init() {
getSourceCmd.AddCommand(getSourceHelmCmd)
}
func getSourceHelmCmdRun(cmd *cobra.Command, args []string) error {
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
kubeClient, err := utils.kubeClient(kubeconfig)
if err != nil {
return err
}
var list sourcev1.HelmRepositoryList
err = kubeClient.List(ctx, &list, client.InNamespace(namespace))
if err != nil {
return err
}
if len(list.Items) == 0 {
logger.Failuref("no sources found in %s namespace", namespace)
return nil
}
for _, source := range list.Items {
isInitialized := false
for _, condition := range source.Status.Conditions {
if condition.Type == sourcev1.ReadyCondition {
if condition.Status != corev1.ConditionFalse {
logger.Successf("%s last fetched revision: %s", source.GetName(), source.Status.Artifact.Revision)
} else {
logger.Failuref("%s %s", source.GetName(), condition.Message)
}
isInitialized = true
break
}
}
if !isInitialized {
logger.Failuref("%s is not ready", source.GetName())
}
}
return nil
}

View File

@@ -19,7 +19,6 @@ package main
import (
"context"
"fmt"
"github.com/fluxcd/pkg/untar"
"io/ioutil"
"net/http"
"os"
@@ -31,6 +30,8 @@ import (
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/api/krusty"
"github.com/fluxcd/pkg/untar"
)
var installCmd = &cobra.Command{
@@ -39,26 +40,29 @@ var installCmd = &cobra.Command{
Long: `The install command deploys the toolkit components in the specified namespace.
If a previous version is installed, then an in-place upgrade will be performed.`,
Example: ` # Install the latest version in the gitops-systems namespace
tk install --version=latest --namespace=gitops-systems
gotk install --version=latest --namespace=gitops-systems
# Dry-run install for a specific version and a series of components
tk install --dry-run --version=v0.0.7 --components="source-controller,kustomize-controller"
gotk install --dry-run --version=v0.0.7 --components="source-controller,kustomize-controller"
# Dry-run install with manifests preview
tk install --dry-run --verbose
gotk install --dry-run --verbose
# Write install manifests to file
tk install --export > gitops-system.yaml
gotk install --export > gitops-system.yaml
`,
RunE: installCmdRun,
}
var (
installExport bool
installDryRun bool
installManifestsPath string
installVersion string
installComponents []string
installExport bool
installDryRun bool
installManifestsPath string
installVersion string
installComponents []string
installRegistry string
installImagePullSecret string
installArch string
)
func init() {
@@ -70,12 +74,22 @@ func init() {
"toolkit version")
installCmd.Flags().StringSliceVar(&installComponents, "components", defaultComponents,
"list of components, accepts comma-separated values")
installCmd.Flags().StringVarP(&installManifestsPath, "manifests", "", "",
installCmd.Flags().StringVar(&installManifestsPath, "manifests", "",
"path to the manifest directory, dev only")
installCmd.Flags().StringVar(&installRegistry, "registry", "ghcr.io/fluxcd",
"container registry where the toolkit images are published")
installCmd.Flags().StringVar(&installImagePullSecret, "image-pull-secret", "",
"Kubernetes secret name used for pulling the toolkit images from a private registry")
installCmd.Flags().StringVar(&installArch, "arch", "amd64",
"arch can be amd64 or arm64")
rootCmd.AddCommand(installCmd)
}
func installCmdRun(cmd *cobra.Command, args []string) error {
if !utils.containsItemString(supportedArch, installArch) {
return fmt.Errorf("arch %s is not supported, can be %v", installArch, supportedArch)
}
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
@@ -97,7 +111,7 @@ func installCmdRun(cmd *cobra.Command, args []string) error {
logger.Generatef("generating manifests")
}
if kustomizePath == "" {
err = genInstallManifests(installVersion, namespace, installComponents, tmpDir)
err = genInstallManifests(installVersion, namespace, installComponents, installRegistry, installImagePullSecret, installArch, tmpDir)
if err != nil {
return fmt.Errorf("install failed: %w", err)
}
@@ -118,6 +132,7 @@ func installCmdRun(cmd *cobra.Command, args []string) error {
} else if installExport {
fmt.Println("---")
fmt.Println("# GitOps Toolkit revision", installVersion, time.Now().Format(time.RFC3339))
fmt.Println("# Components:", strings.Join(installComponents, ","))
fmt.Print(yaml)
fmt.Println("---")
return nil
@@ -183,12 +198,16 @@ fieldSpecs:
`
var kustomizationTmpl = `---
{{- $version := .Version }}
{{- $eventsAddr := .EventsAddr }}
{{- $registry := .Registry }}
{{- $arch := .Arch }}
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: {{.Namespace}}
transformers:
- labels.yaml
resources:
- namespace.yaml
- policies.yaml
@@ -196,6 +215,38 @@ resources:
{{- range .Components }}
- {{.}}.yaml
{{- end }}
patches:
- path: node-selector.yaml
target:
kind: Deployment
patchesJson6902:
{{- range $i, $component := .Components }}
{{- if ne $component "notification-controller" }}
- target:
group: apps
version: v1
kind: Deployment
name: {{$component}}
patch: |-
- op: replace
path: /spec/template/spec/containers/0/args/0
value: --events-addr={{$eventsAddr}}
{{- end }}
{{- end }}
{{- if $registry }}
images:
{{- range $i, $component := .Components }}
- name: fluxcd/{{$component}}
{{- if eq $arch "amd64" }}
newName: {{$registry}}/{{$component}}
{{- else }}
newName: {{$registry}}/{{$component}}-{{$arch}}
{{- end }}
{{- end }}
{{- end }}
`
var kustomizationRolesTmpl = `---
@@ -206,6 +257,23 @@ resources:
nameSuffix: -{{.Namespace}}
`
var nodeSelectorTmpl = `---
apiVersion: apps/v1
kind: Deployment
metadata:
name: all
spec:
template:
spec:
nodeSelector:
kubernetes.io/arch: {{.Arch}}
kubernetes.io/os: linux
{{- if .ImagePullSecret }}
imagePullSecrets:
- name: {{.ImagePullSecret}}
{{- end }}
`
func downloadManifests(version string, tmpDir string) error {
ghURL := "https://github.com/fluxcd/toolkit/releases/latest/download/manifests.tar.gz"
if strings.HasPrefix(version, "v") {
@@ -240,15 +308,28 @@ func downloadManifests(version string, tmpDir string) error {
return nil
}
func genInstallManifests(version string, namespace string, components []string, tmpDir string) error {
func genInstallManifests(version string, namespace string, components []string, registry, imagePullSecret, arch, tmpDir string) error {
eventsAddr := ""
if utils.containsItemString(components, defaultNotification) {
eventsAddr = fmt.Sprintf("http://%s/", defaultNotification)
}
model := struct {
Version string
Namespace string
Components []string
Version string
Namespace string
Components []string
EventsAddr string
Registry string
ImagePullSecret string
Arch string
}{
Version: version,
Namespace: namespace,
Components: components,
Version: version,
Namespace: namespace,
Components: components,
EventsAddr: eventsAddr,
Registry: registry,
ImagePullSecret: imagePullSecret,
Arch: arch,
}
if err := downloadManifests(version, tmpDir); err != nil {
@@ -263,6 +344,10 @@ func genInstallManifests(version string, namespace string, components []string,
return fmt.Errorf("generate labels failed: %w", err)
}
if err := utils.execTemplate(model, nodeSelectorTmpl, path.Join(tmpDir, "node-selector.yaml")); err != nil {
return fmt.Errorf("generate node selector failed: %w", err)
}
if err := utils.execTemplate(model, kustomizationTmpl, path.Join(tmpDir, "kustomization.yaml")); err != nil {
return fmt.Errorf("generate kustomization failed: %w", err)
}

View File

@@ -26,70 +26,70 @@ import (
"github.com/spf13/cobra/doc"
_ "k8s.io/client-go/plugin/pkg/client/auth"
tklog "github.com/fluxcd/toolkit/pkg/log"
gotklog "github.com/fluxcd/toolkit/pkg/log"
)
var VERSION = "0.0.0-dev.0"
var rootCmd = &cobra.Command{
Use: "tk",
Use: "gotk",
Version: VERSION,
SilenceUsage: true,
SilenceErrors: true,
Short: "Command line utility for assembling Kubernetes CD pipelines",
Long: `Command line utility for assembling Kubernetes CD pipelines the GitOps way.`,
Example: ` # Check prerequisites
tk check --pre
Example: ` # Check prerequisites
gotk check --pre
# Install the latest version of the toolkit
tk install --version=master
gotk install --version=master
# Create a source from a public Git repository
tk create source git webapp-latest \
gotk create source git webapp-latest \
--url=https://github.com/stefanprodan/podinfo \
--branch=master \
--interval=3m
# List GitRepository sources and their status
tk get sources git
gotk get sources git
# Trigger a GitRepository source sync
tk sync source git webapp-latest
# Trigger a GitRepository source reconciliation
gotk reconcile source git gitops-system
# Export GitRepository sources in YAML format
tk export source git --all > sources.yaml
gotk export source git --all > sources.yaml
# Create a Kustomization for deploying a series of microservices
tk create kustomization webapp-dev \
gotk create kustomization webapp-dev \
--source=webapp-latest \
--path="./deploy/webapp/" \
--prune=true \
--interval=5m \
--validate=client \
--validation=client \
--health-check="Deployment/backend.webapp" \
--health-check="Deployment/frontend.webapp" \
--health-check-timeout=2m
# Trigger a git sync of the Kustomization's source and apply changes
tk reconcile kustomization webapp-dev --with-source
gotk reconcile kustomization webapp-dev --with-source
# Suspend a Kustomization reconciliation
tk suspend kustomization webapp-dev
gotk suspend kustomization webapp-dev
# Export Kustomizations in YAML format
tk export kustomization --all > kustomizations.yaml
gotk export kustomization --all > kustomizations.yaml
# Resume a Kustomization reconciliation
tk resume kustomization webapp-dev
gotk resume kustomization webapp-dev
# Delete a Kustomization
tk delete kustomization webapp-dev
gotk delete kustomization webapp-dev
# Delete a GitRepository source
tk delete source git webapp-latest
gotk delete source git webapp-latest
# Uninstall the toolkit and delete CRDs
tk uninstall --crds
gotk uninstall --crds
`,
}
@@ -99,14 +99,16 @@ var (
timeout time.Duration
verbose bool
utils Utils
pollInterval = 2 * time.Second
logger tklog.Logger = printLogger{}
pollInterval = 2 * time.Second
logger gotklog.Logger = printLogger{}
)
var (
defaultComponents = []string{"source-controller", "kustomize-controller", "helm-controller", "notification-controller"}
defaultVersion = "latest"
defaultNamespace = "gitops-system"
defaultComponents = []string{"source-controller", "kustomize-controller", "helm-controller", "notification-controller"}
defaultVersion = "latest"
defaultNamespace = "gitops-system"
defaultNotification = "notification-controller"
supportedArch = []string{"arm64", "amd64"}
)
func init() {

View File

@@ -21,6 +21,7 @@ import (
"fmt"
"time"
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
"github.com/spf13/cobra"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
@@ -37,10 +38,10 @@ var reconcileHrCmd = &cobra.Command{
Long: `
The reconcile kustomization command triggers a reconciliation of a HelmRelease resource and waits for it to finish.`,
Example: ` # Trigger a HelmRelease apply outside of the reconciliation interval
tk reconcile hr podinfo
gotk reconcile hr podinfo
# Trigger a reconciliation of the HelmRelease's source and apply changes
tk reconcile hr podinfo --with-source
gotk reconcile hr podinfo --with-source
`,
RunE: reconcileHrCmdRun,
}
@@ -81,7 +82,12 @@ func reconcileHrCmdRun(cmd *cobra.Command, args []string) error {
}
if syncHrWithSource {
err := syncSourceHelmCmdRun(nil, []string{helmRelease.Spec.Chart.SourceRef.Name})
switch helmRelease.Spec.Chart.Spec.SourceRef.Kind {
case sourcev1.HelmRepositoryKind:
err = syncSourceHelmCmdRun(nil, []string{helmRelease.Spec.Chart.Spec.SourceRef.Name})
case sourcev1.GitRepositoryKind:
err = syncSourceGitCmdRun(nil, []string{helmRelease.Spec.Chart.Spec.SourceRef.Name})
}
if err != nil {
return err
}
@@ -138,7 +144,7 @@ func isHelmReleaseReady(ctx context.Context, kubeClient client.Client, name, nam
if condition.Type == helmv2.ReadyCondition {
if condition.Status == corev1.ConditionTrue {
return true, nil
} else if condition.Status == corev1.ConditionFalse {
} else if condition.Status == corev1.ConditionFalse && helmRelease.Status.LastAttemptedRevision != "" {
return false, fmt.Errorf(condition.Message)
}
}

View File

@@ -34,10 +34,10 @@ var reconcileKsCmd = &cobra.Command{
Long: `
The reconcile kustomization command triggers a reconciliation of a Kustomization resource and waits for it to finish.`,
Example: ` # Trigger a Kustomization apply outside of the reconciliation interval
tk reconcile kustomization podinfo
gotk reconcile kustomization podinfo
# Trigger a sync of the Kustomization's source and apply changes
tk reconcile kustomization podinfo --with-source
gotk reconcile kustomization podinfo --with-source
`,
RunE: reconcileKsCmdRun,
}

View File

@@ -31,7 +31,7 @@ var reconcileSourceGitCmd = &cobra.Command{
Short: "Reconcile a GitRepository source",
Long: `The reconcile source command triggers a reconciliation of a GitRepository resource and waits for it to finish.`,
Example: ` # Trigger a git pull for an existing source
tk reconcile source git podinfo
gotk reconcile source git podinfo
`,
RunE: syncSourceGitCmdRun,
}

View File

@@ -34,8 +34,8 @@ var reconcileSourceHelmCmd = &cobra.Command{
Use: "helm [name]",
Short: "Reconcile a HelmRepository source",
Long: `The reconcile source command triggers a reconciliation of a HelmRepository resource and waits for it to finish.`,
Example: ` # Trigger a helm repo update for an existing source
tk reconcile source helm podinfo
Example: ` # Trigger a reconciliation for an existing source
gotk reconcile source helm podinfo
`,
RunE: syncSourceHelmCmdRun,
}

View File

@@ -35,6 +35,9 @@ var resumeHrCmd = &cobra.Command{
Short: "Resume a suspended HelmRelease",
Long: `The resume command marks a previously suspended HelmRelease resource for reconciliation and waits for it to
finish the apply.`,
Example: ` # Resume reconciliation for an existing Helm release
gotk resume hr podinfo
`,
RunE: resumeHrCmdRun,
}

View File

@@ -35,6 +35,9 @@ var resumeKsCmd = &cobra.Command{
Short: "Resume a suspended Kustomization",
Long: `The resume command marks a previously suspended Kustomization resource for reconciliation and waits for it to
finish the apply.`,
Example: ` # Resume reconciliation for an existing Kustomization
gotk resume ks podinfo
`,
RunE: resumeKsCmdRun,
}

View File

@@ -31,7 +31,10 @@ var suspendHrCmd = &cobra.Command{
Aliases: []string{"hr"},
Short: "Suspend reconciliation of HelmRelease",
Long: "The suspend command disables the reconciliation of a HelmRelease resource.",
RunE: suspendHrCmdRun,
Example: ` # Suspend reconciliation for an existing Helm release
gotk suspend hr podinfo
`,
RunE: suspendHrCmdRun,
}
func init() {

View File

@@ -29,7 +29,10 @@ var suspendKsCmd = &cobra.Command{
Aliases: []string{"ks"},
Short: "Suspend reconciliation of Kustomization",
Long: "The suspend command disables the reconciliation of a Kustomization resource.",
RunE: suspendKsCmdRun,
Example: ` # Suspend reconciliation for an existing Kustomization
gotk suspend ks podinfo
`,
RunE: suspendKsCmdRun,
}
func init() {

View File

@@ -19,10 +19,12 @@ package main
import (
"context"
"fmt"
"time"
"github.com/manifoldco/promptui"
"github.com/spf13/cobra"
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1alpha1"
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
)
var uninstallCmd = &cobra.Command{
@@ -30,27 +32,27 @@ var uninstallCmd = &cobra.Command{
Short: "Uninstall the toolkit components",
Long: "The uninstall command removes the namespace, cluster roles, cluster role bindings and CRDs from the cluster.",
Example: ` # Dry-run uninstall of all components
uninstall --dry-run --namespace=gitops-system
gotk uninstall --dry-run --namespace=gitops-system
# Uninstall all components and delete custom resource definitions
uninstall --crds --namespace=gitops-system
gotk uninstall --resources --crds --namespace=gitops-system
`,
RunE: uninstallCmdRun,
}
var (
uninstallCRDs bool
uninstallKustomizations bool
uninstallDryRun bool
uninstallSilent bool
uninstallCRDs bool
uninstallResources bool
uninstallDryRun bool
uninstallSilent bool
)
func init() {
uninstallCmd.Flags().BoolVarP(&uninstallKustomizations, "kustomizations", "", false,
"removes all Kustomizations previously installed")
uninstallCmd.Flags().BoolVarP(&uninstallCRDs, "crds", "", false,
uninstallCmd.Flags().BoolVar(&uninstallResources, "resources", false,
"removes custom resources such as Kustomizations, GitRepositories and HelmRepositories")
uninstallCmd.Flags().BoolVar(&uninstallCRDs, "crds", false,
"removes all CRDs previously installed")
uninstallCmd.Flags().BoolVarP(&uninstallDryRun, "dry-run", "", false,
uninstallCmd.Flags().BoolVar(&uninstallDryRun, "dry-run", false,
"only print the object that would be deleted")
uninstallCmd.Flags().BoolVarP(&uninstallSilent, "silent", "s", false,
"delete components without asking for confirmation")
@@ -75,18 +77,19 @@ func uninstallCmdRun(cmd *cobra.Command, args []string) error {
}
}
if uninstallKustomizations {
logger.Actionf("uninstalling kustomizations")
command := fmt.Sprintf("kubectl -n %s delete kustomizations --all --timeout=%s %s",
namespace, timeout.String(), dryRun)
if _, err := utils.execCommand(ctx, ModeOS, command); err != nil {
return fmt.Errorf("uninstall failed")
if uninstallResources {
logger.Actionf("uninstalling custom resources")
for _, kind := range []string{
kustomizev1.KustomizationKind,
sourcev1.GitRepositoryKind,
sourcev1.HelmRepositoryKind,
} {
command := fmt.Sprintf("kubectl -n %s delete %s --all --timeout=%s %s",
namespace, kind, timeout.String(), dryRun)
if _, err := utils.execCommand(ctx, ModeOS, command); err != nil {
return fmt.Errorf("uninstall failed")
}
}
// TODO: use the kustomizations snapshots to create a list of objects
// that are subject to deletion and wait for all of them to be terminated
logger.Waitingf("waiting on GC")
time.Sleep(30 * time.Second)
}
kinds := "namespace,clusterroles,clusterrolebindings"

View File

@@ -26,12 +26,14 @@ import (
"os/exec"
"text/template"
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1alpha1"
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/tools/clientcmd"
"sigs.k8s.io/controller-runtime/pkg/client"
helmv2 "github.com/fluxcd/helm-controller/api/v2alpha1"
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1alpha1"
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
)
type Utils struct {
@@ -118,6 +120,7 @@ func (*Utils) kubeClient(config string) (client.Client, error) {
_ = corev1.AddToScheme(scheme)
_ = sourcev1.AddToScheme(scheme)
_ = kustomizev1.AddToScheme(scheme)
_ = helmv2.AddToScheme(scheme)
kubeClient, err := client.New(cfg, client.Options{
Scheme: scheme,
@@ -163,3 +166,12 @@ func (*Utils) copyFile(src, dst string) error {
}
return out.Close()
}
func (*Utils) containsItemString(s []string, e string) bool {
for _, a := range s {
if a == e {
return true
}
}
return false
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

View File

@@ -22,3 +22,76 @@ body {
.md-header-nav__title {
font-size: .85rem;
}
.check-bullet {
color:#07bfa5;
background-color: white;
margin-left:-22px;
}
/* Progress bar styling */
.progress-label {
position: absolute;
text-align: center;
font-weight: 700;
width: 100%;
/* remove original styling for thin styling
margin: 0 ! important; */
margin-top: -0.4rem ! important;
line-height: 1.2rem;
white-space: nowrap;
overflow: hidden;
}
.progress-bar {
/*remove original styling for thin styling
height: 1.2rem; */
height: 0.4rem;
float: left;
background: repeating-linear-gradient(
45deg,
rgba(255, 255, 255, 0.2),
rgba(255, 255, 255, 0.2) 10px,
rgba(255, 255, 255, 0.3) 10px,
rgba(255, 255, 255, 0.3) 20px
) #2979ff;
border-radius: 2px;
}
.progress {
display: block;
width: 100%;
/* remove original styling for thin styling
margin: 0.5rem 0;
height: 1.2rem; */
margin-top: 0.9rem;
height: 0.4rem;
background-color: #eeeeee;
position: relative;
border-radius: 2px;
}
.progress-100plus .progress-bar {
background-color: #00c853;
}
.progress-80plus .progress-bar {
background-color: #64dd17;
}
.progress-60plus .progress-bar {
background-color: #fbc02d;
}
.progress-40plus .progress-bar {
background-color: #ff9100;
}
.progress-20plus .progress-bar {
background-color: #ff5252;
}
.progress-0plus .progress-bar {
background-color: #ff1744;
}

91
docs/cmd/gotk.md Normal file
View File

@@ -0,0 +1,91 @@
## gotk
Command line utility for assembling Kubernetes CD pipelines
### Synopsis
Command line utility for assembling Kubernetes CD pipelines the GitOps way.
### Examples
```
# Check prerequisites
gotk check --pre
# Install the latest version of the toolkit
gotk install --version=master
# Create a source from a public Git repository
gotk create source git webapp-latest \
--url=https://github.com/stefanprodan/podinfo \
--branch=master \
--interval=3m
# List GitRepository sources and their status
gotk get sources git
# Trigger a GitRepository source reconciliation
gotk reconcile source git gitops-system
# Export GitRepository sources in YAML format
gotk export source git --all > sources.yaml
# Create a Kustomization for deploying a series of microservices
gotk create kustomization webapp-dev \
--source=webapp-latest \
--path="./deploy/webapp/" \
--prune=true \
--interval=5m \
--validation=client \
--health-check="Deployment/backend.webapp" \
--health-check="Deployment/frontend.webapp" \
--health-check-timeout=2m
# Trigger a git sync of the Kustomization's source and apply changes
gotk reconcile kustomization webapp-dev --with-source
# Suspend a Kustomization reconciliation
gotk suspend kustomization webapp-dev
# Export Kustomizations in YAML format
gotk export kustomization --all > kustomizations.yaml
# Resume a Kustomization reconciliation
gotk resume kustomization webapp-dev
# Delete a Kustomization
gotk delete kustomization webapp-dev
# Delete a GitRepository source
gotk delete source git webapp-latest
# Uninstall the toolkit and delete CRDs
gotk uninstall --crds
```
### Options
```
-h, --help help for gotk
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
--namespace string the namespace scope for this operation (default "gitops-system")
--timeout duration timeout for this operation (default 5m0s)
--verbose print generated objects
```
### SEE ALSO
* [gotk bootstrap](gotk_bootstrap.md) - Bootstrap toolkit components
* [gotk check](gotk_check.md) - Check requirements and installation
* [gotk completion](gotk_completion.md) - Generates bash completion scripts
* [gotk create](gotk_create.md) - Create or update sources and resources
* [gotk delete](gotk_delete.md) - Delete sources and resources
* [gotk export](gotk_export.md) - Export resources in YAML format
* [gotk get](gotk_get.md) - Get sources and resources
* [gotk install](gotk_install.md) - Install the toolkit components
* [gotk reconcile](gotk_reconcile.md) - Reconcile sources and resources
* [gotk resume](gotk_resume.md) - Resume suspended resources
* [gotk suspend](gotk_suspend.md) - Suspend resources
* [gotk uninstall](gotk_uninstall.md) - Uninstall the toolkit components

View File

@@ -0,0 +1,34 @@
## gotk bootstrap
Bootstrap toolkit components
### Synopsis
The bootstrap sub-commands bootstrap the toolkit components on the targeted Git provider.
### Options
```
--arch string arch can be amd64 or arm64 (default "amd64")
--components strings list of components, accepts comma-separated values (default [source-controller,kustomize-controller,helm-controller,notification-controller])
-h, --help help for bootstrap
--image-pull-secret string Kubernetes secret name used for pulling the toolkit images from a private registry
--registry string container registry where the toolkit images are published (default "ghcr.io/fluxcd")
-v, --version string toolkit version (default "latest")
```
### Options inherited from parent commands
```
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
--namespace string the namespace scope for this operation (default "gitops-system")
--timeout duration timeout for this operation (default 5m0s)
--verbose print generated objects
```
### SEE ALSO
* [gotk](gotk.md) - Command line utility for assembling Kubernetes CD pipelines
* [gotk bootstrap github](gotk_bootstrap_github.md) - Bootstrap toolkit components in a GitHub repository
* [gotk bootstrap gitlab](gotk_bootstrap_gitlab.md) - Bootstrap toolkit components in a GitLab repository

View File

@@ -1,4 +1,4 @@
## tk bootstrap github
## gotk bootstrap github
Bootstrap toolkit components in a GitHub repository
@@ -11,7 +11,7 @@ If the toolkit components are present on the cluster,
the bootstrap command will perform an upgrade if needed.
```
tk bootstrap github [flags]
gotk bootstrap github [flags]
```
### Examples
@@ -21,19 +21,19 @@ tk bootstrap github [flags]
export GITHUB_TOKEN=<my-token>
# Run bootstrap for a private repo owned by a GitHub organization
bootstrap github --owner=<organization> --repository=<repo name>
gotk bootstrap github --owner=<organization> --repository=<repo name>
# Run bootstrap for a private repo and assign organization teams to it
bootstrap github --owner=<organization> --repository=<repo name> --team=<team1 slug> --team=<team2 slug>
gotk bootstrap github --owner=<organization> --repository=<repo name> --team=<team1 slug> --team=<team2 slug>
# Run bootstrap for a repository path
bootstrap github --owner=<organization> --repository=<repo name> --path=dev-cluster
gotk bootstrap github --owner=<organization> --repository=<repo name> --path=dev-cluster
# Run bootstrap for a public repository on a personal account
bootstrap github --owner=<user> --repository=<repo name> --private=false --personal=true
gotk bootstrap github --owner=<user> --repository=<repo name> --private=false --personal=true
# Run bootstrap for a private repo hosted on GitHub Enterprise
bootstrap github --owner=<organization> --repository=<repo name> --hostname=<domain>
gotk bootstrap github --owner=<organization> --repository=<repo name> --hostname=<domain>
```
@@ -54,15 +54,18 @@ tk bootstrap github [flags]
### Options inherited from parent commands
```
--components strings list of components, accepts comma-separated values (default [source-controller,kustomize-controller,helm-controller,notification-controller])
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
--namespace string the namespace scope for this operation (default "gitops-system")
--timeout duration timeout for this operation (default 5m0s)
--verbose print generated objects
-v, --version string toolkit version (default "latest")
--arch string arch can be amd64 or arm64 (default "amd64")
--components strings list of components, accepts comma-separated values (default [source-controller,kustomize-controller,helm-controller,notification-controller])
--image-pull-secret string Kubernetes secret name used for pulling the toolkit images from a private registry
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
--namespace string the namespace scope for this operation (default "gitops-system")
--registry string container registry where the toolkit images are published (default "ghcr.io/fluxcd")
--timeout duration timeout for this operation (default 5m0s)
--verbose print generated objects
-v, --version string toolkit version (default "latest")
```
### SEE ALSO
* [tk bootstrap](tk_bootstrap.md) - Bootstrap toolkit components
* [gotk bootstrap](gotk_bootstrap.md) - Bootstrap toolkit components

View File

@@ -0,0 +1,68 @@
## gotk bootstrap gitlab
Bootstrap toolkit components in a GitLab repository
### Synopsis
The bootstrap gitlab command creates the GitLab repository if it doesn't exists and
commits the toolkit components manifests to the master branch.
Then it configures the target cluster to synchronize with the repository.
If the toolkit components are present on the cluster,
the bootstrap command will perform an upgrade if needed.
```
gotk bootstrap gitlab [flags]
```
### Examples
```
# Create a GitLab API token and export it as an env var
export GITLAB_TOKEN=<my-token>
# Run bootstrap for a private repo owned by a GitLab group
gotk bootstrap gitlab --owner=<group> --repository=<repo name>
# Run bootstrap for a repository path
gotk bootstrap gitlab --owner=<group> --repository=<repo name> --path=dev-cluster
# Run bootstrap for a public repository on a personal account
gotk bootstrap gitlab --owner=<user> --repository=<repo name> --private=false --personal=true
# Run bootstrap for a private repo hosted on a GitLab server
gotk bootstrap gitlab --owner=<group> --repository=<repo name> --hostname=<domain>
```
### Options
```
-h, --help help for gitlab
--hostname string GitLab hostname (default "gitlab.com")
--interval duration sync interval (default 1m0s)
--owner string GitLab user or group name
--path string repository path, when specified the cluster sync will be scoped to this path
--personal is personal repository
--private is private repository (default true)
--repository string GitLab repository name
--ssh-hostname string GitLab SSH hostname, defaults to hostname if not specified
```
### Options inherited from parent commands
```
--arch string arch can be amd64 or arm64 (default "amd64")
--components strings list of components, accepts comma-separated values (default [source-controller,kustomize-controller,helm-controller,notification-controller])
--image-pull-secret string Kubernetes secret name used for pulling the toolkit images from a private registry
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
--namespace string the namespace scope for this operation (default "gitops-system")
--registry string container registry where the toolkit images are published (default "ghcr.io/fluxcd")
--timeout duration timeout for this operation (default 5m0s)
--verbose print generated objects
-v, --version string toolkit version (default "latest")
```
### SEE ALSO
* [gotk bootstrap](gotk_bootstrap.md) - Bootstrap toolkit components

View File

@@ -1,4 +1,4 @@
## tk check
## gotk check
Check requirements and installation
@@ -8,17 +8,17 @@ The check command will perform a series of checks to validate that
the local environment is configured correctly and if the installed components are healthy.
```
tk check [flags]
gotk check [flags]
```
### Examples
```
# Run pre-installation checks
tk check --pre
gotk check --pre
# Run installation checks
tk check
gotk check
```
@@ -41,5 +41,5 @@ tk check [flags]
### SEE ALSO
* [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines
* [gotk](gotk.md) - Command line utility for assembling Kubernetes CD pipelines

View File

@@ -1,4 +1,4 @@
## tk completion
## gotk completion
Generates bash completion scripts
@@ -7,7 +7,7 @@ Generates bash completion scripts
Generates bash completion scripts
```
tk completion [flags]
gotk completion [flags]
```
### Examples
@@ -15,12 +15,12 @@ tk completion [flags]
```
To load completion run
. <(tk completion)
. <(gotk completion)
To configure your bash shell to load completions for each session add to your bashrc
# ~/.bashrc or ~/.profile
. <(tk completion)
. <(gotk completion)
```
@@ -41,5 +41,5 @@ To configure your bash shell to load completions for each session add to your ba
### SEE ALSO
* [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines
* [gotk](gotk.md) - Command line utility for assembling Kubernetes CD pipelines

View File

@@ -1,4 +1,4 @@
## tk create
## gotk create
Create or update sources and resources
@@ -25,7 +25,8 @@ The create sub-commands generate sources and resources.
### SEE ALSO
* [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines
* [tk create kustomization](tk_create_kustomization.md) - Create or update a Kustomization resource
* [tk create source](tk_create_source.md) - Create or update sources
* [gotk](gotk.md) - Command line utility for assembling Kubernetes CD pipelines
* [gotk create helmrelease](gotk_create_helmrelease.md) - Create or update a HelmRelease resource
* [gotk create kustomization](gotk_create_kustomization.md) - Create or update a Kustomization resource
* [gotk create source](gotk_create_source.md) - Create or update sources

View File

@@ -0,0 +1,83 @@
## gotk create helmrelease
Create or update a HelmRelease resource
### Synopsis
The helmrelease create command generates a HelmRelease resource for a given HelmRepository source.
```
gotk create helmrelease [name] [flags]
```
### Examples
```
# Create a HelmRelease with a chart from a HelmRepository source
gotk create hr podinfo \
--interval=10m \
--source=HelmRepository/podinfo \
--chart=podinfo \
--chart-version=">4.0.0"
# Create a HelmRelease with a chart from a GitRepository source
gotk create hr podinfo \
--interval=10m \
--source=GitRepository/podinfo \
--chart=./charts/podinfo
# Create a HelmRelease with values from a local YAML file
gotk create hr podinfo \
--source=HelmRepository/podinfo \
--chart=podinfo \
--values=./my-values.yaml
# Create a HelmRelease with a custom release name
gotk create hr podinfo \
--release-name=podinfo-dev
--source=HelmRepository/podinfo \
--chart=podinfo \
# Create a HelmRelease targeting another namespace than the resource
gotk create hr podinfo \
--target-namespace=default \
--source=HelmRepository/podinfo \
--chart=podinfo
# Create a HelmRelease definition on disk without applying it on the cluster
gotk create hr podinfo \
--source=HelmRepository/podinfo \
--chart=podinfo \
--values=./values.yaml \
--export > podinfo-release.yaml
```
### Options
```
--chart string Helm chart name or path
--chart-version string Helm chart version, accepts a semver range (ignored for charts from GitRepository sources)
--depends-on stringArray HelmReleases that must be ready before this release can be installed
-h, --help help for helmrelease
--release-name string name used for the Helm release, defaults to a composition of '[<target-namespace>-]<hr-name>'
--source string source that contains the chart (<kind>/<name>)
--target-namespace string namespace to install this release, defaults to the HelmRelease namespace
--values string local path to the values.yaml file
```
### Options inherited from parent commands
```
--export export in YAML format to stdout
--interval duration source sync interval (default 1m0s)
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
--namespace string the namespace scope for this operation (default "gitops-system")
--timeout duration timeout for this operation (default 5m0s)
--verbose print generated objects
```
### SEE ALSO
* [gotk create](gotk_create.md) - Create or update sources and resources

View File

@@ -1,4 +1,4 @@
## tk create kustomization
## gotk create kustomization
Create or update a Kustomization resource
@@ -7,39 +7,39 @@ Create or update a Kustomization resource
The kustomization source create command generates a Kustomize resource for a given GitRepository source.
```
tk create kustomization [name] [flags]
gotk create kustomization [name] [flags]
```
### Examples
```
# Create a Kustomization resource from a source at a given path
create kustomization contour \
gotk create kustomization contour \
--source=contour \
--path="./examples/contour/" \
--prune=true \
--interval=10m \
--validate=client \
--validation=client \
--health-check="Deployment/contour.projectcontour" \
--health-check="DaemonSet/envoy.projectcontour" \
--health-check-timeout=3m
# Create a Kustomization resource that depends on the previous one
create kustomization webapp \
gotk create kustomization webapp \
--depends-on=contour \
--source=webapp \
--path="./deploy/overlays/dev" \
--prune=true \
--interval=5m \
--validate=client
--validation=client
# Create a Kustomization resource that runs under a service account
create kustomization webapp \
gotk create kustomization webapp \
--source=webapp \
--path="./deploy/overlays/staging" \
--prune=true \
--interval=5m \
--validate=client \
--validation=client \
--sa-name=reconclier \
--sa-namespace=staging
@@ -57,7 +57,7 @@ tk create kustomization [name] [flags]
--sa-name string service account name
--sa-namespace string service account namespace
--source string GitRepository name
--validate string validate the manifests before applying them on the cluster, can be 'client' or 'server'
--validation string validate the manifests before applying them on the cluster, can be 'client' or 'server'
```
### Options inherited from parent commands
@@ -73,5 +73,5 @@ tk create kustomization [name] [flags]
### SEE ALSO
* [tk create](tk_create.md) - Create or update sources and resources
* [gotk create](gotk_create.md) - Create or update sources and resources

View File

@@ -1,4 +1,4 @@
## tk create source
## gotk create source
Create or update sources
@@ -25,6 +25,7 @@ The create source sub-commands generate sources.
### SEE ALSO
* [tk create](tk_create.md) - Create or update sources and resources
* [tk create source git](tk_create_source_git.md) - Create or update a GitRepository source
* [gotk create](gotk_create.md) - Create or update sources and resources
* [gotk create source git](gotk_create_source_git.md) - Create or update a GitRepository source
* [gotk create source helm](gotk_create_source_helm.md) - Create or update a HelmRepository source

View File

@@ -1,4 +1,4 @@
## tk create source git
## gotk create source git
Create or update a GitRepository source
@@ -10,42 +10,42 @@ For Git over SSH, host and SSH keys are automatically generated and stored in a
For private Git repositories, the basic authentication credentials are stored in a Kubernetes secret.
```
tk create source git [name] [flags]
gotk create source git [name] [flags]
```
### Examples
```
# Create a source from a public Git repository master branch
create source git podinfo \
gotk create source git podinfo \
--url=https://github.com/stefanprodan/podinfo \
--branch=master
# Create a source from a Git repository pinned to specific git tag
create source git podinfo \
gotk create source git podinfo \
--url=https://github.com/stefanprodan/podinfo \
--tag="3.2.3"
# Create a source from a public Git repository tag that matches a semver range
create source git podinfo \
gotk create source git podinfo \
--url=https://github.com/stefanprodan/podinfo \
--tag-semver=">=3.2.0 <3.3.0"
# Create a source from a Git repository using SSH authentication
create source git podinfo \
gotk create source git podinfo \
--url=ssh://git@github.com/stefanprodan/podinfo \
--branch=master
# Create a source from a Git repository using SSH authentication and an
# ECDSA P-521 curve public key
create source git podinfo \
gotk create source git podinfo \
--url=ssh://git@github.com/stefanprodan/podinfo \
--branch=master \
--ssh-key-algorithm=ecdsa \
--ssh-ecdsa-curve=p521
# Create a source from a Git repository using basic authentication
create source git podinfo \
gotk create source git podinfo \
--url=https://github.com/stefanprodan/podinfo \
--username=username \
--password=password
@@ -80,5 +80,5 @@ tk create source git [name] [flags]
### SEE ALSO
* [tk create source](tk_create_source.md) - Create or update sources
* [gotk create source](gotk_create_source.md) - Create or update sources

View File

@@ -0,0 +1,64 @@
## gotk create source helm
Create or update a HelmRepository source
### Synopsis
The create source helm command generates a HelmRepository resource and waits for it to fetch the index.
For private Helm repositories, the basic authentication credentials are stored in a Kubernetes secret.
```
gotk create source helm [name] [flags]
```
### Examples
```
# Create a source from a public Helm repository
gotk create source helm podinfo \
--url=https://stefanprodan.github.io/podinfo \
--interval=10m
# Create a source from a Helm repository using basic authentication
gotk create source helm podinfo \
--url=https://stefanprodan.github.io/podinfo \
--username=username \
--password=password
# Create a source from a Helm repository using TLS authentication
gotk create source helm podinfo \
--url=https://stefanprodan.github.io/podinfo \
--cert-file=./cert.crt \
--key-file=./key.crt \
--ca-file=./ca.crt
```
### Options
```
--ca-file string TLS authentication CA file path
--cert-file string TLS authentication cert file path
-h, --help help for helm
--key-file string TLS authentication key file path
-p, --password string basic authentication password
--url string Helm repository address
-u, --username string basic authentication username
```
### Options inherited from parent commands
```
--export export in YAML format to stdout
--interval duration source sync interval (default 1m0s)
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
--namespace string the namespace scope for this operation (default "gitops-system")
--timeout duration timeout for this operation (default 5m0s)
--verbose print generated objects
```
### SEE ALSO
* [gotk create source](gotk_create_source.md) - Create or update sources

View File

@@ -1,4 +1,4 @@
## tk delete
## gotk delete
Delete sources and resources
@@ -24,7 +24,8 @@ The delete sub-commands delete sources and resources.
### SEE ALSO
* [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines
* [tk delete kustomization](tk_delete_kustomization.md) - Delete a Kustomization resource
* [tk delete source](tk_delete_source.md) - Delete sources
* [gotk](gotk.md) - Command line utility for assembling Kubernetes CD pipelines
* [gotk delete helmrelease](gotk_delete_helmrelease.md) - Delete a HelmRelease resource
* [gotk delete kustomization](gotk_delete_kustomization.md) - Delete a Kustomization resource
* [gotk delete source](gotk_delete_source.md) - Delete sources

View File

@@ -0,0 +1,40 @@
## gotk delete helmrelease
Delete a HelmRelease resource
### Synopsis
The delete helmrelease command removes the given HelmRelease from the cluster.
```
gotk delete helmrelease [name] [flags]
```
### Examples
```
# Delete a Helm release and the Kubernetes resources created by it
gotk delete hr podinfo
```
### Options
```
-h, --help help for helmrelease
```
### Options inherited from parent commands
```
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
--namespace string the namespace scope for this operation (default "gitops-system")
-s, --silent delete resource without asking for confirmation
--timeout duration timeout for this operation (default 5m0s)
--verbose print generated objects
```
### SEE ALSO
* [gotk delete](gotk_delete.md) - Delete sources and resources

View File

@@ -1,4 +1,4 @@
## tk delete kustomization
## gotk delete kustomization
Delete a Kustomization resource
@@ -7,7 +7,15 @@ Delete a Kustomization resource
The delete kustomization command deletes the given Kustomization from the cluster.
```
tk delete kustomization [name] [flags]
gotk delete kustomization [name] [flags]
```
### Examples
```
# Delete a kustomization and the Kubernetes resources created by it
gotk delete kustomization podinfo
```
### Options
@@ -28,5 +36,5 @@ tk delete kustomization [name] [flags]
### SEE ALSO
* [tk delete](tk_delete.md) - Delete sources and resources
* [gotk delete](gotk_delete.md) - Delete sources and resources

View File

@@ -1,4 +1,4 @@
## tk delete source
## gotk delete source
Delete sources
@@ -24,6 +24,7 @@ The delete source sub-commands delete sources.
### SEE ALSO
* [tk delete](tk_delete.md) - Delete sources and resources
* [tk delete source git](tk_delete_source_git.md) - Delete a GitRepository source
* [gotk delete](gotk_delete.md) - Delete sources and resources
* [gotk delete source git](gotk_delete_source_git.md) - Delete a GitRepository source
* [gotk delete source helm](gotk_delete_source_helm.md) - Delete a HelmRepository source

View File

@@ -1,4 +1,4 @@
## tk delete source git
## gotk delete source git
Delete a GitRepository source
@@ -7,7 +7,15 @@ Delete a GitRepository source
The delete source git command deletes the given GitRepository from the cluster.
```
tk delete source git [name] [flags]
gotk delete source git [name] [flags]
```
### Examples
```
# Delete a Git repository
gotk delete source git podinfo
```
### Options
@@ -28,5 +36,5 @@ tk delete source git [name] [flags]
### SEE ALSO
* [tk delete source](tk_delete_source.md) - Delete sources
* [gotk delete source](gotk_delete_source.md) - Delete sources

View File

@@ -0,0 +1,40 @@
## gotk delete source helm
Delete a HelmRepository source
### Synopsis
The delete source helm command deletes the given HelmRepository from the cluster.
```
gotk delete source helm [name] [flags]
```
### Examples
```
# Delete a Helm repository
gotk delete source helm podinfo
```
### Options
```
-h, --help help for helm
```
### Options inherited from parent commands
```
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
--namespace string the namespace scope for this operation (default "gitops-system")
-s, --silent delete resource without asking for confirmation
--timeout duration timeout for this operation (default 5m0s)
--verbose print generated objects
```
### SEE ALSO
* [gotk delete source](gotk_delete_source.md) - Delete sources

View File

@@ -1,4 +1,4 @@
## tk export
## gotk export
Export resources in YAML format
@@ -24,7 +24,8 @@ The export sub-commands export resources in YAML format.
### SEE ALSO
* [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines
* [tk export kustomization](tk_export_kustomization.md) - Export Kustomization resources in YAML format
* [tk export source](tk_export_source.md) - Export sources
* [gotk](gotk.md) - Command line utility for assembling Kubernetes CD pipelines
* [gotk export helmrelease](gotk_export_helmrelease.md) - Export HelmRelease resources in YAML format
* [gotk export kustomization](gotk_export_kustomization.md) - Export Kustomization resources in YAML format
* [gotk export source](gotk_export_source.md) - Export sources

View File

@@ -0,0 +1,43 @@
## gotk export helmrelease
Export HelmRelease resources in YAML format
### Synopsis
The export helmrelease command exports one or all HelmRelease resources in YAML format.
```
gotk export helmrelease [name] [flags]
```
### Examples
```
# Export all HelmRelease resources
gotk export helmrelease --all > kustomizations.yaml
# Export a HelmRelease
gotk export hr my-app > app-release.yaml
```
### Options
```
-h, --help help for helmrelease
```
### Options inherited from parent commands
```
--all select all resources
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
--namespace string the namespace scope for this operation (default "gitops-system")
--timeout duration timeout for this operation (default 5m0s)
--verbose print generated objects
```
### SEE ALSO
* [gotk export](gotk_export.md) - Export resources in YAML format

View File

@@ -1,4 +1,4 @@
## tk export kustomization
## gotk export kustomization
Export Kustomization resources in YAML format
@@ -7,17 +7,17 @@ Export Kustomization resources in YAML format
The export kustomization command exports one or all Kustomization resources in YAML format.
```
tk export kustomization [name] [flags]
gotk export kustomization [name] [flags]
```
### Examples
```
# Export all Kustomization resources
export kustomization --all > kustomizations.yaml
gotk export kustomization --all > kustomizations.yaml
# Export a Kustomization
export kustomization my-app > kustomization.yaml
gotk export kustomization my-app > kustomization.yaml
```
@@ -39,5 +39,5 @@ tk export kustomization [name] [flags]
### SEE ALSO
* [tk export](tk_export.md) - Export resources in YAML format
* [gotk export](gotk_export.md) - Export resources in YAML format

View File

@@ -1,4 +1,4 @@
## tk export source
## gotk export source
Export sources
@@ -25,6 +25,7 @@ The export source sub-commands export sources in YAML format.
### SEE ALSO
* [tk export](tk_export.md) - Export resources in YAML format
* [tk export source git](tk_export_source_git.md) - Export GitRepository sources in YAML format
* [gotk export](gotk_export.md) - Export resources in YAML format
* [gotk export source git](gotk_export_source_git.md) - Export GitRepository sources in YAML format
* [gotk export source helm](gotk_export_source_helm.md) - Export HelmRepository sources in YAML format

View File

@@ -1,4 +1,4 @@
## tk export source git
## gotk export source git
Export GitRepository sources in YAML format
@@ -7,17 +7,17 @@ Export GitRepository sources in YAML format
The export source git command exports on or all GitRepository sources in YAML format.
```
tk export source git [name] [flags]
gotk export source git [name] [flags]
```
### Examples
```
# Export all GitRepository sources
export source git --all > sources.yaml
gotk export source git --all > sources.yaml
# Export a GitRepository source including the SSH key pair or basic auth credentials
export source git my-private-repo --with-credentials > source.yaml
gotk export source git my-private-repo --with-credentials > source.yaml
```
@@ -40,5 +40,5 @@ tk export source git [name] [flags]
### SEE ALSO
* [tk export source](tk_export_source.md) - Export sources
* [gotk export source](gotk_export_source.md) - Export sources

View File

@@ -0,0 +1,44 @@
## gotk export source helm
Export HelmRepository sources in YAML format
### Synopsis
The export source git command exports on or all HelmRepository sources in YAML format.
```
gotk export source helm [name] [flags]
```
### Examples
```
# Export all HelmRepository sources
gotk export source helm --all > sources.yaml
# Export a HelmRepository source including the basic auth credentials
gotk export source helm my-private-repo --with-credentials > source.yaml
```
### Options
```
-h, --help help for helm
```
### Options inherited from parent commands
```
--all select all resources
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
--namespace string the namespace scope for this operation (default "gitops-system")
--timeout duration timeout for this operation (default 5m0s)
--verbose print generated objects
--with-credentials include credential secrets
```
### SEE ALSO
* [gotk export source](gotk_export_source.md) - Export sources

View File

@@ -1,4 +1,4 @@
## tk get
## gotk get
Get sources and resources
@@ -23,7 +23,8 @@ The get sub-commands print the statuses of sources and resources.
### SEE ALSO
* [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines
* [tk get kustomizations](tk_get_kustomizations.md) - Get Kustomization source statuses
* [tk get sources](tk_get_sources.md) - Get source statuses
* [gotk](gotk.md) - Command line utility for assembling Kubernetes CD pipelines
* [gotk get helmreleases](gotk_get_helmreleases.md) - Get HelmRelease statuses
* [gotk get kustomizations](gotk_get_kustomizations.md) - Get Kustomization statuses
* [gotk get sources](gotk_get_sources.md) - Get source statuses

View File

@@ -0,0 +1,39 @@
## gotk get helmreleases
Get HelmRelease statuses
### Synopsis
The get helmreleases command prints the statuses of the resources.
```
gotk get helmreleases [flags]
```
### Examples
```
# List all Helm releases and their status
gotk get helmreleases
```
### Options
```
-h, --help help for helmreleases
```
### Options inherited from parent commands
```
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
--namespace string the namespace scope for this operation (default "gitops-system")
--timeout duration timeout for this operation (default 5m0s)
--verbose print generated objects
```
### SEE ALSO
* [gotk get](gotk_get.md) - Get sources and resources

View File

@@ -1,13 +1,21 @@
## tk get kustomizations
## gotk get kustomizations
Get Kustomization source statuses
Get Kustomization statuses
### Synopsis
The get kustomizations command prints the statuses of the resources.
```
tk get kustomizations [flags]
gotk get kustomizations [flags]
```
### Examples
```
# List all kustomizations and their status
gotk get kustomizations
```
### Options
@@ -27,5 +35,5 @@ tk get kustomizations [flags]
### SEE ALSO
* [tk get](tk_get.md) - Get sources and resources
* [gotk get](gotk_get.md) - Get sources and resources

View File

@@ -1,4 +1,4 @@
## tk get sources
## gotk get sources
Get source statuses
@@ -23,6 +23,7 @@ The get source sub-commands print the statuses of the sources.
### SEE ALSO
* [tk get](tk_get.md) - Get sources and resources
* [tk get sources git](tk_get_sources_git.md) - Get GitRepository source statuses
* [gotk get](gotk_get.md) - Get sources and resources
* [gotk get sources git](gotk_get_sources_git.md) - Get GitRepository source statuses
* [gotk get sources helm](gotk_get_sources_helm.md) - Get HelmRepository source statuses

View File

@@ -1,4 +1,4 @@
## tk get sources git
## gotk get sources git
Get GitRepository source statuses
@@ -7,7 +7,15 @@ Get GitRepository source statuses
The get sources git command prints the status of the GitRepository sources.
```
tk get sources git [flags]
gotk get sources git [flags]
```
### Examples
```
# List all Git repositories and their status
gotk get sources git
```
### Options
@@ -27,5 +35,5 @@ tk get sources git [flags]
### SEE ALSO
* [tk get sources](tk_get_sources.md) - Get source statuses
* [gotk get sources](gotk_get_sources.md) - Get source statuses

View File

@@ -0,0 +1,39 @@
## gotk get sources helm
Get HelmRepository source statuses
### Synopsis
The get sources helm command prints the status of the HelmRepository sources.
```
gotk get sources helm [flags]
```
### Examples
```
# List all Helm repositories and their status
gotk get sources helm
```
### Options
```
-h, --help help for helm
```
### Options inherited from parent commands
```
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
--namespace string the namespace scope for this operation (default "gitops-system")
--timeout duration timeout for this operation (default 5m0s)
--verbose print generated objects
```
### SEE ALSO
* [gotk get sources](gotk_get_sources.md) - Get source statuses

57
docs/cmd/gotk_install.md Normal file
View File

@@ -0,0 +1,57 @@
## gotk install
Install the toolkit components
### Synopsis
The install command deploys the toolkit components in the specified namespace.
If a previous version is installed, then an in-place upgrade will be performed.
```
gotk install [flags]
```
### Examples
```
# Install the latest version in the gitops-systems namespace
gotk install --version=latest --namespace=gitops-systems
# Dry-run install for a specific version and a series of components
gotk install --dry-run --version=v0.0.7 --components="source-controller,kustomize-controller"
# Dry-run install with manifests preview
gotk install --dry-run --verbose
# Write install manifests to file
gotk install --export > gitops-system.yaml
```
### Options
```
--arch string arch can be amd64 or arm64 (default "amd64")
--components strings list of components, accepts comma-separated values (default [source-controller,kustomize-controller,helm-controller,notification-controller])
--dry-run only print the object that would be applied
--export write the install manifests to stdout and exit
-h, --help help for install
--image-pull-secret string Kubernetes secret name used for pulling the toolkit images from a private registry
--manifests string path to the manifest directory, dev only
--registry string container registry where the toolkit images are published (default "ghcr.io/fluxcd")
-v, --version string toolkit version (default "latest")
```
### Options inherited from parent commands
```
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
--namespace string the namespace scope for this operation (default "gitops-system")
--timeout duration timeout for this operation (default 5m0s)
--verbose print generated objects
```
### SEE ALSO
* [gotk](gotk.md) - Command line utility for assembling Kubernetes CD pipelines

View File

@@ -1,4 +1,4 @@
## tk reconcile
## gotk reconcile
Reconcile sources and resources
@@ -23,8 +23,8 @@ The reconcile sub-commands trigger a reconciliation of sources and resources.
### SEE ALSO
* [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines
* [tk reconcile helmrelease](tk_reconcile_helmrelease.md) - Reconcile a HelmRelease resource
* [tk reconcile kustomization](tk_reconcile_kustomization.md) - Reconcile a Kustomization resource
* [tk reconcile source](tk_reconcile_source.md) - Reconcile sources
* [gotk](gotk.md) - Command line utility for assembling Kubernetes CD pipelines
* [gotk reconcile helmrelease](gotk_reconcile_helmrelease.md) - Reconcile a HelmRelease resource
* [gotk reconcile kustomization](gotk_reconcile_kustomization.md) - Reconcile a Kustomization resource
* [gotk reconcile source](gotk_reconcile_source.md) - Reconcile sources

View File

@@ -1,4 +1,4 @@
## tk reconcile helmrelease
## gotk reconcile helmrelease
Reconcile a HelmRelease resource
@@ -8,17 +8,17 @@ Reconcile a HelmRelease resource
The reconcile kustomization command triggers a reconciliation of a HelmRelease resource and waits for it to finish.
```
tk reconcile helmrelease [name] [flags]
gotk reconcile helmrelease [name] [flags]
```
### Examples
```
# Trigger a HelmRelease apply outside of the reconciliation interval
tk reconcile hr podinfo
gotk reconcile hr podinfo
# Trigger a reconciliation of the HelmRelease's source and apply changes
tk reconcile hr podinfo --with-source
gotk reconcile hr podinfo --with-source
```
@@ -40,5 +40,5 @@ tk reconcile helmrelease [name] [flags]
### SEE ALSO
* [tk reconcile](tk_reconcile.md) - Reconcile sources and resources
* [gotk reconcile](gotk_reconcile.md) - Reconcile sources and resources

View File

@@ -1,4 +1,4 @@
## tk reconcile kustomization
## gotk reconcile kustomization
Reconcile a Kustomization resource
@@ -8,17 +8,17 @@ Reconcile a Kustomization resource
The reconcile kustomization command triggers a reconciliation of a Kustomization resource and waits for it to finish.
```
tk reconcile kustomization [name] [flags]
gotk reconcile kustomization [name] [flags]
```
### Examples
```
# Trigger a Kustomization apply outside of the reconciliation interval
tk reconcile kustomization podinfo
gotk reconcile kustomization podinfo
# Trigger a sync of the Kustomization's source and apply changes
tk reconcile kustomization podinfo --with-source
gotk reconcile kustomization podinfo --with-source
```
@@ -40,5 +40,5 @@ tk reconcile kustomization [name] [flags]
### SEE ALSO
* [tk reconcile](tk_reconcile.md) - Reconcile sources and resources
* [gotk reconcile](gotk_reconcile.md) - Reconcile sources and resources

View File

@@ -1,4 +1,4 @@
## tk reconcile source
## gotk reconcile source
Reconcile sources
@@ -23,7 +23,7 @@ The reconcile source sub-commands trigger a reconciliation of sources.
### SEE ALSO
* [tk reconcile](tk_reconcile.md) - Reconcile sources and resources
* [tk reconcile source git](tk_reconcile_source_git.md) - Reconcile a GitRepository source
* [tk reconcile source helm](tk_reconcile_source_helm.md) - Reconcile a HelmRepository source
* [gotk reconcile](gotk_reconcile.md) - Reconcile sources and resources
* [gotk reconcile source git](gotk_reconcile_source_git.md) - Reconcile a GitRepository source
* [gotk reconcile source helm](gotk_reconcile_source_helm.md) - Reconcile a HelmRepository source

View File

@@ -1,4 +1,4 @@
## tk reconcile source git
## gotk reconcile source git
Reconcile a GitRepository source
@@ -7,14 +7,14 @@ Reconcile a GitRepository source
The reconcile source command triggers a reconciliation of a GitRepository resource and waits for it to finish.
```
tk reconcile source git [name] [flags]
gotk reconcile source git [name] [flags]
```
### Examples
```
# Trigger a git pull for an existing source
tk reconcile source git podinfo
gotk reconcile source git podinfo
```
@@ -35,5 +35,5 @@ tk reconcile source git [name] [flags]
### SEE ALSO
* [tk reconcile source](tk_reconcile_source.md) - Reconcile sources
* [gotk reconcile source](gotk_reconcile_source.md) - Reconcile sources

View File

@@ -1,4 +1,4 @@
## tk reconcile source helm
## gotk reconcile source helm
Reconcile a HelmRepository source
@@ -7,14 +7,14 @@ Reconcile a HelmRepository source
The reconcile source command triggers a reconciliation of a HelmRepository resource and waits for it to finish.
```
tk reconcile source helm [name] [flags]
gotk reconcile source helm [name] [flags]
```
### Examples
```
# Trigger a helm repo update for an existing source
tk reconcile source helm podinfo
# Trigger a reconciliation for an existing source
gotk reconcile source helm podinfo
```
@@ -35,5 +35,5 @@ tk reconcile source helm [name] [flags]
### SEE ALSO
* [tk reconcile source](tk_reconcile_source.md) - Reconcile sources
* [gotk reconcile source](gotk_reconcile_source.md) - Reconcile sources

View File

@@ -1,4 +1,4 @@
## tk resume
## gotk resume
Resume suspended resources
@@ -23,7 +23,7 @@ The resume sub-commands resume a suspended resource.
### SEE ALSO
* [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines
* [tk resume helmrelease](tk_resume_helmrelease.md) - Resume a suspended HelmRelease
* [tk resume kustomization](tk_resume_kustomization.md) - Resume a suspended Kustomization
* [gotk](gotk.md) - Command line utility for assembling Kubernetes CD pipelines
* [gotk resume helmrelease](gotk_resume_helmrelease.md) - Resume a suspended HelmRelease
* [gotk resume kustomization](gotk_resume_kustomization.md) - Resume a suspended Kustomization

View File

@@ -1,4 +1,4 @@
## tk resume helmrelease
## gotk resume helmrelease
Resume a suspended HelmRelease
@@ -8,7 +8,15 @@ The resume command marks a previously suspended HelmRelease resource for reconci
finish the apply.
```
tk resume helmrelease [name] [flags]
gotk resume helmrelease [name] [flags]
```
### Examples
```
# Resume reconciliation for an existing Helm release
gotk resume hr podinfo
```
### Options
@@ -28,5 +36,5 @@ tk resume helmrelease [name] [flags]
### SEE ALSO
* [tk resume](tk_resume.md) - Resume suspended resources
* [gotk resume](gotk_resume.md) - Resume suspended resources

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