From e60f35a6ae75d9f0eef8f3494422330a30ebe313 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Sat, 18 Feb 2023 18:23:01 +0100 Subject: [PATCH] first commit --- .drone.yml | 25 +++++++++++++ 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 | 20 +++++++++++ releases.yaml | 40 +++++++++++++++++++++ repositories.yaml | 6 ++++ 10 files changed, 151 insertions(+) create mode 100644 .drone.yml 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..98c39db --- /dev/null +++ b/.drone.yml @@ -0,0 +1,25 @@ +--- +# ---------------------------------------------- +# -- Helmfile apply changes +# ---------------------------------------------- +kind: pipeline +type: kubernetes +name: Apply helmfile changes + +trigger: + branch: + - main + event: + - push + +steps: +- name: Publish the Helm chart + image: alpine/helm + environment: + GITEA_TOKEN: + from_secret: GITEA_TOKEN + commands: + - helm plugin install https://github.com/chartmuseum/helm-push + - helm package chart -d chart-package + - helm repo add --username allanger --password $GITEA_TOKEN allanger-charts https://git.badhouseplants.net/api/packages/allanger/helm + - helm cm-push "./chart-package/$(ls chart-package)" allanger-charts 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..eba81b1 --- /dev/null +++ b/helmfile.yaml @@ -0,0 +1,20 @@ +--- +{{ readFile "releases.yaml" }} + +bases: + - environments.yaml + - repositories.yaml + +releases: + - <<: *metrics-server + installed: true + namespace: kube-system + createNamespace: false + + - <<: *openvpn + installed: false + namespace: openvpn-service + createNamespace: true + +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