diff --git a/modules/kubernetes-configuration/extension/tests/e2e/max/main.test.bicep b/modules/kubernetes-configuration/extension/tests/e2e/max/main.test.bicep index 2e89b688c5..bed927f07f 100644 --- a/modules/kubernetes-configuration/extension/tests/e2e/max/main.test.bicep +++ b/modules/kubernetes-configuration/extension/tests/e2e/max/main.test.bicep @@ -79,6 +79,16 @@ module testDeployment '../../../main.bicep' = [for iteration in [ 'init', 'idem' timeoutInSeconds: 180 url: 'https://github.com/mspnp/aks-baseline' } + kustomizations: { + unified: { + dependsOn: [] + force: false + path: './cluster-manifests' + prune: true + syncIntervalInSeconds: 300 + timeoutInSeconds: 300 + } + } } ] } diff --git a/modules/kubernetes-configuration/extension/tests/e2e/waf-aligned/main.test.bicep b/modules/kubernetes-configuration/extension/tests/e2e/waf-aligned/main.test.bicep index c4d96b2b40..79318166b8 100644 --- a/modules/kubernetes-configuration/extension/tests/e2e/waf-aligned/main.test.bicep +++ b/modules/kubernetes-configuration/extension/tests/e2e/waf-aligned/main.test.bicep @@ -79,6 +79,16 @@ module testDeployment '../../../main.bicep' = [for iteration in [ 'init', 'idem' timeoutInSeconds: 180 url: 'https://github.com/mspnp/aks-baseline' } + kustomizations: { + unified: { + dependsOn: [] + force: false + path: './cluster-manifests' + prune: true + syncIntervalInSeconds: 300 + timeoutInSeconds: 300 + } + } } ] } diff --git a/modules/kubernetes-configuration/flux-configuration/README.md b/modules/kubernetes-configuration/flux-configuration/README.md index 31ff175b92..2da23ceb45 100644 --- a/modules/kubernetes-configuration/flux-configuration/README.md +++ b/modules/kubernetes-configuration/flux-configuration/README.md @@ -17,7 +17,7 @@ This module deploys a Kubernetes Configuration Flux Configuration. | Resource Type | API Version | | :-- | :-- | -| `Microsoft.KubernetesConfiguration/fluxConfigurations` | [2022-03-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.KubernetesConfiguration/2022-03-01/fluxConfigurations) | +| `Microsoft.KubernetesConfiguration/fluxConfigurations` | [2023-05-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.KubernetesConfiguration/fluxConfigurations) | ## Usage examples @@ -46,6 +46,22 @@ module fluxConfiguration 'br:bicep/modules/kubernetes-configuration.flux-configu params: { // Required parameters clusterName: '' + kustomizations: { + unified: { + dependsOn: [] + force: false + path: './cluster-manifests' + postBuild: { + substitute: { + TEST_VAR1: 'foo' + TEST_VAR2: 'bar' + } + } + prune: true + syncIntervalInSeconds: 300 + timeoutInSeconds: 300 + } + } name: 'kcfcmin001' namespace: 'flux-system' sourceKind: 'GitRepository' @@ -80,6 +96,24 @@ module fluxConfiguration 'br:bicep/modules/kubernetes-configuration.flux-configu "clusterName": { "value": "" }, + "kustomizations": { + "value": { + "unified": { + "dependsOn": [], + "force": false, + "path": "./cluster-manifests", + "postBuild": { + "substitute": { + "TEST_VAR1": "foo", + "TEST_VAR2": "bar" + } + }, + "prune": true, + "syncIntervalInSeconds": 300, + "timeoutInSeconds": 300 + } + } + }, "name": { "value": "kcfcmin001" }, @@ -126,6 +160,16 @@ module fluxConfiguration 'br:bicep/modules/kubernetes-configuration.flux-configu params: { // Required parameters clusterName: '' + kustomizations: { + unified: { + dependsOn: [] + force: false + path: './cluster-manifests' + prune: true + syncIntervalInSeconds: 300 + timeoutInSeconds: 300 + } + } name: 'kcfcmax001' namespace: 'flux-system' sourceKind: 'GitRepository' @@ -140,16 +184,6 @@ module fluxConfiguration 'br:bicep/modules/kubernetes-configuration.flux-configu timeoutInSeconds: 180 url: 'https://github.com/mspnp/aks-baseline' } - kustomizations: { - unified: { - dependsOn: [] - force: false - path: './cluster-manifests' - prune: true - syncIntervalInSeconds: 300 - timeoutInSeconds: 300 - } - } } } ``` @@ -170,6 +204,18 @@ module fluxConfiguration 'br:bicep/modules/kubernetes-configuration.flux-configu "clusterName": { "value": "" }, + "kustomizations": { + "value": { + "unified": { + "dependsOn": [], + "force": false, + "path": "./cluster-manifests", + "prune": true, + "syncIntervalInSeconds": 300, + "timeoutInSeconds": 300 + } + } + }, "name": { "value": "kcfcmax001" }, @@ -193,18 +239,6 @@ module fluxConfiguration 'br:bicep/modules/kubernetes-configuration.flux-configu "timeoutInSeconds": 180, "url": "https://github.com/mspnp/aks-baseline" } - }, - "kustomizations": { - "value": { - "unified": { - "dependsOn": [], - "force": false, - "path": "./cluster-manifests", - "prune": true, - "syncIntervalInSeconds": 300, - "timeoutInSeconds": 300 - } - } } } } @@ -228,6 +262,16 @@ module fluxConfiguration 'br:bicep/modules/kubernetes-configuration.flux-configu params: { // Required parameters clusterName: '' + kustomizations: { + unified: { + dependsOn: [] + force: false + path: './cluster-manifests' + prune: true + syncIntervalInSeconds: 300 + timeoutInSeconds: 300 + } + } name: 'kcfcwaf001' namespace: 'flux-system' sourceKind: 'GitRepository' @@ -242,16 +286,6 @@ module fluxConfiguration 'br:bicep/modules/kubernetes-configuration.flux-configu timeoutInSeconds: 180 url: 'https://github.com/mspnp/aks-baseline' } - kustomizations: { - unified: { - dependsOn: [] - force: false - path: './cluster-manifests' - prune: true - syncIntervalInSeconds: 300 - timeoutInSeconds: 300 - } - } } } ``` @@ -272,6 +306,18 @@ module fluxConfiguration 'br:bicep/modules/kubernetes-configuration.flux-configu "clusterName": { "value": "" }, + "kustomizations": { + "value": { + "unified": { + "dependsOn": [], + "force": false, + "path": "./cluster-manifests", + "prune": true, + "syncIntervalInSeconds": 300, + "timeoutInSeconds": 300 + } + } + }, "name": { "value": "kcfcwaf001" }, @@ -295,18 +341,6 @@ module fluxConfiguration 'br:bicep/modules/kubernetes-configuration.flux-configu "timeoutInSeconds": 180, "url": "https://github.com/mspnp/aks-baseline" } - }, - "kustomizations": { - "value": { - "unified": { - "dependsOn": [], - "force": false, - "path": "./cluster-manifests", - "prune": true, - "syncIntervalInSeconds": 300, - "timeoutInSeconds": 300 - } - } } } } @@ -323,6 +357,7 @@ module fluxConfiguration 'br:bicep/modules/kubernetes-configuration.flux-configu | Parameter | Type | Description | | :-- | :-- | :-- | | [`clusterName`](#parameter-clustername) | string | The name of the AKS cluster that should be configured. | +| [`kustomizations`](#parameter-kustomizations) | object | Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. | | [`name`](#parameter-name) | string | The name of the Flux Configuration. | | [`namespace`](#parameter-namespace) | string | The namespace to which this configuration is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. | | [`scope`](#parameter-scope) | string | Scope at which the configuration will be installed. | @@ -336,7 +371,6 @@ module fluxConfiguration 'br:bicep/modules/kubernetes-configuration.flux-configu | [`configurationProtectedSettings`](#parameter-configurationprotectedsettings) | secureObject | Key-value pairs of protected configuration settings for the configuration. | | [`enableDefaultTelemetry`](#parameter-enabledefaulttelemetry) | bool | Enable telemetry via a Globally Unique Identifier (GUID). | | [`gitRepository`](#parameter-gitrepository) | object | Parameters to reconcile to the GitRepository source kind type. | -| [`kustomizations`](#parameter-kustomizations) | object | Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. | | [`location`](#parameter-location) | string | Location for all resources. | | [`suspend`](#parameter-suspend) | bool | Whether this configuration should suspend its reconciliation of its kustomizations and sources. | @@ -377,9 +411,8 @@ Parameters to reconcile to the GitRepository source kind type. ### Parameter: `kustomizations` Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. -- Required: No +- Required: Yes - Type: object -- Default: `{}` ### Parameter: `location` diff --git a/modules/kubernetes-configuration/flux-configuration/main.bicep b/modules/kubernetes-configuration/flux-configuration/main.bicep index 8e10734dae..cc2a29c4d0 100644 --- a/modules/kubernetes-configuration/flux-configuration/main.bicep +++ b/modules/kubernetes-configuration/flux-configuration/main.bicep @@ -24,8 +24,8 @@ param configurationProtectedSettings object = {} @description('Optional. Parameters to reconcile to the GitRepository source kind type.') param gitRepository object = {} -@description('Optional. Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster.') -param kustomizations object = {} +@description('Required. Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster.') +param kustomizations object @description('Required. The namespace to which this configuration is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only.') param namespace string @@ -63,14 +63,14 @@ resource managedCluster 'Microsoft.ContainerService/managedClusters@2022-07-01' name: clusterName } -resource fluxConfiguration 'Microsoft.KubernetesConfiguration/fluxConfigurations@2022-03-01' = { +resource fluxConfiguration 'Microsoft.KubernetesConfiguration/fluxConfigurations@2023-05-01' = { name: name scope: managedCluster properties: { bucket: !empty(bucket) ? bucket : null configurationProtectedSettings: !empty(configurationProtectedSettings) ? configurationProtectedSettings : {} gitRepository: !empty(gitRepository) ? gitRepository : null - kustomizations: !empty(kustomizations) ? kustomizations : {} + kustomizations: kustomizations namespace: namespace scope: scope sourceKind: sourceKind diff --git a/modules/kubernetes-configuration/flux-configuration/main.json b/modules/kubernetes-configuration/flux-configuration/main.json index 31cd5d44ab..e8e9b2bf1d 100644 --- a/modules/kubernetes-configuration/flux-configuration/main.json +++ b/modules/kubernetes-configuration/flux-configuration/main.json @@ -5,7 +5,7 @@ "_generator": { "name": "bicep", "version": "0.23.1.45101", - "templateHash": "8985718648814286209" + "templateHash": "10031296768791737313" }, "name": "Kubernetes Configuration Flux Configurations", "description": "This module deploys a Kubernetes Configuration Flux Configuration.", @@ -61,9 +61,8 @@ }, "kustomizations": { "type": "object", - "defaultValue": {}, "metadata": { - "description": "Optional. Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster." + "description": "Required. Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster." } }, "namespace": { @@ -117,14 +116,14 @@ }, { "type": "Microsoft.KubernetesConfiguration/fluxConfigurations", - "apiVersion": "2022-03-01", + "apiVersion": "2023-05-01", "scope": "[format('Microsoft.ContainerService/managedClusters/{0}', parameters('clusterName'))]", "name": "[parameters('name')]", "properties": { "bucket": "[if(not(empty(parameters('bucket'))), parameters('bucket'), null())]", "configurationProtectedSettings": "[if(not(empty(parameters('configurationProtectedSettings'))), parameters('configurationProtectedSettings'), createObject())]", "gitRepository": "[if(not(empty(parameters('gitRepository'))), parameters('gitRepository'), null())]", - "kustomizations": "[if(not(empty(parameters('kustomizations'))), parameters('kustomizations'), createObject())]", + "kustomizations": "[parameters('kustomizations')]", "namespace": "[parameters('namespace')]", "scope": "[parameters('scope')]", "sourceKind": "[parameters('sourceKind')]", diff --git a/modules/kubernetes-configuration/flux-configuration/tests/e2e/defaults/main.test.bicep b/modules/kubernetes-configuration/flux-configuration/tests/e2e/defaults/main.test.bicep index 1e633b5bd0..55fa46533f 100644 --- a/modules/kubernetes-configuration/flux-configuration/tests/e2e/defaults/main.test.bicep +++ b/modules/kubernetes-configuration/flux-configuration/tests/e2e/defaults/main.test.bicep @@ -68,5 +68,21 @@ module testDeployment '../../../main.bicep' = [for iteration in [ 'init', 'idem' timeoutInSeconds: 180 url: 'https://github.com/mspnp/aks-baseline' } + kustomizations: { + unified: { + dependsOn: [] + force: false + path: './cluster-manifests' + prune: true + syncIntervalInSeconds: 300 + timeoutInSeconds: 300 + postBuild: { + substitute: { + TEST_VAR1: 'foo' + TEST_VAR2: 'bar' + } + } + } + } } }]