blob: d941a9813451faee03758bbd577a26901a10b426 [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
19 kubernetes.core.k8s:
20 state: patched
21 api_version: helm.toolkit.fluxcd.io/v2beta1
22 kind: HelmRelease
23 name: "{{ memcached_helm_release_name }}"
24 namespace: "{{ memcached_helm_release_namespace }}"
25 definition:
26 spec:
27 suspend: true
28
29 - name: Remove the existing HelmRelease
30 kubernetes.core.k8s:
31 state: absent
32 api_version: helm.toolkit.fluxcd.io/v2beta1
33 kind: HelmRelease
34 name: "{{ memcached_helm_release_name }}"
35 namespace: "{{ memcached_helm_release_namespace }}"
36
37- name: Deploy Helm chart
38 run_once: true
39 kubernetes.core.helm:
40 name: "{{ memcached_helm_release_name }}"
41 chart_ref: "{{ memcached_helm_chart_ref }}"
42 release_namespace: "{{ memcached_helm_release_namespace }}"
43 create_namespace: true
44 kubeconfig: /etc/kubernetes/admin.conf
45 values: "{{ _memcached_helm_values | combine(memcached_helm_values, recursive=True) }}"
46
47- name: Apply manifests for monitoring
48 run_once: true
49 kubernetes.core.k8s:
50 state: present
51 definition:
52 - apiVersion: v1
53 kind: Service
54 metadata:
55 name: "{{ memcached_helm_release_name }}-metrics"
56 namespace: "{{ memcached_helm_release_namespace }}"
57 labels:
58 application: memcached
59 component: server
60 spec:
61 ports:
62 - name: metrics
63 protocol: TCP
64 port: 9150
65 targetPort: 9150
66 selector:
67 application: memcached
68 component: server