2019-10-16 06:29:17 +03:00
|
|
|
package api
|
|
|
|
|
2019-12-17 04:16:50 +03:00
|
|
|
// Copyright (c) Microsoft Corporation.
|
|
|
|
// Licensed under the Apache License 2.0.
|
|
|
|
|
2019-10-16 06:29:17 +03:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
// OpenShiftCluster represents an OpenShift cluster
|
|
|
|
type OpenShiftCluster struct {
|
|
|
|
MissingFields
|
|
|
|
|
2019-11-28 19:31:37 +03:00
|
|
|
// ID, Name and Type are cased as the user provided them at create time.
|
|
|
|
// ID, Name, Type and Location are immutable.
|
2020-03-08 02:58:45 +03:00
|
|
|
ID string `json:"id,omitempty"`
|
|
|
|
Name string `json:"name,omitempty"`
|
|
|
|
Type string `json:"type,omitempty"`
|
|
|
|
Location string `json:"location,omitempty"`
|
|
|
|
Tags map[string]string `json:"tags,omitempty"`
|
|
|
|
Properties OpenShiftClusterProperties `json:"properties,omitempty"`
|
2019-10-16 06:29:17 +03:00
|
|
|
}
|
|
|
|
|
2020-02-10 01:39:16 +03:00
|
|
|
// SecureBytes represents an encrypted []byte
|
2020-01-23 14:53:53 +03:00
|
|
|
type SecureBytes []byte
|
|
|
|
|
2020-02-10 01:39:16 +03:00
|
|
|
// SecureString represents an encrypted string
|
2020-01-23 14:53:53 +03:00
|
|
|
type SecureString string
|
|
|
|
|
2020-03-08 02:58:45 +03:00
|
|
|
// OpenShiftClusterProperties represents an OpenShift cluster's properties
|
|
|
|
type OpenShiftClusterProperties struct {
|
2019-10-16 06:29:17 +03:00
|
|
|
MissingFields
|
|
|
|
|
2019-11-28 19:31:37 +03:00
|
|
|
// Provisioning state machine:
|
|
|
|
//
|
|
|
|
// From ARM's perspective, Succeeded and Failed are the only two terminal
|
|
|
|
// provisioning states for asynchronous operations. Clients will poll PUT,
|
|
|
|
// PATCH or DELETE operations until the resource gets to one of those
|
|
|
|
// provisioning states.
|
|
|
|
//
|
|
|
|
// ARO uses Creating, Updating and Deleting as non-terminal provisioning
|
|
|
|
// states to signal asynchronous operations from the front end to the back
|
|
|
|
// end.
|
|
|
|
//
|
|
|
|
// In case of failures, the back end sets failedProvisioningState to the
|
|
|
|
// provisioning state at the time of the failure.
|
|
|
|
//
|
|
|
|
// The ARO front end gates provisioning state machine transitions as
|
|
|
|
// follows:
|
|
|
|
//
|
|
|
|
// * no PUT, PATCH or DELETE is accepted unless the cluster is currently in
|
|
|
|
// a terminal provisioning state.
|
|
|
|
//
|
|
|
|
// * DELETE is always allowed regardless of the terminal provisioning state
|
|
|
|
// of the cluster.
|
|
|
|
//
|
|
|
|
// * PUT and PATCH are allowed as long as the cluster is in Succeeded
|
|
|
|
// provisioning state, or in a Failed provisioning state with the failed
|
|
|
|
// provisioning state to Updating.
|
|
|
|
//
|
|
|
|
// i.e. if a cluster creation or deletion fails, there is no remedy but to
|
|
|
|
// delete the cluster.
|
|
|
|
|
2020-05-06 06:07:32 +03:00
|
|
|
// LastProvisioningState allows the backend to see the last terminal
|
|
|
|
// ProvisioningState. When they complete, regardless of success, admin
|
|
|
|
// updates always reset the ProvisioningState to LastProvisioningState.
|
|
|
|
|
2020-10-31 22:42:32 +03:00
|
|
|
ArchitectureVersion ArchitectureVersion `json:"architectureVersion,omitempty"`
|
|
|
|
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
|
|
|
|
LastProvisioningState ProvisioningState `json:"lastProvisioningState,omitempty"`
|
|
|
|
FailedProvisioningState ProvisioningState `json:"failedProvisioningState,omitempty"`
|
|
|
|
LastAdminUpdateError string `json:"lastAdminUpdateError,omitempty"`
|
2019-10-16 06:29:17 +03:00
|
|
|
|
2021-01-13 15:31:19 +03:00
|
|
|
CreatedAt time.Time `json:"createdAt,omitempty"`
|
|
|
|
|
2020-11-05 05:30:58 +03:00
|
|
|
// CreatedBy is the RP version (Git commit hash) that created this cluster
|
|
|
|
CreatedBy string `json:"createdBy,omitempty"`
|
|
|
|
|
2020-11-05 18:25:04 +03:00
|
|
|
// ProvisionedBy is the RP version (Git commit hash) that last successfully
|
|
|
|
// admin updated this cluster
|
2020-11-05 05:30:58 +03:00
|
|
|
ProvisionedBy string `json:"provisionedBy,omitempty"`
|
|
|
|
|
2020-01-10 17:52:45 +03:00
|
|
|
ClusterProfile ClusterProfile `json:"clusterProfile,omitempty"`
|
2019-12-31 06:49:34 +03:00
|
|
|
|
2020-01-16 18:16:50 +03:00
|
|
|
ConsoleProfile ConsoleProfile `json:"consoleProfile,omitempty"`
|
|
|
|
|
2019-11-18 06:07:44 +03:00
|
|
|
ServicePrincipalProfile ServicePrincipalProfile `json:"servicePrincipalProfile,omitempty"`
|
|
|
|
|
2019-10-16 06:29:17 +03:00
|
|
|
NetworkProfile NetworkProfile `json:"networkProfile,omitempty"`
|
|
|
|
|
|
|
|
MasterProfile MasterProfile `json:"masterProfile,omitempty"`
|
|
|
|
|
|
|
|
WorkerProfiles []WorkerProfile `json:"workerProfiles,omitempty"`
|
|
|
|
|
2019-12-31 17:22:06 +03:00
|
|
|
APIServerProfile APIServerProfile `json:"apiserverProfile,omitempty"`
|
|
|
|
|
2019-12-31 23:45:25 +03:00
|
|
|
IngressProfiles []IngressProfile `json:"ingressProfiles,omitempty"`
|
|
|
|
|
2019-11-28 19:41:23 +03:00
|
|
|
// Install is non-nil only when an install is in progress
|
|
|
|
Install *Install `json:"install,omitempty"`
|
2019-10-16 06:29:17 +03:00
|
|
|
|
|
|
|
StorageSuffix string `json:"storageSuffix,omitempty"`
|
|
|
|
|
2020-04-15 05:48:03 +03:00
|
|
|
InfraID string `json:"infraId,omitempty"`
|
2020-03-10 02:53:27 +03:00
|
|
|
SSHKey SecureBytes `json:"sshKey,omitempty"`
|
|
|
|
AdminKubeconfig SecureBytes `json:"adminKubeconfig,omitempty"`
|
2020-03-11 01:22:20 +03:00
|
|
|
AROServiceKubeconfig SecureBytes `json:"aroServiceKubeconfig,omitempty"`
|
2020-10-03 00:53:15 +03:00
|
|
|
AROSREKubeconfig SecureBytes `json:"aroSREKubeconfig,omitempty"`
|
2020-03-10 02:53:27 +03:00
|
|
|
KubeadminPassword SecureString `json:"kubeadminPassword,omitempty"`
|
2020-03-12 07:51:04 +03:00
|
|
|
|
2020-03-21 04:57:07 +03:00
|
|
|
RegistryProfiles []*RegistryProfile `json:"registryProfiles,omitempty"`
|
2019-10-16 06:29:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// ProvisioningState represents a provisioning state
|
|
|
|
type ProvisioningState string
|
|
|
|
|
|
|
|
// ProvisioningState constants
|
|
|
|
const (
|
2020-01-24 14:19:56 +03:00
|
|
|
ProvisioningStateCreating ProvisioningState = "Creating"
|
|
|
|
ProvisioningStateUpdating ProvisioningState = "Updating"
|
|
|
|
ProvisioningStateAdminUpdating ProvisioningState = "AdminUpdating"
|
|
|
|
ProvisioningStateDeleting ProvisioningState = "Deleting"
|
|
|
|
ProvisioningStateSucceeded ProvisioningState = "Succeeded"
|
|
|
|
ProvisioningStateFailed ProvisioningState = "Failed"
|
2019-10-16 06:29:17 +03:00
|
|
|
)
|
|
|
|
|
2020-02-18 18:06:47 +03:00
|
|
|
// IsTerminal returns true if state is Terminal
|
|
|
|
func (t ProvisioningState) IsTerminal() bool {
|
|
|
|
return ProvisioningStateFailed == t || ProvisioningStateSucceeded == t
|
|
|
|
}
|
|
|
|
|
2020-08-06 14:21:55 +03:00
|
|
|
func (t ProvisioningState) String() string {
|
|
|
|
return string(t)
|
|
|
|
}
|
|
|
|
|
2020-01-10 17:52:45 +03:00
|
|
|
// ClusterProfile represents a cluster profile.
|
|
|
|
type ClusterProfile struct {
|
|
|
|
MissingFields
|
|
|
|
|
2020-03-19 01:37:03 +03:00
|
|
|
PullSecret SecureString `json:"pullSecret,omitempty"`
|
|
|
|
Domain string `json:"domain,omitempty"`
|
|
|
|
Version string `json:"version,omitempty"`
|
|
|
|
ResourceGroupID string `json:"resourceGroupId,omitempty"`
|
2020-01-10 17:52:45 +03:00
|
|
|
}
|
|
|
|
|
2020-01-16 18:16:50 +03:00
|
|
|
// ConsoleProfile represents a console profile.
|
|
|
|
type ConsoleProfile struct {
|
|
|
|
MissingFields
|
|
|
|
|
|
|
|
URL string `json:"url,omitempty"`
|
|
|
|
}
|
|
|
|
|
2019-11-18 06:07:44 +03:00
|
|
|
// ServicePrincipalProfile represents a service principal profile.
|
|
|
|
type ServicePrincipalProfile struct {
|
2019-11-21 05:32:34 +03:00
|
|
|
MissingFields
|
|
|
|
|
2020-01-23 14:53:53 +03:00
|
|
|
ClientID string `json:"clientId,omitempty"`
|
|
|
|
ClientSecret SecureString `json:"clientSecret,omitempty"`
|
2021-02-15 22:22:40 +03:00
|
|
|
SPObjectID string `json:"spObjectId,omitempty"`
|
2019-11-18 06:07:44 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// NetworkProfile represents a network profile
|
2019-10-16 06:29:17 +03:00
|
|
|
type NetworkProfile struct {
|
2019-11-21 05:32:34 +03:00
|
|
|
MissingFields
|
|
|
|
|
2019-10-16 06:29:17 +03:00
|
|
|
PodCIDR string `json:"podCidr,omitempty"`
|
|
|
|
ServiceCIDR string `json:"serviceCidr,omitempty"`
|
2020-01-10 16:46:54 +03:00
|
|
|
|
|
|
|
PrivateEndpointIP string `json:"privateEndpointIp,omitempty"`
|
2019-10-16 06:29:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// MasterProfile represents a master profile
|
|
|
|
type MasterProfile struct {
|
2019-11-21 05:32:34 +03:00
|
|
|
MissingFields
|
|
|
|
|
|
|
|
VMSize VMSize `json:"vmSize,omitempty"`
|
|
|
|
SubnetID string `json:"subnetId,omitempty"`
|
2019-10-16 06:29:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// VMSize represents a VM size
|
|
|
|
type VMSize string
|
|
|
|
|
|
|
|
// VMSize constants
|
2020-02-10 18:47:35 +03:00
|
|
|
// add required resources in pkg/api/validate/quota.go when adding a new VMSize
|
2019-10-16 06:29:17 +03:00
|
|
|
const (
|
|
|
|
VMSizeStandardD2sV3 VMSize = "Standard_D2s_v3"
|
2020-04-16 04:42:36 +03:00
|
|
|
|
|
|
|
VMSizeStandardD4asV4 VMSize = "Standard_D4as_v4"
|
|
|
|
VMSizeStandardD8asV4 VMSize = "Standard_D8as_v4"
|
|
|
|
VMSizeStandardD16asV4 VMSize = "Standard_D16as_v4"
|
|
|
|
VMSizeStandardD32asV4 VMSize = "Standard_D32as_v4"
|
|
|
|
|
|
|
|
VMSizeStandardD4sV3 VMSize = "Standard_D4s_v3"
|
|
|
|
VMSizeStandardD8sV3 VMSize = "Standard_D8s_v3"
|
|
|
|
VMSizeStandardD16sV3 VMSize = "Standard_D16s_v3"
|
|
|
|
VMSizeStandardD32sV3 VMSize = "Standard_D32s_v3"
|
|
|
|
|
|
|
|
VMSizeStandardE4sV3 VMSize = "Standard_E4s_v3"
|
|
|
|
VMSizeStandardE8sV3 VMSize = "Standard_E8s_v3"
|
|
|
|
VMSizeStandardE16sV3 VMSize = "Standard_E16s_v3"
|
|
|
|
VMSizeStandardE32sV3 VMSize = "Standard_E32s_v3"
|
|
|
|
|
|
|
|
VMSizeStandardF4sV2 VMSize = "Standard_F4s_v2"
|
|
|
|
VMSizeStandardF8sV2 VMSize = "Standard_F8s_v2"
|
|
|
|
VMSizeStandardF16sV2 VMSize = "Standard_F16s_v2"
|
|
|
|
VMSizeStandardF32sV2 VMSize = "Standard_F32s_v2"
|
2019-10-16 06:29:17 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
// WorkerProfile represents a worker profile
|
|
|
|
type WorkerProfile struct {
|
2019-11-21 05:32:34 +03:00
|
|
|
MissingFields
|
|
|
|
|
2019-10-16 06:29:17 +03:00
|
|
|
Name string `json:"name,omitempty"`
|
|
|
|
VMSize VMSize `json:"vmSize,omitempty"`
|
|
|
|
DiskSizeGB int `json:"diskSizeGB,omitempty"`
|
2019-11-21 05:32:34 +03:00
|
|
|
SubnetID string `json:"subnetId,omitempty"`
|
2019-10-16 06:29:17 +03:00
|
|
|
Count int `json:"count,omitempty"`
|
|
|
|
}
|
|
|
|
|
2019-12-31 17:22:06 +03:00
|
|
|
// APIServerProfile represents an API server profile
|
|
|
|
type APIServerProfile struct {
|
|
|
|
MissingFields
|
|
|
|
|
2020-01-02 22:03:33 +03:00
|
|
|
Visibility Visibility `json:"visibility,omitempty"`
|
|
|
|
URL string `json:"url,omitempty"`
|
|
|
|
IP string `json:"ip,omitempty"`
|
2019-12-31 17:22:06 +03:00
|
|
|
}
|
|
|
|
|
2020-01-02 22:03:33 +03:00
|
|
|
// Visibility represents visibility.
|
|
|
|
type Visibility string
|
|
|
|
|
|
|
|
// Visibility constants
|
|
|
|
const (
|
|
|
|
VisibilityPublic Visibility = "Public"
|
|
|
|
VisibilityPrivate Visibility = "Private"
|
|
|
|
)
|
|
|
|
|
2019-12-31 23:45:25 +03:00
|
|
|
// IngressProfile represents an ingress profile
|
|
|
|
type IngressProfile struct {
|
|
|
|
MissingFields
|
|
|
|
|
2020-01-02 22:03:33 +03:00
|
|
|
Name string `json:"name,omitempty"`
|
|
|
|
Visibility Visibility `json:"visibility,omitempty"`
|
|
|
|
IP string `json:"ip,omitempty"`
|
2019-12-31 23:45:25 +03:00
|
|
|
}
|
|
|
|
|
2020-03-12 07:51:04 +03:00
|
|
|
// RegistryProfile represents a registry's login
|
|
|
|
type RegistryProfile struct {
|
|
|
|
MissingFields
|
|
|
|
|
|
|
|
Name string `json:"name,omitempty"`
|
|
|
|
Username string `json:"username,omitempty"`
|
|
|
|
Password SecureString `json:"password,omitempty"`
|
|
|
|
}
|
|
|
|
|
2019-11-28 19:41:23 +03:00
|
|
|
// Install represents an install process
|
|
|
|
type Install struct {
|
2019-10-16 06:29:17 +03:00
|
|
|
MissingFields
|
|
|
|
|
2019-11-28 19:41:23 +03:00
|
|
|
Now time.Time `json:"now,omitempty"`
|
|
|
|
Phase InstallPhase `json:"phase"`
|
2019-10-16 06:29:17 +03:00
|
|
|
}
|
|
|
|
|
2019-11-28 19:41:23 +03:00
|
|
|
// InstallPhase represents an install phase
|
|
|
|
type InstallPhase int
|
2019-10-16 06:29:17 +03:00
|
|
|
|
2019-11-28 19:41:23 +03:00
|
|
|
// InstallPhase constants
|
2019-10-16 06:29:17 +03:00
|
|
|
const (
|
2020-03-06 23:23:51 +03:00
|
|
|
InstallPhaseBootstrap InstallPhase = iota
|
2019-11-28 19:41:23 +03:00
|
|
|
InstallPhaseRemoveBootstrap
|
2019-10-16 06:29:17 +03:00
|
|
|
)
|
2020-10-31 22:42:32 +03:00
|
|
|
|
|
|
|
// ArchitectureVersion represents an architecture version
|
|
|
|
type ArchitectureVersion int
|
|
|
|
|
|
|
|
// ArchitectureVersion constants
|
|
|
|
const (
|
|
|
|
// ArchitectureVersionV1: 4.3, 4.4: 2 load balancers, 2 NSGs
|
|
|
|
ArchitectureVersionV1 ArchitectureVersion = iota
|
2020-10-31 23:31:10 +03:00
|
|
|
// ArchitectureVersionV2: 4.5: 1 load balancer, 1 NSG
|
|
|
|
ArchitectureVersionV2
|
2020-10-31 22:42:32 +03:00
|
|
|
)
|