mirror of https://github.com/kubernetes/kops.git
Merge pull request #10143 from hakman/deprecate-calico-mv
Deprecate field calico.majorVersion
This commit is contained in:
commit
999ae25932
|
|
@ -2182,7 +2182,7 @@ spec:
|
|||
description: 'LogSeverityScreen lets us set the desired log level. (Default: info)'
|
||||
type: string
|
||||
majorVersion:
|
||||
description: MajorVersion is the version of Calico to use
|
||||
description: MajorVersion is deprecated as of kOps 1.20 and has no effect
|
||||
type: string
|
||||
mtu:
|
||||
description: MTU to be set in the cni-network-config for calico.
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ type CalicoNetworkingSpec struct {
|
|||
PrometheusGoMetricsEnabled bool `json:"prometheusGoMetricsEnabled,omitempty"`
|
||||
// PrometheusProcessMetricsEnabled enables Prometheus process metrics collection
|
||||
PrometheusProcessMetricsEnabled bool `json:"prometheusProcessMetricsEnabled,omitempty"`
|
||||
// MajorVersion is the version of Calico to use
|
||||
// MajorVersion is deprecated as of kOps 1.20 and has no effect
|
||||
MajorVersion string `json:"majorVersion,omitempty"`
|
||||
// IPv4AutoDetectionMethod configures how Calico chooses the IP address used to route
|
||||
// between nodes. This should be set when the host has multiple interfaces
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ type CalicoNetworkingSpec struct {
|
|||
PrometheusGoMetricsEnabled bool `json:"prometheusGoMetricsEnabled,omitempty"`
|
||||
// PrometheusProcessMetricsEnabled enables Prometheus process metrics collection
|
||||
PrometheusProcessMetricsEnabled bool `json:"prometheusProcessMetricsEnabled,omitempty"`
|
||||
// MajorVersion is the version of Calico to use
|
||||
// MajorVersion is deprecated as of kOps 1.20 and has no effect
|
||||
MajorVersion string `json:"majorVersion,omitempty"`
|
||||
// IptablesBackend controls which variant of iptables binary Felix uses
|
||||
// Default: Auto (other options: Legacy, NFT)
|
||||
|
|
|
|||
|
|
@ -924,27 +924,6 @@ func validateEtcdMemberSpec(spec kops.EtcdMemberSpec, fieldPath *field.Path) fie
|
|||
return allErrs
|
||||
}
|
||||
|
||||
func ValidateEtcdVersionForCalicoV3(e kops.EtcdClusterSpec, majorVersion string, fldPath *field.Path) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
|
||||
if e.Version == "" {
|
||||
if majorVersion == "v3" {
|
||||
return allErrs
|
||||
} else {
|
||||
allErrs = append(allErrs, field.Required(fldPath.Child("majorVersion"), "majorVersion required when etcd version is not set explicitly"))
|
||||
}
|
||||
} else {
|
||||
sem, err := semver.Parse(strings.TrimPrefix(e.Version, "v"))
|
||||
if err != nil {
|
||||
allErrs = append(allErrs, field.InternalError(fldPath.Child("majorVersion"), fmt.Errorf("failed to parse etcd version to check compatibility: %s", err)))
|
||||
}
|
||||
if majorVersion == "v3" && sem.Major != 3 {
|
||||
allErrs = append(allErrs, field.Forbidden(fldPath.Child("majorVersion"), fmt.Sprintf("unable to use v3 when etcd version for %s cluster is %s", e.Name, e.Version)))
|
||||
}
|
||||
}
|
||||
return allErrs
|
||||
}
|
||||
|
||||
func validateNetworkingCalico(v *kops.CalicoNetworkingSpec, e kops.EtcdClusterSpec, fldPath *field.Path) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
|
||||
|
|
@ -954,14 +933,6 @@ func validateNetworkingCalico(v *kops.CalicoNetworkingSpec, e kops.EtcdClusterSp
|
|||
fmt.Sprintf("Unable to set number of Typha replicas to less than 0, you've specified %d", v.TyphaReplicas)))
|
||||
}
|
||||
|
||||
if v.MajorVersion != "" {
|
||||
valid := []string{"v3"}
|
||||
allErrs = append(allErrs, IsValidValue(fldPath.Child("majorVersion"), &v.MajorVersion, valid)...)
|
||||
if v.MajorVersion == "v3" {
|
||||
allErrs = append(allErrs, ValidateEtcdVersionForCalicoV3(e, v.MajorVersion, fldPath)...)
|
||||
}
|
||||
}
|
||||
|
||||
if v.AwsSrcDstCheck != "" {
|
||||
valid := []string{"Enable", "Disable", "DoNothing"}
|
||||
allErrs = append(allErrs, IsValidValue(fldPath.Child("awsSrcDstCheck"), &v.AwsSrcDstCheck, valid)...)
|
||||
|
|
|
|||
|
|
@ -395,25 +395,12 @@ func Test_Validate_Calico(t *testing.T) {
|
|||
},
|
||||
{
|
||||
Input: caliInput{
|
||||
Calico: &kops.CalicoNetworkingSpec{
|
||||
MajorVersion: "v3",
|
||||
},
|
||||
Calico: &kops.CalicoNetworkingSpec{},
|
||||
Etcd: kops.EtcdClusterSpec{
|
||||
Version: "3.2.18",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Input: caliInput{
|
||||
Calico: &kops.CalicoNetworkingSpec{
|
||||
MajorVersion: "v3",
|
||||
},
|
||||
Etcd: kops.EtcdClusterSpec{
|
||||
Version: "2.2.18",
|
||||
},
|
||||
},
|
||||
ExpectedErrors: []string{"Forbidden::calico.majorVersion"},
|
||||
},
|
||||
{
|
||||
Input: caliInput{
|
||||
Calico: &kops.CalicoNetworkingSpec{
|
||||
|
|
|
|||
|
|
@ -42,8 +42,7 @@ spec:
|
|||
kubernetesVersion: v1.19.6
|
||||
masterPublicName: api.private.example.com
|
||||
networking:
|
||||
calico:
|
||||
majorVersion: v3
|
||||
calico: {}
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
project: testproject
|
||||
sshAccess:
|
||||
|
|
|
|||
|
|
@ -766,9 +766,7 @@ func setupNetworking(opt *NewClusterOptions, cluster *api.Cluster) error {
|
|||
Backend: "udp",
|
||||
}
|
||||
case "calico":
|
||||
cluster.Spec.Networking.Calico = &api.CalicoNetworkingSpec{
|
||||
MajorVersion: "v3",
|
||||
}
|
||||
cluster.Spec.Networking.Calico = &api.CalicoNetworkingSpec{}
|
||||
case "canal":
|
||||
cluster.Spec.Networking.Canal = &api.CanalNetworkingSpec{}
|
||||
case "kube-router":
|
||||
|
|
|
|||
|
|
@ -206,9 +206,7 @@ func TestSetupNetworking(t *testing.T) {
|
|||
expected: api.Cluster{
|
||||
Spec: api.ClusterSpec{
|
||||
Networking: &api.NetworkingSpec{
|
||||
Calico: &api.CalicoNetworkingSpec{
|
||||
MajorVersion: "v3",
|
||||
},
|
||||
Calico: &api.CalicoNetworkingSpec{},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue