forked from kubernetes/kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 11
WIP: Rebase 1.32 Pre.1 Diff #161
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
Open
mjudeikis
wants to merge
58
commits into
kcp-1.32-baseline
Choose a base branch
from
kcp-1.32-pre.1
base: kcp-1.32-baseline
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
dead945
UPSTREAM: 113151: Revert: Revert: Clean up CRD conversion code structure
sttts d157aea
README
sttts a0f3d68
UPSTREAM: <carry>: controlplane/apiserver: add miniaggregator
sttts 7234f81
UPSTREAM: <carry>: clusterize controllers
sttts 28ac217
UPSTREAM: <carry>: re-add GC worker locks
gman0 570c6ed
UPSTREAM: <carry>: Add kcp patchers
sttts c93e304
UPSTREAM: <carry>: re-generated pkg/controller/resourcequota/resource…
gman0 2016601
UPSTREAM: <carry>: re-generated pkg/controller/garbagecollector/garba…
gman0 f87a202
UPSTREAM: <carry>: storage: etcd cluster key computation
sttts aad4a42
UPSTREAM: <carry>: clusterize serviceaccounts
sttts 86eb6a8
UPSTREAM: <carry>: registry/core/serviceaccount: do not crash without…
sttts 0e41242
UPSTREAM: <carry>: kube-aggregator
sttts 006648f
UPSTREAM: <carry>: INTERESTING: clusterize admission
sttts ba55bcf
UPSTREAM: <carry>: Clusterize ValidatingAdmissionPolicy admission plu…
embik aaa0e92
UPSTREAM: <carry>: clusterize storage hash
sttts f2ad525
UPSTREAM: <carry>: endpoints: add Cluster struct for ctx
sttts 4ed5b98
UPSTREAM: <carry>: endpoints/patch: wire openapi for CRD strategic me…
sttts 4739ef6
UPSTREAM: <carry>: storage/etcd3: clusterize
sttts ab335e9
UPSTREAM: <carry>: apiserver: partial wildcard metadata request accro…
sttts d868a62
UPSTREAM: <carry>: endpoints: set kcp.io/original-api-version on wild…
sttts 7f28105
UPSTREAM: <carry>: watch(er/cache): clusterize
sttts e271562
UPSTREAM: <carry>: apiserver: split chain into pre and post authz
sttts 4a2b5f9
UPSTREAM: <carry>: apiserver: clusterize listed paths
sttts b9669e3
UPSTREAM: <carry>: apiserver: clusterize OpenAPI v2
sttts b5939d8
UPSTREAM: <carry>: clusterize BuiltInAuthenticationOptions
sttts bf1a2a1
UPSTREAM: <carry>: storage: add UseResourceAsPrefixDefault for legacy…
sttts 879e485
UPSTREAM: <carry>: apiextensions-apiserver
sttts 0203da1
UPSTREAM: <carry>: cache-server: wire shard name into storage
sttts db825b7
UPSTREAM: <carry>: add client and informer hacks
sttts 1159daa
UPSTREAM: <carry>: controlplane: wire informers and clients
sttts 4c9c3df
UPSTREAM: <carry>: generic cleanup
mjudeikis ab917a9
UPSTREAM: <carry>: controlplane/apiserver: disable protobuf for loopback
sttts e142cc7
UPSTREAM: <carry>: pass system:admin clients and informers in generic…
embik a71d65e
UPSTREAM: <carry>: remove REST mapper from admission plugins
embik 68b54d6
UPSTREAM: <carry>: provide supportedMediaTypes for custom resoure han…
embik 50c9ea5
UPSTREAM: <carry>: prevent NPE if no authorization is set
embik 2034abe
UPSTREAM: <carry>: wrap CRD group into packagePrefix for OpenAPIV3 bu…
embik 8a207b8
UPSTREAM: <CARRY>: clusterize validatingadmissionpolicystatus controller
embik 7a27a28
UPSTREAM: <carry>: apiserver cleaning
mjudeikis 5c809ee
UPSTREAM: <squash>: remove syncer custom code from apiextensions-apis…
sttts fe0acf7
UPSTREAM: <carry>: include cluster name in authz SubjectAccessReview …
xrstf d57c237
UPSTREAM: <squash>: prevent conflict with pre-existing auth annotation
xrstf 455d854
CARRY: split auth/authz chains even more
mjudeikis 1a37a19
UPSTREAM: <carry>: authz: add scoping to default rule resolver
sttts b6ac17f
UPSTREAM: <carry>: authz: add warrants to default rule resolver
sttts dc03406
UPSTREAM: <squash>: authz: add warrants to default rule resolver: glo…
sttts b06d2a8
UPSTREAM: <squash>: authz: add warrants to default rule resolver: hel…
sttts 1b0b146
UPSTREAM: <squash>: authz: add warrants to default rule resolver: glo…
sttts 0ced631
UPSTREAM: <squash>: authz: add warrants to default rule resolver: for…
sttts bffed1d
UPSTREAM: <squash>: authz: add warrants to default rule resolver: sim…
sttts 8fd95d6
UPSTREAM: <carry>: endpoints: wire in ctx to watchListTransformer
gman0 8befcaf
UPSTREAM: <carry>: Clusterize MutatingAdmissionPolicy admission plugi…
gman0 8fc9059
UPSTREAM: <carry>: don't use --prefers-protobuf with client-gen
gman0 03a3c1b
UPSTREAM: <drop>: Pinned kcp dependencies
gman0 204c308
UPSTREAM: <drop>: Updated vendor modules
gman0 c6ebc59
UPSTREAM: <drop>: Re-generated client code
gman0 89e1549
UPSTREAM 130180: Make disable lookups of SA related artifacts working
mjudeikis 3b193fc
Merge pull request #163 from mjudeikis/mjudeikis/cherry.sa.lookup
mjudeikis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
328 changes: 328 additions & 0 deletions
328
staging/src/k8s.io/apiserver/pkg/clientsethack/adapter.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,328 @@ | ||
/* | ||
Copyright 2022 The KCP Authors. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// +kcp-code-generator:skip | ||
|
||
package clientsethack | ||
|
||
import ( | ||
kcpkubernetesclientset "github.com/kcp-dev/client-go/kubernetes" | ||
|
||
"k8s.io/client-go/discovery" | ||
"k8s.io/client-go/kubernetes" | ||
admissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1" | ||
admissionregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1" | ||
admissionregistrationv1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1" | ||
internalv1alpha1 "k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1" | ||
appsv1 "k8s.io/client-go/kubernetes/typed/apps/v1" | ||
appsv1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1" | ||
appsv1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2" | ||
authenticationv1 "k8s.io/client-go/kubernetes/typed/authentication/v1" | ||
"k8s.io/client-go/kubernetes/typed/authentication/v1alpha1" | ||
authenticationv1beta1 "k8s.io/client-go/kubernetes/typed/authentication/v1beta1" | ||
authorizationv1 "k8s.io/client-go/kubernetes/typed/authorization/v1" | ||
authorizationv1beta1 "k8s.io/client-go/kubernetes/typed/authorization/v1beta1" | ||
autoscalingv1 "k8s.io/client-go/kubernetes/typed/autoscaling/v1" | ||
autoscalingv2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2" | ||
autoscalingv2beta1 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1" | ||
autoscalingv2beta2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2" | ||
batchv1 "k8s.io/client-go/kubernetes/typed/batch/v1" | ||
batchv1beta1 "k8s.io/client-go/kubernetes/typed/batch/v1beta1" | ||
certificatesv1 "k8s.io/client-go/kubernetes/typed/certificates/v1" | ||
certificatesv1alpha1 "k8s.io/client-go/kubernetes/typed/certificates/v1alpha1" | ||
certificatesv1beta1 "k8s.io/client-go/kubernetes/typed/certificates/v1beta1" | ||
coordinationv1 "k8s.io/client-go/kubernetes/typed/coordination/v1" | ||
coordinationv1alpha2 "k8s.io/client-go/kubernetes/typed/coordination/v1alpha2" | ||
coordinationv1beta1 "k8s.io/client-go/kubernetes/typed/coordination/v1beta1" | ||
corev1 "k8s.io/client-go/kubernetes/typed/core/v1" | ||
discoveryv1 "k8s.io/client-go/kubernetes/typed/discovery/v1" | ||
discoveryv1beta1 "k8s.io/client-go/kubernetes/typed/discovery/v1beta1" | ||
eventsv1 "k8s.io/client-go/kubernetes/typed/events/v1" | ||
eventsv1beta1 "k8s.io/client-go/kubernetes/typed/events/v1beta1" | ||
extensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1" | ||
flowcontrolv1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1" | ||
flowcontrolv1beta1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1" | ||
flowcontrolv1beta2 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2" | ||
flowcontrolv1beta3 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3" | ||
networkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1" | ||
networkingv1alpha1 "k8s.io/client-go/kubernetes/typed/networking/v1alpha1" | ||
networkingv1beta1 "k8s.io/client-go/kubernetes/typed/networking/v1beta1" | ||
nodev1 "k8s.io/client-go/kubernetes/typed/node/v1" | ||
nodev1alpha1 "k8s.io/client-go/kubernetes/typed/node/v1alpha1" | ||
nodev1beta1 "k8s.io/client-go/kubernetes/typed/node/v1beta1" | ||
policyv1 "k8s.io/client-go/kubernetes/typed/policy/v1" | ||
policyv1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1" | ||
rbacv1 "k8s.io/client-go/kubernetes/typed/rbac/v1" | ||
rbacv1alpha1 "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1" | ||
rbacv1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1" | ||
resourcev1alpha3 "k8s.io/client-go/kubernetes/typed/resource/v1alpha3" | ||
resourcev1beta1 "k8s.io/client-go/kubernetes/typed/resource/v1beta1" | ||
schedulingv1 "k8s.io/client-go/kubernetes/typed/scheduling/v1" | ||
schedulingv1alpha1 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1" | ||
schedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1" | ||
storagev1 "k8s.io/client-go/kubernetes/typed/storage/v1" | ||
storagev1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1" | ||
storagev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1" | ||
storagemigrationv1alpha1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1alpha1" | ||
) | ||
|
||
// Interface allows us to hold onto a strongly-typed cluster-aware clients here, while | ||
// passing in a cluster-unaware (but non-functional) clients to k8s libraries. We export this type so that we | ||
// can get the cluster-aware clients back using casting in admission plugin initialization. | ||
type Interface interface { | ||
kubernetes.Interface | ||
ClusterAware() kcpkubernetesclientset.ClusterInterface | ||
} | ||
|
||
var _ Interface = (*hack)(nil) | ||
|
||
// Wrap adapts a cluster-aware informer factory to a cluster-unaware wrapper that can divulge it after casting. | ||
func Wrap(clusterAware kcpkubernetesclientset.ClusterInterface) Interface { | ||
return &hack{clusterAware: clusterAware} | ||
} | ||
|
||
// Unwrap extracts a cluster-aware informer factory from the cluster-unaware wrapper, or panics if we get the wrong input. | ||
func Unwrap(clusterUnaware kubernetes.Interface) kcpkubernetesclientset.ClusterInterface { | ||
return clusterUnaware.(Interface).ClusterAware() | ||
} | ||
|
||
type hack struct { | ||
clusterAware kcpkubernetesclientset.ClusterInterface | ||
} | ||
|
||
func (h *hack) AdmissionregistrationV1alpha1() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) AuthenticationV1alpha1() v1alpha1.AuthenticationV1alpha1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) NetworkingV1alpha1() networkingv1alpha1.NetworkingV1alpha1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) ResourceV1alpha3() resourcev1alpha3.ResourceV1alpha3Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) ResourceV1beta1() resourcev1beta1.ResourceV1beta1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) AdmissionregistrationV1() admissionregistrationv1.AdmissionregistrationV1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) AdmissionregistrationV1beta1() admissionregistrationv1beta1.AdmissionregistrationV1beta1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) InternalV1alpha1() internalv1alpha1.InternalV1alpha1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) AppsV1() appsv1.AppsV1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) AppsV1beta1() appsv1beta1.AppsV1beta1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) AppsV1beta2() appsv1beta2.AppsV1beta2Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) AuthenticationV1() authenticationv1.AuthenticationV1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) AuthenticationV1beta1() authenticationv1beta1.AuthenticationV1beta1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) AuthorizationV1() authorizationv1.AuthorizationV1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) AuthorizationV1beta1() authorizationv1beta1.AuthorizationV1beta1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) AutoscalingV1() autoscalingv1.AutoscalingV1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) AutoscalingV2() autoscalingv2.AutoscalingV2Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) AutoscalingV2beta1() autoscalingv2beta1.AutoscalingV2beta1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) AutoscalingV2beta2() autoscalingv2beta2.AutoscalingV2beta2Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) BatchV1() batchv1.BatchV1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) BatchV1beta1() batchv1beta1.BatchV1beta1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) CertificatesV1() certificatesv1.CertificatesV1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) CertificatesV1alpha1() certificatesv1alpha1.CertificatesV1alpha1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) CertificatesV1beta1() certificatesv1beta1.CertificatesV1beta1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) CoordinationV1alpha2() coordinationv1alpha2.CoordinationV1alpha2Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) CoordinationV1beta1() coordinationv1beta1.CoordinationV1beta1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) CoordinationV1() coordinationv1.CoordinationV1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) CoreV1() corev1.CoreV1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) DiscoveryV1() discoveryv1.DiscoveryV1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) DiscoveryV1beta1() discoveryv1beta1.DiscoveryV1beta1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) EventsV1() eventsv1.EventsV1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) EventsV1beta1() eventsv1beta1.EventsV1beta1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) ExtensionsV1beta1() extensionsv1beta1.ExtensionsV1beta1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) FlowcontrolV1beta1() flowcontrolv1beta1.FlowcontrolV1beta1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) FlowcontrolV1beta2() flowcontrolv1beta2.FlowcontrolV1beta2Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) FlowcontrolV1beta3() flowcontrolv1beta3.FlowcontrolV1beta3Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) FlowcontrolV1() flowcontrolv1.FlowcontrolV1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) NetworkingV1() networkingv1.NetworkingV1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) NetworkingV1beta1() networkingv1beta1.NetworkingV1beta1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) NodeV1() nodev1.NodeV1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) NodeV1alpha1() nodev1alpha1.NodeV1alpha1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) NodeV1beta1() nodev1beta1.NodeV1beta1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) PolicyV1() policyv1.PolicyV1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) PolicyV1beta1() policyv1beta1.PolicyV1beta1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) RbacV1() rbacv1.RbacV1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) RbacV1beta1() rbacv1beta1.RbacV1beta1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) RbacV1alpha1() rbacv1alpha1.RbacV1alpha1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) SchedulingV1alpha1() schedulingv1alpha1.SchedulingV1alpha1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) SchedulingV1beta1() schedulingv1beta1.SchedulingV1beta1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) SchedulingV1() schedulingv1.SchedulingV1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) StorageV1beta1() storagev1beta1.StorageV1beta1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) StorageV1() storagev1.StorageV1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) StorageV1alpha1() storagev1alpha1.StorageV1alpha1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) StoragemigrationV1alpha1() storagemigrationv1alpha1.StoragemigrationV1alpha1Interface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) Discovery() discovery.DiscoveryInterface { | ||
panic("programmer error: using a cluster-unaware clientset, need to cast this to use the cluster-aware one!") | ||
} | ||
|
||
func (h *hack) ClusterAware() kcpkubernetesclientset.ClusterInterface { | ||
return h.clusterAware | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
Copyright 2023 The KCP Authors. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// +kcp-code-generator:skip | ||
|
||
package dynamichack | ||
|
||
import ( | ||
kcpdynamic "github.com/kcp-dev/client-go/dynamic" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"k8s.io/client-go/dynamic" | ||
) | ||
|
||
// Interface allows us to hold onto a strongly-typed cluster-aware clients here, while | ||
// passing in a cluster-unaware (but non-functional) clients to k8s libraries. We export this type so that we | ||
// can get the cluster-aware clients back using casting in admission plugin initialization. | ||
type Interface interface { | ||
dynamic.Interface | ||
ClusterAware() kcpdynamic.ClusterInterface | ||
} | ||
|
||
var _ Interface = (*hack)(nil) | ||
|
||
// Wrap adapts a cluster-aware dynamic client to a cluster-unaware wrapper that can divulge it after casting. | ||
func Wrap(clusterAware kcpdynamic.ClusterInterface) Interface { | ||
return &hack{clusterAware: clusterAware} | ||
} | ||
|
||
// Unwrap extracts a cluster-aware dynamic client from the cluster-unaware wrapper, or panics if we get the wrong input. | ||
func Unwrap(clusterUnaware dynamic.Interface) kcpdynamic.ClusterInterface { | ||
return clusterUnaware.(Interface).ClusterAware() | ||
} | ||
|
||
type hack struct { | ||
clusterAware kcpdynamic.ClusterInterface | ||
} | ||
|
||
func (h hack) Resource(resource schema.GroupVersionResource) dynamic.NamespaceableResourceInterface { | ||
panic("programmer error: using a cluster-unaware dynamic client, need to cast this to use the cluster-aware one!") | ||
|
||
} | ||
|
||
func (h hack) ClusterAware() kcpdynamic.ClusterInterface { | ||
panic("programmer error: using a cluster-unaware dynamic, need to cast this to use the cluster-aware one!") | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im surprised this didn't changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
Interface
interface seems to still have that method in upstream's v1.32: https://github.com/kubernetes/kubernetes/blob/v1.32.0/staging/src/k8s.io/client-go/kubernetes/clientset.go#L27Unless you meant something else, @mjudeikis ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean no new types were added/removed in 1.32.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git diff kcp-1.31.0..kcp-1.32-pre.7-review -- staging/src/k8s.io/apiserver/pkg/clientsethack/adapter.go
says that:coordinationV1alpha1
was replaced bycoordinationV1alpha2
, andresourceV1beta1
was addedShould I document this somewhere?