mirror of https://github.com/kubernetes/kops.git
Merge pull request #14669 from johngmyers/cp-kubelet
v1alpha3: use new terminology for kubelet config
This commit is contained in:
commit
0b24fc108a
|
@ -132,7 +132,7 @@ func (b *KubeletBuilder) Build(c *fi.ModelBuilderContext) error {
|
|||
if b.HasAPIServer || !b.UseBootstrapTokens() {
|
||||
var kubeconfig fi.Resource
|
||||
if b.HasAPIServer {
|
||||
kubeconfig, err = b.buildMasterKubeletKubeconfig(c)
|
||||
kubeconfig, err = b.buildControlPlaneKubeletKubeconfig(c)
|
||||
} else {
|
||||
kubeconfig, err = b.BuildBootstrapKubeconfig("kubelet", c)
|
||||
}
|
||||
|
@ -608,8 +608,8 @@ func (b *KubeletBuilder) buildKubeletConfigSpec() (*kops.KubeletConfigSpec, erro
|
|||
return &c, nil
|
||||
}
|
||||
|
||||
// buildMasterKubeletKubeconfig builds a kubeconfig for the master kubelet, self-signing the kubelet cert
|
||||
func (b *KubeletBuilder) buildMasterKubeletKubeconfig(c *fi.ModelBuilderContext) (fi.Resource, error) {
|
||||
// buildControlPlaneKubeletKubeconfig builds a kubeconfig for the master kubelet, self-signing the kubelet cert
|
||||
func (b *KubeletBuilder) buildControlPlaneKubeletKubeconfig(c *fi.ModelBuilderContext) (fi.Resource, error) {
|
||||
nodeName, err := b.NodeName()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error getting NodeName: %v", err)
|
||||
|
|
|
@ -150,12 +150,12 @@ type ClusterSpec struct {
|
|||
// Kubelet is the kubelet configuration for nodes not belonging to the control plane.
|
||||
// It can be overridden by the kubelet configuration specified in the instance group.
|
||||
Kubelet *KubeletConfigSpec `json:"kubelet,omitempty"`
|
||||
// MasterKubelet is the kubelet configuration for nodes belonging to the control plane
|
||||
// ControlPlaneKubelet is the kubelet configuration for nodes belonging to the control plane
|
||||
// It can be overridden by the kubelet configuration specified in the instance group.
|
||||
MasterKubelet *KubeletConfigSpec `json:"masterKubelet,omitempty"`
|
||||
CloudConfig *CloudConfiguration `json:"cloudConfig,omitempty"`
|
||||
ExternalDNS *ExternalDNSConfig `json:"externalDNS,omitempty"`
|
||||
NTP *NTPConfig `json:"ntp,omitempty"`
|
||||
ControlPlaneKubelet *KubeletConfigSpec `json:"controlPlaneKubelet,omitempty"`
|
||||
CloudConfig *CloudConfiguration `json:"cloudConfig,omitempty"`
|
||||
ExternalDNS *ExternalDNSConfig `json:"externalDNS,omitempty"`
|
||||
NTP *NTPConfig `json:"ntp,omitempty"`
|
||||
|
||||
// NodeTerminationHandler determines the node termination handler configuration.
|
||||
NodeTerminationHandler *NodeTerminationHandlerConfig `json:"nodeTerminationHandler,omitempty"`
|
||||
|
|
|
@ -166,10 +166,10 @@ type ClusterSpec struct {
|
|||
Kubelet *KubeletConfigSpec `json:"kubelet,omitempty"`
|
||||
// MasterKubelet is the kubelet configuration for nodes belonging to the control plane
|
||||
// It can be overridden by the kubelet configuration specified in the instance group.
|
||||
MasterKubelet *KubeletConfigSpec `json:"masterKubelet,omitempty"`
|
||||
CloudConfig *CloudConfiguration `json:"cloudConfig,omitempty"`
|
||||
ExternalDNS *ExternalDNSConfig `json:"externalDns,omitempty"`
|
||||
NTP *NTPConfig `json:"ntp,omitempty"`
|
||||
ControlPlaneKubelet *KubeletConfigSpec `json:"masterKubelet,omitempty"`
|
||||
CloudConfig *CloudConfiguration `json:"cloudConfig,omitempty"`
|
||||
ExternalDNS *ExternalDNSConfig `json:"externalDns,omitempty"`
|
||||
NTP *NTPConfig `json:"ntp,omitempty"`
|
||||
|
||||
// NodeTerminationHandler determines the cluster autoscaler configuration.
|
||||
NodeTerminationHandler *NodeTerminationHandlerConfig `json:"nodeTerminationHandler,omitempty"`
|
||||
|
|
|
@ -2603,14 +2603,14 @@ func autoConvert_v1alpha2_ClusterSpec_To_kops_ClusterSpec(in *ClusterSpec, out *
|
|||
} else {
|
||||
out.Kubelet = nil
|
||||
}
|
||||
if in.MasterKubelet != nil {
|
||||
in, out := &in.MasterKubelet, &out.MasterKubelet
|
||||
if in.ControlPlaneKubelet != nil {
|
||||
in, out := &in.ControlPlaneKubelet, &out.ControlPlaneKubelet
|
||||
*out = new(kops.KubeletConfigSpec)
|
||||
if err := Convert_v1alpha2_KubeletConfigSpec_To_kops_KubeletConfigSpec(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.MasterKubelet = nil
|
||||
out.ControlPlaneKubelet = nil
|
||||
}
|
||||
if in.CloudConfig != nil {
|
||||
in, out := &in.CloudConfig, &out.CloudConfig
|
||||
|
@ -3018,14 +3018,14 @@ func autoConvert_kops_ClusterSpec_To_v1alpha2_ClusterSpec(in *kops.ClusterSpec,
|
|||
} else {
|
||||
out.Kubelet = nil
|
||||
}
|
||||
if in.MasterKubelet != nil {
|
||||
in, out := &in.MasterKubelet, &out.MasterKubelet
|
||||
if in.ControlPlaneKubelet != nil {
|
||||
in, out := &in.ControlPlaneKubelet, &out.ControlPlaneKubelet
|
||||
*out = new(KubeletConfigSpec)
|
||||
if err := Convert_kops_KubeletConfigSpec_To_v1alpha2_KubeletConfigSpec(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.MasterKubelet = nil
|
||||
out.ControlPlaneKubelet = nil
|
||||
}
|
||||
if in.CloudConfig != nil {
|
||||
in, out := &in.CloudConfig, &out.CloudConfig
|
||||
|
|
|
@ -1211,8 +1211,8 @@ func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) {
|
|||
*out = new(KubeletConfigSpec)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.MasterKubelet != nil {
|
||||
in, out := &in.MasterKubelet, &out.MasterKubelet
|
||||
if in.ControlPlaneKubelet != nil {
|
||||
in, out := &in.ControlPlaneKubelet, &out.ControlPlaneKubelet
|
||||
*out = new(KubeletConfigSpec)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
|
|
|
@ -147,12 +147,12 @@ type ClusterSpec struct {
|
|||
// Kubelet is the kubelet configuration for nodes not belonging to the control plane.
|
||||
// It can be overridden by the kubelet configuration specified in the instance group.
|
||||
Kubelet *KubeletConfigSpec `json:"kubelet,omitempty"`
|
||||
// MasterKubelet is the kubelet configuration for nodes belonging to the control plane
|
||||
// ControlPlaneKubelet is the kubelet configuration for nodes belonging to the control plane
|
||||
// It can be overridden by the kubelet configuration specified in the instance group.
|
||||
MasterKubelet *KubeletConfigSpec `json:"masterKubelet,omitempty"`
|
||||
CloudConfig *CloudConfiguration `json:"cloudConfig,omitempty"`
|
||||
ExternalDNS *ExternalDNSConfig `json:"externalDNS,omitempty"`
|
||||
NTP *NTPConfig `json:"ntp,omitempty"`
|
||||
ControlPlaneKubelet *KubeletConfigSpec `json:"controlPlaneKubelet,omitempty"`
|
||||
CloudConfig *CloudConfiguration `json:"cloudConfig,omitempty"`
|
||||
ExternalDNS *ExternalDNSConfig `json:"externalDNS,omitempty"`
|
||||
NTP *NTPConfig `json:"ntp,omitempty"`
|
||||
|
||||
// NodeTerminationHandler determines the cluster autoscaler configuration.
|
||||
NodeTerminationHandler *NodeTerminationHandlerConfig `json:"nodeTerminationHandler,omitempty"`
|
||||
|
|
|
@ -2708,14 +2708,14 @@ func autoConvert_v1alpha3_ClusterSpec_To_kops_ClusterSpec(in *ClusterSpec, out *
|
|||
} else {
|
||||
out.Kubelet = nil
|
||||
}
|
||||
if in.MasterKubelet != nil {
|
||||
in, out := &in.MasterKubelet, &out.MasterKubelet
|
||||
if in.ControlPlaneKubelet != nil {
|
||||
in, out := &in.ControlPlaneKubelet, &out.ControlPlaneKubelet
|
||||
*out = new(kops.KubeletConfigSpec)
|
||||
if err := Convert_v1alpha3_KubeletConfigSpec_To_kops_KubeletConfigSpec(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.MasterKubelet = nil
|
||||
out.ControlPlaneKubelet = nil
|
||||
}
|
||||
if in.CloudConfig != nil {
|
||||
in, out := &in.CloudConfig, &out.CloudConfig
|
||||
|
@ -3121,14 +3121,14 @@ func autoConvert_kops_ClusterSpec_To_v1alpha3_ClusterSpec(in *kops.ClusterSpec,
|
|||
} else {
|
||||
out.Kubelet = nil
|
||||
}
|
||||
if in.MasterKubelet != nil {
|
||||
in, out := &in.MasterKubelet, &out.MasterKubelet
|
||||
if in.ControlPlaneKubelet != nil {
|
||||
in, out := &in.ControlPlaneKubelet, &out.ControlPlaneKubelet
|
||||
*out = new(KubeletConfigSpec)
|
||||
if err := Convert_kops_KubeletConfigSpec_To_v1alpha3_KubeletConfigSpec(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.MasterKubelet = nil
|
||||
out.ControlPlaneKubelet = nil
|
||||
}
|
||||
if in.CloudConfig != nil {
|
||||
in, out := &in.CloudConfig, &out.CloudConfig
|
||||
|
|
|
@ -1159,8 +1159,8 @@ func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) {
|
|||
*out = new(KubeletConfigSpec)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.MasterKubelet != nil {
|
||||
in, out := &in.MasterKubelet, &out.MasterKubelet
|
||||
if in.ControlPlaneKubelet != nil {
|
||||
in, out := &in.ControlPlaneKubelet, &out.ControlPlaneKubelet
|
||||
*out = new(KubeletConfigSpec)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
|
|
|
@ -118,8 +118,8 @@ func ValidateCluster(c *kops.Cluster, strict bool) field.ErrorList {
|
|||
if strict && c.Spec.Kubelet == nil {
|
||||
allErrs = append(allErrs, field.Required(fieldSpec.Child("kubelet"), "kubelet not configured"))
|
||||
}
|
||||
if strict && c.Spec.MasterKubelet == nil {
|
||||
allErrs = append(allErrs, field.Required(fieldSpec.Child("masterKubelet"), "masterKubelet not configured"))
|
||||
if strict && c.Spec.ControlPlaneKubelet == nil {
|
||||
allErrs = append(allErrs, field.Required(fieldSpec.Child("controlPlaneKubelet"), "controlPlaneKubelet not configured"))
|
||||
}
|
||||
if strict && c.Spec.KubeControllerManager == nil {
|
||||
allErrs = append(allErrs, field.Required(fieldSpec.Child("kubeControllerManager"), "kubeControllerManager not configured"))
|
||||
|
@ -215,9 +215,9 @@ func ValidateCluster(c *kops.Cluster, strict bool) field.ErrorList {
|
|||
allErrs = append(allErrs, field.Forbidden(fieldSpec.Child("kubelet", "nonMasqueradeCIDR"), "kubelet nonMasqueradeCIDR did not match cluster nonMasqueradeCIDR"))
|
||||
}
|
||||
}
|
||||
if fi.ValueOf(c.Spec.MasterKubelet.NonMasqueradeCIDR) != nonMasqueradeCIDRString {
|
||||
if strict || c.Spec.MasterKubelet.NonMasqueradeCIDR != nil {
|
||||
allErrs = append(allErrs, field.Forbidden(fieldSpec.Child("masterKubelet", "nonMasqueradeCIDR"), "masterKubelet nonMasqueradeCIDR did not match cluster nonMasqueradeCIDR"))
|
||||
if fi.ValueOf(c.Spec.ControlPlaneKubelet.NonMasqueradeCIDR) != nonMasqueradeCIDRString {
|
||||
if strict || c.Spec.ControlPlaneKubelet.NonMasqueradeCIDR != nil {
|
||||
allErrs = append(allErrs, field.Forbidden(fieldSpec.Child("controlPlaneKubelet", "nonMasqueradeCIDR"), "controlPlaneKubelet nonMasqueradeCIDR did not match cluster nonMasqueradeCIDR"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -280,8 +280,8 @@ func ValidateCluster(c *kops.Cluster, strict bool) field.ErrorList {
|
|||
if isExperimentalClusterDNS(c.Spec.Kubelet, c.Spec.KubeDNS) {
|
||||
allErrs = append(allErrs, field.Forbidden(fieldSpec.Child("kubelet", "clusterDNS"), "Kubelet ClusterDNS did not match cluster kubeDNS.serverIP or nodeLocalDNS.localIP"))
|
||||
}
|
||||
if isExperimentalClusterDNS(c.Spec.MasterKubelet, c.Spec.KubeDNS) {
|
||||
allErrs = append(allErrs, field.Forbidden(fieldSpec.Child("masterKubelet", "clusterDNS"), "MasterKubelet ClusterDNS did not match cluster kubeDNS.serverIP or nodeLocalDNS.localIP"))
|
||||
if isExperimentalClusterDNS(c.Spec.ControlPlaneKubelet, c.Spec.KubeDNS) {
|
||||
allErrs = append(allErrs, field.Forbidden(fieldSpec.Child("controlPlaneKubelet", "clusterDNS"), "ControlPlaneKubelet ClusterDNS did not match cluster kubeDNS.serverIP or nodeLocalDNS.localIP"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -344,9 +344,9 @@ func ValidateCluster(c *kops.Cluster, strict bool) field.ErrorList {
|
|||
allErrs = append(allErrs, field.Forbidden(fieldSpec.Child("kubelet", "cloudProvider"), "Did not match cluster cloudProvider"))
|
||||
}
|
||||
}
|
||||
if c.Spec.MasterKubelet != nil && (strict || c.Spec.MasterKubelet.CloudProvider != "") {
|
||||
if c.Spec.MasterKubelet.CloudProvider != "external" && k8sCloudProvider != c.Spec.MasterKubelet.CloudProvider {
|
||||
allErrs = append(allErrs, field.Forbidden(fieldSpec.Child("masterKubelet", "cloudProvider"), "Did not match cluster cloudProvider"))
|
||||
if c.Spec.ControlPlaneKubelet != nil && (strict || c.Spec.ControlPlaneKubelet.CloudProvider != "") {
|
||||
if c.Spec.ControlPlaneKubelet.CloudProvider != "external" && k8sCloudProvider != c.Spec.ControlPlaneKubelet.CloudProvider {
|
||||
allErrs = append(allErrs, field.Forbidden(fieldSpec.Child("controlPlaneKubelet", "cloudProvider"), "Did not match cluster cloudProvider"))
|
||||
}
|
||||
}
|
||||
if c.Spec.KubeAPIServer != nil && (strict || c.Spec.KubeAPIServer.CloudProvider != "") {
|
||||
|
|
|
@ -154,8 +154,8 @@ func validateClusterSpec(spec *kops.ClusterSpec, c *kops.Cluster, fieldPath *fie
|
|||
allErrs = append(allErrs, validateKubelet(spec.Kubelet, c, fieldPath.Child("kubelet"))...)
|
||||
}
|
||||
|
||||
if spec.MasterKubelet != nil {
|
||||
allErrs = append(allErrs, validateKubelet(spec.MasterKubelet, c, fieldPath.Child("masterKubelet"))...)
|
||||
if spec.ControlPlaneKubelet != nil {
|
||||
allErrs = append(allErrs, validateKubelet(spec.ControlPlaneKubelet, c, fieldPath.Child("controlPlaneKubelet"))...)
|
||||
}
|
||||
|
||||
if spec.Networking != nil {
|
||||
|
@ -1598,8 +1598,8 @@ func validateNodeLocalDNS(spec *kops.ClusterSpec, fldpath *field.Path) field.Err
|
|||
allErrs = append(allErrs, field.Forbidden(fldpath.Child("kubelet", "clusterDNS"), "Kubelet ClusterDNS must be set to the default IP address for LocalIP"))
|
||||
}
|
||||
|
||||
if spec.MasterKubelet != nil && spec.MasterKubelet.ClusterDNS != "" && spec.MasterKubelet.ClusterDNS != spec.KubeDNS.NodeLocalDNS.LocalIP {
|
||||
allErrs = append(allErrs, field.Forbidden(fldpath.Child("kubelet", "clusterDNS"), "MasterKubelet ClusterDNS must be set to the default IP address for LocalIP"))
|
||||
if spec.ControlPlaneKubelet != nil && spec.ControlPlaneKubelet.ClusterDNS != "" && spec.ControlPlaneKubelet.ClusterDNS != spec.KubeDNS.NodeLocalDNS.LocalIP {
|
||||
allErrs = append(allErrs, field.Forbidden(fldpath.Child("kubelet", "clusterDNS"), "ControlPlaneKubelet ClusterDNS must be set to the default IP address for LocalIP"))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1256,8 +1256,8 @@ func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) {
|
|||
*out = new(KubeletConfigSpec)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.MasterKubelet != nil {
|
||||
in, out := &in.MasterKubelet, &out.MasterKubelet
|
||||
if in.ControlPlaneKubelet != nil {
|
||||
in, out := &in.ControlPlaneKubelet, &out.ControlPlaneKubelet
|
||||
*out = new(KubeletConfigSpec)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
|
|
|
@ -396,7 +396,7 @@ func (b *BootstrapScript) Run(c *fi.Context) error {
|
|||
spec["kubeAPIServer"] = cs.KubeAPIServer
|
||||
spec["kubeControllerManager"] = cs.KubeControllerManager
|
||||
spec["kubeScheduler"] = cs.KubeScheduler
|
||||
spec["masterKubelet"] = cs.MasterKubelet
|
||||
spec["masterKubelet"] = cs.ControlPlaneKubelet
|
||||
|
||||
for _, etcdCluster := range cs.EtcdClusters {
|
||||
c := kops.EtcdClusterSpec{
|
||||
|
|
|
@ -278,7 +278,7 @@ func makeTestCluster(hookSpecRoles []kops.InstanceGroupRole, fileAssetSpecRoles
|
|||
Kubelet: &kops.KubeletConfigSpec{
|
||||
KubeconfigPath: "/etc/kubernetes/config.txt",
|
||||
},
|
||||
MasterKubelet: &kops.KubeletConfigSpec{
|
||||
ControlPlaneKubelet: &kops.KubeletConfigSpec{
|
||||
KubeconfigPath: "/etc/kubernetes/config.cfg",
|
||||
},
|
||||
EgressProxy: &kops.EgressProxySpec{
|
||||
|
|
|
@ -44,8 +44,8 @@ func (b *KubeletOptionsBuilder) BuildOptions(o interface{}) error {
|
|||
if clusterSpec.Kubelet == nil {
|
||||
clusterSpec.Kubelet = &kops.KubeletConfigSpec{}
|
||||
}
|
||||
if clusterSpec.MasterKubelet == nil {
|
||||
clusterSpec.MasterKubelet = &kops.KubeletConfigSpec{}
|
||||
if clusterSpec.ControlPlaneKubelet == nil {
|
||||
clusterSpec.ControlPlaneKubelet = &kops.KubeletConfigSpec{}
|
||||
}
|
||||
|
||||
if clusterSpec.KubeAPIServer != nil && clusterSpec.KubeAPIServer.EnableBootstrapAuthToken != nil {
|
||||
|
@ -86,11 +86,11 @@ func (b *KubeletOptionsBuilder) BuildOptions(o interface{}) error {
|
|||
}
|
||||
}
|
||||
|
||||
clusterSpec.MasterKubelet.RegisterSchedulable = fi.PtrTo(false)
|
||||
clusterSpec.ControlPlaneKubelet.RegisterSchedulable = fi.PtrTo(false)
|
||||
// Replace the CIDR with a CIDR allocated by KCM (the default, but included for clarity)
|
||||
// We _do_ allow debugging handlers, so we can do logs
|
||||
// This does allow more access than we would like though
|
||||
clusterSpec.MasterKubelet.EnableDebuggingHandlers = fi.PtrTo(true)
|
||||
clusterSpec.ControlPlaneKubelet.EnableDebuggingHandlers = fi.PtrTo(true)
|
||||
|
||||
{
|
||||
// For pod eviction in low memory or empty disk situations
|
||||
|
@ -113,13 +113,13 @@ func (b *KubeletOptionsBuilder) BuildOptions(o interface{}) error {
|
|||
// use kubeconfig instead of api-servers
|
||||
const kubeconfigPath = "/var/lib/kubelet/kubeconfig"
|
||||
clusterSpec.Kubelet.KubeconfigPath = kubeconfigPath
|
||||
clusterSpec.MasterKubelet.KubeconfigPath = kubeconfigPath
|
||||
clusterSpec.ControlPlaneKubelet.KubeconfigPath = kubeconfigPath
|
||||
|
||||
// IsolateMasters enables the legacy behaviour, where master pods on a separate network
|
||||
// In newer versions of kubernetes, most of that functionality has been removed though
|
||||
if fi.ValueOf(clusterSpec.IsolateMasters) {
|
||||
clusterSpec.MasterKubelet.EnableDebuggingHandlers = fi.PtrTo(false)
|
||||
clusterSpec.MasterKubelet.HairpinMode = "none"
|
||||
clusterSpec.ControlPlaneKubelet.EnableDebuggingHandlers = fi.PtrTo(false)
|
||||
clusterSpec.ControlPlaneKubelet.HairpinMode = "none"
|
||||
}
|
||||
|
||||
cloudProvider := clusterSpec.GetCloudProvider()
|
||||
|
@ -218,7 +218,7 @@ func (b *KubeletOptionsBuilder) BuildOptions(o interface{}) error {
|
|||
}
|
||||
|
||||
clusterSpec.Kubelet.RegisterSchedulable = fi.PtrTo(true)
|
||||
clusterSpec.MasterKubelet.RegisterSchedulable = fi.PtrTo(true)
|
||||
clusterSpec.ControlPlaneKubelet.RegisterSchedulable = fi.PtrTo(true)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ func BuildNodeLabels(cluster *kops.Cluster, instanceGroup *kops.InstanceGroup) m
|
|||
// Merge KubeletConfig for NodeLabels
|
||||
c := &kops.KubeletConfigSpec{}
|
||||
if isControlPlane {
|
||||
reflectutils.JSONMergeStruct(c, cluster.Spec.MasterKubelet)
|
||||
reflectutils.JSONMergeStruct(c, cluster.Spec.ControlPlaneKubelet)
|
||||
} else {
|
||||
reflectutils.JSONMergeStruct(c, cluster.Spec.Kubelet)
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ func TestBuildNodeLabels(t *testing.T) {
|
|||
cluster: &kops.Cluster{
|
||||
Spec: kops.ClusterSpec{
|
||||
KubernetesVersion: "v1.9.0",
|
||||
MasterKubelet: &kops.KubeletConfigSpec{
|
||||
ControlPlaneKubelet: &kops.KubeletConfigSpec{
|
||||
NodeLabels: map[string]string{
|
||||
"controlPlane1": "controlPlane1",
|
||||
"controlPlane2": "controlPlane2",
|
||||
|
@ -78,7 +78,7 @@ func TestBuildNodeLabels(t *testing.T) {
|
|||
cluster: &kops.Cluster{
|
||||
Spec: kops.ClusterSpec{
|
||||
KubernetesVersion: "v1.9.0",
|
||||
MasterKubelet: &kops.KubeletConfigSpec{
|
||||
ControlPlaneKubelet: &kops.KubeletConfigSpec{
|
||||
NodeLabels: map[string]string{
|
||||
"controlPlane1": "controlPlane1",
|
||||
"controlPlane2": "controlPlane2",
|
||||
|
|
|
@ -53,6 +53,8 @@ spec:
|
|||
kubernetesApiAccess:
|
||||
- 0.0.0.0/0
|
||||
kubernetesVersion: v1.21.0
|
||||
masterKubelet:
|
||||
cpuCFSQuota: true
|
||||
masterPublicName: api.minimal.example.com
|
||||
networkCIDR: 172.20.0.0/16
|
||||
networking:
|
||||
|
|
|
@ -25,6 +25,8 @@ spec:
|
|||
cloudProvider:
|
||||
aws: {}
|
||||
configBase: memfs://clusters.example.com/minimal.example.com
|
||||
controlPlaneKubelet:
|
||||
cpuCFSQuota: true
|
||||
etcdClusters:
|
||||
- cpuRequest: 200m
|
||||
etcdMembers:
|
||||
|
|
|
@ -253,11 +253,11 @@ func TestPopulateCluster_IsolateMasters(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("Unexpected error from PopulateCluster: %v", err)
|
||||
}
|
||||
if fi.ValueOf(full.Spec.MasterKubelet.EnableDebuggingHandlers) != false {
|
||||
t.Fatalf("Unexpected EnableDebuggingHandlers: %v", fi.ValueOf(full.Spec.MasterKubelet.EnableDebuggingHandlers))
|
||||
if fi.ValueOf(full.Spec.ControlPlaneKubelet.EnableDebuggingHandlers) != false {
|
||||
t.Fatalf("Unexpected EnableDebuggingHandlers: %v", fi.ValueOf(full.Spec.ControlPlaneKubelet.EnableDebuggingHandlers))
|
||||
}
|
||||
if fi.ValueOf(full.Spec.MasterKubelet.ReconcileCIDR) != false {
|
||||
t.Fatalf("Unexpected ReconcileCIDR: %v", fi.ValueOf(full.Spec.MasterKubelet.ReconcileCIDR))
|
||||
if fi.ValueOf(full.Spec.ControlPlaneKubelet.ReconcileCIDR) != false {
|
||||
t.Fatalf("Unexpected ReconcileCIDR: %v", fi.ValueOf(full.Spec.ControlPlaneKubelet.ReconcileCIDR))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -274,8 +274,8 @@ func TestPopulateCluster_IsolateMastersFalse(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("Unexpected error from PopulateCluster: %v", err)
|
||||
}
|
||||
if fi.ValueOf(full.Spec.MasterKubelet.EnableDebuggingHandlers) != true {
|
||||
t.Fatalf("Unexpected EnableDebuggingHandlers: %v", fi.ValueOf(full.Spec.MasterKubelet.EnableDebuggingHandlers))
|
||||
if fi.ValueOf(full.Spec.ControlPlaneKubelet.EnableDebuggingHandlers) != true {
|
||||
t.Fatalf("Unexpected EnableDebuggingHandlers: %v", fi.ValueOf(full.Spec.ControlPlaneKubelet.EnableDebuggingHandlers))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -234,12 +234,12 @@ func PopulateInstanceGroupSpec(cluster *kops.Cluster, input *kops.InstanceGroup,
|
|||
var igKubeletConfig *kops.KubeletConfigSpec
|
||||
// Start with the cluster kubelet config
|
||||
if ig.IsControlPlane() {
|
||||
if cluster.Spec.MasterKubelet != nil {
|
||||
igKubeletConfig = cluster.Spec.MasterKubelet.DeepCopy()
|
||||
if cluster.Spec.ControlPlaneKubelet != nil {
|
||||
igKubeletConfig = cluster.Spec.ControlPlaneKubelet.DeepCopy()
|
||||
} else {
|
||||
igKubeletConfig = &kops.KubeletConfigSpec{}
|
||||
}
|
||||
// A few settings in Kubelet override those in MasterKubelet. I'm not sure why.
|
||||
// A few settings in Kubelet override those in ControlPlaneKubelet. I'm not sure why.
|
||||
if cluster.Spec.Kubelet != nil && cluster.Spec.Kubelet.AnonymousAuth != nil && !*cluster.Spec.Kubelet.AnonymousAuth {
|
||||
igKubeletConfig.AnonymousAuth = fi.PtrTo(false)
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ func TestPopulateInstanceGroup_EvictionHard3(t *testing.T) {
|
|||
|
||||
func TestPopulateInstanceGroup_EvictionHard4(t *testing.T) {
|
||||
_, cluster := buildMinimalCluster()
|
||||
cluster.Spec.MasterKubelet = &kopsapi.KubeletConfigSpec{
|
||||
cluster.Spec.ControlPlaneKubelet = &kopsapi.KubeletConfigSpec{
|
||||
EvictionHard: fi.PtrTo("memory.available<350Mi"),
|
||||
}
|
||||
input := buildMinimalMasterInstanceGroup("us-test-1")
|
||||
|
|
|
@ -36,11 +36,11 @@ func (l *SpecBuilder) BuildCompleteSpec(clusterSpec *kopsapi.ClusterSpec) (*kops
|
|||
completed := &kopsapi.ClusterSpec{}
|
||||
*completed = *(loaded.(*kopsapi.ClusterSpec))
|
||||
|
||||
// Master kubelet config = (base kubelet config + master kubelet config)
|
||||
masterKubelet := &kopsapi.KubeletConfigSpec{}
|
||||
reflectutils.JSONMergeStruct(masterKubelet, completed.Kubelet)
|
||||
reflectutils.JSONMergeStruct(masterKubelet, completed.MasterKubelet)
|
||||
completed.MasterKubelet = masterKubelet
|
||||
// Control-plane kubelet config = (base kubelet config + control-plane kubelet config)
|
||||
controlPlaneKubelet := &kopsapi.KubeletConfigSpec{}
|
||||
reflectutils.JSONMergeStruct(controlPlaneKubelet, completed.Kubelet)
|
||||
reflectutils.JSONMergeStruct(controlPlaneKubelet, completed.ControlPlaneKubelet)
|
||||
completed.ControlPlaneKubelet = controlPlaneKubelet
|
||||
|
||||
klog.V(1).Infof("options: %s", fi.DebugAsJsonStringIndent(completed))
|
||||
return completed, nil
|
||||
|
|
Loading…
Reference in New Issue