k8s apply - fix list merge for array attribute with empty dict (#131)

Fix k8s apply
This commit is contained in:
abikouo
2021-06-15 10:41:55 +02:00
committed by GitHub
parent b7345696cc
commit 58dba6bf22
3 changed files with 65 additions and 34 deletions

View File

@@ -836,6 +836,66 @@
that:
- k8s_secret is not changed
- name: Create network policy (egress array with empty dict)
k8s:
namespace: "{{ apply_namespace }}"
apply: true
definition:
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: apply-netpolicy
labels:
app: apply-netpolicy
annotations:
{}
spec:
podSelector:
matchLabels:
app: apply-netpolicy
policyTypes:
- Ingress
- Egress
ingress:
- ports:
- port: 9093
protocol: TCP
egress:
- {}
- name: Apply network policy
k8s:
namespace: "{{ apply_namespace }}"
definition:
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: apply-netpolicy
labels:
app: apply-netpolicy
annotations:
{}
spec:
podSelector:
matchLabels:
app: apply-netpolicy
policyTypes:
- Ingress
- Egress
ingress:
- ports:
- port: 9093
protocol: TCP
egress:
- {}
apply: true
register: k8s_networkpolicy
- name: Check that nothing changed
assert:
that:
- k8s_networkpolicy is not changed
always:
- name: Remove namespace
k8s: