Documentation ¶
Index ¶
- Constants
- func DeploymentReady(log logger.Logger, ctx context.Context, rs *appsv1.ReplicaSet, ...) bool
- func EqualIgnoreHash(template1, template2 *v1.PodTemplateSpec) bool
- func FindNewReplicaSet(deployment *apps.Deployment, rsList []*apps.ReplicaSet) *apps.ReplicaSet
- func GetNewReplicaSet(deployment *apps.Deployment, c appsclient.AppsV1Interface) (*apps.ReplicaSet, error)
- func IsRollingUpdate(deployment *apps.Deployment) bool
- func ListReplicaSets(deployment *apps.Deployment, getRSList RsListFunc) ([]*apps.ReplicaSet, error)
- func MaxUnavailable(deployment apps.Deployment) int32
- func ResolveFenceposts(maxSurge, maxUnavailable *intstrutil.IntOrString, desired int32) (int32, int32, error)
- type IK8sProjector
- type K8sTargetProvider
- func (i *K8sTargetProvider) Apply(ctx context.Context, dep model.DeploymentSpec, step model.DeploymentStep, ...) (map[string]model.ComponentResultSpec, error)
- func (i *K8sTargetProvider) Get(ctx context.Context, dep model.DeploymentSpec, ...) ([]model.ComponentSpec, error)
- func (i *K8sTargetProvider) GetValidationRule(ctx context.Context) model.ValidationRule
- func (i *K8sTargetProvider) Init(config providers.IProviderConfig) error
- func (i *K8sTargetProvider) InitWithMap(properties map[string]string) error
- func (s *K8sTargetProvider) SetContext(ctx *contexts.ManagerContext)
- type K8sTargetProviderConfig
- type ReplicaSetsByCreationTimestamp
- type RsListFunc
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func DeploymentReady ¶
func DeploymentReady(log logger.Logger, ctx context.Context, rs *appsv1.ReplicaSet, dep *appsv1.Deployment) bool
func EqualIgnoreHash ¶
func EqualIgnoreHash(template1, template2 *v1.PodTemplateSpec) bool
EqualIgnoreHash returns true if two given podTemplateSpec are equal, ignoring the diff in value of Labels[pod-template-hash] We ignore pod-template-hash because:
- The hash result would be different upon podTemplateSpec API changes (e.g. the addition of a new field will cause the hash code to change)
- The deployment template won't have hash labels
func FindNewReplicaSet ¶
func FindNewReplicaSet(deployment *apps.Deployment, rsList []*apps.ReplicaSet) *apps.ReplicaSet
FindNewReplicaSet returns the new RS this given deployment targets (the one with the same pod template).
func GetNewReplicaSet ¶
func GetNewReplicaSet(deployment *apps.Deployment, c appsclient.AppsV1Interface) (*apps.ReplicaSet, error)
GetNewReplicaSet returns a replica set that matches the intent of the given deployment; get ReplicaSetList from client interface. Returns nil if the new replica set doesn't exist yet.
func IsRollingUpdate ¶
func IsRollingUpdate(deployment *apps.Deployment) bool
IsRollingUpdate returns true if the strategy type is a rolling update.
func ListReplicaSets ¶
func ListReplicaSets(deployment *apps.Deployment, getRSList RsListFunc) ([]*apps.ReplicaSet, error)
ListReplicaSets returns a slice of RSes the given deployment targets. Note that this does NOT attempt to reconcile ControllerRef (adopt/orphan), because only the controller itself should do that. However, it does filter out anything whose ControllerRef doesn't match.
func MaxUnavailable ¶
func MaxUnavailable(deployment apps.Deployment) int32
MaxUnavailable returns the maximum unavailable pods a rolling deployment can take.
func ResolveFenceposts ¶
func ResolveFenceposts(maxSurge, maxUnavailable *intstrutil.IntOrString, desired int32) (int32, int32, error)
ResolveFenceposts resolves both maxSurge and maxUnavailable. This needs to happen in one step. For example:
2 desired, max unavailable 1%, surge 0% - should scale old(-1), then new(+1), then old(-1), then new(+1) 1 desired, max unavailable 1%, surge 0% - should scale old(-1), then new(+1) 2 desired, max unavailable 25%, surge 1% - should scale new(+1), then old(-1), then new(+1), then old(-1) 1 desired, max unavailable 25%, surge 1% - should scale new(+1), then old(-1) 2 desired, max unavailable 0%, surge 1% - should scale new(+1), then old(-1), then new(+1), then old(-1) 1 desired, max unavailable 0%, surge 1% - should scale new(+1), then old(-1)
Types ¶
type IK8sProjector ¶
type K8sTargetProvider ¶
type K8sTargetProvider struct { Config K8sTargetProviderConfig Context *contexts.ManagerContext Client kubernetes.Interface DynamicClient dynamic.Interface }
func (*K8sTargetProvider) Apply ¶
func (i *K8sTargetProvider) Apply(ctx context.Context, dep model.DeploymentSpec, step model.DeploymentStep, isDryRun bool) (map[string]model.ComponentResultSpec, error)
func (*K8sTargetProvider) Get ¶
func (i *K8sTargetProvider) Get(ctx context.Context, dep model.DeploymentSpec, references []model.ComponentStep) ([]model.ComponentSpec, error)
func (*K8sTargetProvider) GetValidationRule ¶
func (i *K8sTargetProvider) GetValidationRule(ctx context.Context) model.ValidationRule
func (*K8sTargetProvider) Init ¶
func (i *K8sTargetProvider) Init(config providers.IProviderConfig) error
func (*K8sTargetProvider) InitWithMap ¶
func (i *K8sTargetProvider) InitWithMap(properties map[string]string) error
func (*K8sTargetProvider) SetContext ¶
func (s *K8sTargetProvider) SetContext(ctx *contexts.ManagerContext)
type K8sTargetProviderConfig ¶
type K8sTargetProviderConfig struct { Name string `json:"name"` ConfigType string `json:"configType,omitempty"` ConfigData string `json:"configData,omitempty"` Context string `json:"context,omitempty"` InCluster bool `json:"inCluster"` Projector string `json:"projector,omitempty"` DeploymentStrategy string `json:"deploymentStrategy,omitempty"` DeleteEmptyNamespace bool `json:"deleteEmptyNamespace"` RetryCount int `json:"retryCount"` RetryIntervalInSec int `json:"retryIntervalInSec"` NoWait bool `json:"noWait"` Timeout string `json:"timeout,omitempty"` }
func K8sTargetProviderConfigFromMap ¶
func K8sTargetProviderConfigFromMap(properties map[string]string) (K8sTargetProviderConfig, error)
type ReplicaSetsByCreationTimestamp ¶
type ReplicaSetsByCreationTimestamp []*apps.ReplicaSet
ReplicaSetsByCreationTimestamp sorts a list of ReplicaSet by creation timestamp, using their names as a tie breaker.
func (ReplicaSetsByCreationTimestamp) Len ¶
func (o ReplicaSetsByCreationTimestamp) Len() int
func (ReplicaSetsByCreationTimestamp) Less ¶
func (o ReplicaSetsByCreationTimestamp) Less(i, j int) bool
func (ReplicaSetsByCreationTimestamp) Swap ¶
func (o ReplicaSetsByCreationTimestamp) Swap(i, j int)
type RsListFunc ¶
type RsListFunc func(string, metav1.ListOptions) ([]*apps.ReplicaSet, error)
RsListFunc returns the ReplicaSet from the ReplicaSet namespace and the List metav1.ListOptions.
func RsListFromClient ¶
func RsListFromClient(c appsclient.AppsV1Interface) RsListFunc
RsListFromClient returns an rsListFunc that wraps the given client.