Revert "Revert "oran-shell-release: release image for F""
[pti/rtp.git] / meta-starlingx / meta-stx-flock / stx-monitor-armada-app / monitor-helm / 0009-add-curator-as-of-2019-10-10.patch
1 From 21cd4d9720064f89843551e7da4c1e0528b6cbf5 Mon Sep 17 00:00:00 2001
2 From: Kevin Smith <kevin.smith@windriver.com>
3 Date: Thu, 10 Oct 2019 15:43:20 -0400
4 Subject: [PATCH 1/1] add curator as of 2019-10-10
5
6 ---
7  stable/elasticsearch-curator/Chart.yaml            |  6 +--
8  stable/elasticsearch-curator/OWNERS                |  6 +--
9  stable/elasticsearch-curator/README.md             | 34 ++++++++++---
10  .../ci/initcontainer-values.yaml                   |  9 ++++
11  .../elasticsearch-curator/templates/_helpers.tpl   | 22 +++++++++
12  .../elasticsearch-curator/templates/cronjob.yaml   | 10 ++++
13  stable/elasticsearch-curator/templates/psp.yml     | 35 +++++++++++++
14  stable/elasticsearch-curator/templates/role.yaml   | 23 +++++++++
15  .../templates/rolebinding.yaml                     | 21 ++++++++
16  .../templates/serviceaccount.yaml                  | 12 +++++
17  stable/elasticsearch-curator/values.yaml           | 57 ++++++++++++++++++++--
18  11 files changed, 218 insertions(+), 17 deletions(-)
19  create mode 100644 stable/elasticsearch-curator/ci/initcontainer-values.yaml
20  create mode 100644 stable/elasticsearch-curator/templates/psp.yml
21  create mode 100644 stable/elasticsearch-curator/templates/role.yaml
22  create mode 100644 stable/elasticsearch-curator/templates/rolebinding.yaml
23  create mode 100644 stable/elasticsearch-curator/templates/serviceaccount.yaml
24
25 diff --git a/stable/elasticsearch-curator/Chart.yaml b/stable/elasticsearch-curator/Chart.yaml
26 index 24a37ce..7a8e0a7 100644
27 --- a/stable/elasticsearch-curator/Chart.yaml
28 +++ b/stable/elasticsearch-curator/Chart.yaml
29 @@ -2,7 +2,7 @@ apiVersion: v1
30  appVersion: "5.5.4"
31  description: A Helm chart for Elasticsearch Curator
32  name: elasticsearch-curator
33 -version: 1.3.2
34 +version: 2.0.2
35  home: https://github.com/elastic/curator
36  keywords:
37  - curator
38 @@ -12,7 +12,7 @@ sources:
39  - https://github.com/kubernetes/charts/elasticsearch-curator
40  - https://github.com/pires/docker-elasticsearch-curator
41  maintainers:
42 -  - name: tmestdagh
43 -    email: mestdagh.tom@gmail.com
44 +  - name: desaintmartin
45 +    email: cedric.dsm@gmail.com
46    - name: gianrubio
47      email: gianrubio@gmail.com
48 diff --git a/stable/elasticsearch-curator/OWNERS b/stable/elasticsearch-curator/OWNERS
49 index d8c0ba0..89df1c0 100644
50 --- a/stable/elasticsearch-curator/OWNERS
51 +++ b/stable/elasticsearch-curator/OWNERS
52 @@ -1,6 +1,6 @@
53  approvers:
54 -  - tmestdagh
55 +  - desaintmartin
56    - gianrubio
57  reviewers:
58 -  - tmestdagh
59 -  - gianrubio
60 \ No newline at end of file
61 +  - desaintmartin
62 +  - gianrubio
63 diff --git a/stable/elasticsearch-curator/README.md b/stable/elasticsearch-curator/README.md
64 index 0a9f311..2057b85 100644
65 --- a/stable/elasticsearch-curator/README.md
66 +++ b/stable/elasticsearch-curator/README.md
67 @@ -23,6 +23,17 @@ To install the chart, use the following:
68  $ helm install stable/elasticsearch-curator
69  ```
70  
71 +## Upgrading an existing Release to a new major version
72 +
73 +A major chart version change (like v1.2.3 -> v2.0.0) indicates that there is an
74 +incompatible breaking change needing manual actions.
75 +
76 +### To 2.0.0
77 +
78 +v2.0.0 uses docker image from `elasticsearch-curator` author, which differs in its way to install curator.
79 +
80 +If you have a hardcoded `command` value, please update it to follow the new `curator` executable path: `/curator/curator` (which is not in PATH).
81 +
82  ## Configuration
83  
84  The following table lists the configurable parameters of the docker-registry chart and
85 @@ -31,8 +42,8 @@ their default values.
86  |          Parameter                   |                         Description                         |                   Default                    |
87  | :----------------------------------- | :---------------------------------------------------------- | :------------------------------------------- |
88  | `image.pullPolicy`                   | Container pull policy                                       | `IfNotPresent`                               |
89 -| `image.repository`                   | Container image to use                                      | `quay.io/pires/docker-elasticsearch-curator` |
90 -| `image.tag`                          | Container image tag to deploy                               | `5.5.4`                                      |
91 +| `image.repository`                   | Container image to use                                      | `untergeek/curator`                          |
92 +| `image.tag`                          | Container image tag to deploy                               | `5.7.6`                                      |
93  | `hooks`                              | Whether to run job on selected hooks                        | `{ "install": false, "upgrade": false }`     |
94  | `cronjob.schedule`                   | Schedule for the CronJob                                    | `0 1 * * *`                                  |
95  | `cronjob.annotations`                | Annotations to add to the cronjob                           | {}                                           |
96 @@ -43,15 +54,22 @@ their default values.
97  | `dryrun`                             | Run Curator in dry-run mode                                 | `false`                                      |
98  | `env`                                | Environment variables to add to the cronjob container       | {}                                           |
99  | `envFromSecrets`                     | Environment variables from secrets to the cronjob container | {}                                           |
100 -| `envFromSecrets.*.from.secret`       | - `secretKeyRef.name` used for environment variable         |                                              |              
101 -| `envFromSecrets.*.from.key`          | - `secretKeyRef.key` used for environment variable          |                                              |              
102 -| `command`                            | Command to execute                                          | ["curator"]                                  |
103 -| `configMaps.action_file_yml`         | Contents of the Curator action_file.yml                     | See values.yaml                              |
104 -| `configMaps.config_yml`              | Contents of the Curator config.yml (overrides config)       | See values.yaml                              |
105 +| `envFromSecrets.*.from.secret`       | - `secretKeyRef.name` used for environment variable         |                                              |
106 +| `envFromSecrets.*.from.key`          | - `secretKeyRef.key` used for environment variable          |                                              |
107 +| `command`                            | Command to execute                                          | ["/curator/curator"]                         |
108 +| `configMaps.action_file_yml`           | Contents of the Curator action_file.yml                      | See values.yaml                              |
109 +| `configMaps.config_yml`                | Contents of the Curator config.yml (overrides config)         | See values.yaml                              |
110  | `resources`                          | Resource requests and limits                                | {}                                           |
111  | `priorityClassName`                  | priorityClassName                                           | `nil`                                        |
112  | `extraVolumeMounts`                  | Mount extra volume(s),                                      |                                              |
113  | `extraVolumes`                       | Extra volumes                                               |                                              |
114 -| `securityContext`                    | Configure PodSecurityContext                          |
115 +| `extraInitContainers`                | Init containers to add to the cronjob container             | {}                                           |
116 +| `securityContext`                    | Configure PodSecurityContext                                 | `false`                                      |
117 +| `rbac.enabled`                       | Enable RBAC resources                                       | `false`                                      |
118 +| `psp.create`                         | Create pod security policy resources                        | `false`                                      |
119 +| `serviceAccount.create`              | Create a default serviceaccount for elasticsearch curator   | `true`                                       |
120 +| `serviceAccount.name`                | Name for elasticsearch curator serviceaccount               | `""`                                         |
121 +
122 +
123  Specify each parameter using the `--set key=value[,key=value]` argument to
124  `helm install`.
125 diff --git a/stable/elasticsearch-curator/ci/initcontainer-values.yaml b/stable/elasticsearch-curator/ci/initcontainer-values.yaml
126 new file mode 100644
127 index 0000000..578becf
128 --- /dev/null
129 +++ b/stable/elasticsearch-curator/ci/initcontainer-values.yaml
130 @@ -0,0 +1,9 @@
131 +extraInitContainers:
132 +  test:
133 +    image: alpine:latest
134 +    command:
135 +    - "/bin/sh"
136 +    - "-c"
137 +    args:
138 +    - |
139 +      true
140 diff --git a/stable/elasticsearch-curator/templates/_helpers.tpl b/stable/elasticsearch-curator/templates/_helpers.tpl
141 index c786fb5..8018c5d 100644
142 --- a/stable/elasticsearch-curator/templates/_helpers.tpl
143 +++ b/stable/elasticsearch-curator/templates/_helpers.tpl
144 @@ -12,6 +12,17 @@ Return the appropriate apiVersion for cronjob APIs.
145  {{- end -}}
146  
147  {{/*
148 +Return the appropriate apiVersion for podsecuritypolicy.
149 +*/}}
150 +{{- define "podsecuritypolicy.apiVersion" -}}
151 +{{- if semverCompare "<1.10-0" .Capabilities.KubeVersion.GitVersion -}}
152 +{{- print "extensions/v1beta1" -}}
153 +{{- else -}}
154 +{{- print "policy/v1beta1" -}}
155 +{{- end -}}
156 +{{- end -}}
157 +
158 +{{/*
159  Expand the name of the chart.
160  */}}
161  {{- define "elasticsearch-curator.name" -}}
162 @@ -42,3 +53,14 @@ Create chart name and version as used by the chart label.
163  {{- define "elasticsearch-curator.chart" -}}
164  {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
165  {{- end -}}
166 +
167 +{{/*
168 +Create the name of the service account to use
169 +*/}}
170 +{{- define "elasticsearch-curator.serviceAccountName" -}}
171 +{{- if .Values.serviceAccount.create -}}
172 +    {{ default (include "elasticsearch-curator.fullname" .) .Values.serviceAccount.name }}
173 +{{- else -}}
174 +    {{ default "default" .Values.serviceAccount.name }}
175 +{{- end -}}
176 +{{- end -}}
177 diff --git a/stable/elasticsearch-curator/templates/cronjob.yaml b/stable/elasticsearch-curator/templates/cronjob.yaml
178 index d0388f4..37274f6 100644
179 --- a/stable/elasticsearch-curator/templates/cronjob.yaml
180 +++ b/stable/elasticsearch-curator/templates/cronjob.yaml
181 @@ -53,6 +53,16 @@ spec:
182            imagePullSecrets:
183              - name: {{ .Values.image.pullSecret }}
184  {{- end }}
185 +{{- if .Values.extraInitContainers }}
186 +          initContainers:
187 +{{- range $key, $value := .Values.extraInitContainers }}
188 +          - name: "{{ $key }}"
189 +{{ toYaml $value | indent 12 }}
190 +{{- end }}
191 +{{- end }}
192 +        {{- if .Values.rbac.enabled }}
193 +          serviceAccountName: {{ template "elasticsearch-curator.serviceAccountName" .}}
194 +        {{- end }}
195            containers:
196              - name: {{ .Chart.Name }}
197                image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
198 diff --git a/stable/elasticsearch-curator/templates/psp.yml b/stable/elasticsearch-curator/templates/psp.yml
199 new file mode 100644
200 index 0000000..5f62985
201 --- /dev/null
202 +++ b/stable/elasticsearch-curator/templates/psp.yml
203 @@ -0,0 +1,35 @@
204 +{{- if .Values.psp.create }}
205 +apiVersion: {{ template "podsecuritypolicy.apiVersion" . }}
206 +kind: PodSecurityPolicy
207 +metadata:
208 +  labels:
209 +    app: {{ template "elasticsearch-curator.name" . }}
210 +    chart: {{ template "elasticsearch-curator.chart" . }}
211 +    release: {{ .Release.Name }}
212 +    heritage: {{ .Release.Service }}
213 +  name: {{ template "elasticsearch-curator.fullname" . }}-psp
214 +spec:
215 +  privileged: true
216 +  #requiredDropCapabilities:
217 +  volumes:
218 +    - 'configMap'
219 +    - 'secret'
220 +  hostNetwork: false
221 +  hostIPC: false
222 +  hostPID: false
223 +  runAsUser:
224 +    rule: 'RunAsAny'
225 +  seLinux:
226 +    rule: 'RunAsAny'
227 +  supplementalGroups:
228 +    rule: 'MustRunAs'
229 +    ranges:
230 +      - min: 1
231 +        max: 65535
232 +  fsGroup:
233 +    rule: 'MustRunAs'
234 +    ranges:
235 +      - min: 1
236 +        max: 65535
237 +  readOnlyRootFilesystem: false
238 +{{- end }}
239 diff --git a/stable/elasticsearch-curator/templates/role.yaml b/stable/elasticsearch-curator/templates/role.yaml
240 new file mode 100644
241 index 0000000..8867f67
242 --- /dev/null
243 +++ b/stable/elasticsearch-curator/templates/role.yaml
244 @@ -0,0 +1,23 @@
245 +{{- if .Values.rbac.enabled  }}
246 +kind: Role
247 +apiVersion: rbac.authorization.k8s.io/v1
248 +metadata:
249 +  labels:
250 +    app: {{ template "elasticsearch-curator.name" . }}
251 +    chart: {{ template "elasticsearch-curator.chart" . }}
252 +    heritage: {{ .Release.Service }}
253 +    release: {{ .Release.Name }}
254 +    component: elasticsearch-curator-configmap
255 +  name: {{ template "elasticsearch-curator.name" . }}-role
256 +rules:
257 +- apiGroups: [""]
258 +  resources: ["configmaps"]
259 +  verbs: ["update", "patch"]
260 +{{- if .Values.psp.create }}
261 +- apiGroups: ["extensions"]
262 +  resources: ["podsecuritypolicies"]
263 +  verbs: ["use"]
264 +  resourceNames:
265 +  - {{ template "elasticsearch-curator.fullname" . }}-psp
266 +{{- end -}}
267 +{{- end -}}
268 diff --git a/stable/elasticsearch-curator/templates/rolebinding.yaml b/stable/elasticsearch-curator/templates/rolebinding.yaml
269 new file mode 100644
270 index 0000000..d25d2e1
271 --- /dev/null
272 +++ b/stable/elasticsearch-curator/templates/rolebinding.yaml
273 @@ -0,0 +1,21 @@
274 +{{- if .Values.rbac.enabled -}}
275 +kind: RoleBinding
276 +apiVersion: rbac.authorization.k8s.io/v1
277 +metadata:
278 +  labels:
279 +    app: {{ template "elasticsearch-curator.name" . }}
280 +    chart: {{ template "elasticsearch-curator.chart" . }}
281 +    heritage: {{ .Release.Service }}
282 +    release: {{ .Release.Name }}
283 +    component: elasticsearch-curator-configmap
284 +  name: {{ template "elasticsearch-curator.name" . }}-rolebinding
285 +roleRef:
286 +  kind: Role
287 +  name: {{ template "elasticsearch-curator.name" . }}-role
288 +  apiGroup: rbac.authorization.k8s.io
289 +subjects:
290 +  - kind: ServiceAccount
291 +    name: {{ template "elasticsearch-curator.serviceAccountName" . }}
292 +    namespace: {{ .Release.Namespace }}
293 +{{- end -}}
294 +
295 diff --git a/stable/elasticsearch-curator/templates/serviceaccount.yaml b/stable/elasticsearch-curator/templates/serviceaccount.yaml
296 new file mode 100644
297 index 0000000..ad9c5c9
298 --- /dev/null
299 +++ b/stable/elasticsearch-curator/templates/serviceaccount.yaml
300 @@ -0,0 +1,12 @@
301 +{{- if and .Values.serviceAccount.create .Values.rbac.enabled }}
302 +apiVersion: v1
303 +kind: ServiceAccount
304 +metadata:
305 +  name: {{ template "elasticsearch-curator.serviceAccountName" .}}
306 +  labels:
307 +    app: {{ template "elasticsearch-curator.fullname" . }}
308 +    chart: {{ template "elasticsearch-curator.chart" . }}
309 +    release: "{{ .Release.Name }}"
310 +    heritage: "{{ .Release.Service }}"
311 +{{- end }}
312 +
313 diff --git a/stable/elasticsearch-curator/values.yaml b/stable/elasticsearch-curator/values.yaml
314 index 3779be1..460f2a4 100644
315 --- a/stable/elasticsearch-curator/values.yaml
316 +++ b/stable/elasticsearch-curator/values.yaml
317 @@ -13,9 +13,25 @@ cronjob:
318  pod:
319    annotations: {}
320  
321 +rbac:
322 +  # Specifies whether RBAC should be enabled
323 +  enabled: false
324 +
325 +serviceAccount:
326 +  # Specifies whether a ServiceAccount should be created
327 +  create: true
328 +  # The name of the ServiceAccount to use.
329 +  # If not set and create is true, a name is generated using the fullname template
330 +  name:
331 +
332 +
333 +psp:
334 +  # Specifies whether a podsecuritypolicy should be created
335 +  create: false
336 +
337  image:
338 -  repository: quay.io/pires/docker-elasticsearch-curator
339 -  tag: 5.5.4
340 +  repository: untergeek/curator
341 +  tag: 5.7.6
342    pullPolicy: IfNotPresent
343  
344  hooks:
345 @@ -25,7 +41,7 @@ hooks:
346  # run curator in dry-run mode
347  dryrun: false
348  
349 -command: ["curator"]
350 +command: ["/curator/curator"]
351  env: {}
352  
353  configMaps:
354 @@ -101,5 +117,40 @@ priorityClassName: ""
355  #     mountPath: /certs
356  #     readOnly: true
357  
358 +# Add your own init container or uncomment and modify the given example.
359 +extraInitContainers: {}
360 +  ## Don't configure S3 repository till Elasticsearch is reachable.
361 +  ## Ensure that it is available at http://elasticsearch:9200
362 +  ##
363 +  # elasticsearch-s3-repository:
364 +  #   image: jwilder/dockerize:latest
365 +  #   imagePullPolicy: "IfNotPresent"
366 +  #   command:
367 +  #   - "/bin/sh"
368 +  #   - "-c"
369 +  #   args:
370 +  #   - |
371 +  #     ES_HOST=elasticsearch
372 +  #     ES_PORT=9200
373 +  #     ES_REPOSITORY=backup
374 +  #     S3_REGION=us-east-1
375 +  #     S3_BUCKET=bucket
376 +  #     S3_BASE_PATH=backup
377 +  #     S3_COMPRESS=true
378 +  #     S3_STORAGE_CLASS=standard
379 +  #     apk add curl --no-cache && \
380 +  #     dockerize -wait http://${ES_HOST}:${ES_PORT} --timeout 120s && \
381 +  #     cat <<EOF | curl -sS -XPUT -H "Content-Type: application/json" -d @- http://${ES_HOST}:${ES_PORT}/_snapshot/${ES_REPOSITORY} \
382 +  #     {
383 +  #       "type": "s3",
384 +  #       "settings": {
385 +  #         "bucket": "${S3_BUCKET}",
386 +  #         "base_path": "${S3_BASE_PATH}",
387 +  #         "region": "${S3_REGION}",
388 +  #         "compress": "${S3_COMPRESS}",
389 +  #         "storage_class": "${S3_STORAGE_CLASS}"
390 +  #       }
391 +  #     }
392 +
393  securityContext:
394    runAsUser: 16  # run as cron user instead of root
395 -- 
396 1.8.3.1
397