blob: 6590351845d02e49416899c991ab631e791f9a1c [file] [log] [blame]
Mohammed Naser5826c0b2023-01-26 19:10:54 +00001# Copyright (c) 2022 VEXXHOST, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15- name: Uninstall the legacy HelmRelease
16 run_once: true
17 block:
18 - name: Suspend the existing HelmRelease
Mohammed Naserf0314a82023-04-11 18:53:30 +000019 failed_when: false
Mohammed Naser5826c0b2023-01-26 19:10:54 +000020 kubernetes.core.k8s:
21 state: patched
22 api_version: helm.toolkit.fluxcd.io/v2beta1
23 kind: HelmRelease
24 name: "{{ memcached_helm_release_name }}"
25 namespace: "{{ memcached_helm_release_namespace }}"
26 definition:
27 spec:
28 suspend: true
29
30 - name: Remove the existing HelmRelease
Mohammed Naserf0314a82023-04-11 18:53:30 +000031 failed_when: false
Mohammed Naser5826c0b2023-01-26 19:10:54 +000032 kubernetes.core.k8s:
33 state: absent
34 api_version: helm.toolkit.fluxcd.io/v2beta1
35 kind: HelmRelease
36 name: "{{ memcached_helm_release_name }}"
37 namespace: "{{ memcached_helm_release_namespace }}"
38
39- name: Deploy Helm chart
40 run_once: true
41 kubernetes.core.helm:
42 name: "{{ memcached_helm_release_name }}"
43 chart_ref: "{{ memcached_helm_chart_ref }}"
44 release_namespace: "{{ memcached_helm_release_namespace }}"
45 create_namespace: true
46 kubeconfig: /etc/kubernetes/admin.conf
47 values: "{{ _memcached_helm_values | combine(memcached_helm_values, recursive=True) }}"
48
49- name: Apply manifests for monitoring
50 run_once: true
51 kubernetes.core.k8s:
52 state: present
53 definition:
54 - apiVersion: v1
55 kind: Service
56 metadata:
57 name: "{{ memcached_helm_release_name }}-metrics"
58 namespace: "{{ memcached_helm_release_namespace }}"
59 labels:
60 application: memcached
61 component: server
62 spec:
63 ports:
64 - name: metrics
65 protocol: TCP
66 port: 9150
67 targetPort: 9150
68 selector:
69 application: memcached
70 component: server