Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated cherry pick of #14893: Don't expose v1alpha3 API #15873

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
4 changes: 1 addition & 3 deletions pkg/apis/kops/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ import (
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/kops/pkg/apis/kops"
"k8s.io/kops/pkg/apis/kops/v1alpha2"
"k8s.io/kops/pkg/apis/kops/v1alpha3"
)

func Install(scheme *runtime.Scheme) {
utilruntime.Must(kops.AddToScheme(scheme))
utilruntime.Must(v1alpha2.AddToScheme(scheme))
utilruntime.Must(v1alpha3.AddToScheme(scheme))
utilruntime.Must(scheme.SetVersionPriority(v1alpha2.SchemeGroupVersion, v1alpha3.SchemeGroupVersion))
utilruntime.Must(scheme.SetVersionPriority(v1alpha2.SchemeGroupVersion))
}
16 changes: 6 additions & 10 deletions tests/codecs/componentconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,28 @@ package codecs
import (
"testing"

"k8s.io/kops/pkg/apis/kops/v1alpha3"
"k8s.io/kops/pkg/apis/kops/v1alpha2"
"k8s.io/kops/pkg/diff"
"k8s.io/kops/pkg/kopscodecs"
)

func TestSerializeEmptyCluster(t *testing.T) {
cluster := &v1alpha3.Cluster{}
cluster.Spec.Kubelet = &v1alpha3.KubeletConfigSpec{}
cluster.Spec.KubeControllerManager = &v1alpha3.KubeControllerManagerConfig{}
yaml, err := kopscodecs.ToVersionedYamlWithVersion(cluster, v1alpha3.SchemeGroupVersion)
cluster := &v1alpha2.Cluster{}
cluster.Spec.Kubelet = &v1alpha2.KubeletConfigSpec{}
cluster.Spec.KubeControllerManager = &v1alpha2.KubeControllerManagerConfig{}
yaml, err := kopscodecs.ToVersionedYamlWithVersion(cluster, v1alpha2.SchemeGroupVersion)
if err != nil {
t.Errorf("unexpected error marshaling Cluster: %v", err)
}

yamlString := string(yaml)
expected := `apiVersion: kops.k8s.io/v1alpha3
expected := `apiVersion: kops.k8s.io/v1alpha2
kind: Cluster
metadata:
creationTimestamp: null
spec:
api: {}
cloudProvider: {}
configStore: {}
kubeControllerManager: {}
kubelet: {}
networking: {}
`
if yamlString != expected {
diffString := diff.FormatDiff(expected, yamlString)
Expand Down
38 changes: 0 additions & 38 deletions tests/integration/conversion/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,45 +34,7 @@ import (
// TestConversionMinimal runs the test on a minimum configuration, similar to kops create cluster minimal.example.com --zones us-west-1a
func TestConversionMinimal(t *testing.T) {
runTest(t, "minimal", "legacy-v1alpha2", "v1alpha2")
runTest(t, "minimal", "v1alpha2", "v1alpha3")
runTest(t, "minimal", "v1alpha3", "v1alpha2")
}

func TestConversionAWS(t *testing.T) {
runTest(t, "aws", "v1alpha2", "v1alpha3")
runTest(t, "aws", "v1alpha3", "v1alpha2")
}

func TestConversionAzure(t *testing.T) {
runTest(t, "azure", "v1alpha2", "v1alpha3")
runTest(t, "azure", "v1alpha3", "v1alpha2")
}

func TestConversionCanal(t *testing.T) {
runTest(t, "canal", "v1alpha2", "v1alpha3")
runTest(t, "canal", "v1alpha3", "v1alpha2")
}

func TestConversionCilium(t *testing.T) {
runTest(t, "cilium", "v1alpha2", "v1alpha3")
runTest(t, "cilium", "v1alpha3", "v1alpha2")
}

func TestConversionDO(t *testing.T) {
runTest(t, "do", "v1alpha2", "v1alpha3")
runTest(t, "do", "v1alpha3", "v1alpha2")
}

func TestConversionGCE(t *testing.T) {
runTest(t, "gce", "v1alpha2", "v1alpha3")
runTest(t, "gce", "v1alpha3", "v1alpha2")
}

func TestConversionOpenstack(t *testing.T) {
runTest(t, "openstack", "v1alpha2", "v1alpha3")
runTest(t, "openstack", "v1alpha3", "v1alpha2")
}

func runTest(t *testing.T, srcDir string, fromVersion string, toVersion string) {
t.Run(fromVersion+"-"+toVersion, func(t *testing.T) {
sourcePath := path.Join(srcDir, fromVersion+".yaml")
Expand Down
Loading