Skip to content

Commit

Permalink
Fix flux2-sync chart
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
  • Loading branch information
stefanprodan committed Nov 26, 2021
1 parent 42bff0a commit 0e19ad4
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 53 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/e2e.yaml → .github/workflows/e2e-sync.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: e2e
name: e2e-sync

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

Expand All @@ -24,7 +25,7 @@ jobs:
version: 3.7.1
- name: Install
run: |
helm upgrade --install flux2 ./charts/flux2 \
helm upgrade --install --debug flux2 ./charts/flux2 \
--namespace=flux-system \
--create-namespace \
--wait \
Expand All @@ -34,18 +35,18 @@ jobs:
flux check --namespace flux-system
- name: Sync
run: |
helm upgrade --install podinfo ./charts/flux2-sync \
helm upgrade --install --debug podinfo ./charts/flux2-sync \
--namespace=podinfo \
--create-namespace \
--set gitRepository.metadata.name=podinfo \
--set gitRepository.spec.url=https://github.com/stefanprodan/podinfo.git \
--set gitRepository.spec.ref.branch=master \
--set kustomization.spec.path=kustomize \
--set kustomization.spec.wait=true
--set kustomization.spec.targetNamespace=podinfo \
--set kustomization.spec.wait=true \
--set kustomization.spec.timeout=2m \
- name: Check sync
run: |
flux reconcile source git podinfo --namespace podinfo
flux get source git podinfo --namespace podinfo
flux get kustomization podinfo --namespace podinfo
flux reconcile kustomization podinfo --with-source --namespace podinfo
- name: Debug failure
if: failure()
run: |
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,3 @@ jobs:

- 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
2 changes: 1 addition & 1 deletion charts/flux2-sync/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: flux2-sync
version: "0.1.1"
version: "0.2.0"

description: A Helm chart for flux2 GitRepository to sync with
sources:
Expand Down
13 changes: 5 additions & 8 deletions charts/flux2-sync/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# flux2-sync

![Version: 0.1.1](https://img.shields.io/badge/Version-0.1.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.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

Expand All @@ -12,8 +12,6 @@ A Helm chart for flux2 GitRepository to sync with

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| gitRepository.metadata.labels | object | `{}` | |
| gitRepository.metadata.name | string | `"demo-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 |
Expand All @@ -23,11 +21,11 @@ A Helm chart for flux2 GitRepository to sync with
| 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 | `"https://github.com/fluxcd/flux2-kustomize-helm-example.git"` | The repository URL, can be a HTTP/S or SSH address. |
| 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.force | bool | `false` | (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. |
Expand All @@ -38,11 +36,10 @@ A Helm chart for flux2 GitRepository to sync with
| 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 | `{"kind":"GitRepository","name":"demo-gitrepository"}` | 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.suspend | bool | `false` | (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. |
| kustomization.spec.wait | bool | `false` | (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)
12 changes: 5 additions & 7 deletions charts/flux2-sync/templates/gitrepository.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ 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 }}
app.kubernetes.io/instance: {{ .Release.Name }}
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
spec:
url: {{ .Values.gitRepository.spec.url }}
Expand All @@ -18,8 +16,8 @@ spec:
{{- if .Values.gitRepository.spec.timeout }}
timeout: {{ .Values.gitRepository.spec.timeout }}
{{- end }}
{{- if .Values.gitRepository.spec.ref }}
ref: {{ .Values.gitRepository.spec.ref }}
{{- with .Values.gitRepository.spec.ref }}
ref: {{ toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.gitRepository.spec.verify }}
verify: {{ toYaml . | nindent 4 }}
Expand All @@ -36,6 +34,6 @@ spec:
{{- if .Values.gitRepository.spec.recurseSubmodules }}
recurseSubmodules: {{ .Values.gitRepository.spec.recurseSubmodules }}
{{- end }}
{{- with .Values.gitRepository.spec.decryincludeption }}
{{- with .Values.gitRepository.spec.include }}
include: {{ toYaml . | nindent 4 }}
{{- end }}
12 changes: 4 additions & 8 deletions charts/flux2-sync/templates/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ 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 }}
app.kubernetes.io/instance: {{ .Release.Name }}
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
spec:
{{- with .Values.kustomization.spec.dependsOn }}
Expand All @@ -18,14 +17,11 @@ spec:
retryInterval: {{ .Values.kustomization.spec.retryInterval }}
{{- end }}
{{- if .Values.kustomization.spec.kubeConfig }}
kubeConfig: {{ .Values.kustomization.spec.kubeConfig }}
kubeConfig: {{ toYaml . | nindent 4 }}
{{- 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 }}
Expand All @@ -44,7 +40,7 @@ spec:
{{- end }}
sourceRef:
kind: GitRepository
name: {{ .Values.gitRepository.metadata.name }}
name: {{ .Release.Name }}
{{- if .Values.kustomization.spec.suspend }}
suspend: {{ .Values.kustomization.spec.suspend }}
{{- end }}
Expand Down
23 changes: 8 additions & 15 deletions charts/flux2-sync/values.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
gitRepository:
metadata:
labels: {}
name: "demo-gitrepository"
spec:
# -- The repository URL, can be a HTTP/S or SSH address.
url: "https://github.com/fluxcd/flux2-kustomize-helm-example.git"
# -- The repository URL, can be an 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: {}
Expand All @@ -16,7 +13,8 @@ gitRepository:
timeout: ""

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

# -- (Optional) Verify OpenPGP signature for the Git commit HEAD points to.
verify: {}
Expand All @@ -31,7 +29,7 @@ gitRepository:
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: ""
recurseSubmodules: false

# -- (Optional) Extra git repositories to map into the repository
include: []
Expand All @@ -52,7 +50,7 @@ kustomization:
retryInterval: ""

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

# -- (Optional) Path to the directory containing the kustomization.yaml
# file, or the set of plain YAMLs a kustomization.yaml should
Expand All @@ -78,11 +76,6 @@ kustomization:
# -- (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:
kind: GitRepository
name: demo-gitrepository

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

Expand All @@ -93,7 +86,7 @@ kustomization:
timeout: ""

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

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

0 comments on commit 0e19ad4

Please sign in to comment.