Add default provider taint and taint configuration options

This allows for more specificity when setting taint tolerations for
workloads. Three new env variables are introduced:

VKUBELET_TAINT_KEY (defaults to `virtual-kubelet.io/provider`)
VKUBELET_TAINT_VALUE (defaults to provider name)
VKUBELET_TAINT_EFFECT (defaults to `NoSchedule`)

BREAKING CHANGES:
- The default taint key of `azure.com/aci` is now
  `virtual-kubelet.io/provider`.
- Specifying a custom taint key is now done via an environment variable
  rather than the `--taint` command line flag.
This commit is contained in:
Jacob LeGrone
2018-08-14 11:57:22 -04:00
committed by Robbie Zhang
parent 9f07768875
commit d47a0b2fc0
14 changed files with 75 additions and 28 deletions

View File

@@ -36,7 +36,7 @@ var nodeName string
var operatingSystem string
var provider string
var providerConfig string
var taint string
var disableTaint bool
// RootCmd represents the base command when called without any subcommands
var RootCmd = &cobra.Command{
@@ -47,7 +47,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, taint, provider, providerConfig)
f, err := vkubelet.New(nodeName, operatingSystem, kubeNamespace, kubeConfig, provider, providerConfig, disableTaint)
if err != nil {
log.Fatal(err)
}
@@ -82,7 +82,7 @@ func init() {
RootCmd.PersistentFlags().StringVar(&nodeName, "nodename", defaultNodeName, "kubernetes node name")
RootCmd.PersistentFlags().StringVar(&operatingSystem, "os", "Linux", "Operating System (Linux/Windows)")
RootCmd.PersistentFlags().StringVar(&provider, "provider", "", "cloud provider")
RootCmd.PersistentFlags().StringVar(&taint, "taint", "", "apply taint to node, making scheduling explicit")
RootCmd.PersistentFlags().BoolVar(&disableTaint, "disable-taint", false, "disable the virtual-kubelet node taint")
RootCmd.PersistentFlags().StringVar(&providerConfig, "provider-config", "", "cloud provider configuration file")
// Cobra also supports local flags, which will only run