Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
99 changes: 98 additions & 1 deletion examples/aks-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,101 @@ This example demonstrates how to provision an AKS cluster using Crossplane v1.
4. **Apply the manifests:**
```sh
./install.sh
```
```


## Architecture

```mermaid
graph TD
A[User] -->|Orders a cluster| B[AzureKubernetesCluster XR]

subgraph "Crossplane Control Plane"
B -->|Processed by| C[Crossplane]
C -->|Uses| D[Composition]
D -->|Translates to| E[Managed Resources]
end

subgraph "Azure Providers"
P1[Azure Provider]
P2[provider-azure-containerservice]
end

E -->|ResourceGroup| P1
E -->|KubernetesCluster| P2

P1 -->|Creates| R1[Azure Resource Group]
P2 -->|Creates| R2[Azure AKS Cluster]



classDef crossplane fill:#326ce5,stroke:#fff,stroke-width:2px,color:#fff;
classDef provider fill:#ff6b6b,stroke:#fff,stroke-width:2px,color:#fff;
classDef azure fill:#0072C6,stroke:#fff,stroke-width:2px,color:#fff;
classDef config fill:#ddd,stroke:#333,stroke-width:1px;

class B,C,D,E crossplane;
class P1,P2 provider;
class R1,R2 azure;
class N1,N2,N3,N4 config;
```

## Technical Architecture

### Implementation Flow

1. **Python Functions**
- Python code defines the resource configuration logic
- Functions are packaged into ConfigMaps
- ConfigMaps are labeled with ```function-pythonic.package: ''```

2. **Crossplane Integration**
- XR Definition describes the custom resource structure
- Composition references the Python functions
- Function pipeline executes the Python code

3. **Resource Management**
- Python functions generate Managed Resources
- Managed Resources create actual cloud resources
- Resources are managed through provider controllers

### Diagram

```mermaid
graph TD
subgraph "Python Function Components"
PY[Python Functions]
CM[ConfigMap]
PY -->|Packaged into| CM
CM -->|Label: python-module| K8S[Kubernetes]
end

subgraph "Crossplane Components"
XR[XR Definition]
COMP[Composition]
FN[Function Pipeline]

XR -->|References| COMP
COMP -->|Uses| FN
FN -->|Imports| CM
end

subgraph "Resource Creation"
FN -->|Generates| MR[Managed Resources]
MR -->|Creates| AKS[AKS Cluster]
end

subgraph "Legend"
L1[Python Code]
L2[Kubernetes Resources]
L3[Generated Resources]
end

classDef python fill:#306998,stroke:#fff,stroke-width:2px,color:#fff;
classDef k8s fill:#326ce5,stroke:#fff,stroke-width:2px,color:#fff;
classDef generated fill:#ff6b6b,stroke:#fff,stroke-width:2px,color:#fff;

class PY,L1 python;
class CM,XR,COMP,FN,K8S,L2 k8s;
class MR,AKS,L3 generated;
```
2 changes: 1 addition & 1 deletion examples/aks-cluster/aks/kubernetescluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def compose(self):
else:
aks.spec.forProvider.defaultNodePool.nodeCount = self.spec.nodeCount

aks.spec.forProvider.defaultNodePool.name = 'systempool1'
aks.spec.forProvider.defaultNodePool.name = self.spec.defaultNodePool.name
aks.spec.forProvider.defaultNodePool.vmSize = self.spec.vmSize
aks.spec.forProvider.dnsPrefix = self.metadata.name

Expand Down
2 changes: 1 addition & 1 deletion examples/aks-cluster/cluster-function-pythonic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Function
metadata:
name: function-pythonic
spec:
package: ghcr.io/fortra/function-pythonic:v0.0.10
package: ghcr.io/fortra/function-pythonic:v0.0.11
runtimeConfigRef:
name: function-pythonic
---
Expand Down
2 changes: 1 addition & 1 deletion examples/aks-cluster/composition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ spec:
functionRef:
name: function-pythonic
input:
apiVersion: paks.ythonic.fn.fortra.com/v1alpha1
apiVersion: aks.pythonic.fn.fortra.com/v1alpha1
kind: Composite
composite: aks.kubernetescluster.KubernetesClusterComposite
2 changes: 2 additions & 0 deletions examples/aks-cluster/definition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ spec:
defaultNodePool:
type: object
properties:
name:
type: string
autoScaling:
type: object
properties:
Expand Down
2 changes: 1 addition & 1 deletion examples/aks-cluster/functions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ metadata:
annotations:
render.crossplane.io/runtime: Development
spec:
package: ghcr.io/fortra/function-pythonic:v0.0.8
package: ghcr.io/fortra/function-pythonic:v0.0.11
runtimeConfigRef:
name: function-pythonic
1 change: 1 addition & 0 deletions examples/aks-cluster/xr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
name: my-aks-cluster
spec:
defaultNodePool:
name: systempool1
autoScaling:
enabled: False
minCount: 1
Expand Down