Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
bc4d672
Adding flux extension
MariusStorhaug Feb 9, 2023
e843b2e
move other tests for speed
MariusStorhaug Feb 9, 2023
696d1b3
removed reade refs to other tests
MariusStorhaug Feb 9, 2023
7cd43d3
min test
MariusStorhaug Feb 9, 2023
34b69cb
update readme
MariusStorhaug Feb 9, 2023
e5c8a0f
test minimal fluxconfig
MariusStorhaug Feb 9, 2023
4cb6d80
enable commit/branch based CI
MariusStorhaug Feb 9, 2023
fa14636
*Test flux ext + config
MariusStorhaug Feb 9, 2023
e942898
restore workflow file
MariusStorhaug Feb 9, 2023
0a81b78
fix for flux config
MariusStorhaug Feb 9, 2023
f02301d
fix for defaults
MariusStorhaug Feb 9, 2023
8794a3d
fix flux config name
MariusStorhaug Feb 9, 2023
f991f19
added flux settings and configurations
MariusStorhaug Feb 9, 2023
5bd3564
fix config name
MariusStorhaug Feb 9, 2023
8b664ac
refresh readme
MariusStorhaug Feb 9, 2023
1eaf247
Merge branch 'main' of https://github.com/Azure/ResourceModules into …
MariusStorhaug Feb 9, 2023
629db00
shorter name
MariusStorhaug Feb 9, 2023
e830603
fix readme
MariusStorhaug Feb 9, 2023
7229cef
fixing deployment names/lengths
MariusStorhaug Feb 9, 2023
fe00284
moving tests back
MariusStorhaug Feb 9, 2023
620ec80
refreshing readme
MariusStorhaug Feb 9, 2023
156ebb5
Update modules/Microsoft.ContainerService/managedClusters/deploy.bicep
Feb 10, 2023
ac802b3
Added flux configuration settings and fixed dependsOn
MariusStorhaug Feb 10, 2023
41ee43a
refreshed docs
MariusStorhaug Feb 10, 2023
49d0a69
renamed test minfluxdouble to flux with more features
MariusStorhaug Feb 10, 2023
60d1e89
refresh
MariusStorhaug Feb 10, 2023
447d016
Merge branch 'main' of https://github.com/Azure/ResourceModules into …
MariusStorhaug Feb 11, 2023
a4057f3
added secure to fluxConfigurationProtectedSettings
MariusStorhaug Feb 11, 2023
29f2435
remove the minflux test
MariusStorhaug Feb 11, 2023
157fde5
update readme
MariusStorhaug Feb 11, 2023
dfab334
added some params
MariusStorhaug Feb 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
targetScope = 'subscription'

// ========== //
// Parameters //
// ========== //

@description('Optional. The name of the resource group to deploy for testing purposes.')
@maxLength(90)
param resourceGroupName string = 'ms.containerservice.managedclusters-${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 = 'csmmf2'

@description('Optional. Enable telemetry via a Globally Unique Identifier (GUID).')
param enableDefaultTelemetry bool = true

// ============ //
// Dependencies //
// ============ //

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

module testDeployment '../../deploy.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, location)}-test-${serviceShort}'
params: {
name: '${serviceShort}001'
enableDefaultTelemetry: enableDefaultTelemetry
systemAssignedIdentity: true
primaryAgentPoolProfile: [
{
name: 'systempool'
count: 1
vmSize: 'Standard_DS2_v2'
mode: 'System'
}
]
fluxReleaseTrain: 'Stable'
fluxVersion: ''
fluxConfigurationProtectedSettings: {}
fluxConfigurationSettings: {
'helm-controller.enabled': 'true'
'source-controller.enabled': 'true'
'kustomize-controller.enabled': 'true'
'notification-controller.enabled': 'true'
'image-automation-controller.enabled': 'false'
'image-reflector-controller.enabled': 'false'
}
fluxConfigurations: [
{
namespace: 'flux-system'
scope: 'cluster'
gitRepository: {
repositoryRef: {
branch: 'main'
}
sshKnownHosts: ''
syncIntervalInSeconds: 300
timeoutInSeconds: 180
url: 'https://github.com/mspnp/aks-baseline'
}
}
{
namespace: 'flux-system-helm'
scope: 'cluster'
gitRepository: {
repositoryRef: {
branch: 'main'
}
sshKnownHosts: ''
syncIntervalInSeconds: 300
timeoutInSeconds: 180
url: 'https://github.com/Azure/gitops-flux2-kustomize-helm-mt'
}
kustomizations: {
infra: {
path: './infrastructure'
dependsOn: []
timeoutInSeconds: 600
syncIntervalInSeconds: 600
validation: 'none'
prune: true
}
apps: {
path: './apps/staging'
dependsOn: [
{
kustomizationName: 'infra'
}
]
timeoutInSeconds: 600
syncIntervalInSeconds: 600
retryIntervalInSeconds: 600
prune: true
}
}
}
]
}
}
52 changes: 52 additions & 0 deletions modules/Microsoft.ContainerService/managedClusters/deploy.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,22 @@ param tags object = {}
@description('Optional. The resource ID of the disc encryption set to apply to the cluster. For security reasons, this value should be provided.')
param diskEncryptionSetID string = ''

@description('Optional. ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is "true".')
param fluxReleaseTrain string = 'Stable'

@description('Optional. Version of the extension for this extension, if it is "pinned" to a specific version.')
param fluxVersion string = ''

@description('Optional. Configuration settings that are sensitive, as name-value pairs for configuring this extension.')
@secure()
param fluxConfigurationProtectedSettings object = {}

@description('Optional. Configuration settings, as name-value pairs for configuring this extension.')
param fluxConfigurationSettings object = {}

@description('Optional. A list of flux configuraitons.')
param fluxConfigurations array = []

@description('Optional. The name of logs that will be streamed. "allLogs" includes all possible logs for the resource.')
@allowed([
'allLogs'
Expand Down Expand Up @@ -553,6 +569,42 @@ module managedCluster_agentPools 'agentPools/deploy.bicep' = [for (agentPool, in
}
}]

module managedCluster_extension '../../Microsoft.KubernetesConfiguration/extensions/deploy.bicep' = if (!empty(fluxConfigurations)) {
name: '${uniqueString(deployment().name, location)}-ManagedCluster-FluxExtension'
params: {
clusterName: managedCluster.name
configurationProtectedSettings: !empty(fluxConfigurationProtectedSettings) ? fluxConfigurationProtectedSettings : {}
configurationSettings: !empty(fluxConfigurationSettings) ? fluxConfigurationSettings : {}
enableDefaultTelemetry: enableReferencedModulesTelemetry
extensionType: 'microsoft.flux'
location: location
name: 'flux'
releaseNamespace: 'flux-system'
releaseTrain: !empty(fluxReleaseTrain) ? fluxReleaseTrain : 'Stable'
version: !empty(fluxVersion) ? fluxVersion : ''
}
}

module managedCluster_fluxConfiguration '../../Microsoft.KubernetesConfiguration/fluxConfigurations/deploy.bicep' = [for (fluxConfiguration, index) in fluxConfigurations: {
name: '${uniqueString(deployment().name, location)}-ManagedCluster-FluxConfiguration${index}'
params: {
bucket: contains(fluxConfiguration, 'bucket') ? fluxConfiguration.bucket : {}
clusterName: managedCluster.name
configurationProtectedSettings: contains(fluxConfiguration, 'configurationProtectedSettings') ? fluxConfiguration.configurationProtectedSettings : {}
enableDefaultTelemetry: enableDefaultTelemetry
gitRepository: contains(fluxConfiguration, 'gitRepository') ? fluxConfiguration.gitRepository : {}
kustomizations: contains(fluxConfiguration, 'kustomizations') ? fluxConfiguration.kustomizations : {}
name: contains(fluxConfiguration, 'name') ? fluxConfiguration.name : toLower('${managedCluster.name}-fluxconfiguration${index}')
namespace: fluxConfiguration.namespace
scope: fluxConfiguration.scope
sourceKind: contains(fluxConfiguration, 'gitRepository') ? 'GitRepository' : 'Bucket'
suspend: contains(fluxConfiguration, 'suspend') ? fluxConfiguration.suspend : false
}
dependsOn: [
managedCluster_extension
]
}]

resource managedCluster_lock 'Microsoft.Authorization/locks@2020-05-01' = if (!empty(lock)) {
name: '${managedCluster.name}-${lock}-lock'
properties: {
Expand Down
Loading