forked from Azure/azure-policy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Built-in Policy Release 80586591 (Azure#1139)
Co-authored-by: Azure Policy Bot <[email protected]>
- Loading branch information
Showing
12 changed files
with
821 additions
and
25 deletions.
There are no files selected for viewing
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
152 changes: 152 additions & 0 deletions
152
built-in-policies/policyDefinitions/Kubernetes/AKS_GuardrailsCannotEditIndividualNodes.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
{ | ||
"properties": { | ||
"displayName": "[Preview]: [AKS Guardrails] Cannot Edit Individual Nodes", | ||
"policyType": "BuiltIn", | ||
"mode": "Microsoft.Kubernetes.Data", | ||
"description": "Cannot Edit Individual Nodes. Users should not edit individual nodes. Please edit node pools.", | ||
"metadata": { | ||
"version": "1.0.0-preview", | ||
"category": "Kubernetes", | ||
"preview": true | ||
}, | ||
"version": "1.0.0-preview", | ||
"parameters": { | ||
"effect": { | ||
"type": "String", | ||
"metadata": { | ||
"displayName": "[AKS Guardrails] 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": "[AKS Guardrails] Namespace exclusions", | ||
"description": "List of Kubernetes namespaces to exclude from policy evaluation." | ||
}, | ||
"defaultValue": [ | ||
"kube-system", | ||
"gatekeeper-system", | ||
"azure-arc" | ||
] | ||
}, | ||
"namespaces": { | ||
"type": "Array", | ||
"metadata": { | ||
"displayName": "[AKS Guardrails] 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": "[AKS Guardrails] 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 | ||
} | ||
}, | ||
"allowedUsers": { | ||
"type": "Array", | ||
"metadata": { | ||
"displayName": "[AKS Guardrails] Allowed Users", | ||
"description": "Users that are allowed by AKS Guardrails to modify node labels on individual nodes." | ||
} | ||
}, | ||
"allowedGroups": { | ||
"type": "Array", | ||
"metadata": { | ||
"displayName": "[AKS Guardrails] Allowed Groups", | ||
"description": "Groups that are allowed by AKS Guardrails to modify node labels on individual nodes." | ||
} | ||
} | ||
}, | ||
"policyRule": { | ||
"if": { | ||
"field": "type", | ||
"equals": "Microsoft.ContainerService/managedClusters" | ||
}, | ||
"then": { | ||
"effect": "[parameters('effect')]", | ||
"details": { | ||
"templateInfo": { | ||
"sourceType": "PublicURL", | ||
"url": "https://store.policy.core.windows.net/kubernetes/restricted-node-edits/v1/template.yaml" | ||
}, | ||
"apiGroups": [ | ||
"" | ||
], | ||
"kinds": [ | ||
"Node" | ||
], | ||
"namespaces": "[parameters('namespaces')]", | ||
"excludedNamespaces": "[parameters('excludedNamespaces')]", | ||
"labelSelector": "[parameters('labelSelector')]", | ||
"values": { | ||
"allowedUsers": "[parameters('allowedUsers')]", | ||
"allowedGroups": "[parameters('allowedGroups')]" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"id": "/providers/Microsoft.Authorization/policyDefinitions/53a4a537-990c-495a-92e0-7c21a465442c", | ||
"name": "53a4a537-990c-495a-92e0-7c21a465442c" | ||
} |
137 changes: 137 additions & 0 deletions
137
...-in-policies/policyDefinitions/Kubernetes/AKS_GuardrailsMustHaveAntiAffinityRulesSet.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
{ | ||
"properties": { | ||
"displayName": "[Preview]: [AKS Guardrails] Must Have Anty Affinity Rules Set", | ||
"policyType": "BuiltIn", | ||
"mode": "Microsoft.Kubernetes.Data", | ||
"description": "Requires affinity rules to be set.", | ||
"metadata": { | ||
"version": "1.0.0-preview", | ||
"category": "Kubernetes", | ||
"preview": true | ||
}, | ||
"version": "1.0.0-preview", | ||
"parameters": { | ||
"effect": { | ||
"type": "String", | ||
"metadata": { | ||
"displayName": "[AKS Guardrails] 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": "[AKS Guardrails] Namespace exclusions", | ||
"description": "List of Kubernetes namespaces to exclude from policy evaluation." | ||
}, | ||
"defaultValue": [ | ||
"kube-system", | ||
"gatekeeper-system", | ||
"azure-arc" | ||
] | ||
}, | ||
"namespaces": { | ||
"type": "Array", | ||
"metadata": { | ||
"displayName": "[AKS Guardrails] 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": "[AKS Guardrails] 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 | ||
} | ||
} | ||
}, | ||
"policyRule": { | ||
"if": { | ||
"field": "type", | ||
"equals": "Microsoft.ContainerService/managedClusters" | ||
}, | ||
"then": { | ||
"effect": "[parameters('effect')]", | ||
"details": { | ||
"templateInfo": { | ||
"sourceType": "PublicURL", | ||
"url": "https://store.policy.core.windows.net/kubernetes/pod-enforce-antiaffinity/v1/template.yaml" | ||
}, | ||
"apiGroups": [ | ||
"apps" | ||
], | ||
"kinds": [ | ||
"Deployment", | ||
"StatefulSet", | ||
"ReplicationController", | ||
"ReplicaSet" | ||
], | ||
"namespaces": "[parameters('namespaces')]", | ||
"excludedNamespaces": "[parameters('excludedNamespaces')]", | ||
"labelSelector": "[parameters('labelSelector')]" | ||
} | ||
} | ||
} | ||
}, | ||
"id": "/providers/Microsoft.Authorization/policyDefinitions/34c88cd4-5d72-4dbb-bf77-12c3cafe8791", | ||
"name": "34c88cd4-5d72-4dbb-bf77-12c3cafe8791" | ||
} |
Oops, something went wrong.