From b5feb0f8dc9bc2fd3c63b05ca2f25f0ff72276ea Mon Sep 17 00:00:00 2001 From: Asad Arif Date: Mon, 23 Oct 2023 10:07:58 +0100 Subject: [PATCH 1/4] Updated flux configuration version to 2023-05-01 --- .../flux-configuration/.test/common/main.test.bicep | 6 ++++++ .../kubernetes-configuration/flux-configuration/main.bicep | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/kubernetes-configuration/flux-configuration/.test/common/main.test.bicep b/modules/kubernetes-configuration/flux-configuration/.test/common/main.test.bicep index 4f1883372b..f1f79b5ffa 100644 --- a/modules/kubernetes-configuration/flux-configuration/.test/common/main.test.bicep +++ b/modules/kubernetes-configuration/flux-configuration/.test/common/main.test.bicep @@ -75,6 +75,12 @@ module testDeployment '../../main.bicep' = { prune: true syncIntervalInSeconds: 300 timeoutInSeconds: 300 + postBuild: { + substitute: { + TEST_VAR1: 'foo' + TEST_VAR2: 'bar' + } + } } } } diff --git a/modules/kubernetes-configuration/flux-configuration/main.bicep b/modules/kubernetes-configuration/flux-configuration/main.bicep index 8e10734dae..79d88b7f4d 100644 --- a/modules/kubernetes-configuration/flux-configuration/main.bicep +++ b/modules/kubernetes-configuration/flux-configuration/main.bicep @@ -63,7 +63,7 @@ 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: { From 2216a1633fed4193b7c5340d7562bea203b52190 Mon Sep 17 00:00:00 2001 From: aadev1 Date: Thu, 16 Nov 2023 20:36:20 +0000 Subject: [PATCH 2/4] Update readme and generate main.json --- .../flux-configuration/README.md | 14 +++++++++++++- .../flux-configuration/main.json | 6 +++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/modules/kubernetes-configuration/flux-configuration/README.md b/modules/kubernetes-configuration/flux-configuration/README.md index 4920286fde..70996a0689 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 @@ -64,6 +64,12 @@ module fluxConfiguration 'br:bicep/modules/kubernetes-configuration.flux-configu dependsOn: [] force: false path: './cluster-manifests' + postBuild: { + substitute: { + TEST_VAR1: 'foo' + TEST_VAR2: 'bar' + } + } prune: true syncIntervalInSeconds: 300 timeoutInSeconds: 300 @@ -119,6 +125,12 @@ module fluxConfiguration 'br:bicep/modules/kubernetes-configuration.flux-configu "dependsOn": [], "force": false, "path": "./cluster-manifests", + "postBuild": { + "substitute": { + "TEST_VAR1": "foo", + "TEST_VAR2": "bar" + } + }, "prune": true, "syncIntervalInSeconds": 300, "timeoutInSeconds": 300 diff --git a/modules/kubernetes-configuration/flux-configuration/main.json b/modules/kubernetes-configuration/flux-configuration/main.json index 252df520e1..79a9dd671c 100644 --- a/modules/kubernetes-configuration/flux-configuration/main.json +++ b/modules/kubernetes-configuration/flux-configuration/main.json @@ -4,8 +4,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.22.6.54827", - "templateHash": "6686104224333946371" + "version": "0.23.1.45101", + "templateHash": "15411864534688203291" }, "name": "Kubernetes Configuration Flux Configurations", "description": "This module deploys a Kubernetes Configuration Flux Configuration.", @@ -117,7 +117,7 @@ }, { "type": "Microsoft.KubernetesConfiguration/fluxConfigurations", - "apiVersion": "2022-03-01", + "apiVersion": "2023-05-01", "scope": "[format('Microsoft.ContainerService/managedClusters/{0}', parameters('clusterName'))]", "name": "[parameters('name')]", "properties": { From 91a6108f4b14b074542e65821e66e5e7b2d31c19 Mon Sep 17 00:00:00 2001 From: Asad Arif Date: Tue, 21 Nov 2023 14:43:31 +0000 Subject: [PATCH 3/4] Add kustomization settings to tests --- .../extension/tests/e2e/max/main.test.bicep | 10 ++++++++++ .../extension/tests/e2e/waf-aligned/main.test.bicep | 10 ++++++++++ .../flux-configuration/main.bicep | 6 +++--- 3 files changed, 23 insertions(+), 3 deletions(-) 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/main.bicep b/modules/kubernetes-configuration/flux-configuration/main.bicep index 79d88b7f4d..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 @@ -70,7 +70,7 @@ resource fluxConfiguration 'Microsoft.KubernetesConfiguration/fluxConfigurations 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 From 67e5480456db032253be494fec8e7fcbb6339c7d Mon Sep 17 00:00:00 2001 From: aadev1 Date: Tue, 21 Nov 2023 14:57:38 +0000 Subject: [PATCH 4/4] Update readme and generate main.json --- .../flux-configuration/README.md | 127 +++++++++++------- .../flux-configuration/main.json | 9 +- 2 files changed, 84 insertions(+), 52 deletions(-) diff --git a/modules/kubernetes-configuration/flux-configuration/README.md b/modules/kubernetes-configuration/flux-configuration/README.md index d376173089..2da23ceb45 100644 --- a/modules/kubernetes-configuration/flux-configuration/README.md +++ b/modules/kubernetes-configuration/flux-configuration/README.md @@ -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.json b/modules/kubernetes-configuration/flux-configuration/main.json index 6c42b3b0f5..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": { @@ -124,7 +123,7 @@ "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')]", @@ -155,4 +154,4 @@ "value": "[resourceGroup().name]" } } -} +} \ No newline at end of file