mirror of https://github.com/kubernetes/kops.git
Set flags on AWS CCM mimicking KCM
This commit is contained in:
parent
d906f83121
commit
3d90769e1c
|
|
@ -4,6 +4,7 @@ go_library(
|
|||
name = "go_default_library",
|
||||
srcs = [
|
||||
"apiserver.go",
|
||||
"awscloudcontrollermanager.go",
|
||||
"awsebscsidriver.go",
|
||||
"calico.go",
|
||||
"cilium.go",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
Copyright 2021 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package components
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"k8s.io/kops/pkg/apis/kops"
|
||||
"k8s.io/kops/upup/pkg/fi"
|
||||
"k8s.io/kops/upup/pkg/fi/loader"
|
||||
)
|
||||
|
||||
// KubeControllerManagerOptionsBuilder adds options for the kubernetes controller manager to the model.
|
||||
type AWSCloudControllerManagerOptionsBuilder struct {
|
||||
*OptionsContext
|
||||
}
|
||||
|
||||
var _ loader.OptionsBuilder = &AWSCloudControllerManagerOptionsBuilder{}
|
||||
|
||||
// BuildOptions generates the configurations used for the AWS cloud controller manager manifest
|
||||
func (b *AWSCloudControllerManagerOptionsBuilder) BuildOptions(o interface{}) error {
|
||||
|
||||
clusterSpec := o.(*kops.ClusterSpec)
|
||||
|
||||
eccm := clusterSpec.ExternalCloudControllerManager
|
||||
|
||||
if eccm == nil || kops.CloudProviderID(eccm.CloudProvider) != kops.CloudProviderAWS {
|
||||
return nil
|
||||
}
|
||||
|
||||
eccm.ClusterName = b.ClusterName
|
||||
|
||||
eccm.ClusterCIDR = clusterSpec.NonMasqueradeCIDR
|
||||
|
||||
eccm.AllocateNodeCIDRs = fi.Bool(true)
|
||||
eccm.ConfigureCloudRoutes = fi.Bool(false)
|
||||
|
||||
// TODO: we want to consolidate this with the logic from KCM
|
||||
networking := clusterSpec.Networking
|
||||
if networking == nil {
|
||||
eccm.ConfigureCloudRoutes = fi.Bool(true)
|
||||
} else if networking.Kubenet != nil {
|
||||
eccm.ConfigureCloudRoutes = fi.Bool(true)
|
||||
} else if networking.GCE != nil {
|
||||
eccm.ConfigureCloudRoutes = fi.Bool(false)
|
||||
eccm.CIDRAllocatorType = fi.String("CloudAllocator")
|
||||
|
||||
if eccm.ClusterCIDR == "" {
|
||||
eccm.ClusterCIDR = clusterSpec.PodCIDR
|
||||
}
|
||||
} else if networking.External != nil {
|
||||
eccm.ConfigureCloudRoutes = fi.Bool(false)
|
||||
} else if UsesCNI(networking) {
|
||||
eccm.ConfigureCloudRoutes = fi.Bool(false)
|
||||
} else if networking.Kopeio != nil {
|
||||
// Kopeio is based on kubenet / external
|
||||
eccm.ConfigureCloudRoutes = fi.Bool(false)
|
||||
} else {
|
||||
return fmt.Errorf("no networking mode set")
|
||||
}
|
||||
|
||||
eccm.Master = "https://127.0.0.1"
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -281,6 +281,7 @@ func (c *populateClusterSpec) run(clientset simple.Clientset) error {
|
|||
codeModels = append(codeModels, &components.ClusterAutoscalerOptionsBuilder{OptionsContext: optionsContext})
|
||||
codeModels = append(codeModels, &components.NodeTerminationHandlerOptionsBuilder{OptionsContext: optionsContext})
|
||||
codeModels = append(codeModels, &components.AWSEBSCSIDriverOptionsBuilder{OptionsContext: optionsContext})
|
||||
codeModels = append(codeModels, &components.AWSCloudControllerManagerOptionsBuilder{OptionsContext: optionsContext})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,13 @@ spec:
|
|||
spec:
|
||||
containers:
|
||||
- args:
|
||||
- --master=https://127.0.0.1
|
||||
- --v=2
|
||||
- --cloud-provider=aws
|
||||
- --cluster-name=minimal.example.com
|
||||
- --cluster-cidr=100.64.0.0/10
|
||||
- --allocate-node-cidrs=true
|
||||
- --configure-cloud-routes=false
|
||||
- --use-service-account-credentials=true
|
||||
image: gcr.io/k8s-staging-provider-aws/cloud-controller-manager:latest
|
||||
name: aws-cloud-controller-manager
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ spec:
|
|||
- id: k8s-1.18
|
||||
kubernetesVersion: '>=1.18.0'
|
||||
manifest: aws-cloud-controller.addons.k8s.io/k8s-1.18.yaml
|
||||
manifestHash: c0a92fc15661776506a8861a5600315b930a599b
|
||||
manifestHash: d1234040768f371ebb4a4e27cac699e215afb173
|
||||
name: aws-cloud-controller.addons.k8s.io
|
||||
selector:
|
||||
k8s-addon: aws-cloud-controller.addons.k8s.io
|
||||
|
|
|
|||
Loading…
Reference in New Issue