Skip to content

Commit

Permalink
kubemacpool: Remove namespace labels
Browse files Browse the repository at this point in the history
The kubemacpool project was adding restricted label to test security
context. This change remove labels altogether and configure them at CI
to test it.

Signed-off-by: Enrique Llorente <ellorent@redhat.com>
  • Loading branch information
qinqon committed Jun 15, 2023
1 parent 965e776 commit a32efaa
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
12 changes: 12 additions & 0 deletions automation/components-functests.setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ export KUBECONFIG=$(cluster::kubeconfig)
make cluster-operator-push
make cluster-operator-install

# Test kubemacpool with restricted
if [ "$COMPONENT" == "kubemacpool" ]; then
cluster/kubectl.sh apply -f - <<EOF
apiVersion: v1
kind: Namespace
metadata:
name: cluster-network-addons
labels:
pod-security.kubernetes.io/enforce: restricted
EOF
fi

# Deploy all network addons components with CNAO
cat <<EOF | cluster/kubectl.sh apply -f -
apiVersion: networkaddonsoperator.network.kubevirt.io/v1
Expand Down
3 changes: 0 additions & 3 deletions data/kubemacpool/kubemacpool.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
control-plane: mac-controller-manager
pod-security.kubernetes.io/enforce: restricted
name: '{{ .Namespace }}'
---
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
12 changes: 10 additions & 2 deletions hack/components/bump-kubemacpool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,16 @@ patches:
kind: Deployment
name: mac-controller-manager
namespace: system
- path: cnao_mac-range_patch.json
- path: cnao_mac-range_patch.yaml
target:
version: v1
kind: ConfigMap
name: mac-range-config
namespace: system
- path: cnao_remove-labels_patch.yaml
target:
version: v1
kind: Namespace
EOF

cat <<EOF > config/cnao/cnao_kubemacpool_manager_patch.yaml
Expand Down Expand Up @@ -116,14 +120,18 @@ EOF
value: "{{ toYaml .Placement.Tolerations | nindent 8 }}"
EOF

cat <<EOF > config/cnao/cnao_mac-range_patch.json
cat <<EOF > config/cnao/cnao_mac-range_patch.yaml
- op: replace
path: /data/RANGE_START
value: "{{ .RangeStart }}"
- op: replace
path: /data/RANGE_END
value: "{{ .RangeEnd }}"
EOF
cat <<EOF > config/cnao/cnao_remove-labels_patch.yaml
- op: remove
path: /metadata/labels
EOF


(
Expand Down

0 comments on commit a32efaa

Please sign in to comment.