suite: pod dns policy test templates: - common.yaml tests: - it: should pass with empty dnsPolicy set: podOptions: dnsPolicy: "" workload: workload-name1: enabled: true primary: true type: Deployment podSpec: {} asserts: - documentIndex: &deploymentDoc 0 isKind: of: Deployment - documentIndex: *deploymentDoc equal: path: spec.template.spec.dnsPolicy value: ClusterFirst - it: should pass with dnsPolicy from "global" set: podOptions: dnsPolicy: Default workload: workload-name1: enabled: true primary: true type: Deployment podSpec: {} asserts: - documentIndex: *deploymentDoc equal: path: spec.template.spec.dnsPolicy value: Default - it: should pass with dnsPolicy from "pod" set: podOptions: dnsPolicy: None workload: workload-name1: enabled: true primary: true type: Deployment podSpec: dnsPolicy: ClusterFirst asserts: - documentIndex: *deploymentDoc equal: path: spec.template.spec.dnsPolicy value: ClusterFirst - it: should pass with dnsPolicy from "pod" with tpl set: policy: ClusterFirst podOptions: dnsPolicy: None workload: workload-name1: enabled: true primary: true type: Deployment podSpec: dnsPolicy: "{{ .Values.policy }}" asserts: - documentIndex: *deploymentDoc equal: path: spec.template.spec.dnsPolicy value: ClusterFirst - it: should pass with hostNetwork enabled set: podOptions: dnsPolicy: None workload: workload-name1: enabled: true primary: true type: Deployment podSpec: dnsPolicy: ClusterFirst hostNetwork: true asserts: - documentIndex: *deploymentDoc equal: path: spec.template.spec.dnsPolicy value: ClusterFirstWithHostNet # Failures - it: should fail with invalid dnsPolicy set: podOptions: dnsPolicy: Invalid workload: workload-name1: enabled: true primary: true type: Deployment podSpec: {} asserts: - failedTemplate: errorMessage: Expected to be one of [ClusterFirst, ClusterFirstWithHostNet, Default, None], but got [Invalid]