Skip to content

Commit 61ff855

Browse files
Mikalai Radchuktmshort
authored andcommitted
UPSTREAM: <carry>: Add global-pull-secret flag
Pass global-pull-secret to the manager container. Signed-off-by: Mikalai Radchuk <mradchuk@redhat.com>
1 parent 5f96299 commit 61ff855

File tree

30 files changed

+127
-27
lines changed

30 files changed

+127
-27
lines changed

openshift/generate-manifests.sh

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ IMAGE_MAPPINGS[kube-rbac-proxy]='${KUBE_RBAC_PROXY_IMAGE}'
2020
# shellcheck disable=SC2016
2121
IMAGE_MAPPINGS[manager]='${OPERATOR_CONTROLLER_IMAGE}'
2222

23+
# This is a mapping of catalogd flag names to values. For example, given a deployment with a container
24+
# named "manager" and arguments:
25+
# args:
26+
# - --flagname=one
27+
# and an entry to the FLAG_MAPPINGS of FLAG_MAPPINGS[flagname]='two', the argument will be updated to:
28+
# args:
29+
# - --flagname=two
30+
#
31+
# If the flag doesn't already exist - it will be appended to the list.
32+
declare -A FLAG_MAPPINGS
33+
# shellcheck disable=SC2016
34+
FLAG_MAPPINGS[global-pull-secret]="openshift-config/pull-secret"
35+
2336
##################################################
2437
# You shouldn't need to change anything below here
2538
##################################################
@@ -60,6 +73,17 @@ for container_name in "${!IMAGE_MAPPINGS[@]}"; do
6073
$YQ -i 'select(.kind == "Namespace").metadata.annotations += {"workload.openshift.io/allowed": "management"}' "$TMP_KUSTOMIZE_OUTPUT"
6174
done
6275

76+
# Loop through any flag updates that need to be made to the manager container
77+
for flag_name in "${!FLAG_MAPPINGS[@]}"; do
78+
flagval="${FLAG_MAPPINGS[$flag_name]}"
79+
80+
# First, update the flag if it exists
81+
$YQ -i "(select(.kind == \"Deployment\") | .spec.template.spec.containers[] | select(.name == \"manager\") | .args[] | select(. | contains(\"--$flag_name=\")) | .) = \"--$flag_name=$flagval\"" "$TMP_KUSTOMIZE_OUTPUT"
82+
83+
# Then, append the flag if it doesn't exist
84+
$YQ -i "(select(.kind == \"Deployment\") | .spec.template.spec.containers[] | select(.name == \"manager\") | .args) |= (select(.[] | contains(\"--$flag_name=\")) | .) // . + [\"--$flag_name=$flagval\"]" "$TMP_KUSTOMIZE_OUTPUT"
85+
done
86+
6387
# Use yq to split the single yaml file into 1 per document.
6488
# Naming convention: $index-$kind-$namespace-$name. If $namespace is empty, just use the empty string.
6589
(
@@ -103,4 +127,3 @@ cp "$TMP_MANIFEST_DIR"/* "$MANIFEST_DIR"/
103127
fi
104128
done
105129
)
106-
Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,5 @@
1-
# Adds namespace to all resources.
2-
namespace: OPENSHIFT-NAMESPACE
3-
41
namePrefix: operator-controller-
52

63
resources:
7-
- resources/ca_configmap.yaml
8-
- ../../../../config/base/crd
9-
- ../../../../config/base/rbac
10-
- ../../../../config/base/manager
11-
12-
patches:
13-
- target:
14-
kind: ClusterRole
15-
name: manager-role
16-
path: patches/manager_role.yaml
17-
- target:
18-
kind: Deployment
19-
name: controller-manager
20-
path: patches/manager_deployment_ca.yaml
21-
- target:
22-
kind: Deployment
23-
name: controller-manager
24-
path: patches/manager_deployment_mount_etc_containers.yaml
25-
- target:
26-
kind: Deployment
27-
name: controller-manager
28-
path: patches/manager_deployment_log_verbosity.yaml
29-
- path: patches/manager_namespace_privileged.yaml
4+
- olmv1-ns
5+
- openshift-config
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Adds namespace to all resources.
2+
namespace: OPENSHIFT-NAMESPACE
3+
4+
resources:
5+
- resources/ca_configmap.yaml
6+
- ../../../../../config/base/crd
7+
- ../../../../../config/base/rbac
8+
- ../../../../../config/base/manager
9+
10+
patches:
11+
- target:
12+
kind: ClusterRole
13+
name: manager-role
14+
path: patches/manager_role.yaml
15+
- target:
16+
kind: Deployment
17+
name: controller-manager
18+
path: patches/manager_deployment_ca.yaml
19+
- target:
20+
kind: Deployment
21+
name: controller-manager
22+
path: patches/manager_deployment_mount_etc_containers.yaml
23+
- target:
24+
kind: Deployment
25+
name: controller-manager
26+
path: patches/manager_deployment_log_verbosity.yaml
27+
- path: patches/manager_namespace_privileged.yaml
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Adds namespace to all resources.
2+
namespace: openshift-config
3+
4+
resources:
5+
- rbac/operator-controller_manager_role.yaml
6+
- rbac/operator-controller_manager_role_binding.yaml

0 commit comments

Comments
 (0)