github.com/alibaba/sealer@v0.8.6-0.20220430115802-37a2bdaa8173/pkg/plugin/plugin.go (about)

     1  // Copyright © 2021 Alibaba Group Holding Ltd.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package plugin
    16  
    17  import (
    18  	v1 "github.com/alibaba/sealer/types/api/v1"
    19  	v2 "github.com/alibaba/sealer/types/api/v2"
    20  )
    21  
    22  type Interface interface {
    23  	Run(context Context, phase Phase) error
    24  }
    25  
    26  type Phase string
    27  
    28  const (
    29  	PhasePreInit     = Phase("PreInit")
    30  	PhasePreJoin     = Phase("PreJoin")
    31  	PhasePostJoin    = Phase("PostJoin")
    32  	PhasePreInstall  = Phase("PreInstall")
    33  	PhasePostInstall = Phase("PostInstall")
    34  	PhaseOriginally  = Phase("Originally")
    35  	PhasePreGuest    = Phase("PreGuest")
    36  	PhasePreClean    = Phase("PreClean")
    37  	PhasePostClean   = Phase("PostClean")
    38  )
    39  
    40  const (
    41  	// Plugin used for golang so file to find the related symbol
    42  	Plugin             = "Plugin"
    43  	PluginType         = "PluginType"
    44  	EtcdPlugin         = "ETCD"
    45  	LabelPlugin        = "LABEL"
    46  	ShellPlugin        = "SHELL"
    47  	TaintPlugin        = "TAINT"
    48  	HostNamePlugin     = "HOSTNAME"
    49  	ClusterCheckPlugin = "CLUSTERCHECK"
    50  )
    51  
    52  const (
    53  	ClusterNotReady = "ClusterNotReady"
    54  	ClusterReady    = "ClusterReady"
    55  )
    56  
    57  type Context struct {
    58  	Plugin  *v1.Plugin
    59  	Cluster *v2.Cluster
    60  	Host    []string
    61  }