sigs.k8s.io/cluster-api@v1.7.1/cmd/clusterctl/client/alpha/rollout.go (about)

     1  /*
     2  Copyright 2020 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package alpha
    18  
    19  import (
    20  	"context"
    21  
    22  	corev1 "k8s.io/api/core/v1"
    23  
    24  	"sigs.k8s.io/cluster-api/cmd/clusterctl/client/cluster"
    25  )
    26  
    27  const (
    28  	// MachineDeployment is a resource type.
    29  	MachineDeployment = "machinedeployment"
    30  	// KubeadmControlPlane is a resource type.
    31  	KubeadmControlPlane = "kubeadmcontrolplane"
    32  )
    33  
    34  var validResourceTypes = []string{
    35  	MachineDeployment,
    36  	KubeadmControlPlane,
    37  }
    38  
    39  var validRollbackResourceTypes = []string{
    40  	MachineDeployment,
    41  }
    42  
    43  // Rollout defines the behavior of a rollout implementation.
    44  type Rollout interface {
    45  	ObjectRestarter(context.Context, cluster.Proxy, corev1.ObjectReference) error
    46  	ObjectPauser(context.Context, cluster.Proxy, corev1.ObjectReference) error
    47  	ObjectResumer(context.Context, cluster.Proxy, corev1.ObjectReference) error
    48  	ObjectRollbacker(context.Context, cluster.Proxy, corev1.ObjectReference, int64) error
    49  }
    50  
    51  var _ Rollout = &rollout{}
    52  
    53  type rollout struct{}
    54  
    55  func newRolloutClient() Rollout {
    56  	return &rollout{}
    57  }