oke

package
v1.8.5 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: Apache-2.0 Imports: 27 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDriver

func NewDriver() types.Driver

Types

type ClusterManagerClient

type ClusterManagerClient struct {
	// contains filtered or unexported fields
}

Defines / contains the OCI/OKE/Identity clients and operations.

func NewClusterManagerClient

func NewClusterManagerClient(configuration common.ConfigurationProvider) (*ClusterManagerClient, error)

NewClusterManagerClient creates a new OCI cluster manager, which has a set of clients (CE, VCN, Identity).

func (*ClusterManagerClient) CreateBastionSubnets

func (mgr *ClusterManagerClient) CreateBastionSubnets(ctx context.Context, state *State, vcnID, subnetRouteID string, isPrivate bool, securityListIds []string) ([]string, error)

CreateBastionSubnets creates the (public) bastion subnet(s), or an error.

func (*ClusterManagerClient) CreateCluster

func (mgr *ClusterManagerClient) CreateCluster(ctx context.Context, state *State, vcnID string, controlPlaneSubnetID string, serviceSubnetIds, nodeSubnetIds []string) error

CreateCluster creates a new cluster with no initial node pool and attaches it to the existing network resources, or an error. TODO stop passing in state

func (*ClusterManagerClient) CreateControlPlaneSecurityList added in v1.6.0

func (mgr *ClusterManagerClient) CreateControlPlaneSecurityList(ctx context.Context, state *State, vcnId *string, nodeCidrBlock string, serviceCidrBlock string, name string) ([]string, error)

Create the control-plane security list

func (*ClusterManagerClient) CreateControlPlaneSubnet added in v1.6.0

func (mgr *ClusterManagerClient) CreateControlPlaneSubnet(ctx context.Context, state *State, vcnID, subnetRouteID string, isPrivate bool, securityListIds []string) (string, error)

CreateControlPlaneSubnet creates (public or private) regional subnet for the k8s control-plane, or an error.

func (*ClusterManagerClient) CreateNodePool

func (mgr *ClusterManagerClient) CreateNodePool(ctx context.Context, state *State, vcnID string, serviceSubnetIds, nodeSubnetIds []string) error

CreateNodePool creates a new node pool (i.e. a set of compute nodes) for the cluster, or an error. TODO stop passing in state

func (*ClusterManagerClient) CreateNodeSecurityList added in v1.2.1

func (mgr *ClusterManagerClient) CreateNodeSecurityList(ctx context.Context, state *State, vcnId *string, nodeCidrBlock string, serviceCidrBlock string, name string) ([]string, error)

Create the node security list

func (*ClusterManagerClient) CreateNodeSubnets

func (mgr *ClusterManagerClient) CreateNodeSubnets(ctx context.Context, state *State, vcnID, subnetRouteID string, isPrivate bool, securityListIds []string) ([]string, error)

CreateNodeSubnets creates (public or private) regional node subnet, or an error. TODO stop passing in state

func (*ClusterManagerClient) CreateServiceSecurityList added in v1.2.1

func (mgr *ClusterManagerClient) CreateServiceSecurityList(ctx context.Context, state *State, vcnId *string, name string) ([]string, error)

Create the service security list

func (*ClusterManagerClient) CreateServiceSubnets

func (mgr *ClusterManagerClient) CreateServiceSubnets(ctx context.Context, state *State, vcnID, subnetRouteID string, isPrivate bool, securityListIds []string) ([]string, error)

CreateServiceSubnets creates the regional (public) service subnet (i.e. load balancer subnet), or an error.

func (*ClusterManagerClient) CreateSubnetWithDetails

func (mgr *ClusterManagerClient) CreateSubnetWithDetails(displayName *string, cidrBlock *string, dnsLabel *string, availableDomain *string, vcnID *string, routeTableID *string, isPrivate bool, securityListIds []string, state *State) (core.Subnet, error)

CreateSubnetWithDetails creates a new subnet in the specified VCN, or an error. TODO stop passing in state

func (*ClusterManagerClient) CreateVCNAndNetworkResources

func (mgr *ClusterManagerClient) CreateVCNAndNetworkResources(state *State) (string, string, []string, []string, error)

CreateVCNAndNetworkResources creates a new Virtual Cloud Network and required resources including security lists, Internet Gateway, default route rule, etc., or an error.

func (*ClusterManagerClient) DeleteCluster

func (mgr *ClusterManagerClient) DeleteCluster(ctx context.Context, clusterID string) error

DeleteCluster deletes the cluster with the specified ID, or an error.

func (*ClusterManagerClient) DeleteNodePool

func (mgr *ClusterManagerClient) DeleteNodePool(ctx context.Context, nodePoolID string) error

DeleteNodePool deletes the node pool with the specified ID, or an error

func (*ClusterManagerClient) DeleteVCN

func (mgr *ClusterManagerClient) DeleteVCN(ctx context.Context, vcnID string) error

DeleteVCN deletes the VCN and its associated resources (subnets, attached gateways, etc.) with the specified ID, or an error.

func (*ClusterManagerClient) GetClusterByID

func (mgr *ClusterManagerClient) GetClusterByID(ctx context.Context, clusterID string) (containerengine.Cluster, error)

GetClusterByID returns the cluster with the specified Id, or an error

func (*ClusterManagerClient) GetClusterByName

func (mgr *ClusterManagerClient) GetClusterByName(ctx context.Context, compartmentID, name string) (string, error)

GetClusterByName returns the Cluster ID of the Cluster with the specified name in the specified compartment or an error if it is not found.

func (*ClusterManagerClient) GetKubeconfigByClusterID

func (mgr *ClusterManagerClient) GetKubeconfigByClusterID(ctx context.Context, clusterID, region string) (store.KubeConfig, string, error)

GetKubeconfigByClusterID is a wrapper for the CreateKubeconfig operation that that handles errors and unmarshaling, or an error.

func (*ClusterManagerClient) GetNodePoolByID

func (mgr *ClusterManagerClient) GetNodePoolByID(ctx context.Context, nodePoolID string) (containerengine.NodePool, error)

GetNodePoolByID returns the node pool with the specified Id, or an error.

func (*ClusterManagerClient) GetSubnetById added in v1.6.0

func (mgr *ClusterManagerClient) GetSubnetById(ctx context.Context, subnetId string) (core.Subnet, error)

GetSubnetById returns the subnet with the specified id, or an error if it is not found.

func (*ClusterManagerClient) GetSubnetByName

func (mgr *ClusterManagerClient) GetSubnetByName(ctx context.Context, compartmentID, vcnID, displayName string) (core.Subnet, error)

GetSubnetByName returns the subnet with the specified name in the specified VCN and compartment, or an error if it is not found.

func (*ClusterManagerClient) GetSubnetIDByName

func (mgr *ClusterManagerClient) GetSubnetIDByName(ctx context.Context, compartmentID, vcnID, displayName string) (string, error)

GetSubnetIDByName returns the subnet ID of the subnet with the specified name in the specified VCN and compartment, or an error if it is not found.

func (*ClusterManagerClient) GetVcnByName

func (mgr *ClusterManagerClient) GetVcnByName(ctx context.Context, compartmentID, displayName string) (core.Vcn, error)

GetVcnIDByName returns the VCN with the specified name in the specified compartment or an error if it is not found.

func (*ClusterManagerClient) GetVcnIDByClusterID

func (mgr *ClusterManagerClient) GetVcnIDByClusterID(ctx context.Context, clusterID string) (string, error)

GetVcnIDByClusterID returns the VCN ID for the existing cluster with the specified Id, or an error.

func (*ClusterManagerClient) GetVcnIDByName

func (mgr *ClusterManagerClient) GetVcnIDByName(ctx context.Context, compartmentID, displayName string) (string, error)

GetVcnIDByName returns the VCN ID of the VCN with the specified name in the specified compartment or an error if it is not found.

func (*ClusterManagerClient) ListInternetGatewayIdsInVcn

func (mgr *ClusterManagerClient) ListInternetGatewayIdsInVcn(ctx context.Context, compartmentID, vcnID string) ([]string, error)

ListInternetGatewayIdsInVcn returns the route table IDs of any and all Internet gateways in the specified VCN.

func (*ClusterManagerClient) ListNatGatewayIdsInVcn

func (mgr *ClusterManagerClient) ListNatGatewayIdsInVcn(ctx context.Context, compartmentID, vcnID string) ([]string, error)

ListNatGatewayIdsInVcn returns the NAT gateway IDs of any and all NAT gateways in the specified VCN.

func (*ClusterManagerClient) ListNodepoolIdsInCluster

func (mgr *ClusterManagerClient) ListNodepoolIdsInCluster(ctx context.Context, compartmentID, clusterID string) ([]string, error)

ListNodepoolIdsInCluster returns the node pool IDs of any and all node pools in the specified cluster.

func (*ClusterManagerClient) ListRouteTableIdsInVcn

func (mgr *ClusterManagerClient) ListRouteTableIdsInVcn(ctx context.Context, compartmentID, vcnID string) ([]string, error)

ListRouteTableIdsInVcn returns the route table IDs of any and all route tables in the specified VCN.

func (*ClusterManagerClient) ListSecurityListIdsInVcn

func (mgr *ClusterManagerClient) ListSecurityListIdsInVcn(ctx context.Context, compartmentID, vcnID string) ([]string, error)

ListSecurityListIdsInVcn returns the security list IDs of any and all security lists in the specified VCN.

func (*ClusterManagerClient) ListSubnetIdsInVcn

func (mgr *ClusterManagerClient) ListSubnetIdsInVcn(ctx context.Context, compartmentID, vcnID string) ([]string, error)

ListSubnetIdsInVcn returns the subnet IDs of any and all subnets in the specified VCN.

func (*ClusterManagerClient) ScaleNodePool

func (mgr *ClusterManagerClient) ScaleNodePool(ctx context.Context, nodePoolID string, numNodes int, compartmentID string) error

ScaleNodePool updates the number of nodes in the node pool, or an error.

func (*ClusterManagerClient) UpdateMasterKubernetesVersion

func (mgr *ClusterManagerClient) UpdateMasterKubernetesVersion(ctx context.Context, clusterID, version string) error

UpdateKubernetesMasterVersion updates the version of Kubernetes on the master(s), or an error.

func (*ClusterManagerClient) UpdateNodepoolKubernetesVersion

func (mgr *ClusterManagerClient) UpdateNodepoolKubernetesVersion(ctx context.Context, nodePoolID, version string) error

UpdateNodepoolKubernetesVersion updates the version of Kubernetes on (new) worker that will be added to the node pool. Be sure to call UpdateKubernetesMasterVersion before updating the version of node pools, or an error.

type NetworkConfiguration

type NetworkConfiguration struct {
	// The OCID of the compartment that contains the optional pre-existing VCN
	VcnCompartmentID string
	// Optional pre-existing VCN in which you want to create cluster
	VCNName string
	// The IP address range of the Kubernetes Pod IPs
	PodCidr string
	// The IP address range of the Kubernetes Service IPs
	ServiceCidr string
	// Optional name of the bastion subnet
	BastionSubnetName string
	// Optional name of the control plane (Kubernetes API endpoint) subnet
	ControlPlaneSubnetName string
	// Optional pre-existing load balancer subnets to host load balancers for services
	ServiceLBSubnet1Name string
	ServiceLBSubnet2Name string
	// The number of AD specific subnets (each are created in different availability domains)
	QuantityOfSubnets int64
	// Optional name of node pool subnet
	NodePoolSubnetName string
	// Optional name of node pool subnet security list
	NodePoolSubnetSecurityListName string
	// Optional name of node pool dns domain name
	NodePoolSubnetDnsDomainName string
	// Optional name of the service subnet security list
	ServiceSubnetSecurityListName string
	// Optional name of the service subnet dns domain name
	ServiceSubnetDnsDomainName string
}

Elements that make up the Network configuration (and state) for the OKE cluster

type NodeConfiguration

type NodeConfiguration struct {
	// The OS image that will be used for the VM
	NodeImageName string
	// The shape of the VM for the worker node
	NodeShape string
	// The optional public SSH Key path to access the worker nodes
	// Note, in order to access private nodes you need to set up a bastion host on the bastion subnet
	NodePublicSSHKeyPath string
	// The optional public SSH Key contents to access the worker nodes
	NodePublicSSHKeyContents string
	// The optional user_data file path to execute on worker nodes
	NodeUserDataPath string
	// The optional user_data contents to execute on worker nodes
	NodeUserDataContents string
	// The number of nodes in each subnet / availability domain
	QuantityPerSubnet int64
	// Optional limit on the number of nodes in the pool. Default 0.
	LimitNodeCount int64
	// The optional custom boot volume size to use for the nodes
	CustomBootVolumeSize int64
	// The optional number of OCPUs for each node (each OCPU is equivalent to one physical core of an Intel Xeon processor)
	FlexOCPUs int64
}

Elements that make up the configuration of each node in the OKE cluster

type OKEDriver

type OKEDriver struct {
	// contains filtered or unexported fields
}

func (*OKEDriver) Create

Create implements driver interface

func (*OKEDriver) ETCDRemoveSnapshot

func (d *OKEDriver) ETCDRemoveSnapshot(ctx context.Context, clusterInfo *types.ClusterInfo, opts *types.DriverOptions, snapshotName string) error

func (*OKEDriver) ETCDRestore

func (d *OKEDriver) ETCDRestore(ctx context.Context, clusterInfo *types.ClusterInfo, opts *types.DriverOptions, snapshotName string) (*types.ClusterInfo, error)

func (*OKEDriver) ETCDSave

func (d *OKEDriver) ETCDSave(ctx context.Context, clusterInfo *types.ClusterInfo, opts *types.DriverOptions, snapshotName string) error

func (*OKEDriver) GetCapabilities

func (d *OKEDriver) GetCapabilities(ctx context.Context) (*types.Capabilities, error)

func (*OKEDriver) GetClusterSize

func (d *OKEDriver) GetClusterSize(ctx context.Context, info *types.ClusterInfo) (*types.NodeCount, error)

func (*OKEDriver) GetDriverCreateOptions

func (d *OKEDriver) GetDriverCreateOptions(ctx context.Context) (*types.DriverFlags, error)

GetDriverCreateOptions implements driver interface

func (*OKEDriver) GetDriverUpdateOptions

func (d *OKEDriver) GetDriverUpdateOptions(ctx context.Context) (*types.DriverFlags, error)

GetDriverUpdateOptions implements driver interface

func (*OKEDriver) GetK8SCapabilities

func (d *OKEDriver) GetK8SCapabilities(ctx context.Context, options *types.DriverOptions) (*types.K8SCapabilities, error)

func (*OKEDriver) GetVersion

func (d *OKEDriver) GetVersion(ctx context.Context, info *types.ClusterInfo) (*types.KubernetesVersion, error)

func (*OKEDriver) PostCheck

func (d *OKEDriver) PostCheck(ctx context.Context, info *types.ClusterInfo) (*types.ClusterInfo, error)

func (*OKEDriver) Remove

func (d *OKEDriver) Remove(ctx context.Context, info *types.ClusterInfo) error

func (*OKEDriver) RemoveLegacyServiceAccount

func (d *OKEDriver) RemoveLegacyServiceAccount(ctx context.Context, info *types.ClusterInfo) error

func (*OKEDriver) SetClusterSize

func (d *OKEDriver) SetClusterSize(ctx context.Context, info *types.ClusterInfo, count *types.NodeCount) error

func (*OKEDriver) SetVersion

func (d *OKEDriver) SetVersion(ctx context.Context, info *types.ClusterInfo, version *types.KubernetesVersion) error

func (*OKEDriver) Update

Update implements driver interface

type SignRequest

type SignRequest func(*http.Request) (*http.Request, error)

type State

type State struct {
	// Should the Kubernetes dashboard be enabled
	EnableKubernetesDashboard bool

	// Should the Helm server (Tiller) be enabled
	EnableTiller bool

	// Should K8s API endpoint have private IP (i.e. only accessible from VCN, bastion, or authorized SaaS services)
	// Note, Rancher needs to be able to access the K8s API on the private VCN IP for this to be successful e.g. https://10.0.0.2:6443
	// Typically, that means Rancher is running in the same VCN as the specified control plane subnet (see also control-plane-subnet-name)
	PrivateControlPlane bool

	// Should worker nodes have private IPs (i.e. only accessible from an LB on the service subnet)
	PrivateNodes bool

	// The name of the cluster (and default node pool)
	Name string

	// The Oracle Cloud ID (OCID) of the tenancy
	TenancyID string

	// The OCID of the cluster compartment
	CompartmentID string

	// The user OCID
	UserOCID string

	// The path to the private API Key that is associated with the user and has access the tenancy/compartment
	PrivateKeyPath string
	// The contents the private API Key that is associated with the user and has access the tenancy/compartment
	PrivateKeyContents string

	// The API Key Fingerprint
	Fingerprint string

	// The region where the cluster will be hosted
	Region string

	// The passphrase for the private key
	PrivateKeyPassphrase string

	// The description of the cluster
	// TODO currently unused
	Description string

	// Should cluster creation operation wait until nodes are active
	// TODO currently unused
	WaitNodesActive int64

	// Optional CIDR from which to allow ingress to worker nodes
	WorkerNodeIngressCidr string

	//The OCID of the KMS key to be used as the master for Kubernetes secret encryption
	KmsKeyID string

	// The labels specified during the Kubernetes creation
	// TODO currently unused
	KubernetesLabels map[string]string

	// The version of Kubernetes to run on the master and worker nodes and node pool (e.g. v1.11.9, v1.12.7)
	KubernetesVersion string

	// OCID of the cluster
	ClusterID string

	Network  NetworkConfiguration
	NodePool NodeConfiguration
	// cluster info
	ClusterInfo types.ClusterInfo

	// Should the Deletion of VCN be skipped
	SkipVCNDelete bool
}

func GetState

func GetState(info *types.ClusterInfo) (State, error)

func GetStateFromOpts

func GetStateFromOpts(driverOptions *types.DriverOptions) (State, error)

SetDriverOptions implements driver interface

Jump to

Keyboard shortcuts

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