Skip to content

Commit

Permalink
Built-in Policy Release da9c6b7a (Azure#1238)
Browse files Browse the repository at this point in the history
Co-authored-by: Azure Policy Bot <[email protected]>
  • Loading branch information
pilor and Azure Policy Bot authored Nov 13, 2023
1 parent 61cf0ac commit 09666ae
Show file tree
Hide file tree
Showing 19 changed files with 963 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{
"properties": {
"displayName": "Kubernetes clusters should ensure that the cluster-admin role is only used where required",
"policyType": "BuiltIn",
"mode": "Microsoft.Kubernetes.Data",
"description": "The role 'cluster-admin' provides wide-ranging powers over the environment and should be used only where and when needed.",
"metadata": {
"version": "1.0.0",
"category": "Kubernetes"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "'Audit' allows a non-compliant resource to be created or updated, but flags it as non-compliant. 'Disabled' turns off the policy.",
"portalReview": true
},
"allowedValues": [
"Audit",
"Disabled"
],
"defaultValue": "Audit"
},
"excludedNamespaces": {
"type": "Array",
"metadata": {
"displayName": "Namespace exclusions",
"description": "List of Kubernetes namespaces to exclude from policy evaluation. System namespaces \"kube-system\", \"gatekeeper-system\" and \"azure-arc\" are always excluded by design. \"azure-extensions-usage-system\" is optional to remove."
},
"defaultValue": [
"kube-system",
"gatekeeper-system",
"azure-arc",
"azure-extensions-usage-system"
]
},
"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
}
}
},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.ContainerService/managedClusters"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"templateInfo": {
"sourceType": "PublicURL",
"url": "https://store.policy.azure.us/kubernetes/block-admin-rolebindings/v1/template.yaml"
},
"apiGroups": [
"rbac.authorization.k8s.io"
],
"kinds": [
"ClusterRoleBinding",
"RoleBinding"
],
"excludedNamespaces": "[parameters('excludedNamespaces')]",
"namespaces": "[parameters('namespaces')]",
"labelSelector": "[parameters('labelSelector')]"
}
}
}
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/a3dc4946-dba6-43e6-950d-f96532848c9f",
"name": "a3dc4946-dba6-43e6-950d-f96532848c9f"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"mode": "Indexed",
"description": "Deploy Association to link Windows virtual machine scale sets to the specified Data Collection Rule or the specified Data Collection Endpoint. The list of locations and OS images are updated over time as support is increased.",
"metadata": {
"version": "2.2.0",
"version": "2.3.0",
"category": "Monitoring"
},
"version": "2.2.0",
"version": "2.3.0",
"parameters": {
"effect": {
"type": "String",
Expand Down Expand Up @@ -120,7 +120,8 @@
"2022-datacenter-core-smalldisk-g2",
"2022-datacenter-g2",
"2022-datacenter-smalldisk",
"2022-datacenter-smalldisk-g2"
"2022-datacenter-smalldisk-g2",
"2022-datacenter-gensecond"
]
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"mode": "Indexed",
"description": "Deploy Association to link Windows virtual machines to the specified Data Collection Rule or the specified Data Collection Endpoint. The list of locations and OS images are updated over time as support is increased.",
"metadata": {
"version": "2.2.0",
"version": "2.3.0",
"category": "Monitoring"
},
"version": "2.2.0",
"version": "2.3.0",
"parameters": {
"effect": {
"type": "String",
Expand Down Expand Up @@ -120,7 +120,8 @@
"2022-datacenter-core-smalldisk-g2",
"2022-datacenter-g2",
"2022-datacenter-smalldisk",
"2022-datacenter-smalldisk-g2"
"2022-datacenter-smalldisk-g2",
"2022-datacenter-gensecond"
]
}
]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"properties": {
"policyType": "BuiltIn",
"displayName": "Azure Kubernetes Service Clusters should enable cluster auto-upgrade",
"description": "AKS cluster auto-upgrade can ensure your clusters are up to date and don't miss the latest features or patches from AKS and upstream Kubernetes. Learn more at: https://learn.microsoft.com/en-us/azure/aks/auto-upgrade-cluster.",
"metadata": {
"version": "1.0.0",
"category": "Kubernetes"
},
"version": "1.0.0",
"mode": "Indexed",
"parameters": {
"effect": {
"type": "String",
"defaultValue": "Audit",
"allowedValues": [
"Audit",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy."
}
},
"allowedClusterAutoUpgradeChannels": {
"type": "Array",
"metadata": {
"displayName": "Allowed Cluster Auto-upgrade Channels",
"description": "Cluster auto-upgrade channels viewed as complaint. Lean more at https://learn.microsoft.com/en-us/azure/aks/auto-upgrade-cluster#use-cluster-auto-upgrade",
"portalReview": true
},
"allowedValues": [
"rapid",
"stable",
"patch",
"node-image",
"none"
],
"defaultValue": [
"rapid",
"stable",
"patch"
]
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.ContainerService/managedClusters"
},
{
"anyOf": [
{
"field": "Microsoft.ContainerService/managedClusters/autoUpgradeProfile.upgradeChannel",
"exists": false
},
{
"field": "Microsoft.ContainerService/managedClusters/autoUpgradeProfile.upgradeChannel",
"notin": "[parameters('allowedClusterAutoUpgradeChannels')]"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/5c345cdf-2049-47e0-b8fe-b0e96bc2df35",
"name": "5c345cdf-2049-47e0-b8fe-b0e96bc2df35"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{
"properties": {
"displayName": "Kubernetes clusters should ensure that the cluster-admin role is only used where required",
"policyType": "BuiltIn",
"mode": "Microsoft.Kubernetes.Data",
"description": "The role 'cluster-admin' provides wide-ranging powers over the environment and should be used only where and when needed.",
"metadata": {
"version": "1.0.0",
"category": "Kubernetes"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "'Audit' allows a non-compliant resource to be created or updated, but flags it as non-compliant. 'Disabled' turns off the policy.",
"portalReview": true
},
"allowedValues": [
"Audit",
"Disabled"
],
"defaultValue": "Audit"
},
"excludedNamespaces": {
"type": "Array",
"metadata": {
"displayName": "Namespace exclusions",
"description": "List of Kubernetes namespaces to exclude from policy evaluation. System namespaces \"kube-system\", \"gatekeeper-system\" and \"azure-arc\" are always excluded by design. \"azure-extensions-usage-system\" is optional to remove."
},
"defaultValue": [
"kube-system",
"gatekeeper-system",
"azure-arc",
"azure-extensions-usage-system"
]
},
"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
}
}
},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.ContainerService/managedClusters"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"templateInfo": {
"sourceType": "PublicURL",
"url": "https://store.policy.core.windows.net/kubernetes/block-admin-rolebindings/v1/template.yaml"
},
"apiGroups": [
"rbac.authorization.k8s.io"
],
"kinds": [
"ClusterRoleBinding",
"RoleBinding"
],
"excludedNamespaces": "[parameters('excludedNamespaces')]",
"namespaces": "[parameters('namespaces')]",
"labelSelector": "[parameters('labelSelector')]"
}
}
}
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/a3dc4946-dba6-43e6-950d-f96532848c9f",
"name": "a3dc4946-dba6-43e6-950d-f96532848c9f"
}
Loading

0 comments on commit 09666ae

Please sign in to comment.