Skip to content

Commit 6223b13

Browse files
authored
Merge pull request #4750 from nojnhuh/v2-resources
ASOAPI: reconcile embedded resources
2 parents 3d9f761 + 31ef8e5 commit 6223b13

27 files changed

+1760
-30
lines changed

Tiltfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,11 @@ def create_identity_secret():
255255
os.putenv("AZURE_CLUSTER_IDENTITY_SECRET_NAME", "cluster-identity-secret")
256256
os.putenv("AZURE_CLUSTER_IDENTITY_SECRET_NAMESPACE", "default")
257257
os.putenv("CLUSTER_IDENTITY_NAME", "cluster-identity")
258+
os.putenv("ASO_CREDENTIAL_SECRET_NAME", "aso-credentials")
258259

259260
os.putenv("AZURE_CLIENT_SECRET_B64", base64_encode(os.environ.get("AZURE_CLIENT_SECRET")))
260261
local("cat templates/azure-cluster-identity/secret.yaml | " + envsubst_cmd + " | " + kubectl_cmd + " apply -f -", quiet = True, echo_off = True)
262+
local("cat templates/flavors/aks-aso/credentials.yaml | " + envsubst_cmd + " | " + kubectl_cmd + " apply -f -", quiet = True, echo_off = True)
261263
os.unsetenv("AZURE_CLIENT_SECRET_B64")
262264

263265
def create_crs():

config/crd/bases/infrastructure.cluster.x-k8s.io_azureasomanagedclusters.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,47 @@ spec:
3939
type: object
4040
spec:
4141
description: AzureASOManagedClusterSpec defines the desired state of AzureASOManagedCluster.
42+
properties:
43+
resources:
44+
description: Resources are embedded ASO resources to be managed by
45+
this resource.
46+
items:
47+
type: object
48+
x-kubernetes-preserve-unknown-fields: true
49+
type: array
4250
type: object
4351
status:
4452
description: AzureASOManagedClusterStatus defines the observed state of
4553
AzureASOManagedCluster.
54+
properties:
55+
resources:
56+
items:
57+
description: ResourceStatus represents the status of a resource.
58+
properties:
59+
ready:
60+
type: boolean
61+
resource:
62+
description: StatusResource is a handle to a resource.
63+
properties:
64+
group:
65+
type: string
66+
kind:
67+
type: string
68+
name:
69+
type: string
70+
version:
71+
type: string
72+
required:
73+
- group
74+
- kind
75+
- name
76+
- version
77+
type: object
78+
required:
79+
- ready
80+
- resource
81+
type: object
82+
type: array
4683
type: object
4784
type: object
4885
served: true

config/crd/bases/infrastructure.cluster.x-k8s.io_azureasomanagedclustertemplates.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ spec:
4848
spec:
4949
description: AzureASOManagedClusterTemplateResourceSpec defines
5050
the desired state of the templated resource.
51+
properties:
52+
resources:
53+
description: Resources are embedded ASO resources to be managed
54+
by this resource.
55+
items:
56+
type: object
57+
x-kubernetes-preserve-unknown-fields: true
58+
type: array
5159
type: object
5260
type: object
5361
required:

config/crd/bases/infrastructure.cluster.x-k8s.io_azureasomanagedcontrolplanes.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,47 @@ spec:
4040
spec:
4141
description: AzureASOManagedControlPlaneSpec defines the desired state
4242
of AzureASOManagedControlPlane.
43+
properties:
44+
resources:
45+
description: Resources are embedded ASO resources to be managed by
46+
this resource.
47+
items:
48+
type: object
49+
x-kubernetes-preserve-unknown-fields: true
50+
type: array
4351
type: object
4452
status:
4553
description: AzureASOManagedControlPlaneStatus defines the observed state
4654
of AzureASOManagedControlPlane.
55+
properties:
56+
resources:
57+
items:
58+
description: ResourceStatus represents the status of a resource.
59+
properties:
60+
ready:
61+
type: boolean
62+
resource:
63+
description: StatusResource is a handle to a resource.
64+
properties:
65+
group:
66+
type: string
67+
kind:
68+
type: string
69+
name:
70+
type: string
71+
version:
72+
type: string
73+
required:
74+
- group
75+
- kind
76+
- name
77+
- version
78+
type: object
79+
required:
80+
- ready
81+
- resource
82+
type: object
83+
type: array
4784
type: object
4885
type: object
4986
served: true

config/crd/bases/infrastructure.cluster.x-k8s.io_azureasomanagedcontrolplanetemplates.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ spec:
4848
spec:
4949
description: AzureASOManagedControlPlaneTemplateResourceSpec defines
5050
the desired state of the templated resource.
51+
properties:
52+
resources:
53+
description: Resources are embedded ASO resources to be managed
54+
by this resource.
55+
items:
56+
type: object
57+
x-kubernetes-preserve-unknown-fields: true
58+
type: array
5159
type: object
5260
type: object
5361
required:

config/crd/bases/infrastructure.cluster.x-k8s.io_azureasomanagedmachinepools.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,47 @@ spec:
4040
spec:
4141
description: AzureASOManagedMachinePoolSpec defines the desired state
4242
of AzureASOManagedMachinePool.
43+
properties:
44+
resources:
45+
description: Resources are embedded ASO resources to be managed by
46+
this resource.
47+
items:
48+
type: object
49+
x-kubernetes-preserve-unknown-fields: true
50+
type: array
4351
type: object
4452
status:
4553
description: AzureASOManagedMachinePoolStatus defines the observed state
4654
of AzureASOManagedMachinePool.
55+
properties:
56+
resources:
57+
items:
58+
description: ResourceStatus represents the status of a resource.
59+
properties:
60+
ready:
61+
type: boolean
62+
resource:
63+
description: StatusResource is a handle to a resource.
64+
properties:
65+
group:
66+
type: string
67+
kind:
68+
type: string
69+
name:
70+
type: string
71+
version:
72+
type: string
73+
required:
74+
- group
75+
- kind
76+
- name
77+
- version
78+
type: object
79+
required:
80+
- ready
81+
- resource
82+
type: object
83+
type: array
4784
type: object
4885
type: object
4986
served: true

config/crd/bases/infrastructure.cluster.x-k8s.io_azureasomanagedmachinepooltemplates.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ spec:
4848
spec:
4949
description: AzureASOManagedControlPlaneTemplateResourceSpec defines
5050
the desired state of the templated resource.
51+
properties:
52+
resources:
53+
description: Resources are embedded ASO resources to be managed
54+
by this resource.
55+
items:
56+
type: object
57+
x-kubernetes-preserve-unknown-fields: true
58+
type: array
5159
type: object
5260
type: object
5361
required:

exp/api/v1alpha1/azureasomanagedcluster_types.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@ type AzureASOManagedClusterSpec struct {
3535

3636
// AzureASOManagedClusterStatus defines the observed state of AzureASOManagedCluster.
3737
type AzureASOManagedClusterStatus struct {
38+
//+optional
39+
Resources []ResourceStatus `json:"resources,omitempty"`
40+
}
41+
42+
// ResourceStatus represents the status of a resource.
43+
type ResourceStatus struct {
44+
Resource StatusResource `json:"resource"`
45+
Ready bool `json:"ready"`
46+
}
47+
48+
// StatusResource is a handle to a resource.
49+
type StatusResource struct {
50+
Group string `json:"group"`
51+
Version string `json:"version"`
52+
Kind string `json:"kind"`
53+
Name string `json:"name"`
3854
}
3955

4056
//+kubebuilder:object:root=true
@@ -49,6 +65,11 @@ type AzureASOManagedCluster struct {
4965
Status AzureASOManagedClusterStatus `json:"status,omitempty"`
5066
}
5167

68+
// SetResourceStatuses returns the status of resources.
69+
func (a *AzureASOManagedCluster) SetResourceStatuses(r []ResourceStatus) {
70+
a.Status.Resources = r
71+
}
72+
5273
//+kubebuilder:object:root=true
5374

5475
// AzureASOManagedClusterList contains a list of AzureASOManagedCluster.

exp/api/v1alpha1/azureasomanagedclustertemplate_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package v1alpha1
1818

1919
import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
"k8s.io/apimachinery/pkg/runtime"
2122
)
2223

2324
// AzureASOManagedClusterTemplateSpec defines the desired state of AzureASOManagedClusterTemplate.
@@ -32,6 +33,9 @@ type AzureASOManagedClusterTemplateResource struct {
3233

3334
// AzureASOManagedClusterTemplateResourceSpec defines the desired state of the templated resource.
3435
type AzureASOManagedClusterTemplateResourceSpec struct {
36+
// Resources are embedded ASO resources to be managed by this resource.
37+
//+optional
38+
Resources []runtime.RawExtension `json:"resources,omitempty"`
3539
}
3640

3741
//+kubebuilder:object:root=true

exp/api/v1alpha1/azureasomanagedcontrolplane_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ type AzureASOManagedControlPlaneSpec struct {
3030

3131
// AzureASOManagedControlPlaneStatus defines the observed state of AzureASOManagedControlPlane.
3232
type AzureASOManagedControlPlaneStatus struct {
33+
//+optional
34+
Resources []ResourceStatus `json:"resources,omitempty"`
3335
}
3436

3537
//+kubebuilder:object:root=true
@@ -44,6 +46,11 @@ type AzureASOManagedControlPlane struct {
4446
Status AzureASOManagedControlPlaneStatus `json:"status,omitempty"`
4547
}
4648

49+
// SetResourceStatuses returns the status of resources.
50+
func (a *AzureASOManagedControlPlane) SetResourceStatuses(r []ResourceStatus) {
51+
a.Status.Resources = r
52+
}
53+
4754
//+kubebuilder:object:root=true
4855

4956
// AzureASOManagedControlPlaneList contains a list of AzureASOManagedControlPlane.

0 commit comments

Comments
 (0)