Add back deprecated taint flag
TODO: Revert this commit Related to #316
This commit is contained in:
committed by
Robbie Zhang
parent
d47a0b2fc0
commit
5115c1e5cd
@@ -36,6 +36,7 @@ var nodeName string
|
||||
var operatingSystem string
|
||||
var provider string
|
||||
var providerConfig string
|
||||
var taintKey string
|
||||
var disableTaint bool
|
||||
|
||||
// RootCmd represents the base command when called without any subcommands
|
||||
@@ -47,7 +48,7 @@ backend implementation allowing users to create kubernetes nodes without running
|
||||
This allows users to schedule kubernetes workloads on nodes that aren't running Kubernetes.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println(kubeConfig)
|
||||
f, err := vkubelet.New(nodeName, operatingSystem, kubeNamespace, kubeConfig, provider, providerConfig, disableTaint)
|
||||
f, err := vkubelet.New(nodeName, operatingSystem, kubeNamespace, kubeConfig, provider, providerConfig, taintKey, disableTaint)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@@ -84,6 +85,8 @@ func init() {
|
||||
RootCmd.PersistentFlags().StringVar(&provider, "provider", "", "cloud provider")
|
||||
RootCmd.PersistentFlags().BoolVar(&disableTaint, "disable-taint", false, "disable the virtual-kubelet node taint")
|
||||
RootCmd.PersistentFlags().StringVar(&providerConfig, "provider-config", "", "cloud provider configuration file")
|
||||
RootCmd.PersistentFlags().StringVar(&taintKey, "taint", "", "Set node taint key")
|
||||
RootCmd.PersistentFlags().MarkDeprecated("taint", "Taint key should now be configured using the VK_TAINT_KEY environment variable")
|
||||
|
||||
// Cobra also supports local flags, which will only run
|
||||
// when this action is called directly.
|
||||
|
||||
@@ -46,7 +46,7 @@ func getEnv(key, defaultValue string) string {
|
||||
}
|
||||
|
||||
// New creates a new virtual-kubelet server.
|
||||
func New(nodeName, operatingSystem, namespace, kubeConfig, provider, providerConfig string, disableTaint bool) (*Server, error) {
|
||||
func New(nodeName, operatingSystem, namespace, kubeConfig, provider, providerConfig, taintKey string, disableTaint bool) (*Server, error) {
|
||||
var config *rest.Config
|
||||
|
||||
// Check if the kubeConfig file exists.
|
||||
@@ -80,7 +80,13 @@ func New(nodeName, operatingSystem, namespace, kubeConfig, provider, providerCon
|
||||
|
||||
internalIP := os.Getenv("VKUBELET_POD_IP")
|
||||
|
||||
vkTaintKey := getEnv("VKUBELET_TAINT_KEY", "virtual-kubelet.io/provider")
|
||||
var defaultTaintKey string
|
||||
if taintKey != "" {
|
||||
defaultTaintKey = taintKey
|
||||
} else {
|
||||
defaultTaintKey = "virtual-kubelet.io/provider"
|
||||
}
|
||||
vkTaintKey := getEnv("VKUBELET_TAINT_KEY", defaultTaintKey)
|
||||
vkTaintValue := getEnv("VKUBELET_TAINT_VALUE", provider)
|
||||
vkTaintEffectEnv := getEnv("VKUBELET_TAINT_EFFECT", "NoSchedule")
|
||||
var vkTaintEffect corev1.TaintEffect
|
||||
|
||||
Reference in New Issue
Block a user