diff --git a/common.yaml b/common.yaml index 77d4073..a4b034c 100644 --- a/common.yaml +++ b/common.yaml @@ -15,4 +15,4 @@ spec: targetRevision: HEAD directory: recurse: true - include: "{*.argoapp.yaml,*.argoapp.yml}" + include: "{*.argoapp.yaml,*.argoapp.yml}" \ No newline at end of file diff --git a/common/cert-manager/cert-manager.argoapp.yaml b/common/cert-manager/cert-manager.argoapp.yaml index a668c94..f3d80b6 100644 --- a/common/cert-manager/cert-manager.argoapp.yaml +++ b/common/cert-manager/cert-manager.argoapp.yaml @@ -1,30 +1,41 @@ apiVersion: argoproj.io/v1alpha1 -kind: Application +kind: ApplicationSet metadata: name: cert-manager namespace: argocd spec: - destination: - namespace: cert-manager - server: https://kubernetes.default.svc - project: default - sources: - - chart: cert-manager - helm: - valueFiles: - - $values/common/cert-manager/helm/cert-manager-values.yaml - parameters: - - name: installCRDs # Not recommended for prod installs according to: https://cert-manager.io/docs/installation/helm/ - value: "true" - repoURL: https://charts.jetstack.io - targetRevision: v1.16.1 - - repoURL: 'https://github.com/ClubCedille/k8s-base.git' - targetRevision: master - ref: values - - repoURL: 'https://github.com/ClubCedille/k8s-base.git' - targetRevision: master - path: common/cert-manager/issuers - syncPolicy: - automated: {} - syncOptions: - - CreateNamespace=true + goTemplate: true + goTemplateOptions: ["missingkey=error"] + generators: + - clusters: {} + template: + metadata: + name: "{{.name}}-cert-manager" + namespace: argocd + annotations: + argocd.argoproj.io/sync-wave: "-70" + spec: + destination: + namespace: cert-manager + server: "{{.server}}" + project: "{{.name}}" + sources: + - chart: cert-manager + helm: + valueFiles: + - $values/common/cert-manager/helm/cert-manager-values.yaml + parameters: + - name: installCRDs # Not recommended for prod installs according to: https://cert-manager.io/docs/installation/helm/ + value: "true" + repoURL: https://charts.jetstack.io + targetRevision: v1.16.1 + - repoURL: 'https://github.com/ClubCedille/k8s-base.git' + targetRevision: master + ref: values + - repoURL: 'https://github.com/ClubCedille/k8s-base.git' + targetRevision: master + path: common/cert-manager/issuers + syncPolicy: + automated: {} + syncOptions: + - CreateNamespace=true diff --git a/common/contour/contour.argoapp.yaml b/common/contour/contour.argoapp.yaml index d4262e1..76b684e 100644 --- a/common/contour/contour.argoapp.yaml +++ b/common/contour/contour.argoapp.yaml @@ -1,22 +1,33 @@ apiVersion: argoproj.io/v1alpha1 -kind: Application +kind: ApplicationSet metadata: name: contour namespace: argocd spec: - destination: - namespace: project-contour - server: https://kubernetes.default.svc - project: default - sources: - - chart: contour - helm: - parameters: - - name: envoy.service.type - value: "LoadBalancer" - repoURL: https://charts.bitnami.com/bitnami - targetRevision: 19.3.1 - syncPolicy: - automated: {} - syncOptions: - - CreateNamespace=true + goTemplate: true + goTemplateOptions: ["missingkey=error"] + generators: + - clusters: {} + template: + metadata: + name: "{{.name}}-contour" + namespace: argocd + annotations: + argocd.argoproj.io/sync-wave: "-70" + spec: + destination: + namespace: project-contour + server: "{{.server}}" + project: "{{.name}}" + sources: + - chart: contour + helm: + parameters: + - name: envoy.service.type + value: "LoadBalancer" + repoURL: https://charts.bitnami.com/bitnami + targetRevision: 19.3.1 + syncPolicy: + automated: {} + syncOptions: + - CreateNamespace=true diff --git a/common/external-ip/external-ip.argoapp.yaml b/common/external-ip/external-ip.argoapp.yaml new file mode 100644 index 0000000..1d92005 --- /dev/null +++ b/common/external-ip/external-ip.argoapp.yaml @@ -0,0 +1,36 @@ +apiVersion: argoproj.io/v1alpha1 +kind: ApplicationSet +metadata: + name: external-ips + namespace: argocd +spec: + goTemplate: true + goTemplateOptions: ["missingkey=error"] + generators: + - clusters: + selector: + matchLabels: + etsmtl.club/external-network: "true" + template: + metadata: + name: '{{.name}}-external-ip' + annotations: + argocd.argoproj.io/sync-wave: "-80" + spec: + project: "{{.name}}" + source: + repoURL: https://github.com/ClubCedille/k8s-management/ + targetRevision: HEAD + path: common/external-ip + destination: + server: {{.server}} + namespace: metallb-system + kustomize: + patches: + patch: |- + - op: add + path: /spec/addresses/0 + value: + ip: {{ index .metadata.annotations "etsmtl.club/external-ip" }} + target: + kind: IPAddressPool \ No newline at end of file diff --git a/common/external-ip/ip-reservation.yaml b/common/external-ip/ip-reservation.yaml new file mode 100644 index 0000000..47250ed --- /dev/null +++ b/common/external-ip/ip-reservation.yaml @@ -0,0 +1,19 @@ +apiVersion: metallb.io/v1beta1 +kind: IPAddressPool +metadata: + name: public-ip + namespace: metallb-system +spec: + addresses: [] +--- +apiVersion: metallb.io/v1beta1 +kind: L2Advertisement +metadata: + name: public-ip + namespace: metallb-system +spec: + ipAddressPools: + - public-ip + nodeSelectors: + - matchLabels: + etsmtl.club/external-network: "true" diff --git a/common/external-ip/kustomization.yaml b/common/external-ip/kustomization.yaml new file mode 100644 index 0000000..889ce67 --- /dev/null +++ b/common/external-ip/kustomization.yaml @@ -0,0 +1,3 @@ +resources: + - routes-daemonset.yaml + - ip-reservation.yaml \ No newline at end of file diff --git a/common/metallb/routes-daemonset.yaml b/common/external-ip/routes-daemonset.yaml similarity index 100% rename from common/metallb/routes-daemonset.yaml rename to common/external-ip/routes-daemonset.yaml diff --git a/common/metallb/kustomization.yaml b/common/metallb/kustomization.yaml index a4ecac8..fede3c5 100644 --- a/common/metallb/kustomization.yaml +++ b/common/metallb/kustomization.yaml @@ -2,7 +2,6 @@ namespace: metallb-system resources: - https://github.com/metallb/metallb//config/native?ref=v0.14.8 - - routes-daemonset.yaml patches: # add pod security labels to ns diff --git a/common/metallb/metallb.argoapp.yaml b/common/metallb/metallb.argoapp.yaml index 1a44fab..0ebe317 100644 --- a/common/metallb/metallb.argoapp.yaml +++ b/common/metallb/metallb.argoapp.yaml @@ -1,15 +1,24 @@ apiVersion: argoproj.io/v1alpha1 -kind: Application +kind: ApplicationSet metadata: name: metallb namespace: argocd - annotations: - argocd.argoproj.io/sync-wave: "-90" spec: - project: default - destination: - server: https://kubernetes.default.svc - source: - repoURL: https://github.com/ClubCedille/k8s-base - path: common/metallb - targetRevision: HEAD \ No newline at end of file + goTemplate: true + goTemplateOptions: ["missingkey=error"] + generators: + - clusters: {} + template: + metadata: + name: "{{.name}}-metallb" + namespace: argocd + annotations: + argocd.argoproj.io/sync-wave: "-90" + spec: + project: "{{.name}}" + destination: + server: "{{.server}}" + source: + repoURL: https://github.com/ClubCedille/k8s-base + path: common/metallb + targetRevision: HEAD \ No newline at end of file diff --git a/common/rook/rook.argoapp.yaml b/common/rook/rook.argoapp.yaml index 9f7b232..283adb2 100644 --- a/common/rook/rook.argoapp.yaml +++ b/common/rook/rook.argoapp.yaml @@ -1,18 +1,27 @@ apiVersion: argoproj.io/v1alpha1 -kind: Application +kind: ApplicationSet metadata: - name: rook + name: metallb namespace: argocd spec: - destination: - namespace: rook - server: https://kubernetes.default.svc - project: default - source: - repoURL: https://github.com/ClubCedille/k8s-base - path: common/rook/ressources - targetRevision: HEAD - syncPolicy: - automated: {} - syncOptions: - - CreateNamespace=true + goTemplate: true + goTemplateOptions: ["missingkey=error"] + generators: + - clusters: {} + template: + metadata: + name: "{{.name}}-rook" + namespace: argocd + spec: + destination: + namespace: rook + server: "{{.server}}" + project: "{{.name}}" + source: + repoURL: https://github.com/ClubCedille/k8s-base + path: common/rook/ressources + targetRevision: HEAD + syncPolicy: + automated: {} + syncOptions: + - CreateNamespace=true