Commit 5c168e2d authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #39996 from kubermatic/aws

Automatic merge from submit-queue AWS: run k8s master in different account or different provider Currently the master and the nodes must run in the same account. With this change the master can run in a different AWS account, on a different cloud provider or on premise. ## Release Notes ```release-note AWS cloud provider: allow to run the master with a different AWS account or even on a different cloud provider than the nodes. ```
parents 298db3a0 0be5e604
...@@ -388,6 +388,11 @@ type CloudConfig struct { ...@@ -388,6 +388,11 @@ type CloudConfig struct {
// Maybe if we're not running on AWS, e.g. bootstrap; for now it is not very useful // Maybe if we're not running on AWS, e.g. bootstrap; for now it is not very useful
Zone string Zone string
// The AWS VPC flag enables the possibility to run the master components
// on a different aws account, on a different cloud provider or on-premise.
// If the flag is set also the KubernetesClusterTag must be provided
VPC string
// KubernetesClusterTag is the legacy cluster id we'll use to identify our cluster resources // KubernetesClusterTag is the legacy cluster id we'll use to identify our cluster resources
KubernetesClusterTag string KubernetesClusterTag string
// KubernetesClusterTag is the cluster id we'll use to identify our cluster resources // KubernetesClusterTag is the cluster id we'll use to identify our cluster resources
...@@ -812,13 +817,24 @@ func newAWSCloud(config io.Reader, awsServices Services) (*Cloud, error) { ...@@ -812,13 +817,24 @@ func newAWSCloud(config io.Reader, awsServices Services) (*Cloud, error) {
deviceAllocators: make(map[types.NodeName]DeviceAllocator), deviceAllocators: make(map[types.NodeName]DeviceAllocator),
} }
selfAWSInstance, err := awsCloud.buildSelfAWSInstance() if cfg.Global.VPC != "" && cfg.Global.KubernetesClusterTag != "" {
if err != nil { // When the master is running on a different AWS account, cloud provider or on-premise
return nil, err // build up a dummy instance and use the VPC from the nodes account
} glog.Info("Master is configured to run on a AWS account, different cloud provider or on-premise")
awsCloud.selfAWSInstance = &awsInstance{
nodeName: "master-dummy",
vpcID: cfg.Global.VPC,
}
awsCloud.vpcID = cfg.Global.VPC
} else {
selfAWSInstance, err := awsCloud.buildSelfAWSInstance()
if err != nil {
return nil, err
}
awsCloud.selfAWSInstance = selfAWSInstance
awsCloud.vpcID = selfAWSInstance.vpcID
awsCloud.selfAWSInstance = selfAWSInstance }
awsCloud.vpcID = selfAWSInstance.vpcID
if cfg.Global.KubernetesClusterTag != "" || cfg.Global.KubernetesClusterID != "" { if cfg.Global.KubernetesClusterTag != "" || cfg.Global.KubernetesClusterID != "" {
if err := awsCloud.tagging.init(cfg.Global.KubernetesClusterTag, cfg.Global.KubernetesClusterID); err != nil { if err := awsCloud.tagging.init(cfg.Global.KubernetesClusterTag, cfg.Global.KubernetesClusterID); err != nil {
...@@ -826,7 +842,7 @@ func newAWSCloud(config io.Reader, awsServices Services) (*Cloud, error) { ...@@ -826,7 +842,7 @@ func newAWSCloud(config io.Reader, awsServices Services) (*Cloud, error) {
} }
} else { } else {
// TODO: Clean up double-API query // TODO: Clean up double-API query
info, err := selfAWSInstance.describeInstance() info, err := awsCloud.selfAWSInstance.describeInstance()
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment