Skip to content

Commit 60ca623

Browse files
committed
pkg: fix compile errors after bump to k8s 1.29
1 parent 8e8819b commit 60ca623

File tree

3 files changed

+100
-3
lines changed

3 files changed

+100
-3
lines changed

pkg/cmd/oauth-apiserver/cmd.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ func NewOAuthAPIServerOptions(out io.Writer) *OAuthAPIServerOptions {
4949
TokenValidationOptions: tokenvalidationoptions.NewTokenValidationOptions(),
5050
Output: out,
5151
}
52-
o.RecommendedOptions.Etcd.StorageConfig.Paging = true
5352
return o
5453
}
5554

@@ -133,7 +132,7 @@ func (o *OAuthAPIServerOptions) NewOAuthAPIServerConfig() (*apiserver.Config, er
133132
}
134133

135134
serverConfig.GenericConfig.OpenAPIConfig = openapiconfig.DefaultOpenAPIConfig()
136-
serverConfig.GenericConfig.OpenAPIV3Config = openapiconfig.DefaultOpenAPIConfig()
135+
serverConfig.GenericConfig.OpenAPIV3Config = openapiconfig.DefaultOpenAPIV3Config()
137136
serverConfig.GenericConfig.AggregatedDiscoveryGroupManager = aggregated.NewResourceManager("apis")
138137
// do not to install the default OpenAPI handler in the aggregated apiserver
139138
// as it will be handled by openapi aggregator (both v2 and v3)

pkg/cmd/oauth-apiserver/cmd_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ func TestAddFlags(t *testing.T) {
8989
Transport: storagebackend.TransportConfig{
9090
TracerProvider: oteltrace.NewNoopTracerProvider(),
9191
},
92-
Paging: true,
9392
Prefix: "openshift.io",
9493
CompactionInterval: storagebackend.DefaultCompactInterval,
9594
CountMetricPollPeriod: time.Minute,

pkg/cmd/oauth-apiserver/openapiconfig/openapiconfig.go

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
apiserverendpointsopenapi "k8s.io/apiserver/pkg/endpoints/openapi"
88
aggregatorscheme "k8s.io/kube-aggregator/pkg/apiserver/scheme"
99
openapicommon "k8s.io/kube-openapi/pkg/common"
10+
"k8s.io/kube-openapi/pkg/spec3"
1011
"k8s.io/kube-openapi/pkg/validation/spec"
1112
"k8s.io/kubernetes/pkg/api/legacyscheme"
1213

@@ -115,3 +116,101 @@ func DefaultOpenAPIConfig() *openapicommon.Config {
115116
SecurityDefinitions: &securityDefinitions,
116117
}
117118
}
119+
120+
func DefaultOpenAPIV3Config() *openapicommon.OpenAPIV3Config {
121+
defNamer := apiserverendpointsopenapi.NewDefinitionNamer(legacyscheme.Scheme, extensionsapiserver.Scheme, aggregatorscheme.Scheme)
122+
return &openapicommon.OpenAPIV3Config{
123+
Info: &spec.Info{
124+
InfoProps: spec.InfoProps{
125+
Title: "OpenShift OAuth-related APIs",
126+
Version: version.Get().String(),
127+
License: &spec.License{
128+
Name: "Apache 2.0 (ASL2.0)",
129+
URL: "http://www.apache.org/licenses/LICENSE-2.0",
130+
},
131+
Description: heredoc.Doc(`
132+
OpenShift OAuth APIs provide access and authorization tokens,
133+
users, groups and similar objects required for OpenShift integrated
134+
OAuth authentication to work on top of Kubernetes. The API allows
135+
consistent management of those objects.
136+
137+
All API operations are authenticated via an Authorization bearer token that
138+
is provided for service accounts as a generated secret (in JWT form) or via
139+
the native OAuth access tokens. Core infrastructure components may use client
140+
certificates that require no authentication.
141+
142+
All API operations return a 'resourceVersion' string that represents the
143+
version of the object in the underlying storage. The standard LIST operation
144+
performs a snapshot read of the underlying objects, returning a resourceVersion
145+
representing a consistent version of the listed objects. The WATCH operation
146+
allows all updates to a set of objects after the provided resourceVersion to
147+
be observed by a client. By listing and beginning a watch from the returned
148+
resourceVersion, clients may observe a consistent view of the state of one
149+
or more objects. Note that WATCH always returns the update after the provided
150+
resourceVersion. Watch may be extended a limited time in the past - using
151+
etcd 2 the watch window is 1000 events (which on a large cluster may only
152+
be a few tens of seconds) so clients must explicitly handle the "watch
153+
to old error" by re-listing.
154+
155+
Objects are divided into two rough categories - those that have a lifecycle
156+
and must reflect the state of the cluster, and those that have no state.
157+
Objects with lifecycle typically have three main sections:
158+
159+
* 'metadata' common to all objects
160+
* a 'spec' that represents the desired state
161+
* a 'status' that represents how much of the desired state is reflected on
162+
the cluster at the current time
163+
164+
Objects that have no state have 'metadata' but may lack a 'spec' or 'status'
165+
section.
166+
167+
Objects are divided into those that are namespace scoped (only exist inside
168+
of a namespace) and those that are cluster scoped (exist outside of
169+
a namespace). A namespace scoped resource will be deleted when the namespace
170+
is deleted and cannot be created if the namespace has not yet been created
171+
or is in the process of deletion. Cluster scoped resources are typically
172+
only accessible to admins - resources like nodes, persistent volumes, and
173+
cluster policy.
174+
175+
All objects have a schema that is a combination of the 'kind' and
176+
'apiVersion' fields. This schema is additive only for any given version -
177+
no backwards incompatible changes are allowed without incrementing the
178+
apiVersion. The server will return and accept a number of standard
179+
responses that share a common schema - for instance, the common
180+
error type is 'metav1.Status' (described below) and will be returned
181+
on any error from the API server.
182+
183+
The API is available in multiple serialization formats - the default is
184+
JSON (Accept: application/json and Content-Type: application/json) but
185+
clients may also use YAML (application/yaml) or the native Protobuf
186+
schema (application/vnd.kubernetes.protobuf). Note that the format
187+
of the WATCH API call is slightly different - for JSON it returns newline
188+
delimited objects while for Protobuf it returns length-delimited frames
189+
(4 bytes in network-order) that contain a 'versioned.Watch' Protobuf
190+
object.
191+
192+
See the OpenShift documentation at https://docs.openshift.org for more
193+
information.
194+
`),
195+
},
196+
},
197+
DefaultResponse: &spec3.Response{
198+
ResponseProps: spec3.ResponseProps{
199+
Description: "Default Response.",
200+
},
201+
},
202+
IgnorePrefixes: []string{"/swaggerapi", "/healthz", "/controllers", "/metrics", "/version/openshift", "/brokers"},
203+
GetDefinitions: openapigenerated.GetOpenAPIDefinitions,
204+
GetDefinitionName: defNamer.GetDefinitionName,
205+
SecuritySchemes: map[string]*spec3.SecurityScheme{
206+
"BearerToken": {
207+
SecuritySchemeProps: spec3.SecuritySchemeProps{
208+
Type: "apiKey",
209+
Name: "authorization",
210+
In: "header",
211+
Description: "Bearer Token authentication",
212+
},
213+
},
214+
},
215+
}
216+
}

0 commit comments

Comments
 (0)