Merge pull request #133179 from nmn3m/fix-strings-title

Replace deprecated strings.Title with cases.Title

Kubernetes-commit: a8905a154b349352f2fad1d9530397003dfba0a6
This commit is contained in:
Kubernetes Publisher 2025-09-09 05:53:30 -07:00
commit bbc375b610
3 changed files with 16 additions and 14 deletions

4
go.mod
View File

@ -41,6 +41,7 @@ require (
golang.org/x/net v0.40.0
golang.org/x/sync v0.14.0
golang.org/x/sys v0.33.0
golang.org/x/text v0.25.0
golang.org/x/time v0.9.0
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb
google.golang.org/grpc v1.72.2
@ -51,7 +52,7 @@ require (
k8s.io/api v0.0.0-20250903202746-44a3d73239dc
k8s.io/apimachinery v0.0.0-20250905080136-9357001b8e78
k8s.io/client-go v0.0.0-20250908202926-1e409efaeed5
k8s.io/component-base v0.0.0-20250903090628-8f7bf5d4d816
k8s.io/component-base v0.0.0-20250909163423-c49a7765f420
k8s.io/klog/v2 v2.130.1
k8s.io/kms v0.0.0-20250828165801-c86d8f91ad08
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b
@ -118,7 +119,6 @@ require (
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/oauth2 v0.30.0 // indirect
golang.org/x/term v0.32.0 // indirect
golang.org/x/text v0.25.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect

4
go.sum
View File

@ -301,8 +301,8 @@ k8s.io/apimachinery v0.0.0-20250905080136-9357001b8e78 h1:bKP+Ktqy2mMYabMMvsHrfo
k8s.io/apimachinery v0.0.0-20250905080136-9357001b8e78/go.mod h1:7OLTj40s+nlro63xSAmcBvG2yQchJEdd+Lq2NGRhUlY=
k8s.io/client-go v0.0.0-20250908202926-1e409efaeed5 h1:mhmRY92ErxNf1lYXYlp7OFv0KmIDaSKHiHRoPWcODXs=
k8s.io/client-go v0.0.0-20250908202926-1e409efaeed5/go.mod h1:NXuQi/3PMua/pxtgiIHovbD+p0QlT8lYXqFD05y7QRE=
k8s.io/component-base v0.0.0-20250903090628-8f7bf5d4d816 h1:jAtnpEI/Iap0NOBI93KzytBCYKkxX4hkm8BYyChTQJQ=
k8s.io/component-base v0.0.0-20250903090628-8f7bf5d4d816/go.mod h1:6fNXilnkfmEvX+iUtojZI1OHHc5e52FCUfY5X8bukjw=
k8s.io/component-base v0.0.0-20250909163423-c49a7765f420 h1:OGkbTlD/Y/XQIeTcKxKFjTSUkVxK6xoSWHujNGjsD5I=
k8s.io/component-base v0.0.0-20250909163423-c49a7765f420/go.mod h1:luCZgSO+0ZQcFDEuO6ORgs2ljy0NzcQO2Tjqb/zxyds=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/kms v0.0.0-20250828165801-c86d8f91ad08 h1:gGi1IROnaWEdeKYF5ah1kTSticAZCKX2pUzEwbm8viE=

View File

@ -28,6 +28,8 @@ import (
restful "github.com/emicklei/go-restful/v3"
"sigs.k8s.io/structured-merge-diff/v6/fieldpath"
"golang.org/x/text/cases"
"golang.org/x/text/language"
apidiscoveryv2 "k8s.io/api/apidiscovery/v2"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/conversion"
@ -818,7 +820,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
route := ws.GET(action.Path).To(handler).
Doc(doc).
Param(ws.QueryParameter("pretty", "If 'true', then the output is pretty printed. Defaults to 'false' unless the user-agent indicates a browser or command-line HTTP tool (curl and wget).")).
Operation("read"+namespaced+kind+strings.Title(subresource)+operationSuffix).
Operation("read"+namespaced+kind+cases.Title(language.English).String(subresource)+operationSuffix).
Produces(append(storageMeta.ProducesMIMETypes(action.Verb), mediaTypes...)...).
Returns(http.StatusOK, "OK", producedObject).
Writes(producedObject)
@ -839,7 +841,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
route := ws.GET(action.Path).To(handler).
Doc(doc).
Param(ws.QueryParameter("pretty", "If 'true', then the output is pretty printed. Defaults to 'false' unless the user-agent indicates a browser or command-line HTTP tool (curl and wget).")).
Operation("list"+namespaced+kind+strings.Title(subresource)+operationSuffix).
Operation("list"+namespaced+kind+cases.Title(language.English).String(subresource)+operationSuffix).
Produces(append(storageMeta.ProducesMIMETypes(action.Verb), allMediaTypes...)...).
Returns(http.StatusOK, "OK", versionedList).
Writes(versionedList)
@ -872,7 +874,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
route := ws.PUT(action.Path).To(handler).
Doc(doc).
Param(ws.QueryParameter("pretty", "If 'true', then the output is pretty printed. Defaults to 'false' unless the user-agent indicates a browser or command-line HTTP tool (curl and wget).")).
Operation("replace"+namespaced+kind+strings.Title(subresource)+operationSuffix).
Operation("replace"+namespaced+kind+cases.Title(language.English).String(subresource)+operationSuffix).
Produces(append(storageMeta.ProducesMIMETypes(action.Verb), mediaTypes...)...).
Returns(http.StatusOK, "OK", producedObject).
// TODO: in some cases, the API may return a v1.Status instead of the versioned object
@ -905,7 +907,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
Doc(doc).
Param(ws.QueryParameter("pretty", "If 'true', then the output is pretty printed. Defaults to 'false' unless the user-agent indicates a browser or command-line HTTP tool (curl and wget).")).
Consumes(supportedTypes...).
Operation("patch"+namespaced+kind+strings.Title(subresource)+operationSuffix).
Operation("patch"+namespaced+kind+cases.Title(language.English).String(subresource)+operationSuffix).
Produces(append(storageMeta.ProducesMIMETypes(action.Verb), mediaTypes...)...).
Returns(http.StatusOK, "OK", producedObject).
// Patch can return 201 when a server side apply is requested
@ -934,7 +936,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
route := ws.POST(action.Path).To(handler).
Doc(doc).
Param(ws.QueryParameter("pretty", "If 'true', then the output is pretty printed. Defaults to 'false' unless the user-agent indicates a browser or command-line HTTP tool (curl and wget).")).
Operation("create"+namespaced+kind+strings.Title(subresource)+operationSuffix).
Operation("create"+namespaced+kind+cases.Title(language.English).String(subresource)+operationSuffix).
Produces(append(storageMeta.ProducesMIMETypes(action.Verb), mediaTypes...)...).
Returns(http.StatusOK, "OK", producedObject).
// TODO: in some cases, the API may return a v1.Status instead of the versioned object
@ -963,7 +965,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
route := ws.DELETE(action.Path).To(handler).
Doc(doc).
Param(ws.QueryParameter("pretty", "If 'true', then the output is pretty printed. Defaults to 'false' unless the user-agent indicates a browser or command-line HTTP tool (curl and wget).")).
Operation("delete"+namespaced+kind+strings.Title(subresource)+operationSuffix).
Operation("delete"+namespaced+kind+cases.Title(language.English).String(subresource)+operationSuffix).
Produces(append(storageMeta.ProducesMIMETypes(action.Verb), mediaTypes...)...).
Writes(deleteReturnType).
Returns(http.StatusOK, "OK", deleteReturnType).
@ -987,7 +989,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
route := ws.DELETE(action.Path).To(handler).
Doc(doc).
Param(ws.QueryParameter("pretty", "If 'true', then the output is pretty printed. Defaults to 'false' unless the user-agent indicates a browser or command-line HTTP tool (curl and wget).")).
Operation("deletecollection"+namespaced+kind+strings.Title(subresource)+operationSuffix).
Operation("deletecollection"+namespaced+kind+cases.Title(language.English).String(subresource)+operationSuffix).
Produces(append(storageMeta.ProducesMIMETypes(action.Verb), mediaTypes...)...).
Writes(versionedStatus).
Returns(http.StatusOK, "OK", versionedStatus)
@ -1015,7 +1017,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
route := ws.GET(action.Path).To(handler).
Doc(doc).
Param(ws.QueryParameter("pretty", "If 'true', then the output is pretty printed. Defaults to 'false' unless the user-agent indicates a browser or command-line HTTP tool (curl and wget).")).
Operation("watch"+namespaced+kind+strings.Title(subresource)+operationSuffix).
Operation("watch"+namespaced+kind+cases.Title(language.English).String(subresource)+operationSuffix).
Produces(allMediaTypes...).
Returns(http.StatusOK, "OK", versionedWatchEvent).
Writes(versionedWatchEvent)
@ -1036,7 +1038,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
route := ws.GET(action.Path).To(handler).
Doc(doc).
Param(ws.QueryParameter("pretty", "If 'true', then the output is pretty printed. Defaults to 'false' unless the user-agent indicates a browser or command-line HTTP tool (curl and wget).")).
Operation("watch"+namespaced+kind+strings.Title(subresource)+"List"+operationSuffix).
Operation("watch"+namespaced+kind+cases.Title(language.English).String(subresource)+"List"+operationSuffix).
Produces(allMediaTypes...).
Returns(http.StatusOK, "OK", versionedWatchEvent).
Writes(versionedWatchEvent)
@ -1060,7 +1062,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
route := ws.Method(method).Path(action.Path).
To(handler).
Doc(doc).
Operation("connect" + strings.Title(strings.ToLower(method)) + namespaced + kind + strings.Title(subresource) + operationSuffix).
Operation("connect" + cases.Title(language.English).String(strings.ToLower(method)) + namespaced + kind + cases.Title(language.English).String(subresource) + operationSuffix).
Produces("*/*").
Consumes("*/*").
Writes(connectProducedObject)