kubernetes

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RevisionAnnotation is the revision annotation of a deployment's replica sets which records its rollout sequence
	RevisionAnnotation = "deployment.kubernetes.io/revision"
	// RevisionHistoryAnnotation maintains the history of all old revisions that a replica set has served for a deployment.
	RevisionHistoryAnnotation = "deployment.kubernetes.io/revision-history"
	// DesiredReplicasAnnotation is the desired replicas for a deployment recorded as an annotation
	// in its replica sets. Helps in separating scaling events from the rollout process and for
	// determining if the new replica set for a deployment is really saturated.
	DesiredReplicasAnnotation = "deployment.kubernetes.io/desired-replicas"
	// MaxReplicasAnnotation is the maximum replicas a deployment can have at a given point, which
	// is deployment.spec.replicas + maxSurge. Used by the underlying replica sets to estimate their
	// proportions in case the deployment has surge replicas.
	MaxReplicasAnnotation = "deployment.kubernetes.io/max-replicas"
)

Variables

This section is empty.

Functions

func CloneAndRemoveLabel

func CloneAndRemoveLabel(labels map[string]string, labelKey string) map[string]string

Taken from https://github.com/kubernetes/kubernetes/blob/master/pkg/util/labels/labels.go

CloneAndRemoveLabel clones the given map and returns a new map with the given key removed. Returns the given map, if labelKey is empty.

func SetDeploymentAnnotationsTo

func SetDeploymentAnnotationsTo(deployment *apps.Deployment, rollbackToRS *apps.ReplicaSet)

https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/deployment/util/deployment_util.go#L331

SetDeploymentAnnotationsTo sets deployment's annotations as given RS's annotations. This action should be done if and only if the deployment is rolling back to this rs. Note that apply and revision annotations are not changed.

func SetFromReplicaSetTemplate

func SetFromReplicaSetTemplate(deployment *apps.Deployment, template v1.PodTemplateSpec) *apps.Deployment

https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/deployment/util/deployment_util.go#L679

SetFromReplicaSetTemplate sets the desired PodTemplateSpec from a replica set template to the given deployment.

Types

type CleanupArtifactsRequest

type CleanupArtifactsRequest struct {
	Manifests []map[string]interface{} `json:"manifests"`
	Account   string                   `json:"account"`
}

type Controller

type Controller struct {
	*internal.Controller
}

Controller holds all non request-scoped objects.

func (*Controller) CleanupArtifacts

func (cc *Controller) CleanupArtifacts(c *gin.Context, ca CleanupArtifactsRequest)

func (*Controller) Delete

func (cc *Controller) Delete(c *gin.Context, dm DeleteManifestRequest)

func (*Controller) Deploy

func (cc *Controller) Deploy(c *gin.Context, dm DeployManifestRequest)

Deploy performs a "Deploy (Manifest)" Spinnaker operation. It takes in a list of manifest and the Kubernetes provider to "apply" them to. It adds Spinnaker annotations/labels, and handles any Spinnaker versioning, then applies each manifest one by one.

func (*Controller) Disable added in v0.21.0

func (cc *Controller) Disable(c *gin.Context, dm DisableManifestRequest)

Disable takes in manifest coordinates and grabs the list of load balancers fronting it from the annotation `traffic.spinnaker.io/load-balancers`. It loops through these load balancers, removing any selectors from the target manifest's labels and patching the target resource using the JSON patch strategy. It then patches the labels of all pods that this manifest owns.

func (*Controller) Enable added in v0.22.0

func (cc *Controller) Enable(c *gin.Context, dm EnableManifestRequest)

Enable takes in manifest coordinates and grabs the list of load balancers behind which it needs to be fronted from the annotation `traffic.spinnaker.io/load-balancers`. It loops through these load balancers, adding any selectors from the load balancer's labels and patching the target resource using the JSON patch strategy. It then patches the labels of all pods that this manifest owns.

func (*Controller) Patch

func (cc *Controller) Patch(c *gin.Context, pm PatchManifestRequest)

func (*Controller) Rollback

func (cc *Controller) Rollback(c *gin.Context, ur UndoRolloutManifestRequest)

func (*Controller) RollingRestart

func (cc *Controller) RollingRestart(c *gin.Context, rr RollingRestartManifestRequest)

RollingRestart performs a `kubectl rollout restart` by setting an annotation on a pod template to the current time in RFC3339.

func (*Controller) RunJob

func (cc *Controller) RunJob(c *gin.Context, rj RunJobRequest)

func (*Controller) Scale

func (cc *Controller) Scale(c *gin.Context, sm ScaleManifestRequest)

type DeleteManifestRequest

type DeleteManifestRequest struct {
	App            string                              `json:"app"`
	Mode           string                              `json:"mode"`
	LabelSelectors DeleteManifestRequestLabelSelectors `json:"labelSelectors"`
	ManifestName   string                              `json:"manifestName"`
	CloudProvider  string                              `json:"cloudProvider"`
	Options        DeleteManifestRequestOptions        `json:"options"`
	Kinds          []string                            `json:"kinds"`
	Location       string                              `json:"location"`
	User           string                              `json:"user"`
	Account        string                              `json:"account"`
}

type DeleteManifestRequestLabelSelector

type DeleteManifestRequestLabelSelector struct {
	Kind   string   `json:"kind"`
	Values []string `json:"values"`
	Key    string   `json:"key"`
}

type DeleteManifestRequestLabelSelectors

type DeleteManifestRequestLabelSelectors struct {
	Selectors []DeleteManifestRequestLabelSelector `json:"selectors"`
}

type DeleteManifestRequestOptions

type DeleteManifestRequestOptions struct {
	Cascading          *bool  `json:"cascading"`
	OrphanDependants   *bool  `json:"orphanDependants"`
	GracePeriodSeconds *int64 `json:"gracePeriodSeconds"`
}

type DeployManifestRequest

type DeployManifestRequest struct {
	EnableTraffic     bool                     `json:"enableTraffic"`
	NamespaceOverride string                   `json:"namespaceOverride"`
	CloudProvider     string                   `json:"cloudProvider"`
	Manifests         []map[string]interface{} `json:"manifests"`
	TrafficManagement TrafficManagement        `json:"trafficManagement"`
	Moniker           struct {
		App string `json:"app"`
	} `json:"moniker"`
	Source                   string                 `json:"source"`
	Account                  string                 `json:"account"`
	SkipExpressionEvaluation bool                   `json:"skipExpressionEvaluation"`
	RequiredArtifacts        []clouddriver.Artifact `json:"requiredArtifacts"`
	OptionalArtifacts        []clouddriver.Artifact `json:"optionalArtifacts"`
}

type DisableManifestRequest added in v0.21.0

type DisableManifestRequest struct {
	App           string `json:"app"`
	CloudProvider string `json:"cloudProvider"`
	ManifestName  string `json:"manifestName"`
	Location      string `json:"location"`
	Account       string `json:"account"`
}

type EnableManifestRequest added in v0.22.0

type EnableManifestRequest struct {
	App           string `json:"app"`
	CloudProvider string `json:"cloudProvider"`
	ManifestName  string `json:"manifestName"`
	Location      string `json:"location"`
	Account       string `json:"account"`
}

type ManifestCoordinatesResponse

type ManifestCoordinatesResponse struct {
	Kind      string `json:"kind"`
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
}

type ManifestResponse

type ManifestResponse struct {
	Account   string                  `json:"account"`
	Artifacts []clouddriver.Artifact  `json:"artifacts"`
	Events    []v1.Event              `json:"events"`
	Location  string                  `json:"location"`
	Manifest  map[string]interface{}  `json:"manifest"`
	Metrics   []interface{}           `json:"metrics"`
	Moniker   ManifestResponseMoniker `json:"moniker"`
	Name      string                  `json:"name"`
	Status    manifest.Status         `json:"status"`
	Warnings  []interface{}           `json:"warnings"`
}

type ManifestResponseMoniker

type ManifestResponseMoniker struct {
	App     string `json:"app"`
	Cluster string `json:"cluster"`
}

type Operation

type Operation struct {
	CleanupArtifacts       *CleanupArtifactsRequest       `json:"cleanupArtifacts"`
	DeleteManifest         *DeleteManifestRequest         `json:"deleteManifest"`
	DeployManifest         *DeployManifestRequest         `json:"deployManifest"`
	DisableManifest        *DisableManifestRequest        `json:"disableManifest"`
	EnableManifest         *EnableManifestRequest         `json:"enableManifest"`
	PatchManifest          *PatchManifestRequest          `json:"patchManifest"`
	RollingRestartManifest *RollingRestartManifestRequest `json:"rollingRestartManifest"`
	RunJob                 *RunJobRequest                 `json:"runJob"`
	ScaleManifest          *ScaleManifestRequest          `json:"scaleManifest"`
	UndoRolloutManifest    *UndoRolloutManifestRequest    `json:"undoRolloutManifest"`
}

type Operations

type Operations []Operation

type OperationsResponse

type OperationsResponse struct {
	ID          string `json:"id"`
	ResourceURI string `json:"resourceUri"`
}

type PatchManifestRequest

type PatchManifestRequest struct {
	App      string `json:"app"`
	Cluster  string `json:"cluster"`
	Criteria string `json:"criteria"`
	// Kind          string                         `json:"kind"`
	ManifestName  string                      `json:"manifestName"`
	Source        string                      `json:"source"`
	Mode          string                      `json:"mode"`
	PatchBody     json.RawMessage             `json:"patchBody"`
	CloudProvider string                      `json:"cloudProvider"`
	Options       PatchManifestRequestOptions `json:"options"`
	// Manifests         []map[string]interface{}       `json:"manifests"`
	Location          string                 `json:"location"`
	Account           string                 `json:"account"`
	AllArtifacts      []clouddriver.Artifact `json:"allArtifacts"`
	RequiredArtifacts []clouddriver.Artifact `json:"requiredArtifacts"`
	OptionalArtifacts []clouddriver.Artifact `json:"optionalArtifacts"`
}

type PatchManifestRequestOptions

type PatchManifestRequestOptions struct {
	MergeStrategy string `json:"mergeStrategy"`
	Record        bool   `json:"record"`
}

Merge strategy can be "strategic", "json", or "merge".

type RollingRestartManifestRequest

type RollingRestartManifestRequest struct {
	CloudProvider string `json:"cloudProvider"`
	ManifestName  string `json:"manifestName"`
	Location      string `json:"location"`
	User          string `json:"user"`
	Account       string `json:"account"`
}

type RunJobRequest

type RunJobRequest struct {
	Account           string                 `json:"account"`
	Alias             string                 `json:"alias"`
	Application       string                 `json:"application"`
	CloudProvider     string                 `json:"cloudProvider"`
	Manifest          map[string]interface{} `json:"manifest"`
	RequiredArtifacts []clouddriver.Artifact `json:"requiredArtifacts"`
	OptionalArtifacts []clouddriver.Artifact `json:"optionalArtifacts"`
}

type ScaleManifestRequest

type ScaleManifestRequest struct {
	Replicas      string `json:"replicas"`
	ManifestName  string `json:"manifestName"`
	CloudProvider string `json:"cloudProvider"`
	Location      string `json:"location"`
	User          string `json:"user"`
	Account       string `json:"account"`
}

type TrafficManagement added in v0.24.0

type TrafficManagement struct {
	Enabled bool                     `json:"enabled"`
	Options TrafficManagementOptions `json:"options"`
}

type TrafficManagementOptions added in v0.24.0

type TrafficManagementOptions struct {
	EnableTraffic bool     `json:"enableTraffic"`
	Namespace     string   `json:"namespace"`
	Services      []string `json:"services"`
}

type UndoRolloutManifestRequest

type UndoRolloutManifestRequest struct {
	Mode             string `json:"mode"`
	ManifestName     string `json:"manifestName"`
	CloudProvider    string `json:"cloudProvider"`
	Location         string `json:"location"`
	NumRevisionsBack int    `json:"numRevisionsBack"`
	User             string `json:"user"`
	Account          string `json:"account"`
	Revision         string `json:"revision"`
}

Jump to

Keyboard shortcuts

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