This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"properties": { | |
"policyType": "Custom", | |
"mode": "Microsoft.Kubernetes.Data", | |
"policyRule": { | |
"if": { | |
"field": "type", | |
"in": [ | |
"Microsoft.ContainerService/managedClusters" | |
] | |
}, | |
"then": { | |
"effect": "[parameters('effect')]", | |
"details": { | |
"templateInfo": { | |
"sourceType": "PublicURL", | |
"url": "https://stopapolicyjx01.blob.core.windows.net/templates/template.yaml" | |
}, | |
"apiGroups": [ | |
"" | |
], | |
"kinds": [ | |
"[parameters('kind')]" | |
], | |
"namespaces": "[parameters('namespaces')]", | |
"excludedNamespaces": "[parameters('excludedNamespaces')]", | |
"labelSelector": "[parameters('labelSelector')]", | |
"values": { | |
"namespace": "[parameters('namespace')]" | |
} | |
} | |
} | |
}, | |
"parameters": { | |
"kind": { | |
"type": "String", | |
"metadata": { | |
"displayName": "The Kind of Resource the policy is restricting", | |
"description": "This is a Restriction" | |
}, | |
"allowedValues": [ | |
"Pod", | |
"Deployment", | |
"Service" | |
] | |
}, | |
"namespace": { | |
"type": "String", | |
"metadata": { | |
"displayName": "The namespace the restriction will be applied to", | |
"description": "" | |
} | |
}, | |
"effect": { | |
"type": "String", | |
"metadata": { | |
"displayName": "Effect", | |
"description": "'audit' allows a non-compliant resource to be created or updated, but flags it as non-compliant. 'deny' blocks the non-compliant resource creation or update. 'disabled' turns off the policy." | |
}, | |
"allowedValues": [ | |
"audit", | |
"deny", | |
"disabled" | |
], | |
"defaultValue": "audit" | |
}, | |
"excludedNamespaces": { | |
"type": "Array", | |
"metadata": { | |
"displayName": "Namespace exclusions", | |
"description": "List of Kubernetes namespaces to exclude from policy evaluation." | |
}, | |
"defaultValue": [ | |
"kube-system", | |
"gatekeeper-system", | |
"azure-arc" | |
] | |
}, | |
"namespaces": { | |
"type": "Array", | |
"metadata": { | |
"displayName": "Namespace inclusions", | |
"description": "List of Kubernetes namespaces to only include in policy evaluation. An empty list means the policy is applied to all resources in all namespaces." | |
}, | |
"defaultValue": [] | |
}, | |
"labelSelector": { | |
"type": "Object", | |
"metadata": { | |
"displayName": "Kubernetes label selector", | |
"description": "Label query to select Kubernetes resources for policy evaluation. An empty label selector matches all Kubernetes resources." | |
}, | |
"defaultValue": {}, | |
"schema": { | |
"description": "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all resources.", | |
"type": "object", | |
"properties": { | |
"matchLabels": { | |
"description": "matchLabels is a map of {key,value} pairs.", | |
"type": "object", | |
"additionalProperties": { | |
"type": "string" | |
}, | |
"minProperties": 1 | |
}, | |
"matchExpressions": { | |
"description": "matchExpressions is a list of values, a key, and an operator.", | |
"type": "array", | |
"items": { | |
"type": "object", | |
"properties": { | |
"key": { | |
"description": "key is the label key that the selector applies to.", | |
"type": "string" | |
}, | |
"operator": { | |
"description": "operator represents a key's relationship to a set of values.", | |
"type": "string", | |
"enum": [ | |
"In", | |
"NotIn", | |
"Exists", | |
"DoesNotExist" | |
] | |
}, | |
"values": { | |
"description": "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty.", | |
"type": "array", | |
"items": { | |
"type": "string" | |
} | |
} | |
}, | |
"required": [ | |
"key", | |
"operator" | |
], | |
"additionalProperties": false | |
}, | |
"minItems": 1 | |
} | |
}, | |
"additionalProperties": false | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment