From 285aa6e594b4c5d5af946a39ce2a6dfaf62f857d Mon Sep 17 00:00:00 2001 From: auricom Date: Tue, 27 Apr 2021 22:51:22 +0200 Subject: [PATCH] feat: migrate k8s-gateway to helm-chart --- .../networking/k8s-gateway/deployment.yaml | 126 ------------------ .../networking/k8s-gateway/helm-release.yaml | 25 ++++ .../networking/k8s-gateway/kustomization.yaml | 2 +- .../charts/k8s-gateway-charts.yaml | 16 +++ cluster/base-custom/charts/kustomization.yaml | 1 + 5 files changed, 43 insertions(+), 127 deletions(-) delete mode 100644 cluster/apps/networking/k8s-gateway/deployment.yaml create mode 100644 cluster/apps/networking/k8s-gateway/helm-release.yaml create mode 100644 cluster/base-custom/charts/k8s-gateway-charts.yaml diff --git a/cluster/apps/networking/k8s-gateway/deployment.yaml b/cluster/apps/networking/k8s-gateway/deployment.yaml deleted file mode 100644 index 837e463b2..000000000 --- a/cluster/apps/networking/k8s-gateway/deployment.yaml +++ /dev/null @@ -1,126 +0,0 @@ -# see: https://github.com/ori-edge/k8s_gateway/blob/master/examples/install-clusterwide.yml ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: excoredns - namespace: networking ---- -# Source: coredns/templates/configmap.yaml -apiVersion: v1 -kind: ConfigMap -metadata: - name: excoredns - namespace: networking -data: - Corefile: |- - .:53 { - errors - log - ready - k8s_gateway ${SECRET_CLUSTER_DOMAIN} - { - resources Ingress Service - ttl 10 - apex dns1 - } - forward . /etc/resolv.conf - cache 30 - loop - reload - loadbalance - } ---- -# Source: coredns/templates/clusterrole.yaml -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: excoredns -rules: - - apiGroups: - - "" - resources: - - services - - namespaces - verbs: - - list - - watch - - apiGroups: - - extensions - - networking.k8s.io - resources: - - ingresses - verbs: - - list - - watch ---- -# Source: coredns/templates/clusterrolebinding.yaml -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: excoredns -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: excoredns -subjects: - - kind: ServiceAccount - name: excoredns - namespace: networking ---- -apiVersion: v1 -kind: Service -metadata: - name: external-dns - namespace: networking -spec: - selector: - k8s-app: "excoredns" - ports: - - name: udp-53 - port: 53 - protocol: UDP - type: LoadBalancer - externalIPs: - - ${CLUSTER_LB_K8SGATEWAY} - externalTrafficPolicy: Local ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: excoredns - namespace: networking -spec: - replicas: 1 - selector: - matchLabels: - k8s-app: "excoredns" - template: - metadata: - labels: - k8s-app: "excoredns" - spec: - serviceAccountName: excoredns - dnsPolicy: ClusterFirst - containers: - - name: "coredns" - image: "quay.io/oriedge/k8s_gateway:v0.1.4" - imagePullPolicy: IfNotPresent - args: ["-conf", "/etc/coredns/Corefile"] - volumeMounts: - - name: config-volume - mountPath: /etc/coredns - resources: - requests: - cpu: 100m - memory: 128Mi - ports: - - { containerPort: 53, protocol: UDP, name: udp-53 } - - { containerPort: 53, protocol: TCP, name: tcp-53 } - volumes: - - name: config-volume - configMap: - name: excoredns - items: - - key: Corefile - path: Corefile diff --git a/cluster/apps/networking/k8s-gateway/helm-release.yaml b/cluster/apps/networking/k8s-gateway/helm-release.yaml new file mode 100644 index 000000000..fa482a571 --- /dev/null +++ b/cluster/apps/networking/k8s-gateway/helm-release.yaml @@ -0,0 +1,25 @@ +--- +apiVersion: helm.toolkit.fluxcd.io/v2beta1 +kind: HelmRelease +metadata: + name: k8s-gateway + namespace: networking +spec: + interval: 5m + chart: + spec: + # renovate: registryUrl=https://github.com/ori-edge/k8s_gateway + chart: ./charts/k8s-gateway + version: 1.0.2 + sourceRef: + kind: GitRepository + name: k8s-gateway-charts + namespace: flux-system + interval: 5m + values: + domain: "${SECRET_CLUSTER_DOMAIN}" + service: + type: LoadBalancer + externalIPs: + - ${CLUSTER_LB_K8SGATEWAY} + externalTrafficPolicy: Local diff --git a/cluster/apps/networking/k8s-gateway/kustomization.yaml b/cluster/apps/networking/k8s-gateway/kustomization.yaml index 9c2d28b0c..34a8531ce 100644 --- a/cluster/apps/networking/k8s-gateway/kustomization.yaml +++ b/cluster/apps/networking/k8s-gateway/kustomization.yaml @@ -1,4 +1,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - - deployment.yaml + - helm-release.yaml diff --git a/cluster/base-custom/charts/k8s-gateway-charts.yaml b/cluster/base-custom/charts/k8s-gateway-charts.yaml new file mode 100644 index 000000000..5341962f7 --- /dev/null +++ b/cluster/base-custom/charts/k8s-gateway-charts.yaml @@ -0,0 +1,16 @@ +--- +apiVersion: source.toolkit.fluxcd.io/v1beta1 +kind: GitRepository +metadata: + name: k8s-gateway-charts + namespace: flux-system +spec: + interval: 1440m + url: https://github.com/ori-edge/k8s_gateway + ref: + branch: master + ignore: | + # exclude all + /* + # include charts directory + !/charts/ diff --git a/cluster/base-custom/charts/kustomization.yaml b/cluster/base-custom/charts/kustomization.yaml index bad039583..4687c2baa 100644 --- a/cluster/base-custom/charts/kustomization.yaml +++ b/cluster/base-custom/charts/kustomization.yaml @@ -14,6 +14,7 @@ resources: - ingress-nginx-charts.yaml - jetstack-charts.yaml - k8s-at-home.yaml + - k8s-gateway-charts.yaml - kasten-charts.yaml - kubernetes-dashboard-charts.yaml - kubernetes-sigs-descheduler-charts.yaml