From 1a667f001e05a895169a1094b999dda344b3f5dc Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Sat, 18 Feb 2023 17:46:04 +0000 Subject: [PATCH] Install metrics-server (#1) Reviewed-on: https://git.badhouseplants.net/badhouseplants/k8s-cluster-config/pulls/1 --- .drone.yml | 71 +++++++++++++++++++++++ README.md | 2 + badhouseplants/helmfile.yaml | 0 badhouseplants/values/values.openvpn.yaml | 8 +++ common/values.metrics-server.yaml | 4 ++ environments.yaml | 5 ++ etersoft/helmfile.yaml | 0 etersoft/values/values.openvpn.yaml | 43 ++++++++++++++ helmfile.yaml | 15 +++++ releases.yaml | 40 +++++++++++++ repositories.yaml | 6 ++ 11 files changed, 194 insertions(+) create mode 100644 .drone.yml create mode 100644 README.md create mode 100644 badhouseplants/helmfile.yaml create mode 100644 badhouseplants/values/values.openvpn.yaml create mode 100644 common/values.metrics-server.yaml create mode 100644 environments.yaml create mode 100644 etersoft/helmfile.yaml create mode 100644 etersoft/values/values.openvpn.yaml create mode 100644 helmfile.yaml create mode 100644 releases.yaml create mode 100644 repositories.yaml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..9d8add7 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,71 @@ +--- +# ---------------------------------------------- +# -- Helmfile diff changes +# ---------------------------------------------- +kind: pipeline +type: kubernetes +name: Show helmfile diffs + +trigger: + branch: + exclude: + - main + event: + - push + +steps: +- name: Diff badhouseplants + image: ghcr.io/helmfile/helmfile:canary + environment: + KUBECONFIG_CONTENT: + from_secret: KUBECONFIG_CONTENT + commands: + - mkdir $HOME/.kube + - echo $KUBECONFIG_CONTENT | base64 -d > $HOME/.kube/config + - helmfile -e badhouseplants diff + +- name: Diff eterosoft + image: ghcr.io/helmfile/helmfile:canary + environment: + KUBECONFIG_CONTENT: + from_secret: KUBECONFIG_CONTENT + commands: + - mkdir $HOME/.kube + - echo $KUBECONFIG_CONTENT | base64 -d > $HOME/.kube/config + - helmfile -e etersoft diff + +--- +# ---------------------------------------------- +# -- Helmfile apply changes +# ---------------------------------------------- +kind: pipeline +type: kubernetes +name: Apply helmfile changes + +trigger: + branch: + - main + event: + - push + +steps: +- name: Diff badhouseplants + image: ghcr.io/helmfile/helmfile:canary + environment: + KUBECONFIG_CONTENT: + from_secret: KUBECONFIG_CONTENT + commands: + - mkdir $HOME/.kube + - echo $KUBECONFIG_CONTENT | base64 -d > $HOME/.kube/config + - helmfile -e badhouseplants apply + +- name: Diff eterosoft + image: ghcr.io/helmfile/helmfile:canary + environment: + KUBECONFIG_CONTENT: + from_secret: KUBECONFIG_CONTENT + commands: + - mkdir $HOME/.kube + - echo $KUBECONFIG_CONTENT | base64 -d > $HOME/.kube/config + - helmfile -e etersoft apply + diff --git a/README.md b/README.md new file mode 100644 index 0000000..197b3f5 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# Kubernetes configuration +[![Build Status](https://drone.badhouseplants.net/api/badges/badhouseplants/k8s-cluster-config/status.svg)](https://drone.badhouseplants.net/badhouseplants/k8s-cluster-config) diff --git a/badhouseplants/helmfile.yaml b/badhouseplants/helmfile.yaml new file mode 100644 index 0000000..e69de29 diff --git a/badhouseplants/values/values.openvpn.yaml b/badhouseplants/values/values.openvpn.yaml new file mode 100644 index 0000000..5fddee6 --- /dev/null +++ b/badhouseplants/values/values.openvpn.yaml @@ -0,0 +1,8 @@ +storageClassName: longhorn +openvpn: + server: "tcp://195.201.250.50:1194" +service: + type: ClusterIP + port: 1194 + targetPort: 1194 + protocol: TCP diff --git a/common/values.metrics-server.yaml b/common/values.metrics-server.yaml new file mode 100644 index 0000000..ad6879b --- /dev/null +++ b/common/values.metrics-server.yaml @@ -0,0 +1,4 @@ +apiService: + insecureSkipTLSVerify: true +args: + - --kubelet-insecure-tls diff --git a/environments.yaml b/environments.yaml new file mode 100644 index 0000000..bbecb66 --- /dev/null +++ b/environments.yaml @@ -0,0 +1,5 @@ +environments: + badhouseplants: + kubeContext: allanger@badhouseplants-microk8s + etersoft: + kubeContext: allanger@etersoft diff --git a/etersoft/helmfile.yaml b/etersoft/helmfile.yaml new file mode 100644 index 0000000..e69de29 diff --git a/etersoft/values/values.openvpn.yaml b/etersoft/values/values.openvpn.yaml new file mode 100644 index 0000000..2b0c78d --- /dev/null +++ b/etersoft/values/values.openvpn.yaml @@ -0,0 +1,43 @@ +storageClassName: microk8s-hostpath +openvpn: + server: "tcp://91.232.225.63:1194" +service: + type: ClusterIP + port: 1194 + targetPort: 1194 + protocol: TCP +istio-resources: + enabled: true + gateways: + - metadata: + name: etersoft-vpn + namespace: istio-system + spec: + selector: + istio: ingressgateway + servers: + - hosts: + - '*' + port: + name: openvpn + number: 1194 + protocol: TCP + # virtual_services: + # - metadata: + # name: openvpn + # spec: + # hosts: + # - '*' + # gateways: + # - istio-system/etersoft-vpn + # tcp: + # - match: + # - port: 1194 + # route: + # - destination: + # host: openvpn + # port: + # number: 1194 + # + # + # diff --git a/helmfile.yaml b/helmfile.yaml new file mode 100644 index 0000000..edf0fea --- /dev/null +++ b/helmfile.yaml @@ -0,0 +1,15 @@ +--- +{{ readFile "releases.yaml" }} + +bases: + - environments.yaml + - repositories.yaml + +releases: + - <<: *metrics-server + installed: true + namespace: kube-system + createNamespace: false + +helmfiles: + - path: {{.Environment.Name }}/helmfile.yaml diff --git a/releases.yaml b/releases.yaml new file mode 100644 index 0000000..c7853df --- /dev/null +++ b/releases.yaml @@ -0,0 +1,40 @@ +--- +templates: + crd-management-hook: + hooks: + - events: ["preapply"] + showlogs: true + command: "sh" + args: + - -c + - "helm show crds {{ .Release.Chart }} --version {{ .Release.Version }}| kubectl apply -f -" + - events: ["prepare"] + showlogs: true + command: "sh" + args: + - -c + - "helm show crds {{ .Release.Chart }} --version {{ .Release.Version }} | kubectl diff -f - || true" + - events: ["postuninstall"] + showlogs: true + command: "sh" + args: + - -c + - "helm show crds {{ .Release.Chart }} --version {{ .Release.Version }} | kubectl delete -f -" + # ---------------------------- + # -- Releases + # ---------------------------- + metrics-server: &metrics-server + name: metrics-server + chart: metrics-server/metrics-server + version: 3.8.3 + values: + - common/values.{{ .Release.Name }}.yaml + inherit: + - template: crd-management-hook + + openvpn: &openvpn + name: openvpn + chart: allanger-charts/openvpn + version: 1.0.1 + values: + - "{{ .Environment.Name }}/values/values.{{ .Release.Name }}.yaml" diff --git a/repositories.yaml b/repositories.yaml new file mode 100644 index 0000000..7b5917e --- /dev/null +++ b/repositories.yaml @@ -0,0 +1,6 @@ +--- +repositories: + - name: metrics-server + url: https://kubernetes-sigs.github.io/metrics-server/ + - name: allanger-charts + url: https://allanger.github.io/allanger-charts