-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ApplicationSet for Cluster API operator (#21)
Co-authored-by: David Tesar <david.tesar@microsoft.com>
- Loading branch information
Showing
8 changed files
with
222 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
gitops/bootstrap/control-plane/addons/azure/addons-azure-cluster-api-operator.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: ApplicationSet | ||
metadata: | ||
name: addons-cluster-api | ||
spec: | ||
syncPolicy: | ||
preserveResourcesOnDeletion: true | ||
generators: | ||
- merge: | ||
mergeKeys: [server] | ||
generators: | ||
- clusters: | ||
values: | ||
addonChart: cluster-api-operator | ||
addonChartNamespace: capi-operator-system | ||
addonChartVersion: 0.9.0 | ||
addonChartRepository: https://kubernetes-sigs.github.io/cluster-api-operator | ||
selector: | ||
matchExpressions: | ||
- key: akuity.io/argo-cd-cluster-name | ||
operator: NotIn | ||
values: [in-cluster] | ||
- key: enable_cluster_api_operator | ||
operator: In | ||
values: ['true'] | ||
- clusters: | ||
selector: | ||
matchLabels: | ||
environment: staging | ||
values: | ||
addonChartVersion: 0.9.0 | ||
- clusters: | ||
selector: | ||
matchLabels: | ||
environment: prod | ||
values: | ||
addonChartVersion: 0.9.0 | ||
template: | ||
metadata: | ||
name: addon-{{name}}-{{values.addonChart}} | ||
spec: | ||
project: default | ||
sources: | ||
- repoURL: '{{metadata.annotations.addons_repo_url}}' | ||
targetRevision: '{{metadata.annotations.addons_repo_revision}}' | ||
path: '{{metadata.annotations.addons_repo_basepath}}hooks/sleep' | ||
- repoURL: '{{metadata.annotations.addons_repo_url}}' | ||
targetRevision: '{{metadata.annotations.addons_repo_revision}}' | ||
ref: values | ||
- chart: '{{values.addonChart}}' | ||
repoURL: '{{values.addonChartRepository}}' | ||
targetRevision: '{{values.addonChartVersion}}' | ||
helm: | ||
releaseName: '{{values.addonChart}}' | ||
ignoreMissingValueFiles: true | ||
valueFiles: | ||
- $values/{{metadata.annotations.addons_repo_basepath}}environments/default/addons/{{values.addonChart}}/values.yaml | ||
- $values/{{metadata.annotations.addons_repo_basepath}}environments/{{metadata.labels.environment}}/addons/{{values.addonChart}}/values.yaml | ||
- $values/{{metadata.annotations.addons_repo_basepath}}environments/clusters/{{name}}/addons/{{values.addonChart}}/values.yaml | ||
destination: | ||
namespace: '{{values.addonChartNamespace}}' | ||
name: '{{name}}' | ||
syncPolicy: | ||
retry: | ||
limit: 5 | ||
automated: {} | ||
syncOptions: | ||
- CreateNamespace=true | ||
- ServerSideApply=true | ||
ignoreDifferences: | ||
- group: apiextensions.k8s.io | ||
kind: CustomResourceDefinition | ||
jqPathExpressions: | ||
- '.spec.conversion.webhook.clientConfig.caBundle' | ||
|
79 changes: 79 additions & 0 deletions
79
gitops/bootstrap/control-plane/addons/azure/addons-cert-manager-appset.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
--- | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: ApplicationSet | ||
metadata: | ||
name: addons-cert-manager | ||
spec: | ||
syncPolicy: | ||
preserveResourcesOnDeletion: true | ||
generators: | ||
- merge: | ||
mergeKeys: [server] | ||
generators: | ||
- clusters: | ||
values: | ||
addonChart: cert-manager | ||
# anything not staging or prod use this version | ||
addonChartVersion: v1.14.2 | ||
addonChartRepository: https://charts.jetstack.io | ||
selector: | ||
matchExpressions: | ||
- key: akuity.io/argo-cd-cluster-name | ||
operator: NotIn | ||
values: [in-cluster] | ||
- key: enable_cert_manager | ||
operator: In | ||
values: ['true'] | ||
- clusters: | ||
selector: | ||
matchLabels: | ||
environment: staging | ||
values: | ||
addonChartVersion: v1.14.2 | ||
- clusters: | ||
selector: | ||
matchLabels: | ||
environment: prod | ||
values: | ||
addonChartVersion: v1.14.2 | ||
template: | ||
metadata: | ||
name: addon-{{name}}-{{values.addonChart}} | ||
spec: | ||
project: default | ||
sources: | ||
- repoURL: '{{metadata.annotations.addons_repo_url}}' | ||
targetRevision: '{{metadata.annotations.addons_repo_revision}}' | ||
ref: values | ||
- chart: '{{values.addonChart}}' | ||
repoURL: '{{values.addonChartRepository}}' | ||
targetRevision: '{{values.addonChartVersion}}' | ||
helm: | ||
releaseName: '{{values.addonChart}}' | ||
ignoreMissingValueFiles: true | ||
valueFiles: | ||
- $values/{{metadata.annotations.addons_repo_basepath}}environments/default/addons/{{values.addonChart}}/values.yaml | ||
- $values/{{metadata.annotations.addons_repo_basepath}}environments/{{metadata.labels.environment}}/addons/{{values.addonChart}}/values.yaml | ||
- $values/{{metadata.annotations.addons_repo_basepath}}clusters/{{name}}/addons/{{values.addonChart}}/values.yaml | ||
values: | | ||
installCRDs: true | ||
# fileParameters: | ||
# - name: | ||
# path: | ||
# parameters | ||
# values | ||
# valuesObject | ||
destination: | ||
namespace: 'cert-manager' | ||
name: '{{name}}' | ||
syncPolicy: | ||
automated: {} | ||
syncOptions: | ||
- CreateNamespace=true | ||
- ServerSideApply=true # Big CRDs. | ||
ignoreDifferences: | ||
- group: admissionregistration.k8s.io | ||
kind: ValidatingWebhookConfiguration | ||
# Azure adding "control-plane" and "kubernetes.azure.com/managedby" keys to the webhook configuration. | ||
jqPathExpressions: | ||
- '.webhooks[].namespaceSelector.matchExpressions' |
13 changes: 13 additions & 0 deletions
13
gitops/environments/default/addons/cluster-api-operator/values.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
addon: helm | ||
infrastructure: "azure:v1.13.2" | ||
manager: | ||
featureGates: | ||
MachinePool: true | ||
ClusterResourceSet: true | ||
ClusterTopology: true | ||
cert-manager: | ||
enabled: false | ||
installCRDs: false | ||
#configSecret: | ||
# name: | ||
# namespace: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
generateName: sleep- | ||
annotations: | ||
argocd.argoproj.io/hook: PreSync | ||
argocd.argoproj.io/hook-delete-policy: HookSucceeded | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: sleep | ||
image: busybox | ||
command: | ||
- "sleep" | ||
- "120" | ||
restartPolicy: Never | ||
backoffLimit: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
resource "azurerm_user_assigned_identity" "capz" { | ||
count = try(var.addons.enable_cluster_api_operator, false) ? 1 : 0 | ||
name = "capz" | ||
resource_group_name = azurerm_resource_group.this.name | ||
location = azurerm_resource_group.this.location | ||
} | ||
|
||
resource "azurerm_role_assignment" "capz_role_assignment" { | ||
count = try(var.addons.enable_cluster_api_operator, false) ? 1 : 0 | ||
scope = azurerm_resource_group.this.id | ||
role_definition_name = "Owner" | ||
principal_id = azurerm_user_assigned_identity.capz[0].principal_id | ||
} | ||
|
||
resource "azurerm_federated_identity_credential" "capz" { | ||
count = try(var.addons.enable_cluster_api_operator, false) ? 1 : 0 | ||
depends_on = [module.aks] | ||
name = "capz-manager-credential" | ||
resource_group_name = azurerm_resource_group.this.name | ||
audience = ["api://AzureADTokenExchange"] | ||
issuer = module.aks.oidc_issuer_url | ||
parent_id = azurerm_user_assigned_identity.capz[0].id | ||
subject = "system:serviceaccount:azure-infrastructure-system:capz-manager" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters