Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion k8s/crds/kops.k8s.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/kops/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/kops/v1alpha2/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
29 changes: 0 additions & 29 deletions pkg/apis/kops/validation/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}

Expand All @@ -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)...)
Expand Down
15 changes: 1 addition & 14 deletions pkg/apis/kops/validation/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 1 addition & 3 deletions upup/pkg/fi/cloudup/new_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
4 changes: 1 addition & 3 deletions upup/pkg/fi/cloudup/new_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{},
},
},
},
Expand Down