Help us shape the future of Go! Take the 2026 Go Developer Survey

clusters

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: Apache-2.0 Imports: 4 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(client *golangsdk.ServiceClient, clusterId string, opts DeleteQueryParams) error

Delete will permanently delete a particular cluster based on its unique ID.

func UpdateMasterIp

func UpdateMasterIp(client *golangsdk.ServiceClient, clusterId string, opts UpdateIpOpts) error

Update the access information of a specified cluster.

Types

type AuthenticationSpec

type AuthenticationSpec struct {
	// Authentication mode: rbac , x509 or authenticating_proxy
	Mode                string            `json:"mode" required:"true"`
	AuthenticatingProxy map[string]string `json:"authenticatingProxy" required:"true"`
}

Authentication parameters

type CertCluster

type CertCluster struct {
	// Server IP address
	Server string `json:"server"`
	// Certificate data
	CertAuthorityData string `json:"certificate-authority-data,omitempty"`
	// Whether to skip the server certificate verification. If the cluster type is externalCluster, the value is true.
	InsecureSkipTLSVerify bool `json:"insecure-skip-tls-verify,omitempty"`
}

type CertClusters

type CertClusters struct {
	// Cluster name
	Name string `json:"name"`
	// Cluster information
	Cluster CertCluster `json:"cluster"`
}

type CertContext

type CertContext struct {
	// Cluster name
	Cluster string `json:"cluster"`
	// User name
	User string `json:"user"`
}

type CertContexts

type CertContexts struct {
	// Context name
	Name string `json:"name"`
	// Context information
	Context CertContext `json:"context"`
}

type CertUser

type CertUser struct {
	// Client certificate
	ClientCertData string `json:"client-certificate-data"`
	// Client key data
	ClientKeyData string `json:"client-key-data"`
}

type CertUsers

type CertUsers struct {
	// User name
	Name string `json:"name"`
	// Cluster information
	User CertUser `json:"user"`
}

type Certificate

type Certificate struct {
	// API type, fixed value Config
	Kind string `json:"kind"`
	// API version, fixed value v1
	ApiVersion string `json:"apiVersion"`
	// Cluster list
	Clusters []CertClusters `json:"clusters"`
	// User list
	Users []CertUsers `json:"users"`
	// Context list
	Contexts []CertContexts `json:"contexts"`
	// The current context
	CurrentContext string `json:"current-context"`
}

func GetCert

func GetCert(client *golangsdk.ServiceClient, clusterId string) (*Certificate, error)

GetCert retrieves a particular cluster certificate based on its unique ID. (Depreciated)

func GetCertWithExpiration added in v0.5.8

func GetCertWithExpiration(client *golangsdk.ServiceClient, clusterId string, opts ExpirationOpts) (*Certificate, error)

GetCertWithExpiration retrieves a particular cluster certificate based on its unique ID.

type Clusters

type Clusters struct {
	// API type, fixed value Cluster
	Kind string `json:"kind" required:"true"`
	// API version, fixed value v3
	ApiVersion string `json:"apiversion" required:"true"`
	// Metadata of a Cluster
	Metadata MetaData `json:"metadata" required:"true"`
	// specifications of a Cluster
	Spec Spec `json:"spec" required:"true"`
	// status of a Cluster
	Status Status `json:"status"`
}

func Create

func Create(client *golangsdk.ServiceClient, opts CreateOpts) (*Clusters, error)

Create accepts a CreateOpts struct and uses the values to create a new logical cluster.

func FilterClusters

func FilterClusters(clusters []Clusters, opts ListOpts) []Clusters

func Get

func Get(client *golangsdk.ServiceClient, clusterId string) (*Clusters, error)

Get retrieves a particular cluster based on its unique ID.

func List

func List(client *golangsdk.ServiceClient, opts ListOpts) ([]Clusters, error)

List returns collection of clusters.

func Update

func Update(client *golangsdk.ServiceClient, clusterId string, opts UpdateOpts) (*Clusters, error)

Update allows clusters to update description.

type Conditions

type Conditions struct {
	// The type of component
	Type string `json:"type"`
	// The state of the component
	Status string `json:"status"`
	// The reason that the component becomes current
	Reason string `json:"reason"`
}

type Configuration added in v0.9.6

type Configuration struct {
	Name  string      `json:"name,omitempty"`
	Value interface{} `json:"value,omitempty"`
}

type ContainerNetworkSpec

type ContainerNetworkSpec struct {
	// Container network type: overlay_l2 , underlay_ipvlan or vpc-router
	Mode string `json:"mode" required:"true"`
	// Container network segment: 172.16.0.0/16 ~ 172.31.0.0/16. If there is a network segment conflict, it will be automatically reselected.
	Cidr string `json:"cidr,omitempty"`
}

Container network parameters

type CreateMetaData

type CreateMetaData struct {
	// Cluster unique name
	Name string `json:"name" required:"true"`
	// Cluster tag, key/value pair format
	Labels map[string]string `json:"labels,omitempty"`
	// Cluster annotation, key/value pair format
	Annotations map[string]string `json:"annotations,omitempty"`
	// Cluster timezone
	Timezone string `json:"timezone,omitempty"`
}

Metadata required to create a cluster

type CreateOpts

type CreateOpts struct {
	// API type, fixed value Cluster
	Kind string `json:"kind" required:"true"`
	// API version, fixed value v3
	ApiVersion string `json:"apiversion" required:"true"`
	// Metadata required to create a cluster
	Metadata CreateMetaData `json:"metadata" required:"true"`
	// specifications to create a cluster
	Spec Spec `json:"spec" required:"true"`
}

CreateOpts contains all the values needed to create a new cluster

type DeleteQueryParams added in v0.9.4

type DeleteQueryParams struct {
	ErrorStatus string `q:"errorStatus,omitempty"`
	DeleteEfs   string `q:"delete_efs,omitempty"`
	DeleteENI   string `q:"delete_eni,omitempty"`
	DeleteEvs   string `q:"delete_evs,omitempty"`
	DeleteNet   string `q:"delete_net,omitempty"`
	DeleteObs   string `q:"delete_obs,omitempty"`
	DeleteSfs   string `q:"delete_sfs,omitempty"`
}

type Endpoints

type Endpoints struct {
	// The address accessed within the user's subnet - OpenTelekomCloud
	Url string `json:"url"`
	// Public network access address - OpenTelekomCloud
	Type string `json:"type"`
	// Internal network address - OTC
	Internal string `json:"internal"`
	// External network address - OTC
	External string `json:"external"`
	// Endpoint of the cluster to be accessed through API Gateway - OTC
	ExternalOTC string `json:"external_otc"`
}

type EniNetworkSpec added in v0.5.9

type EniNetworkSpec struct {
	// Eni network subnet id
	SubnetId string `json:"eniSubnetId" required:"true"`
	// Eni network cidr
	Cidr string `json:"eniSubnetCIDR" required:"true"`
}

type ExpirationOpts added in v0.5.8

type ExpirationOpts struct {
	Duration int `json:"duration" required:"true"`
}

type HostNetworkSpec

type HostNetworkSpec struct {
	// The ID of the VPC used to create the node
	VpcId string `json:"vpc" required:"true"`
	// The ID of the subnet used to create the node
	SubnetId string `json:"subnet" required:"true"`
	// The ID of the high speed network used to create bare metal nodes.
	// This parameter is required when creating a bare metal cluster.
	HighwaySubnet string `json:"highwaySubnet,omitempty"`
	// The ID of the Security Group used to create the node
	SecurityGroupId string `json:"SecurityGroup,omitempty"`
}

Node network parameters

type IpSpec

type IpSpec struct {
	ID string `json:"id" required:"true"`
}

type ListCluster

type ListCluster struct {
	// API type, fixed value Cluster
	Kind string `json:"kind"`
	// API version, fixed value v3
	ApiVersion string `json:"apiVersion"`
	// all Clusters
	Clusters []Clusters `json:"items"`
}

type ListOpts

type ListOpts struct {
	Name  string `json:"name"`
	ID    string `json:"uuid"`
	Type  string `json:"type"`
	VpcID string `json:"vpc"`
	Phase string `json:"phase"`
}

ListOpts allows the filtering of list data using given parameters.

type MasterSpec added in v0.9.4

type MasterSpec struct {
	AvailabilityZone string `json:"availabilityZone"`
}

type MetaData

type MetaData struct {
	// Cluster unique name
	Name string `json:"name"`
	// Cluster unique Id
	Id string `json:"uid"`
	// Cluster tag, key/value pair format
	Labels map[string]string `json:"labels,omitempty"`
	// Cluster annotation, key/value pair format
	Annotations map[string]string `json:"annotations,omitempty"`
	// Cluster timezone
	Timezone string `json:"timezone,omitempty"`
}

Metadata required to create a cluster

type PackageConfiguration added in v0.9.6

type PackageConfiguration struct {
	Name           string          `json:"name,omitempty"`
	Configurations []Configuration `json:"configurations,omitempty"`
}

type PublicAccess added in v0.9.4

type PublicAccess struct {
	// Trustlist of network CIDRs that are allowed to access cluster APIs.
	Cidrs []string `json:"cidrs,omitempty"`
}

type Spec

type Spec struct {
	// Cluster category: CCE, Turbo
	Category string `json:"category,omitempty"`
	// Cluster Type: VirtualMachine, BareMetal, or Windows
	Type string `json:"type" required:"true"`
	// Cluster specifications
	Flavor string `json:"flavor" required:"true"`
	// Cluster's baseline Kubernetes version. The latest version is recommended
	Version string `json:"version,omitempty"`
	// Cluster description
	Description string `json:"description,omitempty"`
	// Whether the cluster supports IPv6 addresses. This field is supported in clusters of v1.25 and later versions.
	Ipv6Enable bool `json:"ipv6enable,omitempty"`
	// Node network parameters
	HostNetwork HostNetworkSpec `json:"hostNetwork" required:"true"`
	// Container network parameters
	ContainerNetwork ContainerNetworkSpec `json:"containerNetwork" required:"true"`
	// ENI network parameters
	EniNetwork *EniNetworkSpec `json:"eniNetwork,omitempty"`
	// Cluster API access control
	PublicAccess *PublicAccess `json:"publicAccess,omitempty"`
	// Authentication parameters
	Authentication AuthenticationSpec `json:"authentication,omitempty"`
	// Advanced configurations of the master node.
	Masters []MasterSpec `json:"masters,omitempty"`
	// KubernetesSvcIpRange Service CIDR block or the IP address range which the kubernetes clusterIp must fall within.
	// This parameter is available only for clusters of v1.11.7 and later.
	KubernetesSvcIpRange string `json:"kubernetesSvcIpRange,omitempty"`
	// KubeProxyMode Service forwarding mode. One of `iptables`, `ipvs`
	KubeProxyMode string `json:"kubeProxyMode,omitempty"`
	// Extended parameter for a cluster
	ExtendParam map[string]string `json:"extendParam,omitempty"`
	// The system disks and data disks of the master nodes in the cluster are encrypted.
	EnableMasterVolumeEncryption *bool `json:"enableMasterVolumeEncryption,omitempty"`
	// Charging mode of the cluster, which is 0 (on demand)
	BillingMode int `json:"billingMode,omitempty"`
	// Custom san list for certificates
	CustomSan []string `json:"customSan,omitempty"`
	// Whether Istio is supported.
	SupportIstio *bool `json:"supportIstio,omitempty"`
	// configurationsOverride
	ConfigurationsOverride []PackageConfiguration `json:"configurationsOverride,omitempty"`
	// Cluster deletion protection: true/false.
	// When enabled, the cluster cannot be deleted.
	DeletionProtection *bool `json:"deletionProtection,omitempty"`
}

Specifications to create a cluster

type Status

type Status struct {
	// The state of the cluster
	Phase string `json:"phase"`
	// The ID of the Job that is operating asynchronously in the cluster
	JobID string `json:"jobID"`
	// Reasons for the cluster to become current
	Reason string `json:"reason"`
	// The status of each component in the cluster
	Conditions Conditions `json:"conditions"`
	// Kube-apiserver access address in the cluster
	Endpoints []Endpoints `json:"-"`
}

func (*Status) UnmarshalJSON

func (r *Status) UnmarshalJSON(b []byte) error

UnmarshalJSON helps to unmarshal Status fields into needed values. OTC and Huawei have different data types and child fields for `endpoints` field in Cluster Status. This function handles the unmarshal for both

type UpdateIpOpts

type UpdateIpOpts struct {
	Action    string `json:"action" required:"true"`
	Spec      IpSpec `json:"spec,omitempty"`
	ElasticIp string `json:"elasticIp"`
}

type UpdateOpts

type UpdateOpts struct {
	Spec UpdateSpec `json:"spec" required:"true"`
}

UpdateOpts contains all the values needed to update a new cluster

type UpdateSpec

type UpdateSpec struct {
	// Cluster description
	Description string `json:"description,omitempty"`
}

Directories

Path Synopsis
cluster unit tests
cluster unit tests

Jump to

Keyboard shortcuts

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