Skip to content

Commit

Permalink
add chart flux-sync (#15)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Werdermann <daniel.werdermann@gmail.com>
  • Loading branch information
dwerder authored Nov 9, 2021
1 parent 029efaf commit 905a5f2
Show file tree
Hide file tree
Showing 13 changed files with 432 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codespell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Codespell
uses: codespell-project/actions-codespell@master
with:
skip: .git,./charts/flux2/Changelog.md
skip: .git,./charts/flux2/Changelog.md,./charts/flux2-sync/Changelog.md
ignore_words_list: iam,aks,keypair
check_filenames: true
check_hidden: true
10 changes: 8 additions & 2 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,11 @@ jobs:
uses: helm/kind-action@v1.2.0
if: steps.list-changed.outputs.changed == 'true'

- name: Run chart-testing (install)
run: ct install --config ct.yaml
- name: Run chart-testing (install) for flux2
run: ct install --config ct.yaml --charts charts/flux2

- name: Run chart-testing (install) for flux2-sync
run: |
helm install flux2 charts/flux2 --namespace flux2-sync --create-namespace
ct install --config ct.yaml --charts charts/flux2-sync --namespace flux2-sync
helm uninstall flux2 --namespace flux2-sync
25 changes: 25 additions & 0 deletions charts/flux2-sync/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

tests/
115 changes: 115 additions & 0 deletions charts/flux2-sync/Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Change Log

## 0.1.0

**Release date:** 2021-11-08

![Helm: v3](https://img.shields.io/static/v1?label=Helm&message=v3&color=informational&logo=helm)


* add chart for repo sync

### Default value changes

```diff
gitRepository:
metadata:
labels: {}
name: ""
spec:
# -- The repository URL, can be a HTTP/S or SSH address.
url: ""

# -- (Optional) The secret name containing the Git credentials. For HTTPS repositories the secret must contain username and password fields. For SSH repositories the secret must contain identity, identity.pub and known_hosts fields.
secretRef: {}

# -- The interval at which to check for repository updates.
interval: ""

# -- (Optional) The timeout for remote Git operations like cloning, defaults to 20s.
timeout: ""

# -- (Optional) The Git reference to checkout and monitor for changes, defaults to master branch.
ref: ""

# -- (Optional) Verify OpenPGP signature for the Git commit HEAD points to.
verify: {}

# -- (Optional) Ignore overrides the set of excluded patterns in the .sourceignore format (which is the same as .gitignore). If not provided, a default will be used, consult the documentation for your version to find out what those are.
ignore: ""

# -- (Optional) This flag tells the controller to suspend the reconciliation of this source.
suspend: ""

# -- (Optional) Determines which git client library to use. Defaults to go-git, valid values are (‘go-git’, ‘libgit2’).
gitImplementation: ""

# -- (Optional) When enabled, after the clone is created, initializes all submodules within, using their default settings. This option is available only when using the ‘go-git’ GitImplementation.
recurseSubmodules: ""

# -- (Optional) Extra git repositories to map into the repository
include: []


kustomization:
spec:
# -- (Optional) DependsOn may contain a dependency.CrossNamespaceDependencyReference slice with references to Kustomization resources that must be ready before this Kustomization can be reconciled.
dependsOn: []

# -- (Optional) Decrypt Kubernetes secrets before applying them on the cluster.
decryption: {}

# -- The interval at which to reconcile the Kustomization.
interval: 5m

# -- (Optional) The interval at which to retry a previously failed reconciliation. When not specified, the controller uses the KustomizationSpec.Interval value to retry failures.
retryInterval: ""

# -- (Optional) The KubeConfig for reconciling the Kustomization on a remote cluster. When specified, KubeConfig takes precedence over ServiceAccountName.
kubeConfig: ""

# -- (Optional) Path to the directory containing the kustomization.yaml
# file, or the set of plain YAMLs a kustomization.yaml should
# be generated for. Defaults to ‘None’, which translates to
# the root path of the SourceRef.
path: ""

# -- (Optional) PostBuild describes which actions to perform on the YAML manifest generated by building the kustomize overlay.
postBuild: {}

# -- Prune enables garbage collection. Defaults to true.
prune: true

# -- (Optional) A list of resources to be included in the health assessment.
healthChecks: []

# -- (Optional) Strategic merge and JSON patches, defined as inline YAML objects, capable of targeting objects based on kind, label and annotation selectors.
patches: []

# -- (Optional) Images is a list of (image name, new name, new tag or digest) for changing image names, tags or digests. This can also be achieved with a patch, but this operator is simpler to specify.
images: []

# -- (Optional) The name of the Kubernetes service account to impersonate when reconciling this Kustomization.
serviceAccountName: ""

# -- Reference of the source where the kustomization file is.
sourceRef: {}

# -- (Optional) This flag tells the controller to suspend subsequent kustomize executions, it does not apply to already started executions. Defaults to false.
suspend: ""

# -- (Optional) TargetNamespace sets or overrides the namespace in the kustomization.yaml file.
targetNamespace: ""

# -- (Optional) Timeout for validation, apply and health checking operations. Defaults to ‘Interval’ duration
timeout: ""

# -- (Optional) Force instructs the controller to recreate resources when patching fails due to an immutable field change. Defaults to false.
force: ""

# -- (Optional) Wait instructs the controller to check the health of all the reconciled resources. When enabled, the HealthChecks are ignored. Defaults to false.
wait: ""
```

---
Autogenerated from Helm Chart and git history using [helm-changelog](https://github.com/mogensen/helm-changelog)
9 changes: 9 additions & 0 deletions charts/flux2-sync/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v2
name: flux2-sync
version: "0.1.0"

description: A Helm chart for flux2 GitRepository to sync with
sources:
- https://github.com/fluxcd-community/helm-charts

type: application
54 changes: 54 additions & 0 deletions charts/flux2-sync/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# flux2-sync

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)

A Helm chart for flux2 GitRepository to sync with

## Source Code

* <https://github.com/fluxcd-community/helm-charts>

## Requirements

| Repository | Name | Version |
|------------|------|---------|
| https://fluxcd-community.github.io/helm-charts/ | flux2 | >=0.3.1 |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| gitRepository.metadata.labels | object | `{}` | |
| gitRepository.metadata.name | string | `"gitRepository"` | |
| gitRepository.spec.gitImplementation | string | `""` | (Optional) Determines which git client library to use. Defaults to go-git, valid values are (‘go-git’, ‘libgit2’). |
| gitRepository.spec.ignore | string | `""` | (Optional) Ignore overrides the set of excluded patterns in the .sourceignore format (which is the same as .gitignore). If not provided, a default will be used, consult the documentation for your version to find out what those are. |
| gitRepository.spec.include | list | `[]` | (Optional) Extra git repositories to map into the repository |
| gitRepository.spec.interval | string | `""` | The interval at which to check for repository updates. |
| gitRepository.spec.recurseSubmodules | string | `""` | (Optional) When enabled, after the clone is created, initializes all submodules within, using their default settings. This option is available only when using the ‘go-git’ GitImplementation. |
| gitRepository.spec.ref | string | `""` | (Optional) The Git reference to checkout and monitor for changes, defaults to master branch. |
| gitRepository.spec.secretRef | object | `{}` | (Optional) The secret name containing the Git credentials. For HTTPS repositories the secret must contain username and password fields. For SSH repositories the secret must contain identity, identity.pub and known_hosts fields. |
| gitRepository.spec.suspend | string | `""` | (Optional) This flag tells the controller to suspend the reconciliation of this source. |
| gitRepository.spec.timeout | string | `""` | (Optional) The timeout for remote Git operations like cloning, defaults to 20s. |
| gitRepository.spec.url | string | `""` | The repository URL, can be a HTTP/S or SSH address. |
| gitRepository.spec.verify | object | `{}` | (Optional) Verify OpenPGP signature for the Git commit HEAD points to. |
| kustomization.spec.decryption | object | `{}` | (Optional) Decrypt Kubernetes secrets before applying them on the cluster. |
| kustomization.spec.dependsOn | list | `[]` | (Optional) DependsOn may contain a dependency.CrossNamespaceDependencyReference slice with references to Kustomization resources that must be ready before this Kustomization can be reconciled. |
| kustomization.spec.force | string | `""` | (Optional) Force instructs the controller to recreate resources when patching fails due to an immutable field change. Defaults to false. |
| kustomization.spec.healthChecks | list | `[]` | (Optional) A list of resources to be included in the health assessment. |
| kustomization.spec.images | list | `[]` | (Optional) Images is a list of (image name, new name, new tag or digest) for changing image names, tags or digests. This can also be achieved with a patch, but this operator is simpler to specify. |
| kustomization.spec.interval | string | `"5m"` | The interval at which to reconcile the Kustomization. |
| kustomization.spec.kubeConfig | string | `""` | (Optional) The KubeConfig for reconciling the Kustomization on a remote cluster. When specified, KubeConfig takes precedence over ServiceAccountName. |
| kustomization.spec.patches | list | `[]` | (Optional) Strategic merge and JSON patches, defined as inline YAML objects, capable of targeting objects based on kind, label and annotation selectors. |
| kustomization.spec.path | string | `""` | (Optional) Path to the directory containing the kustomization.yaml file, or the set of plain YAMLs a kustomization.yaml should be generated for. Defaults to ‘None’, which translates to the root path of the SourceRef. |
| kustomization.spec.postBuild | object | `{}` | (Optional) PostBuild describes which actions to perform on the YAML manifest generated by building the kustomize overlay. |
| kustomization.spec.prune | bool | `true` | Prune enables garbage collection. Defaults to true. |
| kustomization.spec.retryInterval | string | `""` | (Optional) The interval at which to retry a previously failed reconciliation. When not specified, the controller uses the KustomizationSpec.Interval value to retry failures. |
| kustomization.spec.serviceAccountName | string | `""` | (Optional) The name of the Kubernetes service account to impersonate when reconciling this Kustomization. |
| kustomization.spec.sourceRef | object | `{}` | Reference of the source where the kustomization file is. |
| kustomization.spec.suspend | string | `""` | (Optional) This flag tells the controller to suspend subsequent kustomize executions, it does not apply to already started executions. Defaults to false. |
| kustomization.spec.targetNamespace | string | `""` | (Optional) TargetNamespace sets or overrides the namespace in the kustomization.yaml file. |
| kustomization.spec.timeout | string | `""` | (Optional) Timeout for validation, apply and health checking operations. Defaults to ‘Interval’ duration |
| kustomization.spec.wait | string | `""` | (Optional) Wait instructs the controller to check the health of all the reconciled resources. When enabled, the HealthChecks are ignored. Defaults to false. |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
41 changes: 41 additions & 0 deletions charts/flux2-sync/templates/gitrepository.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: GitRepository
metadata:
labels:
app.kubernetes.io/instance: {{ .Release.Namespace }}
app.kubernetes.io/part-of: flux
{{- with .Values.gitRepository.metadata.labels }}{{ toYaml . | indent 4 }}{{ end }}
name: {{ .Values.gitRepository.metadata.name }}
namespace: {{ .Release.Namespace }}
spec:
url: {{ .Values.gitRepository.spec.url }}
{{- with .Values.gitRepository.spec.secretRef }}
secretRef: {{ toYaml . | nindent 4 }}
{{- end }}
{{- if .Values.gitRepository.spec.interval }}
interval: {{ .Values.gitRepository.spec.interval }}
{{- end }}
{{- if .Values.gitRepository.spec.timeout }}
timeout: {{ .Values.gitRepository.spec.timeout }}
{{- end }}
{{- if .Values.gitRepository.spec.ref }}
ref: {{ .Values.gitRepository.spec.ref }}
{{- end }}
{{- with .Values.gitRepository.spec.verify }}
verify: {{ toYaml . | nindent 4 }}
{{- end }}
{{- if .Values.gitRepository.spec.ignore }}
ignore: {{ .Values.gitRepository.spec.ignore }}
{{- end }}
{{- if .Values.gitRepository.spec.suspend }}
suspend: {{ .Values.gitRepository.spec.suspend }}
{{- end }}
{{- if .Values.gitRepository.spec.gitImplementation }}
gitImplementation: {{ .Values.gitRepository.spec.gitImplementation }}
{{- end }}
{{- if .Values.gitRepository.spec.recurseSubmodules }}
recurseSubmodules: {{ .Values.gitRepository.spec.recurseSubmodules }}
{{- end }}
{{- with .Values.gitRepository.spec.decryincludeption }}
include: {{ toYaml . | nindent 4 }}
{{- end }}
62 changes: 62 additions & 0 deletions charts/flux2-sync/templates/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
labels:
app.kubernetes.io/instance: {{ .Release.Namespace }}
app.kubernetes.io/part-of: flux
name: kustomization-{{ .Values.gitRepository.metadata.name }}-{{ .Release.Namespace }}
namespace: {{ .Release.Namespace }}
spec:
{{- with .Values.kustomization.spec.dependsOn }}
dependsOn: {{ toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.kustomization.spec.decryption }}
decryption: {{ toYaml . | nindent 4 }}
{{- end }}
interval: {{ .Values.kustomization.spec.interval }}
{{- if .Values.kustomization.spec.retryInterval }}
retryInterval: {{ .Values.kustomization.spec.retryInterval }}
{{- end }}
{{- if .Values.kustomization.spec.kubeConfig }}
kubeConfig: {{ .Values.kustomization.spec.kubeConfig }}
{{- end }}
{{- if .Values.kustomization.spec.path }}
path: {{ .Values.kustomization.spec.path }}
{{- end }}
{{- if .Values.kustomization.spec.wait }}
{{ toYaml .Values.kustomization.spec.wait | nindent 4 }}
{{- end }}
{{- with .Values.kustomization.spec.postBuild }}
postBuild: {{ toYaml . | nindent 4 }}
{{- end }}
prune: {{ .Values.kustomization.spec.prune }}
{{- with .Values.kustomization.spec.healthChecks }}
healthChecks: {{ toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.kustomization.spec.patches }}
patches: {{ toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.kustomization.spec.images }}
images: {{ toYaml . | nindent 4 }}
{{- end }}
{{- if .Values.kustomization.spec.serviceAccountName }}
serviceAccountName: {{ .Values.kustomization.spec.serviceAccountName }}
{{- end }}
sourceRef:
kind: GitRepository
name: {{ .Values.gitRepository.metadata.name }}
{{- if .Values.kustomization.spec.suspend }}
suspend: {{ .Values.kustomization.spec.suspend }}
{{- end }}
{{- if .Values.kustomization.spec.targetNamespace }}
targetNamespace: {{ .Values.kustomization.spec.targetNamespace }}
{{- end }}
{{- if .Values.kustomization.spec.timeout }}
timeout: {{ .Values.kustomization.spec.timeout }}
{{- end }}
{{- if .Values.kustomization.spec.force }}
force: {{ .Values.kustomization.spec.force }}
{{- end }}
{{- if .Values.kustomization.spec.wait }}
wait: {{ .Values.kustomization.spec.wait }}
{{- end }}
Loading

0 comments on commit 905a5f2

Please sign in to comment.