This repository was archived by the owner on Dec 10, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 12 files changed +286
-0
lines changed
Expand file tree Collapse file tree 12 files changed +286
-0
lines changed Original file line number Diff line number Diff line change 1+ # AKS Cluster Example
2+
3+ This example demonstrates how to provision an AKS cluster using Crossplane v1.
4+
5+ ## Prerequisites
6+
7+ - Kubernetes cluster (v1.31+)
8+ - Helm v3.x
9+
10+ ## Install Crossplane v1 via Helm
11+
12+ 1 . ** Add the Crossplane Helm repository:**
13+ ``` sh
14+ helm repo add crossplane-stable https://charts.crossplane.io/stable
15+ helm repo update
16+ ```
17+
18+ 2. ** Install Crossplane v1:**
19+ ` ` ` sh
20+ helm install crossplane --namespace crossplane-system --create-namespace crossplane-stable/crossplane --version 1.x.x
21+ ` ` `
22+ Replace ` 1.x.x` with the desired Crossplane v1 release.
23+
24+ 3. ** Verify installation:**
25+ ` ` ` sh
26+ kubectl get pods -n crossplane-system
27+ ` ` `
28+
29+ 4. ** Apply the manifests:**
30+ ` ` ` sh
31+ ./install.sh
32+ ` ` `
Original file line number Diff line number Diff line change 1+ apiVersion : pkg.crossplane.io/v1
2+ kind : Function
3+ metadata :
4+ name : function-pythonic
5+ spec :
6+ package : ghcr.io/fortra/function-pythonic:v0.0.8
7+ runtimeConfigRef :
8+ name : function-pythonic
9+ ---
10+ apiVersion : pkg.crossplane.io/v1beta1
11+ kind : DeploymentRuntimeConfig
12+ metadata :
13+ name : function-pythonic
14+ spec :
15+ deploymentTemplate :
16+ spec :
17+ selector : {}
18+ template :
19+ spec :
20+ containers :
21+ - name : package-runtime
22+ args :
23+ - --debug
24+ - --packages
25+ - --packages-namespace=crossplane-system
26+ serviceAccountName : function-pythonic
27+ serviceAccountTemplate :
28+ metadata :
29+ name : function-pythonic
30+ ---
31+ apiVersion : rbac.authorization.k8s.io/v1
32+ kind : Role
33+ metadata :
34+ namespace : crossplane-system
35+ name : function-pythonic
36+ rules :
37+ - apiGroups :
38+ - ' '
39+ resources :
40+ - configmaps
41+ verbs :
42+ - list
43+ - watch
44+ - patch
45+ - apiGroups :
46+ - ' '
47+ resources :
48+ - events
49+ verbs :
50+ - create
51+ ---
52+ apiVersion : rbac.authorization.k8s.io/v1
53+ kind : RoleBinding
54+ metadata :
55+ namespace : crossplane-system
56+ name : function-pythonic
57+ roleRef :
58+ apiGroup : rbac.authorization.k8s.io
59+ kind : Role
60+ name : function-pythonic
61+ subjects :
62+ - kind : ServiceAccount
63+ name : function-pythonic
Original file line number Diff line number Diff line change 1+ apiVersion : apiextensions.crossplane.io/v1
2+ kind : Composition
3+ metadata :
4+ name : aks-cluster
5+ spec :
6+ compositeTypeRef :
7+ apiVersion : example.crossplane.io/v1
8+ kind : AzureKubernetesCluster
9+ mode : Pipeline
10+ pipeline :
11+ - step : create-resourcegroup
12+ functionRef :
13+ name : function-pythonic
14+ input :
15+ apiVersion : pythonic.fn.fortra.com/v1alpha1
16+ kind : Composite
17+ composite : resourcegroup.ResourceGroupComposite
18+ - step : create-aks-cluster
19+ functionRef :
20+ name : function-pythonic
21+ input :
22+ apiVersion : pythonic.fn.fortra.com/v1alpha1
23+ kind : Composite
24+ composite : kubernetescluster.KubernetesClusterComposite
Original file line number Diff line number Diff line change 1+ apiVersion : apiextensions.crossplane.io/v1
2+ kind : CompositeResourceDefinition
3+ metadata :
4+ name : azurekubernetesclusters.example.crossplane.io
5+ spec :
6+ group : example.crossplane.io
7+ names :
8+ kind : AzureKubernetesCluster
9+ plural : azurekubernetesclusters
10+ claimNames :
11+ kind : AzureKubernetesClusterClaim
12+ plural : azurekubernetesclusterclaims
13+ versions :
14+ - name : v1
15+ served : true
16+ referenceable : true
17+ schema :
18+ openAPIV3Schema :
19+ type : object
20+ properties :
21+ spec :
22+ type : object
23+ properties :
24+ defaultNodePool :
25+ type : object
26+ properties :
27+ autoScaling :
28+ type : object
29+ properties :
30+ enabled :
31+ type : boolean
32+ minCount :
33+ type : integer
34+ maxCount :
35+ type : integer
36+ nodeCount :
37+ type : integer
38+ vmSize :
39+ type : string
40+ resourceGroupName :
41+ type : string
42+ location :
43+ type : string
Original file line number Diff line number Diff line change 1+ apiVersion : pkg.crossplane.io/v1beta1
2+ kind : Function
3+ metadata :
4+ name : function-pythonic
5+ annotations :
6+ render.crossplane.io/runtime : Development
7+ spec :
8+ package : ghcr.io/fortra/function-pythonic:v0.0.8
9+ runtimeConfigRef :
10+ name : function-pythonic
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # Install function-pythonic and azure providers
4+ kubectl apply -f cluster-function-pythonic.yaml
5+ kubectl apply -f providers.yaml
6+
7+ # Install AKS Crossplane XRDs and Compositions
8+ kubectl apply -f definition.yaml
9+ # Wait for the generated CRDs to be created
10+ sleep 5
11+
12+ # Create the AKS cluster
13+ kubectl apply -k .
Original file line number Diff line number Diff line change 1+ from crossplane .pythonic import BaseComposite
2+
3+ class KubernetesClusterComposite (BaseComposite ):
4+ def compose (self ):
5+ labels = {'example.crossplane.io/AzureKubernetesCluster' : self .metadata .name }
6+ self .logger .info (f"Composing AKS cluster { self .metadata .name } " )
7+
8+ aks = self .resources .KubernetesCluster (
9+ 'containerservice.azure.upbound.io/v1beta2' , 'KubernetesCluster'
10+ )
11+ aks .metadata .name = self .metadata .name
12+ aks .metadata .labels = labels
13+
14+ aks .spec .forProvider .location = self .spec .location
15+ aks .spec .forProvider .resourceGroupNameRef .name = self .spec .resourceGroupName
16+ aks .spec .forProvider .identity .type = 'SystemAssigned'
17+
18+ if self .spec .defaultNodePool .autoScaling .enabled :
19+ aks .spec .forProvider .defaultNodePool .autoScalingEnabled = True
20+ aks .spec .forProvider .defaultNodePool .minCount = self .spec .defaultNodePool .autoScaling .minCount
21+ aks .spec .forProvider .defaultNodePool .maxCount = self .spec .defaultNodePool .autoScaling .maxCount
22+ else :
23+ aks .spec .forProvider .defaultNodePool .nodeCount = self .spec .nodeCount
24+
25+ aks .spec .forProvider .defaultNodePool .name = 'systempool1'
26+ aks .spec .forProvider .defaultNodePool .vmSize = self .spec .vmSize
27+ aks .spec .forProvider .dnsPrefix = self .metadata .name
28+
29+ self .status .aks = aks .status .endpoint
Original file line number Diff line number Diff line change 1+ apiVersion : kustomize.config.k8s.io/v1beta1
2+ kind : Kustomization
3+
4+ generatorOptions :
5+ disableNameSuffixHash : true
6+
7+ configMapGenerator :
8+
9+ - namespace : crossplane-system
10+ name : pythonic-aks
11+ options :
12+ labels :
13+ function-pythonic.package : ' '
14+ files :
15+ - kubernetescluster.py
16+ - resourcegroup.py
17+
18+ resources :
19+ - composition.yaml
20+ - xr.yaml
Original file line number Diff line number Diff line change 1+ ---
2+ apiVersion : pkg.crossplane.io/v1
3+ kind : Provider
4+ metadata :
5+ name : upbound-provider-family-azure
6+ spec :
7+ package : xpkg.upbound.io/upbound/provider-family-azure:v1
8+ ---
9+ apiVersion : pkg.crossplane.io/v1
10+ kind : Provider
11+ metadata :
12+ name : upbound-provider-azure-containerservice
13+ spec :
14+ package : xpkg.upbound.io/upbound/provider-azure-containerservice:v1
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # In one terminal
4+ # PYTHONPATH=. function-pythonic --insecure --debug
5+
6+ # In another terminal:
7+
8+ cd $( dirname $( realpath $0 ) )
9+ exec crossplane render xr.yaml composition.yaml functions.yaml
You can’t perform that action at this time.
0 commit comments