Documentation
¶
Index ¶
- func CalculateExpectedPartition(total *int32, expectedUpdatedReplicas, partitionInSpec int32) int32
- func CalculateProgressingPartition(total *int32, expectedUpdatedReplicas, partitionInSpec int32) int32
- func CalculateUpdatedReplicas(totalReplicas *int32, expectedReplicas intstr.IntOrString) (int32, error)
- func GetCanaryName(workloadName string) string
- 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 Get(ctx context.Context, c client.Client, inter Accessor, ...) (*Info, error)
- func List(ctx context.Context, c client.Client, inter Accessor, namespace string, ...) (workloads, canaryWorkloads []*Info, err error)
- func NewInfo(cluster string, gvk schema.GroupVersionKind, obj client.Object, ...) *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, c client.Client, mutateFn func(client.Object) error) (bool, error)
- type InfoStatus
- type Matcher
- type Owner
- type ReplicaObjectControl
- type Set
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateExpectedPartition ¶ added in v0.1.3
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 CalculateProgressingPartition ¶ added in v0.2.0
func CalculateProgressingPartition(total *int32, expectedUpdatedReplicas, partitionInSpec int32) int32
CalculateProgressingPartition calculates the progressing partition based on the total replicas, expected replicas, and the partition in the spec. In this function, partition means how many replicas need to be updated.
func CalculateUpdatedReplicas ¶ added in v0.1.3
func CalculateUpdatedReplicas(totalReplicas *int32, expectedReplicas intstr.IntOrString) (int32, error)
func GetCanaryName ¶ added in v0.2.0
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 { accessor.ObjectAccessor // DependentWorkloadGVKs returns the dependent workloadds' GroupVersionKinds DependentWorkloadGVKs() []schema.GroupVersionKind // 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, expectedUpdatedReplicas int32) 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) (workloads, canaryWorkloads []*Info, err error)
List return a list of workloads that match the given namespace and match.
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 }
func GetControllerOf ¶ added in v0.1.3
type ReplicaObjectControl ¶ added in v0.2.0
type ReplicaObjectControl interface { // RepliceType returns the type of replica object ReplicaType() schema.GroupVersionKind // IsUpdateObject checks if the replica object revision is updated of the workload IsUpdateObject(ctx context.Context, reader client.Reader, workload, object client.Object) (bool, error) // GetReplicObjects gets the pod selector of the workload GetReplicObjects(ctx context.Context, reader client.Reader, workload client.Object) ([]client.Object, error) }