Skip to content

Commit 5b29b6c

Browse files
authored
Merge pull request #4714 from nojnhuh/v2-flag
Add ASOAPI feature flag
2 parents c60d200 + 436e9c2 commit 5b29b6c

File tree

4 files changed

+61
-2
lines changed

4 files changed

+61
-2
lines changed

config/manager/manager.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ spec:
2424
- --leader-elect
2525
- "--diagnostics-address=${CAPZ_DIAGNOSTICS_ADDRESS:=:8443}"
2626
- "--insecure-diagnostics=${CAPZ_INSECURE_DIAGNOSTICS:=false}"
27-
- "--feature-gates=MachinePool=${EXP_MACHINE_POOL:=false},AKSResourceHealth=${EXP_AKS_RESOURCE_HEALTH:=false},EdgeZone=${EXP_EDGEZONE:=false}"
27+
- "--feature-gates=MachinePool=${EXP_MACHINE_POOL:=false},AKSResourceHealth=${EXP_AKS_RESOURCE_HEALTH:=false},EdgeZone=${EXP_EDGEZONE:=false},ASOAPI=${EXP_ASO_API:=false}"
2828
- "--v=0"
2929
image: controller:latest
3030
imagePullPolicy: Always

docs/book/src/topics/aso.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,56 @@ More details about how ASO manages CRDs can be found [here](https://azure.github
7979

8080
**Note:** To install the resource for the newly installed CRDs, make sure that the ASO operator has the authentication to install the resources. Refer [authentication in ASO](https://azure.github.io/azure-service-operator/guide/authentication/) for more details.
8181
An example configuration file and demo for `Azure Cache for Redis` can be found [here](https://github.com/Azure-Samples/azure-service-operator-samples/tree/master/azure-votes-redis).
82+
83+
## Experimental ASO API
84+
85+
CAPZ has begun to experiment with a new flavor of APIs that attempt to address the following limitations of
86+
the existing CAPZ APIs for advanced use cases:
87+
88+
- A limited set of Azure resource types can be represented.
89+
- A limited set of Azure resource topologies can be expressed. e.g. Only a single Virtual Network resource can
90+
be reconciled for each CAPZ-managed AKS cluster.
91+
- For each Azure resource type supported by CAPZ, CAPZ generally only uses a single Azure API version to
92+
define resources of that type.
93+
- For each Azure API version known by CAPZ, only a subset of fields defined in that version by the Azure API
94+
spec are exposed by the CAPZ API.
95+
96+
This new experimental API defines new AzureASOManagedCluster, AzureASOManagedControlPlane, and
97+
AzureASOManagedMachinePool resources. An AzureASOManagedCluster might look like this:
98+
99+
```yaml
100+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
101+
kind: AzureASOManagedCluster
102+
metadata:
103+
name: my-cluster
104+
namespace: default
105+
spec:
106+
resources:
107+
- apiVersion: resources.azure.com/v1api20200601
108+
kind: ResourceGroup
109+
metadata:
110+
name: my-resource-group
111+
spec:
112+
location: eastus
113+
```
114+
115+
The main element of the new API is `spec.resources` in each new resource, which defines arbitrary, literal ASO
116+
resources inline to be managed by CAPZ. These inline ASO resource definitions take the place of almost all
117+
other configuration currently defined by CAPZ. e.g. Instead of a CAPZ-specific `spec.location` field on the
118+
existing AzureManagedControlPlane, the same value would be expected to be set on an ASO ManagedCluster
119+
resource defined in an AzureASOManagedControlPlane's `spec.resources`. This pattern allows users to define, in
120+
full, any ASO-supported version of a resource type in any of these new CAPZ resources.
121+
122+
The obvious tradeoff with this new style of API is that CAPZ resource definitions can become more verbose for
123+
basic use cases. To address this, CAPZ will still offer flavor templates that use this API with all of the
124+
boilerplate predefined to serve as a starting point for customization.
125+
126+
The overall theme of this API is to leverage ASO as much as possible for representing Azure resources in the
127+
Kubernetes API, thereby making CAPZ the thinnest possible translation layer between ASO and Cluster API.
128+
129+
This experiment will help inform CAPZ whether this pattern may be a candidate for a potential v2 API. If
130+
you're interested in trying this out, stay tuned! This functionality is available, but under heavy
131+
construction and not yet in a usable state, behind the `ASOAPI` feature flag (set by the `EXP_ASO_API`
132+
environment variable).
133+
134+
Feedback is welcome!

feature/feature.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ const (
4747
// owner: @upxinxin
4848
// alpha: v1.8
4949
EdgeZone featuregate.Feature = "EdgeZone"
50+
51+
// ASOAPI is the feature gate for enabling the AzureASO... APIs.
52+
// owner: @nojnhuh
53+
// alpha: v1.15
54+
ASOAPI featuregate.Feature = "ASOAPI"
5055
)
5156

5257
func init() {
@@ -60,4 +65,5 @@ var defaultCAPZFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
6065
AKS: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // Remove in 1.12
6166
AKSResourceHealth: {Default: false, PreRelease: featuregate.Alpha},
6267
EdgeZone: {Default: false, PreRelease: featuregate.Alpha},
68+
ASOAPI: {Default: false, PreRelease: featuregate.Alpha},
6369
}

hack/observability/opentelemetry/controller-manager-patch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ spec:
1212
- "--diagnostics-address=:8080"
1313
- "--insecure-diagnostics"
1414
- "--leader-elect"
15-
- "--feature-gates=MachinePool=${EXP_MACHINE_POOL:=false},AKSResourceHealth=${EXP_AKS_RESOURCE_HEALTH:=false},EdgeZone=${EXP_EDGEZONE:=false}"
15+
- "--feature-gates=MachinePool=${EXP_MACHINE_POOL:=false},AKSResourceHealth=${EXP_AKS_RESOURCE_HEALTH:=false},EdgeZone=${EXP_EDGEZONE:=false},ASOAPI=${EXP_ASO_API:=false}"
1616
- "--enable-tracing"

0 commit comments

Comments
 (0)