Skip to content

Commit 3f28f8d

Browse files
committed
feat(examples): Polishes AKS Cluster example
1 parent b8a1b11 commit 3f28f8d

File tree

5 files changed

+103
-3
lines changed

5 files changed

+103
-3
lines changed

examples/aks-cluster/README.md

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,101 @@ This example demonstrates how to provision an AKS cluster using Crossplane v1.
2929
4. **Apply the manifests:**
3030
```sh
3131
./install.sh
32-
```
32+
```
33+
34+
35+
## Architecture
36+
37+
```mermaid
38+
graph TD
39+
A[User] -->|Orders a cluster| B[AzureKubernetesCluster XR]
40+
41+
subgraph "Crossplane Control Plane"
42+
B -->|Processed by| C[Crossplane]
43+
C -->|Uses| D[Composition]
44+
D -->|Translates to| E[Managed Resources]
45+
end
46+
47+
subgraph "Azure Providers"
48+
P1[Azure Provider]
49+
P2[provider-azure-containerservice]
50+
end
51+
52+
E -->|ResourceGroup| P1
53+
E -->|KubernetesCluster| P2
54+
55+
P1 -->|Creates| R1[Azure Resource Group]
56+
P2 -->|Creates| R2[Azure AKS Cluster]
57+
58+
59+
60+
classDef crossplane fill:#326ce5,stroke:#fff,stroke-width:2px,color:#fff;
61+
classDef provider fill:#ff6b6b,stroke:#fff,stroke-width:2px,color:#fff;
62+
classDef azure fill:#0072C6,stroke:#fff,stroke-width:2px,color:#fff;
63+
classDef config fill:#ddd,stroke:#333,stroke-width:1px;
64+
65+
class B,C,D,E crossplane;
66+
class P1,P2 provider;
67+
class R1,R2 azure;
68+
class N1,N2,N3,N4 config;
69+
```
70+
71+
## Technical Architecture
72+
73+
### Implementation Flow
74+
75+
1. **Python Functions**
76+
- Python code defines the resource configuration logic
77+
- Functions are packaged into ConfigMaps
78+
- ConfigMaps are labeled with ```function-pythonic.package: ''```
79+
80+
2. **Crossplane Integration**
81+
- XR Definition describes the custom resource structure
82+
- Composition references the Python functions
83+
- Function pipeline executes the Python code
84+
85+
3. **Resource Management**
86+
- Python functions generate Managed Resources
87+
- Managed Resources create actual cloud resources
88+
- Resources are managed through provider controllers
89+
90+
### Diagram
91+
92+
```mermaid
93+
graph TD
94+
subgraph "Python Function Components"
95+
PY[Python Functions]
96+
CM[ConfigMap]
97+
PY -->|Packaged into| CM
98+
CM -->|Label: python-module| K8S[Kubernetes]
99+
end
100+
101+
subgraph "Crossplane Components"
102+
XR[XR Definition]
103+
COMP[Composition]
104+
FN[Function Pipeline]
105+
106+
XR -->|References| COMP
107+
COMP -->|Uses| FN
108+
FN -->|Imports| CM
109+
end
110+
111+
subgraph "Resource Creation"
112+
FN -->|Generates| MR[Managed Resources]
113+
MR -->|Creates| AKS[AKS Cluster]
114+
end
115+
116+
subgraph "Legend"
117+
L1[Python Code]
118+
L2[Kubernetes Resources]
119+
L3[Generated Resources]
120+
end
121+
122+
classDef python fill:#306998,stroke:#fff,stroke-width:2px,color:#fff;
123+
classDef k8s fill:#326ce5,stroke:#fff,stroke-width:2px,color:#fff;
124+
classDef generated fill:#ff6b6b,stroke:#fff,stroke-width:2px,color:#fff;
125+
126+
class PY,L1 python;
127+
class CM,XR,COMP,FN,K8S,L2 k8s;
128+
class MR,AKS,L3 generated;
129+
```

examples/aks-cluster/aks/kubernetescluster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def compose(self):
2222
else:
2323
aks.spec.forProvider.defaultNodePool.nodeCount = self.spec.nodeCount
2424

25-
aks.spec.forProvider.defaultNodePool.name = 'systempool1'
25+
aks.spec.forProvider.defaultNodePool.name = self.spec.defaultNodePool.name
2626
aks.spec.forProvider.defaultNodePool.vmSize = self.spec.vmSize
2727
aks.spec.forProvider.dnsPrefix = self.metadata.name
2828

examples/aks-cluster/composition.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ spec:
1919
functionRef:
2020
name: function-pythonic
2121
input:
22-
apiVersion: paks.ythonic.fn.fortra.com/v1alpha1
22+
apiVersion: aks.pythonic.fn.fortra.com/v1alpha1
2323
kind: Composite
2424
composite: aks.kubernetescluster.KubernetesClusterComposite

examples/aks-cluster/definition.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ spec:
2424
defaultNodePool:
2525
type: object
2626
properties:
27+
name:
28+
type: string
2729
autoScaling:
2830
type: object
2931
properties:

examples/aks-cluster/xr.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ metadata:
55
name: my-aks-cluster
66
spec:
77
defaultNodePool:
8+
name: systempool
89
autoScaling:
910
enabled: False
1011
minCount: 1

0 commit comments

Comments
 (0)