Skip to content

Commit 298567a

Browse files
committed
Add RosaRoleConfig API and CRD.
1 parent e9f2823 commit 298567a

17 files changed

+1162
-26
lines changed

PROJECT

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,60 @@ version: "2"
22
domain: cluster.x-k8s.io
33
repo: sigs.k8s.io/cluster-api-provider-aws
44
resources:
5-
# v1beta1 types
65
- group: infrastructure
7-
version: v1beta1
86
kind: AWSMachine
9-
- group: infrastructure
107
version: v1beta1
11-
kind: AWSCluster
128
- group: infrastructure
9+
kind: AWSCluster
1310
version: v1beta1
14-
kind: AWSMachineTemplate
1511
- group: infrastructure
12+
kind: AWSMachineTemplate
1613
version: v1beta1
17-
kind: AWSClusterStaticIdentity
1814
- group: infrastructure
15+
kind: AWSClusterStaticIdentity
1916
version: v1beta1
20-
kind: AWSClusterRoleIdentity
2117
- group: infrastructure
18+
kind: AWSClusterRoleIdentity
2219
version: v1beta1
23-
kind: AWSClusterControllerIdentity
2420
- group: infrastructure
21+
kind: AWSClusterControllerIdentity
2522
version: v1beta1
26-
kind: AWSClusterTemplate
2723
- group: infrastructure
24+
kind: AWSClusterTemplate
2825
version: v1beta1
29-
kind: AWSManagedControlPlanes
3026
- group: infrastructure
27+
kind: AWSManagedControlPlanes
3128
version: v1beta1
29+
- group: infrastructure
3230
kind: AWSManagedCluster
33-
# v1beta2 types
31+
version: v1beta1
3432
- group: infrastructure
35-
version: v1beta2
3633
kind: AWSMachine
37-
- group: infrastructure
3834
version: v1beta2
39-
kind: AWSCluster
4035
- group: infrastructure
36+
kind: AWSCluster
4137
version: v1beta2
42-
kind: AWSMachineTemplate
4338
- group: infrastructure
39+
kind: AWSMachineTemplate
4440
version: v1beta2
45-
kind: AWSClusterStaticIdentity
4641
- group: infrastructure
42+
kind: AWSClusterStaticIdentity
4743
version: v1beta2
48-
kind: AWSClusterRoleIdentity
4944
- group: infrastructure
45+
kind: AWSClusterRoleIdentity
5046
version: v1beta2
51-
kind: AWSClusterControllerIdentity
5247
- group: infrastructure
48+
kind: AWSClusterControllerIdentity
5349
version: v1beta2
54-
kind: AWSClusterTemplate
5550
- group: infrastructure
51+
kind: AWSClusterTemplate
5652
version: v1beta2
57-
kind: AWSManagedControlPlanes
5853
- group: infrastructure
54+
kind: AWSManagedControlPlanes
5955
version: v1beta2
56+
- group: infrastructure
6057
kind: AWSManagedCluster
58+
version: v1beta2
59+
- group: infrastructure
60+
kind: ROSARoleConfig
61+
version: v1beta2

api/v1beta2/rosaroleconfig_types.go

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
/*
2+
Copyright The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1beta2
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
)
22+
23+
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
24+
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
25+
26+
// ROSARoleConfigSpec defines the desired state of ROSARoleConfig
27+
28+
type ROSARoleConfigSpec struct {
29+
AccountRoleConfig AccountRoleConfig `json:"accountRoleConfig"`
30+
OperatorRoleConfig OperatorRoleConfig `json:"operatorRoleConfig"`
31+
OIDCConfig OIDCConfig `json:"oidcConfig"`
32+
}
33+
34+
// +kubebuilder:object:root=true
35+
// +kubebuilder:resource:path=rosaroleconfig,scope=cluster,categories=cluster-api,shortName=rosarole
36+
// +kubebuilder:storageversion
37+
// +kubebuilder:subresource:status
38+
39+
// ROSARoleConfig is the Schema for the rosaroleconfigs API
40+
type ROSARoleConfig struct {
41+
metav1.TypeMeta `json:",inline"`
42+
metav1.ObjectMeta `json:"metadata,omitempty"`
43+
44+
Spec ROSARoleConfigSpec `json:"spec,omitempty"`
45+
Status ROSARoleConfigStatus `json:"status,omitempty"`
46+
}
47+
48+
type AccountRoleConfig struct {
49+
// TODO: verify max len
50+
// +kubebuilder:validation:MaxLength:=4
51+
// +kubebuilder:validation:Required
52+
Prefix string `json:"prefix"`
53+
// +optional
54+
PermissionsBoundaryARN string `json:"permissionsBoundaryARN,omitempty"`
55+
// +optional
56+
Path string `json:"path,omitempty"`
57+
// +kubebuilder:validation:Required
58+
Version string `json:"version"`
59+
// +optional
60+
SharedVPCConfig SharedVPCConfig `json:"sharedVPCConfig,omitempty"`
61+
}
62+
63+
type OperatorRoleConfig struct {
64+
// TODO: verify max len
65+
// +kubebuilder:validation:MaxLength:=4
66+
// +kubebuilder:validation:Required
67+
Prefix string `json:"prefix"`
68+
// +optional
69+
PermissionsBoundaryARN string `json:"permissionsBoundaryARN,omitempty"`
70+
// +kubebuilder:validation:Required
71+
OIDCConfigID string `json:"oidcConfigId,omitempty"`
72+
// +optional
73+
SharedVPCConfig SharedVPCConfig `json:"sharedVPCConfig,omitempty"`
74+
}
75+
76+
type SharedVPCConfig struct {
77+
RouteRoleARN string `json:"routeRoleARN,omitempty"`
78+
VPCEndpointRoleARN string `json:"vpcEndpointRoleArn,omitempty"`
79+
}
80+
81+
type OIDCConfig struct {
82+
CreateManagedOIDC string `json:"createManagedOIDC"`
83+
ExternalAuthProviders []ExternalAuthProvider `json:"externalAuthProviders,omitempty"`
84+
}
85+
86+
type ExternalAuthProvider struct {
87+
Name string `json:"name"`
88+
Issuer Issuer `json:"issuer"`
89+
ClaimMappings ClaimMappings `json:"claimMappings"`
90+
OIDCClients []OIDCClient `json:"oidcClients,omitempty"`
91+
}
92+
93+
type Issuer struct {
94+
IssuerURL string `json:"issuerURL"`
95+
Audiences []string `json:"audiences,omitempty"`
96+
}
97+
98+
type ClaimMappings struct {
99+
Username Mapping `json:"username"`
100+
Groups Mapping `json:"groups,omitempty"`
101+
}
102+
103+
type Mapping struct {
104+
Claim string `json:"claim"`
105+
PrefixPolicy string `json:"prefixPolicy,omitempty"`
106+
}
107+
108+
type OIDCClient struct {
109+
ComponentName string `json:"componentName"`
110+
ComponentNamespace string `json:"componentNamespace"`
111+
ClientID string `json:"clientID"`
112+
ClientSecret SecretReference `json:"clientSecret"`
113+
}
114+
115+
type SecretReference struct {
116+
Name string `json:"name"`
117+
}
118+
119+
// ROSARoleConfigStatus defines the observed state of ROSARoleConfig
120+
type ROSARoleConfigStatus struct {
121+
Conditions []metav1.Condition `json:"conditions,omitempty"`
122+
OIDCID string `json:"oidcID,omitempty"`
123+
OIDCProviderARN string `json:"oidcProviderARN,omitempty"`
124+
AccountRolesRef AccountRolesRef `json:"accountRolesRef,omitempty"`
125+
OperatorRolesRef OperatorRolesRef `json:"operatorRolesRef,omitempty"`
126+
}
127+
128+
type AccountRolesRef struct {
129+
InstallerRoleARN string `json:"installerRoleARN,omitempty"`
130+
SupportRoleARN string `json:"supportRoleARN,omitempty"`
131+
WorkerRoleARN string `json:"workerRoleARN,omitempty"`
132+
}
133+
134+
type OperatorRolesRef struct {
135+
IngressARN string `json:"ingressARN,omitempty"`
136+
ImageRegistryARN string `json:"imageRegistryARN,omitempty"`
137+
StorageARN string `json:"storageARN,omitempty"`
138+
NetworkARN string `json:"networkARN,omitempty"`
139+
KubeCloudControllerARN string `json:"kubeCloudControllerARN,omitempty"`
140+
NodePoolManagementARN string `json:"nodePoolManagementARN,omitempty"`
141+
ControlPlaneOperatorARN string `json:"controlPlaneOperatorARN,omitempty"`
142+
KMSProviderARN string `json:"kmsProviderARN,omitempty"`
143+
}
144+
145+
// +kubebuilder:object:root=true
146+
147+
// ROSARoleConfigList contains a list of ROSARoleConfig
148+
type ROSARoleConfigList struct {
149+
metav1.TypeMeta `json:",inline"`
150+
metav1.ListMeta `json:"metadata,omitempty"`
151+
Items []ROSARoleConfig `json:"items"`
152+
}
153+
154+
func init() {
155+
SchemeBuilder.Register(&ROSARoleConfig{}, &ROSARoleConfigList{})
156+
}

0 commit comments

Comments
 (0)