Skip to content

Commit aa7e877

Browse files
authored
refactor: Refactoring the templates (#2)
* Refactored FluxCD resources and configuration for Git repository and Kustomization * removed kind and usage platformservice as they are no templates * refactored openmcp template * chore: add YAML document separators to multiple files * chore: update version to v0.0.4
1 parent 558d855 commit aa7e877

23 files changed

+130
-181
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
**/config/*

Taskfile.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ tasks:
8383
- |
8484
flux install --export \
8585
--components-extra="image-reflector-controller,image-automation-controller" \
86-
> gotk-components.yaml
87-
dir: ./templates/fluxcd/resources
86+
> components.yaml
87+
dir: ./templates/fluxcd/templates/resources
8888

8989
pull:
9090
desc: Pulls the resources from the gitops-template ocm.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.0.3-dev
1+
v0.0.4

docs/Templating.md

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,51 @@ platformClusterKubeconfigSecretName: "platform-kubeconfig"
2626
resources files:
2727

2828
```yaml
29+
# The information for the git repo
2930
git:
30-
repoUrl: "" # The url to the github gitops repository
31-
mainBranch: "" # The main branch of the gitops repository (most of the time, set it to 'main')
31+
repoUrl: ""
32+
mainBranch: ""
33+
34+
# Image pull secrets to be added to all deployments
35+
imagePullSecrets: []
36+
# - name: my-registry-secret
37+
38+
# Image replacement variables
39+
# You can either specify a prefix which is put in front of xxx-controller or directly specify the images
40+
images:
41+
prefix: "ghcr.io/openmcp-project/fluxcd"
42+
sourceController:
43+
image: "ghcr.io/fluxcd/source-controller"
44+
tag: "latest" # optional
45+
digest: "" # optional
46+
notificationController:
47+
image: "ghcr.io/fluxcd/notification-controller"
48+
kustomizeController:
49+
image: "ghcr.io/fluxcd/kustomize-controller"
50+
helmController:
51+
image: "ghcr.io/fluxcd/helm-controller"
52+
imageReflectorController:
53+
image: "ghcr.io/fluxcd/image-reflector-controller"
54+
imageAutomationController:
55+
image: "ghcr.io/fluxcd/image-automation-controller"
3256
```
3357
3458
When rendering the `overlays` files, the following values are used:
3559

3660
```yaml
37-
fluxCDResourcesPath: "" # The path were the fluxcd resources are lying relative to the overlays
38-
gitRepoEnvBranch: "" # The branch for this environment to look at
39-
envPathFluxSystem: "" # The path were the env overlays are located at from the root of the git repo
61+
# Path from the overlays folder to the resources folder of fluxcd (e.g. ../../../resources/fluxcd)
62+
fluxCDResourcesPath: ""
63+
# Path to the env fluxCD folder (e.g. envs/%ENV%/fluxcd)
64+
fluxCDEnvPath: ""
65+
# branch of the env (e.g. dev)
66+
gitRepoEnvBranch: ""
4067
```
4168

4269
### OpenMCP
4370

4471
```yaml
45-
openMCPResourcesPath: "" # The path were the fluxcd resources are lying relative to the overlays
72+
openMCPResourcesPath: "" # The path were the fluxcd resources are lying relative to the overlays (e.g. ../../../resources/openmcp)
4673
openMCPOperator:
4774
image: "" # the image of the openmcp operator to use
4875
tag: "" # the tag of the image of the openmcp operator you want to use for deployment
49-
50-
onboardingClusterKubeconfigSecretName: "" # the secret name for the onboarding cluster; must be located in the openmcp-system namespace
51-
platformClusterKubeconfigSecretName: "" # the secret name for the platform cluster; must be located in the openmcp-system namespace
5276
```

templates/fluxcd/templates/overlays/gotk-sync-kustomization.yaml renamed to templates/fluxcd/templates/overlays/flux-kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ metadata:
55
name: flux-system
66
namespace: flux-system
77
spec:
8-
path: {{ .Values.envPathFluxSystem }}
8+
path: {{ .Values.fluxCDEnvPath }}
File renamed without changes.

templates/fluxcd/templates/overlays/kustomization.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ kind: Kustomization
33
resources:
44
- {{ .Values.fluxCDResourcesPath }}
55
patches:
6-
- path: gotk-sync-gitrepo.yaml
7-
- path: gotk-sync-kustomization.yaml
6+
- path: gitrepo.yaml
7+
- path: flux-kustomization.yaml

templates/fluxcd/templates/resources/gotk-components.yaml renamed to templates/fluxcd/templates/resources/components.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5344,8 +5344,6 @@ spec:
53445344
name: data
53455345
- mountPath: /tmp
53465346
name: tmp
5347-
imagePullSecrets:
5348-
- name: \{\{ .Values.imagePullSecret }}
53495347
nodeSelector:
53505348
kubernetes.io/os: linux
53515349
priorityClassName: system-cluster-critical
@@ -7242,8 +7240,6 @@ spec:
72427240
volumeMounts:
72437241
- mountPath: /tmp
72447242
name: temp
7245-
imagePullSecrets:
7246-
- name: \{\{ .Values.imagePullSecret }}
72477243
nodeSelector:
72487244
kubernetes.io/os: linux
72497245
priorityClassName: system-cluster-critical
@@ -11046,8 +11042,6 @@ spec:
1104611042
volumeMounts:
1104711043
- mountPath: /tmp
1104811044
name: temp
11049-
imagePullSecrets:
11050-
- name: \{\{ .Values.imagePullSecret }}
1105111045
nodeSelector:
1105211046
kubernetes.io/os: linux
1105311047
priorityClassName: system-cluster-critical
@@ -13027,8 +13021,6 @@ spec:
1302713021
volumeMounts:
1302813022
- mountPath: /tmp
1302913023
name: temp
13030-
imagePullSecrets:
13031-
- name: \{\{ .Values.imagePullSecret }}
1303213024
nodeSelector:
1303313025
kubernetes.io/os: linux
1303413026
securityContext:
@@ -14139,8 +14131,6 @@ spec:
1413914131
name: temp
1414014132
- mountPath: /data
1414114133
name: data
14142-
imagePullSecrets:
14143-
- name: \{\{ .Values.imagePullSecret }}
1414414134
nodeSelector:
1414514135
kubernetes.io/os: linux
1414614136
securityContext:
@@ -14974,8 +14964,6 @@ spec:
1497414964
volumeMounts:
1497514965
- mountPath: /tmp
1497614966
name: temp
14977-
imagePullSecrets:
14978-
- name: \{\{ .Values.imagePullSecret }}
1497914967
nodeSelector:
1498014968
kubernetes.io/os: linux
1498114969
securityContext:

templates/fluxcd/templates/resources/gotk-sync.yaml renamed to templates/fluxcd/templates/resources/flux-kustomization.yaml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
---
2-
apiVersion: source.toolkit.fluxcd.io/v1
3-
kind: GitRepository
4-
metadata:
5-
name: environments
6-
namespace: flux-system
7-
spec:
8-
interval: 5m
9-
url: {{ .Values.git.repoUrl }}
10-
ref:
11-
branch: {{ .Values.git.mainBranch }}
12-
secretRef:
13-
name: git
14-
---
151
apiVersion: kustomize.toolkit.fluxcd.io/v1
162
kind: Kustomization
173
metadata:
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
apiVersion: source.toolkit.fluxcd.io/v1
3+
kind: GitRepository
4+
metadata:
5+
name: environments
6+
namespace: flux-system
7+
spec:
8+
interval: 5m
9+
url: {{ .Values.git.repoUrl }}
10+
ref:
11+
branch: {{ .Values.git.mainBranch }}
12+
secretRef:
13+
name: git

0 commit comments

Comments
 (0)