Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document AKSClusterConfig API #247

Merged
merged 2 commits into from
Sep 6, 2023
Merged
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
209 changes: 158 additions & 51 deletions pkg/apis/aks.cattle.io/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ import (

// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:printcolumn:name="ClusterName",type="string",JSONPath=".spec.clusterName"
// +kubebuilder:printcolumn:name="KubernetesVersion",type="string",JSONPath=".spec.kubernetesVersion"
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase"
// +kubebuilder:printcolumn:name="FailureMessage",type="string",JSONPath=".status.failureMessage"

type AKSClusterConfig struct {
metav1.TypeMeta `json:",inline"`
Expand All @@ -33,40 +37,113 @@ type AKSClusterConfig struct {

// AKSClusterConfigSpec is the spec for a AKSClusterConfig resource
type AKSClusterConfigSpec struct {
Imported bool `json:"imported" norman:"noupdate"`
ResourceLocation string `json:"resourceLocation" norman:"noupdate"`
ResourceGroup string `json:"resourceGroup" norman:"noupdate"`
ClusterName string `json:"clusterName" norman:"noupdate"`
AzureCredentialSecret string `json:"azureCredentialSecret"`
BaseURL *string `json:"baseUrl" norman:"pointer"`
AuthBaseURL *string `json:"authBaseUrl" norman:"pointer"`
NetworkPlugin *string `json:"networkPlugin" norman:"pointer"`
VirtualNetworkResourceGroup *string `json:"virtualNetworkResourceGroup" norman:"pointer"`
VirtualNetwork *string `json:"virtualNetwork" norman:"pointer"`
Subnet *string `json:"subnet" norman:"pointer"`
NetworkDNSServiceIP *string `json:"dnsServiceIp" norman:"pointer"`
NetworkServiceCIDR *string `json:"serviceCidr" norman:"pointer"`
NetworkDockerBridgeCIDR *string `json:"dockerBridgeCidr" norman:"pointer"`
NetworkPodCIDR *string `json:"podCidr" norman:"pointer"`
NodeResourceGroup *string `json:"nodeResourceGroup,omitempty" norman:"pointer"`
OutboundType *string `json:"outboundType" norman:"pointer"`
LoadBalancerSKU *string `json:"loadBalancerSku" norman:"pointer"`
NetworkPolicy *string `json:"networkPolicy" norman:"pointer"`
LinuxAdminUsername *string `json:"linuxAdminUsername,omitempty" norman:"pointer"`
LinuxSSHPublicKey *string `json:"sshPublicKey,omitempty" norman:"pointer"`
DNSPrefix *string `json:"dnsPrefix,omitempty" norman:"pointer"`
KubernetesVersion *string `json:"kubernetesVersion" norman:"pointer"`
Tags map[string]string `json:"tags"`
NodePools []AKSNodePool `json:"nodePools"`
PrivateCluster *bool `json:"privateCluster"`
PrivateDNSZone *string `json:"privateDnsZone" norman:"pointer"`
AuthorizedIPRanges *[]string `json:"authorizedIpRanges" norman:"pointer"`
HTTPApplicationRouting *bool `json:"httpApplicationRouting"`
Monitoring *bool `json:"monitoring"`
LogAnalyticsWorkspaceGroup *string `json:"logAnalyticsWorkspaceGroup" norman:"pointer"`
LogAnalyticsWorkspaceName *string `json:"logAnalyticsWorkspaceName" norman:"pointer"`
ManagedIdentity *bool `json:"managedIdentity" norman:"pointer"`
UserAssignedIdentity *string `json:"userAssignedIdentity" norman:"pointer"`
// Importer indicates that the cluster was imported.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imported*

// +optional
// +kubebuilder:default=false
Imported bool `json:"imported" norman:"noupdate"`
// Location specifies the region to create the private endpoint.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ResourceLocation

ResourceLocation string `json:"resourceLocation" norman:"noupdate"`
// ResourceGroup is the name of the Azure resource group for this AKS Cluster.
// Immutable.
ResourceGroup string `json:"resourceGroup" norman:"noupdate"`
// AKS ClusterName allows you to specify the name of the AKS cluster in Azure.
ClusterName string `json:"clusterName" norman:"noupdate"`
// AzureCredentialSecret is the name of the secret containing the Azure credentials.
AzureCredentialSecret string `json:"azureCredentialSecret"`
// BaseURL is the Azure Resource Manager endpoint.
// +optional
BaseURL *string `json:"baseUrl" norman:"pointer"`
// AuthBaseURL is the Azure Active Directory endpoint.
// +optional
AuthBaseURL *string `json:"authBaseUrl" norman:"pointer"`
// NetworkPlugin used for building Kubernetes network.
// Allowed values are "azure", "kubenet".
// Immutable.
// +kubebuilder:validation:Enum=azure;kubenet
// +optional
NetworkPlugin *string `json:"networkPlugin" norman:"pointer"`
// VirualNetworkResourceGroup is the name of the Azure resource group for the VNet and Subnet.
// +optional
VirtualNetworkResourceGroup *string `json:"virtualNetworkResourceGroup" norman:"pointer"`
// VirtualNetwork describes the vnet for the AKS cluster. Will be created if it does not exist.
// +optional
VirtualNetwork *string `json:"virtualNetwork" norman:"pointer"`
// Subnet describes a subnet for an AKS cluster.
Subnet *string `json:"subnet" norman:"pointer"`
// NeworkDNSServiceIP is an IP address assigned to the Kubernetes DNS service.
// It must be within the Kubernetes service address range specified in serviceCidr.
// Immutable.
// +optional
NetworkDNSServiceIP *string `json:"dnsServiceIp" norman:"pointer"`
// NetworkService CIDR is the network service cidr.
NetworkServiceCIDR *string `json:"serviceCidr" norman:"pointer"`
// NetworkDockerBridgeCIDR is the network docker bridge cidr.
NetworkDockerBridgeCIDR *string `json:"dockerBridgeCidr" norman:"pointer"`
// NetworkPodCIDR is the network pod cidr.
NetworkPodCIDR *string `json:"podCidr" norman:"pointer"`
// NodeResourceGroupName is the name of the resource group
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NodeResourceGroup

// containing cluster IaaS resources.
// +optional
NodeResourceGroup *string `json:"nodeResourceGroup,omitempty" norman:"pointer"`
// Outbound configuration used by Nodes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OutboundType

// Immutable.
// +kubebuilder:validation:Enum=loadBalancer;managedNATGateway;userAssignedNATGateway;userDefinedRouting
// +optional
OutboundType *string `json:"outboundType" norman:"pointer"`
// LoadBalancerSKU is the SKU of the loadBalancer to be provisioned.
// Immutable.
// +kubebuilder:validation:Enum=Basic;Standard
// +optional
LoadBalancerSKU *string `json:"loadBalancerSku" norman:"pointer"`
// NetworkPolicy used for building Kubernetes network.
// Allowed values are "azure", "calico".
// Immutable.
// +kubebuilder:validation:Enum=azure;calico
// +optional
NetworkPolicy *string `json:"networkPolicy" norman:"pointer"`
// LinuxAdminUsername is a string literal containing a linux admin username.
// +optional
LinuxAdminUsername *string `json:"linuxAdminUsername,omitempty" norman:"pointer"`
// LinuxSSHPublicKey is a string literal containing a ssh public key.
// +optional
LinuxSSHPublicKey *string `json:"sshPublicKey,omitempty" norman:"pointer"`
// DNSPrefix is the DNS prefix to use with hosted Kubernetes API server FQDN.
DNSPrefix *string `json:"dnsPrefix,omitempty" norman:"pointer"`
// Version defines the desired Kubernetes version.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KubernetesVersion

// +kubebuilder:validation:MinLength:=2
KubernetesVersion *string `json:"kubernetesVersion" norman:"pointer"`
// Tags 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
Tags map[string]string `json:"tags"`
// NodePools is a list of node pools associated with the AKS cluster.
NodePools []AKSNodePool `json:"nodePools"`
// PrivateCluster - Whether to create the cluster as a private cluster or not.
// +optional
PrivateCluster *bool `json:"privateCluster"`
// PrivateDNSZone - Private dns zone mode for private cluster.
// +kubebuilder:validation:Enum=System;None
// +optional
PrivateDNSZone *string `json:"privateDnsZone" norman:"pointer"`
// AuthorizedIPRanges - Authorized IP Ranges to kubernetes API server.
// +optional
AuthorizedIPRanges *[]string `json:"authorizedIpRanges" norman:"pointer"`
// HTTPApplicationRouting is enabling add-on for the cluster.
// Immutable.
// +optional
HTTPApplicationRouting *bool `json:"httpApplicationRouting"`
// Monitoring is enabling add-on for the AKS cluster.
Monitoring *bool `json:"monitoring"`
// LogAnalyticsWorkspaceResourceGroup is the name of the resource group for the Log Analytics Workspace.
// +optional
LogAnalyticsWorkspaceGroup *string `json:"logAnalyticsWorkspaceGroup" norman:"pointer"`
// LogAnalyticsWorkspaceName is the name of the Log Analytics Workspace.
// +optional
LogAnalyticsWorkspaceName *string `json:"logAnalyticsWorkspaceName" norman:"pointer"`
// ManagedIdentity - Should a managed identity be enabled or not?
ManagedIdentity *bool `json:"managedIdentity" norman:"pointer"`
// UserAssignedIdentity - User assigned identity to be used for the cluster.
UserAssignedIdentity *string `json:"userAssignedIdentity" norman:"pointer"`
}

type AKSClusterConfigStatus struct {
Expand All @@ -76,21 +153,51 @@ type AKSClusterConfigStatus struct {
}

type AKSNodePool struct {
Name *string `json:"name,omitempty" norman:"pointer"`
Count *int32 `json:"count,omitempty"`
MaxPods *int32 `json:"maxPods,omitempty"`
VMSize string `json:"vmSize,omitempty"`
OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"`
OsDiskType string `json:"osDiskType,omitempty"`
Mode string `json:"mode,omitempty"`
OsType string `json:"osType,omitempty"`
OrchestratorVersion *string `json:"orchestratorVersion,omitempty" norman:"pointer"`
AvailabilityZones *[]string `json:"availabilityZones,omitempty" norman:"pointer"`
MaxSurge *string `json:"maxSurge,omitempty"`
MaxCount *int32 `json:"maxCount,omitempty"`
MinCount *int32 `json:"minCount,omitempty"`
EnableAutoScaling *bool `json:"enableAutoScaling,omitempty"`
VnetSubnetID *string `json:"vnetSubnetID,omitempty" norman:"pointer"`
NodeLabels map[string]*string `json:"nodeLabels,omitempty"`
NodeTaints *[]string `json:"nodeTaints,omitempty"`
// Name is the name of the node pool.
Name *string `json:"name,omitempty" norman:"pointer"`
// NodeCount is the number of nodes in the node pool.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Count

Count *int32 `json:"count,omitempty"`
// MaxPods is the maximum number of pods that can run on each node.
MaxPods *int32 `json:"maxPods,omitempty"`
// VMSize is the size of the Virtual Machine.
VMSize string `json:"vmSize,omitempty"`
// OsDiskSizeGB is the disk size of the OS disk in GB.
// +kubebuilder:validation:Minimum=0
OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"`
// OSDiskType is the type of the OS disk.
// +kubebuilder:validation:Enum=Standard_LRS;Premium_LRS;StandardSSD_LRS;UltraSSD_LRS
OsDiskType string `json:"osDiskType,omitempty"`
// Mode is the mode of the node pool.
// +kubebuilder:validation:Enum=System;User
Mode string `json:"mode,omitempty"`
// OsType is the type of the OS.
OsType string `json:"osType,omitempty"`
// OrchestratorVersion is the version of the Kubernetes.
// +kubebuilder:validation:MinLength:=2
OrchestratorVersion *string `json:"orchestratorVersion,omitempty" norman:"pointer"`
// AvailabilityZones is the list of availability zones.
// +optional
// +kubebuilder:validation:UniqueItems:=true
AvailabilityZones *[]string `json:"availabilityZones,omitempty" norman:"pointer"`
// MaxSurge is the maximum number of nodes that can be added to the node pool during an upgrade.
// +optional
MaxSurge *string `json:"maxSurge,omitempty"`
// MaxCount is the maximum number of nodes in the node pool.
// +kubebuilder:validation:Minimum=0
MaxCount *int32 `json:"maxCount,omitempty"`
// MinCount is the minimum number of nodes in the node pool.
// +kubebuilder:validation:Minimum=0
MinCount *int32 `json:"minCount,omitempty"`
// EnableAutoScaling is whether to enable auto scaling or not.
// +optional
EnableAutoScaling *bool `json:"enableAutoScaling,omitempty"`
// VnetSubnetID is the ID of the subnet.
VnetSubnetID *string `json:"vnetSubnetID,omitempty" norman:"pointer"`
// NodeLabels is the list of node labels.
// +optional
NodeLabels map[string]*string `json:"nodeLabels,omitempty"`
// NodeTaints is the list of node taints.
// +kubebuilder:validation:UniqueItems:=true
// +optional
NodeTaints *[]string `json:"nodeTaints,omitempty"`
}
Loading