tkgconfigproviders

package
v0.0.0-...-b25b198 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package tkgconfigproviders helps setup and modify configs for TKG supported providers

Index

Constants

This section is empty.

Variables

View Source
var NodeTypes map[string]nodeType

NodeTypes defines a struct of clusterPlan map

Functions

func CheckAndGetProxyURL

func CheckAndGetProxyURL(username, password, proxyURL string) (string, error)

CheckAndGetProxyURL validates and returns the proxy URL

func GetVsphereNodeSizeOptions

func GetVsphereNodeSizeOptions() string

GetVsphereNodeSizeOptions returns the list of vSphere node size options

Types

type AWSConfig

type AWSConfig struct {
	AccessKeyID           string `yaml:"AWS_ACCESS_KEY_ID,omitempty"`
	AMIID                 string `yaml:"AWS_AMI_ID,omitempty"`
	AWSPrivateSubnetID    string `yaml:"AWS_PRIVATE_SUBNET_ID"`
	AWSPrivateSubnetID2   string `yaml:"AWS_PRIVATE_SUBNET_ID_1"`
	AWSPrivateSubnetID3   string `yaml:"AWS_PRIVATE_SUBNET_ID_2"`
	AWSPublicSubnetID     string `yaml:"AWS_PUBLIC_SUBNET_ID"`
	AWSPublicSubnetID2    string `yaml:"AWS_PUBLIC_SUBNET_ID_1"`
	AWSPublicSubnetID3    string `yaml:"AWS_PUBLIC_SUBNET_ID_2"`
	AWSVPCID              string `yaml:"AWS_VPC_ID"`
	B64EncodedCredentials string `yaml:"AWS_B64ENCODED_CREDENTIALS,omitempty"`
	BastionHostEnabled    string `yaml:"BASTION_HOST_ENABLED"`
	CeipParticipation     string `yaml:"ENABLE_CEIP_PARTICIPATION,omitempty"`
	ClusterAnnotations    string `yaml:"CLUSTER_ANNOTATIONS,omitempty"`
	ClusterCidr           string `yaml:"CLUSTER_CIDR"`
	ClusterHTTPProxy      string `yaml:"TKG_HTTP_PROXY,omitempty"`
	ClusterHTTPSProxy     string `yaml:"TKG_HTTPS_PROXY,omitempty"`
	ClusterLabels         string `yaml:"CLUSTER_LABELS,omitempty"`
	ClusterName           string `yaml:"CLUSTER_NAME,omitempty"`
	ClusterNoProxy        string `yaml:"TKG_NO_PROXY,omitempty"`
	ClusterPlan           string `yaml:"CLUSTER_PLAN,omitempty"`
	ControlPlaneNodeType  string `yaml:"CONTROL_PLANE_MACHINE_TYPE,omitempty"`
	// ControlPlaneOSDiskSizeGiB is the size of the root volume of the control plane instances of a cluster
	ControlPlaneOSDiskSizeGiB  string `yaml:"AWS_CONTROL_PLANE_OS_DISK_SIZE_GIB,omitempty"`
	CredentialProfile          string `yaml:"AWS_PROFILE,omitempty"`
	EnableAuditLogging         string `yaml:"ENABLE_AUDIT_LOGGING"`
	HTTPProxyEnabled           string `yaml:"TKG_HTTP_PROXY_ENABLED"`
	InfrastructureProvider     string `yaml:"INFRASTRUCTURE_PROVIDER,omitempty"`
	LoadBalancerSchemeInternal string `yaml:"AWS_LOAD_BALANCER_SCHEME_INTERNAL,omitempty"`
	MachineHealthCheckEnabled  string `yaml:"ENABLE_MHC"`
	Node2Az                    string `yaml:"AWS_NODE_AZ_1"`
	Node3Az                    string `yaml:"AWS_NODE_AZ_2"`
	NodeAz                     string `yaml:"AWS_NODE_AZ"`
	NodeMachineType            string `yaml:"NODE_MACHINE_TYPE,omitempty"`
	NodeMachineType1           string `yaml:"NODE_MACHINE_TYPE_1,omitempty"`
	NodeMachineType2           string `yaml:"NODE_MACHINE_TYPE_2,omitempty"`
	// NodeOSDiskSizeGiB is the size of the root volume of the node instances of a cluster
	NodeOSDiskSizeGiB      string                    `yaml:"AWS_NODE_OS_DISK_SIZE_GIB,omitempty"`
	PrivateNode2Cidr       string                    `yaml:"AWS_PRIVATE_NODE_CIDR_1"`
	PrivateNode3Cidr       string                    `yaml:"AWS_PRIVATE_NODE_CIDR_2"`
	PrivateNodeCidr        string                    `yaml:"AWS_PRIVATE_NODE_CIDR"`
	PublicNode2Cidr        string                    `yaml:"AWS_PUBLIC_NODE_CIDR_1"`
	PublicNode3Cidr        string                    `yaml:"AWS_PUBLIC_NODE_CIDR_2"`
	PublicNodeCidr         string                    `yaml:"AWS_PUBLIC_NODE_CIDR"`
	Region                 string                    `yaml:"AWS_REGION,omitempty"`
	SecretAcessKey         string                    `yaml:"AWS_SECRET_ACCESS_KEY,omitempty"`
	ServiceCidr            string                    `yaml:"SERVICE_CIDR"`
	SessionToken           string                    `yaml:"AWS_SESSION_TOKEN,omitempty"`
	SSHKeyName             string                    `yaml:"AWS_SSH_KEY_NAME"`
	VPCCidr                string                    `yaml:"AWS_VPC_CIDR"`
	IdentityReference      AWSIdentityReference      `yaml:",inline"`
	SecurityGroupOverrides AWSSecurityGroupOverrides `yaml:",inline"`
	IDPConfig              `yaml:",inline"`
	OsInfo                 `yaml:",inline"`
}

AWSConfig is the tkg config for aws

type AWSIdentityReference

type AWSIdentityReference struct {
	// Kind is an optional kind of a Kubernetes resource containing  an identity to be used for a cluster.
	// Defaults to AWSClusterRoleIdentity if Name is set
	Kind string `yaml:"AWS_IDENTITY_REF_KIND,omitempty"`
	// Name is an optional name of a Kubernetes resource containing an identity to be used for a cluster.
	Name string `yaml:"AWS_IDENTITY_REF_NAME,omitempty"`
}

AWSIdentityReference defines an optional reference to a AWS Identity Reference resource.

type AWSSecurityGroupOverrides

type AWSSecurityGroupOverrides struct {
	// APIServerLoadBalancer is an optional security group ID of a pre-created security group that will be used for Kubernetes
	// API Server ELB, and will control inbound access to the the control plane endpoint
	APIServerLoadBalancer string `yaml:"AWS_SECURITY_GROUP_APISERVER_LB,omitempty"`
	// Bastion is an optional security group ID of a pre-created security group that will be used to control in-bound access
	// to the bastion
	Bastion string `yaml:"AWS_SECURITY_GROUP_BASTION,omitempty"`
	// ControlPlane is an optional security group ID of a pre-created security group that will be used to control in-bound
	// access to the control plane nodes
	ControlPlane string `yaml:"AWS_SECURITY_GROUP_CONTROLPLANE,omitempty"`
	// CloudProviderLoadBalancer is an optional security group ID for use by the Kubernetes AWS Cloud Provider for setting rules
	// for ELBs
	CloudProviderLoadBalancer string `yaml:"AWS_SECURITY_GROUP_LB,omitempty"`
	// Node is an optional security group ID that will be used to to control in-bound acceess to all nodes
	Node string `yaml:"AWS_SECURITY_GROUP_NODE,omitempty"`
}

AWSSecurityGroupOverrides can be used in conjunction with Bring Your Own Infrastructure to define specific security group IDs to use for the cluster

type AzureConfig

type AzureConfig struct {
	ClusterName               string `yaml:"CLUSTER_NAME,omitempty"`
	ClusterLabels             string `yaml:"CLUSTER_LABELS,omitempty"`
	ClusterAnnotations        string `yaml:"CLUSTER_ANNOTATIONS,omitempty"`
	InfrastructureProvider    string `yaml:"INFRASTRUCTURE_PROVIDER,omitempty"`
	ClusterPlan               string `yaml:"CLUSTER_PLAN,omitempty"`
	CeipParticipation         string `yaml:"ENABLE_CEIP_PARTICIPATION,omitempty"`
	Region                    string `yaml:"AZURE_LOCATION,omitempty"`
	SubscriptionID            string `yaml:"AZURE_SUBSCRIPTION_ID,omitempty"`
	Environment               string `yaml:"AZURE_ENVIRONMENT,omitempty"`
	TenantID                  string `yaml:"AZURE_TENANT_ID,omitempty"`
	ClientID                  string `yaml:"AZURE_CLIENT_ID,omitempty"`
	ClientSecret              string `yaml:"AZURE_CLIENT_SECRET,omitempty"`
	SSHKeyB64                 string `yaml:"AZURE_SSH_PUBLIC_KEY_B64,omitempty"`
	ControlPlaneMachineType   string `yaml:"AZURE_CONTROL_PLANE_MACHINE_TYPE,omitempty"`
	NodeMachineType           string `yaml:"AZURE_NODE_MACHINE_TYPE,omitempty"`
	ResourceGroup             string `yaml:"AZURE_RESOURCE_GROUP,omitempty"`
	VNetResourceGroup         string `yaml:"AZURE_VNET_RESOURCE_GROUP,omitempty"`
	VNetName                  string `yaml:"AZURE_VNET_NAME,omitempty"`
	ControlPlaneSubnet        string `yaml:"AZURE_CONTROL_PLANE_SUBNET_NAME,omitempty"`
	WorkerNodeSubnet          string `yaml:"AZURE_NODE_SUBNET_NAME,omitempty"`
	VNetCIDR                  string `yaml:"AZURE_VNET_CIDR,omitempty"`
	ControlPlaneSubnetCIDR    string `yaml:"AZURE_CONTROL_PLANE_SUBNET_CIDR,omitempty"`
	ControlPlaneSubnetSG      string `yaml:"AZURE_CONTROL_PLANE_SUBNET_SECURITY_GROUP,omitempty"`
	WorkerNodeSubnetCIDR      string `yaml:"AZURE_NODE_SUBNET_CIDR,omitempty"`
	WorkerNodeSubnetSG        string `yaml:"AZURE_NODE_SUBNET_SECURITY_GROUP,omitempty"`
	MachineHealthCheckEnabled string `yaml:"ENABLE_MHC,omitempty"`
	EnableAuditLogging        string `yaml:"ENABLE_AUDIT_LOGGING"`
	ServiceCIDR               string `yaml:"SERVICE_CIDR,omitempty"`
	ClusterCIDR               string `yaml:"CLUSTER_CIDR,omitempty"`
	ClusterHTTPProxy          string `yaml:"TKG_HTTP_PROXY,omitempty"`
	ClusterHTTPSProxy         string `yaml:"TKG_HTTPS_PROXY,omitempty"`
	ClusterNoProxy            string `yaml:"TKG_NO_PROXY,omitempty"`
	HTTPProxyEnabled          string `yaml:"TKG_HTTP_PROXY_ENABLED"`
	EnablePrivateCluster      string `yaml:"AZURE_ENABLE_PRIVATE_CLUSTER"`
	FrontendPrivateIP         string `yaml:"AZURE_FRONTEND_PRIVATE_IP"`
	IDPConfig                 `yaml:",inline"`
	OsInfo                    `yaml:",inline"`
}

AzureConfig is the tkg config for Azure

type Client

type Client interface {
	NewAWSConfig(params *models.AWSRegionalClusterParams, encodedCredentials string) (*AWSConfig, error)
	GetAzureVMImageInfo(tkrVersion string) (*tkgconfigbom.AzureInfo, error)
	GetAWSAMIInfo(bomConfiguration *tkgconfigbom.BOMConfiguration, awsRegion string) (*tkgconfigbom.AMIInfo, error)
	NewAzureConfig(params *models.AzureRegionalClusterParams) (*AzureConfig, error)
	NewVSphereConfig(params *models.VsphereRegionalClusterParams) (*VSphereConfig, error)
	NewDockerConfig(params *models.DockerRegionalClusterParams) (*DockerConfig, error)
	CreateAWSParams(res *AWSConfig) (params *models.AWSRegionalClusterParams, err error)
	CreateAzureParams(res *AzureConfig) (params *models.AzureRegionalClusterParams, err error)
	CreateDockerParams(res *DockerConfig) (params *models.DockerRegionalClusterParams, err error)
	CreateVSphereParams(res *VSphereConfig) (params *models.VsphereRegionalClusterParams, err error)
}

Client implements TKG provider configuration related functions

func New

func New(configDir string, tkgConfigReaderWriter tkgconfigreaderwriter.TKGConfigReaderWriter) Client

New creates new tkgconfig providers client

type DockerConfig

type DockerConfig struct {
	ClusterName               string `yaml:"CLUSTER_NAME,omitempty"`
	ClusterLabels             string `yaml:"CLUSTER_LABELS,omitempty"`
	ClusterAnnotations        string `yaml:"CLUSTER_ANNOTATIONS,omitempty"`
	InfrastructureProvider    string `yaml:"INFRASTRUCTURE_PROVIDER,omitempty"`
	ClusterPlan               string `yaml:"CLUSTER_PLAN,omitempty"`
	CeipParticipation         string `yaml:"ENABLE_CEIP_PARTICIPATION,omitempty"`
	MachineHealthCheckEnabled string `yaml:"ENABLE_MHC,omitempty"`
	ServiceCIDR               string `yaml:"SERVICE_CIDR,omitempty"`
	ClusterCIDR               string `yaml:"CLUSTER_CIDR,omitempty"`
	ClusterHTTPProxy          string `yaml:"TKG_HTTP_PROXY,omitempty"`
	ClusterHTTPSProxy         string `yaml:"TKG_HTTPS_PROXY,omitempty"`
	ClusterNoProxy            string `yaml:"TKG_NO_PROXY,omitempty"`
	HTTPProxyEnabled          string `yaml:"TKG_HTTP_PROXY_ENABLED"`
	IDPConfig                 `yaml:",inline"`
	OsInfo                    `yaml:",inline"`
}

DockerConfig is the tkg config file for docker provider

type IDPConfig

type IDPConfig struct {
	IdentityManagementType string `yaml:"IDENTITY_MANAGEMENT_TYPE"`
	OIDCConfig             `yaml:",inline"`
	LDAPConfig             `yaml:",inline"`
}

IDPConfig struct defining properties for identity provider configuration

type K8sVersionAMIMap

type K8sVersionAMIMap map[string]string

K8sVersionAMIMap represents map of k8s version to aws AMI ID to use for that k8s version

type LDAPConfig

type LDAPConfig struct {
	LDAPBindDN               string `yaml:"LDAP_BIND_DN"`
	LDAPBindPassword         string `yaml:"LDAP_BIND_PASSWORD"`
	LDAPHost                 string `yaml:"LDAP_HOST"`
	LDAPUserSearchBaseDN     string `yaml:"LDAP_USER_SEARCH_BASE_DN"`
	LDAPUserSearchFilter     string `yaml:"LDAP_USER_SEARCH_FILTER"`
	LDAPUserSearchUsername   string `yaml:"LDAP_USER_SEARCH_USERNAME"`
	LDAPUserSearchNameAttr   string `yaml:"LDAP_USER_SEARCH_NAME_ATTRIBUTE"`
	LDAPGroupSearchBaseDN    string `yaml:"LDAP_GROUP_SEARCH_BASE_DN"`
	LDAPGroupSearchFilter    string `yaml:"LDAP_GROUP_SEARCH_FILTER"`
	LDAPGroupSearchUserAttr  string `yaml:"LDAP_GROUP_SEARCH_USER_ATTRIBUTE"`
	LDAPGroupSearchGroupAttr string `yaml:"LDAP_GROUP_SEARCH_GROUP_ATTRIBUTE"`
	LDAPGroupSearchNameAttr  string `yaml:"LDAP_GROUP_SEARCH_NAME_ATTRIBUTE"`
	LDAPRootCAData           string `yaml:"LDAP_ROOT_CA_DATA_B64"`
}

LDAPConfig struct defining properties for OIDC configuration

type OIDCConfig

type OIDCConfig struct {
	OIDCProviderName  string `yaml:"OIDC_IDENTITY_PROVIDER_NAME"`
	OIDCIssuerURL     string `yaml:"OIDC_IDENTITY_PROVIDER_ISSUER_URL"`
	OIDCClientID      string `yaml:"OIDC_IDENTITY_PROVIDER_CLIENT_ID"`
	OIDCClientSecret  string `yaml:"OIDC_IDENTITY_PROVIDER_CLIENT_SECRET"`
	OIDCScopes        string `yaml:"OIDC_IDENTITY_PROVIDER_SCOPES"`
	OIDCGroupsClaim   string `yaml:"OIDC_IDENTITY_PROVIDER_GROUPS_CLAIM"`
	OIDCUsernameClaim string `yaml:"OIDC_IDENTITY_PROVIDER_USERNAME_CLAIM"`
}

OIDCConfig struct defining properties for OIDC configuration

type OsInfo

type OsInfo struct {
	Name    string `yaml:"OS_NAME"`
	Version string `yaml:"OS_VERSION"`
	Arch    string `yaml:"OS_ARCH"`
}

OsInfo struct defining os name, version and arch properties of VM image

type VSphereConfig

type VSphereConfig struct {
	ClusterName            string `yaml:"CLUSTER_NAME,omitempty"`
	ClusterLabels          string `yaml:"CLUSTER_LABELS,omitempty"`
	ClusterAnnotations     string `yaml:"CLUSTER_ANNOTATIONS,omitempty"`
	InfrastructureProvider string `yaml:"INFRASTRUCTURE_PROVIDER,omitempty"`
	ClusterPlan            string `yaml:"CLUSTER_PLAN,omitempty"`
	CeipParticipation      string `yaml:"ENABLE_CEIP_PARTICIPATION,omitempty"`

	K8sVersion                                     string `yaml:"KUBERNETES_VERSION,omitempty"`
	IPFamily                                       string `yaml:"TKG_IP_FAMILY,omitempty"`
	Server                                         string `yaml:"VSPHERE_SERVER,omitempty"`
	Username                                       string `yaml:"VSPHERE_USERNAME,omitempty"`
	Password                                       string `yaml:"VSPHERE_PASSWORD,omitempty"`
	VSphereInsecure                                string `yaml:"VSPHERE_INSECURE,omitempty"`
	Datacenter                                     string `yaml:"VSPHERE_DATACENTER,omitempty"`
	Datastore                                      string `yaml:"VSPHERE_DATASTORE,omitempty"`
	Network                                        string `yaml:"VSPHERE_NETWORK,omitempty"`
	ResourcePool                                   string `yaml:"VSPHERE_RESOURCE_POOL,omitempty"`
	Folder                                         string `yaml:"VSPHERE_FOLDER,omitempty"`
	ControlPlaneDiskGIB                            string `yaml:"VSPHERE_CONTROL_PLANE_DISK_GIB,omitempty"`
	ControlPlaneCPUs                               string `yaml:"VSPHERE_CONTROL_PLANE_NUM_CPUS,omitempty"`
	ControlPlaneMemory                             string `yaml:"VSPHERE_CONTROL_PLANE_MEM_MIB,omitempty"`
	WorkerDiskGIB                                  string `yaml:"VSPHERE_WORKER_DISK_GIB,omitempty"`
	WorkerCPUs                                     string `yaml:"VSPHERE_WORKER_NUM_CPUS,omitempty"`
	WorkerMemory                                   string `yaml:"VSPHERE_WORKER_MEM_MIB,omitempty"`
	SSHKey                                         string `yaml:"VSPHERE_SSH_AUTHORIZED_KEY,omitempty"`
	ServiceCIDR                                    string `yaml:"SERVICE_CIDR,omitempty"`
	ClusterCIDR                                    string `yaml:"CLUSTER_CIDR,omitempty"`
	ServiceDomain                                  string `yaml:"SERVICE_DOMAIN,omitempty"`
	MachineHealthCheckEnabled                      string `yaml:"ENABLE_MHC"`
	ControlPlaneEndpoint                           string `yaml:"VSPHERE_CONTROL_PLANE_ENDPOINT"`
	VSphereTLSThumbprint                           string `yaml:"VSPHERE_TLS_THUMBPRINT"`
	ClusterHTTPProxy                               string `yaml:"TKG_HTTP_PROXY,omitempty"`
	ClusterHTTPSProxy                              string `yaml:"TKG_HTTPS_PROXY,omitempty"`
	ClusterNoProxy                                 string `yaml:"TKG_NO_PROXY,omitempty"`
	HTTPProxyEnabled                               string `yaml:"TKG_HTTP_PROXY_ENABLED"`
	AviController                                  string `yaml:"AVI_CONTROLLER"`
	AviUsername                                    string `yaml:"AVI_USERNAME"`
	AviPassword                                    string `yaml:"AVI_PASSWORD"`
	AviCloudName                                   string `yaml:"AVI_CLOUD_NAME"`
	AviServiceEngine                               string `yaml:"AVI_SERVICE_ENGINE_GROUP"`
	AviDataNetwork                                 string `yaml:"AVI_DATA_NETWORK"`
	AviDataNetworkCIDR                             string `yaml:"AVI_DATA_NETWORK_CIDR"`
	AviControlPlaneNetwork                         string `yaml:"AVI_CONTROL_PLANE_NETWORK"`
	AviControlPlaneNetworkCIDR                     string `yaml:"AVI_CONTROL_PLANE_NETWORK_CIDR"`
	AviCAData                                      string `yaml:"AVI_CA_DATA_B64"`
	AviLabels                                      string `yaml:"AVI_LABELS"`
	AviEnable                                      string `yaml:"AVI_ENABLE"`
	EnableAuditLogging                             string `yaml:"ENABLE_AUDIT_LOGGING"`
	AviControlPlaneEndpointProvider                string `yaml:"AVI_CONTROL_PLANE_HA_PROVIDER,omitempty"`
	AviManagementClusterServiceEngine              string `yaml:"AVI_MANAGEMENT_CLUSTER_SERVICE_ENGINE_GROUP"`
	AviManagementClusterVipNetworkName             string `yaml:"AVI_MANAGEMENT_CLUSTER_VIP_NETWORK_NAME"`
	AviManagementClusterVipNetworkCidr             string `yaml:"AVI_MANAGEMENT_CLUSTER_VIP_NETWORK_CIDR"`
	AviManagementClusterControlPlaneVipNetworkName string `yaml:"AVI_MANAGEMENT_CLUSTER_CONTROL_PLANE_VIP_NETWORK_NAME"`
	AviManagementClusterControlPlaneVipNetworkCIDR string `yaml:"AVI_MANAGEMENT_CLUSTER_CONTROL_PLANE_VIP_NETWORK_CIDR"`
	VSphereWorkerPCIDevices                        string `yaml:"VSPHERE_WORKER_PCI_DEVICES,omitempty"`
	VSphereControlPlanePCIDevices                  string `yaml:"VSPHERE_CONTROL_PLANE_PCI_DEVICES,omitempty"`
	WorkerRolloutStrategy                          string `yaml:"WORKER_ROLLOUT_STRATEGY"`
	VSphereControlPlaneCustomVMXKeys               string `yaml:"VSPHERE_CONTROL_PLANE_CUSTOM_VMX_KEYS,omitempty"`
	VSphereWorkerCustomVMXKeys                     string `yaml:"VSPHERE_WORKER_CUSTOM_VMX_KEYS,omitempty"`
	VSphereIgnorePCIDevicesAllowList               string `yaml:"VSPHERE_IGNORE_PCI_DEVICES_ALLOW_LIST,omitempty"`
	VSphereControlPlaneHardwareVersion             string `yaml:"VSPHERE_CONTROL_PLANE_HARDWARE_VERSION,omitempty"`
	VSphereWorkerHardwareVersion                   string `yaml:"VSPHERE_WORKER_HARDWARE_VERSION,omitempty"`
	IDPConfig                                      `yaml:",inline"`
	OsInfo                                         `yaml:",inline"`
}

VSphereConfig is the tkg config file for vsphere

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL