github.com/vmware/go-vcloud-director/v2@v2.24.0/govcd/cse_type.go (about)

     1  package govcd
     2  
     3  import (
     4  	semver "github.com/hashicorp/go-version"
     5  	"github.com/vmware/go-vcloud-director/v2/types/v56"
     6  	"time"
     7  )
     8  
     9  // CseKubernetesCluster is a type for managing an existing Kubernetes cluster created by the Container Service Extension (CSE)
    10  type CseKubernetesCluster struct {
    11  	CseClusterSettings
    12  	ID                         string
    13  	Etag                       string
    14  	KubernetesVersion          semver.Version
    15  	TkgVersion                 semver.Version
    16  	CapvcdVersion              semver.Version
    17  	ClusterResourceSetBindings []string
    18  	CpiVersion                 semver.Version
    19  	CsiVersion                 semver.Version
    20  	State                      string
    21  	Events                     []CseClusterEvent
    22  
    23  	client            *Client
    24  	capvcdType        *types.Capvcd
    25  	supportedUpgrades []*types.VAppTemplate // Caches the vApp templates that can be used to upgrade a cluster.
    26  }
    27  
    28  // CseClusterSettings defines the required configuration of a Container Service Extension (CSE) Kubernetes cluster.
    29  type CseClusterSettings struct {
    30  	CseVersion              semver.Version
    31  	Name                    string
    32  	OrganizationId          string
    33  	VdcId                   string
    34  	NetworkId               string
    35  	KubernetesTemplateOvaId string
    36  	ControlPlane            CseControlPlaneSettings
    37  	WorkerPools             []CseWorkerPoolSettings
    38  	DefaultStorageClass     *CseDefaultStorageClassSettings // Optional
    39  	Owner                   string                          // Optional, if not set will pick the current session user from the VCDClient
    40  	ApiToken                string
    41  	NodeHealthCheck         bool
    42  	PodCidr                 string
    43  	ServiceCidr             string
    44  	SshPublicKey            string
    45  	VirtualIpSubnet         string
    46  	AutoRepairOnErrors      bool
    47  }
    48  
    49  // CseControlPlaneSettings defines the required configuration of a Control Plane of a Container Service Extension (CSE) Kubernetes cluster.
    50  type CseControlPlaneSettings struct {
    51  	MachineCount      int
    52  	DiskSizeGi        int
    53  	SizingPolicyId    string // Optional
    54  	PlacementPolicyId string // Optional
    55  	StorageProfileId  string // Optional
    56  	Ip                string // Optional
    57  }
    58  
    59  // CseWorkerPoolSettings defines the required configuration of a Worker Pool of a Container Service Extension (CSE) Kubernetes cluster.
    60  type CseWorkerPoolSettings struct {
    61  	Name              string
    62  	MachineCount      int
    63  	DiskSizeGi        int
    64  	SizingPolicyId    string // Optional
    65  	PlacementPolicyId string // Optional
    66  	VGpuPolicyId      string // Optional
    67  	StorageProfileId  string // Optional
    68  }
    69  
    70  // CseDefaultStorageClassSettings defines the required configuration of a Default Storage Class of a Container Service Extension (CSE) Kubernetes cluster.
    71  type CseDefaultStorageClassSettings struct {
    72  	StorageProfileId string
    73  	Name             string
    74  	ReclaimPolicy    string // Must be either "delete" or "retain"
    75  	Filesystem       string // Must be either "ext4" or "xfs"
    76  }
    77  
    78  // CseClusterEvent is an event that has occurred during the lifetime of a Container Service Extension (CSE) Kubernetes cluster.
    79  type CseClusterEvent struct {
    80  	Name         string
    81  	Type         string
    82  	ResourceId   string
    83  	ResourceName string
    84  	OccurredAt   time.Time
    85  	Details      string
    86  }
    87  
    88  // CseClusterUpdateInput defines the required configuration that a Container Service Extension (CSE) Kubernetes cluster needs in order to be updated.
    89  type CseClusterUpdateInput struct {
    90  	KubernetesTemplateOvaId *string
    91  	ControlPlane            *CseControlPlaneUpdateInput
    92  	WorkerPools             *map[string]CseWorkerPoolUpdateInput // Maps a node pool name with its contents
    93  	NewWorkerPools          *[]CseWorkerPoolSettings
    94  	NodeHealthCheck         *bool
    95  	AutoRepairOnErrors      *bool
    96  }
    97  
    98  // CseControlPlaneUpdateInput defines the required configuration that the Control Plane of the Container Service Extension (CSE) Kubernetes cluster
    99  // needs in order to be updated.
   100  type CseControlPlaneUpdateInput struct {
   101  	MachineCount int
   102  }
   103  
   104  // CseWorkerPoolUpdateInput defines the required configuration that a Worker Pool of the Container Service Extension (CSE) Kubernetes cluster
   105  // needs in order to be updated.
   106  type CseWorkerPoolUpdateInput struct {
   107  	MachineCount int
   108  }
   109  
   110  // cseClusterSettingsInternal defines the required arguments that are required by the CSE Server used internally to specify
   111  // a Kubernetes cluster. These are not set by the user, but instead they are computed from a valid
   112  // CseClusterSettings object in the CseClusterSettings.toCseClusterSettingsInternal method. These fields are then
   113  // inserted in Go templates to render a final JSON that is valid to be used as the cluster Runtime Defined Entity (RDE) payload.
   114  //
   115  // The main difference between CseClusterSettings and this structure is that the first one uses IDs and this one uses names, among
   116  // other differences like the computed tkgVersionBundle.
   117  type cseClusterSettingsInternal struct {
   118  	CseVersion                semver.Version
   119  	Name                      string
   120  	OrganizationName          string
   121  	VdcName                   string
   122  	NetworkName               string
   123  	KubernetesTemplateOvaName string
   124  	TkgVersionBundle          tkgVersionBundle
   125  	CatalogName               string
   126  	RdeType                   *types.DefinedEntityType
   127  	ControlPlane              cseControlPlaneSettingsInternal
   128  	WorkerPools               []cseWorkerPoolSettingsInternal
   129  	DefaultStorageClass       cseDefaultStorageClassInternal
   130  	VcdKeConfig               vcdKeConfig
   131  	Owner                     string
   132  	ApiToken                  string
   133  	VcdUrl                    string
   134  	VirtualIpSubnet           string
   135  	SshPublicKey              string
   136  	PodCidr                   string
   137  	ServiceCidr               string
   138  	AutoRepairOnErrors        bool
   139  }
   140  
   141  // tkgVersionBundle is a type that contains all the versions of the components of
   142  // a Kubernetes cluster that can be obtained with the internal properties of the Kubernetes Template OVAs downloaded from
   143  // https://customerconnect.vmware.com
   144  type tkgVersionBundle struct {
   145  	EtcdVersion       string
   146  	CoreDnsVersion    string
   147  	TkgVersion        string
   148  	TkrVersion        string
   149  	KubernetesVersion string
   150  }
   151  
   152  // cseControlPlaneSettingsInternal defines the Control Plane inside cseClusterSettingsInternal
   153  type cseControlPlaneSettingsInternal struct {
   154  	MachineCount        int
   155  	DiskSizeGi          int
   156  	SizingPolicyName    string
   157  	PlacementPolicyName string
   158  	StorageProfileName  string
   159  	Ip                  string
   160  }
   161  
   162  // cseWorkerPoolSettingsInternal defines a Worker Pool inside cseClusterSettingsInternal
   163  type cseWorkerPoolSettingsInternal struct {
   164  	Name                string
   165  	MachineCount        int
   166  	DiskSizeGi          int
   167  	SizingPolicyName    string
   168  	PlacementPolicyName string
   169  	VGpuPolicyName      string
   170  	StorageProfileName  string
   171  }
   172  
   173  // cseDefaultStorageClassInternal defines a Default Storage Class inside cseClusterSettingsInternal
   174  type cseDefaultStorageClassInternal struct {
   175  	StorageProfileName     string
   176  	Name                   string
   177  	UseDeleteReclaimPolicy bool
   178  	Filesystem             string
   179  }
   180  
   181  // vcdKeConfig is a type that contains only the required and relevant fields from the VCDKEConfig (CSE Server) configuration,
   182  // such as the Machine Health Check settings.
   183  type vcdKeConfig struct {
   184  	MaxUnhealthyNodesPercentage float64
   185  	NodeStartupTimeout          string
   186  	NodeNotReadyTimeout         string
   187  	NodeUnknownTimeout          string
   188  	ContainerRegistryUrl        string
   189  	Base64Certificates          []string
   190  }
   191  
   192  // cseComponentsVersions is a type that registers the versions of the subcomponents of a specific CSE Version
   193  type cseComponentsVersions struct {
   194  	VcdKeConfigRdeTypeVersion string
   195  	CapvcdRdeTypeVersion      string
   196  	CseInterfaceVersion       string
   197  }
   198  
   199  // Constants that define the RDE Type of a CSE Kubernetes cluster
   200  const (
   201  	cseKubernetesClusterVendor    = "vmware"
   202  	cseKubernetesClusterNamespace = "capvcdCluster"
   203  )