cluster

package
v0.0.0-...-e7c744b Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Creating = "CREATING"
	Running  = "RUNNING"
	Updating = "UPDATING"
	Deleting = "DELETING"
	Warning  = "WARNING"
	Error    = "ERROR"

	CreatingMessage = "Cluster creation is in progress"
	RunningMessage  = "Cluster is running"
	UpdatingMessage = "Update is in progress"
	DeletingMessage = "Termination is in progress"
)

### [ Cluster statuses ] ### //

View Source
const (
	Amazon     = "amazon"
	Azure      = "azure"
	Google     = "google"
	Kubernetes = "kubernetes"
	Vsphere    = "vsphere"
)

Cloud constants

View Source
const (
	EKS     = "eks"
	AKS     = "aks"
	GKE     = "gke"
	PKE     = "pke"
	Unknown = "unknown"
)

Distribution constants

View Source
const (
	InstallKubernetesDashboardPostHook = "InstallKubernetesDashboardPostHook"
	RestoreFromBackup                  = "RestoreFromBackup"
	InitSpotConfig                     = "InitSpotConfig"
)

constants for posthooks

Variables

This section is empty.

Functions

func GetAPIEndpointFromKubeconfig

func GetAPIEndpointFromKubeconfig(config []byte) (string, error)

func StoreConfig

func StoreConfig(c *KubernetesCluster) ([]byte, error)

StoreConfig returns marshalled config file

Types

type ActualNodePoolStatus

type ActualNodePoolStatus struct {
	NodePoolStatus
	ActualCount int `json:"actualCount"`
}

type BaseChartConfig

type BaseChartConfig struct {
	Chart   string
	Version string
}

type BaseConfig

type BaseConfig struct {
	Enabled bool
}

type BasePostHookConfig

type BasePostHookConfig struct {
	Enabled bool

	BaseChartConfig `mapstructure:",squash"`
}

type CPU

type CPU struct {
	ResourceSummaryItem
}

CPU describes CPU resource summary

type CloudInfoFilter

type CloudInfoFilter struct {
	Fields           []string          `json:"fields,omitempty"`
	InstanceType     *InstanceFilter   `json:"instanceType,omitempty"`
	KubernetesFilter *KubernetesFilter `json:"k8sVersion,omitempty"`
	ImageFilter      *ImageFilter      `json:"image,omitempty"`
}

CloudInfoFilter describes a filter in cloud info

type CloudInfoRequest

type CloudInfoRequest struct {
	OrganizationId uint             `json:"-"`
	SecretId       string           `json:"secretId,omitempty"`
	Filter         *CloudInfoFilter `json:"filter,omitempty"`
}

CloudInfoRequest describes Cloud info requests

type CreateClusterProperties

type CreateClusterProperties struct {
	CreateClusterEKS        *ekscluster.CreateClusterEKS        `json:"eks,omitempty" yaml:"eks,omitempty"`
	CreateClusterAKS        *aks.CreateClusterAKS               `json:"aks,omitempty" yaml:"aks,omitempty"`
	CreateClusterGKE        *gke.CreateClusterGKE               `json:"gke,omitempty" yaml:"gke,omitempty"`
	CreateClusterKubernetes *kubernetes.CreateClusterKubernetes `json:"kubernetes,omitempty" yaml:"kubernetes,omitempty"`
	CreateClusterPKE        *pke.CreateClusterPKE               `json:"pke,omitempty" yaml:"pke,omitempty"`
}

CreateClusterProperties contains the cluster flavor specific properties.

type CreateClusterRequest

type CreateClusterRequest struct {
	Name       string                   `json:"name" yaml:"name" binding:"required"`
	Location   string                   `json:"location" yaml:"location"`
	Cloud      string                   `json:"cloud" yaml:"cloud" binding:"required"`
	SecretId   string                   `json:"secretId" yaml:"secretId"`
	SecretIds  []string                 `json:"secretIds,omitempty" yaml:"secretIds,omitempty"`
	SecretName string                   `json:"secretName" yaml:"secretName"`
	PostHooks  PostHooks                `json:"postHooks" yaml:"postHooks"`
	Properties *CreateClusterProperties `json:"properties" yaml:"properties" binding:"required"`
}

CreateClusterRequest describes a create cluster request

func (*CreateClusterRequest) AddDefaults

func (r *CreateClusterRequest) AddDefaults() error

AddDefaults puts default values to optional field(s)

func (*CreateClusterRequest) Validate

func (r *CreateClusterRequest) Validate() error

Validate checks the request fields

type CreateClusterResponse

type CreateClusterResponse struct {
	Name       string `json:"name"`
	ResourceID uint   `json:"id"`
}

CreateClusterResponse describes Pipeline's CreateCluster API response

type GenTLSForLogging

type GenTLSForLogging struct {
	TLSEnabled       bool   `json:"tlsEnabled" binding:"required"`
	GenTLSSecretName string `json:"genTlsSecretName"`
	Namespace        string `json:"namespace"`
	TLSHost          string `json:"tlsHost"`
}

GenTLSForLogging describes the TLS related params for Logging

type GetCloudInfoResponse

type GetCloudInfoResponse struct {
	Type               string                  `json:"type" binding:"required"`
	NameRegexp         string                  `json:"nameRegexp,omitempty"`
	Locations          []string                `json:"locations,omitempty"`
	NodeInstanceType   map[string]MachineTypes `json:"instanceType,omitempty"`
	KubernetesVersions interface{}             `json:"kubernetesVersions,omitempty"`
	Image              map[string][]string     `json:"image,omitempty"`
}

GetCloudInfoResponse describes Pipeline's Cloud info API response

type GetClusterConfigResponse

type GetClusterConfigResponse struct {
	Status int    `json:"status"`
	Data   string `json:"data"`
}

GetClusterConfigResponse describes Pipeline's GetConfig API response

type GetClusterStatusResponse

type GetClusterStatusResponse struct {
	Status        string                     `json:"status"`
	StatusMessage string                     `json:"statusMessage,omitempty"`
	Name          string                     `json:"name"`
	Location      string                     `json:"location"`
	Cloud         string                     `json:"cloud"`
	Distribution  string                     `json:"distribution"`
	Spot          bool                       `json:"spot,omitempty"`
	OIDCEnabled   bool                       `json:"oidcEnabled,omitempty"`
	Version       string                     `json:"version,omitempty"`
	ResourceID    uint                       `json:"id"`
	NodePools     map[string]*NodePoolStatus `json:"nodePools"`
	pkgCommon.CreatorBaseFields

	// If region not available fall back to Location
	Region    string     `json:"region,omitempty"`
	StartedAt *time.Time `json:"startedAt,omitempty"`
}

GetClusterStatusResponse describes Pipeline's GetClusterStatus API response

type GetNodePoolsResponse

type GetNodePoolsResponse struct {
	NodePools               map[string]*ActualNodePoolStatus `json:"nodePools,omitempty"`
	ClusterTotalResources   map[string]float64               `json:"clusterTotalResources,omitempty"`
	ClusterDesiredResources map[string]float64               `json:"clusterDesiredResources,omitempty"`
	ClusterStatus           string                           `json:"status,omitempty"`
	Cloud                   string                           `json:"cloud"`
	Distribution            string                           `json:"distribution"`
	Location                string                           `json:"location"`
}

GetNodePoolsResponse describes node pools of a cluster

type ImageFilter

type ImageFilter struct {
	Location string    `json:"location,omitempty"`
	Tags     []*string `json:"tags,omitempty"`
}

ImageFilter describes image filter of cloud info

type IngressControllerConfig

type IngressControllerConfig struct {
	BasePostHookConfig `mapstructure:",squash"`

	Values values.Config
}

type InstanceFilter

type InstanceFilter struct {
	Location string `json:"location,omitempty"`
}

InstanceFilter describes instance filter of cloud info

type KubeConfig

type KubeConfig struct {
	APIVersion     string          `yaml:"apiVersion,omitempty"`
	Clusters       []configCluster `yaml:"clusters,omitempty"`
	Contexts       []configContext `yaml:"contexts,omitempty"`
	Users          []configUser    `yaml:"users,omitempty"`
	CurrentContext string          `yaml:"current-context,omitempty"`
	Kind           string          `yaml:"kind,omitempty"`
}

type KubernetesCluster

type KubernetesCluster struct {
	// The name of the cluster
	Name string `json:"name,omitempty" yaml:"name,omitempty"`
	// The status of the cluster
	Status string `json:"status,omitempty" yaml:"status,omitempty"`
	// Kubernetes cluster version
	Version string `json:"version,omitempty" yaml:"version,omitempty"`
	// Service account token to access kubernetes API
	ServiceAccountToken string `json:"serviceAccountToken,omitempty" yaml:"service_account_token,omitempty"`
	// Kubernetes API master endpoint
	Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
	// Username for http basic authentication
	Username string `json:"username,omitempty" yaml:"username,omitempty"`
	// Password for http basic authentication
	Password string `json:"password,omitempty" yaml:"password,omitempty"`
	// Root CaCertificate for API server(base64 encoded)
	RootCACert string `json:"rootCACert,omitempty" yaml:"root_ca_cert,omitempty"`
	// Client Certificate(base64 encoded)
	ClientCertificate string `json:"clientCertificate,omitempty" yaml:"client_certificate,omitempty"`
	// Client private key(base64 encoded)
	ClientKey string `json:"clientKey,omitempty" yaml:"client_key,omitempty"`
	// Node count in the cluster
	NodeCount int64 `json:"nodeCount,omitempty" yaml:"node_count,omitempty"`
	// Metadata store specific driver options per cloud provider
	Metadata map[string]string `json:"metadata,omitempty" yaml:"metadata,omitempty"`

	AuthProviderName      string `json:"auth_provider_name,omitempty"`
	AuthAccessToken       string `json:"auth_access_token,omitempty"`
	AuthAccessTokenExpiry string `json:"auth_access_token_expiry,omitempty"`
	CurrentContext        string `json:"current_context,omitempty"`
}

KubernetesCluster represents a kubernetes cluster

type KubernetesFilter

type KubernetesFilter struct {
	Location string `json:"location,omitempty"`
}

KubernetesFilter describes K8S version filter of cloud info

type LoggingParam

type LoggingParam struct {
	BucketName       string           `json:"bucketName" binding:"required"`
	Region           string           `json:"region"`
	ResourceGroup    string           `json:"resourceGroup"`
	StorageAccount   string           `json:"storageAccount"`
	SecretId         string           `json:"secretId"`
	SecretName       string           `json:"secretName"`
	GenTLSForLogging GenTLSForLogging `json:"tls" binding:"required"`
}

LoggingParam describes the logging posthook params

func (LoggingParam) String

func (p LoggingParam) String() string

type MachineTypes

type MachineTypes []string

MachineTypes describes a string slice which contains machine types

type Memory

type Memory struct {
	ResourceSummaryItem
}

Memory describes Memory resource summary

type NodePoolData

type NodePoolData struct {
	Count int `json:"count"`
}

NodePoolData describes node pool size

type NodePoolLabel

type NodePoolLabel struct {
	Name     string `json:"name"`
	Value    string `json:"value"`
	Reserved bool   `json:"reserved"`
}

NodePoolLabel describes labels on a node pool

type NodePoolStatus

type NodePoolStatus struct {
	Autoscaling  bool              `json:"autoscaling,omitempty"`
	Count        int               `json:"count"`
	InstanceType string            `json:"instanceType,omitempty"`
	SpotPrice    string            `json:"spotPrice,omitempty"`
	Preemptible  bool              `json:"preemptible,omitempty"`
	MinCount     int               `json:"minCount"`
	MaxCount     int               `json:"maxCount"`
	Image        string            `json:"image,omitempty"`
	Version      string            `json:"version,omitempty"`
	Labels       map[string]string `json:"labels,omitempty"`
	Vcpu         int               `json:"vcpu,omitempty"`
	Ram          int               `json:"ram,omitempty"`
	Template     string            `json:"template,omitempty"`

	pkgCommon.CreatorBaseFields
}

NodePoolStatus describes cluster's node status

type PodDetailsResponse

type PodDetailsResponse struct {
	Name          string            `json:"name"`
	Namespace     string            `json:"namespace"`
	CreatedAt     time.Time         `json:"createdAt"`
	Labels        map[string]string `json:"labels,omitempty"`
	RestartPolicy string            `json:"restartPolicy,omitempty"`
	Conditions    []v1.PodCondition `json:"conditions,omitempty"`
	Summary       *ResourceSummary  `json:"resourceSummary,omitempty"`
}

PodDetailsResponse describes a pod

type PostHookConfig

type PostHookConfig struct {
	// ingress controller config
	Ingress IngressControllerConfig

	// Kubernetes Dashboard config
	Dashboard BasePostHookConfig

	// Init spot config
	Spotconfig SpotConfig

	// Instance Termination Handler config
	ITH BasePostHookConfig

	// Cluster Autoscaler config
	Autoscaler BaseConfig
}

type PostHookParam

type PostHookParam interface{}

PostHookParam describes posthook params in create request

type PostHooks

type PostHooks map[string]PostHookParam

PostHooks describes a {cluster_id}/posthooks API request

type ResourceSummary

type ResourceSummary struct {
	Cpu    *CPU    `json:"cpu,omitempty"`
	Memory *Memory `json:"memory,omitempty"`
	Status string  `json:"status,omitempty"`
}

ResourceSummary describes a node's resource summary with CPU and Memory capacity/request/limit/allocatable

type ResourceSummaryItem

type ResourceSummaryItem struct {
	Capacity    string `json:"capacity,omitempty"`
	Allocatable string `json:"allocatable,omitempty"`
	Limit       string `json:"limit,omitempty"`
	Request     string `json:"request,omitempty"`
}

ResourceSummaryItem describes a resource summary with capacity/request/limit/allocatable

type RestoreFromBackupParams

type RestoreFromBackupParams struct {
	BackupID              uint           `json:"backupId"`
	Options               RestoreOptions `json:"options,omitempty"`
	UseClusterSecret      bool           `json:"useClusterSecret,omitempty"`
	ServiceAccountRoleARN string         `json:"serviceAccountRoleARN,omitempty"`
	UseProviderSecret     bool           `json:"useProviderSecret,omitempty"`
}

RestoreFromBackupParams describes RestoreFromBackup posthook params

func GetRestoreBackupParams

func GetRestoreBackupParams(postHooks PostHooks) (*RestoreFromBackupParams, error)

type RestoreOptions

type RestoreOptions struct {
	// IncludedNamespaces is a slice of namespace names to include objects
	// from. If empty, all namespaces are included.
	IncludedNamespaces []string `json:"includedNamespaces,omitempty"`

	// ExcludedNamespaces contains a list of namespaces that are not
	// included in the restore.
	ExcludedNamespaces []string `json:"excludedNamespaces,omitempty"`

	// IncludedResources is a slice of resource names to include
	// in the restore. If empty, all resources in the backup are included.
	IncludedResources []string `json:"includedResources,omitempty"`

	// ExcludedResources is a slice of resource names that are not
	// included in the restore.
	ExcludedResources []string `json:"excludedResources,omitempty"`

	// NamespaceMapping is a map of source namespace names
	// to target namespace names to restore into. Any source
	// namespaces not included in the map will be restored into
	// namespaces of the same name.
	NamespaceMapping map[string]string `json:"namespaceMapping,omitempty"`

	// LabelSelector is a metav1.LabelSelector to filter with
	// when restoring individual objects from the backup. If empty
	// or nil, all objects are included. Optional.
	LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`

	// RestorePVs specifies whether to restore all included
	// PVs from snapshot (via the cloudprovider).
	RestorePVs *bool `json:"restorePVs,omitempty"`

	// IncludeClusterResources specifies whether cluster-scoped resources
	// should be included for consideration in the restore. If null, defaults
	// to true.
	IncludeClusterResources *bool `json:"includeClusterResources,omitempty"`
}

RestoreOptions defines options specification for an Ark restore

type SpotChartsConfig

type SpotChartsConfig struct {
	Scheduler BaseChartConfig
	Webhook   BaseChartConfig
}

type SpotConfig

type SpotConfig struct {
	Enabled bool
	Charts  SpotChartsConfig
}

type SupportedClusterItem

type SupportedClusterItem struct {
	Name    string `json:"name" binding:"required"`
	Key     string `json:"key" binding:"required"`
	Enabled bool   `json:"enabled"`
	Icon    string `json:"icon"`
}

SupportedClusterItem describes a supported cloud provider

type SupportedClustersResponse

type SupportedClustersResponse struct {
	Items []SupportedClusterItem `json:"items"`
}

SupportedClustersResponse describes the supported cloud providers

type UpdateClusterRequest

type UpdateClusterRequest struct {
	Cloud            string `json:"cloud" binding:"required"`
	UpdateProperties `json:"properties"`
}

UpdateClusterRequest describes an update cluster request

func (*UpdateClusterRequest) String

func (r *UpdateClusterRequest) String() string

String method prints formatted update request fields

func (*UpdateClusterRequest) Validate

func (r *UpdateClusterRequest) Validate() error

Validate checks the request fields

type UpdateNodePoolsRequest

type UpdateNodePoolsRequest struct {
	NodePools map[string]*NodePoolData `json:"nodePools,omitempty"`
}

UpdateNodePoolsRequest describes an update node pools request

type UpdateProperties

type UpdateProperties struct {
	EKS *ekscluster.UpdateClusterAmazonEKS `json:"eks,omitempty"`
	AKS *aks.UpdateClusterAzure            `json:"aks,omitempty"`
	GKE *gke.UpdateClusterGoogle           `json:"gke,omitempty"`
	PKE *pke.UpdateClusterPKE              `json:"pke,omitempty"`
}

UpdateProperties describes Pipeline's UpdateCluster request properties

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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