Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e80cd5c44 | ||
|
|
b979e313b2 | ||
|
|
533cb42d29 | ||
|
|
35a209903e | ||
|
|
824de61579 | ||
|
|
17ca3f8ac2 | ||
|
|
87a299736e | ||
|
|
e86286722a | ||
|
|
c4a0724c8d | ||
|
|
17139f34dd | ||
|
|
1779714b0d | ||
|
|
1ff4495737 | ||
|
|
02c0dc1217 | ||
|
|
fb43c194b9 | ||
|
|
ae94bb56d9 | ||
|
|
123433c4ea | ||
|
|
58619076ea | ||
|
|
a50d1c5784 | ||
|
|
91c8cb197f | ||
|
|
427c60618f | ||
|
|
2d417f200d | ||
|
|
54b11e7b25 | ||
|
|
50d2eb7d57 | ||
|
|
dfb20dd1ca | ||
|
|
4f22016f13 | ||
|
|
430a2d0454 | ||
|
|
db23c8ce9f | ||
|
|
ffd4784916 | ||
|
|
750830c302 | ||
|
|
d245ef9b39 | ||
|
|
c8586d1ef4 | ||
|
|
316cba1cb8 | ||
|
|
13dba62b8d | ||
|
|
c2ff169c08 | ||
|
|
57a1dbfc6d | ||
|
|
efb39d6fc6 | ||
|
|
b784234430 | ||
|
|
aebad92426 | ||
|
|
8e67cfd5c9 |
31
.github/workflows/docs.yaml
vendored
31
.github/workflows/docs.yaml
vendored
@@ -13,27 +13,32 @@ jobs:
|
|||||||
- name: Checkout master
|
- name: Checkout master
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
- name: Copy assets
|
- name: Copy assets
|
||||||
|
env:
|
||||||
|
SOURCE_VER: ${{ 'v0.0.7' }}
|
||||||
|
KUSTOMIZE_VER: ${{ 'v0.0.7' }}
|
||||||
|
HELM_VER: ${{ 'v0.0.1' }}
|
||||||
|
NOTIFICATION_VER: ${{ 'v0.0.6' }}
|
||||||
run: |
|
run: |
|
||||||
# source-controller CRDs
|
# source-controller CRDs
|
||||||
curl https://raw.githubusercontent.com/fluxcd/source-controller/master/docs/api/source.md > docs/components/source/api.md
|
curl "https://raw.githubusercontent.com/fluxcd/source-controller/$SOURCE_VER/docs/api/source.md" > docs/components/source/api.md
|
||||||
curl https://raw.githubusercontent.com/fluxcd/source-controller/master/docs/spec/v1alpha1/gitrepositories.md > docs/components/source/gitrepositories.md
|
curl "https://raw.githubusercontent.com/fluxcd/source-controller/$SOURCE_VER/docs/spec/v1alpha1/gitrepositories.md" > docs/components/source/gitrepositories.md
|
||||||
curl https://raw.githubusercontent.com/fluxcd/source-controller/master/docs/spec/v1alpha1/helmrepositories.md > docs/components/source/helmrepositories.md
|
curl "https://raw.githubusercontent.com/fluxcd/source-controller/$SOURCE_VER/docs/spec/v1alpha1/helmrepositories.md" > docs/components/source/helmrepositories.md
|
||||||
curl https://raw.githubusercontent.com/fluxcd/source-controller/master/docs/spec/v1alpha1/helmcharts.md > docs/components/source/helmcharts.md
|
curl "https://raw.githubusercontent.com/fluxcd/source-controller/$SOURCE_VER/docs/spec/v1alpha1/helmcharts.md" > docs/components/source/helmcharts.md
|
||||||
|
|
||||||
# kustomize-controller CRDs
|
# kustomize-controller CRDs
|
||||||
curl https://raw.githubusercontent.com/fluxcd/kustomize-controller/master/docs/api/kustomize.md > docs/components/kustomize/api.md
|
curl "https://raw.githubusercontent.com/fluxcd/kustomize-controller/$KUSTOMIZE_VER/docs/api/kustomize.md" > docs/components/kustomize/api.md
|
||||||
curl https://raw.githubusercontent.com/fluxcd/kustomize-controller/master/docs/spec/v1alpha1/kustomization.md > docs/components/kustomize/kustomization.md
|
curl "https://raw.githubusercontent.com/fluxcd/kustomize-controller/$KUSTOMIZE_VER/docs/spec/v1alpha1/kustomization.md" > docs/components/kustomize/kustomization.md
|
||||||
|
|
||||||
# helm-controller CRDs
|
# helm-controller CRDs
|
||||||
curl https://raw.githubusercontent.com/fluxcd/helm-controller/master/docs/api/helmrelease.md > docs/components/helm/api.md
|
curl "https://raw.githubusercontent.com/fluxcd/helm-controller/$HELM_VER/docs/api/helmrelease.md" > docs/components/helm/api.md
|
||||||
curl https://raw.githubusercontent.com/fluxcd/helm-controller/master/docs/spec/v2alpha1/helmreleases.md > docs/components/helm/helmreleases.md
|
curl "https://raw.githubusercontent.com/fluxcd/helm-controller/$HELM_VER/docs/spec/v2alpha1/helmreleases.md" > docs/components/helm/helmreleases.md
|
||||||
|
|
||||||
# notification-controller CRDs
|
# notification-controller CRDs
|
||||||
curl https://raw.githubusercontent.com/fluxcd/notification-controller/master/docs/api/notification.md > docs/components/notification/api.md
|
curl "https://raw.githubusercontent.com/fluxcd/notification-controller/$NOTIFICATION_VER/docs/api/notification.md" > docs/components/notification/api.md
|
||||||
curl https://raw.githubusercontent.com/fluxcd/notification-controller/master/docs/spec/v1alpha1/event.md > docs/components/notification/event.md
|
curl "https://raw.githubusercontent.com/fluxcd/notification-controller/$NOTIFICATION_VER/docs/spec/v1alpha1/event.md" > docs/components/notification/event.md
|
||||||
curl https://raw.githubusercontent.com/fluxcd/notification-controller/master/docs/spec/v1alpha1/alert.md > docs/components/notification/alert.md
|
curl "https://raw.githubusercontent.com/fluxcd/notification-controller/$NOTIFICATION_VER/docs/spec/v1alpha1/alert.md" > docs/components/notification/alert.md
|
||||||
curl https://raw.githubusercontent.com/fluxcd/notification-controller/master/docs/spec/v1alpha1/provider.md > docs/components/notification/provider.md
|
curl "https://raw.githubusercontent.com/fluxcd/notification-controller/$NOTIFICATION_VER/docs/spec/v1alpha1/provider.md" > docs/components/notification/provider.md
|
||||||
curl https://raw.githubusercontent.com/fluxcd/notification-controller/master/docs/spec/v1alpha1/receiver.md > docs/components/notification/receiver.md
|
curl "https://raw.githubusercontent.com/fluxcd/notification-controller/$NOTIFICATION_VER/docs/spec/v1alpha1/receiver.md" > docs/components/notification/receiver.md
|
||||||
|
|
||||||
# install script
|
# install script
|
||||||
cp install/tk.sh docs/install.sh
|
cp install/tk.sh docs/install.sh
|
||||||
|
|||||||
@@ -18,16 +18,39 @@ organization.
|
|||||||
|
|
||||||
## Communications
|
## Communications
|
||||||
|
|
||||||
The project uses Slack: To join the conversation, simply join the
|
For realtime communications we use Slack: To join the conversation, simply
|
||||||
[CNCF](https://slack.cncf.io/) Slack workspace and use the
|
join the [CNCF](https://slack.cncf.io/) Slack workspace and use the
|
||||||
[#flux-dev](https://cloud-native.slack.com/messages/flux-dev/) channel.
|
[#flux-dev](https://cloud-native.slack.com/messages/flux-dev/) channel.
|
||||||
|
|
||||||
The developers use a mailing list to discuss development as well.
|
To discuss ideas and specifications we use [Github
|
||||||
Simply subscribe to [flux-dev on cncf.io](https://lists.cncf.io/g/cncf-flux-dev)
|
Discussions](https://github.com/fluxcd/toolkit/discussions).
|
||||||
to join the conversation (this will also add an invitation to your
|
|
||||||
Google calendar for our [Flux
|
For announcements we use a mailing list as well. Simply subscribe to
|
||||||
|
[flux-dev on cncf.io](https://lists.cncf.io/g/cncf-flux-dev)
|
||||||
|
to join the conversation (there you can also add calendar invites
|
||||||
|
to your Google calendar for our [Flux
|
||||||
meeting](https://docs.google.com/document/d/1l_M0om0qUEN_NNiGgpqJ2tvsF2iioHkaARDeh6b70B0/edit#)).
|
meeting](https://docs.google.com/document/d/1l_M0om0qUEN_NNiGgpqJ2tvsF2iioHkaARDeh6b70B0/edit#)).
|
||||||
|
|
||||||
|
## Understanding the GitOps Toolkit
|
||||||
|
|
||||||
|
If you are entirely new to the GitOps Toolkit,
|
||||||
|
you might want to take a look at the [introductory talk and demo](https://www.youtube.com/watch?v=qQBtSkgl7tI).
|
||||||
|
|
||||||
|
This project is composed of:
|
||||||
|
|
||||||
|
- [/f/toolkit](https://github.com/fluxcd/toolkit): The GitOps Toolkit CLI
|
||||||
|
- [/f/source-manager](https://github.com/fluxcd/source-controller): Kubernetes operator for managing sources
|
||||||
|
- [/f/kustomize-controller](https://github.com/fluxcd/kustomize-controller): Kubernetes operator for building GitOps pipelines with Kustomize
|
||||||
|
- [/f/helm-controller](https://github.com/fluxcd/helm-controller): Kubernetes operator for building GitOps pipelines with Helm
|
||||||
|
- [/f/notification-controller](https://github.com/fluxcd/notification-controller): Kubernetes operator for handling inbound and outbound events
|
||||||
|
|
||||||
|
### Understanding the code
|
||||||
|
|
||||||
|
To get started with developing controllers, you might want to review
|
||||||
|
[our guide](https://toolkit.fluxcd.io/dev-guides/source-watcher/) which
|
||||||
|
walks you through writing a short and concise controller that watches out
|
||||||
|
for source changes.
|
||||||
|
|
||||||
### How to run the test suite
|
### How to run the test suite
|
||||||
|
|
||||||
You can run the unit tests by simply doing
|
You can run the unit tests by simply doing
|
||||||
@@ -66,16 +89,3 @@ For the GitOps Toolkit controllers we prefer the following rules for good commit
|
|||||||
|
|
||||||
The [following article](https://chris.beams.io/posts/git-commit/#seven-rules)
|
The [following article](https://chris.beams.io/posts/git-commit/#seven-rules)
|
||||||
has some more helpful advice on documenting your work.
|
has some more helpful advice on documenting your work.
|
||||||
|
|
||||||
## Understanding the GitOps Toolkit
|
|
||||||
|
|
||||||
If you are entirely new to the GitOps Toolkit,
|
|
||||||
you might want to take a look at the [introductory talk and demo](https://www.youtube.com/watch?v=qQBtSkgl7tI).
|
|
||||||
|
|
||||||
This project is composed of:
|
|
||||||
|
|
||||||
- [/f/toolkit](https://github.com/fluxcd/toolkit): The GitOps Toolkit CLI
|
|
||||||
- [/f/source-manager](https://github.com/fluxcd/source-controller): Kubernetes operator for managing sources
|
|
||||||
- [/f/kustomize-controller](https://github.com/fluxcd/kustomize-controller): Kubernetes operator for building GitOps pipelines with Kustomize
|
|
||||||
- [/f/helm-controller](https://github.com/fluxcd/helm-controller): Kubernetes operator for building GitOps pipelines with Helm
|
|
||||||
- [/f/notification-controller](https://github.com/fluxcd/notification-controller): Kubernetes operator for handling inbound and outbound events
|
|
||||||
|
|||||||
@@ -45,8 +45,10 @@ 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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,13 @@ For private Helm repositories, the basic authentication credentials are stored i
|
|||||||
--url=https://stefanprodan.github.io/podinfo \
|
--url=https://stefanprodan.github.io/podinfo \
|
||||||
--username=username \
|
--username=username \
|
||||||
--password=password
|
--password=password
|
||||||
|
|
||||||
|
# Create a source from a Helm repository using TLS authentication
|
||||||
|
tk create source helm podinfo \
|
||||||
|
--url=https://stefanprodan.github.io/podinfo \
|
||||||
|
--cert-file=./cert.crt \
|
||||||
|
--key-file=./key.crt \
|
||||||
|
--ca-file=./ca.crt
|
||||||
`,
|
`,
|
||||||
RunE: createSourceHelmCmdRun,
|
RunE: createSourceHelmCmdRun,
|
||||||
}
|
}
|
||||||
@@ -57,12 +64,18 @@ var (
|
|||||||
sourceHelmURL string
|
sourceHelmURL string
|
||||||
sourceHelmUsername string
|
sourceHelmUsername string
|
||||||
sourceHelmPassword string
|
sourceHelmPassword string
|
||||||
|
sourceHelmCertFile string
|
||||||
|
sourceHelmKeyFile string
|
||||||
|
sourceHelmCAFile string
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
createSourceHelmCmd.Flags().StringVar(&sourceHelmURL, "url", "", "Helm repository address")
|
createSourceHelmCmd.Flags().StringVar(&sourceHelmURL, "url", "", "Helm repository address")
|
||||||
createSourceHelmCmd.Flags().StringVarP(&sourceHelmUsername, "username", "u", "", "basic authentication username")
|
createSourceHelmCmd.Flags().StringVarP(&sourceHelmUsername, "username", "u", "", "basic authentication username")
|
||||||
createSourceHelmCmd.Flags().StringVarP(&sourceHelmPassword, "password", "p", "", "basic authentication password")
|
createSourceHelmCmd.Flags().StringVarP(&sourceHelmPassword, "password", "p", "", "basic authentication password")
|
||||||
|
createSourceHelmCmd.Flags().StringVar(&sourceHelmCertFile, "cert-file", "", "TLS authentication cert file path")
|
||||||
|
createSourceHelmCmd.Flags().StringVar(&sourceHelmKeyFile, "key-file", "", "TLS authentication key file path")
|
||||||
|
createSourceHelmCmd.Flags().StringVar(&sourceHelmCAFile, "ca-file", "", "TLS authentication CA file path")
|
||||||
|
|
||||||
createSourceCmd.AddCommand(createSourceHelmCmd)
|
createSourceCmd.AddCommand(createSourceHelmCmd)
|
||||||
}
|
}
|
||||||
@@ -113,35 +126,52 @@ func createSourceHelmCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
return exportHelmRepository(helmRepository)
|
return exportHelmRepository(helmRepository)
|
||||||
}
|
}
|
||||||
|
|
||||||
withAuth := false
|
logger.Generatef("generating source")
|
||||||
|
|
||||||
|
secret := corev1.Secret{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: secretName,
|
||||||
|
Namespace: namespace,
|
||||||
|
},
|
||||||
|
StringData: map[string]string{},
|
||||||
|
}
|
||||||
|
|
||||||
if sourceHelmUsername != "" && sourceHelmPassword != "" {
|
if sourceHelmUsername != "" && sourceHelmPassword != "" {
|
||||||
logger.Actionf("applying secret with basic auth credentials")
|
secret.StringData["username"] = sourceHelmUsername
|
||||||
secret := corev1.Secret{
|
secret.StringData["password"] = sourceHelmPassword
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
}
|
||||||
Name: secretName,
|
|
||||||
Namespace: namespace,
|
if sourceHelmCertFile != "" && sourceHelmKeyFile != "" {
|
||||||
},
|
cert, err := ioutil.ReadFile(sourceHelmCertFile)
|
||||||
StringData: map[string]string{
|
if err != nil {
|
||||||
"username": sourceHelmUsername,
|
return fmt.Errorf("failed to read repository cert file '%s': %w", sourceHelmCertFile, err)
|
||||||
"password": sourceHelmPassword,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
secret.StringData["certFile"] = string(cert)
|
||||||
|
|
||||||
|
key, err := ioutil.ReadFile(sourceHelmKeyFile)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to read repository key file '%s': %w", sourceHelmKeyFile, err)
|
||||||
|
}
|
||||||
|
secret.StringData["keyFile"] = string(key)
|
||||||
|
}
|
||||||
|
|
||||||
|
if sourceHelmCAFile != "" {
|
||||||
|
ca, err := ioutil.ReadFile(sourceHelmCAFile)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to read repository CA file '%s': %w", sourceHelmCAFile, err)
|
||||||
|
}
|
||||||
|
secret.StringData["caFile"] = string(ca)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(secret.StringData) > 0 {
|
||||||
|
logger.Actionf("applying secret with repository credentials")
|
||||||
if err := upsertSecret(ctx, kubeClient, secret); err != nil {
|
if err := upsertSecret(ctx, kubeClient, secret); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
withAuth = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if withAuth {
|
|
||||||
logger.Successf("authentication configured")
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.Generatef("generating source")
|
|
||||||
|
|
||||||
if withAuth {
|
|
||||||
helmRepository.Spec.SecretRef = &corev1.LocalObjectReference{
|
helmRepository.Spec.SecretRef = &corev1.LocalObjectReference{
|
||||||
Name: secretName,
|
Name: secretName,
|
||||||
}
|
}
|
||||||
|
logger.Successf("authentication configured")
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Actionf("applying source")
|
logger.Actionf("applying source")
|
||||||
|
|||||||
@@ -54,11 +54,13 @@ If a previous version is installed, then an in-place upgrade will be performed.`
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
installExport bool
|
installExport bool
|
||||||
installDryRun bool
|
installDryRun bool
|
||||||
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)
|
||||||
}
|
}
|
||||||
@@ -185,11 +191,14 @@ fieldSpecs:
|
|||||||
|
|
||||||
var kustomizationTmpl = `---
|
var kustomizationTmpl = `---
|
||||||
{{- $eventsAddr := .EventsAddr }}
|
{{- $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
|
||||||
@@ -198,20 +207,33 @@ resources:
|
|||||||
- {{.}}.yaml
|
- {{.}}.yaml
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
patches:
|
||||||
|
- path: node-selector.yaml
|
||||||
|
target:
|
||||||
|
kind: Deployment
|
||||||
|
|
||||||
patchesJson6902:
|
patchesJson6902:
|
||||||
{{- range $i, $v := .Components }}
|
{{- range $i, $component := .Components }}
|
||||||
{{- if ne $v "notification-controller" }}
|
{{- if ne $component "notification-controller" }}
|
||||||
- target:
|
- target:
|
||||||
group: apps
|
group: apps
|
||||||
version: v1
|
version: v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
name: {{$v}}
|
name: {{$component}}
|
||||||
patch: |-
|
patch: |-
|
||||||
- op: replace
|
- op: replace
|
||||||
path: /spec/template/spec/containers/0/args/0
|
path: /spec/template/spec/containers/0/args/0
|
||||||
value: --events-addr={{$eventsAddr}}
|
value: --events-addr={{$eventsAddr}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if $registry }}
|
||||||
|
images:
|
||||||
|
{{- range $i, $component := .Components }}
|
||||||
|
- name: fluxcd/{{$component}}
|
||||||
|
newName: {{$registry}}/{{$component}}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
`
|
`
|
||||||
|
|
||||||
var kustomizationRolesTmpl = `---
|
var kustomizationRolesTmpl = `---
|
||||||
@@ -222,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") {
|
||||||
@@ -256,22 +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 := ""
|
eventsAddr := ""
|
||||||
if utils.containsItemString(components, defaultNotification) {
|
if utils.containsItemString(components, defaultNotification) {
|
||||||
eventsAddr = fmt.Sprintf("http://%s/", 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
|
EventsAddr string
|
||||||
|
Registry string
|
||||||
|
ImagePullSecret string
|
||||||
}{
|
}{
|
||||||
Version: version,
|
Version: version,
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Components: components,
|
Components: components,
|
||||||
EventsAddr: eventsAddr,
|
EventsAddr: eventsAddr,
|
||||||
|
Registry: registry,
|
||||||
|
ImagePullSecret: imagePullSecret,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := downloadManifests(version, tmpDir); err != nil {
|
if err := downloadManifests(version, tmpDir); err != nil {
|
||||||
@@ -286,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)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ var rootCmd = &cobra.Command{
|
|||||||
SilenceErrors: true,
|
SilenceErrors: true,
|
||||||
Short: "Command line utility for assembling Kubernetes CD pipelines",
|
Short: "Command line utility for assembling Kubernetes CD pipelines",
|
||||||
Long: `Command line utility for assembling Kubernetes CD pipelines the GitOps way.`,
|
Long: `Command line utility for assembling Kubernetes CD pipelines the GitOps way.`,
|
||||||
Example: ` # Check prerequisites
|
Example: ` # Check prerequisites
|
||||||
tk check --pre
|
tk check --pre
|
||||||
|
|
||||||
# Install the latest version of the toolkit
|
# Install the latest version of the toolkit
|
||||||
@@ -53,8 +53,8 @@ var rootCmd = &cobra.Command{
|
|||||||
# List GitRepository sources and their status
|
# List GitRepository sources and their status
|
||||||
tk get sources git
|
tk get sources git
|
||||||
|
|
||||||
# Trigger a GitRepository source sync
|
# Trigger a GitRepository source reconciliation
|
||||||
tk sync source git webapp-latest
|
tk reconcile source git gitops-system
|
||||||
|
|
||||||
# Export GitRepository sources in YAML format
|
# Export GitRepository sources in YAML format
|
||||||
tk export source git --all > sources.yaml
|
tk export source git --all > sources.yaml
|
||||||
|
|||||||
@@ -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{
|
||||||
@@ -33,24 +35,24 @@ var uninstallCmd = &cobra.Command{
|
|||||||
tk 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
|
||||||
tk 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,
|
||||||
if _, err := utils.execCommand(ctx, ModeOS, command); err != nil {
|
sourcev1.GitRepositoryKind,
|
||||||
return fmt.Errorf("uninstall failed")
|
sourcev1.HelmRepositoryKind,
|
||||||
|
} {
|
||||||
|
command := fmt.Sprintf("kubectl -n %s delete %s --all --timeout=%s %s",
|
||||||
|
namespace, kind, timeout.String(), dryRun)
|
||||||
|
if _, err := utils.execCommand(ctx, ModeOS, command); err != nil {
|
||||||
|
return fmt.Errorf("uninstall failed")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: use the kustomizations snapshots to create a list of objects
|
|
||||||
// that are subject to deletion and wait for all of them to be terminated
|
|
||||||
logger.Waitingf("waiting on GC")
|
|
||||||
time.Sleep(30 * time.Second)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
kinds := "namespace,clusterroles,clusterrolebindings"
|
kinds := "namespace,clusterroles,clusterrolebindings"
|
||||||
|
|||||||
BIN
docs/_files/cp-dashboard-p1.png
Normal file
BIN
docs/_files/cp-dashboard-p1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 144 KiB |
BIN
docs/_files/cp-dashboard-p2.png
Normal file
BIN
docs/_files/cp-dashboard-p2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 146 KiB |
73
docs/_static/custom.css
vendored
73
docs/_static/custom.css
vendored
@@ -22,3 +22,76 @@ body {
|
|||||||
.md-header-nav__title {
|
.md-header-nav__title {
|
||||||
font-size: .85rem;
|
font-size: .85rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.check-bullet {
|
||||||
|
color:#07bfa5;
|
||||||
|
background-color: white;
|
||||||
|
margin-left:-22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Progress bar styling */
|
||||||
|
|
||||||
|
.progress-label {
|
||||||
|
position: absolute;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: 700;
|
||||||
|
width: 100%;
|
||||||
|
/* remove original styling for thin styling
|
||||||
|
margin: 0 ! important; */
|
||||||
|
margin-top: -0.4rem ! important;
|
||||||
|
line-height: 1.2rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-bar {
|
||||||
|
/*remove original styling for thin styling
|
||||||
|
height: 1.2rem; */
|
||||||
|
height: 0.4rem;
|
||||||
|
float: left;
|
||||||
|
background: repeating-linear-gradient(
|
||||||
|
45deg,
|
||||||
|
rgba(255, 255, 255, 0.2),
|
||||||
|
rgba(255, 255, 255, 0.2) 10px,
|
||||||
|
rgba(255, 255, 255, 0.3) 10px,
|
||||||
|
rgba(255, 255, 255, 0.3) 20px
|
||||||
|
) #2979ff;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
/* remove original styling for thin styling
|
||||||
|
margin: 0.5rem 0;
|
||||||
|
height: 1.2rem; */
|
||||||
|
margin-top: 0.9rem;
|
||||||
|
height: 0.4rem;
|
||||||
|
background-color: #eeeeee;
|
||||||
|
position: relative;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-100plus .progress-bar {
|
||||||
|
background-color: #00c853;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-80plus .progress-bar {
|
||||||
|
background-color: #64dd17;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-60plus .progress-bar {
|
||||||
|
background-color: #fbc02d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-40plus .progress-bar {
|
||||||
|
background-color: #ff9100;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-20plus .progress-bar {
|
||||||
|
background-color: #ff5252;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-0plus .progress-bar {
|
||||||
|
background-color: #ff1744;
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ Command line utility for assembling Kubernetes CD pipelines the GitOps way.
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
# Check prerequisites
|
# Check prerequisites
|
||||||
tk check --pre
|
tk check --pre
|
||||||
|
|
||||||
# Install the latest version of the toolkit
|
# Install the latest version of the toolkit
|
||||||
@@ -24,8 +24,8 @@ Command line utility for assembling Kubernetes CD pipelines the GitOps way.
|
|||||||
# List GitRepository sources and their status
|
# List GitRepository sources and their status
|
||||||
tk get sources git
|
tk get sources git
|
||||||
|
|
||||||
# Trigger a GitRepository source sync
|
# Trigger a GitRepository source reconciliation
|
||||||
tk sync source git webapp-latest
|
tk reconcile source git gitops-system
|
||||||
|
|
||||||
# Export GitRepository sources in YAML format
|
# Export GitRepository sources in YAML format
|
||||||
tk export source git --all > sources.yaml
|
tk export source git --all > sources.yaml
|
||||||
|
|||||||
@@ -9,9 +9,11 @@ The bootstrap sub-commands bootstrap the toolkit components on the targeted Git
|
|||||||
### Options
|
### Options
|
||||||
|
|
||||||
```
|
```
|
||||||
--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
|
||||||
-v, --version string toolkit version (default "latest")
|
--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")
|
||||||
```
|
```
|
||||||
|
|
||||||
### Options inherited from parent commands
|
### Options inherited from parent commands
|
||||||
|
|||||||
@@ -54,12 +54,14 @@ tk bootstrap github [flags]
|
|||||||
### Options inherited from parent commands
|
### Options inherited from parent commands
|
||||||
|
|
||||||
```
|
```
|
||||||
--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])
|
||||||
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
|
--image-pull-secret string Kubernetes secret name used for pulling the toolkit images from a private registry
|
||||||
--namespace string the namespace scope for this operation (default "gitops-system")
|
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
|
||||||
--timeout duration timeout for this operation (default 5m0s)
|
--namespace string the namespace scope for this operation (default "gitops-system")
|
||||||
--verbose print generated objects
|
--registry string container registry where the toolkit images are published (default "docker.io/fluxcd")
|
||||||
-v, --version string toolkit version (default "latest")
|
--timeout duration timeout for this operation (default 5m0s)
|
||||||
|
--verbose print generated objects
|
||||||
|
-v, --version string toolkit version (default "latest")
|
||||||
```
|
```
|
||||||
|
|
||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
|
|||||||
@@ -50,12 +50,14 @@ tk bootstrap gitlab [flags]
|
|||||||
### Options inherited from parent commands
|
### Options inherited from parent commands
|
||||||
|
|
||||||
```
|
```
|
||||||
--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])
|
||||||
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
|
--image-pull-secret string Kubernetes secret name used for pulling the toolkit images from a private registry
|
||||||
--namespace string the namespace scope for this operation (default "gitops-system")
|
--kubeconfig string path to the kubeconfig file (default "~/.kube/config")
|
||||||
--timeout duration timeout for this operation (default 5m0s)
|
--namespace string the namespace scope for this operation (default "gitops-system")
|
||||||
--verbose print generated objects
|
--registry string container registry where the toolkit images are published (default "docker.io/fluxcd")
|
||||||
-v, --version string toolkit version (default "latest")
|
--timeout duration timeout for this operation (default 5m0s)
|
||||||
|
--verbose print generated objects
|
||||||
|
-v, --version string toolkit version (default "latest")
|
||||||
```
|
```
|
||||||
|
|
||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
|
|||||||
@@ -26,15 +26,25 @@ tk create source helm [name] [flags]
|
|||||||
--username=username \
|
--username=username \
|
||||||
--password=password
|
--password=password
|
||||||
|
|
||||||
|
# Create a source from a Helm repository using TLS authentication
|
||||||
|
tk create source helm podinfo \
|
||||||
|
--url=https://stefanprodan.github.io/podinfo \
|
||||||
|
--cert-file=./cert.crt \
|
||||||
|
--key-file=./key.crt \
|
||||||
|
--ca-file=./ca.crt
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
```
|
```
|
||||||
-h, --help help for helm
|
--ca-file string TLS authentication CA file path
|
||||||
-p, --password string basic authentication password
|
--cert-file string TLS authentication cert file path
|
||||||
--url string Helm repository address
|
-h, --help help for helm
|
||||||
-u, --username string basic authentication username
|
--key-file string TLS authentication key file path
|
||||||
|
-p, --password string basic authentication password
|
||||||
|
--url string Helm repository address
|
||||||
|
-u, --username string basic authentication username
|
||||||
```
|
```
|
||||||
|
|
||||||
### Options inherited from parent commands
|
### Options inherited from parent commands
|
||||||
|
|||||||
@@ -31,12 +31,14 @@ tk install [flags]
|
|||||||
### Options
|
### Options
|
||||||
|
|
||||||
```
|
```
|
||||||
--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])
|
||||||
--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
|
||||||
--manifests string path to the manifest directory, dev only
|
--image-pull-secret string Kubernetes secret name used for pulling the toolkit images from a private registry
|
||||||
-v, --version string toolkit version (default "latest")
|
--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")
|
||||||
```
|
```
|
||||||
|
|
||||||
### Options inherited from parent commands
|
### Options inherited from parent commands
|
||||||
|
|||||||
@@ -17,18 +17,18 @@ tk uninstall [flags]
|
|||||||
tk 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
|
||||||
tk uninstall --crds --namespace=gitops-system
|
tk uninstall --resources --crds --namespace=gitops-system
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
```
|
```
|
||||||
--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
|
||||||
```
|
```
|
||||||
|
|
||||||
### Options inherited from parent commands
|
### Options inherited from parent commands
|
||||||
|
|||||||
@@ -131,8 +131,8 @@ type GitRepositoryWatcher struct {
|
|||||||
Scheme *runtime.Scheme
|
Scheme *runtime.Scheme
|
||||||
}
|
}
|
||||||
|
|
||||||
// +kubebuilder:rbac:groups=source.fluxcd.io,resources=gitrepositories,verbs=get;list;watch
|
// +kubebuilder:rbac:groups=source.toolkit.fluxcd.io,resources=gitrepositories,verbs=get;list;watch
|
||||||
// +kubebuilder:rbac:groups=source.fluxcd.io,resources=gitrepositories/status,verbs=get
|
// +kubebuilder:rbac:groups=source.toolkit.fluxcd.io,resources=gitrepositories/status,verbs=get
|
||||||
|
|
||||||
func (r *GitRepositoryWatcher) Reconcile(req ctrl.Request) (ctrl.Result, error) {
|
func (r *GitRepositoryWatcher) Reconcile(req ctrl.Request) (ctrl.Result, error) {
|
||||||
// set timeout for the reconciliation
|
// set timeout for the reconciliation
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ The helm-controller is part of the default toolkit installation.
|
|||||||
To follow this guide you'll need a Kubernetes cluster with the GitOps
|
To follow this guide you'll need a Kubernetes cluster with the GitOps
|
||||||
toolkit controllers installed on it.
|
toolkit controllers installed on it.
|
||||||
Please see the [get started guide](../get-started/index.md)
|
Please see the [get started guide](../get-started/index.md)
|
||||||
or the [install command docs](../cmd/tk_install.md).
|
or the [installation guide](installation.md).
|
||||||
|
|
||||||
## Define a Helm repository
|
## Define a Helm repository
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ By default, the source-controller watches for sources only in the
|
|||||||
untrusted sources from being registered by users.
|
untrusted sources from being registered by users.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: source.fluxcd.io/v1alpha1
|
apiVersion: source.toolkit.fluxcd.io/v1alpha1
|
||||||
kind: HelmRepository
|
kind: HelmRepository
|
||||||
metadata:
|
metadata:
|
||||||
name: podinfo
|
name: podinfo
|
||||||
@@ -55,7 +55,7 @@ With the `HelmRepository` created, define a new `HelmRelease` to deploy
|
|||||||
the Helm chart from the repository:
|
the Helm chart from the repository:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: helm.fluxcd.io/v2alpha1
|
apiVersion: helm.toolkit.fluxcd.io/v2alpha1
|
||||||
kind: HelmRelease
|
kind: HelmRelease
|
||||||
metadata:
|
metadata:
|
||||||
name: podinfo
|
name: podinfo
|
||||||
@@ -93,6 +93,32 @@ helm-controller.
|
|||||||
See the [`HelmRelease` CRD docs](../components/helm/helmreleases.md)
|
See the [`HelmRelease` CRD docs](../components/helm/helmreleases.md)
|
||||||
for more details.
|
for more details.
|
||||||
|
|
||||||
|
## Refer to values in `ConfigMap` and `Secret` resources
|
||||||
|
|
||||||
|
It is possible to define a list of `ConfigMap` and `Secret` resources
|
||||||
|
from which to take values. The values are merged in the order given,
|
||||||
|
with the later values overwriting earlier. These values always have a
|
||||||
|
lower priority than the values inlined in the `HelmRelease` via the
|
||||||
|
`spec.values` parameter.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
spec:
|
||||||
|
valuesFrom:
|
||||||
|
- kind: ConfigMap
|
||||||
|
name: prod-env-values
|
||||||
|
- kind: Secret
|
||||||
|
name: prod-secret-values
|
||||||
|
valuesKey: secret.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
The definition of the listed keys is as follows:
|
||||||
|
|
||||||
|
- `kind`: Kind of the values referent (`ConfigMap` or `Secret`).
|
||||||
|
- `name`: Name of the values referent, in the same namespace as the
|
||||||
|
`HelmRelease`.
|
||||||
|
- `valuesKey` _(Optional)_: The key in the referent the values can be
|
||||||
|
found at. Defaults to `values.yaml` when ommitted.
|
||||||
|
|
||||||
## Configure notifications
|
## Configure notifications
|
||||||
|
|
||||||
The default toolkit installation configures the helm-controller to
|
The default toolkit installation configures the helm-controller to
|
||||||
@@ -105,7 +131,7 @@ the `gitops-system` to start receiving notifications about the Helm
|
|||||||
release:
|
release:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: notification.fluxcd.io/v1alpha1
|
apiVersion: notification.toolkit.fluxcd.io/v1alpha1
|
||||||
kind: Alert
|
kind: Alert
|
||||||
metadata:
|
metadata:
|
||||||
generation: 2
|
generation: 2
|
||||||
@@ -147,7 +173,7 @@ kubectl -n gitops-system create secret generic webhook-token \
|
|||||||
When using [Harbor](https://goharbor.io/) as your Helm repository, you can define a receiver with:
|
When using [Harbor](https://goharbor.io/) as your Helm repository, you can define a receiver with:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: notification.fluxcd.io/v1alpha1
|
apiVersion: notification.toolkit.fluxcd.io/v1alpha1
|
||||||
kind: Receiver
|
kind: Receiver
|
||||||
metadata:
|
metadata:
|
||||||
name: helm-podinfo
|
name: helm-podinfo
|
||||||
|
|||||||
357
docs/guides/installation.md
Normal file
357
docs/guides/installation.md
Normal file
@@ -0,0 +1,357 @@
|
|||||||
|
# Installation
|
||||||
|
|
||||||
|
This guide walks you through setting up the GitOps Toolkit
|
||||||
|
to manage one or more Kubernetes clusters.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
You will need a Kubernetes cluster version **1.16** or newer
|
||||||
|
and kubectl version **1.18** or newer.
|
||||||
|
|
||||||
|
Install the toolkit CLI with:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -s https://toolkit.fluxcd.io/install.sh | sudo bash
|
||||||
|
```
|
||||||
|
|
||||||
|
The install script downloads the tk binary to `/usr/local/bin`.
|
||||||
|
Binaries for macOS and Linux AMD64 are available for download on the
|
||||||
|
[release page](https://github.com/fluxcd/toolkit/releases).
|
||||||
|
|
||||||
|
Verify that your cluster satisfies the prerequisites with:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk check --pre
|
||||||
|
```
|
||||||
|
|
||||||
|
## Bootstrap
|
||||||
|
|
||||||
|
Using the `tk bootstrap` command you can install the toolkit on a Kubernetes cluster
|
||||||
|
and configure it to manage itself from a Git repository.
|
||||||
|
|
||||||
|
The bootstrap creates a Git repository if one doesn't exist and
|
||||||
|
commits the toolkit components manifests to the master branch.
|
||||||
|
Then it configures the target cluster to synchronize with that
|
||||||
|
repository by setting up SSH deploy keys.
|
||||||
|
|
||||||
|
If the toolkit components are present on the cluster,
|
||||||
|
the bootstrap command will perform an upgrade if needed.
|
||||||
|
The bootstrap is idempotent, it's safe to run the command as many times as you want.
|
||||||
|
|
||||||
|
You can choose what components to install and for which cluster with:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk bootstrap <GIT-PROVIDER> \
|
||||||
|
--components=source-controller,kustomize-controller,helm-controller,notification-controller \
|
||||||
|
--path=my-cluster \
|
||||||
|
--version=latest
|
||||||
|
```
|
||||||
|
|
||||||
|
If you wish to install a specific version, use the toolkit
|
||||||
|
[release tag](https://github.com/fluxcd/toolkit/releases) e.g. `--version=v0.0.14`.
|
||||||
|
|
||||||
|
With `--path` you can configure the directory which will be used to reconcile the target cluster.
|
||||||
|
To control multiple clusters from the same Git repository, you have to set a unique path per
|
||||||
|
cluster e.g. `staging-cluster` and `production-cluster`:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
├── staging-cluster # <- path=staging-cluster
|
||||||
|
│ └── gitops-system # <- namespace dir generated by bootstrap
|
||||||
|
│ ├── toolkit-components.yaml
|
||||||
|
│ ├── toolkit-kustomization.yaml
|
||||||
|
│ └── toolkit-source.yaml
|
||||||
|
└── production-cluster # <- path=production-cluster
|
||||||
|
└── gitops-system
|
||||||
|
```
|
||||||
|
|
||||||
|
### GitHub and GitHub Enterprise
|
||||||
|
|
||||||
|
Generate a [personal access token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line)
|
||||||
|
that can create repositories by checking all permissions under `repo`.
|
||||||
|
|
||||||
|
Export your GitHub personal access token as an environment variable:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
export GITHUB_TOKEN=<your-token>
|
||||||
|
```
|
||||||
|
|
||||||
|
Run the bootstrap for a repository on your personal GitHub account:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk bootstrap github \
|
||||||
|
--owner=my-github-username \
|
||||||
|
--repository=my-repository \
|
||||||
|
--path=my-cluster \
|
||||||
|
--personal
|
||||||
|
```
|
||||||
|
|
||||||
|
Run the bootstrap for a repository owned by a GitHub organization:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk bootstrap github \
|
||||||
|
--owner=my-github-organization \
|
||||||
|
--repository=my-repository \
|
||||||
|
--team=team1-slug \
|
||||||
|
--team=team2-slug \
|
||||||
|
--path=my-cluster
|
||||||
|
```
|
||||||
|
|
||||||
|
When you specify a list of teams, those teams will be granted maintainer access to the repository.
|
||||||
|
|
||||||
|
To run the bootstrap for a repository hosted on GitHub Enterprise, you have to specify your GitHub hostname:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk bootstrap github \
|
||||||
|
--hostname=my-github-enterprise.com \
|
||||||
|
--owner=my-github-organization \
|
||||||
|
--repository=my-repository \
|
||||||
|
--path=my-cluster
|
||||||
|
```
|
||||||
|
|
||||||
|
### GitLab and GitLab Enterprise
|
||||||
|
|
||||||
|
Generate a [personal access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html)
|
||||||
|
that grants complete read/write access to the GitLab API.
|
||||||
|
|
||||||
|
Export your GitLab personal access token as an environment variable:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
export GITLAB_TOKEN=<your-token>
|
||||||
|
```
|
||||||
|
|
||||||
|
Run the bootstrap for a repository on your personal GitLab account:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk bootstrap gitlab \
|
||||||
|
--owner=my-gitlab-username \
|
||||||
|
--repository=my-repository \
|
||||||
|
--path=my-cluster \
|
||||||
|
--personal
|
||||||
|
```
|
||||||
|
|
||||||
|
Run the bootstrap for a repository owned by a GitLab group:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk bootstrap gitlab \
|
||||||
|
--owner=my-gitlab-group \
|
||||||
|
--repository=my-repository \
|
||||||
|
--path=my-cluster
|
||||||
|
```
|
||||||
|
|
||||||
|
To run the bootstrap for a repository hosted on GitLab on-prem or enterprise, you have to specify your GitLab hostname:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk bootstrap gitlab \
|
||||||
|
--hostname=my-gitlab.com \
|
||||||
|
--owner=my-gitlab-group \
|
||||||
|
--repository=my-repository \
|
||||||
|
--path=my-cluster
|
||||||
|
```
|
||||||
|
|
||||||
|
### Generic Git Server
|
||||||
|
|
||||||
|
For other Git providers such as Bitbucket, Gogs, Gitea, etc you can manually setup the repository and the deploy key.
|
||||||
|
|
||||||
|
Create a Git repository and clone it locally:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git clone ssh://<host>/<org>/my-repository
|
||||||
|
cd my-repository
|
||||||
|
```
|
||||||
|
|
||||||
|
Create a directory inside the repository:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
mkdir -p ./my-cluster/gitops-system
|
||||||
|
```
|
||||||
|
|
||||||
|
Generate the toolkit manifests with:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk install --version=latest \
|
||||||
|
--export > ./my-cluster/gitops-system/toolkit-components.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
If your cluster must pull images from a private container registry, first you should pull
|
||||||
|
the toolkit images from Docker Hub and push them to your registry, for example:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker pull fluxcd/source-controller:v0.0.7
|
||||||
|
docker tag fluxcd/source-controller:v0.0.7 registry.internal/fluxcd/source-controller:v0.0.7
|
||||||
|
docker push registry.internal/fluxcd/source-controller:v0.0.7
|
||||||
|
```
|
||||||
|
|
||||||
|
Create the pull secret in the `gitops-system` namespace:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
kubectl create ns gitops-system
|
||||||
|
|
||||||
|
kubectl -n gitops-system create secret generic regcred \
|
||||||
|
--from-file=.dockerconfigjson=/.docker/config.json \
|
||||||
|
--type=kubernetes.io/dockerconfigjson
|
||||||
|
```
|
||||||
|
|
||||||
|
Set your registry domain, and the pull secret when generating the manifests:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk install --version=latest \
|
||||||
|
--registry=registry.internal/fluxcd \
|
||||||
|
--image-pull-secret=regcred \
|
||||||
|
--export > ./my-cluster/gitops-system/toolkit-components.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
Commit and push the manifest to the master branch:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git add -A && git commit -m "add toolkit manifests" && git push
|
||||||
|
```
|
||||||
|
|
||||||
|
Apply the manifests on your cluster:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
kubectl apply -f ./my-cluster/gitops-system/toolkit-components.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
Verify that the toolkit controllers have started:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk check
|
||||||
|
```
|
||||||
|
|
||||||
|
Create a `GitRepository` object on your cluster by specifying the SSH address of your repo:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk create source git gitops-system \
|
||||||
|
--url= ssh://<host>/<org>/my-repository \
|
||||||
|
--ssh-key-algorithm=ecdsa \
|
||||||
|
--ssh-ecdsa-curve=p521 \
|
||||||
|
--branch=master \
|
||||||
|
--interval=1m
|
||||||
|
```
|
||||||
|
|
||||||
|
You will be prompted to add a deploy key to your repository.
|
||||||
|
If you don't specify the SSH algorithm, then tk will generate an RSA 2048 bits key.
|
||||||
|
|
||||||
|
If your Git server supports basic auth, you can set the URL to HTTPS and specify the credentials with:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk create source git gitops-system \
|
||||||
|
--url=https://<host>/<org>/my-repository \
|
||||||
|
--username=my-username \
|
||||||
|
--password=my-password \
|
||||||
|
--branch=master \
|
||||||
|
--interval=1m
|
||||||
|
```
|
||||||
|
|
||||||
|
Create a `Kustomization` object on your cluster:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk create kustomization gitops-system \
|
||||||
|
--source=gitops-system \
|
||||||
|
--path="./my-cluster" \
|
||||||
|
--prune=true \
|
||||||
|
--interval=10m
|
||||||
|
```
|
||||||
|
|
||||||
|
Export both objects, commit and push the manifests to Git:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk export source git gitops-system \
|
||||||
|
> ./my-cluster/gitops-system/toolkit-source.yaml
|
||||||
|
|
||||||
|
tk export kustomization gitops-system \
|
||||||
|
> ./my-cluster/gitops-system/toolkit-kustomization.yaml
|
||||||
|
|
||||||
|
git add -A && git commit -m "add toolkit reconciliation" && git push
|
||||||
|
```
|
||||||
|
|
||||||
|
To upgrade the toolkit to a newer version, run the install command and commit the changes:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk install --version=latest \
|
||||||
|
--export > ./my-cluster/gitops-system/toolkit-components.yaml
|
||||||
|
|
||||||
|
git add -A && git commit -m "update toolkit" && git push
|
||||||
|
```
|
||||||
|
|
||||||
|
The source-controller will pull the changes on the cluster, then the kustomize-controller
|
||||||
|
will perform a rolling update of all toolkit components including itself.
|
||||||
|
|
||||||
|
## Dev install
|
||||||
|
|
||||||
|
For testing purposes you can install the toolkit without storing its manifests in a Git repository.
|
||||||
|
|
||||||
|
Here is the equivalent to `fluxctl install`:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk install \
|
||||||
|
--components=source-controller,kustomize-controller
|
||||||
|
```
|
||||||
|
|
||||||
|
Then you can register Git repositories and reconcile them on your cluster:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk create source git podinfo \
|
||||||
|
--url=https://github.com/stefanprodan/podinfo \
|
||||||
|
--tag-semver=">=4.0.0" \
|
||||||
|
--interval=1m
|
||||||
|
|
||||||
|
tk create kustomization podinfo-default \
|
||||||
|
--source=podinfo \
|
||||||
|
--path="./kustomize" \
|
||||||
|
--prune=true \
|
||||||
|
--validation=client \
|
||||||
|
--interval=10m \
|
||||||
|
--health-check="Deployment/podinfo.default" \
|
||||||
|
--health-check-timeout=2m
|
||||||
|
```
|
||||||
|
|
||||||
|
Here is the equivalent to `helm install helm-operator`:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk install \
|
||||||
|
--components=source-controller,kustomize-controller,helm-controller
|
||||||
|
```
|
||||||
|
|
||||||
|
Then you can register Helm repositories and create Helm releases:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk create source helm stable \
|
||||||
|
--interval=1h \
|
||||||
|
--url=https://kubernetes-charts.storage.googleapis.com
|
||||||
|
|
||||||
|
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"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Monitoring with Prometheus and Grafana
|
||||||
|
|
||||||
|
The GitOps Toolkit comes with an optional monitoring stack.
|
||||||
|
You can install the stack in the `gitops-system` namespace with:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
kustomize build github.com/fluxcd/toolkit/manifests/monitoring?ref=master | kubectl apply -f-
|
||||||
|
```
|
||||||
|
|
||||||
|
The monitoring stack is composed of:
|
||||||
|
|
||||||
|
* Prometheus server - collects metrics from the toolkit controllers and stores them for 2h
|
||||||
|
* Grafana dashboards - displays the control plane resource usage and reconciliation stats
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
If you wish to use your own Prometheus and Grafana instances, then you can import the dashboards from
|
||||||
|
[GitHub](https://github.com/fluxcd/toolkit/tree/master/manifests/monitoring/grafana/dashboards).
|
||||||
|
|
||||||
|
!!! hint
|
||||||
|
Note that the toolkit controllers expose the `/metrics` endpoint on port `8080`.
|
||||||
|
When using Prometheus Operator you should create `PodMonitor` objects to configure scraping.
|
||||||
|
When Prometheus is running outside of the `gitops-system` namespace, you have to create a network policy
|
||||||
|
that allows traffic on port `8080` from the namespace where Prometheus is deployed.
|
||||||
@@ -8,7 +8,10 @@ of an app was deployed and if the deployment is healthy.
|
|||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
* [Get started guide](../get-started/index.md)
|
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 [installation guide](installation.md).
|
||||||
|
|
||||||
The GitOps toolkit controllers emit Kubernetes events whenever a resource status changes.
|
The GitOps toolkit controllers emit Kubernetes events whenever a resource status changes.
|
||||||
You can use the [notification-controller](../components/notification/controller.md)
|
You can use the [notification-controller](../components/notification/controller.md)
|
||||||
@@ -30,7 +33,7 @@ it can be a Slack, Microsoft Teams, Discord or Rocket webhook URL.
|
|||||||
Create a notification provider for Slack by referencing the above secret:
|
Create a notification provider for Slack by referencing the above secret:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: notification.fluxcd.io/v1alpha1
|
apiVersion: notification.toolkit.fluxcd.io/v1alpha1
|
||||||
kind: Provider
|
kind: Provider
|
||||||
metadata:
|
metadata:
|
||||||
name: slack
|
name: slack
|
||||||
@@ -54,7 +57,7 @@ Elasticsearch, CloudWatch, Stackdriver, etc.
|
|||||||
Create an alert definition for all repositories and kustomizations:
|
Create an alert definition for all repositories and kustomizations:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: notification.fluxcd.io/v1alpha1
|
apiVersion: notification.toolkit.fluxcd.io/v1alpha1
|
||||||
kind: Alert
|
kind: Alert
|
||||||
metadata:
|
metadata:
|
||||||
name: on-call-webapp
|
name: on-call-webapp
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ nobody else can obtain the original secret, even if they have access to the Git
|
|||||||
To follow this guide you'll need a Kubernetes cluster with the GitOps
|
To follow this guide you'll need a Kubernetes cluster with the GitOps
|
||||||
toolkit controllers installed on it.
|
toolkit controllers installed on it.
|
||||||
Please see the [get started guide](../get-started/index.md)
|
Please see the [get started guide](../get-started/index.md)
|
||||||
or the [install command docs](../cmd/tk_install.md).
|
or the [installation guide](installation.md).
|
||||||
|
|
||||||
The sealed-secrets controller comes with a companion CLI tool called kubeseal.
|
The sealed-secrets controller comes with a companion CLI tool called kubeseal.
|
||||||
With kubeseal you can create SealedSecret custom resources in YAML format
|
With kubeseal you can create SealedSecret custom resources in YAML format
|
||||||
@@ -116,7 +116,7 @@ to the fleet repository.
|
|||||||
Helm repository manifest:
|
Helm repository manifest:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: source.fluxcd.io/v1alpha1
|
apiVersion: source.toolkit.fluxcd.io/v1alpha1
|
||||||
kind: HelmRepository
|
kind: HelmRepository
|
||||||
metadata:
|
metadata:
|
||||||
name: stable
|
name: stable
|
||||||
@@ -129,7 +129,7 @@ spec:
|
|||||||
Helm release manifest:
|
Helm release manifest:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: helm.fluxcd.io/v2alpha1
|
apiVersion: helm.toolkit.fluxcd.io/v2alpha1
|
||||||
kind: HelmRelease
|
kind: HelmRelease
|
||||||
metadata:
|
metadata:
|
||||||
name: sealed-secrets
|
name: sealed-secrets
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ GitOps pipelines that react to external events.
|
|||||||
To follow this guide you'll need a Kubernetes cluster with the GitOps
|
To follow this guide you'll need a Kubernetes cluster with the GitOps
|
||||||
toolkit controllers installed on it.
|
toolkit controllers installed on it.
|
||||||
Please see the [get started guide](../get-started/index.md)
|
Please see the [get started guide](../get-started/index.md)
|
||||||
or the [install command docs](../cmd/tk_install.md).
|
or the [installation guide](installation.md).
|
||||||
|
|
||||||
The [notification controller](../components/notification/controller.md)
|
The [notification controller](../components/notification/controller.md)
|
||||||
can handle events coming from external systems
|
can handle events coming from external systems
|
||||||
@@ -58,7 +58,7 @@ watch kubectl -n gitops-system get svc/receiver
|
|||||||
Create a Git source pointing to a GitHub repository that you have control over:
|
Create a Git source pointing to a GitHub repository that you have control over:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: source.fluxcd.io/v1alpha1
|
apiVersion: source.toolkit.fluxcd.io/v1alpha1
|
||||||
kind: GitRepository
|
kind: GitRepository
|
||||||
metadata:
|
metadata:
|
||||||
name: webapp
|
name: webapp
|
||||||
@@ -89,7 +89,7 @@ kubectl -n gitops-system create secret generic webhook-token \
|
|||||||
Create a receiver for GitHub and specify the `GitRepository` object:
|
Create a receiver for GitHub and specify the `GitRepository` object:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: notification.fluxcd.io/v1alpha1
|
apiVersion: notification.toolkit.fluxcd.io/v1alpha1
|
||||||
kind: Receiver
|
kind: Receiver
|
||||||
metadata:
|
metadata:
|
||||||
name: webapp
|
name: webapp
|
||||||
|
|||||||
@@ -10,76 +10,82 @@
|
|||||||
|
|
||||||
### Flux read-only feature parity
|
### Flux read-only feature parity
|
||||||
|
|
||||||
|
[= 80% "80%"]
|
||||||
|
|
||||||
This would be the first stepping stone: we want the GitOps Toolkit to be on-par with today's Flux in
|
This would be the first stepping stone: we want the GitOps Toolkit to be on-par with today's Flux in
|
||||||
[read-only mode](https://github.com/fluxcd/flux/blob/master/docs/faq.md#can-i-run-flux-with-readonly-git-access)
|
[read-only mode](https://github.com/fluxcd/flux/blob/master/docs/faq.md#can-i-run-flux-with-readonly-git-access)
|
||||||
and [FluxCloud](https://github.com/justinbarrick/fluxcloud) notifications.
|
and [FluxCloud](https://github.com/justinbarrick/fluxcloud) notifications.
|
||||||
|
|
||||||
Goals
|
Goals
|
||||||
|
|
||||||
- Offer an in-place migration tool for those that are using Flux in read-only mode to synchronize plain manifests
|
- Offer an in-place migration tool for those that are using Flux in read-only mode to synchronize plain manifests
|
||||||
- Offer a migration guide for those that are using Flux in read-only mode to synchronize Kustomize overlays
|
- Offer a migration guide for those that are using Flux in read-only mode to synchronize Kustomize overlays
|
||||||
- ~~Offer a dedicated component for forwarding events to external messaging platforms~~
|
- <span class="check-bullet">:material-check-bold:</span> [Offer a dedicated component for forwarding events to external messaging platforms](https://toolkit.fluxcd.io/guides/notifications/)
|
||||||
|
|
||||||
Non-Goals
|
Non-Goals
|
||||||
|
|
||||||
- Migrate users that are using Flux to run custom scripts with `flux.yaml`
|
- Migrate users that are using Flux to run custom scripts with `flux.yaml`
|
||||||
- Automate the migration of `flux.yaml` kustomize users
|
- Automate the migration of `flux.yaml` kustomize users
|
||||||
|
|
||||||
Tasks
|
Tasks
|
||||||
|
|
||||||
- ~~Design the events API~~
|
- [x] <span style="color:grey">Design the events API</span>
|
||||||
- ~~Implement events in source and kustomize controllers~~
|
- [x] <span style="color:grey">Implement events in source and kustomize controllers</span>
|
||||||
- ~~Make the kustomize-controller apply/gc events on-par with Flux v1 apply events~~
|
- [x] <span style="color:grey">Make the kustomize-controller apply/gc events on-par with Flux v1 apply events</span>
|
||||||
- ~~Design the notifications and events filtering API~~
|
- [x] <span style="color:grey">Design the notifications and events filtering API</span>
|
||||||
- ~~Implement a notification controller for Slack, MS Teams, Discord, Rocket~~
|
- [x] <span style="color:grey">Implement a notification controller for Slack, MS Teams, Discord, Rocket</span>
|
||||||
- Implement Prometheus metrics in source and kustomize controllers
|
- [x] <span style="color:grey">Implement Prometheus metrics in source and kustomize controllers</span>
|
||||||
- Review the git source and kustomize APIs
|
- [ ] Review the git source and kustomize APIs
|
||||||
- Implement the migration command in tk
|
- [ ] Implement the migration command in tk
|
||||||
- Create a migration guide for `flux.yaml` kustomize users
|
- [ ] Create a migration guide for `flux.yaml` kustomize users
|
||||||
|
|
||||||
### Flux image update feature parity
|
### Flux image update feature parity
|
||||||
|
|
||||||
|
[= 0% "0%"]
|
||||||
|
|
||||||
Goals
|
Goals
|
||||||
|
|
||||||
- Offer components that can replace Flux v1 image update feature
|
- Offer components that can replace Flux v1 image update feature
|
||||||
|
|
||||||
Non-Goals
|
Non-Goals
|
||||||
|
|
||||||
- Maintain backwards compatibility with Flux v1 annotations
|
- Maintain backwards compatibility with Flux v1 annotations
|
||||||
|
|
||||||
Tasks
|
Tasks
|
||||||
|
|
||||||
- [Design the image scanning and automation API](https://github.com/fluxcd/toolkit/discussions/107)
|
- [ ] [Design the image scanning and automation API](https://github.com/fluxcd/toolkit/discussions/107)
|
||||||
- Implement an image scanning controller
|
- [ ] Implement an image scanning controller
|
||||||
- Design the automation component
|
- [ ] Design the automation component
|
||||||
- Implement the image scan/patch/push workflow
|
- [ ] Implement the image scan/patch/push workflow
|
||||||
- Integrate the new components in the toolkit assembler
|
- [ ] Integrate the new components in the toolkit assembler
|
||||||
- Create a migration guide from Flux annotations
|
- [ ] Create a migration guide from Flux annotations
|
||||||
|
|
||||||
## The road to Helm Operator v2
|
## The road to Helm Operator v2
|
||||||
|
|
||||||
### Helm v3 feature parity
|
### Helm v3 feature parity
|
||||||
|
|
||||||
|
[= 50% "50%"]
|
||||||
|
|
||||||
Goals
|
Goals
|
||||||
|
|
||||||
- Offer a migration guide for those that are using Helm Operator with Helm v3 and Helm repositories
|
- Offer a migration guide for those that are using Helm Operator with Helm v3 and Helm repositories
|
||||||
|
|
||||||
Non-Goals
|
Non-Goals
|
||||||
|
|
||||||
- Migrate users that are using Helm v2
|
- Migrate users that are using Helm v2
|
||||||
|
|
||||||
Stretch-Goals
|
Stretch-Goals
|
||||||
|
|
||||||
- [Migrate users that are using Helm charts from Git](https://github.com/fluxcd/toolkit/discussions/75#discussioncomment-38589)
|
- [Migrate users that are using Helm charts from Git](https://github.com/fluxcd/toolkit/discussions/75#discussioncomment-38589)
|
||||||
|
|
||||||
Tasks
|
Tasks
|
||||||
|
|
||||||
- ~~Implement a Helm controller for Helm v3 covering all the current release options~~
|
- [x] <span style="color:grey">Implement a Helm controller for Helm v3 covering all the current release options</span>
|
||||||
- Discuss and design Helm releases based on source API:
|
- [ ] Discuss and design Helm releases based on source API:
|
||||||
+ [Providing values from sources](https://github.com/fluxcd/toolkit/discussions/100)
|
* [ ] [Providing values from sources](https://github.com/fluxcd/toolkit/discussions/100)
|
||||||
+ [Conditional remediation on failed Helm actions](https://github.com/fluxcd/toolkit/discussions/102)
|
* [ ] [Conditional remediation on failed Helm actions](https://github.com/fluxcd/toolkit/discussions/102)
|
||||||
+ [Support running Helm test actions on an interval](https://github.com/fluxcd/toolkit/discussions/103)
|
* [ ] [Support running Helm test actions on an interval](https://github.com/fluxcd/toolkit/discussions/103)
|
||||||
- Review the Helm release, chart and repository APIs
|
- [x] <span style="color:grey">Review the Helm release, chart and repository APIs</span>
|
||||||
- ~~Implement events in Helm controller~~
|
- [x] <span style="color:grey">Implement events in Helm controller</span>
|
||||||
- Implement Prometheus metrics in Helm controller
|
- [x] <span style="color:grey">Implement Prometheus metrics in Helm controller</span>
|
||||||
- Create a migration guide for Helm Operator users
|
- [ ] Create a migration guide for Helm Operator users
|
||||||
|
|||||||
6
go.mod
6
go.mod
@@ -4,10 +4,10 @@ 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.4
|
github.com/fluxcd/helm-controller v0.0.1
|
||||||
github.com/fluxcd/kustomize-controller v0.0.5
|
github.com/fluxcd/kustomize-controller v0.0.7
|
||||||
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.7
|
||||||
github.com/manifoldco/promptui v0.7.0
|
github.com/manifoldco/promptui v0.7.0
|
||||||
github.com/spf13/cobra v1.0.0
|
github.com/spf13/cobra v1.0.0
|
||||||
golang.org/x/net v0.0.0-20200602114024-627f9648deb9 // indirect
|
golang.org/x/net v0.0.0-20200602114024-627f9648deb9 // indirect
|
||||||
|
|||||||
12
go.sum
12
go.sum
@@ -172,14 +172,14 @@ 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.4 h1:Go7ZGI91BY6A69Qp9TdJg3nufaahQCYhpj7Lum9oyKA=
|
github.com/fluxcd/helm-controller v0.0.1 h1:vTAbVJbn6MX8YAMPQ+zeiGV2CwX75YjF1Yxd8veng7c=
|
||||||
github.com/fluxcd/helm-controller v0.0.1-beta.4/go.mod h1:asoN9pG8J0oQ9iXpkxNwvch1EKspus6RxH818ZYVo+4=
|
github.com/fluxcd/helm-controller v0.0.1/go.mod h1:TLmobkvkb44l/R3J9MZsO0ht4nUX7plO5hWj4qTrhgI=
|
||||||
github.com/fluxcd/kustomize-controller v0.0.5 h1:jjBJT/UbblMaeQpYn5TjH/oXXnORO6C3Cka77bs9K3Q=
|
github.com/fluxcd/kustomize-controller v0.0.7 h1:bIBT5s6jnRjUEOp+AdgQNGpQBZHMBJV/Ak1bK1qtRSM=
|
||||||
github.com/fluxcd/kustomize-controller v0.0.5/go.mod h1:1O78f9Qigs74BMxO/ThzLt5XGGQnwQPgzi+47ntie5M=
|
github.com/fluxcd/kustomize-controller v0.0.7/go.mod h1:GVZs7l+0iI/N6ly0ftNzD5cZqJTmd+BPbsy445hklpU=
|
||||||
github.com/fluxcd/pkg v0.0.3 h1:yhjtpGtD9LxFo8JtwTuUxJyFcX2wSSb0TPptIEpGSmA=
|
github.com/fluxcd/pkg v0.0.3 h1:yhjtpGtD9LxFo8JtwTuUxJyFcX2wSSb0TPptIEpGSmA=
|
||||||
github.com/fluxcd/pkg v0.0.3/go.mod h1:rtlppQU+9DNikyDZptLdOeTf+wBvQQiQQ/J113FPoeU=
|
github.com/fluxcd/pkg v0.0.3/go.mod h1:rtlppQU+9DNikyDZptLdOeTf+wBvQQiQQ/J113FPoeU=
|
||||||
github.com/fluxcd/source-controller v0.0.6 h1:8yBdy5ZQmM4jZWHDBDgysftZnC1mybyfkV7NRzCo5Kc=
|
github.com/fluxcd/source-controller v0.0.7 h1:D17Le7bc+53deRA3EMJc9eB/uU2HqvkMCwILE5HRhPk=
|
||||||
github.com/fluxcd/source-controller v0.0.6/go.mod h1:XZR988ahVLjbqfe0EUq2Zl7bYH2NBly3u0n7DY5XtyU=
|
github.com/fluxcd/source-controller v0.0.7/go.mod h1:XZR988ahVLjbqfe0EUq2Zl7bYH2NBly3u0n7DY5XtyU=
|
||||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ=
|
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ=
|
||||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
||||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||||
|
|||||||
@@ -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.4
|
- github.com/fluxcd/helm-controller/config//crd?ref=v0.0.1
|
||||||
- github.com/fluxcd/helm-controller/config//manager?ref=v0.0.1-beta.4
|
- github.com/fluxcd/helm-controller/config//manager?ref=v0.0.1
|
||||||
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.7
|
||||||
- github.com/fluxcd/kustomize-controller/config//manager?ref=v0.0.5
|
- github.com/fluxcd/kustomize-controller/config//manager?ref=v0.0.7
|
||||||
patchesJson6902:
|
patchesJson6902:
|
||||||
- target:
|
- target:
|
||||||
group: apps
|
group: apps
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- github.com/fluxcd/notification-controller/config//crd?ref=v0.0.5
|
- github.com/fluxcd/notification-controller/config//crd?ref=v0.0.7
|
||||||
- github.com/fluxcd/notification-controller/config//manager?ref=v0.0.5
|
- github.com/fluxcd/notification-controller/config//manager?ref=v0.0.7
|
||||||
|
|||||||
@@ -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/source-controller/config//crd?ref=v0.0.6
|
- github.com/fluxcd/source-controller/config//crd?ref=v0.0.7
|
||||||
- github.com/fluxcd/source-controller/config//manager?ref=v0.0.6
|
- github.com/fluxcd/source-controller/config//manager?ref=v0.0.7
|
||||||
patchesJson6902:
|
patchesJson6902:
|
||||||
- target:
|
- target:
|
||||||
group: apps
|
group: apps
|
||||||
|
|||||||
1412
manifests/monitoring/grafana/dashboards/control-plane.json
Normal file
1412
manifests/monitoring/grafana/dashboards/control-plane.json
Normal file
File diff suppressed because it is too large
Load Diff
18
manifests/monitoring/grafana/datasources.yaml
Normal file
18
manifests/monitoring/grafana/datasources.yaml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: grafana-datasources
|
||||||
|
namespace: gitops-system
|
||||||
|
data:
|
||||||
|
datasources.yaml: |-
|
||||||
|
apiVersion: 1
|
||||||
|
deleteDatasources:
|
||||||
|
- name: prometheus
|
||||||
|
datasources:
|
||||||
|
- name: prometheus
|
||||||
|
type: prometheus
|
||||||
|
access: proxy
|
||||||
|
url: http://prometheus:9090
|
||||||
|
isDefault: true
|
||||||
|
editable: true
|
||||||
|
version: 1
|
||||||
60
manifests/monitoring/grafana/deployment.yaml
Normal file
60
manifests/monitoring/grafana/deployment.yaml
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: grafana
|
||||||
|
labels:
|
||||||
|
app: grafana
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: grafana
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: grafana
|
||||||
|
annotations:
|
||||||
|
prometheus.io/scrape: 'false'
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: grafana
|
||||||
|
image: "grafana/grafana:7.1.1"
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
containerPort: 3000
|
||||||
|
protocol: TCP
|
||||||
|
env:
|
||||||
|
- name: GF_PATHS_PROVISIONING
|
||||||
|
value: /etc/grafana/provisioning/
|
||||||
|
- name: GF_AUTH_BASIC_ENABLED
|
||||||
|
value: "false"
|
||||||
|
- name: GF_AUTH_ANONYMOUS_ENABLED
|
||||||
|
value: "true"
|
||||||
|
- name: GF_AUTH_ANONYMOUS_ORG_ROLE
|
||||||
|
value: Admin
|
||||||
|
- name: GF_DEFAULT_THEME
|
||||||
|
value: "Light"
|
||||||
|
volumeMounts:
|
||||||
|
- name: grafana
|
||||||
|
mountPath: /var/lib/grafana
|
||||||
|
- name: dashboards
|
||||||
|
mountPath: /etc/grafana/dashboards
|
||||||
|
- name: datasources
|
||||||
|
mountPath: /etc/grafana/provisioning/datasources
|
||||||
|
- name: providers
|
||||||
|
mountPath: /etc/grafana/provisioning/dashboards
|
||||||
|
resources:
|
||||||
|
{}
|
||||||
|
volumes:
|
||||||
|
- name: grafana
|
||||||
|
emptyDir: {}
|
||||||
|
- name: dashboards
|
||||||
|
configMap:
|
||||||
|
name: grafana-dashboards
|
||||||
|
- name: providers
|
||||||
|
configMap:
|
||||||
|
name: grafana-providers
|
||||||
|
- name: datasources
|
||||||
|
configMap:
|
||||||
|
name: grafana-datasources
|
||||||
13
manifests/monitoring/grafana/kustomization.yaml
Normal file
13
manifests/monitoring/grafana/kustomization.yaml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
namespace: gitops-system
|
||||||
|
resources:
|
||||||
|
- service.yaml
|
||||||
|
- deployment.yaml
|
||||||
|
- providers.yaml
|
||||||
|
- datasources.yaml
|
||||||
|
configMapGenerator:
|
||||||
|
- name: grafana-dashboards
|
||||||
|
files:
|
||||||
|
- dashboards/control-plane.json
|
||||||
|
|
||||||
17
manifests/monitoring/grafana/providers.yaml
Normal file
17
manifests/monitoring/grafana/providers.yaml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: grafana-providers
|
||||||
|
namespace: gitops-system
|
||||||
|
data:
|
||||||
|
providers.yaml: |+
|
||||||
|
apiVersion: 1
|
||||||
|
providers:
|
||||||
|
- name: 'default'
|
||||||
|
orgId: 1
|
||||||
|
folder: ''
|
||||||
|
type: file
|
||||||
|
disableDeletion: false
|
||||||
|
editable: true
|
||||||
|
options:
|
||||||
|
path: /etc/grafana/dashboards
|
||||||
16
manifests/monitoring/grafana/service.yaml
Normal file
16
manifests/monitoring/grafana/service.yaml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: grafana
|
||||||
|
namespace: gitops-system
|
||||||
|
labels:
|
||||||
|
app: grafana
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
ports:
|
||||||
|
- port: 3000
|
||||||
|
targetPort: http
|
||||||
|
protocol: TCP
|
||||||
|
name: http
|
||||||
|
selector:
|
||||||
|
app: grafana
|
||||||
6
manifests/monitoring/kustomization.yaml
Normal file
6
manifests/monitoring/kustomization.yaml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
namespace: gitops-system
|
||||||
|
resources:
|
||||||
|
- prometheus
|
||||||
|
- grafana
|
||||||
5
manifests/monitoring/prometheus/account.yaml
Normal file
5
manifests/monitoring/prometheus/account.yaml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: prometheus
|
||||||
|
namespace: gitops-system
|
||||||
52
manifests/monitoring/prometheus/deployment.yaml
Normal file
52
manifests/monitoring/prometheus/deployment.yaml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: prometheus
|
||||||
|
namespace: gitops-system
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: prometheus
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: prometheus
|
||||||
|
annotations:
|
||||||
|
appmesh.k8s.aws/sidecarInjectorWebhook: disabled
|
||||||
|
sidecar.istio.io/inject: "false"
|
||||||
|
spec:
|
||||||
|
serviceAccountName: prometheus
|
||||||
|
containers:
|
||||||
|
- name: prometheus
|
||||||
|
image: prom/prometheus:v2.20.0
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
args:
|
||||||
|
- '--storage.tsdb.retention=2h'
|
||||||
|
- '--config.file=/etc/prometheus/prometheus.yml'
|
||||||
|
ports:
|
||||||
|
- containerPort: 9090
|
||||||
|
name: http
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /-/healthy
|
||||||
|
port: 9090
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /-/ready
|
||||||
|
port: 9090
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 10m
|
||||||
|
memory: 128Mi
|
||||||
|
volumeMounts:
|
||||||
|
- name: config-volume
|
||||||
|
mountPath: /etc/prometheus
|
||||||
|
- name: data-volume
|
||||||
|
mountPath: /prometheus/data
|
||||||
|
volumes:
|
||||||
|
- name: config-volume
|
||||||
|
configMap:
|
||||||
|
name: prometheus
|
||||||
|
- name: data-volume
|
||||||
|
emptyDir: {}
|
||||||
12
manifests/monitoring/prometheus/kustomization.yaml
Normal file
12
manifests/monitoring/prometheus/kustomization.yaml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
namespace: gitops-system
|
||||||
|
resources:
|
||||||
|
- account.yaml
|
||||||
|
- rbac.yaml
|
||||||
|
- service.yaml
|
||||||
|
- deployment.yaml
|
||||||
|
configMapGenerator:
|
||||||
|
- name: prometheus
|
||||||
|
files:
|
||||||
|
- prometheus.yml
|
||||||
52
manifests/monitoring/prometheus/prometheus.yml
Normal file
52
manifests/monitoring/prometheus/prometheus.yml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
global:
|
||||||
|
scrape_interval: 10s
|
||||||
|
scrape_configs:
|
||||||
|
|
||||||
|
# Kubernetes API
|
||||||
|
- job_name: kubernetes-apiserver
|
||||||
|
kubernetes_sd_configs:
|
||||||
|
- role: endpoints
|
||||||
|
namespaces:
|
||||||
|
names:
|
||||||
|
- default
|
||||||
|
scheme: https
|
||||||
|
tls_config:
|
||||||
|
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
|
||||||
|
insecure_skip_verify: true
|
||||||
|
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
|
||||||
|
relabel_configs:
|
||||||
|
- source_labels: [__meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]
|
||||||
|
action: keep
|
||||||
|
regex: kubernetes;https
|
||||||
|
|
||||||
|
# Kubernetes pods
|
||||||
|
- job_name: kubernetes-pods
|
||||||
|
kubernetes_sd_configs:
|
||||||
|
- role: pod
|
||||||
|
relabel_configs:
|
||||||
|
- action: keep
|
||||||
|
regex: true
|
||||||
|
source_labels:
|
||||||
|
- __meta_kubernetes_pod_annotation_prometheus_io_scrape
|
||||||
|
- action: replace
|
||||||
|
regex: (.+)
|
||||||
|
source_labels:
|
||||||
|
- __meta_kubernetes_pod_annotation_prometheus_io_path
|
||||||
|
target_label: __metrics_path__
|
||||||
|
- action: replace
|
||||||
|
regex: ([^:]+)(?::\d+)?;(\d+)
|
||||||
|
replacement: $1:$2
|
||||||
|
source_labels:
|
||||||
|
- __address__
|
||||||
|
- __meta_kubernetes_pod_annotation_prometheus_io_port
|
||||||
|
target_label: __address__
|
||||||
|
- action: labelmap
|
||||||
|
regex: __meta_kubernetes_pod_label_(.+)
|
||||||
|
- action: replace
|
||||||
|
source_labels:
|
||||||
|
- __meta_kubernetes_namespace
|
||||||
|
target_label: kubernetes_namespace
|
||||||
|
- action: replace
|
||||||
|
source_labels:
|
||||||
|
- __meta_kubernetes_pod_name
|
||||||
|
target_label: kubernetes_pod_name
|
||||||
32
manifests/monitoring/prometheus/rbac.yaml
Normal file
32
manifests/monitoring/prometheus/rbac.yaml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRole
|
||||||
|
metadata:
|
||||||
|
name: prometheus-gitops-system
|
||||||
|
rules:
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources:
|
||||||
|
- nodes
|
||||||
|
- services
|
||||||
|
- endpoints
|
||||||
|
- pods
|
||||||
|
- nodes/proxy
|
||||||
|
verbs: ["get", "list", "watch"]
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources:
|
||||||
|
- configmaps
|
||||||
|
verbs: ["get"]
|
||||||
|
- nonResourceURLs: ["/metrics"]
|
||||||
|
verbs: ["get"]
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
name: prometheus-gitops-system
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: prometheus-gitops-system
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: prometheus
|
||||||
|
namespace: gitops-system
|
||||||
12
manifests/monitoring/prometheus/service.yaml
Normal file
12
manifests/monitoring/prometheus/service.yaml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: prometheus
|
||||||
|
namespace: gitops-system
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: prometheus
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
protocol: TCP
|
||||||
|
port: 9090
|
||||||
@@ -3,16 +3,16 @@ kind: Role
|
|||||||
metadata:
|
metadata:
|
||||||
name: crd-controller
|
name: crd-controller
|
||||||
rules:
|
rules:
|
||||||
- apiGroups: ['source.fluxcd.io']
|
- apiGroups: ['source.toolkit.fluxcd.io']
|
||||||
resources: ['*']
|
resources: ['*']
|
||||||
verbs: ['*']
|
verbs: ['*']
|
||||||
- apiGroups: ['kustomize.fluxcd.io']
|
- apiGroups: ['kustomize.toolkit.fluxcd.io']
|
||||||
resources: ['*']
|
resources: ['*']
|
||||||
verbs: ['*']
|
verbs: ['*']
|
||||||
- apiGroups: ['helm.fluxcd.io']
|
- apiGroups: ['helm.toolkit.fluxcd.io']
|
||||||
resources: ['*']
|
resources: ['*']
|
||||||
verbs: ['*']
|
verbs: ['*']
|
||||||
- apiGroups: ['notification.fluxcd.io']
|
- apiGroups: ['notification.toolkit.fluxcd.io']
|
||||||
resources: ['*']
|
resources: ['*']
|
||||||
verbs: ['*']
|
verbs: ['*']
|
||||||
- apiGroups:
|
- apiGroups:
|
||||||
|
|||||||
@@ -35,11 +35,17 @@ markdown_extensions:
|
|||||||
highlight_code: true
|
highlight_code: true
|
||||||
- pymdownx.tabbed
|
- pymdownx.tabbed
|
||||||
- pymdownx.tilde
|
- pymdownx.tilde
|
||||||
|
- pymdownx.progressbar
|
||||||
|
- pymdownx.tasklist
|
||||||
|
- pymdownx.emoji:
|
||||||
|
emoji_index: !!python/name:materialx.emoji.twemoji
|
||||||
|
emoji_generator: !!python/name:materialx.emoji.to_svg
|
||||||
|
|
||||||
nav:
|
nav:
|
||||||
- Introduction: index.md
|
- Introduction: index.md
|
||||||
- Get Started: get-started/index.md
|
- Get Started: get-started/index.md
|
||||||
- Guides:
|
- Guides:
|
||||||
|
- Installation: guides/installation.md
|
||||||
- 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
|
||||||
|
|||||||
Reference in New Issue
Block a user