blob: 6d52b2a087da2aaaae48ebf21c46b8643242183e [file] [log] [blame]
Jack Lucasd41dbdb2021-02-16 11:07:28 -05001{{/*
2#============LICENSE_START========================================================
3# ================================================================================
4# Copyright (c) 2021 J. F. Lucas. All rights reserved.
5# ================================================================================
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17# ============LICENSE_END=========================================================
18*/}}
19{{/*
20dcaegen2-services-common.consulDeleteJob:
21This template generates a Kubernetes Job that runs when a
22DCAE microservice is deleted. The Job deletes the Consul
23entry that contains the microservice's configuration.
24
25The template expects the full chart context as input. A chart for a
26DCAE microservice references this template using:
27{{ include "dcaegen2-services-common.consulDeleteJob" . }}
28The template directly references data in .Values, and indirectly (through its
29use of templates from the ONAP "common" collection) references data in
30.Release.
31
32The microservice configuration data is loaded into Consul by an
33initContainer that is part of the Kubernetes Deployment for the microservice.
34See the documentation for dcaegen2-services-common.microserviceDeployment
35for more information.
36*/}}
37{{- define "dcaegen2-services-common.consulDeleteJob" -}}
38apiVersion: batch/v1
39kind: Job
40metadata:
41 name: {{ include "common.fullname" . }}-delete-config
42 namespace: {{ include "common.namespace" . }}
43 labels: {{ include "common.labels" . | nindent 4 }}
44 annotations:
45 "helm.sh/hook": pre-delete
46 "helm.sh/hook-delete-policy": hook-succeeded,hook-failed
47spec:
48 template:
49 metadata:
50 name: {{ include "common.fullname" . }}-delete-config
51 labels: {{ include "common.labels" . | nindent 8 }}
52 spec:
53 restartPolicy: Never
54 containers:
55 - name: dcae-config-delete
56 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.consulLoaderImage }}
57 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
58 args:
59 - --delete-key
60 - {{ include "common.name" . }}
61{{ end -}}