Documentation
¶
Index ¶
- func CalculateExpectedPartition(total *int32, expectedReplicas intstr.IntOrString, partitionInSpec int32) (int32, error)
- func CalculateUpdatedReplicas(totalReplicas *int32, expectedReplicas intstr.IntOrString) (int32, error)
- func GetClusterFromLabel(labels map[string]string) string
- func IsCanary(workload client.Object) bool
- func IsControlledByRollout(workload client.Object) bool
- func IsProgressing(workload client.Object) bool
- func IsWaitingRollout(info Info) bool
- func PatchMetadata(meta *metav1.ObjectMeta, patch rolloutv1alpha1.MetadataPatch)
- type Accessor
- type BatchReleaseControl
- type CanaryReleaseControl
- type Info
- func (o *Info) APIStatus() rolloutv1alpha1.RolloutWorkloadStatus
- func (o *Info) CheckUpdatedReady(replicas int32) bool
- func (o *Info) NamespacedName() types.NamespacedName
- func (o *Info) String() string
- func (o *Info) UpdateOnConflict(ctx context.Context, client client.Client, mutateFn func(client.Object) error) (bool, error)
- type InfoStatus
- type Matcher
- type Owner
- type PodControl
- type Set
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateExpectedPartition ¶ added in v0.1.3
func CalculateExpectedPartition(total *int32, expectedReplicas intstr.IntOrString, partitionInSpec int32) (int32, error)
CalculateExpectedPartition calculates the expected partition based on the total replicas, expected replicas, and the partition in the spec. In this function, partition means how many replicas are not updated.
func CalculateUpdatedReplicas ¶ added in v0.1.3
func CalculateUpdatedReplicas(totalReplicas *int32, expectedReplicas intstr.IntOrString) (int32, error)
func GetClusterFromLabel ¶
func IsControlledByRollout ¶ added in v0.1.3
func IsProgressing ¶ added in v0.1.3
func IsWaitingRollout ¶ added in v0.1.1
func PatchMetadata ¶ added in v0.1.0
func PatchMetadata(meta *metav1.ObjectMeta, patch rolloutv1alpha1.MetadataPatch)
PatchMetadata patches metadata with the given patch
Types ¶
type Accessor ¶ added in v0.1.1
type Accessor interface {
// GroupVersionKind returns the GroupVersionKind of the workload
GroupVersionKind() schema.GroupVersionKind
// DependentWorkloadGVKs returns the dependent workloadds' GroupVersionKinds
DependentWorkloadGVKs() []schema.GroupVersionKind
// NewObject returns a new instance of the workload type
NewObject() client.Object
// NewObjectList returns a new instance of the workload list type
NewObjectList() client.ObjectList
// Watchable indicates whether this workload type can be watched from the API server.
Watchable() bool
// GetInfo returns a info represent workload
GetInfo(cluster string, obj client.Object) (*Info, error)
}
Accessor defines the functions to access the workload. The following interfaces are optional: - CanaryReleaseControl - BatchReleaseControl - PodControl
type BatchReleaseControl ¶ added in v0.1.3
type BatchReleaseControl interface {
// BatchPreCheck checks object before batch release.
BatchPreCheck(obj client.Object) error
// ApplyPartition use expectedUpdated replicas to calculate partition and apply it to the workload.
ApplyPartition(obj client.Object, expectedUpdated intstr.IntOrString) error
}
BatchReleaseControl defines the control functions for workload batch release
type CanaryReleaseControl ¶ added in v0.1.3
type CanaryReleaseControl interface {
// CanaryPreCheck checks object before canary release.
CanaryPreCheck(obj client.Object) error
// Scale scales the workload replicas.
Scale(obj client.Object, replicas int32) error
// ApplyCanaryPatch applies canary to the workload.
ApplyCanaryPatch(canary client.Object, podTemplatePatch *v1alpha1.MetadataPatch) error
}
CanaryReleaseControl defines the control functions for workload canary release
type Info ¶
type Info struct {
metav1.ObjectMeta
// GVK is the GroupVersionKind of the workload.
schema.GroupVersionKind
// Status is the status of the workload.
Status InfoStatus
// Object is the object representing the workload.
Object client.Object
}
workload info
func List ¶ added in v0.1.1
func List(ctx context.Context, c client.Client, inter Accessor, namespace string, match rolloutv1alpha1.ResourceMatch) ([]*Info, error)
List return a list of workloads that match the given namespace and match. It will ignore canary workloads or deleted workloads by default.
func NewInfo ¶
func NewInfo(cluster string, gvk schema.GroupVersionKind, obj client.Object, status InfoStatus) *Info
func (*Info) APIStatus ¶ added in v0.1.0
func (o *Info) APIStatus() rolloutv1alpha1.RolloutWorkloadStatus
func (*Info) CheckUpdatedReady ¶ added in v0.1.1
func (*Info) NamespacedName ¶ added in v0.1.0
func (o *Info) NamespacedName() types.NamespacedName
type InfoStatus ¶ added in v0.1.1
type InfoStatus struct {
// ObservedGeneration is the most recent generation observed for this workload.
ObservedGeneration int64
// StableRevision is the old stable revision used to generate pods.
StableRevision string
// UpdatedRevision is the updated template revision used to generate pods.
UpdatedRevision string
// Replicas is the desired number of pods targeted by workload
Replicas int32
// UpdatedReplicas is the number of pods targeted by workload that have the updated template spec.
UpdatedReplicas int32
// UpdatedReadyReplicas is the number of ready pods targeted by workload that have the updated template spec.
UpdatedReadyReplicas int32
// UpdatedAvailableReplicas is the number of service available pods targeted by workload that have the updated template spec.
UpdatedAvailableReplicas int32
}
workload status
type Matcher ¶ added in v0.1.1
func MatchAsMatcher ¶
func MatchAsMatcher(match rolloutv1alpha1.ResourceMatch) Matcher
type Owner ¶ added in v0.1.3
type Owner struct {
Ref *metav1.OwnerReference
GVK schema.GroupVersionKind
}