Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8586d1ef4 | ||
|
|
316cba1cb8 | ||
|
|
13dba62b8d | ||
|
|
c2ff169c08 | ||
|
|
57a1dbfc6d | ||
|
|
efb39d6fc6 | ||
|
|
b784234430 | ||
|
|
aebad92426 | ||
|
|
8e67cfd5c9 | ||
|
|
10cc6d7e08 | ||
|
|
83c236c829 | ||
|
|
b6ab37691f | ||
|
|
c85af78025 | ||
|
|
2c2fc6dd97 | ||
|
|
3620b76139 | ||
|
|
ca5732e586 | ||
|
|
2463d72f3b | ||
|
|
d6f7474200 | ||
|
|
0b2bc7ab3f | ||
|
|
0a4fac61d4 | ||
|
|
797aec5528 | ||
|
|
5f0b95dc59 | ||
|
|
b384c5f14c | ||
|
|
5254dca9d9 | ||
|
|
8534ccbf37 | ||
|
|
9af874d810 |
23
.github/workflows/e2e.yaml
vendored
23
.github/workflows/e2e.yaml
vendored
@@ -91,6 +91,29 @@ jobs:
|
|||||||
- name: tk delete source git
|
- name: tk delete source git
|
||||||
run: |
|
run: |
|
||||||
./bin/tk delete source git podinfo --silent
|
./bin/tk delete source git podinfo --silent
|
||||||
|
- name: tk create source helm
|
||||||
|
run: |
|
||||||
|
./bin/tk create source helm podinfo \
|
||||||
|
--url https://stefanprodan.github.io/podinfo
|
||||||
|
- name: tk create helmrelease
|
||||||
|
run: |
|
||||||
|
./bin/tk create hr podinfo \
|
||||||
|
--target-namespace=default \
|
||||||
|
--source=podinfo \
|
||||||
|
--chart-name=podinfo \
|
||||||
|
--chart-version=">4.0.0 <5.0.0"
|
||||||
|
- name: tk get helmreleases
|
||||||
|
run: |
|
||||||
|
./bin/tk get helmreleases
|
||||||
|
- name: tk export helmrelease
|
||||||
|
run: |
|
||||||
|
./bin/tk export hr --all
|
||||||
|
- name: tk delete helmrelease
|
||||||
|
run: |
|
||||||
|
./bin/tk delete hr podinfo --silent
|
||||||
|
- name: tk delete source helm
|
||||||
|
run: |
|
||||||
|
./bin/tk delete source helm podinfo --silent
|
||||||
- name: tk check
|
- name: tk check
|
||||||
run: |
|
run: |
|
||||||
./bin/tk check
|
./bin/tk check
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ var bootstrapCmd = &cobra.Command{
|
|||||||
var (
|
var (
|
||||||
bootstrapVersion string
|
bootstrapVersion string
|
||||||
bootstrapComponents []string
|
bootstrapComponents []string
|
||||||
|
bootstrapRegistry string
|
||||||
|
bootstrapImagePullSecret string
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -61,7 +63,10 @@ func init() {
|
|||||||
"toolkit version")
|
"toolkit version")
|
||||||
bootstrapCmd.PersistentFlags().StringSliceVar(&bootstrapComponents, "components", defaultComponents,
|
bootstrapCmd.PersistentFlags().StringSliceVar(&bootstrapComponents, "components", defaultComponents,
|
||||||
"list of components, accepts comma-separated values")
|
"list of components, accepts comma-separated values")
|
||||||
|
bootstrapCmd.PersistentFlags().StringVar(&bootstrapRegistry, "registry", "docker.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")
|
||||||
rootCmd.AddCommand(bootstrapCmd)
|
rootCmd.AddCommand(bootstrapCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +78,7 @@ func generateInstallManifests(targetPath, namespace, tmpDir string) (string, err
|
|||||||
return "", fmt.Errorf("generating manifests failed: %w", err)
|
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, tkDir); err != nil {
|
||||||
return "", fmt.Errorf("generating manifests failed: %w", err)
|
return "", fmt.Errorf("generating manifests failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,19 +42,19 @@ the bootstrap command will perform an upgrade if needed.`,
|
|||||||
export GITHUB_TOKEN=<my-token>
|
export GITHUB_TOKEN=<my-token>
|
||||||
|
|
||||||
# Run bootstrap for a private repo owned by a GitHub organization
|
# Run bootstrap for a private repo owned by a GitHub organization
|
||||||
bootstrap github --owner=<organization> --repository=<repo name>
|
tk bootstrap github --owner=<organization> --repository=<repo name>
|
||||||
|
|
||||||
# Run bootstrap for a private repo and assign organization teams to it
|
# 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>
|
tk bootstrap github --owner=<organization> --repository=<repo name> --team=<team1 slug> --team=<team2 slug>
|
||||||
|
|
||||||
# Run bootstrap for a repository path
|
# Run bootstrap for a repository path
|
||||||
bootstrap github --owner=<organization> --repository=<repo name> --path=dev-cluster
|
tk bootstrap github --owner=<organization> --repository=<repo name> --path=dev-cluster
|
||||||
|
|
||||||
# Run bootstrap for a public repository on a personal account
|
# Run bootstrap for a public repository on a personal account
|
||||||
bootstrap github --owner=<user> --repository=<repo name> --private=false --personal=true
|
tk bootstrap github --owner=<user> --repository=<repo name> --private=false --personal=true
|
||||||
|
|
||||||
# Run bootstrap for a private repo hosted on GitHub Enterprise
|
# Run bootstrap for a private repo hosted on GitHub Enterprise
|
||||||
bootstrap github --owner=<organization> --repository=<repo name> --hostname=<domain>
|
tk bootstrap github --owner=<organization> --repository=<repo name> --hostname=<domain>
|
||||||
`,
|
`,
|
||||||
RunE: bootstrapGitHubCmdRun,
|
RunE: bootstrapGitHubCmdRun,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,16 +42,16 @@ the bootstrap command will perform an upgrade if needed.`,
|
|||||||
export GITLAB_TOKEN=<my-token>
|
export GITLAB_TOKEN=<my-token>
|
||||||
|
|
||||||
# Run bootstrap for a private repo owned by a GitLab group
|
# Run bootstrap for a private repo owned by a GitLab group
|
||||||
bootstrap gitlab --owner=<group> --repository=<repo name>
|
tk bootstrap gitlab --owner=<group> --repository=<repo name>
|
||||||
|
|
||||||
# Run bootstrap for a repository path
|
# Run bootstrap for a repository path
|
||||||
bootstrap gitlab --owner=<group> --repository=<repo name> --path=dev-cluster
|
tk bootstrap gitlab --owner=<group> --repository=<repo name> --path=dev-cluster
|
||||||
|
|
||||||
# Run bootstrap for a public repository on a personal account
|
# Run bootstrap for a public repository on a personal account
|
||||||
bootstrap gitlab --owner=<user> --repository=<repo name> --private=false --personal=true
|
tk bootstrap gitlab --owner=<user> --repository=<repo name> --private=false --personal=true
|
||||||
|
|
||||||
# Run bootstrap for a private repo hosted on a GitLab server
|
# Run bootstrap for a private repo hosted on a GitLab server
|
||||||
bootstrap gitlab --owner=<group> --repository=<repo name> --hostname=<domain>
|
tk bootstrap gitlab --owner=<group> --repository=<repo name> --hostname=<domain>
|
||||||
`,
|
`,
|
||||||
RunE: bootstrapGitLabCmdRun,
|
RunE: bootstrapGitLabCmdRun,
|
||||||
}
|
}
|
||||||
|
|||||||
256
cmd/tk/create_helmrelease.go
Normal file
256
cmd/tk/create_helmrelease.go
Normal file
@@ -0,0 +1,256 @@
|
|||||||
|
/*
|
||||||
|
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"
|
||||||
|
|
||||||
|
"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 from a source
|
||||||
|
tk create hr podinfo \
|
||||||
|
--interval=10m \
|
||||||
|
--release-name=podinfo \
|
||||||
|
--target-namespace=default \
|
||||||
|
--source=podinfo \
|
||||||
|
--chart-name=podinfo \
|
||||||
|
--chart-version=">4.0.0"
|
||||||
|
|
||||||
|
# Create a HelmRelease with values for a local YAML file
|
||||||
|
tk create hr podinfo \
|
||||||
|
--target-namespace=default \
|
||||||
|
--source=podinfo \
|
||||||
|
--chart-name=podinfo \
|
||||||
|
--chart-version=4.0.5 \
|
||||||
|
--values=./my-values.yaml
|
||||||
|
|
||||||
|
# Create a HelmRelease definition on disk without applying it on the cluster
|
||||||
|
tk create hr podinfo \
|
||||||
|
--target-namespace=default \
|
||||||
|
--source=podinfo \
|
||||||
|
--chart-name=podinfo \
|
||||||
|
--chart-version=4.0.5 \
|
||||||
|
--values=./values.yaml \
|
||||||
|
--export > podinfo-release.yaml
|
||||||
|
`,
|
||||||
|
RunE: createHelmReleaseCmdRun,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
hrName string
|
||||||
|
hrSource string
|
||||||
|
hrDependsOn []string
|
||||||
|
hrChartName 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", "", "HelmRepository name")
|
||||||
|
createHelmReleaseCmd.Flags().StringVar(&hrChartName, "chart-name", "", "Helm chart name")
|
||||||
|
createHelmReleaseCmd.Flags().StringVar(&hrChartVersion, "chart-version", "", "Helm chart version, accepts semver range")
|
||||||
|
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")
|
||||||
|
}
|
||||||
|
if hrChartName == "" {
|
||||||
|
return fmt.Errorf("chart name is required")
|
||||||
|
}
|
||||||
|
if hrChartVersion == "" {
|
||||||
|
return fmt.Errorf("chart version 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{
|
||||||
|
Name: hrChartName,
|
||||||
|
Version: hrChartVersion,
|
||||||
|
SourceRef: helmv2.CrossNamespaceObjectReference{
|
||||||
|
Kind: sourcev1.HelmRepositoryKind,
|
||||||
|
Name: hrSource,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,7 +40,7 @@ var createKsCmd = &cobra.Command{
|
|||||||
Short: "Create or update a Kustomization resource",
|
Short: "Create or update a Kustomization resource",
|
||||||
Long: "The kustomization source create command generates a Kustomize resource for a given GitRepository source.",
|
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
|
Example: ` # Create a Kustomization resource from a source at a given path
|
||||||
create kustomization contour \
|
tk create kustomization contour \
|
||||||
--source=contour \
|
--source=contour \
|
||||||
--path="./examples/contour/" \
|
--path="./examples/contour/" \
|
||||||
--prune=true \
|
--prune=true \
|
||||||
@@ -51,7 +51,7 @@ var createKsCmd = &cobra.Command{
|
|||||||
--health-check-timeout=3m
|
--health-check-timeout=3m
|
||||||
|
|
||||||
# Create a Kustomization resource that depends on the previous one
|
# Create a Kustomization resource that depends on the previous one
|
||||||
create kustomization webapp \
|
tk create kustomization webapp \
|
||||||
--depends-on=contour \
|
--depends-on=contour \
|
||||||
--source=webapp \
|
--source=webapp \
|
||||||
--path="./deploy/overlays/dev" \
|
--path="./deploy/overlays/dev" \
|
||||||
@@ -60,7 +60,7 @@ var createKsCmd = &cobra.Command{
|
|||||||
--validation=client
|
--validation=client
|
||||||
|
|
||||||
# Create a Kustomization resource that runs under a service account
|
# Create a Kustomization resource that runs under a service account
|
||||||
create kustomization webapp \
|
tk create kustomization webapp \
|
||||||
--source=webapp \
|
--source=webapp \
|
||||||
--path="./deploy/overlays/staging" \
|
--path="./deploy/overlays/staging" \
|
||||||
--prune=true \
|
--prune=true \
|
||||||
|
|||||||
@@ -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 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.`,
|
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
|
Example: ` # Create a source from a public Git repository master branch
|
||||||
create source git podinfo \
|
tk create source git podinfo \
|
||||||
--url=https://github.com/stefanprodan/podinfo \
|
--url=https://github.com/stefanprodan/podinfo \
|
||||||
--branch=master
|
--branch=master
|
||||||
|
|
||||||
# Create a source from a Git repository pinned to specific git tag
|
# Create a source from a Git repository pinned to specific git tag
|
||||||
create source git podinfo \
|
tk create source git podinfo \
|
||||||
--url=https://github.com/stefanprodan/podinfo \
|
--url=https://github.com/stefanprodan/podinfo \
|
||||||
--tag="3.2.3"
|
--tag="3.2.3"
|
||||||
|
|
||||||
# Create a source from a public Git repository tag that matches a semver range
|
# Create a source from a public Git repository tag that matches a semver range
|
||||||
create source git podinfo \
|
tk create source git podinfo \
|
||||||
--url=https://github.com/stefanprodan/podinfo \
|
--url=https://github.com/stefanprodan/podinfo \
|
||||||
--tag-semver=">=3.2.0 <3.3.0"
|
--tag-semver=">=3.2.0 <3.3.0"
|
||||||
|
|
||||||
# Create a source from a Git repository using SSH authentication
|
# Create a source from a Git repository using SSH authentication
|
||||||
create source git podinfo \
|
tk create source git podinfo \
|
||||||
--url=ssh://git@github.com/stefanprodan/podinfo \
|
--url=ssh://git@github.com/stefanprodan/podinfo \
|
||||||
--branch=master
|
--branch=master
|
||||||
|
|
||||||
# Create a source from a Git repository using SSH authentication and an
|
# Create a source from a Git repository using SSH authentication and an
|
||||||
# ECDSA P-521 curve public key
|
# ECDSA P-521 curve public key
|
||||||
create source git podinfo \
|
tk create source git podinfo \
|
||||||
--url=ssh://git@github.com/stefanprodan/podinfo \
|
--url=ssh://git@github.com/stefanprodan/podinfo \
|
||||||
--branch=master \
|
--branch=master \
|
||||||
--ssh-key-algorithm=ecdsa \
|
--ssh-key-algorithm=ecdsa \
|
||||||
--ssh-ecdsa-curve=p521
|
--ssh-ecdsa-curve=p521
|
||||||
|
|
||||||
# Create a source from a Git repository using basic authentication
|
# Create a source from a Git repository using basic authentication
|
||||||
create source git podinfo \
|
tk create source git podinfo \
|
||||||
--url=https://github.com/stefanprodan/podinfo \
|
--url=https://github.com/stefanprodan/podinfo \
|
||||||
--username=username \
|
--username=username \
|
||||||
--password=password
|
--password=password
|
||||||
@@ -115,7 +115,7 @@ func createSourceGitCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
name := args[0]
|
name := args[0]
|
||||||
|
|
||||||
if sourceGitURL == "" {
|
if sourceGitURL == "" {
|
||||||
return fmt.Errorf("git-url is required")
|
return fmt.Errorf("url is required")
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpDir, err := ioutil.TempDir("", name)
|
tmpDir, err := ioutil.TempDir("", name)
|
||||||
|
|||||||
229
cmd/tk/create_source_helm.go
Normal file
229
cmd/tk/create_source_helm.go
Normal file
@@ -0,0 +1,229 @@
|
|||||||
|
/*
|
||||||
|
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
|
||||||
|
tk create source helm podinfo \
|
||||||
|
--url=https://stefanprodan.github.io/podinfo \
|
||||||
|
--interval=10m
|
||||||
|
|
||||||
|
# Create a source from a Helm repository using basic authentication
|
||||||
|
tk create source helm podinfo \
|
||||||
|
--url=https://stefanprodan.github.io/podinfo \
|
||||||
|
--username=username \
|
||||||
|
--password=password
|
||||||
|
`,
|
||||||
|
RunE: createSourceHelmCmdRun,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
sourceHelmURL string
|
||||||
|
sourceHelmUsername string
|
||||||
|
sourceHelmPassword 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")
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
kubeClient, err := utils.kubeClient(kubeconfig)
|
||||||
|
if err != nil {
|
||||||
|
return 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)
|
||||||
|
}
|
||||||
|
|
||||||
|
withAuth := false
|
||||||
|
if sourceHelmUsername != "" && sourceHelmPassword != "" {
|
||||||
|
logger.Actionf("applying secret with basic auth credentials")
|
||||||
|
secret := corev1.Secret{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: secretName,
|
||||||
|
Namespace: namespace,
|
||||||
|
},
|
||||||
|
StringData: map[string]string{
|
||||||
|
"username": sourceHelmUsername,
|
||||||
|
"password": sourceHelmPassword,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
if err := upsertSecret(ctx, kubeClient, secret); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
withAuth = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if withAuth {
|
||||||
|
logger.Successf("authentication configured")
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.Generatef("generating source")
|
||||||
|
|
||||||
|
if withAuth {
|
||||||
|
helmRepository.Spec.SecretRef = &corev1.LocalObjectReference{
|
||||||
|
Name: secretName,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
91
cmd/tk/delete_helmrelease.go
Normal file
91
cmd/tk/delete_helmrelease.go
Normal 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
|
||||||
|
tk 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
|
||||||
|
}
|
||||||
@@ -31,6 +31,9 @@ var deleteKsCmd = &cobra.Command{
|
|||||||
Aliases: []string{"ks"},
|
Aliases: []string{"ks"},
|
||||||
Short: "Delete a Kustomization resource",
|
Short: "Delete a Kustomization resource",
|
||||||
Long: "The delete kustomization command deletes the given Kustomization from the cluster.",
|
Long: "The delete kustomization command deletes the given Kustomization from the cluster.",
|
||||||
|
Example: ` # Delete a kustomization and the Kubernetes resources created by it
|
||||||
|
tk delete kustomization podinfo
|
||||||
|
`,
|
||||||
RunE: deleteKsCmdRun,
|
RunE: deleteKsCmdRun,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ var deleteSourceGitCmd = &cobra.Command{
|
|||||||
Use: "git [name]",
|
Use: "git [name]",
|
||||||
Short: "Delete a GitRepository source",
|
Short: "Delete a GitRepository source",
|
||||||
Long: "The delete source git command deletes the given GitRepository from the cluster.",
|
Long: "The delete source git command deletes the given GitRepository from the cluster.",
|
||||||
|
Example: ` # Delete a Git repository
|
||||||
|
tk delete source git podinfo
|
||||||
|
`,
|
||||||
RunE: deleteSourceGitCmdRun,
|
RunE: deleteSourceGitCmdRun,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
86
cmd/tk/delete_source_helm.go
Normal file
86
cmd/tk/delete_source_helm.go
Normal 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
|
||||||
|
tk 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
|
||||||
|
}
|
||||||
118
cmd/tk/export_helmrelease.go
Normal file
118
cmd/tk/export_helmrelease.go
Normal 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
|
||||||
|
tk export helmrelease --all > kustomizations.yaml
|
||||||
|
|
||||||
|
# Export a HelmRelease
|
||||||
|
tk 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
|
||||||
|
}
|
||||||
@@ -34,10 +34,10 @@ var exportKsCmd = &cobra.Command{
|
|||||||
Short: "Export Kustomization resources in YAML format",
|
Short: "Export Kustomization resources in YAML format",
|
||||||
Long: "The export kustomization command exports one or all Kustomization resources in YAML format.",
|
Long: "The export kustomization command exports one or all Kustomization resources in YAML format.",
|
||||||
Example: ` # Export all Kustomization resources
|
Example: ` # Export all Kustomization resources
|
||||||
export kustomization --all > kustomizations.yaml
|
tk export kustomization --all > kustomizations.yaml
|
||||||
|
|
||||||
# Export a Kustomization
|
# Export a Kustomization
|
||||||
export kustomization my-app > kustomization.yaml
|
tk export kustomization my-app > kustomization.yaml
|
||||||
`,
|
`,
|
||||||
RunE: exportKsCmdRun,
|
RunE: exportKsCmdRun,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,10 +34,10 @@ var exportSourceGitCmd = &cobra.Command{
|
|||||||
Short: "Export GitRepository sources in YAML format",
|
Short: "Export GitRepository sources in YAML format",
|
||||||
Long: "The export source git command exports on or all 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
|
Example: ` # Export all GitRepository sources
|
||||||
export source git --all > sources.yaml
|
tk export source git --all > sources.yaml
|
||||||
|
|
||||||
# Export a GitRepository source including the SSH key pair or basic auth credentials
|
# Export a GitRepository source including the SSH key pair or basic auth credentials
|
||||||
export source git my-private-repo --with-credentials > source.yaml
|
tk export source git my-private-repo --with-credentials > source.yaml
|
||||||
`,
|
`,
|
||||||
RunE: exportSourceGitCmdRun,
|
RunE: exportSourceGitCmdRun,
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ func init() {
|
|||||||
|
|
||||||
func exportSourceGitCmdRun(cmd *cobra.Command, args []string) error {
|
func exportSourceGitCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
if !exportAll && len(args) < 1 {
|
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)
|
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 {
|
func exportGit(source sourcev1.GitRepository) error {
|
||||||
gvk := sourcev1.GroupVersion.WithKind("GitRepository")
|
gvk := sourcev1.GroupVersion.WithKind(sourcev1.GitRepositoryKind)
|
||||||
export := sourcev1.GitRepository{
|
export := sourcev1.GitRepository{
|
||||||
TypeMeta: metav1.TypeMeta{
|
TypeMeta: metav1.TypeMeta{
|
||||||
Kind: gvk.Kind,
|
Kind: gvk.Kind,
|
||||||
|
|||||||
139
cmd/tk/export_source_helm.go
Normal file
139
cmd/tk/export_source_helm.go
Normal 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
|
||||||
|
tk export source helm --all > sources.yaml
|
||||||
|
|
||||||
|
# Export a HelmRepository source including the basic auth credentials
|
||||||
|
tk 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
|
||||||
|
}
|
||||||
90
cmd/tk/get_helmrelease.go
Normal file
90
cmd/tk/get_helmrelease.go
Normal 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
|
||||||
|
tk 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
|
||||||
|
}
|
||||||
@@ -28,8 +28,11 @@ import (
|
|||||||
var getKsCmd = &cobra.Command{
|
var getKsCmd = &cobra.Command{
|
||||||
Use: "kustomizations",
|
Use: "kustomizations",
|
||||||
Aliases: []string{"ks"},
|
Aliases: []string{"ks"},
|
||||||
Short: "Get Kustomization source statuses",
|
Short: "Get Kustomization statuses",
|
||||||
Long: "The get kustomizations command prints the statuses of the resources.",
|
Long: "The get kustomizations command prints the statuses of the resources.",
|
||||||
|
Example: ` # List all kustomizations and their status
|
||||||
|
tk get kustomizations
|
||||||
|
`,
|
||||||
RunE: getKsCmdRun,
|
RunE: getKsCmdRun,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ var getSourceGitCmd = &cobra.Command{
|
|||||||
Use: "git",
|
Use: "git",
|
||||||
Short: "Get GitRepository source statuses",
|
Short: "Get GitRepository source statuses",
|
||||||
Long: "The get sources git command prints the status of the GitRepository sources.",
|
Long: "The get sources git command prints the status of the GitRepository sources.",
|
||||||
|
Example: ` # List all Git repositories and their status
|
||||||
|
tk get sources git
|
||||||
|
`,
|
||||||
RunE: getSourceGitCmdRun,
|
RunE: getSourceGitCmdRun,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
80
cmd/tk/get_source_helm.go
Normal file
80
cmd/tk/get_source_helm.go
Normal 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
|
||||||
|
tk 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
|
||||||
|
}
|
||||||
@@ -59,6 +59,8 @@ var (
|
|||||||
installManifestsPath string
|
installManifestsPath string
|
||||||
installVersion string
|
installVersion string
|
||||||
installComponents []string
|
installComponents []string
|
||||||
|
installRegistry string
|
||||||
|
installImagePullSecret string
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -70,8 +72,12 @@ func init() {
|
|||||||
"toolkit version")
|
"toolkit version")
|
||||||
installCmd.Flags().StringSliceVar(&installComponents, "components", defaultComponents,
|
installCmd.Flags().StringSliceVar(&installComponents, "components", defaultComponents,
|
||||||
"list of components, accepts comma-separated values")
|
"list of components, accepts comma-separated values")
|
||||||
installCmd.Flags().StringVarP(&installManifestsPath, "manifests", "", "",
|
installCmd.Flags().StringVar(&installManifestsPath, "manifests", "",
|
||||||
"path to the manifest directory, dev only")
|
"path to the manifest directory, dev only")
|
||||||
|
installCmd.Flags().StringVar(&installRegistry, "registry", "docker.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")
|
||||||
rootCmd.AddCommand(installCmd)
|
rootCmd.AddCommand(installCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +103,7 @@ func installCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
logger.Generatef("generating manifests")
|
logger.Generatef("generating manifests")
|
||||||
}
|
}
|
||||||
if kustomizePath == "" {
|
if kustomizePath == "" {
|
||||||
err = genInstallManifests(installVersion, namespace, installComponents, tmpDir)
|
err = genInstallManifests(installVersion, namespace, installComponents, installRegistry, installImagePullSecret, tmpDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("install failed: %w", err)
|
return fmt.Errorf("install failed: %w", err)
|
||||||
}
|
}
|
||||||
@@ -118,6 +124,7 @@ func installCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
} else if installExport {
|
} else if installExport {
|
||||||
fmt.Println("---")
|
fmt.Println("---")
|
||||||
fmt.Println("# GitOps Toolkit revision", installVersion, time.Now().Format(time.RFC3339))
|
fmt.Println("# GitOps Toolkit revision", installVersion, time.Now().Format(time.RFC3339))
|
||||||
|
fmt.Println("# Components:", strings.Join(installComponents, ","))
|
||||||
fmt.Print(yaml)
|
fmt.Print(yaml)
|
||||||
fmt.Println("---")
|
fmt.Println("---")
|
||||||
return nil
|
return nil
|
||||||
@@ -183,12 +190,15 @@ fieldSpecs:
|
|||||||
`
|
`
|
||||||
|
|
||||||
var kustomizationTmpl = `---
|
var kustomizationTmpl = `---
|
||||||
{{- $version := .Version }}
|
{{- $eventsAddr := .EventsAddr }}
|
||||||
|
{{- $registry := .Registry }}
|
||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
namespace: {{.Namespace}}
|
namespace: {{.Namespace}}
|
||||||
|
|
||||||
transformers:
|
transformers:
|
||||||
- labels.yaml
|
- labels.yaml
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
- namespace.yaml
|
- namespace.yaml
|
||||||
- policies.yaml
|
- policies.yaml
|
||||||
@@ -196,6 +206,34 @@ resources:
|
|||||||
{{- range .Components }}
|
{{- range .Components }}
|
||||||
- {{.}}.yaml
|
- {{.}}.yaml
|
||||||
{{- end }}
|
{{- 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}}
|
||||||
|
newName: {{$registry}}/{{$component}}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
`
|
`
|
||||||
|
|
||||||
var kustomizationRolesTmpl = `---
|
var kustomizationRolesTmpl = `---
|
||||||
@@ -206,6 +244,23 @@ resources:
|
|||||||
nameSuffix: -{{.Namespace}}
|
nameSuffix: -{{.Namespace}}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
var nodeSelectorTmpl = `---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: all
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
nodeSelector:
|
||||||
|
kubernetes.io/arch: amd64
|
||||||
|
kubernetes.io/os: linux
|
||||||
|
{{- if .ImagePullSecret }}
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: {{.ImagePullSecret}}
|
||||||
|
{{- end }}
|
||||||
|
`
|
||||||
|
|
||||||
func downloadManifests(version string, tmpDir string) error {
|
func downloadManifests(version string, tmpDir string) error {
|
||||||
ghURL := "https://github.com/fluxcd/toolkit/releases/latest/download/manifests.tar.gz"
|
ghURL := "https://github.com/fluxcd/toolkit/releases/latest/download/manifests.tar.gz"
|
||||||
if strings.HasPrefix(version, "v") {
|
if strings.HasPrefix(version, "v") {
|
||||||
@@ -240,15 +295,26 @@ func downloadManifests(version string, tmpDir string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func genInstallManifests(version string, namespace string, components []string, tmpDir string) error {
|
func genInstallManifests(version string, namespace string, components []string, registry, imagePullSecret, tmpDir string) error {
|
||||||
|
eventsAddr := ""
|
||||||
|
if utils.containsItemString(components, defaultNotification) {
|
||||||
|
eventsAddr = fmt.Sprintf("http://%s/", defaultNotification)
|
||||||
|
}
|
||||||
|
|
||||||
model := struct {
|
model := struct {
|
||||||
Version string
|
Version string
|
||||||
Namespace string
|
Namespace string
|
||||||
Components []string
|
Components []string
|
||||||
|
EventsAddr string
|
||||||
|
Registry string
|
||||||
|
ImagePullSecret string
|
||||||
}{
|
}{
|
||||||
Version: version,
|
Version: version,
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Components: components,
|
Components: components,
|
||||||
|
EventsAddr: eventsAddr,
|
||||||
|
Registry: registry,
|
||||||
|
ImagePullSecret: imagePullSecret,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := downloadManifests(version, tmpDir); err != nil {
|
if err := downloadManifests(version, tmpDir); err != nil {
|
||||||
@@ -263,6 +329,10 @@ func genInstallManifests(version string, namespace string, components []string,
|
|||||||
return fmt.Errorf("generate labels failed: %w", err)
|
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 {
|
if err := utils.execTemplate(model, kustomizationTmpl, path.Join(tmpDir, "kustomization.yaml")); err != nil {
|
||||||
return fmt.Errorf("generate kustomization failed: %w", err)
|
return fmt.Errorf("generate kustomization failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ var (
|
|||||||
defaultComponents = []string{"source-controller", "kustomize-controller", "helm-controller", "notification-controller"}
|
defaultComponents = []string{"source-controller", "kustomize-controller", "helm-controller", "notification-controller"}
|
||||||
defaultVersion = "latest"
|
defaultVersion = "latest"
|
||||||
defaultNamespace = "gitops-system"
|
defaultNamespace = "gitops-system"
|
||||||
|
defaultNotification = "notification-controller"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ var reconcileSourceHelmCmd = &cobra.Command{
|
|||||||
Use: "helm [name]",
|
Use: "helm [name]",
|
||||||
Short: "Reconcile a HelmRepository source",
|
Short: "Reconcile a HelmRepository source",
|
||||||
Long: `The reconcile source command triggers a reconciliation of a HelmRepository resource and waits for it to finish.`,
|
Long: `The reconcile source command triggers a reconciliation of a HelmRepository resource and waits for it to finish.`,
|
||||||
Example: ` # Trigger a helm repo update for an existing source
|
Example: ` # Trigger a reconciliation for an existing source
|
||||||
tk reconcile source helm podinfo
|
tk reconcile source helm podinfo
|
||||||
`,
|
`,
|
||||||
RunE: syncSourceHelmCmdRun,
|
RunE: syncSourceHelmCmdRun,
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ var resumeHrCmd = &cobra.Command{
|
|||||||
Short: "Resume a suspended HelmRelease",
|
Short: "Resume a suspended HelmRelease",
|
||||||
Long: `The resume command marks a previously suspended HelmRelease resource for reconciliation and waits for it to
|
Long: `The resume command marks a previously suspended HelmRelease resource for reconciliation and waits for it to
|
||||||
finish the apply.`,
|
finish the apply.`,
|
||||||
|
Example: ` # Resume reconciliation for an existing Helm release
|
||||||
|
tk resume hr podinfo
|
||||||
|
`,
|
||||||
RunE: resumeHrCmdRun,
|
RunE: resumeHrCmdRun,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ var resumeKsCmd = &cobra.Command{
|
|||||||
Short: "Resume a suspended Kustomization",
|
Short: "Resume a suspended Kustomization",
|
||||||
Long: `The resume command marks a previously suspended Kustomization resource for reconciliation and waits for it to
|
Long: `The resume command marks a previously suspended Kustomization resource for reconciliation and waits for it to
|
||||||
finish the apply.`,
|
finish the apply.`,
|
||||||
|
Example: ` # Resume reconciliation for an existing Kustomization
|
||||||
|
tk resume ks podinfo
|
||||||
|
`,
|
||||||
RunE: resumeKsCmdRun,
|
RunE: resumeKsCmdRun,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ var suspendHrCmd = &cobra.Command{
|
|||||||
Aliases: []string{"hr"},
|
Aliases: []string{"hr"},
|
||||||
Short: "Suspend reconciliation of HelmRelease",
|
Short: "Suspend reconciliation of HelmRelease",
|
||||||
Long: "The suspend command disables the reconciliation of a HelmRelease resource.",
|
Long: "The suspend command disables the reconciliation of a HelmRelease resource.",
|
||||||
|
Example: ` # Suspend reconciliation for an existing Helm release
|
||||||
|
tk suspend hr podinfo
|
||||||
|
`,
|
||||||
RunE: suspendHrCmdRun,
|
RunE: suspendHrCmdRun,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ var suspendKsCmd = &cobra.Command{
|
|||||||
Aliases: []string{"ks"},
|
Aliases: []string{"ks"},
|
||||||
Short: "Suspend reconciliation of Kustomization",
|
Short: "Suspend reconciliation of Kustomization",
|
||||||
Long: "The suspend command disables the reconciliation of a Kustomization resource.",
|
Long: "The suspend command disables the reconciliation of a Kustomization resource.",
|
||||||
|
Example: ` # Suspend reconciliation for an existing Kustomization
|
||||||
|
tk suspend ks podinfo
|
||||||
|
`,
|
||||||
RunE: suspendKsCmdRun,
|
RunE: suspendKsCmdRun,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,10 +19,12 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/manifoldco/promptui"
|
"github.com/manifoldco/promptui"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1alpha1"
|
||||||
|
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var uninstallCmd = &cobra.Command{
|
var uninstallCmd = &cobra.Command{
|
||||||
@@ -30,27 +32,27 @@ var uninstallCmd = &cobra.Command{
|
|||||||
Short: "Uninstall the toolkit components",
|
Short: "Uninstall the toolkit components",
|
||||||
Long: "The uninstall command removes the namespace, cluster roles, cluster role bindings and CRDs from the cluster.",
|
Long: "The uninstall command removes the namespace, cluster roles, cluster role bindings and CRDs from the cluster.",
|
||||||
Example: ` # Dry-run uninstall of all components
|
Example: ` # Dry-run uninstall of all components
|
||||||
uninstall --dry-run --namespace=gitops-system
|
tk uninstall --dry-run --namespace=gitops-system
|
||||||
|
|
||||||
# Uninstall all components and delete custom resource definitions
|
# Uninstall all components and delete custom resource definitions
|
||||||
uninstall --crds --namespace=gitops-system
|
tk uninstall --resources --crds --namespace=gitops-system
|
||||||
`,
|
`,
|
||||||
RunE: uninstallCmdRun,
|
RunE: uninstallCmdRun,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
uninstallCRDs bool
|
uninstallCRDs bool
|
||||||
uninstallKustomizations bool
|
uninstallResources bool
|
||||||
uninstallDryRun bool
|
uninstallDryRun bool
|
||||||
uninstallSilent bool
|
uninstallSilent bool
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
uninstallCmd.Flags().BoolVarP(&uninstallKustomizations, "kustomizations", "", false,
|
uninstallCmd.Flags().BoolVar(&uninstallResources, "resources", false,
|
||||||
"removes all Kustomizations previously installed")
|
"removes custom resources such as Kustomizations, GitRepositories and HelmRepositories")
|
||||||
uninstallCmd.Flags().BoolVarP(&uninstallCRDs, "crds", "", false,
|
uninstallCmd.Flags().BoolVar(&uninstallCRDs, "crds", false,
|
||||||
"removes all CRDs previously installed")
|
"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")
|
"only print the object that would be deleted")
|
||||||
uninstallCmd.Flags().BoolVarP(&uninstallSilent, "silent", "s", false,
|
uninstallCmd.Flags().BoolVarP(&uninstallSilent, "silent", "s", false,
|
||||||
"delete components without asking for confirmation")
|
"delete components without asking for confirmation")
|
||||||
@@ -75,18 +77,19 @@ func uninstallCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if uninstallKustomizations {
|
if uninstallResources {
|
||||||
logger.Actionf("uninstalling kustomizations")
|
logger.Actionf("uninstalling custom resources")
|
||||||
command := fmt.Sprintf("kubectl -n %s delete kustomizations --all --timeout=%s %s",
|
for _, kind := range []string{
|
||||||
namespace, timeout.String(), dryRun)
|
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 {
|
if _, err := utils.execCommand(ctx, ModeOS, command); err != nil {
|
||||||
return fmt.Errorf("uninstall failed")
|
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"
|
kinds := "namespace,clusterroles,clusterrolebindings"
|
||||||
|
|||||||
@@ -26,12 +26,14 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1alpha1"
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/client-go/tools/clientcmd"
|
"k8s.io/client-go/tools/clientcmd"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
"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 {
|
type Utils struct {
|
||||||
@@ -118,6 +120,7 @@ func (*Utils) kubeClient(config string) (client.Client, error) {
|
|||||||
_ = corev1.AddToScheme(scheme)
|
_ = corev1.AddToScheme(scheme)
|
||||||
_ = sourcev1.AddToScheme(scheme)
|
_ = sourcev1.AddToScheme(scheme)
|
||||||
_ = kustomizev1.AddToScheme(scheme)
|
_ = kustomizev1.AddToScheme(scheme)
|
||||||
|
_ = helmv2.AddToScheme(scheme)
|
||||||
|
|
||||||
kubeClient, err := client.New(cfg, client.Options{
|
kubeClient, err := client.New(cfg, client.Options{
|
||||||
Scheme: scheme,
|
Scheme: scheme,
|
||||||
@@ -163,3 +166,12 @@ func (*Utils) copyFile(src, dst string) error {
|
|||||||
}
|
}
|
||||||
return out.Close()
|
return out.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (*Utils) containsItemString(s []string, e string) bool {
|
||||||
|
for _, a := range s {
|
||||||
|
if a == e {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ The bootstrap sub-commands bootstrap the toolkit components on the targeted Git
|
|||||||
```
|
```
|
||||||
--components strings list of components, accepts comma-separated values (default [source-controller,kustomize-controller,helm-controller,notification-controller])
|
--components strings list of components, accepts comma-separated values (default [source-controller,kustomize-controller,helm-controller,notification-controller])
|
||||||
-h, --help help for bootstrap
|
-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 "docker.io/fluxcd")
|
||||||
-v, --version string toolkit version (default "latest")
|
-v, --version string toolkit version (default "latest")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -21,19 +21,19 @@ tk bootstrap github [flags]
|
|||||||
export GITHUB_TOKEN=<my-token>
|
export GITHUB_TOKEN=<my-token>
|
||||||
|
|
||||||
# Run bootstrap for a private repo owned by a GitHub organization
|
# Run bootstrap for a private repo owned by a GitHub organization
|
||||||
bootstrap github --owner=<organization> --repository=<repo name>
|
tk bootstrap github --owner=<organization> --repository=<repo name>
|
||||||
|
|
||||||
# Run bootstrap for a private repo and assign organization teams to it
|
# 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>
|
tk bootstrap github --owner=<organization> --repository=<repo name> --team=<team1 slug> --team=<team2 slug>
|
||||||
|
|
||||||
# Run bootstrap for a repository path
|
# Run bootstrap for a repository path
|
||||||
bootstrap github --owner=<organization> --repository=<repo name> --path=dev-cluster
|
tk bootstrap github --owner=<organization> --repository=<repo name> --path=dev-cluster
|
||||||
|
|
||||||
# Run bootstrap for a public repository on a personal account
|
# Run bootstrap for a public repository on a personal account
|
||||||
bootstrap github --owner=<user> --repository=<repo name> --private=false --personal=true
|
tk bootstrap github --owner=<user> --repository=<repo name> --private=false --personal=true
|
||||||
|
|
||||||
# Run bootstrap for a private repo hosted on GitHub Enterprise
|
# Run bootstrap for a private repo hosted on GitHub Enterprise
|
||||||
bootstrap github --owner=<organization> --repository=<repo name> --hostname=<domain>
|
tk bootstrap github --owner=<organization> --repository=<repo name> --hostname=<domain>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -55,8 +55,10 @@ tk bootstrap github [flags]
|
|||||||
|
|
||||||
```
|
```
|
||||||
--components strings list of components, accepts comma-separated values (default [source-controller,kustomize-controller,helm-controller,notification-controller])
|
--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")
|
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
|
||||||
--namespace string the namespace scope for this operation (default "gitops-system")
|
--namespace string the namespace scope for this operation (default "gitops-system")
|
||||||
|
--registry string container registry where the toolkit images are published (default "docker.io/fluxcd")
|
||||||
--timeout duration timeout for this operation (default 5m0s)
|
--timeout duration timeout for this operation (default 5m0s)
|
||||||
--verbose print generated objects
|
--verbose print generated objects
|
||||||
-v, --version string toolkit version (default "latest")
|
-v, --version string toolkit version (default "latest")
|
||||||
|
|||||||
@@ -21,16 +21,16 @@ tk bootstrap gitlab [flags]
|
|||||||
export GITLAB_TOKEN=<my-token>
|
export GITLAB_TOKEN=<my-token>
|
||||||
|
|
||||||
# Run bootstrap for a private repo owned by a GitLab group
|
# Run bootstrap for a private repo owned by a GitLab group
|
||||||
bootstrap gitlab --owner=<group> --repository=<repo name>
|
tk bootstrap gitlab --owner=<group> --repository=<repo name>
|
||||||
|
|
||||||
# Run bootstrap for a repository path
|
# Run bootstrap for a repository path
|
||||||
bootstrap gitlab --owner=<group> --repository=<repo name> --path=dev-cluster
|
tk bootstrap gitlab --owner=<group> --repository=<repo name> --path=dev-cluster
|
||||||
|
|
||||||
# Run bootstrap for a public repository on a personal account
|
# Run bootstrap for a public repository on a personal account
|
||||||
bootstrap gitlab --owner=<user> --repository=<repo name> --private=false --personal=true
|
tk bootstrap gitlab --owner=<user> --repository=<repo name> --private=false --personal=true
|
||||||
|
|
||||||
# Run bootstrap for a private repo hosted on a GitLab server
|
# Run bootstrap for a private repo hosted on a GitLab server
|
||||||
bootstrap gitlab --owner=<group> --repository=<repo name> --hostname=<domain>
|
tk bootstrap gitlab --owner=<group> --repository=<repo name> --hostname=<domain>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -51,8 +51,10 @@ tk bootstrap gitlab [flags]
|
|||||||
|
|
||||||
```
|
```
|
||||||
--components strings list of components, accepts comma-separated values (default [source-controller,kustomize-controller,helm-controller,notification-controller])
|
--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")
|
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
|
||||||
--namespace string the namespace scope for this operation (default "gitops-system")
|
--namespace string the namespace scope for this operation (default "gitops-system")
|
||||||
|
--registry string container registry where the toolkit images are published (default "docker.io/fluxcd")
|
||||||
--timeout duration timeout for this operation (default 5m0s)
|
--timeout duration timeout for this operation (default 5m0s)
|
||||||
--verbose print generated objects
|
--verbose print generated objects
|
||||||
-v, --version string toolkit version (default "latest")
|
-v, --version string toolkit version (default "latest")
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ The create sub-commands generate sources and resources.
|
|||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
|
|
||||||
* [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines
|
* [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines
|
||||||
|
* [tk create helmrelease](tk_create_helmrelease.md) - Create or update a HelmRelease resource
|
||||||
* [tk create kustomization](tk_create_kustomization.md) - Create or update a Kustomization resource
|
* [tk create kustomization](tk_create_kustomization.md) - Create or update a Kustomization resource
|
||||||
* [tk create source](tk_create_source.md) - Create or update sources
|
* [tk create source](tk_create_source.md) - Create or update sources
|
||||||
|
|
||||||
|
|||||||
71
docs/cmd/tk_create_helmrelease.md
Normal file
71
docs/cmd/tk_create_helmrelease.md
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
## tk create helmrelease
|
||||||
|
|
||||||
|
Create or update a HelmRelease resource
|
||||||
|
|
||||||
|
### Synopsis
|
||||||
|
|
||||||
|
The helmrelease create command generates a HelmRelease resource for a given HelmRepository source.
|
||||||
|
|
||||||
|
```
|
||||||
|
tk create helmrelease [name] [flags]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# Create a HelmRelease from a source
|
||||||
|
tk create hr podinfo \
|
||||||
|
--interval=10m \
|
||||||
|
--release-name=podinfo \
|
||||||
|
--target-namespace=default \
|
||||||
|
--source=podinfo \
|
||||||
|
--chart-name=podinfo \
|
||||||
|
--chart-version=">4.0.0"
|
||||||
|
|
||||||
|
# Create a HelmRelease with values for a local YAML file
|
||||||
|
tk create hr podinfo \
|
||||||
|
--target-namespace=default \
|
||||||
|
--source=podinfo \
|
||||||
|
--chart-name=podinfo \
|
||||||
|
--chart-version=4.0.5 \
|
||||||
|
--values=./my-values.yaml
|
||||||
|
|
||||||
|
# Create a HelmRelease definition on disk without applying it on the cluster
|
||||||
|
tk create hr podinfo \
|
||||||
|
--target-namespace=default \
|
||||||
|
--source=podinfo \
|
||||||
|
--chart-name=podinfo \
|
||||||
|
--chart-version=4.0.5 \
|
||||||
|
--values=./values.yaml \
|
||||||
|
--export > podinfo-release.yaml
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
--chart-name string Helm chart name
|
||||||
|
--chart-version string Helm chart version, accepts semver range
|
||||||
|
--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 HelmRepository 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
|
||||||
|
|
||||||
|
* [tk create](tk_create.md) - Create or update sources and resources
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ tk create kustomization [name] [flags]
|
|||||||
|
|
||||||
```
|
```
|
||||||
# Create a Kustomization resource from a source at a given path
|
# Create a Kustomization resource from a source at a given path
|
||||||
create kustomization contour \
|
tk create kustomization contour \
|
||||||
--source=contour \
|
--source=contour \
|
||||||
--path="./examples/contour/" \
|
--path="./examples/contour/" \
|
||||||
--prune=true \
|
--prune=true \
|
||||||
@@ -25,7 +25,7 @@ tk create kustomization [name] [flags]
|
|||||||
--health-check-timeout=3m
|
--health-check-timeout=3m
|
||||||
|
|
||||||
# Create a Kustomization resource that depends on the previous one
|
# Create a Kustomization resource that depends on the previous one
|
||||||
create kustomization webapp \
|
tk create kustomization webapp \
|
||||||
--depends-on=contour \
|
--depends-on=contour \
|
||||||
--source=webapp \
|
--source=webapp \
|
||||||
--path="./deploy/overlays/dev" \
|
--path="./deploy/overlays/dev" \
|
||||||
@@ -34,7 +34,7 @@ tk create kustomization [name] [flags]
|
|||||||
--validation=client
|
--validation=client
|
||||||
|
|
||||||
# Create a Kustomization resource that runs under a service account
|
# Create a Kustomization resource that runs under a service account
|
||||||
create kustomization webapp \
|
tk create kustomization webapp \
|
||||||
--source=webapp \
|
--source=webapp \
|
||||||
--path="./deploy/overlays/staging" \
|
--path="./deploy/overlays/staging" \
|
||||||
--prune=true \
|
--prune=true \
|
||||||
|
|||||||
@@ -27,4 +27,5 @@ The create source sub-commands generate sources.
|
|||||||
|
|
||||||
* [tk create](tk_create.md) - Create or update sources and resources
|
* [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
|
* [tk create source git](tk_create_source_git.md) - Create or update a GitRepository source
|
||||||
|
* [tk create source helm](tk_create_source_helm.md) - Create or update a HelmRepository source
|
||||||
|
|
||||||
|
|||||||
@@ -17,35 +17,35 @@ tk create source git [name] [flags]
|
|||||||
|
|
||||||
```
|
```
|
||||||
# Create a source from a public Git repository master branch
|
# Create a source from a public Git repository master branch
|
||||||
create source git podinfo \
|
tk create source git podinfo \
|
||||||
--url=https://github.com/stefanprodan/podinfo \
|
--url=https://github.com/stefanprodan/podinfo \
|
||||||
--branch=master
|
--branch=master
|
||||||
|
|
||||||
# Create a source from a Git repository pinned to specific git tag
|
# Create a source from a Git repository pinned to specific git tag
|
||||||
create source git podinfo \
|
tk create source git podinfo \
|
||||||
--url=https://github.com/stefanprodan/podinfo \
|
--url=https://github.com/stefanprodan/podinfo \
|
||||||
--tag="3.2.3"
|
--tag="3.2.3"
|
||||||
|
|
||||||
# Create a source from a public Git repository tag that matches a semver range
|
# Create a source from a public Git repository tag that matches a semver range
|
||||||
create source git podinfo \
|
tk create source git podinfo \
|
||||||
--url=https://github.com/stefanprodan/podinfo \
|
--url=https://github.com/stefanprodan/podinfo \
|
||||||
--tag-semver=">=3.2.0 <3.3.0"
|
--tag-semver=">=3.2.0 <3.3.0"
|
||||||
|
|
||||||
# Create a source from a Git repository using SSH authentication
|
# Create a source from a Git repository using SSH authentication
|
||||||
create source git podinfo \
|
tk create source git podinfo \
|
||||||
--url=ssh://git@github.com/stefanprodan/podinfo \
|
--url=ssh://git@github.com/stefanprodan/podinfo \
|
||||||
--branch=master
|
--branch=master
|
||||||
|
|
||||||
# Create a source from a Git repository using SSH authentication and an
|
# Create a source from a Git repository using SSH authentication and an
|
||||||
# ECDSA P-521 curve public key
|
# ECDSA P-521 curve public key
|
||||||
create source git podinfo \
|
tk create source git podinfo \
|
||||||
--url=ssh://git@github.com/stefanprodan/podinfo \
|
--url=ssh://git@github.com/stefanprodan/podinfo \
|
||||||
--branch=master \
|
--branch=master \
|
||||||
--ssh-key-algorithm=ecdsa \
|
--ssh-key-algorithm=ecdsa \
|
||||||
--ssh-ecdsa-curve=p521
|
--ssh-ecdsa-curve=p521
|
||||||
|
|
||||||
# Create a source from a Git repository using basic authentication
|
# Create a source from a Git repository using basic authentication
|
||||||
create source git podinfo \
|
tk create source git podinfo \
|
||||||
--url=https://github.com/stefanprodan/podinfo \
|
--url=https://github.com/stefanprodan/podinfo \
|
||||||
--username=username \
|
--username=username \
|
||||||
--password=password
|
--password=password
|
||||||
|
|||||||
54
docs/cmd/tk_create_source_helm.md
Normal file
54
docs/cmd/tk_create_source_helm.md
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
## tk 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.
|
||||||
|
|
||||||
|
```
|
||||||
|
tk create source helm [name] [flags]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# Create a source from a public Helm repository
|
||||||
|
tk create source helm podinfo \
|
||||||
|
--url=https://stefanprodan.github.io/podinfo \
|
||||||
|
--interval=10m
|
||||||
|
|
||||||
|
# Create a source from a Helm repository using basic authentication
|
||||||
|
tk create source helm podinfo \
|
||||||
|
--url=https://stefanprodan.github.io/podinfo \
|
||||||
|
--username=username \
|
||||||
|
--password=password
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
-h, --help help for helm
|
||||||
|
-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
|
||||||
|
|
||||||
|
* [tk create source](tk_create_source.md) - Create or update sources
|
||||||
|
|
||||||
@@ -25,6 +25,7 @@ The delete sub-commands delete sources and resources.
|
|||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
|
|
||||||
* [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines
|
* [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines
|
||||||
|
* [tk delete helmrelease](tk_delete_helmrelease.md) - Delete a HelmRelease resource
|
||||||
* [tk delete kustomization](tk_delete_kustomization.md) - Delete a Kustomization resource
|
* [tk delete kustomization](tk_delete_kustomization.md) - Delete a Kustomization resource
|
||||||
* [tk delete source](tk_delete_source.md) - Delete sources
|
* [tk delete source](tk_delete_source.md) - Delete sources
|
||||||
|
|
||||||
|
|||||||
40
docs/cmd/tk_delete_helmrelease.md
Normal file
40
docs/cmd/tk_delete_helmrelease.md
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
## tk delete helmrelease
|
||||||
|
|
||||||
|
Delete a HelmRelease resource
|
||||||
|
|
||||||
|
### Synopsis
|
||||||
|
|
||||||
|
The delete helmrelease command removes the given HelmRelease from the cluster.
|
||||||
|
|
||||||
|
```
|
||||||
|
tk delete helmrelease [name] [flags]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# Delete a Helm release and the Kubernetes resources created by it
|
||||||
|
tk 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
|
||||||
|
|
||||||
|
* [tk delete](tk_delete.md) - Delete sources and resources
|
||||||
|
|
||||||
@@ -10,6 +10,14 @@ The delete kustomization command deletes the given Kustomization from the cluste
|
|||||||
tk delete kustomization [name] [flags]
|
tk delete kustomization [name] [flags]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# Delete a kustomization and the Kubernetes resources created by it
|
||||||
|
tk delete kustomization podinfo
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -26,4 +26,5 @@ The delete source sub-commands delete sources.
|
|||||||
|
|
||||||
* [tk delete](tk_delete.md) - Delete sources and resources
|
* [tk delete](tk_delete.md) - Delete sources and resources
|
||||||
* [tk delete source git](tk_delete_source_git.md) - Delete a GitRepository source
|
* [tk delete source git](tk_delete_source_git.md) - Delete a GitRepository source
|
||||||
|
* [tk delete source helm](tk_delete_source_helm.md) - Delete a HelmRepository source
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,14 @@ The delete source git command deletes the given GitRepository from the cluster.
|
|||||||
tk delete source git [name] [flags]
|
tk delete source git [name] [flags]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# Delete a Git repository
|
||||||
|
tk delete source git podinfo
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
40
docs/cmd/tk_delete_source_helm.md
Normal file
40
docs/cmd/tk_delete_source_helm.md
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
## tk delete source helm
|
||||||
|
|
||||||
|
Delete a HelmRepository source
|
||||||
|
|
||||||
|
### Synopsis
|
||||||
|
|
||||||
|
The delete source helm command deletes the given HelmRepository from the cluster.
|
||||||
|
|
||||||
|
```
|
||||||
|
tk delete source helm [name] [flags]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# Delete a Helm repository
|
||||||
|
tk 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
|
||||||
|
|
||||||
|
* [tk delete source](tk_delete_source.md) - Delete sources
|
||||||
|
|
||||||
@@ -25,6 +25,7 @@ The export sub-commands export resources in YAML format.
|
|||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
|
|
||||||
* [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines
|
* [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines
|
||||||
|
* [tk export helmrelease](tk_export_helmrelease.md) - Export HelmRelease resources in YAML format
|
||||||
* [tk export kustomization](tk_export_kustomization.md) - Export Kustomization resources in YAML format
|
* [tk export kustomization](tk_export_kustomization.md) - Export Kustomization resources in YAML format
|
||||||
* [tk export source](tk_export_source.md) - Export sources
|
* [tk export source](tk_export_source.md) - Export sources
|
||||||
|
|
||||||
|
|||||||
43
docs/cmd/tk_export_helmrelease.md
Normal file
43
docs/cmd/tk_export_helmrelease.md
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
## tk export helmrelease
|
||||||
|
|
||||||
|
Export HelmRelease resources in YAML format
|
||||||
|
|
||||||
|
### Synopsis
|
||||||
|
|
||||||
|
The export helmrelease command exports one or all HelmRelease resources in YAML format.
|
||||||
|
|
||||||
|
```
|
||||||
|
tk export helmrelease [name] [flags]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# Export all HelmRelease resources
|
||||||
|
tk export helmrelease --all > kustomizations.yaml
|
||||||
|
|
||||||
|
# Export a HelmRelease
|
||||||
|
tk 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
|
||||||
|
|
||||||
|
* [tk export](tk_export.md) - Export resources in YAML format
|
||||||
|
|
||||||
@@ -14,10 +14,10 @@ tk export kustomization [name] [flags]
|
|||||||
|
|
||||||
```
|
```
|
||||||
# Export all Kustomization resources
|
# Export all Kustomization resources
|
||||||
export kustomization --all > kustomizations.yaml
|
tk export kustomization --all > kustomizations.yaml
|
||||||
|
|
||||||
# Export a Kustomization
|
# Export a Kustomization
|
||||||
export kustomization my-app > kustomization.yaml
|
tk export kustomization my-app > kustomization.yaml
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -27,4 +27,5 @@ The export source sub-commands export sources in YAML format.
|
|||||||
|
|
||||||
* [tk export](tk_export.md) - Export resources in YAML format
|
* [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
|
* [tk export source git](tk_export_source_git.md) - Export GitRepository sources in YAML format
|
||||||
|
* [tk export source helm](tk_export_source_helm.md) - Export HelmRepository sources in YAML format
|
||||||
|
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ tk export source git [name] [flags]
|
|||||||
|
|
||||||
```
|
```
|
||||||
# Export all GitRepository sources
|
# Export all GitRepository sources
|
||||||
export source git --all > sources.yaml
|
tk export source git --all > sources.yaml
|
||||||
|
|
||||||
# Export a GitRepository source including the SSH key pair or basic auth credentials
|
# Export a GitRepository source including the SSH key pair or basic auth credentials
|
||||||
export source git my-private-repo --with-credentials > source.yaml
|
tk export source git my-private-repo --with-credentials > source.yaml
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
44
docs/cmd/tk_export_source_helm.md
Normal file
44
docs/cmd/tk_export_source_helm.md
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
## tk export source helm
|
||||||
|
|
||||||
|
Export HelmRepository sources in YAML format
|
||||||
|
|
||||||
|
### Synopsis
|
||||||
|
|
||||||
|
The export source git command exports on or all HelmRepository sources in YAML format.
|
||||||
|
|
||||||
|
```
|
||||||
|
tk export source helm [name] [flags]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# Export all HelmRepository sources
|
||||||
|
tk export source helm --all > sources.yaml
|
||||||
|
|
||||||
|
# Export a HelmRepository source including the basic auth credentials
|
||||||
|
tk 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
|
||||||
|
|
||||||
|
* [tk export source](tk_export_source.md) - Export sources
|
||||||
|
|
||||||
@@ -24,6 +24,7 @@ The get sub-commands print the statuses of sources and resources.
|
|||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
|
|
||||||
* [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines
|
* [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines
|
||||||
* [tk get kustomizations](tk_get_kustomizations.md) - Get Kustomization source statuses
|
* [tk get helmreleases](tk_get_helmreleases.md) - Get HelmRelease statuses
|
||||||
|
* [tk get kustomizations](tk_get_kustomizations.md) - Get Kustomization statuses
|
||||||
* [tk get sources](tk_get_sources.md) - Get source statuses
|
* [tk get sources](tk_get_sources.md) - Get source statuses
|
||||||
|
|
||||||
|
|||||||
39
docs/cmd/tk_get_helmreleases.md
Normal file
39
docs/cmd/tk_get_helmreleases.md
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
## tk get helmreleases
|
||||||
|
|
||||||
|
Get HelmRelease statuses
|
||||||
|
|
||||||
|
### Synopsis
|
||||||
|
|
||||||
|
The get helmreleases command prints the statuses of the resources.
|
||||||
|
|
||||||
|
```
|
||||||
|
tk get helmreleases [flags]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# List all Helm releases and their status
|
||||||
|
tk 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
|
||||||
|
|
||||||
|
* [tk get](tk_get.md) - Get sources and resources
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
## tk get kustomizations
|
## tk get kustomizations
|
||||||
|
|
||||||
Get Kustomization source statuses
|
Get Kustomization statuses
|
||||||
|
|
||||||
### Synopsis
|
### Synopsis
|
||||||
|
|
||||||
@@ -10,6 +10,14 @@ The get kustomizations command prints the statuses of the resources.
|
|||||||
tk get kustomizations [flags]
|
tk get kustomizations [flags]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# List all kustomizations and their status
|
||||||
|
tk get kustomizations
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -25,4 +25,5 @@ The get source sub-commands print the statuses of the sources.
|
|||||||
|
|
||||||
* [tk get](tk_get.md) - Get sources and resources
|
* [tk get](tk_get.md) - Get sources and resources
|
||||||
* [tk get sources git](tk_get_sources_git.md) - Get GitRepository source statuses
|
* [tk get sources git](tk_get_sources_git.md) - Get GitRepository source statuses
|
||||||
|
* [tk get sources helm](tk_get_sources_helm.md) - Get HelmRepository source statuses
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,14 @@ The get sources git command prints the status of the GitRepository sources.
|
|||||||
tk get sources git [flags]
|
tk get sources git [flags]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# List all Git repositories and their status
|
||||||
|
tk get sources git
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
39
docs/cmd/tk_get_sources_helm.md
Normal file
39
docs/cmd/tk_get_sources_helm.md
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
## tk get sources helm
|
||||||
|
|
||||||
|
Get HelmRepository source statuses
|
||||||
|
|
||||||
|
### Synopsis
|
||||||
|
|
||||||
|
The get sources helm command prints the status of the HelmRepository sources.
|
||||||
|
|
||||||
|
```
|
||||||
|
tk get sources helm [flags]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# List all Helm repositories and their status
|
||||||
|
tk 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
|
||||||
|
|
||||||
|
* [tk get sources](tk_get_sources.md) - Get source statuses
|
||||||
|
|
||||||
@@ -35,7 +35,9 @@ tk install [flags]
|
|||||||
--dry-run only print the object that would be applied
|
--dry-run only print the object that would be applied
|
||||||
--export write the install manifests to stdout and exit
|
--export write the install manifests to stdout and exit
|
||||||
-h, --help help for install
|
-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
|
--manifests string path to the manifest directory, dev only
|
||||||
|
--registry string container registry where the toolkit images are published (default "docker.io/fluxcd")
|
||||||
-v, --version string toolkit version (default "latest")
|
-v, --version string toolkit version (default "latest")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ tk reconcile source helm [name] [flags]
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
# Trigger a helm repo update for an existing source
|
# Trigger a reconciliation for an existing source
|
||||||
tk reconcile source helm podinfo
|
tk reconcile source helm podinfo
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -11,6 +11,14 @@ finish the apply.
|
|||||||
tk resume helmrelease [name] [flags]
|
tk resume helmrelease [name] [flags]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# Resume reconciliation for an existing Helm release
|
||||||
|
tk resume hr podinfo
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -11,6 +11,14 @@ finish the apply.
|
|||||||
tk resume kustomization [name] [flags]
|
tk resume kustomization [name] [flags]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# Resume reconciliation for an existing Kustomization
|
||||||
|
tk resume ks podinfo
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -10,6 +10,14 @@ The suspend command disables the reconciliation of a HelmRelease resource.
|
|||||||
tk suspend helmrelease [name] [flags]
|
tk suspend helmrelease [name] [flags]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# Suspend reconciliation for an existing Helm release
|
||||||
|
tk suspend hr podinfo
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -10,6 +10,14 @@ The suspend command disables the reconciliation of a Kustomization resource.
|
|||||||
tk suspend kustomization [name] [flags]
|
tk suspend kustomization [name] [flags]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# Suspend reconciliation for an existing Kustomization
|
||||||
|
tk suspend ks podinfo
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ tk uninstall [flags]
|
|||||||
|
|
||||||
```
|
```
|
||||||
# Dry-run uninstall of all components
|
# Dry-run uninstall of all components
|
||||||
uninstall --dry-run --namespace=gitops-system
|
tk uninstall --dry-run --namespace=gitops-system
|
||||||
|
|
||||||
# Uninstall all components and delete custom resource definitions
|
# Uninstall all components and delete custom resource definitions
|
||||||
uninstall --crds --namespace=gitops-system
|
tk uninstall --resources --crds --namespace=gitops-system
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ tk uninstall [flags]
|
|||||||
--crds removes all CRDs previously installed
|
--crds removes all CRDs previously installed
|
||||||
--dry-run only print the object that would be deleted
|
--dry-run only print the object that would be deleted
|
||||||
-h, --help help for uninstall
|
-h, --help help for uninstall
|
||||||
--kustomizations removes all Kustomizations previously installed
|
--resources removes custom resources such as Kustomizations, GitRepositories and HelmRepositories
|
||||||
-s, --silent delete components without asking for confirmation
|
-s, --silent delete components without asking for confirmation
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ If you delete a kustomization from the `fleet-infra` repo, the reconciler will r
|
|||||||
were previously applied from that kustomization.
|
were previously applied from that kustomization.
|
||||||
|
|
||||||
If you alter the webapp deployment using `kubectl edit`, the changes will be reverted to match
|
If you alter the webapp deployment using `kubectl edit`, the changes will be reverted to match
|
||||||
the state described in git. When dealing with an incident, you can pause the recitation of a
|
the state described in git. When dealing with an incident, you can pause the reconciliation of a
|
||||||
kustomization with `tk suspend kustomization <name>`. Once the debugging session
|
kustomization with `tk suspend kustomization <name>`. Once the debugging session
|
||||||
is over, you can re-enable the reconciliation with `tk resume kustomization <name>`.
|
is over, you can re-enable the reconciliation with `tk resume kustomization <name>`.
|
||||||
|
|
||||||
|
|||||||
173
docs/guides/sealed-secrets.md
Normal file
173
docs/guides/sealed-secrets.md
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
# Sealed Secrets
|
||||||
|
|
||||||
|
In order to store secrets safely in a public or private Git repository, you can use
|
||||||
|
Bitnami's [sealed-secrets controller](https://github.com/bitnami-labs/sealed-secrets)
|
||||||
|
and encrypt your Kubernetes Secrets into SealedSecrets.
|
||||||
|
The sealed secrets can be decrypted only by the controller running in your cluster and
|
||||||
|
nobody else can obtain the original secret, even if they have access to the Git repository.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
To follow this guide you'll need a Kubernetes cluster with the GitOps
|
||||||
|
toolkit controllers installed on it.
|
||||||
|
Please see the [get started guide](../get-started/index.md)
|
||||||
|
or the [install command docs](../cmd/tk_install.md).
|
||||||
|
|
||||||
|
The sealed-secrets controller comes with a companion CLI tool called kubeseal.
|
||||||
|
With kubeseal you can create SealedSecret custom resources in YAML format
|
||||||
|
and store those in your Git repository.
|
||||||
|
|
||||||
|
Install the kubeseal CLI:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
brew install kubeseal
|
||||||
|
```
|
||||||
|
|
||||||
|
For Linux or Windows you can download the kubeseal binary from
|
||||||
|
[GitHub](https://github.com/bitnami-labs/sealed-secrets/releases).
|
||||||
|
|
||||||
|
## Deploy sealed-secrets with a HelmRelease
|
||||||
|
|
||||||
|
You'll be using [helm-controller](../components/helm/controller.md) APIs to install
|
||||||
|
the sealed-secrets controller from its [Helm chart](https://hub.kubeapps.com/charts/stable/sealed-secrets).
|
||||||
|
|
||||||
|
First you have to register the Helm repository where the sealed-secrets chart is published:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk create source helm stable \
|
||||||
|
--interval=1h \
|
||||||
|
--url=https://kubernetes-charts.storage.googleapis.com
|
||||||
|
```
|
||||||
|
|
||||||
|
With `interval` we configure [source-controller](../components/source/controller.md) to download
|
||||||
|
the Helm repository index every hour. If a newer version of sealed-secrets is published,
|
||||||
|
source-controller will signal helm-controller that a new chart is available.
|
||||||
|
|
||||||
|
Create a Helm release that installs the latest version of sealed-secrets controller:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk create helmrelease sealed-secrets \
|
||||||
|
--interval=1h \
|
||||||
|
--release-name=sealed-secrets \
|
||||||
|
--target-namespace=gitops-system \
|
||||||
|
--source=stable \
|
||||||
|
--chart-name=sealed-secrets \
|
||||||
|
--chart-version="^1.10.0"
|
||||||
|
```
|
||||||
|
|
||||||
|
With chart version `^1.10.0` we configure helm-controller to automatically upgrade the release
|
||||||
|
when a new chart version is fetch by source-controller.
|
||||||
|
|
||||||
|
At startup, the sealed-secrets controller generates a 4096-bit RSA key pair and
|
||||||
|
persists the private and public keys as Kubernetes secrets in the `gitops-system` namespace.
|
||||||
|
|
||||||
|
You can retrieve the public key with:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
kubeseal --fetch-cert \
|
||||||
|
--controller-name=sealed-secrets \
|
||||||
|
--controller-namespace=gitops-system \
|
||||||
|
> pub-sealed-secrets.pem
|
||||||
|
```
|
||||||
|
|
||||||
|
The public key can be safely stored in Git, and can be used to encrypt secrets
|
||||||
|
without direct access to the Kubernetes cluster.
|
||||||
|
|
||||||
|
## Encrypt secrets
|
||||||
|
|
||||||
|
Generate a Kubernetes secret manifest with kubectl:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
kubectl -n default create secret generic basic-auth \
|
||||||
|
--from-literal=user=admin \
|
||||||
|
--from-literal=password=change-me \
|
||||||
|
--dry-run \
|
||||||
|
-o yaml > basic-auth.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
Encrypt the secret with kubeseal:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
kubeseal --format=yaml --cert=pub-sealed-secrets.pem \
|
||||||
|
< basic-auth.yaml > basic-auth-sealed.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
Delete the plain secret and apply the sealed one:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
rm basic-auth.yaml
|
||||||
|
kubectl apply -f basic-auth-sealed.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
Verify that the sealed-secrets controller has created the `basic-auth` Kubernetes Secret:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ kubectl -n default get secrets basic-auth
|
||||||
|
|
||||||
|
NAME TYPE DATA AGE
|
||||||
|
basic-auth Opaque 2 1m43s
|
||||||
|
```
|
||||||
|
|
||||||
|
## GitOps workflow
|
||||||
|
|
||||||
|
A cluster admin should add the stable `HelmRepository` manifest and the sealed-secrets `HelmRelease`
|
||||||
|
to the fleet repository.
|
||||||
|
|
||||||
|
Helm repository manifest:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: source.fluxcd.io/v1alpha1
|
||||||
|
kind: HelmRepository
|
||||||
|
metadata:
|
||||||
|
name: stable
|
||||||
|
namespace: gitops-system
|
||||||
|
spec:
|
||||||
|
interval: 1h0m0s
|
||||||
|
url: https://kubernetes-charts.storage.googleapis.com
|
||||||
|
```
|
||||||
|
|
||||||
|
Helm release manifest:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: helm.fluxcd.io/v2alpha1
|
||||||
|
kind: HelmRelease
|
||||||
|
metadata:
|
||||||
|
name: sealed-secrets
|
||||||
|
namespace: gitops-system
|
||||||
|
spec:
|
||||||
|
chart:
|
||||||
|
name: sealed-secrets
|
||||||
|
sourceRef:
|
||||||
|
kind: HelmRepository
|
||||||
|
name: stable
|
||||||
|
version: "^1.10.0"
|
||||||
|
interval: 1h0m0s
|
||||||
|
releaseName: sealed-secrets
|
||||||
|
targetNamespace: gitops-system
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! hint
|
||||||
|
You can generate the above manifests using `tk create <kind> --export > manifest.yaml`.
|
||||||
|
|
||||||
|
Once the sealed-secrets controller is installed, the admin fetches the
|
||||||
|
public key and shares it with the teams that operate on the fleet clusters via Git.
|
||||||
|
|
||||||
|
When a team member wants to create a Kubernetes Secret on a cluster,
|
||||||
|
they uses kubeseal and the public key corresponding to that cluster to generate a SealedSecret.
|
||||||
|
|
||||||
|
Assuming a team member wants to deploy an application that needs to connect
|
||||||
|
to a database using a username and password, they'll be doing the following:
|
||||||
|
|
||||||
|
* create a Kubernetes Secret manifest locally with the db credentials e.g. `db-auth.yaml`
|
||||||
|
* encrypt the secret with kubeseal as `db-auth-sealed.yaml`
|
||||||
|
* delete the original secret file `db-auth.yaml`
|
||||||
|
* create a Kubernetes Deployment manifest for the app e.g. `app-deployment.yaml`
|
||||||
|
* add the Secret to the Deployment manifest as a [volume mount or env var](https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets) using the original name `db-auth`
|
||||||
|
* commit the manifests `db-auth-sealed.yaml` and `app-deployment.yaml` to a Git repository that's being synced by the GitOps toolkit controllers
|
||||||
|
|
||||||
|
Once the manifests have been pushed to the Git repository, the following happens:
|
||||||
|
|
||||||
|
* source-controller pulls the changes from Git
|
||||||
|
* kustomize-controller applies the SealedSecret and the Deployment manifests
|
||||||
|
* sealed-secrets controller decrypts the SealedSecret and creates a Kubernetes Secret
|
||||||
|
* kubelet creates the pods and mounts the secret as a volume or env variable inside the app container
|
||||||
3
go.mod
3
go.mod
@@ -4,7 +4,7 @@ go 1.14
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/blang/semver v3.5.1+incompatible
|
github.com/blang/semver v3.5.1+incompatible
|
||||||
github.com/fluxcd/helm-controller v0.0.1-beta.1
|
github.com/fluxcd/helm-controller v0.0.1-beta.4
|
||||||
github.com/fluxcd/kustomize-controller v0.0.5
|
github.com/fluxcd/kustomize-controller v0.0.5
|
||||||
github.com/fluxcd/pkg v0.0.3
|
github.com/fluxcd/pkg v0.0.3
|
||||||
github.com/fluxcd/source-controller v0.0.6
|
github.com/fluxcd/source-controller v0.0.6
|
||||||
@@ -16,6 +16,7 @@ require (
|
|||||||
google.golang.org/appengine v1.6.6 // indirect
|
google.golang.org/appengine v1.6.6 // indirect
|
||||||
google.golang.org/protobuf v1.24.0 // indirect
|
google.golang.org/protobuf v1.24.0 // indirect
|
||||||
k8s.io/api v0.18.4
|
k8s.io/api v0.18.4
|
||||||
|
k8s.io/apiextensions-apiserver v0.18.4
|
||||||
k8s.io/apimachinery v0.18.4
|
k8s.io/apimachinery v0.18.4
|
||||||
k8s.io/client-go v0.18.4
|
k8s.io/client-go v0.18.4
|
||||||
sigs.k8s.io/controller-runtime v0.6.1
|
sigs.k8s.io/controller-runtime v0.6.1
|
||||||
|
|||||||
4
go.sum
4
go.sum
@@ -172,8 +172,8 @@ github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d h1:105gxyaGwC
|
|||||||
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d/go.mod h1:ZZMPRZwes7CROmyNKgQzC3XPs6L/G2EJLHddWejkmf4=
|
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d/go.mod h1:ZZMPRZwes7CROmyNKgQzC3XPs6L/G2EJLHddWejkmf4=
|
||||||
github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc=
|
github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc=
|
||||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||||
github.com/fluxcd/helm-controller v0.0.1-beta.1 h1:XNQWhrKmT4KcJ0kaNbl/QsN+aTDU8XCMmFB1pnexpaQ=
|
github.com/fluxcd/helm-controller v0.0.1-beta.4 h1:Go7ZGI91BY6A69Qp9TdJg3nufaahQCYhpj7Lum9oyKA=
|
||||||
github.com/fluxcd/helm-controller v0.0.1-beta.1/go.mod h1:asoN9pG8J0oQ9iXpkxNwvch1EKspus6RxH818ZYVo+4=
|
github.com/fluxcd/helm-controller v0.0.1-beta.4/go.mod h1:asoN9pG8J0oQ9iXpkxNwvch1EKspus6RxH818ZYVo+4=
|
||||||
github.com/fluxcd/kustomize-controller v0.0.5 h1:jjBJT/UbblMaeQpYn5TjH/oXXnORO6C3Cka77bs9K3Q=
|
github.com/fluxcd/kustomize-controller v0.0.5 h1:jjBJT/UbblMaeQpYn5TjH/oXXnORO6C3Cka77bs9K3Q=
|
||||||
github.com/fluxcd/kustomize-controller v0.0.5/go.mod h1:1O78f9Qigs74BMxO/ThzLt5XGGQnwQPgzi+47ntie5M=
|
github.com/fluxcd/kustomize-controller v0.0.5/go.mod h1:1O78f9Qigs74BMxO/ThzLt5XGGQnwQPgzi+47ntie5M=
|
||||||
github.com/fluxcd/pkg v0.0.3 h1:yhjtpGtD9LxFo8JtwTuUxJyFcX2wSSb0TPptIEpGSmA=
|
github.com/fluxcd/pkg v0.0.3 h1:yhjtpGtD9LxFo8JtwTuUxJyFcX2wSSb0TPptIEpGSmA=
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- github.com/fluxcd/helm-controller/config//crd?ref=v0.0.1-beta.1
|
- github.com/fluxcd/helm-controller/config//crd?ref=v0.0.1-beta.4
|
||||||
- github.com/fluxcd/helm-controller/config//manager?ref=v0.0.1-beta.1
|
- github.com/fluxcd/helm-controller/config//manager?ref=v0.0.1-beta.4
|
||||||
patchesJson6902:
|
patchesJson6902:
|
||||||
- target:
|
- target:
|
||||||
group: apps
|
group: apps
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- github.com/fluxcd/kustomize-controller/config//crd?ref=v0.0.5
|
- github.com/fluxcd/kustomize-controller/config//crd?ref=v0.0.6
|
||||||
- github.com/fluxcd/kustomize-controller/config//manager?ref=v0.0.5
|
- github.com/fluxcd/kustomize-controller/config//manager?ref=v0.0.6
|
||||||
patchesJson6902:
|
patchesJson6902:
|
||||||
- target:
|
- target:
|
||||||
group: apps
|
group: apps
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ nav:
|
|||||||
- Manage Helm Releases: guides/helmreleases.md
|
- Manage Helm Releases: guides/helmreleases.md
|
||||||
- Setup Notifications: guides/notifications.md
|
- Setup Notifications: guides/notifications.md
|
||||||
- Setup Webhook Receivers: guides/webhook-receivers.md
|
- Setup Webhook Receivers: guides/webhook-receivers.md
|
||||||
|
- Sealed Secrets: guides/sealed-secrets.md
|
||||||
- Toolkit Components:
|
- Toolkit Components:
|
||||||
- Source Controller:
|
- Source Controller:
|
||||||
- Overview: components/source/controller.md
|
- Overview: components/source/controller.md
|
||||||
@@ -73,20 +74,28 @@ nav:
|
|||||||
- Check: cmd/tk_check.md
|
- Check: cmd/tk_check.md
|
||||||
- Create: cmd/tk_create.md
|
- Create: cmd/tk_create.md
|
||||||
- Create kustomization: cmd/tk_create_kustomization.md
|
- Create kustomization: cmd/tk_create_kustomization.md
|
||||||
|
- Create helmrelease: cmd/tk_create_helmrelease.md
|
||||||
- Create source: cmd/tk_create_source.md
|
- Create source: cmd/tk_create_source.md
|
||||||
- Create source git: cmd/tk_create_source_git.md
|
- Create source git: cmd/tk_create_source_git.md
|
||||||
|
- Create source helm: cmd/tk_create_source_helm.md
|
||||||
- Delete: cmd/tk_delete.md
|
- Delete: cmd/tk_delete.md
|
||||||
- Delete kustomization: cmd/tk_delete_kustomization.md
|
- Delete kustomization: cmd/tk_delete_kustomization.md
|
||||||
|
- Delete helmrelease: cmd/tk_delete_helmrelease.md
|
||||||
- Delete source: cmd/tk_delete_source.md
|
- Delete source: cmd/tk_delete_source.md
|
||||||
- Delete source git: cmd/tk_delete_source_git.md
|
- Delete source git: cmd/tk_delete_source_git.md
|
||||||
|
- Delete source helm: cmd/tk_delete_source_helm.md
|
||||||
- Export: cmd/tk_export.md
|
- Export: cmd/tk_export.md
|
||||||
- Export kustomization: cmd/tk_export_kustomization.md
|
- Export kustomization: cmd/tk_export_kustomization.md
|
||||||
|
- Export helmrelease: cmd/tk_export_helmrelease.md
|
||||||
- Export source: cmd/tk_export_source.md
|
- Export source: cmd/tk_export_source.md
|
||||||
- Export source git: cmd/tk_export_source_git.md
|
- Export source git: cmd/tk_export_source_git.md
|
||||||
|
- Export source helm: cmd/tk_export_source_helm.md
|
||||||
- Get: cmd/tk_get.md
|
- Get: cmd/tk_get.md
|
||||||
- Get kustomizations: cmd/tk_get_kustomizations.md
|
- Get kustomizations: cmd/tk_get_kustomizations.md
|
||||||
|
- Get helmreleases: cmd/tk_get_helmreleases.md
|
||||||
- Get sources: cmd/tk_get_sources.md
|
- Get sources: cmd/tk_get_sources.md
|
||||||
- Get sources git: cmd/tk_get_sources_git.md
|
- Get sources git: cmd/tk_get_sources_git.md
|
||||||
|
- Get sources helm: cmd/tk_get_sources_helm.md
|
||||||
- Install: cmd/tk_install.md
|
- Install: cmd/tk_install.md
|
||||||
- Resume: cmd/tk_resume.md
|
- Resume: cmd/tk_resume.md
|
||||||
- Resume kustomization: cmd/tk_resume_kustomization.md
|
- Resume kustomization: cmd/tk_resume_kustomization.md
|
||||||
|
|||||||
Reference in New Issue
Block a user