Skip to content

Commit

Permalink
Remove as much of the classic networking logic as we can
Browse files Browse the repository at this point in the history
  • Loading branch information
Ole Markus With committed May 21, 2020
1 parent b39b388 commit 454c6a6
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 46 deletions.
22 changes: 0 additions & 22 deletions cmd/kops/upgrade_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,28 +168,6 @@ func (c *UpgradeClusterCmd) Run(ctx context.Context, args []string) error {
proposedKubernetesVersion = currentKubernetesVersion
}

// Prompt to upgrade addins?

// Prompt to upgrade to kubenet
if channelClusterSpec.Networking != nil {
if cluster.Spec.Networking == nil {
cluster.Spec.Networking = &kopsapi.NetworkingSpec{}
}
// TODO: make this less hard coded
if channelClusterSpec.Networking.Kubenet != nil && channelClusterSpec.Networking.Classic != nil {
actions = append(actions, &upgradeAction{
Item: "Cluster",
Property: "Networking",
Old: "classic",
New: "kubenet",
apply: func() {
cluster.Spec.Networking.Classic = nil
cluster.Spec.Networking.Kubenet = channelClusterSpec.Networking.Kubenet
},
})
}
}

cloud, err := cloudup.BuildCloud(cluster)
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions nodeup/pkg/model/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ go_library(
"//pkg/k8scodecs:go_default_library",
"//pkg/kubeconfig:go_default_library",
"//pkg/kubemanifest:go_default_library",
"//pkg/model/components:go_default_library",
"//pkg/nodelabels:go_default_library",
"//pkg/pki:go_default_library",
"//pkg/rbac:go_default_library",
Expand Down
4 changes: 1 addition & 3 deletions pkg/apis/kops/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,9 +605,7 @@ func (c *Cluster) FillDefaults() error {

// fillClusterSpecNetworking provides default value if c.Spec.NetworkingSpec is nil
func (c *Cluster) fillClusterSpecNetworkingSpec() {
if c.Spec.Networking.Classic != nil {
// OK
} else if c.Spec.Networking.Kubenet != nil {
if c.Spec.Networking.Kubenet != nil {
// OK
} else if c.Spec.Networking.CNI != nil {
// OK
Expand Down
7 changes: 0 additions & 7 deletions pkg/model/components/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package components

import (
"k8s.io/klog"
"k8s.io/kops/pkg/apis/kops"
"k8s.io/kops/upup/pkg/fi"
"k8s.io/kops/upup/pkg/fi/loader"
Expand Down Expand Up @@ -86,11 +85,5 @@ func (b *DockerOptionsBuilder) BuildOptions(o interface{}) error {
docker.Storage = fi.String("overlay,aufs")
}

networking := clusterSpec.Networking
if networking == nil || networking.Classic != nil {
klog.Warningf("using deprecated (classic) networking")
docker.Bridge = fi.String("cbr0")
}

return nil
}
6 changes: 2 additions & 4 deletions pkg/model/components/kubecontrollermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import (
"fmt"
"time"

"k8s.io/kops/pkg/model/components"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/klog"
"k8s.io/kops/pkg/apis/kops"
Expand Down Expand Up @@ -129,7 +127,7 @@ func (b *KubeControllerManagerOptionsBuilder) BuildOptions(o interface{}) error
kcm.ConfigureCloudRoutes = fi.Bool(false)

networking := clusterSpec.Networking
if networking == nil || networking.Classic != nil {
if networking == nil {
kcm.ConfigureCloudRoutes = fi.Bool(true)
} else if networking.Kubenet != nil {
kcm.ConfigureCloudRoutes = fi.Bool(true)
Expand All @@ -142,7 +140,7 @@ func (b *KubeControllerManagerOptionsBuilder) BuildOptions(o interface{}) error
}
} else if networking.External != nil {
kcm.ConfigureCloudRoutes = fi.Bool(false)
} else if components.UsesCNI(networking) {
} else if UsesCNI(networking) {
kcm.ConfigureCloudRoutes = fi.Bool(false)
} else if networking.Kopeio != nil {
// Kopeio is based on kubenet / external
Expand Down
10 changes: 0 additions & 10 deletions upup/pkg/fi/cloudup/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,6 @@ func TestValidateFull_UpdatePolicy_Invalid(t *testing.T) {
expectErrorFromValidate(t, c, "spec.updatePolicy")
}

func Test_Validate_No_Classic_With_14(t *testing.T) {
c := buildDefaultCluster(t)
c.Spec.KubernetesVersion = "1.4.1"
c.Spec.Networking = &api.NetworkingSpec{
Classic: &api.ClassicNetworkingSpec{},
}

expectErrorFromValidate(t, c, "spec.networking")
}

func Test_Validate_Kubenet_With_14(t *testing.T) {
c := buildDefaultCluster(t)
c.Spec.KubernetesVersion = "1.4.1"
Expand Down

0 comments on commit 454c6a6

Please sign in to comment.