From eac8d6a9971fbb2358f7c1c5283453d1015ffd73 Mon Sep 17 00:00:00 2001 From: feihujiang Date: Thu, 5 Nov 2015 18:48:03 +0800 Subject: [PATCH] Cleanup the content of deprecated V1beta1 --- pkg/api/doc.go | 2 +- pkg/api/helpers.go | 3 +- pkg/api/meta/interfaces.go | 2 -- pkg/api/testing/fuzzer.go | 28 ------------------- pkg/api/types.go | 1 - .../unversioned/clientcmd/api/types_test.go | 8 +++--- pkg/conversion/converter.go | 4 +-- pkg/conversion/encode.go | 4 +-- pkg/conversion/scheme.go | 4 +-- pkg/kubelet/network/exec/exec.go | 2 +- pkg/runtime/scheme.go | 4 +-- pkg/runtime/types.go | 2 +- 12 files changed, 16 insertions(+), 48 deletions(-) diff --git a/pkg/api/doc.go b/pkg/api/doc.go index 7cc6359fa51..8a54f7acc69 100644 --- a/pkg/api/doc.go +++ b/pkg/api/doc.go @@ -17,6 +17,6 @@ limitations under the License. // Package api contains the latest (or "internal") version of the // Kubernetes API objects. This is the API objects as represented in memory. // The contract presented to clients is located in the versioned packages, -// which are sub-directories. The first one is "v1beta1". Those packages +// which are sub-directories. The first one is "v1". Those packages // describe how a particular version is serialized to storage/network. package api diff --git a/pkg/api/helpers.go b/pkg/api/helpers.go index 8248899d56a..860ffd0a3ef 100644 --- a/pkg/api/helpers.go +++ b/pkg/api/helpers.go @@ -53,8 +53,7 @@ func (c *ConversionError) Error() string { var Semantic = conversion.EqualitiesOrDie( func(a, b resource.Quantity) bool { // Ignore formatting, only care that numeric value stayed the same. - // TODO: if we decide it's important, after we drop v1beta1/2, we - // could start comparing format. + // TODO: if we decide it's important, it should be safe to start comparing the format. // // Uninitialized quantities are equivalent to 0 quantities. if a.Amount == nil && b.MilliValue() == 0 { diff --git a/pkg/api/meta/interfaces.go b/pkg/api/meta/interfaces.go index 3d7455469e2..2ecc7607013 100644 --- a/pkg/api/meta/interfaces.go +++ b/pkg/api/meta/interfaces.go @@ -107,8 +107,6 @@ const ( ) // RESTScope contains the information needed to deal with REST resources that are in a resource hierarchy -// TODO After we deprecate v1beta1 and v1beta2, we can look a supporting removing the flexibility of supporting -// either a query or path param, and instead just support path param type RESTScope interface { // Name of the scope Name() RESTScopeName diff --git a/pkg/api/testing/fuzzer.go b/pkg/api/testing/fuzzer.go index 69a933f87df..fe4f04a015b 100644 --- a/pkg/api/testing/fuzzer.go +++ b/pkg/api/testing/fuzzer.go @@ -36,7 +36,6 @@ import ( "k8s.io/kubernetes/pkg/util" "github.com/google/gofuzz" - "speter.net/go/exp/math/dec/inf" ) // FuzzerFor can randomly populate api objects that are destined for version. @@ -111,15 +110,6 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer { statuses := []api.PodPhase{api.PodPending, api.PodRunning, api.PodFailed, api.PodUnknown} *j = statuses[c.Rand.Intn(len(statuses))] }, - func(j *api.PodTemplateSpec, c fuzz.Continue) { - // TODO: v1beta1/2 can't round trip a nil template correctly, fix by having v1beta1/2 - // conversion compare converted object to nil via DeepEqual - j.ObjectMeta = api.ObjectMeta{} - c.Fuzz(&j.ObjectMeta) - j.ObjectMeta = api.ObjectMeta{Labels: j.ObjectMeta.Labels} - j.Spec = api.PodSpec{} - c.Fuzz(&j.Spec) - }, func(j *api.Binding, c fuzz.Continue) { c.Fuzz(&j.ObjectMeta) j.Target.Name = c.RandString() @@ -189,15 +179,6 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer { c.RandString(): c.RandString(), } }, - func(q *resource.Quantity, c fuzz.Continue) { - // Real Quantity fuzz testing is done elsewhere; - // this limited subset of functionality survives - // round-tripping to v1beta1/2. - q.Amount = &inf.Dec{} - q.Format = resource.DecimalExponent - //q.Amount.SetScale(inf.Scale(-c.Intn(12))) - q.Amount.SetUnscaled(c.Int63n(1000)) - }, func(q *api.ResourceRequirements, c fuzz.Continue) { randomQuantity := func() resource.Quantity { return *resource.NewQuantity(c.Int63n(1000), resource.DecimalExponent) @@ -313,15 +294,6 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer { c.Fuzz(&sc.Capabilities.Drop) } }, - func(e *api.Event, c fuzz.Continue) { - c.FuzzNoCustom(e) // fuzz self without calling this function again - // Fix event count to 1, otherwise, if a v1beta1 or v1beta2 event has a count set arbitrarily, it's count is ignored - if e.FirstTimestamp.IsZero() { - e.Count = 1 - } else { - c.Fuzz(&e.Count) - } - }, func(s *api.Secret, c fuzz.Continue) { c.FuzzNoCustom(s) // fuzz self without calling this function again s.Type = api.SecretTypeOpaque diff --git a/pkg/api/types.go b/pkg/api/types.go index 4ba8dafce8d..cce9e79480a 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -1137,7 +1137,6 @@ type ReplicationControllerSpec struct { // Template is the object that describes the pod that will be created if // insufficient replicas are detected. Internally, this takes precedence over a // TemplateRef. - // Must be set before converting to a v1beta1 or v1beta2 API object. Template *PodTemplateSpec `json:"template,omitempty"` } diff --git a/pkg/client/unversioned/clientcmd/api/types_test.go b/pkg/client/unversioned/clientcmd/api/types_test.go index af351bf2f42..8059fe21fd1 100644 --- a/pkg/client/unversioned/clientcmd/api/types_test.go +++ b/pkg/client/unversioned/clientcmd/api/types_test.go @@ -44,13 +44,13 @@ func ExampleOfOptionsConfig() { defaultConfig.Preferences.Colors = true defaultConfig.Clusters["alfa"] = &Cluster{ Server: "https://alfa.org:8080", - APIVersion: "v1beta2", + APIVersion: "v1", InsecureSkipTLSVerify: true, CertificateAuthority: "path/to/my/cert-ca-filename", } defaultConfig.Clusters["bravo"] = &Cluster{ Server: "https://bravo.org:8080", - APIVersion: "v1beta1", + APIVersion: "v1", InsecureSkipTLSVerify: false, } defaultConfig.AuthInfos["white-mage-via-cert"] = &AuthInfo{ @@ -86,13 +86,13 @@ func ExampleOfOptionsConfig() { // clusters: // alfa: // LocationOfOrigin: "" - // api-version: v1beta2 + // api-version: v1 // certificate-authority: path/to/my/cert-ca-filename // insecure-skip-tls-verify: true // server: https://alfa.org:8080 // bravo: // LocationOfOrigin: "" - // api-version: v1beta1 + // api-version: v1 // server: https://bravo.org:8080 // contexts: // alfa-as-black-mage: diff --git a/pkg/conversion/converter.go b/pkg/conversion/converter.go index 61025b61725..8c0bdfc9b1f 100644 --- a/pkg/conversion/converter.go +++ b/pkg/conversion/converter.go @@ -291,7 +291,7 @@ func verifyConversionFunctionSignature(ft reflect.Type) error { // // Example: // c.RegisterConversionFunc( -// func(in *Pod, out *v1beta1.Pod, s Scope) error { +// func(in *Pod, out *v1.Pod, s Scope) error { // // conversion logic... // return nil // }) @@ -343,7 +343,7 @@ func (c *Converter) SetStructFieldCopy(srcFieldType interface{}, srcFieldName st // // Example: // c.RegisteDefaultingFunc( -// func(in *v1beta1.Pod) { +// func(in *v1.Pod) { // // defaulting logic... // }) func (c *Converter) RegisterDefaultingFunc(defaultingFunc interface{}) error { diff --git a/pkg/conversion/encode.go b/pkg/conversion/encode.go index 7e1b82445bf..07cd333c223 100644 --- a/pkg/conversion/encode.go +++ b/pkg/conversion/encode.go @@ -43,8 +43,8 @@ import ( // expressing any API object. // * Only versioned objects should be encoded. This means that, if you pass // a native object, Encode will convert it to a versioned object. For -// example, an api.Pod will get converted to a v1beta1.Pod. However, if -// you pass in an object that's already versioned (v1beta1.Pod), Encode +// example, an api.Pod will get converted to a v1.Pod. However, if +// you pass in an object that's already versioned (v1.Pod), Encode // will not modify it. // // The purpose of the above complex conversion behavior is to allow us to diff --git a/pkg/conversion/scheme.go b/pkg/conversion/scheme.go index 1906178a9dc..d0e2864613d 100644 --- a/pkg/conversion/scheme.go +++ b/pkg/conversion/scheme.go @@ -184,7 +184,7 @@ func (s *Scheme) NewObject(versionName, kind string) (interface{}, error) { // // the source version, e.g., "" // s.Meta().SrcVersion // // You can depend on this being set to the destination version, -// // e.g., "v1beta1". +// // e.g., "v1". // s.Meta().DestVersion // // Call scope.Convert to copy sub-fields. // s.Convert(&in.SubFieldThatMoved, &out.NewLocation.NewName, 0) @@ -256,7 +256,7 @@ func (s *Scheme) AddStructFieldConversion(srcFieldType interface{}, srcFieldName // how to call these functions from the types of their two parameters. // // s.AddDefaultingFuncs( -// func(obj *v1beta1.Pod) { +// func(obj *v1.Pod) { // if obj.OptionalField == "" { // obj.OptionalField = "DefaultValue" // } diff --git a/pkg/kubelet/network/exec/exec.go b/pkg/kubelet/network/exec/exec.go index a29388d70ed..af9ec1be123 100644 --- a/pkg/kubelet/network/exec/exec.go +++ b/pkg/kubelet/network/exec/exec.go @@ -33,7 +33,7 @@ limitations under the License. // formatted output indicating the pod's IPAddress(v4/v6). An empty string value or an erroneous output // will mean the container runtime (docker) will be asked for the PodIP // e.g. { -// "apiVersion" : "v1beta1", +// "apiVersion" : "v1", // "kind" : "PodNetworkStatus", // "ip" : "10.20.30.40" // } diff --git a/pkg/runtime/scheme.go b/pkg/runtime/scheme.go index 0a2bf47c3e6..c21e9bc0750 100644 --- a/pkg/runtime/scheme.go +++ b/pkg/runtime/scheme.go @@ -423,8 +423,8 @@ func (s *Scheme) ConvertToVersion(in Object, outVersion string) (Object, error) // API object. // * Only versioned objects should be encoded. This means that, if you pass // a native object, Encode will convert it to a versioned object. For -// example, an api.Pod will get converted to a v1beta1.Pod. However, if -// you pass in an object that's already versioned (v1beta1.Pod), Encode +// example, an api.Pod will get converted to a v1.Pod. However, if +// you pass in an object that's already versioned (v1.Pod), Encode // will not modify it. // // The purpose of the above complex conversion behavior is to allow us to diff --git a/pkg/runtime/types.go b/pkg/runtime/types.go index 28a9f66032b..5f6b792a2cc 100644 --- a/pkg/runtime/types.go +++ b/pkg/runtime/types.go @@ -84,7 +84,7 @@ type EmbeddedObject struct { // // On the wire, the JSON will look something like this: // { // "kind":"MyAPIObject", -// "apiVersion":"v1beta1", +// "apiVersion":"v1", // "myPlugin": { // "kind":"PluginA", // "aOption":"foo",