Skip to content

Commit

Permalink
[Modules] Updated KubernetesConfiguration/FluxConfigurations to new d…
Browse files Browse the repository at this point in the history
…ependency approach (#1828)

* [Modules] Updated KubernetesConfiguration/FluxConfigurations to new dependency approach

* Update to latest

* Update to latest

* Updated folder default to common.

* Update to latest

* Update to latest

* Update to latest

* Update modules/Microsoft.KubernetesConfiguration/fluxConfigurations/.test/common/deploy.test.bicep

* Update modules/Microsoft.KubernetesConfiguration/fluxConfigurations/.test/min/deploy.test.bicep
  • Loading branch information
AlexanderSehr authored Sep 25, 2022
1 parent 842330c commit cfd4b3d
Show file tree
Hide file tree
Showing 8 changed files with 263 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ jobs:
- name: 'Using test file [${{ matrix.moduleTestFilePaths }}]'
uses: ./.github/actions/templates/validateModuleDeployment
with:
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
parameterFilePath: '${{ env.modulePath }}/${{ matrix.moduleTestFilePaths }}'
templateFilePath: '${{ env.modulePath }}/${{ matrix.moduleTestFilePaths }}'
location: '${{ env.location }}'
resourceGroupName: '${{ env.resourceGroupName }}'
subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@description('Optional. The location to deploy resources to.')
param location string = resourceGroup().location

@description('Required. The name of the AKS cluster to create.')
param clusterName string

@description('Required. The name of the AKS cluster extension to create.')
param clusterExtensionName string

@description('Required. The name of the AKS cluster nodes resource group to create.')
param clusterNodeResourceGroupName string

resource cluster 'Microsoft.ContainerService/managedClusters@2022-06-01' = {
name: clusterName
location: location
identity: {
type: 'SystemAssigned'
}
properties: {
dnsPrefix: clusterName
nodeResourceGroup: clusterNodeResourceGroupName
agentPoolProfiles: [
{
name: 'agentpool'
count: 1
vmSize: 'Standard_DS2_v2'
osType: 'Linux'
mode: 'System'
}
]
}
}

resource extension 'Microsoft.KubernetesConfiguration/extensions@2022-03-01' = {
scope: cluster
name: clusterExtensionName
properties: {
extensionType: 'microsoft.flux'
releaseTrain: 'Stable'
scope: {
cluster: {
releaseNamespace: 'flux-system'
}
}
}
}

@description('The name of the created AKS cluster.')
output clusterName string = cluster.name
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
targetScope = 'subscription'

// ========== //
// Parameters //
// ========== //
@description('Optional. The name of the resource group to deploy for testing purposes.')
@maxLength(90)
param resourceGroupName string = 'ms.kubernetesconfiguration.fluxconfigurations-${serviceShort}-rg'

@description('Optional. The location to deploy resources to.')
param location string = deployment().location

@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints.')
param serviceShort string = 'kcfccom'

// =========== //
// Deployments //
// =========== //

// General resources
// =================
resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: resourceGroupName
location: location
}

module resourceGroupResources 'dependencies.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, location)}-paramNested'
params: {
clusterName: 'dep-carml-aks-${serviceShort}'
clusterExtensionName: '<<namePrefix>>${serviceShort}001'
clusterNodeResourceGroupName: 'nodes-${resourceGroupName}'
}
}

// ============== //
// Test Execution //
// ============== //

module testDeployment '../../deploy.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name)}-test-${serviceShort}'
params: {
name: '<<namePrefix>>${serviceShort}001'
clusterName: resourceGroupResources.outputs.clusterName
namespace: 'flux-system'
scope: 'cluster'
sourceKind: 'GitRepository'
gitRepository: {
repositoryRef: {
branch: 'main'
}
sshKnownHosts: ''
syncIntervalInSeconds: 300
timeoutInSeconds: 180
url: 'https://github.com/mspnp/aks-baseline'
}
kustomizations: {
unified: {
dependsOn: []
force: false
path: './cluster-manifests'
prune: true
syncIntervalInSeconds: 300
timeoutInSeconds: 300
}
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@description('Optional. The location to deploy resources to.')
param location string = resourceGroup().location

@description('Required. The name of the AKS cluster to create.')
param clusterName string

@description('Required. The name of the AKS cluster extension to create.')
param clusterExtensionName string

@description('Required. The name of the AKS cluster nodes resource group to create.')
param clusterNodeResourceGroupName string

resource cluster 'Microsoft.ContainerService/managedClusters@2022-06-01' = {
name: clusterName
location: location
identity: {
type: 'SystemAssigned'
}
properties: {
dnsPrefix: clusterName
nodeResourceGroup: clusterNodeResourceGroupName
agentPoolProfiles: [
{
name: 'agentpool'
count: 1
vmSize: 'Standard_DS2_v2'
osType: 'Linux'
mode: 'System'
}
]
}
}

resource extension 'Microsoft.KubernetesConfiguration/extensions@2022-03-01' = {
scope: cluster
name: clusterExtensionName
properties: {
extensionType: 'microsoft.flux'
releaseTrain: 'Stable'
scope: {
cluster: {
releaseNamespace: 'flux-system'
}
}
}
}

@description('The name of the created AKS cluster.')
output clusterName string = cluster.name
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
targetScope = 'subscription'

// ========== //
// Parameters //
// ========== //
@description('Optional. The name of the resource group to deploy for testing purposes.')
@maxLength(90)
param resourceGroupName string = 'ms.kubernetesconfiguration.fluxconfigurations-${serviceShort}-rg'

@description('Optional. The location to deploy resources to.')
param location string = deployment().location

@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints.')
param serviceShort string = 'kcfcmin'

// =========== //
// Deployments //
// =========== //

// General resources
// =================
resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: resourceGroupName
location: location
}

module resourceGroupResources 'dependencies.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, location)}-paramNested'
params: {
clusterName: 'dep-carml-aks-${serviceShort}'
clusterExtensionName: '<<namePrefix>>${serviceShort}001'
clusterNodeResourceGroupName: 'nodes-${resourceGroupName}'
}
}

// ============== //
// Test Execution //
// ============== //

module testDeployment '../../deploy.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name)}-test-${serviceShort}'
params: {
name: '<<namePrefix>>${serviceShort}001'
clusterName: resourceGroupResources.outputs.clusterName
namespace: 'flux-system'
scope: 'cluster'
sourceKind: 'GitRepository'
gitRepository: {
repositoryRef: {
branch: 'main'
}
sshKnownHosts: ''
syncIntervalInSeconds: 300
timeoutInSeconds: 180
url: 'https://github.com/mspnp/aks-baseline'
}
}
}

This file was deleted.

Loading

0 comments on commit cfd4b3d

Please sign in to comment.