/
azuremanagedcontrolplane_types.go
145 lines (114 loc) · 5.42 KB
/
azuremanagedcontrolplane_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
Copyright 2020 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha3
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3"
)
// AzureManagedControlPlaneSpec defines the desired state of AzureManagedControlPlane.
type AzureManagedControlPlaneSpec struct {
// Version defines the desired Kubernetes version.
// +kubebuilder:validation:MinLength:=2
Version string `json:"version"`
// ResourceGroupName is the name of the Azure resource group for this AKS Cluster.
ResourceGroupName string `json:"resourceGroupName"`
// NodeResourceGroupName is the name of the resource group
// containing cluster IaaS resources. Will be populated to default
// in webhook.
NodeResourceGroupName string `json:"nodeResourceGroupName"`
// VirtualNetwork describes the vnet for the AKS cluster. Will be created if it does not exist.
VirtualNetwork ManagedControlPlaneVirtualNetwork `json:"virtualNetwork,omitempty"`
// SubscriotionID is the GUID of the Azure subscription to hold this cluster.
SubscriptionID string `json:"subscriptionID,omitempty"`
// Location is a string matching one of the canonical Azure region names. Examples: "westus2", "eastus".
Location string `json:"location"`
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
// +optional
ControlPlaneEndpoint clusterv1alpha3.APIEndpoint `json:"controlPlaneEndpoint"`
// AdditionalTags is an optional set of tags to add to Azure resources managed by the Azure provider, in addition to the
// ones added by default.
// +optional
AdditionalTags Tags `json:"additionalTags,omitempty"`
// NetworkPlugin used for building Kubernetes network.
// +kubebuilder:validation:Enum=azure;kubenet
// +optional
NetworkPlugin *string `json:"networkPlugin,omitempty"`
// NetworkPolicy used for building Kubernetes network.
// +kubebuilder:validation:Enum=azure;calico
// +optional
NetworkPolicy *string `json:"networkPolicy,omitempty"`
// SSHPublicKey is a string literal containing an ssh public key base64 encoded.
SSHPublicKey string `json:"sshPublicKey"`
// DNSServiceIP is an IP address assigned to the Kubernetes DNS service.
// It must be within the Kubernetes service address range specified in serviceCidr.
// +optional
DNSServiceIP *string `json:"dnsServiceIP,omitempty"`
// LoadBalancerSKU is the SKU of the loadBalancer to be provisioned.
// +kubebuilder:validation:Enum=Basic;Standard
// +optional
LoadBalancerSKU *string `json:"loadBalancerSKU,omitempty"`
// AadProfile is Azure Active Directory configuration to integrate with AKS for aad authentication.
// +optional
AADProfile *AADProfile `json:"aadProfile,omitempty"`
}
// AADProfile - AAD integration managed by AKS.
type AADProfile struct {
// Managed - Whether to enable managed AAD.
// +kubebuilder:validation:Required
Managed bool `json:"managed"`
// AdminGroupObjectIDs - AAD group object IDs that will have admin role of the cluster.
// +kubebuilder:validation:Required
AdminGroupObjectIDs []string `json:"adminGroupObjectIDs"`
}
// ManagedControlPlaneVirtualNetwork describes a virtual network required to provision AKS clusters.
type ManagedControlPlaneVirtualNetwork struct {
Name string `json:"name"`
CIDRBlock string `json:"cidrBlock"`
Subnet ManagedControlPlaneSubnet `json:"subnet,omitempty"`
}
// ManagedControlPlaneSubnet describes a subnet for an AKS cluster.
type ManagedControlPlaneSubnet struct {
Name string `json:"name"`
CIDRBlock string `json:"cidrBlock"`
}
// AzureManagedControlPlaneStatus defines the observed state of AzureManagedControlPlane.
type AzureManagedControlPlaneStatus struct {
// Ready is true when the provider resource is ready.
// +optional
Ready bool `json:"ready,omitempty"`
// Initialized is true when the the control plane is available for initial contact.
// This may occur before the control plane is fully ready.
// In the AzureManagedControlPlane implementation, these are identical.
// +optional
Initialized bool `json:"initialized,omitempty"`
}
// +kubebuilder:object:root=true
// +kubebuilder:resource:path=azuremanagedcontrolplanes,scope=Namespaced,categories=cluster-api,shortName=amcp
// +kubebuilder:subresource:status
// AzureManagedControlPlane is the Schema for the azuremanagedcontrolplanes API.
type AzureManagedControlPlane struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec AzureManagedControlPlaneSpec `json:"spec,omitempty"`
Status AzureManagedControlPlaneStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// AzureManagedControlPlaneList contains a list of AzureManagedControlPlanes.
type AzureManagedControlPlaneList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []AzureManagedControlPlane `json:"items"`
}
func init() {
SchemeBuilder.Register(&AzureManagedControlPlane{}, &AzureManagedControlPlaneList{})
}