File tree 5 files changed +77
-1
lines changed
5 files changed +77
-1
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ metadata:
103
103
categories : Modernization & Migration
104
104
certified : " false"
105
105
containerImage : quay.io/konveyor/tackle2-operator:latest
106
- createdAt : " 2024-10-09T15:56:59Z "
106
+ createdAt : " 2024-11-07T18:19:51Z "
107
107
description : Konveyor is an open-source application modernization platform that
108
108
helps organizations safely and predictably modernize applications to Kubernetes
109
109
at scale.
@@ -331,6 +331,14 @@ spec:
331
331
- ' *'
332
332
verbs :
333
333
- ' *'
334
+ - apiGroups :
335
+ - security.openshift.io
336
+ resourceNames :
337
+ - anyuid
338
+ resources :
339
+ - securitycontextconstraints
340
+ verbs :
341
+ - use
334
342
serviceAccountName : tackle-hub
335
343
- rules :
336
344
- apiGroups :
Original file line number Diff line number Diff line change @@ -12,3 +12,11 @@ rules:
12
12
- ' *'
13
13
verbs :
14
14
- ' *'
15
+ - apiGroups :
16
+ - security.openshift.io
17
+ resourceNames :
18
+ - anyuid
19
+ resources :
20
+ - securitycontextconstraints
21
+ verbs :
22
+ - use
Original file line number Diff line number Diff line change 3
3
set_fact :
4
4
api_groups : " {{ lookup('k8s', cluster_info='api_groups') }}"
5
5
6
+ - name : Gather Facts
7
+ ansible.builtin.gather_facts :
8
+ gather_subset :
9
+ - user_uid
10
+
11
+ - name : " Retrieve UID"
12
+ set_fact :
13
+ hub_uid : " {{ ansible_facts['user_uid'] }}"
14
+
6
15
- name : " Transfer rwx_storage_class setting if hub_bucket_storage_class is not defined"
7
16
set_fact :
8
17
hub_bucket_storage_class : " {{ rwx_storage_class }}"
562
571
definition : " {{ lookup('template', 'route-ui.yml.j2') }}"
563
572
when : openshift_cluster|bool
564
573
574
+ - name : " Check if Cache PersistentVolumeClaim exists"
575
+ kubernetes.core.k8s_info :
576
+ api_version : v1
577
+ kind : PersistentVolumeClaim
578
+ namespace : " {{ app_namespace }}"
579
+ name : " {{ cache_data_volume_claim_name }}"
580
+ register : cache_pvc
581
+
582
+ - name : " Delete cache PVC if non-root label is missing so it can be recreated"
583
+ when : cache_pvc.resources|length > 0 and cache_pvc.resources[0].metadata.labels['non-root'] is not defined
584
+ block :
585
+ - name : Scale down Hub
586
+ k8s :
587
+ state : present
588
+ definition : " {{ lookup('template', 'deployment-hub.yml.j2') }}"
589
+ merge_type : merge
590
+ vars :
591
+ hub_deployment_replicas : 0
592
+
593
+ - name : Delete cache PVC
594
+ k8s :
595
+ state : absent
596
+ definition : " {{ lookup('template', 'persistentvolumeclaim-cache.yml.j2') }}"
597
+ wait : true
598
+
599
+ - name : Scale up Hub
600
+ k8s :
601
+ state : present
602
+ definition : " {{ lookup('template', 'deployment-hub.yml.j2') }}"
603
+ merge_type : merge
604
+
565
605
- name : " Setup Cache PersistentVolumeClaim"
566
606
k8s :
567
607
state : present
Original file line number Diff line number Diff line change @@ -204,6 +204,8 @@ spec:
204
204
requests:
205
205
cpu: {{ hub_container_requests_cpu }}
206
206
memory: {{ hub_container_requests_memory }}
207
+ securityContext:
208
+ runAsUser: {{ hub_uid }}
207
209
# TODO: Add liveness and readiness probes
208
210
volumeMounts:
209
211
- name: {{ hub_database_volume_name }}
@@ -218,6 +220,23 @@ spec:
218
220
- name: {{ hub_tls_secret_name }}
219
221
mountPath: /var/run/secrets/{{ hub_tls_secret_name }}/tls.crt
220
222
{% endif %}
223
+ initContainers:
224
+ - command:
225
+ - chown
226
+ - -R
227
+ - {{ hub_uid }}:root
228
+ - {{ hub_database_volume_path }}
229
+ - {{ hub_bucket_volume_path }}
230
+ image: "{{ hub_image_fqin }}"
231
+ imagePullPolicy: "{{ image_pull_policy }}"
232
+ name: update-perms
233
+ securityContext:
234
+ runAsUser: 0
235
+ volumeMounts:
236
+ - mountPath: {{ hub_database_volume_path }}
237
+ name: {{ hub_database_volume_name }}
238
+ - mountPath: {{ hub_bucket_volume_path }}
239
+ name: {{ hub_bucket_volume_name }}
221
240
volumes:
222
241
{% if rwx_supported |bool %}
223
242
- name: {{ cache_data_volume_name }}
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ metadata:
8
8
app.kubernetes.io/name: {{ cache_name }}
9
9
app.kubernetes.io/part-of: {{ app_name }}
10
10
volume: {{ cache_data_volume_name }}
11
+ non-root: "true"
11
12
spec:
12
13
accessModes:
13
14
- "{{ cache_data_volume_claim_mode }}"
You can’t perform that action at this time.
0 commit comments