Skip to content

Instantly share code, notes, and snippets.

@sadysnaat
Created December 17, 2024 20:03
Show Gist options
  • Save sadysnaat/9e750c85d0fd3524a9625c6c08d35d18 to your computer and use it in GitHub Desktop.
Save sadysnaat/9e750c85d0fd3524a9625c6c08d35d18 to your computer and use it in GitHub Desktop.
Git Ops Repo patches for Cluster API Operator Flux tutorial
diff --git a/apps/base/capi-operator/kustomization.yaml b/apps/base/capi-operator/kustomization.yaml
index bb5688c..15049ae 100644
--- a/apps/base/capi-operator/kustomization.yaml
+++ b/apps/base/capi-operator/kustomization.yaml
@@ -1,4 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- - capi-operator.yaml
\ No newline at end of file
+ - capi-operator.yaml
+ - provider.yaml
\ No newline at end of file
diff --git a/apps/base/capi-operator/provider.yaml b/apps/base/capi-operator/provider.yaml
new file mode 100644
index 0000000..d4adb9a
--- /dev/null
+++ b/apps/base/capi-operator/provider.yaml
@@ -0,0 +1,43 @@
+apiVersion: v1
+kind: Namespace
+metadata:
+ name: capi-system
+---
+apiVersion: v1
+kind: Namespace
+metadata:
+ name: capi-kubeadm-bootstrap-system
+---
+apiVersion: v1
+kind: Namespace
+metadata:
+ name: capi-kubeadm-control-plane-system
+---
+apiVersion: v1
+kind: Namespace
+metadata:
+ name: docker-infrastructure-system
+---
+apiVersion: operator.cluster.x-k8s.io/v1alpha2
+kind: BootstrapProvider
+metadata:
+ name: kubeadm
+ namespace: capi-kubeadm-bootstrap-system
+---
+apiVersion: operator.cluster.x-k8s.io/v1alpha2
+kind: ControlPlaneProvider
+metadata:
+ name: kubeadm
+ namespace: capi-kubeadm-control-plane-system
+---
+apiVersion: operator.cluster.x-k8s.io/v1alpha2
+kind: CoreProvider
+metadata:
+ name: cluster-api
+ namespace: capi-system
+---
+apiVersion: operator.cluster.x-k8s.io/v1alpha2
+kind: InfrastructureProvider
+metadata:
+ name: docker
+ namespace: docker-infrastructure-system
\ No newline at end of file
diff --git a/apps/base/capi-operator/capi-operator.yaml b/apps/base/capi-operator/capi-operator.yaml
new file mode 100644
index 0000000..66f4d56
--- /dev/null
+++ b/apps/base/capi-operator/capi-operator.yaml
@@ -0,0 +1,31 @@
+---
+apiVersion: helm.toolkit.fluxcd.io/v2
+kind: HelmRelease
+metadata:
+ name: capi-operator
+ namespace: flux-system
+spec:
+ chart:
+ spec:
+ chart: cluster-api-operator
+ reconcileStrategy: ChartVersion
+ sourceRef:
+ kind: HelmRepository
+ name: capi-operator
+ namespace: flux-system
+ install:
+ createNamespace: true
+ disableHooks: true
+ interval: 1m0s
+ releaseName: capi-operator
+ targetNamespace: capi-operator-system
+
+---
+apiVersion: source.toolkit.fluxcd.io/v1
+kind: HelmRepository
+metadata:
+ name: capi-operator
+ namespace: flux-system
+spec:
+ interval: 1m0s
+ url: https://kubernetes-sigs.github.io/cluster-api-operator
diff --git a/apps/base/capi-operator/kustomization.yaml b/apps/base/capi-operator/kustomization.yaml
new file mode 100644
index 0000000..bb5688c
--- /dev/null
+++ b/apps/base/capi-operator/kustomization.yaml
@@ -0,0 +1,4 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+resources:
+ - capi-operator.yaml
\ No newline at end of file
diff --git a/apps/production/kustomization.yaml b/apps/production/kustomization.yaml
new file mode 100644
index 0000000..4159b95
--- /dev/null
+++ b/apps/production/kustomization.yaml
@@ -0,0 +1,4 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+resources:
+ - ../base/capi-operator
\ No newline at end of file
diff --git a/clusters/production/apps.yaml b/clusters/production/apps.yaml
new file mode 100644
index 0000000..a6106eb
--- /dev/null
+++ b/clusters/production/apps.yaml
@@ -0,0 +1,14 @@
+apiVersion: kustomize.toolkit.fluxcd.io/v1
+kind: Kustomization
+metadata:
+ name: tenants
+ namespace: flux-system
+spec:
+ dependsOn:
+ - name: cert-manager
+ interval: 5m
+ sourceRef:
+ kind: GitRepository
+ name: flux-system
+ path: ./apps/production
+ prune: true
\ No newline at end of file
diff --git a/clusters/production/infrastructure.yaml b/clusters/production/infrastructure.yaml
new file mode 100644
index 0000000..ee3313a
--- /dev/null
+++ b/clusters/production/infrastructure.yaml
@@ -0,0 +1,14 @@
+---
+apiVersion: kustomize.toolkit.fluxcd.io/v1
+kind: Kustomization
+metadata:
+ name: cert-manager
+ namespace: flux-system
+spec:
+ interval: 10m
+ sourceRef:
+ kind: GitRepository
+ name: flux-system
+ path: ./infrastructure/cert-manager
+ prune: true
+ timeout: 5m
diff --git a/infrastructure/cert-manager/cert-manager.yaml b/infrastructure/cert-manager/cert-manager.yaml
new file mode 100644
index 0000000..83694a1
--- /dev/null
+++ b/infrastructure/cert-manager/cert-manager.yaml
@@ -0,0 +1,33 @@
+---
+apiVersion: source.toolkit.fluxcd.io/v1
+kind: HelmRepository
+metadata:
+ name: cert-manager
+ namespace: flux-system
+spec:
+ interval: 1m0s
+ url: https://charts.jetstack.io
+
+---
+apiVersion: helm.toolkit.fluxcd.io/v2
+kind: HelmRelease
+metadata:
+ name: cert-manager
+ namespace: flux-system
+spec:
+ chart:
+ spec:
+ chart: cert-manager
+ reconcileStrategy: ChartVersion
+ sourceRef:
+ kind: HelmRepository
+ name: cert-manager
+ namespace: flux-system
+ install:
+ createNamespace: true
+ interval: 1m0s
+ releaseName: cert-manager
+ targetNamespace: cert-manager
+ values:
+ crds:
+ enabled: true
\ No newline at end of file
diff --git a/infrastructure/cert-manager/kustomization.yaml b/infrastructure/cert-manager/kustomization.yaml
new file mode 100644
index 0000000..859702d
--- /dev/null
+++ b/infrastructure/cert-manager/kustomization.yaml
@@ -0,0 +1,4 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+resources:
+ - cert-manager.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment