Merge pull request #642 from grahamhayes/cluster-dns-support

Allow virtual-kubelet to use cluster domain
This commit is contained in:
Brian Goff
2019-06-19 11:38:00 -07:00
committed by GitHub
4 changed files with 17 additions and 6 deletions

View File

@@ -60,6 +60,7 @@ func (mv mapVar) Type() string {
func installFlags(flags *pflag.FlagSet, c *Opts) {
flags.StringVar(&c.KubeConfigPath, "kubeconfig", c.KubeConfigPath, "kube config file to use for connecting to the Kubernetes API server")
flags.StringVar(&c.KubeNamespace, "namespace", c.KubeNamespace, "kubernetes namespace (default is 'all')")
flags.StringVar(&c.KubeClusterDomain, "cluster-domain", c.KubeClusterDomain, "kubernetes cluster-domain (default is 'cluster.local')")
flags.StringVar(&c.NodeName, "nodename", c.NodeName, "kubernetes node name")
flags.StringVar(&c.OperatingSystem, "os", c.OperatingSystem, "Operating System (Linux/Windows)")
flags.StringVar(&c.Provider, "provider", c.Provider, "cloud provider")

View File

@@ -34,6 +34,7 @@ const (
DefaultListenPort = 10250 // TODO(cpuguy83)(VK1.0): Change this to an addr instead of just a port.. we should not be listening on all interfaces.
DefaultPodSyncWorkers = 10
DefaultKubeNamespace = corev1.NamespaceAll
DefaultKubeClusterDomain = "cluster.local"
DefaultTaintEffect = string(corev1.TaintEffectNoSchedule)
DefaultTaintKey = "virtual-kubelet.io/provider"
@@ -49,6 +50,9 @@ type Opts struct {
KubeConfigPath string
// Namespace to watch for pods and other resources
KubeNamespace string
// Domain suffix to append to search domains for the pods created by virtual-kubelet
KubeClusterDomain string
// Sets the port to listen for requests from the Kubernetes API server
ListenPort int32
@@ -127,6 +131,10 @@ func SetDefaultOpts(c *Opts) error {
c.KubeNamespace = DefaultKubeNamespace
}
if c.KubeClusterDomain == "" {
c.KubeClusterDomain = DefaultKubeClusterDomain
}
if c.TaintKey == "" {
c.TaintKey = DefaultTaintKey
}

View File

@@ -126,6 +126,7 @@ func runRootCommand(ctx context.Context, s *providers.Store, c Opts) error {
ResourceManager: rm,
DaemonPort: int32(c.ListenPort),
InternalIP: os.Getenv("VKUBELET_POD_IP"),
KubeClusterDomain: c.KubeClusterDomain,
}
pInit := s.Get(c.Provider)

View File

@@ -62,12 +62,13 @@ func (s *Store) Exists(name string) bool {
// InitConfig is the config passed to initialize a registered provider.
type InitConfig struct {
ConfigPath string
NodeName string
OperatingSystem string
InternalIP string
DaemonPort int32
ResourceManager *manager.ResourceManager
ConfigPath string
NodeName string
OperatingSystem string
InternalIP string
DaemonPort int32
KubeClusterDomain string
ResourceManager *manager.ResourceManager
}
type InitFunc func(InitConfig) (Provider, error)