fix: re-enable control plane flags
This PR aims to fix the ability to pass extra flags to control plane components. This will close #1523 Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
This commit is contained in:
parent
4f39907b6e
commit
aabd46e651
2
go.mod
2
go.mod
@ -5,7 +5,7 @@ go 1.13
|
||||
replace (
|
||||
github.com/docker/distribution v2.7.1+incompatible => github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible
|
||||
github.com/firecracker-microvm/firecracker-go-sdk v0.19.0 => github.com/smira/firecracker-go-sdk v0.19.1-0.20200110185541-4fce8cba9f84
|
||||
github.com/kubernetes-sigs/bootkube => github.com/talos-systems/bootkube v0.14.1-0.20200121212854-f29021689bee
|
||||
github.com/kubernetes-sigs/bootkube => github.com/talos-systems/bootkube v0.14.1-0.20200123150754-82cbbbe2c4de
|
||||
github.com/opencontainers/runtime-spec v1.0.1 => github.com/opencontainers/runtime-spec v0.1.2-0.20180301181910-fa4b36aa9c99
|
||||
)
|
||||
|
||||
|
4
go.sum
4
go.sum
@ -525,8 +525,8 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
|
||||
github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
|
||||
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2 h1:b6uOv7YOFK0TYG7HtkIgExQo+2RdLuwRft63jn2HWj8=
|
||||
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
|
||||
github.com/talos-systems/bootkube v0.14.1-0.20200121212854-f29021689bee h1:Grx/Ut3pPr+ZaBF/TdqmeEw5RLuX7e0m93yMpSOth1E=
|
||||
github.com/talos-systems/bootkube v0.14.1-0.20200121212854-f29021689bee/go.mod h1:zLrZfPQ49k0O6x6QN0pDSJn9iD0EMyj6J+5x1vqJSFw=
|
||||
github.com/talos-systems/bootkube v0.14.1-0.20200123150754-82cbbbe2c4de h1:aXXO2cMA1iAxVtC2ailC/stPAlpNjpS3OyV0rxJsy7g=
|
||||
github.com/talos-systems/bootkube v0.14.1-0.20200123150754-82cbbbe2c4de/go.mod h1:zLrZfPQ49k0O6x6QN0pDSJn9iD0EMyj6J+5x1vqJSFw=
|
||||
github.com/talos-systems/grpc-proxy v0.2.0 h1:DN75bLfaW4xfhq0r0mwFRnfGhSB+HPhK1LNzuMEs9Pw=
|
||||
github.com/talos-systems/grpc-proxy v0.2.0/go.mod h1:sm97Vc/z2cok3pu6ruNeszQej4KDxFrDgfWs4C1mtC4=
|
||||
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
|
||||
|
@ -309,27 +309,30 @@ func generateAssets(config runtime.Configurator) (err error) {
|
||||
images.PodCheckpointer = config.Cluster().PodCheckpointer().Image()
|
||||
|
||||
conf := asset.Config{
|
||||
ClusterName: config.Cluster().Name(),
|
||||
CACert: k8sCA,
|
||||
CAPrivKey: k8sKey,
|
||||
EtcdCACert: ca,
|
||||
EtcdClientCert: peer,
|
||||
EtcdClientKey: key,
|
||||
EtcdServers: []*url.URL{etcdServer},
|
||||
EtcdUseTLS: true,
|
||||
ControlPlaneEndpoint: config.Cluster().Endpoint(),
|
||||
LocalAPIServerPort: config.Cluster().LocalAPIServerPort(),
|
||||
APIServiceIP: apiServiceIP,
|
||||
DNSServiceIP: dnsServiceIP,
|
||||
PodCIDR: podCIDR,
|
||||
ServiceCIDR: serviceCIDR,
|
||||
NetworkProvider: config.Cluster().Network().CNI().Name(),
|
||||
AltNames: altNames,
|
||||
Images: images,
|
||||
BootstrapSecretsSubdir: "/assets/tls",
|
||||
BootstrapTokenID: config.Cluster().Token().ID(),
|
||||
BootstrapTokenSecret: config.Cluster().Token().Secret(),
|
||||
AESCBCEncryptionSecret: config.Cluster().AESCBCEncryptionSecret(),
|
||||
ClusterName: config.Cluster().Name(),
|
||||
APIServerExtraArgs: config.Cluster().APIServer().ExtraArgs(),
|
||||
ControllerManagerExtraArgs: config.Cluster().ControllerManager().ExtraArgs(),
|
||||
SchedulerExtraArgs: config.Cluster().Scheduler().ExtraArgs(),
|
||||
CACert: k8sCA,
|
||||
CAPrivKey: k8sKey,
|
||||
EtcdCACert: ca,
|
||||
EtcdClientCert: peer,
|
||||
EtcdClientKey: key,
|
||||
EtcdServers: []*url.URL{etcdServer},
|
||||
EtcdUseTLS: true,
|
||||
ControlPlaneEndpoint: config.Cluster().Endpoint(),
|
||||
LocalAPIServerPort: config.Cluster().LocalAPIServerPort(),
|
||||
APIServiceIP: apiServiceIP,
|
||||
DNSServiceIP: dnsServiceIP,
|
||||
PodCIDR: podCIDR,
|
||||
ServiceCIDR: serviceCIDR,
|
||||
NetworkProvider: config.Cluster().Network().CNI().Name(),
|
||||
AltNames: altNames,
|
||||
Images: images,
|
||||
BootstrapSecretsSubdir: "/assets/tls",
|
||||
BootstrapTokenID: config.Cluster().Token().ID(),
|
||||
BootstrapTokenSecret: config.Cluster().Token().Secret(),
|
||||
AESCBCEncryptionSecret: config.Cluster().AESCBCEncryptionSecret(),
|
||||
}
|
||||
|
||||
as, err := asset.NewDefaultAssets(conf)
|
||||
|
@ -15,6 +15,9 @@ import (
|
||||
// related options.
|
||||
type Cluster interface {
|
||||
Name() string
|
||||
APIServer() APIServer
|
||||
ControllerManager() ControllerManager
|
||||
Scheduler() Scheduler
|
||||
Endpoint() *url.URL
|
||||
Token() Token
|
||||
CertSANs() []string
|
||||
@ -45,6 +48,24 @@ type CNI interface {
|
||||
URLs() []string
|
||||
}
|
||||
|
||||
// APIServer defines the requirements for a config that pertains to apiserver related
|
||||
// options.
|
||||
type APIServer interface {
|
||||
ExtraArgs() map[string]string
|
||||
}
|
||||
|
||||
// ControllerManager defines the requirements for a config that pertains to controller manager related
|
||||
// options.
|
||||
type ControllerManager interface {
|
||||
ExtraArgs() map[string]string
|
||||
}
|
||||
|
||||
// Scheduler defines the requirements for a config that pertains to scheduler related
|
||||
// options.
|
||||
type Scheduler interface {
|
||||
ExtraArgs() map[string]string
|
||||
}
|
||||
|
||||
// Etcd defines the requirements for a config that pertains to etcd related
|
||||
// options.
|
||||
type Etcd interface {
|
||||
|
@ -39,11 +39,11 @@ func initUd(in *Input) (*v1alpha1.Config, error) {
|
||||
ControlPlane: &v1alpha1.ControlPlaneConfig{
|
||||
Endpoint: &v1alpha1.Endpoint{URL: controlPlaneURL},
|
||||
},
|
||||
APIServer: &v1alpha1.APIServerConfig{
|
||||
APIServerConfig: &v1alpha1.APIServerConfig{
|
||||
CertSANs: certSANs,
|
||||
},
|
||||
ControllerManager: &v1alpha1.ControllerManagerConfig{},
|
||||
Scheduler: &v1alpha1.SchedulerConfig{},
|
||||
ControllerManagerConfig: &v1alpha1.ControllerManagerConfig{},
|
||||
SchedulerConfig: &v1alpha1.SchedulerConfig{},
|
||||
EtcdConfig: &v1alpha1.EtcdConfig{
|
||||
RootCA: in.Certs.Etcd,
|
||||
},
|
||||
|
@ -203,16 +203,16 @@ func (c *ClusterConfig) LocalAPIServerPort() int {
|
||||
|
||||
// CertSANs implements the Configurator interface.
|
||||
func (c *ClusterConfig) CertSANs() []string {
|
||||
return c.APIServer.CertSANs
|
||||
return c.APIServerConfig.CertSANs
|
||||
}
|
||||
|
||||
// SetCertSANs implements the Configurator interface.
|
||||
func (c *ClusterConfig) SetCertSANs(sans []string) {
|
||||
if c.APIServer == nil {
|
||||
c.APIServer = &APIServerConfig{}
|
||||
if c.APIServerConfig == nil {
|
||||
c.APIServerConfig = &APIServerConfig{}
|
||||
}
|
||||
|
||||
c.APIServer.CertSANs = append(c.APIServer.CertSANs, sans...)
|
||||
c.APIServerConfig.CertSANs = append(c.APIServerConfig.CertSANs, sans...)
|
||||
}
|
||||
|
||||
// CA implements the Configurator interface.
|
||||
@ -230,6 +230,48 @@ func (c *ClusterConfig) Config(t machine.Type) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// APIServer implements the Configurator interface.
|
||||
func (c *ClusterConfig) APIServer() cluster.APIServer {
|
||||
if c.APIServerConfig == nil {
|
||||
return &APIServerConfig{}
|
||||
}
|
||||
|
||||
return c.APIServerConfig
|
||||
}
|
||||
|
||||
// ExtraArgs implements the Configurator interface.
|
||||
func (a *APIServerConfig) ExtraArgs() map[string]string {
|
||||
return a.ExtraArgsConfig
|
||||
}
|
||||
|
||||
// ControllerManager implements the Configurator interface.
|
||||
func (c *ClusterConfig) ControllerManager() cluster.ControllerManager {
|
||||
if c.ControllerManagerConfig == nil {
|
||||
return &ControllerManagerConfig{}
|
||||
}
|
||||
|
||||
return c.ControllerManagerConfig
|
||||
}
|
||||
|
||||
// ExtraArgs implements the Configurator interface.
|
||||
func (c *ControllerManagerConfig) ExtraArgs() map[string]string {
|
||||
return c.ExtraArgsConfig
|
||||
}
|
||||
|
||||
// Scheduler implements the Configurator interface.
|
||||
func (c *ClusterConfig) Scheduler() cluster.Scheduler {
|
||||
if c.SchedulerConfig == nil {
|
||||
return &SchedulerConfig{}
|
||||
}
|
||||
|
||||
return c.SchedulerConfig
|
||||
}
|
||||
|
||||
// ExtraArgs implements the Configurator interface.
|
||||
func (s *SchedulerConfig) ExtraArgs() map[string]string {
|
||||
return s.ExtraArgsConfig
|
||||
}
|
||||
|
||||
// Etcd implements the Configurator interface.
|
||||
func (c *ClusterConfig) Etcd() cluster.Etcd {
|
||||
return c.EtcdConfig
|
||||
|
@ -235,7 +235,7 @@ type ClusterConfig struct {
|
||||
// certSANs:
|
||||
// - 1.2.3.4
|
||||
// - 5.6.7.8
|
||||
APIServer *APIServerConfig `yaml:"apiServer,omitempty"`
|
||||
APIServerConfig *APIServerConfig `yaml:"apiServer,omitempty"`
|
||||
// description: |
|
||||
// Controller manager server specific configuration options.
|
||||
// examples:
|
||||
@ -244,7 +244,7 @@ type ClusterConfig struct {
|
||||
// image: ...
|
||||
// extraArgs:
|
||||
// key: value
|
||||
ControllerManager *ControllerManagerConfig `yaml:"controllerManager,omitempty"`
|
||||
ControllerManagerConfig *ControllerManagerConfig `yaml:"controllerManager,omitempty"`
|
||||
// description: |
|
||||
// Scheduler server specific configuration options.
|
||||
// examples:
|
||||
@ -253,7 +253,7 @@ type ClusterConfig struct {
|
||||
// image: ...
|
||||
// extraArgs:
|
||||
// key: value
|
||||
Scheduler *SchedulerConfig `yaml:"scheduler,omitempty"`
|
||||
SchedulerConfig *SchedulerConfig `yaml:"scheduler,omitempty"`
|
||||
// description: |
|
||||
// Etcd specific configuration options.
|
||||
// examples:
|
||||
@ -479,7 +479,7 @@ type APIServerConfig struct {
|
||||
Image string `yaml:"image,omitempty"`
|
||||
// description: |
|
||||
// Extra arguments to supply to the API server.
|
||||
ExtraArgs map[string]string `yaml:"extraArgs,omitempty"`
|
||||
ExtraArgsConfig map[string]string `yaml:"extraArgs,omitempty"`
|
||||
// description: |
|
||||
// Extra certificate subject alternative names for the API server's certificate.
|
||||
CertSANs []string `yaml:"certSANs,omitempty"`
|
||||
@ -492,7 +492,7 @@ type ControllerManagerConfig struct {
|
||||
Image string `yaml:"image,omitempty"`
|
||||
// description: |
|
||||
// Extra arguments to supply to the controller manager.
|
||||
ExtraArgs map[string]string `yaml:"extraArgs,omitempty"`
|
||||
ExtraArgsConfig map[string]string `yaml:"extraArgs,omitempty"`
|
||||
}
|
||||
|
||||
// SchedulerConfig represents kube scheduler config vals.
|
||||
@ -502,7 +502,7 @@ type SchedulerConfig struct {
|
||||
Image string `yaml:"image,omitempty"`
|
||||
// description: |
|
||||
// Extra arguments to supply to the scheduler.
|
||||
ExtraArgs map[string]string `yaml:"extraArgs,omitempty"`
|
||||
ExtraArgsConfig map[string]string `yaml:"extraArgs,omitempty"`
|
||||
}
|
||||
|
||||
// EtcdConfig represents etcd config vals.
|
||||
|
Loading…
x
Reference in New Issue
Block a user