Documentation ¶
Index ¶
- Constants
- func CloneAndRemoveLabel(labels map[string]string, labelKey string) map[string]string
- func SetDeploymentAnnotationsTo(deployment *apps.Deployment, rollbackToRS *apps.ReplicaSet)
- func SetFromReplicaSetTemplate(deployment *apps.Deployment, template v1.PodTemplateSpec) *apps.Deployment
- type CleanupArtifactsRequest
- type Controller
- func (cc *Controller) CleanupArtifacts(c *gin.Context, ca CleanupArtifactsRequest)
- func (cc *Controller) Delete(c *gin.Context, dm DeleteManifestRequest)
- func (cc *Controller) Deploy(c *gin.Context, dm DeployManifestRequest)
- func (cc *Controller) Disable(c *gin.Context, dm DisableManifestRequest)
- func (cc *Controller) Enable(c *gin.Context, dm EnableManifestRequest)
- func (cc *Controller) Patch(c *gin.Context, pm PatchManifestRequest)
- func (cc *Controller) Rollback(c *gin.Context, ur UndoRolloutManifestRequest)
- func (cc *Controller) RollingRestart(c *gin.Context, rr RollingRestartManifestRequest)
- func (cc *Controller) RunJob(c *gin.Context, rj RunJobRequest)
- func (cc *Controller) Scale(c *gin.Context, sm ScaleManifestRequest)
- type DeleteManifestRequest
- type DeleteManifestRequestLabelSelector
- type DeleteManifestRequestLabelSelectors
- type DeleteManifestRequestOptions
- type DeployManifestRequest
- type DisableManifestRequest
- type EnableManifestRequest
- type ManifestCoordinatesResponse
- type ManifestResponse
- type ManifestResponseMoniker
- type Operation
- type Operations
- type OperationsResponse
- type PatchManifestRequest
- type PatchManifestRequestOptions
- type RollingRestartManifestRequest
- type RunJobRequest
- type ScaleManifestRequest
- type TrafficManagement
- type TrafficManagementOptions
- type UndoRolloutManifestRequest
Constants ¶
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 ¶
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)
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
SetFromReplicaSetTemplate sets the desired PodTemplateSpec from a replica set template to the given deployment.
Types ¶
type CleanupArtifactsRequest ¶
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 DeleteManifestRequestLabelSelectors ¶
type DeleteManifestRequestLabelSelectors struct {
Selectors []DeleteManifestRequestLabelSelector `json:"selectors"`
}
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 EnableManifestRequest ¶ added in v0.22.0
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 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 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 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 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 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"` }