kubernetes

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	Name       string `mapstructure:",name"`
	Kubeconfig string `mapstructure:",kubeconfig"`
	InCluster  bool   `mapstructure:",inCluster"`
	ClientSet  kubernetes.Interface
	Fake       bool
}

Cluster struct

func GetCluster

func GetCluster(name string) (*Cluster, error)

GetCluster get a list of clusters

func GetClusters

func GetClusters() ([]*Cluster, error)

GetClusters get a list of clusters

func (*Cluster) BlueGreenStrategy

func (c *Cluster) BlueGreenStrategy(_ model.DeploymentRequest) (bool, error)

BlueGreenStrategy releases a new version alongside the old version then switch traffic.

func (*Cluster) CanaryStrategy

func (c *Cluster) CanaryStrategy(_ model.DeploymentRequest) (bool, error)

CanaryStrategy releases a new version to a subset of users, then proceed to a full rollout.

func (*Cluster) Config

func (c *Cluster) Config() error

Config configs the client set for testing

func (*Cluster) Deploy

func (c *Cluster) Deploy(deploymentRequest model.DeploymentRequest) (bool, error)

Deploy deploys an application

func (*Cluster) FetchDeploymentStatus

func (c *Cluster) FetchDeploymentStatus(ctx context.Context, namespace, name string, limit int) (bool, error)

FetchDeploymentStatus get deployment status

func (*Cluster) GetApplication

func (c *Cluster) GetApplication(ctx context.Context, namespace, id, name, format string) (model.Application, error)

GetApplication gets current application version

func (*Cluster) GetConfig

func (c *Cluster) GetConfig(ctx context.Context, namespace string) (model.Configs, error)

GetConfig gets a beetle configs for a specific namespace

func (*Cluster) GetConfigMap

func (c *Cluster) GetConfigMap(ctx context.Context, namespace, name string) (model.ConfigMap, error)

GetConfigMap gets a configmap data

func (*Cluster) GetDeployment

func (c *Cluster) GetDeployment(ctx context.Context, namespace, name string) (model.Deployment, error)

GetDeployment gets a deployment by name

func (*Cluster) GetDeployments

func (c *Cluster) GetDeployments(ctx context.Context, namespace, label string) ([]model.Deployment, error)

GetDeployments gets a list of deployments

func (*Cluster) GetNamespace

func (c *Cluster) GetNamespace(ctx context.Context, name string) (model.Namespace, error)

GetNamespace gets a namespace by name

func (*Cluster) GetNamespaces

func (c *Cluster) GetNamespaces(ctx context.Context) ([]model.Namespace, error)

GetNamespaces gets a list of cluster namespaces

func (*Cluster) Override

func (c *Cluster) Override(objects ...runtime.Object)

Override overrides the client set for testing

func (*Cluster) PatchDeployment

func (c *Cluster) PatchDeployment(ctx context.Context, namespace, name, data string) (bool, error)

PatchDeployment updates the deployment

func (*Cluster) Ping

func (c *Cluster) Ping(ctx context.Context) (bool, error)

Ping check the cluster

func (*Cluster) RampedStrategy

func (c *Cluster) RampedStrategy(deploymentRequest model.DeploymentRequest) (bool, error)

RampedStrategy releases a new version on a rolling update fashion, one after the other.

it will set maxSurge as 25% and maxUnavailable as 25%

This method is like running this command

$ kubectl patch deployment toad-deployment --type=json -p '[

    {"op":"replace", "path":"/spec/strategy", "value":{"type":"RollingUpdate"}},
    {"op":"replace", "path":"/spec/strategy/rollingUpdate", "value":{"maxSurge":""}},
	   {"op":"replace", "path":"/spec/strategy/rollingUpdate", "value":{"maxUnavailable":""}},
    {"op":"replace","path":"/spec/template/spec/containers/0/image","value":"clivern/toad:release-0.2.4"}

]'

func (*Cluster) RecreateStrategy

func (c *Cluster) RecreateStrategy(deploymentRequest model.DeploymentRequest) (bool, error)

RecreateStrategy terminates the old version and release the new one.

This method is like running this command

$ kubectl patch deployment toad-deployment --type=json -p '[

{"op":"replace", "path":"/spec/strategy", "value":{"type":"Recreate"}},
{"op":"replace","path":"/spec/template/spec/containers/0/image","value":"clivern/toad:release-0.2.4"}

]'

type Clusters

type Clusters struct {
	Clusters []*Cluster `mapstructure:",clusters"`
}

Clusters struct

Jump to

Keyboard shortcuts

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