func opaDeploymentLabelConstraint()

in appconfigmgrv2/controllers/opa_constraints.go [49:88]


func opaDeploymentLabelConstraint(namespaces []string) *unstructured.Unstructured {
	u := &unstructured.Unstructured{
		Object: map[string]interface{}{
			"metadata": map[string]interface{}{
				"name": "deployments-must-have-correct-labels",
			},
			"spec": map[string]interface{}{
				"match": map[string]interface{}{
					"kinds": []map[string]interface{}{
						{
							"apiGroups": []string{
								"extensions",
								"apps",
							},
							"kinds": []string{
								"Deployment",
							},
						},
						{
							"apiGroups": []string{""},
							"kinds": []string{
								"Pod",
							},
						},
					},
					"namespaces": namespaces,
				},
				"parameters": map[string]interface{}{
					"labels": []string{
						"app",
						"version",
					},
				},
			},
		},
	}

	u.SetGroupVersionKind(opaConstraintGVK())
	return u
}