Compare commits

..

1 Commits

Author SHA1 Message Date
Kubernetes Publisher
a909ceb58f Update dependencies to v0.30.0-beta.0 tag 2024-03-13 08:04:33 +00:00
12 changed files with 65 additions and 305 deletions

View File

@@ -18,23 +18,23 @@ limitations under the License.
package v1
// NodeRuntimeHandlerApplyConfiguration represents an declarative configuration of the NodeRuntimeHandler type for use
// NodeRuntimeClassApplyConfiguration represents an declarative configuration of the NodeRuntimeClass type for use
// with apply.
type NodeRuntimeHandlerApplyConfiguration struct {
Name *string `json:"name,omitempty"`
Features *NodeRuntimeHandlerFeaturesApplyConfiguration `json:"features,omitempty"`
type NodeRuntimeClassApplyConfiguration struct {
Name *string `json:"name,omitempty"`
Features *NodeRuntimeClassFeaturesApplyConfiguration `json:"features,omitempty"`
}
// NodeRuntimeHandlerApplyConfiguration constructs an declarative configuration of the NodeRuntimeHandler type for use with
// NodeRuntimeClassApplyConfiguration constructs an declarative configuration of the NodeRuntimeClass type for use with
// apply.
func NodeRuntimeHandler() *NodeRuntimeHandlerApplyConfiguration {
return &NodeRuntimeHandlerApplyConfiguration{}
func NodeRuntimeClass() *NodeRuntimeClassApplyConfiguration {
return &NodeRuntimeClassApplyConfiguration{}
}
// WithName sets the Name field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Name field is set to the value of the last call.
func (b *NodeRuntimeHandlerApplyConfiguration) WithName(value string) *NodeRuntimeHandlerApplyConfiguration {
func (b *NodeRuntimeClassApplyConfiguration) WithName(value string) *NodeRuntimeClassApplyConfiguration {
b.Name = &value
return b
}
@@ -42,7 +42,7 @@ func (b *NodeRuntimeHandlerApplyConfiguration) WithName(value string) *NodeRunti
// WithFeatures sets the Features field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Features field is set to the value of the last call.
func (b *NodeRuntimeHandlerApplyConfiguration) WithFeatures(value *NodeRuntimeHandlerFeaturesApplyConfiguration) *NodeRuntimeHandlerApplyConfiguration {
func (b *NodeRuntimeClassApplyConfiguration) WithFeatures(value *NodeRuntimeClassFeaturesApplyConfiguration) *NodeRuntimeClassApplyConfiguration {
b.Features = value
return b
}

View File

@@ -18,22 +18,22 @@ limitations under the License.
package v1
// NodeRuntimeHandlerFeaturesApplyConfiguration represents an declarative configuration of the NodeRuntimeHandlerFeatures type for use
// NodeRuntimeClassFeaturesApplyConfiguration represents an declarative configuration of the NodeRuntimeClassFeatures type for use
// with apply.
type NodeRuntimeHandlerFeaturesApplyConfiguration struct {
type NodeRuntimeClassFeaturesApplyConfiguration struct {
RecursiveReadOnlyMounts *bool `json:"recursiveReadOnlyMounts,omitempty"`
}
// NodeRuntimeHandlerFeaturesApplyConfiguration constructs an declarative configuration of the NodeRuntimeHandlerFeatures type for use with
// NodeRuntimeClassFeaturesApplyConfiguration constructs an declarative configuration of the NodeRuntimeClassFeatures type for use with
// apply.
func NodeRuntimeHandlerFeatures() *NodeRuntimeHandlerFeaturesApplyConfiguration {
return &NodeRuntimeHandlerFeaturesApplyConfiguration{}
func NodeRuntimeClassFeatures() *NodeRuntimeClassFeaturesApplyConfiguration {
return &NodeRuntimeClassFeaturesApplyConfiguration{}
}
// WithRecursiveReadOnlyMounts sets the RecursiveReadOnlyMounts field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the RecursiveReadOnlyMounts field is set to the value of the last call.
func (b *NodeRuntimeHandlerFeaturesApplyConfiguration) WithRecursiveReadOnlyMounts(value bool) *NodeRuntimeHandlerFeaturesApplyConfiguration {
func (b *NodeRuntimeClassFeaturesApplyConfiguration) WithRecursiveReadOnlyMounts(value bool) *NodeRuntimeClassFeaturesApplyConfiguration {
b.RecursiveReadOnlyMounts = &value
return b
}

View File

@@ -36,7 +36,7 @@ type NodeStatusApplyConfiguration struct {
VolumesInUse []v1.UniqueVolumeName `json:"volumesInUse,omitempty"`
VolumesAttached []AttachedVolumeApplyConfiguration `json:"volumesAttached,omitempty"`
Config *NodeConfigStatusApplyConfiguration `json:"config,omitempty"`
RuntimeHandlers []NodeRuntimeHandlerApplyConfiguration `json:"runtimeHandlers,omitempty"`
RuntimeClasses []NodeRuntimeClassApplyConfiguration `json:"runtimeClasses,omitempty"`
}
// NodeStatusApplyConfiguration constructs an declarative configuration of the NodeStatus type for use with
@@ -155,15 +155,15 @@ func (b *NodeStatusApplyConfiguration) WithConfig(value *NodeConfigStatusApplyCo
return b
}
// WithRuntimeHandlers adds the given value to the RuntimeHandlers field in the declarative configuration
// WithRuntimeClasses adds the given value to the RuntimeClasses field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the RuntimeHandlers field.
func (b *NodeStatusApplyConfiguration) WithRuntimeHandlers(values ...*NodeRuntimeHandlerApplyConfiguration) *NodeStatusApplyConfiguration {
// If called multiple times, values provided by each call will be appended to the RuntimeClasses field.
func (b *NodeStatusApplyConfiguration) WithRuntimeClasses(values ...*NodeRuntimeClassApplyConfiguration) *NodeStatusApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithRuntimeHandlers")
panic("nil value passed to WithRuntimeClasses")
}
b.RuntimeHandlers = append(b.RuntimeHandlers, *values[i])
b.RuntimeClasses = append(b.RuntimeClasses, *values[i])
}
return b
}

View File

@@ -4759,7 +4759,6 @@ var schemaYAML = typed.YAMLObject(`types:
- name: name
type:
scalar: string
default: ""
- name: optional
type:
scalar: boolean
@@ -4773,7 +4772,6 @@ var schemaYAML = typed.YAMLObject(`types:
- name: name
type:
scalar: string
default: ""
- name: optional
type:
scalar: boolean
@@ -4811,7 +4809,6 @@ var schemaYAML = typed.YAMLObject(`types:
- name: name
type:
scalar: string
default: ""
- name: optional
type:
scalar: boolean
@@ -4830,7 +4827,6 @@ var schemaYAML = typed.YAMLObject(`types:
- name: name
type:
scalar: string
default: ""
- name: optional
type:
scalar: boolean
@@ -5654,7 +5650,6 @@ var schemaYAML = typed.YAMLObject(`types:
- name: ip
type:
scalar: string
default: ""
- name: io.k8s.api.core.v1.HostIP
map:
fields:
@@ -5884,7 +5879,6 @@ var schemaYAML = typed.YAMLObject(`types:
- name: name
type:
scalar: string
default: ""
elementRelationship: atomic
- name: io.k8s.api.core.v1.LocalVolumeSource
map:
@@ -6079,17 +6073,17 @@ var schemaYAML = typed.YAMLObject(`types:
type:
namedType: io.k8s.api.core.v1.DaemonEndpoint
default: {}
- name: io.k8s.api.core.v1.NodeRuntimeHandler
- name: io.k8s.api.core.v1.NodeRuntimeClass
map:
fields:
- name: features
type:
namedType: io.k8s.api.core.v1.NodeRuntimeHandlerFeatures
namedType: io.k8s.api.core.v1.NodeRuntimeClassFeatures
- name: name
type:
scalar: string
default: ""
- name: io.k8s.api.core.v1.NodeRuntimeHandlerFeatures
- name: io.k8s.api.core.v1.NodeRuntimeClassFeatures
map:
fields:
- name: recursiveReadOnlyMounts
@@ -6217,11 +6211,11 @@ var schemaYAML = typed.YAMLObject(`types:
- name: phase
type:
scalar: string
- name: runtimeHandlers
- name: runtimeClasses
type:
list:
elementType:
namedType: io.k8s.api.core.v1.NodeRuntimeHandler
namedType: io.k8s.api.core.v1.NodeRuntimeClass
elementRelationship: atomic
- name: volumesAttached
type:
@@ -7623,7 +7617,6 @@ var schemaYAML = typed.YAMLObject(`types:
- name: name
type:
scalar: string
default: ""
- name: optional
type:
scalar: boolean
@@ -7637,7 +7630,6 @@ var schemaYAML = typed.YAMLObject(`types:
- name: name
type:
scalar: string
default: ""
- name: optional
type:
scalar: boolean
@@ -7654,7 +7646,6 @@ var schemaYAML = typed.YAMLObject(`types:
- name: name
type:
scalar: string
default: ""
- name: optional
type:
scalar: boolean

View File

@@ -18,22 +18,22 @@ limitations under the License.
package v1alpha2
// ResourceModelApplyConfiguration represents an declarative configuration of the ResourceModel type for use
// NodeResourceModelApplyConfiguration represents an declarative configuration of the NodeResourceModel type for use
// with apply.
type ResourceModelApplyConfiguration struct {
type NodeResourceModelApplyConfiguration struct {
NamedResources *NamedResourcesResourcesApplyConfiguration `json:"namedResources,omitempty"`
}
// ResourceModelApplyConfiguration constructs an declarative configuration of the ResourceModel type for use with
// NodeResourceModelApplyConfiguration constructs an declarative configuration of the NodeResourceModel type for use with
// apply.
func ResourceModel() *ResourceModelApplyConfiguration {
return &ResourceModelApplyConfiguration{}
func NodeResourceModel() *NodeResourceModelApplyConfiguration {
return &NodeResourceModelApplyConfiguration{}
}
// WithNamedResources sets the NamedResources field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the NamedResources field is set to the value of the last call.
func (b *ResourceModelApplyConfiguration) WithNamedResources(value *NamedResourcesResourcesApplyConfiguration) *ResourceModelApplyConfiguration {
func (b *NodeResourceModelApplyConfiguration) WithNamedResources(value *NamedResourcesResourcesApplyConfiguration) *NodeResourceModelApplyConfiguration {
b.NamedResources = value
return b
}

View File

@@ -30,11 +30,11 @@ import (
// ResourceSliceApplyConfiguration represents an declarative configuration of the ResourceSlice type for use
// with apply.
type ResourceSliceApplyConfiguration struct {
v1.TypeMetaApplyConfiguration `json:",inline"`
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
NodeName *string `json:"nodeName,omitempty"`
DriverName *string `json:"driverName,omitempty"`
ResourceModelApplyConfiguration `json:",inline"`
v1.TypeMetaApplyConfiguration `json:",inline"`
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
NodeName *string `json:"nodeName,omitempty"`
DriverName *string `json:"driverName,omitempty"`
NodeResourceModelApplyConfiguration `json:",inline"`
}
// ResourceSlice constructs an declarative configuration of the ResourceSlice type for use with

View File

@@ -801,10 +801,10 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &applyconfigurationscorev1.NodeConfigStatusApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("NodeDaemonEndpoints"):
return &applyconfigurationscorev1.NodeDaemonEndpointsApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("NodeRuntimeHandler"):
return &applyconfigurationscorev1.NodeRuntimeHandlerApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("NodeRuntimeHandlerFeatures"):
return &applyconfigurationscorev1.NodeRuntimeHandlerFeaturesApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("NodeRuntimeClass"):
return &applyconfigurationscorev1.NodeRuntimeClassApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("NodeRuntimeClassFeatures"):
return &applyconfigurationscorev1.NodeRuntimeClassFeaturesApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("NodeSelector"):
return &applyconfigurationscorev1.NodeSelectorApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("NodeSelectorRequirement"):
@@ -1559,6 +1559,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &resourcev1alpha2.NamedResourcesResourcesApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("NamedResourcesStringSlice"):
return &resourcev1alpha2.NamedResourcesStringSliceApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("NodeResourceModel"):
return &resourcev1alpha2.NodeResourceModelApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("PodSchedulingContext"):
return &resourcev1alpha2.PodSchedulingContextApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("PodSchedulingContextSpec"):
@@ -1595,8 +1597,6 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &resourcev1alpha2.ResourceFilterModelApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("ResourceHandle"):
return &resourcev1alpha2.ResourceHandleApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("ResourceModel"):
return &resourcev1alpha2.ResourceModelApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("ResourceRequest"):
return &resourcev1alpha2.ResourceRequestApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("ResourceRequestModel"):

19
go.mod
View File

@@ -19,13 +19,13 @@ require (
github.com/peterbourgon/diskv v2.0.1+incompatible
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.4
golang.org/x/net v0.23.0
golang.org/x/net v0.21.0
golang.org/x/oauth2 v0.10.0
golang.org/x/term v0.18.0
golang.org/x/term v0.17.0
golang.org/x/time v0.3.0
google.golang.org/protobuf v1.33.0
k8s.io/api v0.30.4
k8s.io/apimachinery v0.30.4
k8s.io/api v0.30.0-beta.0
k8s.io/apimachinery v0.30.0-beta.0
k8s.io/klog/v2 v2.120.1
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
@@ -41,9 +41,7 @@ require (
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
@@ -52,14 +50,17 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/onsi/ginkgo/v2 v2.15.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.18.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
replace (
k8s.io/api => k8s.io/api v0.30.0-beta.0
k8s.io/apimachinery => k8s.io/apimachinery v0.30.0-beta.0
)

26
go.sum
View File

@@ -1,8 +1,5 @@
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
@@ -47,7 +44,6 @@ github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWm
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM=
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28=
github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
@@ -94,7 +90,6 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
@@ -112,8 +107,8 @@ golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8=
golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -121,12 +116,11 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
@@ -159,10 +153,10 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.30.4 h1:XASIELmW8w8q0i1Y4124LqPoWMycLjyQti/fdYHYjCs=
k8s.io/api v0.30.4/go.mod h1:ZqniWRKu7WIeLijbbzetF4U9qZ03cg5IRwl8YVs8mX0=
k8s.io/apimachinery v0.30.4 h1:5QHQI2tInzr8LsT4kU/2+fSeibH1eIHswNx480cqIoY=
k8s.io/apimachinery v0.30.4/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc=
k8s.io/api v0.30.0-beta.0 h1:5nsH5CjCcgbHxWigNtvMu3rulycLWPqrlDe5tSonVQI=
k8s.io/api v0.30.0-beta.0/go.mod h1:A74Wh+vOyYXQS7SbhLXPF3rW0+CQP078Sqn+yuHQV8Y=
k8s.io/apimachinery v0.30.0-beta.0 h1:/gaNLWP5ynEG0ExJ+4w2YCj5/L4MU66RsWEAKciy0/g=
k8s.io/apimachinery v0.30.0-beta.0/go.mod h1:wEJvNDlfxMRaMhyv38SIHIEC9hah/xuzqUUhxIyUv7Y=
k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw=
k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag=

View File

@@ -17,12 +17,10 @@ limitations under the License.
package portforward
import (
"errors"
"fmt"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"k8s.io/apimachinery/pkg/util/httpstream"
)
@@ -38,7 +36,7 @@ func TestFallbackDialer(t *testing.T) {
assert.True(t, primary.dialed, "no fallback; primary should have dialed")
assert.False(t, secondary.dialed, "no fallback; secondary should *not* have dialed")
assert.Equal(t, primaryProtocol, negotiated, "primary negotiated protocol returned")
require.NoError(t, err, "error from primary dialer should be nil")
assert.Nil(t, err, "error from primary dialer should be nil")
// If primary dialer error is upgrade error, then fallback returning secondary dial response.
primary = &fakeDialer{dialed: false, negotiatedProtocol: primaryProtocol, err: &httpstream.UpgradeFailureError{}}
secondary = &fakeDialer{dialed: false, negotiatedProtocol: secondaryProtocol}
@@ -47,18 +45,7 @@ func TestFallbackDialer(t *testing.T) {
assert.True(t, primary.dialed, "fallback; primary should have dialed")
assert.True(t, secondary.dialed, "fallback; secondary should have dialed")
assert.Equal(t, secondaryProtocol, negotiated, "negotiated protocol is from secondary dialer")
require.NoError(t, err, "error from secondary dialer should be nil")
// If primary dialer error is https proxy dialing error, then fallback returning secondary dial response.
primary = &fakeDialer{negotiatedProtocol: primaryProtocol, err: errors.New("proxy: unknown scheme: https")}
secondary = &fakeDialer{negotiatedProtocol: secondaryProtocol}
fallbackDialer = NewFallbackDialer(primary, secondary, func(err error) bool {
return httpstream.IsUpgradeFailure(err) || httpstream.IsHTTPSProxyError(err)
})
_, negotiated, err = fallbackDialer.Dial(protocols...)
assert.True(t, primary.dialed, "fallback; primary should have dialed")
assert.True(t, secondary.dialed, "fallback; secondary should have dialed")
assert.Equal(t, secondaryProtocol, negotiated, "negotiated protocol is from secondary dialer")
require.NoError(t, err, "error from secondary dialer should be nil")
assert.Nil(t, err, "error from secondary dialer should be nil")
// If primary dialer returns non-upgrade error, then primary error is returned.
nonUpgradeErr := fmt.Errorf("This is a non-upgrade error")
primary = &fakeDialer{dialed: false, err: nonUpgradeErr}

View File

@@ -20,19 +20,15 @@ import (
"bytes"
"context"
"crypto/rand"
"crypto/tls"
"io"
"net/http"
"net/http/httptest"
"net/url"
"sync/atomic"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"k8s.io/apimachinery/pkg/util/httpstream"
utilnettesting "k8s.io/apimachinery/pkg/util/net/testing"
"k8s.io/apimachinery/pkg/util/remotecommand"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/rest"
@@ -229,175 +225,3 @@ func TestFallbackClient_PrimaryAndSecondaryFail(t *testing.T) {
require.Error(t, err)
}
}
// localhostCert was generated from crypto/tls/generate_cert.go with the following command:
//
// go run generate_cert.go --rsa-bits 2048 --host 127.0.0.1,::1,example.com --ca --start-date "Jan 1 00:00:00 1970" --duration=1000000h
var localhostCert = []byte(`-----BEGIN CERTIFICATE-----
MIIDGTCCAgGgAwIBAgIRALL5AZcefF4kkYV1SEG6YrMwDQYJKoZIhvcNAQELBQAw
EjEQMA4GA1UEChMHQWNtZSBDbzAgFw03MDAxMDEwMDAwMDBaGA8yMDg0MDEyOTE2
MDAwMFowEjEQMA4GA1UEChMHQWNtZSBDbzCCASIwDQYJKoZIhvcNAQEBBQADggEP
ADCCAQoCggEBALQ/FHcyVwdFHxARbbD2KBtDUT7Eni+8ioNdjtGcmtXqBv45EC1C
JOqqGJTroFGJ6Q9kQIZ9FqH5IJR2fOOJD9kOTueG4Vt1JY1rj1Kbpjefu8XleZ5L
SBwIWVnN/lEsEbuKmj7N2gLt5AH3zMZiBI1mg1u9Z5ZZHYbCiTpBrwsq6cTlvR9g
dyo1YkM5hRESCzsrL0aUByoo0qRMD8ZsgANJwgsiO0/M6idbxDwv1BnGwGmRYvOE
Hxpy3v0Jg7GJYrvnpnifJTs4nw91N5X9pXxR7FFzi/6HTYDWRljvTb0w6XciKYAz
bWZ0+cJr5F7wB7ovlbm7HrQIR7z7EIIu2d8CAwEAAaNoMGYwDgYDVR0PAQH/BAQD
AgKkMBMGA1UdJQQMMAoGCCsGAQUFBwMBMA8GA1UdEwEB/wQFMAMBAf8wLgYDVR0R
BCcwJYILZXhhbXBsZS5jb22HBH8AAAGHEAAAAAAAAAAAAAAAAAAAAAEwDQYJKoZI
hvcNAQELBQADggEBAFPPWopNEJtIA2VFAQcqN6uJK+JVFOnjGRoCrM6Xgzdm0wxY
XCGjsxY5dl+V7KzdGqu858rCaq5osEBqypBpYAnS9C38VyCDA1vPS1PsN8SYv48z
DyBwj+7R2qar0ADBhnhWxvYO9M72lN/wuCqFKYMeFSnJdQLv3AsrrHe9lYqOa36s
8wxSwVTFTYXBzljPEnSaaJMPqFD8JXaZK1ryJPkO5OsCNQNGtatNiWAf3DcmwHAT
MGYMzP0u4nw47aRz9shB8w+taPKHx2BVwE1m/yp3nHVioOjXqA1fwRQVGclCJSH1
D2iq3hWVHRENgjTjANBPICLo9AZ4JfN6PH19mnU=
-----END CERTIFICATE-----`)
// localhostKey is the private key for localhostCert.
var localhostKey = []byte(`-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAtD8UdzJXB0UfEBFtsPYoG0NRPsSeL7yKg12O0Zya1eoG/jkQ
LUIk6qoYlOugUYnpD2RAhn0WofkglHZ844kP2Q5O54bhW3UljWuPUpumN5+7xeV5
nktIHAhZWc3+USwRu4qaPs3aAu3kAffMxmIEjWaDW71nllkdhsKJOkGvCyrpxOW9
H2B3KjViQzmFERILOysvRpQHKijSpEwPxmyAA0nCCyI7T8zqJ1vEPC/UGcbAaZFi
84QfGnLe/QmDsYliu+emeJ8lOzifD3U3lf2lfFHsUXOL/odNgNZGWO9NvTDpdyIp
gDNtZnT5wmvkXvAHui+VubsetAhHvPsQgi7Z3wIDAQABAoIBAGmw93IxjYCQ0ncc
kSKMJNZfsdtJdaxuNRZ0nNNirhQzR2h403iGaZlEpmdkhzxozsWcto1l+gh+SdFk
bTUK4MUZM8FlgO2dEqkLYh5BcMT7ICMZvSfJ4v21E5eqR68XVUqQKoQbNvQyxFk3
EddeEGdNrkb0GDK8DKlBlzAW5ep4gjG85wSTjR+J+muUv3R0BgLBFSuQnIDM/IMB
LWqsja/QbtB7yppe7jL5u8UCFdZG8BBKT9fcvFIu5PRLO3MO0uOI7LTc8+W1Xm23
uv+j3SY0+v+6POjK0UlJFFi/wkSPTFIfrQO1qFBkTDQHhQ6q/7GnILYYOiGbIRg2
NNuP52ECgYEAzXEoy50wSYh8xfFaBuxbm3ruuG2W49jgop7ZfoFrPWwOQKAZS441
VIwV4+e5IcA6KkuYbtGSdTYqK1SMkgnUyD/VevwAqH5TJoEIGu0pDuKGwVuwqioZ
frCIAV5GllKyUJ55VZNbRr2vY2fCsWbaCSCHETn6C16DNuTCe5C0JBECgYEA4JqY
5GpNbMG8fOt4H7hU0Fbm2yd6SHJcQ3/9iimef7xG6ajxsYrIhg1ft+3IPHMjVI0+
9brwHDnWg4bOOx/VO4VJBt6Dm/F33bndnZRkuIjfSNpLM51P+EnRdaFVHOJHwKqx
uF69kihifCAG7YATgCveeXImzBUSyZUz9UrETu8CgYARNBimdFNG1RcdvEg9rC0/
p9u1tfecvNySwZqU7WF9kz7eSonTueTdX521qAHowaAdSpdJMGODTTXaywm6cPhQ
jIfj9JZZhbqQzt1O4+08Qdvm9TamCUB5S28YLjza+bHU7nBaqixKkDfPqzCyilpX
yVGGL8SwjwmN3zop/sQXAQKBgC0JMsESQ6YcDsRpnrOVjYQc+LtW5iEitTdfsaID
iGGKihmOI7B66IxgoCHMTws39wycKdSyADVYr5e97xpR3rrJlgQHmBIrz+Iow7Q2
LiAGaec8xjl6QK/DdXmFuQBKqyKJ14rljFODP4QuE9WJid94bGqjpf3j99ltznZP
4J8HAoGAJb4eb4lu4UGwifDzqfAPzLGCoi0fE1/hSx34lfuLcc1G+LEu9YDKoOVJ
9suOh0b5K/bfEy9KrVMBBriduvdaERSD8S3pkIQaitIz0B029AbE4FLFf9lKQpP2
KR8NJEkK99Vh/tew6jAMll70xFrE7aF8VLXJVE7w4sQzuvHxl9Q=
-----END RSA PRIVATE KEY-----
`)
// See (https://github.com/kubernetes/kubernetes/issues/126134).
func TestFallbackClient_WebSocketHTTPSProxyCausesSPDYFallback(t *testing.T) {
cert, err := tls.X509KeyPair(localhostCert, localhostKey)
if err != nil {
t.Errorf("https (valid hostname): proxy_test: %v", err)
}
var proxyCalled atomic.Int64
proxyHandler := utilnettesting.NewHTTPProxyHandler(t, func(req *http.Request) bool {
proxyCalled.Add(1)
return true
})
defer proxyHandler.Wait()
proxyServer := httptest.NewUnstartedServer(proxyHandler)
proxyServer.TLS = &tls.Config{Certificates: []tls.Certificate{cert}}
proxyServer.StartTLS()
defer proxyServer.Close() //nolint:errcheck
proxyLocation, err := url.Parse(proxyServer.URL)
require.NoError(t, err)
// Create fake SPDY server. Copy received STDIN data back onto STDOUT stream.
spdyServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
var stdin, stdout bytes.Buffer
ctx, err := createHTTPStreams(w, req, &StreamOptions{
Stdin: &stdin,
Stdout: &stdout,
})
if err != nil {
w.WriteHeader(http.StatusForbidden)
return
}
defer ctx.conn.Close() //nolint:errcheck
_, err = io.Copy(ctx.stdoutStream, ctx.stdinStream)
if err != nil {
t.Fatalf("error copying STDIN to STDOUT: %v", err)
}
}))
defer spdyServer.Close() //nolint:errcheck
backendLocation, err := url.Parse(spdyServer.URL)
require.NoError(t, err)
clientConfig := &rest.Config{
Host: spdyServer.URL,
TLSClientConfig: rest.TLSClientConfig{CAData: localhostCert},
Proxy: func(req *http.Request) (*url.URL, error) {
return proxyLocation, nil
},
}
// Websocket with https proxy will fail in dialing (falling back to SPDY).
websocketExecutor, err := NewWebSocketExecutor(clientConfig, "GET", backendLocation.String())
require.NoError(t, err)
spdyExecutor, err := NewSPDYExecutor(clientConfig, "POST", backendLocation)
require.NoError(t, err)
// Fallback to spdyExecutor with websocket https proxy error; spdyExecutor succeeds against fake spdy server.
sawHTTPSProxyError := false
exec, err := NewFallbackExecutor(websocketExecutor, spdyExecutor, func(err error) bool {
if httpstream.IsUpgradeFailure(err) {
t.Errorf("saw upgrade failure: %v", err)
return true
}
if httpstream.IsHTTPSProxyError(err) {
sawHTTPSProxyError = true
t.Logf("saw https proxy error: %v", err)
return true
}
return false
})
require.NoError(t, err)
// Generate random data, and set it up to stream on STDIN. The data will be
// returned on the STDOUT buffer.
randomSize := 1024 * 1024
randomData := make([]byte, randomSize)
if _, err := rand.Read(randomData); err != nil {
t.Errorf("unexpected error reading random data: %v", err)
}
var stdout bytes.Buffer
options := &StreamOptions{
Stdin: bytes.NewReader(randomData),
Stdout: &stdout,
}
errorChan := make(chan error)
go func() {
errorChan <- exec.StreamWithContext(context.Background(), *options)
}()
select {
case <-time.After(wait.ForeverTestTimeout):
t.Fatalf("expect stream to be closed after connection is closed.")
case err := <-errorChan:
if err != nil {
t.Errorf("unexpected error")
}
}
data, err := io.ReadAll(bytes.NewReader(stdout.Bytes()))
if err != nil {
t.Errorf("error reading the stream: %v", err)
return
}
// Check the random data sent on STDIN was the same returned on STDOUT.
if !bytes.Equal(randomData, data) {
t.Errorf("unexpected data received: %d sent: %d", len(data), len(randomData))
}
// Ensure the https proxy error was observed
if !sawHTTPSProxyError {
t.Errorf("expected to see https proxy error")
}
// Ensure the proxy was called once
if e, a := int64(1), proxyCalled.Load(); e != a {
t.Errorf("expected %d proxy call, got %d", e, a)
}
}

View File

@@ -39,7 +39,6 @@ import (
v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/httpstream"
"k8s.io/apimachinery/pkg/util/httpstream/wsstream"
"k8s.io/apimachinery/pkg/util/remotecommand"
"k8s.io/apimachinery/pkg/util/wait"
@@ -1341,39 +1340,3 @@ func createWebSocketStreams(req *http.Request, w http.ResponseWriter, opts *opti
return wsStreams, nil
}
// See (https://github.com/kubernetes/kubernetes/issues/126134).
func TestWebSocketClient_HTTPSProxyErrorExpected(t *testing.T) {
urlStr := "http://127.0.0.1/never-used" + "?" + "stdin=true" + "&" + "stdout=true"
websocketLocation, err := url.Parse(urlStr)
if err != nil {
t.Fatalf("Unable to parse WebSocket server URL: %s", urlStr)
}
// proxy url with https scheme will trigger websocket dialing error.
httpsProxyFunc := func(req *http.Request) (*url.URL, error) { return url.Parse("https://127.0.0.1") }
exec, err := NewWebSocketExecutor(&rest.Config{Host: websocketLocation.Host, Proxy: httpsProxyFunc}, "GET", urlStr)
if err != nil {
t.Errorf("unexpected error creating websocket executor: %v", err)
}
var stdout bytes.Buffer
options := &StreamOptions{
Stdout: &stdout,
}
errorChan := make(chan error)
go func() {
// Start the streaming on the WebSocket "exec" client.
errorChan <- exec.StreamWithContext(context.Background(), *options)
}()
select {
case <-time.After(wait.ForeverTestTimeout):
t.Fatalf("expect stream to be closed after connection is closed.")
case err := <-errorChan:
if err == nil {
t.Errorf("expected error but received none")
}
if !httpstream.IsHTTPSProxyError(err) {
t.Errorf("expected https proxy error, got (%s)", err)
}
}
}