repo
stringlengths
6
47
file_url
stringlengths
77
269
file_path
stringlengths
5
186
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-07 08:35:43
2026-01-07 08:55:24
truncated
bool
2 classes
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/admissionregistration/v1alpha1/mutatingadmissionpolicy.go
vendor/k8s.io/client-go/listers/admissionregistration/v1alpha1/mutatingadmissionpolicy.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1alpha1 import ( admissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" ) // MutatingAdmissionPolicyLister helps list MutatingAdmissionPolicies. // All objects returned here must be treated as read-only. type MutatingAdmissionPolicyLister interface { // List lists all MutatingAdmissionPolicies in the indexer. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*admissionregistrationv1alpha1.MutatingAdmissionPolicy, err error) // Get retrieves the MutatingAdmissionPolicy from the index for a given name. // Objects returned here must be treated as read-only. Get(name string) (*admissionregistrationv1alpha1.MutatingAdmissionPolicy, error) MutatingAdmissionPolicyListerExpansion } // mutatingAdmissionPolicyLister implements the MutatingAdmissionPolicyLister interface. type mutatingAdmissionPolicyLister struct { listers.ResourceIndexer[*admissionregistrationv1alpha1.MutatingAdmissionPolicy] } // NewMutatingAdmissionPolicyLister returns a new MutatingAdmissionPolicyLister. func NewMutatingAdmissionPolicyLister(indexer cache.Indexer) MutatingAdmissionPolicyLister { return &mutatingAdmissionPolicyLister{listers.New[*admissionregistrationv1alpha1.MutatingAdmissionPolicy](indexer, admissionregistrationv1alpha1.Resource("mutatingadmissionpolicy"))} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/admissionregistration/v1alpha1/validatingadmissionpolicy.go
vendor/k8s.io/client-go/listers/admissionregistration/v1alpha1/validatingadmissionpolicy.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1alpha1 import ( admissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" ) // ValidatingAdmissionPolicyLister helps list ValidatingAdmissionPolicies. // All objects returned here must be treated as read-only. type ValidatingAdmissionPolicyLister interface { // List lists all ValidatingAdmissionPolicies in the indexer. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*admissionregistrationv1alpha1.ValidatingAdmissionPolicy, err error) // Get retrieves the ValidatingAdmissionPolicy from the index for a given name. // Objects returned here must be treated as read-only. Get(name string) (*admissionregistrationv1alpha1.ValidatingAdmissionPolicy, error) ValidatingAdmissionPolicyListerExpansion } // validatingAdmissionPolicyLister implements the ValidatingAdmissionPolicyLister interface. type validatingAdmissionPolicyLister struct { listers.ResourceIndexer[*admissionregistrationv1alpha1.ValidatingAdmissionPolicy] } // NewValidatingAdmissionPolicyLister returns a new ValidatingAdmissionPolicyLister. func NewValidatingAdmissionPolicyLister(indexer cache.Indexer) ValidatingAdmissionPolicyLister { return &validatingAdmissionPolicyLister{listers.New[*admissionregistrationv1alpha1.ValidatingAdmissionPolicy](indexer, admissionregistrationv1alpha1.Resource("validatingadmissionpolicy"))} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/admissionregistration/v1/expansion_generated.go
vendor/k8s.io/client-go/listers/admissionregistration/v1/expansion_generated.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1 // MutatingWebhookConfigurationListerExpansion allows custom methods to be added to // MutatingWebhookConfigurationLister. type MutatingWebhookConfigurationListerExpansion interface{} // ValidatingAdmissionPolicyListerExpansion allows custom methods to be added to // ValidatingAdmissionPolicyLister. type ValidatingAdmissionPolicyListerExpansion interface{} // ValidatingAdmissionPolicyBindingListerExpansion allows custom methods to be added to // ValidatingAdmissionPolicyBindingLister. type ValidatingAdmissionPolicyBindingListerExpansion interface{} // ValidatingWebhookConfigurationListerExpansion allows custom methods to be added to // ValidatingWebhookConfigurationLister. type ValidatingWebhookConfigurationListerExpansion interface{}
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/admissionregistration/v1/validatingadmissionpolicybinding.go
vendor/k8s.io/client-go/listers/admissionregistration/v1/validatingadmissionpolicybinding.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1 import ( admissionregistrationv1 "k8s.io/api/admissionregistration/v1" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" ) // ValidatingAdmissionPolicyBindingLister helps list ValidatingAdmissionPolicyBindings. // All objects returned here must be treated as read-only. type ValidatingAdmissionPolicyBindingLister interface { // List lists all ValidatingAdmissionPolicyBindings in the indexer. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*admissionregistrationv1.ValidatingAdmissionPolicyBinding, err error) // Get retrieves the ValidatingAdmissionPolicyBinding from the index for a given name. // Objects returned here must be treated as read-only. Get(name string) (*admissionregistrationv1.ValidatingAdmissionPolicyBinding, error) ValidatingAdmissionPolicyBindingListerExpansion } // validatingAdmissionPolicyBindingLister implements the ValidatingAdmissionPolicyBindingLister interface. type validatingAdmissionPolicyBindingLister struct { listers.ResourceIndexer[*admissionregistrationv1.ValidatingAdmissionPolicyBinding] } // NewValidatingAdmissionPolicyBindingLister returns a new ValidatingAdmissionPolicyBindingLister. func NewValidatingAdmissionPolicyBindingLister(indexer cache.Indexer) ValidatingAdmissionPolicyBindingLister { return &validatingAdmissionPolicyBindingLister{listers.New[*admissionregistrationv1.ValidatingAdmissionPolicyBinding](indexer, admissionregistrationv1.Resource("validatingadmissionpolicybinding"))} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/admissionregistration/v1/mutatingwebhookconfiguration.go
vendor/k8s.io/client-go/listers/admissionregistration/v1/mutatingwebhookconfiguration.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1 import ( admissionregistrationv1 "k8s.io/api/admissionregistration/v1" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" ) // MutatingWebhookConfigurationLister helps list MutatingWebhookConfigurations. // All objects returned here must be treated as read-only. type MutatingWebhookConfigurationLister interface { // List lists all MutatingWebhookConfigurations in the indexer. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*admissionregistrationv1.MutatingWebhookConfiguration, err error) // Get retrieves the MutatingWebhookConfiguration from the index for a given name. // Objects returned here must be treated as read-only. Get(name string) (*admissionregistrationv1.MutatingWebhookConfiguration, error) MutatingWebhookConfigurationListerExpansion } // mutatingWebhookConfigurationLister implements the MutatingWebhookConfigurationLister interface. type mutatingWebhookConfigurationLister struct { listers.ResourceIndexer[*admissionregistrationv1.MutatingWebhookConfiguration] } // NewMutatingWebhookConfigurationLister returns a new MutatingWebhookConfigurationLister. func NewMutatingWebhookConfigurationLister(indexer cache.Indexer) MutatingWebhookConfigurationLister { return &mutatingWebhookConfigurationLister{listers.New[*admissionregistrationv1.MutatingWebhookConfiguration](indexer, admissionregistrationv1.Resource("mutatingwebhookconfiguration"))} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/admissionregistration/v1/validatingadmissionpolicy.go
vendor/k8s.io/client-go/listers/admissionregistration/v1/validatingadmissionpolicy.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1 import ( admissionregistrationv1 "k8s.io/api/admissionregistration/v1" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" ) // ValidatingAdmissionPolicyLister helps list ValidatingAdmissionPolicies. // All objects returned here must be treated as read-only. type ValidatingAdmissionPolicyLister interface { // List lists all ValidatingAdmissionPolicies in the indexer. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*admissionregistrationv1.ValidatingAdmissionPolicy, err error) // Get retrieves the ValidatingAdmissionPolicy from the index for a given name. // Objects returned here must be treated as read-only. Get(name string) (*admissionregistrationv1.ValidatingAdmissionPolicy, error) ValidatingAdmissionPolicyListerExpansion } // validatingAdmissionPolicyLister implements the ValidatingAdmissionPolicyLister interface. type validatingAdmissionPolicyLister struct { listers.ResourceIndexer[*admissionregistrationv1.ValidatingAdmissionPolicy] } // NewValidatingAdmissionPolicyLister returns a new ValidatingAdmissionPolicyLister. func NewValidatingAdmissionPolicyLister(indexer cache.Indexer) ValidatingAdmissionPolicyLister { return &validatingAdmissionPolicyLister{listers.New[*admissionregistrationv1.ValidatingAdmissionPolicy](indexer, admissionregistrationv1.Resource("validatingadmissionpolicy"))} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/admissionregistration/v1/validatingwebhookconfiguration.go
vendor/k8s.io/client-go/listers/admissionregistration/v1/validatingwebhookconfiguration.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1 import ( admissionregistrationv1 "k8s.io/api/admissionregistration/v1" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" ) // ValidatingWebhookConfigurationLister helps list ValidatingWebhookConfigurations. // All objects returned here must be treated as read-only. type ValidatingWebhookConfigurationLister interface { // List lists all ValidatingWebhookConfigurations in the indexer. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*admissionregistrationv1.ValidatingWebhookConfiguration, err error) // Get retrieves the ValidatingWebhookConfiguration from the index for a given name. // Objects returned here must be treated as read-only. Get(name string) (*admissionregistrationv1.ValidatingWebhookConfiguration, error) ValidatingWebhookConfigurationListerExpansion } // validatingWebhookConfigurationLister implements the ValidatingWebhookConfigurationLister interface. type validatingWebhookConfigurationLister struct { listers.ResourceIndexer[*admissionregistrationv1.ValidatingWebhookConfiguration] } // NewValidatingWebhookConfigurationLister returns a new ValidatingWebhookConfigurationLister. func NewValidatingWebhookConfigurationLister(indexer cache.Indexer) ValidatingWebhookConfigurationLister { return &validatingWebhookConfigurationLister{listers.New[*admissionregistrationv1.ValidatingWebhookConfiguration](indexer, admissionregistrationv1.Resource("validatingwebhookconfiguration"))} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/expansion_generated.go
vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/expansion_generated.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1beta1 // MutatingWebhookConfigurationListerExpansion allows custom methods to be added to // MutatingWebhookConfigurationLister. type MutatingWebhookConfigurationListerExpansion interface{} // ValidatingAdmissionPolicyListerExpansion allows custom methods to be added to // ValidatingAdmissionPolicyLister. type ValidatingAdmissionPolicyListerExpansion interface{} // ValidatingAdmissionPolicyBindingListerExpansion allows custom methods to be added to // ValidatingAdmissionPolicyBindingLister. type ValidatingAdmissionPolicyBindingListerExpansion interface{} // ValidatingWebhookConfigurationListerExpansion allows custom methods to be added to // ValidatingWebhookConfigurationLister. type ValidatingWebhookConfigurationListerExpansion interface{}
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/validatingadmissionpolicybinding.go
vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/validatingadmissionpolicybinding.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1beta1 import ( admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" ) // ValidatingAdmissionPolicyBindingLister helps list ValidatingAdmissionPolicyBindings. // All objects returned here must be treated as read-only. type ValidatingAdmissionPolicyBindingLister interface { // List lists all ValidatingAdmissionPolicyBindings in the indexer. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*admissionregistrationv1beta1.ValidatingAdmissionPolicyBinding, err error) // Get retrieves the ValidatingAdmissionPolicyBinding from the index for a given name. // Objects returned here must be treated as read-only. Get(name string) (*admissionregistrationv1beta1.ValidatingAdmissionPolicyBinding, error) ValidatingAdmissionPolicyBindingListerExpansion } // validatingAdmissionPolicyBindingLister implements the ValidatingAdmissionPolicyBindingLister interface. type validatingAdmissionPolicyBindingLister struct { listers.ResourceIndexer[*admissionregistrationv1beta1.ValidatingAdmissionPolicyBinding] } // NewValidatingAdmissionPolicyBindingLister returns a new ValidatingAdmissionPolicyBindingLister. func NewValidatingAdmissionPolicyBindingLister(indexer cache.Indexer) ValidatingAdmissionPolicyBindingLister { return &validatingAdmissionPolicyBindingLister{listers.New[*admissionregistrationv1beta1.ValidatingAdmissionPolicyBinding](indexer, admissionregistrationv1beta1.Resource("validatingadmissionpolicybinding"))} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go
vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1beta1 import ( admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" ) // MutatingWebhookConfigurationLister helps list MutatingWebhookConfigurations. // All objects returned here must be treated as read-only. type MutatingWebhookConfigurationLister interface { // List lists all MutatingWebhookConfigurations in the indexer. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*admissionregistrationv1beta1.MutatingWebhookConfiguration, err error) // Get retrieves the MutatingWebhookConfiguration from the index for a given name. // Objects returned here must be treated as read-only. Get(name string) (*admissionregistrationv1beta1.MutatingWebhookConfiguration, error) MutatingWebhookConfigurationListerExpansion } // mutatingWebhookConfigurationLister implements the MutatingWebhookConfigurationLister interface. type mutatingWebhookConfigurationLister struct { listers.ResourceIndexer[*admissionregistrationv1beta1.MutatingWebhookConfiguration] } // NewMutatingWebhookConfigurationLister returns a new MutatingWebhookConfigurationLister. func NewMutatingWebhookConfigurationLister(indexer cache.Indexer) MutatingWebhookConfigurationLister { return &mutatingWebhookConfigurationLister{listers.New[*admissionregistrationv1beta1.MutatingWebhookConfiguration](indexer, admissionregistrationv1beta1.Resource("mutatingwebhookconfiguration"))} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/validatingadmissionpolicy.go
vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/validatingadmissionpolicy.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1beta1 import ( admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" ) // ValidatingAdmissionPolicyLister helps list ValidatingAdmissionPolicies. // All objects returned here must be treated as read-only. type ValidatingAdmissionPolicyLister interface { // List lists all ValidatingAdmissionPolicies in the indexer. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*admissionregistrationv1beta1.ValidatingAdmissionPolicy, err error) // Get retrieves the ValidatingAdmissionPolicy from the index for a given name. // Objects returned here must be treated as read-only. Get(name string) (*admissionregistrationv1beta1.ValidatingAdmissionPolicy, error) ValidatingAdmissionPolicyListerExpansion } // validatingAdmissionPolicyLister implements the ValidatingAdmissionPolicyLister interface. type validatingAdmissionPolicyLister struct { listers.ResourceIndexer[*admissionregistrationv1beta1.ValidatingAdmissionPolicy] } // NewValidatingAdmissionPolicyLister returns a new ValidatingAdmissionPolicyLister. func NewValidatingAdmissionPolicyLister(indexer cache.Indexer) ValidatingAdmissionPolicyLister { return &validatingAdmissionPolicyLister{listers.New[*admissionregistrationv1beta1.ValidatingAdmissionPolicy](indexer, admissionregistrationv1beta1.Resource("validatingadmissionpolicy"))} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/validatingwebhookconfiguration.go
vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/validatingwebhookconfiguration.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1beta1 import ( admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" ) // ValidatingWebhookConfigurationLister helps list ValidatingWebhookConfigurations. // All objects returned here must be treated as read-only. type ValidatingWebhookConfigurationLister interface { // List lists all ValidatingWebhookConfigurations in the indexer. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*admissionregistrationv1beta1.ValidatingWebhookConfiguration, err error) // Get retrieves the ValidatingWebhookConfiguration from the index for a given name. // Objects returned here must be treated as read-only. Get(name string) (*admissionregistrationv1beta1.ValidatingWebhookConfiguration, error) ValidatingWebhookConfigurationListerExpansion } // validatingWebhookConfigurationLister implements the ValidatingWebhookConfigurationLister interface. type validatingWebhookConfigurationLister struct { listers.ResourceIndexer[*admissionregistrationv1beta1.ValidatingWebhookConfiguration] } // NewValidatingWebhookConfigurationLister returns a new ValidatingWebhookConfigurationLister. func NewValidatingWebhookConfigurationLister(indexer cache.Indexer) ValidatingWebhookConfigurationLister { return &validatingWebhookConfigurationLister{listers.New[*admissionregistrationv1beta1.ValidatingWebhookConfiguration](indexer, admissionregistrationv1beta1.Resource("validatingwebhookconfiguration"))} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/storagemigration/v1alpha1/expansion_generated.go
vendor/k8s.io/client-go/listers/storagemigration/v1alpha1/expansion_generated.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1alpha1 // StorageVersionMigrationListerExpansion allows custom methods to be added to // StorageVersionMigrationLister. type StorageVersionMigrationListerExpansion interface{}
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/storagemigration/v1alpha1/storageversionmigration.go
vendor/k8s.io/client-go/listers/storagemigration/v1alpha1/storageversionmigration.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1alpha1 import ( storagemigrationv1alpha1 "k8s.io/api/storagemigration/v1alpha1" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" ) // StorageVersionMigrationLister helps list StorageVersionMigrations. // All objects returned here must be treated as read-only. type StorageVersionMigrationLister interface { // List lists all StorageVersionMigrations in the indexer. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*storagemigrationv1alpha1.StorageVersionMigration, err error) // Get retrieves the StorageVersionMigration from the index for a given name. // Objects returned here must be treated as read-only. Get(name string) (*storagemigrationv1alpha1.StorageVersionMigration, error) StorageVersionMigrationListerExpansion } // storageVersionMigrationLister implements the StorageVersionMigrationLister interface. type storageVersionMigrationLister struct { listers.ResourceIndexer[*storagemigrationv1alpha1.StorageVersionMigration] } // NewStorageVersionMigrationLister returns a new StorageVersionMigrationLister. func NewStorageVersionMigrationLister(indexer cache.Indexer) StorageVersionMigrationLister { return &storageVersionMigrationLister{listers.New[*storagemigrationv1alpha1.StorageVersionMigration](indexer, storagemigrationv1alpha1.Resource("storageversionmigration"))} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/coordination/v1/lease.go
vendor/k8s.io/client-go/listers/coordination/v1/lease.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1 import ( coordinationv1 "k8s.io/api/coordination/v1" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" ) // LeaseLister helps list Leases. // All objects returned here must be treated as read-only. type LeaseLister interface { // List lists all Leases in the indexer. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*coordinationv1.Lease, err error) // Leases returns an object that can list and get Leases. Leases(namespace string) LeaseNamespaceLister LeaseListerExpansion } // leaseLister implements the LeaseLister interface. type leaseLister struct { listers.ResourceIndexer[*coordinationv1.Lease] } // NewLeaseLister returns a new LeaseLister. func NewLeaseLister(indexer cache.Indexer) LeaseLister { return &leaseLister{listers.New[*coordinationv1.Lease](indexer, coordinationv1.Resource("lease"))} } // Leases returns an object that can list and get Leases. func (s *leaseLister) Leases(namespace string) LeaseNamespaceLister { return leaseNamespaceLister{listers.NewNamespaced[*coordinationv1.Lease](s.ResourceIndexer, namespace)} } // LeaseNamespaceLister helps list and get Leases. // All objects returned here must be treated as read-only. type LeaseNamespaceLister interface { // List lists all Leases in the indexer for a given namespace. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*coordinationv1.Lease, err error) // Get retrieves the Lease from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. Get(name string) (*coordinationv1.Lease, error) LeaseNamespaceListerExpansion } // leaseNamespaceLister implements the LeaseNamespaceLister // interface. type leaseNamespaceLister struct { listers.ResourceIndexer[*coordinationv1.Lease] }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/coordination/v1/expansion_generated.go
vendor/k8s.io/client-go/listers/coordination/v1/expansion_generated.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1 // LeaseListerExpansion allows custom methods to be added to // LeaseLister. type LeaseListerExpansion interface{} // LeaseNamespaceListerExpansion allows custom methods to be added to // LeaseNamespaceLister. type LeaseNamespaceListerExpansion interface{}
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/coordination/v1beta1/lease.go
vendor/k8s.io/client-go/listers/coordination/v1beta1/lease.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1beta1 import ( coordinationv1beta1 "k8s.io/api/coordination/v1beta1" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" ) // LeaseLister helps list Leases. // All objects returned here must be treated as read-only. type LeaseLister interface { // List lists all Leases in the indexer. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*coordinationv1beta1.Lease, err error) // Leases returns an object that can list and get Leases. Leases(namespace string) LeaseNamespaceLister LeaseListerExpansion } // leaseLister implements the LeaseLister interface. type leaseLister struct { listers.ResourceIndexer[*coordinationv1beta1.Lease] } // NewLeaseLister returns a new LeaseLister. func NewLeaseLister(indexer cache.Indexer) LeaseLister { return &leaseLister{listers.New[*coordinationv1beta1.Lease](indexer, coordinationv1beta1.Resource("lease"))} } // Leases returns an object that can list and get Leases. func (s *leaseLister) Leases(namespace string) LeaseNamespaceLister { return leaseNamespaceLister{listers.NewNamespaced[*coordinationv1beta1.Lease](s.ResourceIndexer, namespace)} } // LeaseNamespaceLister helps list and get Leases. // All objects returned here must be treated as read-only. type LeaseNamespaceLister interface { // List lists all Leases in the indexer for a given namespace. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*coordinationv1beta1.Lease, err error) // Get retrieves the Lease from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. Get(name string) (*coordinationv1beta1.Lease, error) LeaseNamespaceListerExpansion } // leaseNamespaceLister implements the LeaseNamespaceLister // interface. type leaseNamespaceLister struct { listers.ResourceIndexer[*coordinationv1beta1.Lease] }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/coordination/v1beta1/expansion_generated.go
vendor/k8s.io/client-go/listers/coordination/v1beta1/expansion_generated.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1beta1 // LeaseListerExpansion allows custom methods to be added to // LeaseLister. type LeaseListerExpansion interface{} // LeaseNamespaceListerExpansion allows custom methods to be added to // LeaseNamespaceLister. type LeaseNamespaceListerExpansion interface{}
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/coordination/v1alpha2/expansion_generated.go
vendor/k8s.io/client-go/listers/coordination/v1alpha2/expansion_generated.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1alpha2 // LeaseCandidateListerExpansion allows custom methods to be added to // LeaseCandidateLister. type LeaseCandidateListerExpansion interface{} // LeaseCandidateNamespaceListerExpansion allows custom methods to be added to // LeaseCandidateNamespaceLister. type LeaseCandidateNamespaceListerExpansion interface{}
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/coordination/v1alpha2/leasecandidate.go
vendor/k8s.io/client-go/listers/coordination/v1alpha2/leasecandidate.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1alpha2 import ( coordinationv1alpha2 "k8s.io/api/coordination/v1alpha2" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" ) // LeaseCandidateLister helps list LeaseCandidates. // All objects returned here must be treated as read-only. type LeaseCandidateLister interface { // List lists all LeaseCandidates in the indexer. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*coordinationv1alpha2.LeaseCandidate, err error) // LeaseCandidates returns an object that can list and get LeaseCandidates. LeaseCandidates(namespace string) LeaseCandidateNamespaceLister LeaseCandidateListerExpansion } // leaseCandidateLister implements the LeaseCandidateLister interface. type leaseCandidateLister struct { listers.ResourceIndexer[*coordinationv1alpha2.LeaseCandidate] } // NewLeaseCandidateLister returns a new LeaseCandidateLister. func NewLeaseCandidateLister(indexer cache.Indexer) LeaseCandidateLister { return &leaseCandidateLister{listers.New[*coordinationv1alpha2.LeaseCandidate](indexer, coordinationv1alpha2.Resource("leasecandidate"))} } // LeaseCandidates returns an object that can list and get LeaseCandidates. func (s *leaseCandidateLister) LeaseCandidates(namespace string) LeaseCandidateNamespaceLister { return leaseCandidateNamespaceLister{listers.NewNamespaced[*coordinationv1alpha2.LeaseCandidate](s.ResourceIndexer, namespace)} } // LeaseCandidateNamespaceLister helps list and get LeaseCandidates. // All objects returned here must be treated as read-only. type LeaseCandidateNamespaceLister interface { // List lists all LeaseCandidates in the indexer for a given namespace. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*coordinationv1alpha2.LeaseCandidate, err error) // Get retrieves the LeaseCandidate from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. Get(name string) (*coordinationv1alpha2.LeaseCandidate, error) LeaseCandidateNamespaceListerExpansion } // leaseCandidateNamespaceLister implements the LeaseCandidateNamespaceLister // interface. type leaseCandidateNamespaceLister struct { listers.ResourceIndexer[*coordinationv1alpha2.LeaseCandidate] }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/policy/v1/poddisruptionbudget.go
vendor/k8s.io/client-go/listers/policy/v1/poddisruptionbudget.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1 import ( policyv1 "k8s.io/api/policy/v1" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" ) // PodDisruptionBudgetLister helps list PodDisruptionBudgets. // All objects returned here must be treated as read-only. type PodDisruptionBudgetLister interface { // List lists all PodDisruptionBudgets in the indexer. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*policyv1.PodDisruptionBudget, err error) // PodDisruptionBudgets returns an object that can list and get PodDisruptionBudgets. PodDisruptionBudgets(namespace string) PodDisruptionBudgetNamespaceLister PodDisruptionBudgetListerExpansion } // podDisruptionBudgetLister implements the PodDisruptionBudgetLister interface. type podDisruptionBudgetLister struct { listers.ResourceIndexer[*policyv1.PodDisruptionBudget] } // NewPodDisruptionBudgetLister returns a new PodDisruptionBudgetLister. func NewPodDisruptionBudgetLister(indexer cache.Indexer) PodDisruptionBudgetLister { return &podDisruptionBudgetLister{listers.New[*policyv1.PodDisruptionBudget](indexer, policyv1.Resource("poddisruptionbudget"))} } // PodDisruptionBudgets returns an object that can list and get PodDisruptionBudgets. func (s *podDisruptionBudgetLister) PodDisruptionBudgets(namespace string) PodDisruptionBudgetNamespaceLister { return podDisruptionBudgetNamespaceLister{listers.NewNamespaced[*policyv1.PodDisruptionBudget](s.ResourceIndexer, namespace)} } // PodDisruptionBudgetNamespaceLister helps list and get PodDisruptionBudgets. // All objects returned here must be treated as read-only. type PodDisruptionBudgetNamespaceLister interface { // List lists all PodDisruptionBudgets in the indexer for a given namespace. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*policyv1.PodDisruptionBudget, err error) // Get retrieves the PodDisruptionBudget from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. Get(name string) (*policyv1.PodDisruptionBudget, error) PodDisruptionBudgetNamespaceListerExpansion } // podDisruptionBudgetNamespaceLister implements the PodDisruptionBudgetNamespaceLister // interface. type podDisruptionBudgetNamespaceLister struct { listers.ResourceIndexer[*policyv1.PodDisruptionBudget] }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/policy/v1/expansion_generated.go
vendor/k8s.io/client-go/listers/policy/v1/expansion_generated.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1 // EvictionListerExpansion allows custom methods to be added to // EvictionLister. type EvictionListerExpansion interface{} // EvictionNamespaceListerExpansion allows custom methods to be added to // EvictionNamespaceLister. type EvictionNamespaceListerExpansion interface{}
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/policy/v1/poddisruptionbudget_expansion.go
vendor/k8s.io/client-go/listers/policy/v1/poddisruptionbudget_expansion.go
/* Copyright 2021 The Kubernetes 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. */ package v1 import ( "fmt" "k8s.io/api/core/v1" policy "k8s.io/api/policy/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" ) // PodDisruptionBudgetListerExpansion allows custom methods to be added to // PodDisruptionBudgetLister. type PodDisruptionBudgetListerExpansion interface { GetPodPodDisruptionBudgets(pod *v1.Pod) ([]*policy.PodDisruptionBudget, error) } // PodDisruptionBudgetNamespaceListerExpansion allows custom methods to be added to // PodDisruptionBudgetNamespaceLister. type PodDisruptionBudgetNamespaceListerExpansion interface{} // GetPodPodDisruptionBudgets returns a list of PodDisruptionBudgets matching a pod. func (s *podDisruptionBudgetLister) GetPodPodDisruptionBudgets(pod *v1.Pod) ([]*policy.PodDisruptionBudget, error) { var selector labels.Selector list, err := s.PodDisruptionBudgets(pod.Namespace).List(labels.Everything()) if err != nil { return nil, err } var pdbList []*policy.PodDisruptionBudget for i := range list { pdb := list[i] selector, err = metav1.LabelSelectorAsSelector(pdb.Spec.Selector) if err != nil { // This object has an invalid selector, it does not match the pod continue } // Unlike the v1beta version, here we let an empty selector match everything. if !selector.Matches(labels.Set(pod.Labels)) { continue } pdbList = append(pdbList, pdb) } if len(pdbList) == 0 { return nil, fmt.Errorf("could not find PodDisruptionBudget for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) } return pdbList, nil }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/policy/v1/eviction.go
vendor/k8s.io/client-go/listers/policy/v1/eviction.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1 import ( policyv1 "k8s.io/api/policy/v1" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" ) // EvictionLister helps list Evictions. // All objects returned here must be treated as read-only. type EvictionLister interface { // List lists all Evictions in the indexer. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*policyv1.Eviction, err error) // Evictions returns an object that can list and get Evictions. Evictions(namespace string) EvictionNamespaceLister EvictionListerExpansion } // evictionLister implements the EvictionLister interface. type evictionLister struct { listers.ResourceIndexer[*policyv1.Eviction] } // NewEvictionLister returns a new EvictionLister. func NewEvictionLister(indexer cache.Indexer) EvictionLister { return &evictionLister{listers.New[*policyv1.Eviction](indexer, policyv1.Resource("eviction"))} } // Evictions returns an object that can list and get Evictions. func (s *evictionLister) Evictions(namespace string) EvictionNamespaceLister { return evictionNamespaceLister{listers.NewNamespaced[*policyv1.Eviction](s.ResourceIndexer, namespace)} } // EvictionNamespaceLister helps list and get Evictions. // All objects returned here must be treated as read-only. type EvictionNamespaceLister interface { // List lists all Evictions in the indexer for a given namespace. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*policyv1.Eviction, err error) // Get retrieves the Eviction from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. Get(name string) (*policyv1.Eviction, error) EvictionNamespaceListerExpansion } // evictionNamespaceLister implements the EvictionNamespaceLister // interface. type evictionNamespaceLister struct { listers.ResourceIndexer[*policyv1.Eviction] }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/policy/v1beta1/poddisruptionbudget.go
vendor/k8s.io/client-go/listers/policy/v1beta1/poddisruptionbudget.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1beta1 import ( policyv1beta1 "k8s.io/api/policy/v1beta1" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" ) // PodDisruptionBudgetLister helps list PodDisruptionBudgets. // All objects returned here must be treated as read-only. type PodDisruptionBudgetLister interface { // List lists all PodDisruptionBudgets in the indexer. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*policyv1beta1.PodDisruptionBudget, err error) // PodDisruptionBudgets returns an object that can list and get PodDisruptionBudgets. PodDisruptionBudgets(namespace string) PodDisruptionBudgetNamespaceLister PodDisruptionBudgetListerExpansion } // podDisruptionBudgetLister implements the PodDisruptionBudgetLister interface. type podDisruptionBudgetLister struct { listers.ResourceIndexer[*policyv1beta1.PodDisruptionBudget] } // NewPodDisruptionBudgetLister returns a new PodDisruptionBudgetLister. func NewPodDisruptionBudgetLister(indexer cache.Indexer) PodDisruptionBudgetLister { return &podDisruptionBudgetLister{listers.New[*policyv1beta1.PodDisruptionBudget](indexer, policyv1beta1.Resource("poddisruptionbudget"))} } // PodDisruptionBudgets returns an object that can list and get PodDisruptionBudgets. func (s *podDisruptionBudgetLister) PodDisruptionBudgets(namespace string) PodDisruptionBudgetNamespaceLister { return podDisruptionBudgetNamespaceLister{listers.NewNamespaced[*policyv1beta1.PodDisruptionBudget](s.ResourceIndexer, namespace)} } // PodDisruptionBudgetNamespaceLister helps list and get PodDisruptionBudgets. // All objects returned here must be treated as read-only. type PodDisruptionBudgetNamespaceLister interface { // List lists all PodDisruptionBudgets in the indexer for a given namespace. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*policyv1beta1.PodDisruptionBudget, err error) // Get retrieves the PodDisruptionBudget from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. Get(name string) (*policyv1beta1.PodDisruptionBudget, error) PodDisruptionBudgetNamespaceListerExpansion } // podDisruptionBudgetNamespaceLister implements the PodDisruptionBudgetNamespaceLister // interface. type podDisruptionBudgetNamespaceLister struct { listers.ResourceIndexer[*policyv1beta1.PodDisruptionBudget] }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/policy/v1beta1/expansion_generated.go
vendor/k8s.io/client-go/listers/policy/v1beta1/expansion_generated.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1beta1 // EvictionListerExpansion allows custom methods to be added to // EvictionLister. type EvictionListerExpansion interface{} // EvictionNamespaceListerExpansion allows custom methods to be added to // EvictionNamespaceLister. type EvictionNamespaceListerExpansion interface{}
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/policy/v1beta1/poddisruptionbudget_expansion.go
vendor/k8s.io/client-go/listers/policy/v1beta1/poddisruptionbudget_expansion.go
/* Copyright 2017 The Kubernetes 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. */ package v1beta1 import ( "fmt" "k8s.io/api/core/v1" policy "k8s.io/api/policy/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" ) // PodDisruptionBudgetListerExpansion allows custom methods to be added to // PodDisruptionBudgetLister. type PodDisruptionBudgetListerExpansion interface { GetPodPodDisruptionBudgets(pod *v1.Pod) ([]*policy.PodDisruptionBudget, error) } // PodDisruptionBudgetNamespaceListerExpansion allows custom methods to be added to // PodDisruptionBudgetNamespaceLister. type PodDisruptionBudgetNamespaceListerExpansion interface{} // GetPodPodDisruptionBudgets returns a list of PodDisruptionBudgets matching a pod. Returns an error only if no matching PodDisruptionBudgets are found. func (s *podDisruptionBudgetLister) GetPodPodDisruptionBudgets(pod *v1.Pod) ([]*policy.PodDisruptionBudget, error) { var selector labels.Selector list, err := s.PodDisruptionBudgets(pod.Namespace).List(labels.Everything()) if err != nil { return nil, err } var pdbList []*policy.PodDisruptionBudget for i := range list { pdb := list[i] selector, err = metav1.LabelSelectorAsSelector(pdb.Spec.Selector) if err != nil { // This object has an invalid selector, it does not match the pod continue } // If a PDB with a nil or empty selector creeps in, it should match nothing, not everything. if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { continue } pdbList = append(pdbList, pdb) } if len(pdbList) == 0 { return nil, fmt.Errorf("could not find PodDisruptionBudget for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) } return pdbList, nil }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/listers/policy/v1beta1/eviction.go
vendor/k8s.io/client-go/listers/policy/v1beta1/eviction.go
/* Copyright The Kubernetes 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1beta1 import ( policyv1beta1 "k8s.io/api/policy/v1beta1" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" ) // EvictionLister helps list Evictions. // All objects returned here must be treated as read-only. type EvictionLister interface { // List lists all Evictions in the indexer. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*policyv1beta1.Eviction, err error) // Evictions returns an object that can list and get Evictions. Evictions(namespace string) EvictionNamespaceLister EvictionListerExpansion } // evictionLister implements the EvictionLister interface. type evictionLister struct { listers.ResourceIndexer[*policyv1beta1.Eviction] } // NewEvictionLister returns a new EvictionLister. func NewEvictionLister(indexer cache.Indexer) EvictionLister { return &evictionLister{listers.New[*policyv1beta1.Eviction](indexer, policyv1beta1.Resource("eviction"))} } // Evictions returns an object that can list and get Evictions. func (s *evictionLister) Evictions(namespace string) EvictionNamespaceLister { return evictionNamespaceLister{listers.NewNamespaced[*policyv1beta1.Eviction](s.ResourceIndexer, namespace)} } // EvictionNamespaceLister helps list and get Evictions. // All objects returned here must be treated as read-only. type EvictionNamespaceLister interface { // List lists all Evictions in the indexer for a given namespace. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*policyv1beta1.Eviction, err error) // Get retrieves the Eviction from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. Get(name string) (*policyv1beta1.Eviction, error) EvictionNamespaceListerExpansion } // evictionNamespaceLister implements the EvictionNamespaceLister // interface. type evictionNamespaceLister struct { listers.ResourceIndexer[*policyv1beta1.Eviction] }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/rest/request.go
vendor/k8s.io/client-go/rest/request.go
/* Copyright 2014 The Kubernetes 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. */ package rest import ( "bytes" "context" "encoding/base64" "encoding/hex" "fmt" "io" "mime" "net/http" "net/http/httptrace" "net/url" "os" "path" "reflect" "strconv" "strings" "sync" "time" "golang.org/x/net/http2" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/conversion" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer/streaming" "k8s.io/apimachinery/pkg/util/net" "k8s.io/apimachinery/pkg/watch" clientfeatures "k8s.io/client-go/features" restclientwatch "k8s.io/client-go/rest/watch" "k8s.io/client-go/tools/metrics" "k8s.io/client-go/util/flowcontrol" "k8s.io/klog/v2" "k8s.io/utils/clock" ) var ( // longThrottleLatency defines threshold for logging requests. All requests being // throttled (via the provided rateLimiter) for more than longThrottleLatency will // be logged. longThrottleLatency = 50 * time.Millisecond // extraLongThrottleLatency defines the threshold for logging requests at log level 2. extraLongThrottleLatency = 1 * time.Second ) // HTTPClient is an interface for testing a request object. type HTTPClient interface { Do(req *http.Request) (*http.Response, error) } // ResponseWrapper is an interface for getting a response. // The response may be either accessed as a raw data (the whole output is put into memory) or as a stream. type ResponseWrapper interface { DoRaw(context.Context) ([]byte, error) Stream(context.Context) (io.ReadCloser, error) } // RequestConstructionError is returned when there's an error assembling a request. type RequestConstructionError struct { Err error } // Error returns a textual description of 'r'. func (r *RequestConstructionError) Error() string { return fmt.Sprintf("request construction error: '%v'", r.Err) } var noBackoff = &NoBackoff{} type requestRetryFunc func(maxRetries int) WithRetry func defaultRequestRetryFn(maxRetries int) WithRetry { return &withRetry{maxRetries: maxRetries} } // Request allows for building up a request to a server in a chained fashion. // Any errors are stored until the end of your call, so you only have to // check once. type Request struct { c *RESTClient contentConfig ClientContentConfig contentTypeNotSet bool warningHandler WarningHandler rateLimiter flowcontrol.RateLimiter backoff BackoffManager timeout time.Duration maxRetries int // generic components accessible via method setters verb string pathPrefix string subpath string params url.Values headers http.Header // structural elements of the request that are part of the Kubernetes API conventions namespace string namespaceSet bool resource string resourceName string subresource string // output err error // only one of body / bodyBytes may be set. requests using body are not retryable. body io.Reader bodyBytes []byte retryFn requestRetryFunc } // NewRequest creates a new request helper object for accessing runtime.Objects on a server. func NewRequest(c *RESTClient) *Request { var backoff BackoffManager if c.createBackoffMgr != nil { backoff = c.createBackoffMgr() } if backoff == nil { backoff = noBackoff } var pathPrefix string if c.base != nil { pathPrefix = path.Join("/", c.base.Path, c.versionedAPIPath) } else { pathPrefix = path.Join("/", c.versionedAPIPath) } var timeout time.Duration if c.Client != nil { timeout = c.Client.Timeout } // A request needs to know whether the content type was explicitly configured or selected by // default in order to support the per-request Protobuf override used by clients generated // with --prefers-protobuf. contentConfig, contentTypeDefaulted := c.content.GetClientContentConfig() r := &Request{ c: c, rateLimiter: c.rateLimiter, backoff: backoff, timeout: timeout, pathPrefix: pathPrefix, maxRetries: 10, retryFn: defaultRequestRetryFn, warningHandler: c.warningHandler, contentConfig: contentConfig, contentTypeNotSet: contentTypeDefaulted, } r.setAcceptHeader() return r } // NewRequestWithClient creates a Request with an embedded RESTClient for use in test scenarios. func NewRequestWithClient(base *url.URL, versionedAPIPath string, content ClientContentConfig, client *http.Client) *Request { return NewRequest(&RESTClient{ base: base, versionedAPIPath: versionedAPIPath, content: requestClientContentConfigProvider{base: content}, Client: client, }) } func (r *Request) UseProtobufAsDefaultIfPreferred(prefersProtobuf bool) *Request { if prefersProtobuf { return r.UseProtobufAsDefault() } return r } func (r *Request) UseProtobufAsDefault() *Request { if r.contentTypeNotSet && len(r.contentConfig.AcceptContentTypes) == 0 { r.contentConfig.AcceptContentTypes = "application/vnd.kubernetes.protobuf,application/json" r.contentConfig.ContentType = "application/vnd.kubernetes.protobuf" r.setAcceptHeader() } return r } func (r *Request) setAcceptHeader() { switch { case len(r.contentConfig.AcceptContentTypes) > 0: r.SetHeader("Accept", r.contentConfig.AcceptContentTypes) case len(r.contentConfig.ContentType) > 0: r.SetHeader("Accept", r.contentConfig.ContentType+", */*") } } // Verb sets the verb this request will use. func (r *Request) Verb(verb string) *Request { r.verb = verb return r } // Prefix adds segments to the relative beginning to the request path. These // items will be placed before the optional Namespace, Resource, or Name sections. // Setting AbsPath will clear any previously set Prefix segments func (r *Request) Prefix(segments ...string) *Request { if r.err != nil { return r } r.pathPrefix = path.Join(r.pathPrefix, path.Join(segments...)) return r } // Suffix appends segments to the end of the path. These items will be placed after the prefix and optional // Namespace, Resource, or Name sections. func (r *Request) Suffix(segments ...string) *Request { if r.err != nil { return r } r.subpath = path.Join(r.subpath, path.Join(segments...)) return r } // Resource sets the resource to access (<resource>/[ns/<namespace>/]<name>) func (r *Request) Resource(resource string) *Request { if r.err != nil { return r } if len(r.resource) != 0 { r.err = fmt.Errorf("resource already set to %q, cannot change to %q", r.resource, resource) return r } if msgs := IsValidPathSegmentName(resource); len(msgs) != 0 { r.err = fmt.Errorf("invalid resource %q: %v", resource, msgs) return r } r.resource = resource return r } // BackOff sets the request's backoff manager to the one specified, // or defaults to the stub implementation if nil is provided func (r *Request) BackOff(manager BackoffManager) *Request { if manager == nil { r.backoff = &NoBackoff{} return r } r.backoff = manager return r } // WarningHandler sets the handler this client uses when warning headers are encountered. // If set to nil, this client will use the default warning handler (see SetDefaultWarningHandler). func (r *Request) WarningHandler(handler WarningHandler) *Request { r.warningHandler = handler return r } // Throttle receives a rate-limiter and sets or replaces an existing request limiter func (r *Request) Throttle(limiter flowcontrol.RateLimiter) *Request { r.rateLimiter = limiter return r } // SubResource sets a sub-resource path which can be multiple segments after the resource // name but before the suffix. func (r *Request) SubResource(subresources ...string) *Request { if r.err != nil { return r } subresource := path.Join(subresources...) if len(r.subresource) != 0 { r.err = fmt.Errorf("subresource already set to %q, cannot change to %q", r.subresource, subresource) return r } for _, s := range subresources { if msgs := IsValidPathSegmentName(s); len(msgs) != 0 { r.err = fmt.Errorf("invalid subresource %q: %v", s, msgs) return r } } r.subresource = subresource return r } // Name sets the name of a resource to access (<resource>/[ns/<namespace>/]<name>) func (r *Request) Name(resourceName string) *Request { if r.err != nil { return r } if len(resourceName) == 0 { r.err = fmt.Errorf("resource name may not be empty") return r } if len(r.resourceName) != 0 { r.err = fmt.Errorf("resource name already set to %q, cannot change to %q", r.resourceName, resourceName) return r } if msgs := IsValidPathSegmentName(resourceName); len(msgs) != 0 { r.err = fmt.Errorf("invalid resource name %q: %v", resourceName, msgs) return r } r.resourceName = resourceName return r } // Namespace applies the namespace scope to a request (<resource>/[ns/<namespace>/]<name>) func (r *Request) Namespace(namespace string) *Request { if r.err != nil { return r } if r.namespaceSet { r.err = fmt.Errorf("namespace already set to %q, cannot change to %q", r.namespace, namespace) return r } if msgs := IsValidPathSegmentName(namespace); len(msgs) != 0 { r.err = fmt.Errorf("invalid namespace %q: %v", namespace, msgs) return r } r.namespaceSet = true r.namespace = namespace return r } // NamespaceIfScoped is a convenience function to set a namespace if scoped is true func (r *Request) NamespaceIfScoped(namespace string, scoped bool) *Request { if scoped { return r.Namespace(namespace) } return r } // AbsPath overwrites an existing path with the segments provided. Trailing slashes are preserved // when a single segment is passed. func (r *Request) AbsPath(segments ...string) *Request { if r.err != nil { return r } r.pathPrefix = path.Join(r.c.base.Path, path.Join(segments...)) if len(segments) == 1 && (len(r.c.base.Path) > 1 || len(segments[0]) > 1) && strings.HasSuffix(segments[0], "/") { // preserve any trailing slashes for legacy behavior r.pathPrefix += "/" } return r } // RequestURI overwrites existing path and parameters with the value of the provided server relative // URI. func (r *Request) RequestURI(uri string) *Request { if r.err != nil { return r } locator, err := url.Parse(uri) if err != nil { r.err = err return r } r.pathPrefix = locator.Path if len(locator.Query()) > 0 { if r.params == nil { r.params = make(url.Values) } for k, v := range locator.Query() { r.params[k] = v } } return r } // Param creates a query parameter with the given string value. func (r *Request) Param(paramName, s string) *Request { if r.err != nil { return r } return r.setParam(paramName, s) } // VersionedParams will take the provided object, serialize it to a map[string][]string using the // implicit RESTClient API version and the default parameter codec, and then add those as parameters // to the request. Use this to provide versioned query parameters from client libraries. // VersionedParams will not write query parameters that have omitempty set and are empty. If a // parameter has already been set it is appended to (Params and VersionedParams are additive). func (r *Request) VersionedParams(obj runtime.Object, codec runtime.ParameterCodec) *Request { return r.SpecificallyVersionedParams(obj, codec, r.contentConfig.GroupVersion) } func (r *Request) SpecificallyVersionedParams(obj runtime.Object, codec runtime.ParameterCodec, version schema.GroupVersion) *Request { if r.err != nil { return r } params, err := codec.EncodeParameters(obj, version) if err != nil { r.err = err return r } for k, v := range params { if r.params == nil { r.params = make(url.Values) } r.params[k] = append(r.params[k], v...) } return r } func (r *Request) setParam(paramName, value string) *Request { if r.params == nil { r.params = make(url.Values) } r.params[paramName] = append(r.params[paramName], value) return r } func (r *Request) SetHeader(key string, values ...string) *Request { if r.headers == nil { r.headers = http.Header{} } r.headers.Del(key) for _, value := range values { r.headers.Add(key, value) } return r } // Timeout makes the request use the given duration as an overall timeout for the // request. Additionally, if set passes the value as "timeout" parameter in URL. func (r *Request) Timeout(d time.Duration) *Request { if r.err != nil { return r } r.timeout = d return r } // MaxRetries makes the request use the given integer as a ceiling of retrying upon receiving // "Retry-After" headers and 429 status-code in the response. The default is 10 unless this // function is specifically called with a different value. // A zero maxRetries prevent it from doing retires and return an error immediately. func (r *Request) MaxRetries(maxRetries int) *Request { if maxRetries < 0 { maxRetries = 0 } r.maxRetries = maxRetries return r } // Body makes the request use obj as the body. Optional. // If obj is a string, try to read a file of that name. // If obj is a []byte, send it directly. // If obj is an io.Reader, use it directly. // If obj is a runtime.Object, marshal it correctly, and set Content-Type header. // If obj is a runtime.Object and nil, do nothing. // Otherwise, set an error. func (r *Request) Body(obj interface{}) *Request { if r.err != nil { return r } switch t := obj.(type) { case string: data, err := os.ReadFile(t) if err != nil { r.err = err return r } r.body = nil r.bodyBytes = data case []byte: r.body = nil r.bodyBytes = t case io.Reader: r.body = t r.bodyBytes = nil case runtime.Object: // callers may pass typed interface pointers, therefore we must check nil with reflection if reflect.ValueOf(t).IsNil() { return r } encoder, err := r.contentConfig.Negotiator.Encoder(r.contentConfig.ContentType, nil) if err != nil { r.err = err return r } data, err := runtime.Encode(encoder, t) if err != nil { r.err = err return r } r.body = nil r.bodyBytes = data r.SetHeader("Content-Type", r.contentConfig.ContentType) default: r.err = fmt.Errorf("unknown type used for body: %+v", obj) } return r } // Error returns any error encountered constructing the request, if any. func (r *Request) Error() error { return r.err } // URL returns the current working URL. Check the result of Error() to ensure // that the returned URL is valid. func (r *Request) URL() *url.URL { p := r.pathPrefix if r.namespaceSet && len(r.namespace) > 0 { p = path.Join(p, "namespaces", r.namespace) } if len(r.resource) != 0 { p = path.Join(p, strings.ToLower(r.resource)) } // Join trims trailing slashes, so preserve r.pathPrefix's trailing slash for backwards compatibility if nothing was changed if len(r.resourceName) != 0 || len(r.subpath) != 0 || len(r.subresource) != 0 { p = path.Join(p, r.resourceName, r.subresource, r.subpath) } finalURL := &url.URL{} if r.c.base != nil { *finalURL = *r.c.base } finalURL.Path = p query := url.Values{} for key, values := range r.params { for _, value := range values { query.Add(key, value) } } // timeout is handled specially here. if r.timeout != 0 { query.Set("timeout", r.timeout.String()) } finalURL.RawQuery = query.Encode() return finalURL } // finalURLTemplate is similar to URL(), but will make all specific parameter values equal // - instead of name or namespace, "{name}" and "{namespace}" will be used, and all query // parameters will be reset. This creates a copy of the url so as not to change the // underlying object. func (r Request) finalURLTemplate() url.URL { newParams := url.Values{} v := []string{"{value}"} for k := range r.params { newParams[k] = v } r.params = newParams u := r.URL() if u == nil { return url.URL{} } segments := strings.Split(u.Path, "/") groupIndex := 0 index := 0 trimmedBasePath := "" if r.c.base != nil && strings.Contains(u.Path, r.c.base.Path) { p := strings.TrimPrefix(u.Path, r.c.base.Path) if !strings.HasPrefix(p, "/") { p = "/" + p } // store the base path that we have trimmed so we can append it // before returning the URL trimmedBasePath = r.c.base.Path segments = strings.Split(p, "/") groupIndex = 1 } if len(segments) <= 2 { return *u } const CoreGroupPrefix = "api" const NamedGroupPrefix = "apis" isCoreGroup := segments[groupIndex] == CoreGroupPrefix isNamedGroup := segments[groupIndex] == NamedGroupPrefix if isCoreGroup { // checking the case of core group with /api/v1/... format index = groupIndex + 2 } else if isNamedGroup { // checking the case of named group with /apis/apps/v1/... format index = groupIndex + 3 } else { // this should not happen that the only two possibilities are /api... and /apis..., just want to put an // outlet here in case more API groups are added in future if ever possible: // https://kubernetes.io/docs/concepts/overview/kubernetes-api/#api-groups // if a wrong API groups name is encountered, return the {prefix} for url.Path u.Path = "/{prefix}" u.RawQuery = "" return *u } // switch segLength := len(segments) - index; segLength { switch { // case len(segments) - index == 1: // resource (with no name) do nothing case len(segments)-index == 2: // /$RESOURCE/$NAME: replace $NAME with {name} segments[index+1] = "{name}" case len(segments)-index == 3: if segments[index+2] == "finalize" || segments[index+2] == "status" { // /$RESOURCE/$NAME/$SUBRESOURCE: replace $NAME with {name} segments[index+1] = "{name}" } else { // /namespace/$NAMESPACE/$RESOURCE: replace $NAMESPACE with {namespace} segments[index+1] = "{namespace}" } case len(segments)-index >= 4: segments[index+1] = "{namespace}" // /namespace/$NAMESPACE/$RESOURCE/$NAME: replace $NAMESPACE with {namespace}, $NAME with {name} if segments[index+3] != "finalize" && segments[index+3] != "status" { // /$RESOURCE/$NAME/$SUBRESOURCE: replace $NAME with {name} segments[index+3] = "{name}" } } u.Path = path.Join(trimmedBasePath, path.Join(segments...)) return *u } func (r *Request) tryThrottleWithInfo(ctx context.Context, retryInfo string) error { if r.rateLimiter == nil { return nil } now := time.Now() err := r.rateLimiter.Wait(ctx) if err != nil { err = fmt.Errorf("client rate limiter Wait returned an error: %w", err) } latency := time.Since(now) var message string switch { case len(retryInfo) > 0: message = fmt.Sprintf("Waited for %v, %s - request: %s:%s", latency, retryInfo, r.verb, r.URL().String()) default: message = fmt.Sprintf("Waited for %v due to client-side throttling, not priority and fairness, request: %s:%s", latency, r.verb, r.URL().String()) } if latency > longThrottleLatency { klog.V(3).Info(message) } if latency > extraLongThrottleLatency { // If the rate limiter latency is very high, the log message should be printed at a higher log level, // but we use a throttled logger to prevent spamming. globalThrottledLogger.Infof("%s", message) } metrics.RateLimiterLatency.Observe(ctx, r.verb, r.finalURLTemplate(), latency) return err } func (r *Request) tryThrottle(ctx context.Context) error { return r.tryThrottleWithInfo(ctx, "") } type throttleSettings struct { logLevel klog.Level minLogInterval time.Duration lastLogTime time.Time lock sync.RWMutex } type throttledLogger struct { clock clock.PassiveClock settings []*throttleSettings } var globalThrottledLogger = &throttledLogger{ clock: clock.RealClock{}, settings: []*throttleSettings{ { logLevel: 2, minLogInterval: 1 * time.Second, }, { logLevel: 0, minLogInterval: 10 * time.Second, }, }, } func (b *throttledLogger) attemptToLog() (klog.Level, bool) { for _, setting := range b.settings { if bool(klog.V(setting.logLevel).Enabled()) { // Return early without write locking if possible. if func() bool { setting.lock.RLock() defer setting.lock.RUnlock() return b.clock.Since(setting.lastLogTime) >= setting.minLogInterval }() { setting.lock.Lock() defer setting.lock.Unlock() if b.clock.Since(setting.lastLogTime) >= setting.minLogInterval { setting.lastLogTime = b.clock.Now() return setting.logLevel, true } } return -1, false } } return -1, false } // Infof will write a log message at each logLevel specified by the receiver's throttleSettings // as long as it hasn't written a log message more recently than minLogInterval. func (b *throttledLogger) Infof(message string, args ...interface{}) { if logLevel, ok := b.attemptToLog(); ok { klog.V(logLevel).Infof(message, args...) } } // Watch attempts to begin watching the requested location. // Returns a watch.Interface, or an error. func (r *Request) Watch(ctx context.Context) (watch.Interface, error) { w, _, e := r.watchInternal(ctx) return w, e } func (r *Request) watchInternal(ctx context.Context) (watch.Interface, runtime.Decoder, error) { if r.body == nil { logBody(ctx, 2, "Request Body", r.bodyBytes) } // We specifically don't want to rate limit watches, so we // don't use r.rateLimiter here. if r.err != nil { return nil, nil, r.err } client := r.c.Client if client == nil { client = http.DefaultClient } isErrRetryableFunc := func(request *http.Request, err error) bool { // The watch stream mechanism handles many common partial data errors, so closed // connections can be retried in many cases. if net.IsProbableEOF(err) || net.IsTimeout(err) { return true } return false } retry := r.retryFn(r.maxRetries) url := r.URL().String() for { if err := retry.Before(ctx, r); err != nil { return nil, nil, retry.WrapPreviousError(err) } req, err := r.newHTTPRequest(ctx) if err != nil { return nil, nil, err } resp, err := client.Do(req) retry.After(ctx, r, resp, err) if err == nil && resp.StatusCode == http.StatusOK { return r.newStreamWatcher(resp) } done, transformErr := func() (bool, error) { defer readAndCloseResponseBody(resp) if retry.IsNextRetry(ctx, r, req, resp, err, isErrRetryableFunc) { return false, nil } if resp == nil { // the server must have sent us an error in 'err' return true, nil } result := r.transformResponse(ctx, resp, req) if err := result.Error(); err != nil { return true, err } return true, fmt.Errorf("for request %s, got status: %v", url, resp.StatusCode) }() if done { if isErrRetryableFunc(req, err) { return watch.NewEmptyWatch(), nil, nil } if err == nil { // if the server sent us an HTTP Response object, // we need to return the error object from that. err = transformErr } return nil, nil, retry.WrapPreviousError(err) } } } type WatchListResult struct { // err holds any errors we might have received // during streaming. err error // items hold the collected data items []runtime.Object // initialEventsEndBookmarkRV holds the resource version // extracted from the bookmark event that marks // the end of the stream. initialEventsEndBookmarkRV string // negotiatedObjectDecoder knows how to decode // the initialEventsListBlueprint negotiatedObjectDecoder runtime.Decoder // base64EncodedInitialEventsListBlueprint contains an empty, // versioned list encoded in the requested format // (e.g., protobuf, JSON, CBOR) and stored as a base64-encoded string base64EncodedInitialEventsListBlueprint string } // Into stores the result into obj. The passed obj parameter must be a pointer to a list type. // // Note: // // Special attention should be given to the type *unstructured.Unstructured, // which represents a list type but does not have an "Items" field. // Users who directly use RESTClient may store the response in such an object. // This particular case is not handled by the current implementation of this function, // but may be considered for future updates. func (r WatchListResult) Into(obj runtime.Object) error { if r.err != nil { return r.err } listItemsPtr, err := meta.GetItemsPtr(obj) if err != nil { return err } listVal, err := conversion.EnforcePtr(listItemsPtr) if err != nil { return err } if listVal.Kind() != reflect.Slice { return fmt.Errorf("need a pointer to slice, got %v", listVal.Kind()) } encodedInitialEventsListBlueprint, err := base64.StdEncoding.DecodeString(r.base64EncodedInitialEventsListBlueprint) if err != nil { return fmt.Errorf("failed to decode the received blueprint list, err %w", err) } err = runtime.DecodeInto(r.negotiatedObjectDecoder, encodedInitialEventsListBlueprint, obj) if err != nil { return err } if len(r.items) == 0 { listVal.Set(reflect.MakeSlice(listVal.Type(), 0, 0)) } else { listVal.Set(reflect.MakeSlice(listVal.Type(), len(r.items), len(r.items))) for i, o := range r.items { if listVal.Type().Elem() != reflect.TypeOf(o).Elem() { return fmt.Errorf("received object type = %v at index = %d, doesn't match the list item type = %v", reflect.TypeOf(o).Elem(), i, listVal.Type().Elem()) } listVal.Index(i).Set(reflect.ValueOf(o).Elem()) } } listMeta, err := meta.ListAccessor(obj) if err != nil { return err } listMeta.SetResourceVersion(r.initialEventsEndBookmarkRV) return nil } // WatchList establishes a stream to get a consistent snapshot of data // from the server as described in https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/3157-watch-list#proposal // // Note that the watchlist requires properly setting the ListOptions // otherwise it just establishes a regular watch with the server. // Check the documentation https://kubernetes.io/docs/reference/using-api/api-concepts/#streaming-lists // to see what parameters are currently required. func (r *Request) WatchList(ctx context.Context) WatchListResult { if r.body == nil { logBody(ctx, 2, "Request Body", r.bodyBytes) } if !clientfeatures.FeatureGates().Enabled(clientfeatures.WatchListClient) { return WatchListResult{err: fmt.Errorf("%q feature gate is not enabled", clientfeatures.WatchListClient)} } // TODO(#115478): consider validating request parameters (i.e sendInitialEvents). // Most users use the generated client, which handles the proper setting of parameters. // We don't have validation for other methods (e.g., the Watch) // thus, for symmetry, we haven't added additional checks for the WatchList method. w, d, err := r.watchInternal(ctx) if err != nil { return WatchListResult{err: err} } return r.handleWatchList(ctx, w, d) } // handleWatchList holds the actual logic for easier unit testing. // Note that this function will close the passed watch. func (r *Request) handleWatchList(ctx context.Context, w watch.Interface, negotiatedObjectDecoder runtime.Decoder) WatchListResult { defer w.Stop() var lastKey string var items []runtime.Object for { select { case <-ctx.Done(): return WatchListResult{err: ctx.Err()} case event, ok := <-w.ResultChan(): if !ok { return WatchListResult{err: fmt.Errorf("unexpected watch close")} } if event.Type == watch.Error { return WatchListResult{err: errors.FromObject(event.Object)} } meta, err := meta.Accessor(event.Object) if err != nil { return WatchListResult{err: fmt.Errorf("failed to parse watch event: %#v", event)} } switch event.Type { case watch.Added: // the following check ensures that the response is ordered. // earlier servers had a bug that caused them to not sort the output. // in such cases, return an error which can trigger fallback logic. key := objectKeyFromMeta(meta) if len(lastKey) > 0 && lastKey > key { return WatchListResult{err: fmt.Errorf("cannot add the obj (%#v) with the key = %s, as it violates the ordering guarantees provided by the watchlist feature in beta phase, lastInsertedKey was = %s", event.Object, key, lastKey)} } items = append(items, event.Object) lastKey = key case watch.Bookmark: if meta.GetAnnotations()[metav1.InitialEventsAnnotationKey] == "true" { base64EncodedInitialEventsListBlueprint := meta.GetAnnotations()[metav1.InitialEventsListBlueprintAnnotationKey] if len(base64EncodedInitialEventsListBlueprint) == 0 { return WatchListResult{err: fmt.Errorf("%q annotation is missing content", metav1.InitialEventsListBlueprintAnnotationKey)} } return WatchListResult{ items: items, initialEventsEndBookmarkRV: meta.GetResourceVersion(), negotiatedObjectDecoder: negotiatedObjectDecoder, base64EncodedInitialEventsListBlueprint: base64EncodedInitialEventsListBlueprint, } } default: return WatchListResult{err: fmt.Errorf("unexpected watch event %#v, expected to only receive watch.Added and watch.Bookmark events", event)} } } } } func (r *Request) newStreamWatcher(resp *http.Response) (watch.Interface, runtime.Decoder, error) { contentType := resp.Header.Get("Content-Type") mediaType, params, err := mime.ParseMediaType(contentType) if err != nil { klog.V(4).Infof("Unexpected content type from the server: %q: %v", contentType, err) } objectDecoder, streamingSerializer, framer, err := r.contentConfig.Negotiator.StreamDecoder(mediaType, params) if err != nil { return nil, nil, err } handleWarnings(resp.Header, r.warningHandler) frameReader := framer.NewFrameReader(resp.Body) watchEventDecoder := streaming.NewDecoder(frameReader, streamingSerializer) return watch.NewStreamWatcher( restclientwatch.NewDecoder(watchEventDecoder, objectDecoder), // use 500 to indicate that the cause of the error is unknown - other error codes // are more specific to HTTP interactions, and set a reason errors.NewClientErrorReporter(http.StatusInternalServerError, r.verb, "ClientWatchDecoding"), ), objectDecoder, nil } // updateRequestResultMetric increments the RequestResult metric counter, // it should be called with the (response, err) tuple from the final // reply from the server. func updateRequestResultMetric(ctx context.Context, req *Request, resp *http.Response, err error) { code, host := sanitize(req, resp, err) metrics.RequestResult.Increment(ctx, code, req.verb, host) } // updateRequestRetryMetric increments the RequestRetry metric counter, // it should be called with the (response, err) tuple for each retry // except for the final attempt. func updateRequestRetryMetric(ctx context.Context, req *Request, resp *http.Response, err error) { code, host := sanitize(req, resp, err) metrics.RequestRetry.IncrementRetry(ctx, code, req.verb, host) } func sanitize(req *Request, resp *http.Response, err error) (string, string) { host := "none" if req.c.base != nil { host = req.c.base.Host } // Errors can be arbitrary strings. Unbound label cardinality is not suitable for a metric // system so we just report them as `<error>`. code := "<error>" if resp != nil { code = strconv.Itoa(resp.StatusCode) } return code, host } // Stream formats and executes the request, and offers streaming of the response. // Returns io.ReadCloser which could be used for streaming of the response, or an error // Any non-2xx http status code causes an error. If we get a non-2xx code, we try to convert the body into an APIStatus object. // If we can, we return that as an error. Otherwise, we create an error that lists the http status and the content of the response. func (r *Request) Stream(ctx context.Context) (io.ReadCloser, error) { if r.body == nil { logBody(ctx, 2, "Request Body", r.bodyBytes) } if r.err != nil { return nil, r.err } if err := r.tryThrottle(ctx); err != nil { return nil, err } client := r.c.Client if client == nil { client = http.DefaultClient } retry := r.retryFn(r.maxRetries) url := r.URL().String() for { if err := retry.Before(ctx, r); err != nil { return nil, err } req, err := r.newHTTPRequest(ctx) if err != nil { return nil, err } resp, err := client.Do(req) retry.After(ctx, r, resp, err) if err != nil { // we only retry on an HTTP response with 'Retry-After' header return nil, err } switch { case (resp.StatusCode >= 200) && (resp.StatusCode < 300):
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
true
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/rest/warnings.go
vendor/k8s.io/client-go/rest/warnings.go
/* Copyright 2020 The Kubernetes 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. */ package rest import ( "fmt" "io" "net/http" "sync" "k8s.io/klog/v2" "k8s.io/apimachinery/pkg/util/net" ) // WarningHandler is an interface for handling warning headers type WarningHandler interface { // HandleWarningHeader is called with the warn code, agent, and text when a warning header is countered. HandleWarningHeader(code int, agent string, text string) } var ( defaultWarningHandler WarningHandler = WarningLogger{} defaultWarningHandlerLock sync.RWMutex ) // SetDefaultWarningHandler sets the default handler clients use when warning headers are encountered. // By default, warnings are logged. Several built-in implementations are provided: // - NoWarnings suppresses warnings. // - WarningLogger logs warnings. // - NewWarningWriter() outputs warnings to the provided writer. func SetDefaultWarningHandler(l WarningHandler) { defaultWarningHandlerLock.Lock() defer defaultWarningHandlerLock.Unlock() defaultWarningHandler = l } func getDefaultWarningHandler() WarningHandler { defaultWarningHandlerLock.RLock() defer defaultWarningHandlerLock.RUnlock() l := defaultWarningHandler return l } // NoWarnings is an implementation of WarningHandler that suppresses warnings. type NoWarnings struct{} func (NoWarnings) HandleWarningHeader(code int, agent string, message string) {} // WarningLogger is an implementation of WarningHandler that logs code 299 warnings type WarningLogger struct{} func (WarningLogger) HandleWarningHeader(code int, agent string, message string) { if code != 299 || len(message) == 0 { return } klog.Warning(message) } type warningWriter struct { // out is the writer to output warnings to out io.Writer // opts contains options controlling warning output opts WarningWriterOptions // writtenLock guards written and writtenCount writtenLock sync.Mutex writtenCount int written map[string]struct{} } // WarningWriterOptions controls the behavior of a WarningHandler constructed using NewWarningWriter() type WarningWriterOptions struct { // Deduplicate indicates a given warning message should only be written once. // Setting this to true in a long-running process handling many warnings can result in increased memory use. Deduplicate bool // Color indicates that warning output can include ANSI color codes Color bool } // NewWarningWriter returns an implementation of WarningHandler that outputs code 299 warnings to the specified writer. func NewWarningWriter(out io.Writer, opts WarningWriterOptions) *warningWriter { h := &warningWriter{out: out, opts: opts} if opts.Deduplicate { h.written = map[string]struct{}{} } return h } const ( yellowColor = "\u001b[33;1m" resetColor = "\u001b[0m" ) // HandleWarningHeader prints warnings with code=299 to the configured writer. func (w *warningWriter) HandleWarningHeader(code int, agent string, message string) { if code != 299 || len(message) == 0 { return } w.writtenLock.Lock() defer w.writtenLock.Unlock() if w.opts.Deduplicate { if _, alreadyWritten := w.written[message]; alreadyWritten { return } w.written[message] = struct{}{} } w.writtenCount++ if w.opts.Color { fmt.Fprintf(w.out, "%sWarning:%s %s\n", yellowColor, resetColor, message) } else { fmt.Fprintf(w.out, "Warning: %s\n", message) } } func (w *warningWriter) WarningCount() int { w.writtenLock.Lock() defer w.writtenLock.Unlock() return w.writtenCount } func handleWarnings(headers http.Header, handler WarningHandler) []net.WarningHeader { if handler == nil { handler = getDefaultWarningHandler() } warnings, _ := net.ParseWarningHeaders(headers["Warning"]) for _, warning := range warnings { handler.HandleWarningHeader(warning.Code, warning.Agent, warning.Text) } return warnings }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/rest/exec.go
vendor/k8s.io/client-go/rest/exec.go
/* Copyright 2020 The Kubernetes 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. */ package rest import ( "fmt" "net/http" "net/url" clientauthenticationapi "k8s.io/client-go/pkg/apis/clientauthentication" ) // This file contains Config logic related to exec credential plugins. // ConfigToExecCluster creates a clientauthenticationapi.Cluster with the corresponding fields from // the provided Config. func ConfigToExecCluster(config *Config) (*clientauthenticationapi.Cluster, error) { caData, err := dataFromSliceOrFile(config.CAData, config.CAFile) if err != nil { return nil, fmt.Errorf("failed to load CA bundle for execProvider: %v", err) } var proxyURL string if config.Proxy != nil { req, err := http.NewRequest("", config.Host, nil) if err != nil { return nil, fmt.Errorf("failed to create proxy URL request for execProvider: %w", err) } url, err := config.Proxy(req) if err != nil { return nil, fmt.Errorf("failed to get proxy URL for execProvider: %w", err) } if url != nil { proxyURL = url.String() } } return &clientauthenticationapi.Cluster{ Server: config.Host, TLSServerName: config.ServerName, InsecureSkipTLSVerify: config.Insecure, CertificateAuthorityData: caData, ProxyURL: proxyURL, DisableCompression: config.DisableCompression, Config: config.ExecProvider.Config, }, nil } // ExecClusterToConfig creates a Config with the corresponding fields from the provided // clientauthenticationapi.Cluster. The returned Config will be anonymous (i.e., it will not have // any authentication-related fields set). func ExecClusterToConfig(cluster *clientauthenticationapi.Cluster) (*Config, error) { var proxy func(*http.Request) (*url.URL, error) if cluster.ProxyURL != "" { proxyURL, err := url.Parse(cluster.ProxyURL) if err != nil { return nil, fmt.Errorf("cannot parse proxy URL: %w", err) } proxy = http.ProxyURL(proxyURL) } return &Config{ Host: cluster.Server, TLSClientConfig: TLSClientConfig{ Insecure: cluster.InsecureSkipTLSVerify, ServerName: cluster.TLSServerName, CAData: cluster.CertificateAuthorityData, }, Proxy: proxy, DisableCompression: cluster.DisableCompression, }, nil }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/rest/client.go
vendor/k8s.io/client-go/rest/client.go
/* Copyright 2014 The Kubernetes 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. */ package rest import ( "fmt" "mime" "net/http" "net/url" "os" "strconv" "strings" "sync/atomic" "time" "github.com/munnerz/goautoneg" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" clientfeatures "k8s.io/client-go/features" "k8s.io/client-go/util/flowcontrol" ) const ( // Environment variables: Note that the duration should be long enough that the backoff // persists for some reasonable time (i.e. 120 seconds). The typical base might be "1". envBackoffBase = "KUBE_CLIENT_BACKOFF_BASE" envBackoffDuration = "KUBE_CLIENT_BACKOFF_DURATION" ) // Interface captures the set of operations for generically interacting with Kubernetes REST apis. type Interface interface { GetRateLimiter() flowcontrol.RateLimiter Verb(verb string) *Request Post() *Request Put() *Request Patch(pt types.PatchType) *Request Get() *Request Delete() *Request APIVersion() schema.GroupVersion } // ClientContentConfig controls how RESTClient communicates with the server. // // TODO: ContentConfig will be updated to accept a Negotiator instead of a // NegotiatedSerializer and NegotiatedSerializer will be removed. type ClientContentConfig struct { // AcceptContentTypes specifies the types the client will accept and is optional. // If not set, ContentType will be used to define the Accept header AcceptContentTypes string // ContentType specifies the wire format used to communicate with the server. // This value will be set as the Accept header on requests made to the server if // AcceptContentTypes is not set, and as the default content type on any object // sent to the server. If not set, "application/json" is used. ContentType string // GroupVersion is the API version to talk to. Must be provided when initializing // a RESTClient directly. When initializing a Client, will be set with the default // code version. This is used as the default group version for VersionedParams. GroupVersion schema.GroupVersion // Negotiator is used for obtaining encoders and decoders for multiple // supported media types. Negotiator runtime.ClientNegotiator } // RESTClient imposes common Kubernetes API conventions on a set of resource paths. // The baseURL is expected to point to an HTTP or HTTPS path that is the parent // of one or more resources. The server should return a decodable API resource // object, or an api.Status object which contains information about the reason for // any failure. // // Most consumers should use client.New() to get a Kubernetes API client. type RESTClient struct { // base is the root URL for all invocations of the client base *url.URL // versionedAPIPath is a path segment connecting the base URL to the resource root versionedAPIPath string // content describes how a RESTClient encodes and decodes responses. content requestClientContentConfigProvider // creates BackoffManager that is passed to requests. createBackoffMgr func() BackoffManager // rateLimiter is shared among all requests created by this client unless specifically // overridden. rateLimiter flowcontrol.RateLimiter // warningHandler is shared among all requests created by this client. // If not set, defaultWarningHandler is used. warningHandler WarningHandler // Set specific behavior of the client. If not set http.DefaultClient will be used. Client *http.Client } // NewRESTClient creates a new RESTClient. This client performs generic REST functions // such as Get, Put, Post, and Delete on specified paths. func NewRESTClient(baseURL *url.URL, versionedAPIPath string, config ClientContentConfig, rateLimiter flowcontrol.RateLimiter, client *http.Client) (*RESTClient, error) { base := *baseURL if !strings.HasSuffix(base.Path, "/") { base.Path += "/" } base.RawQuery = "" base.Fragment = "" return &RESTClient{ base: &base, versionedAPIPath: versionedAPIPath, content: requestClientContentConfigProvider{base: scrubCBORContentConfigIfDisabled(config)}, createBackoffMgr: readExpBackoffConfig, rateLimiter: rateLimiter, Client: client, }, nil } func scrubCBORContentConfigIfDisabled(content ClientContentConfig) ClientContentConfig { if clientfeatures.FeatureGates().Enabled(clientfeatures.ClientsAllowCBOR) { content.Negotiator = clientNegotiatorWithCBORSequenceStreamDecoder{content.Negotiator} return content } if mediatype, _, err := mime.ParseMediaType(content.ContentType); err == nil && mediatype == "application/cbor" { content.ContentType = "application/json" } clauses := goautoneg.ParseAccept(content.AcceptContentTypes) scrubbed := false for i, clause := range clauses { if clause.Type == "application" && clause.SubType == "cbor" { scrubbed = true clauses[i].SubType = "json" } } if !scrubbed { // No application/cbor in AcceptContentTypes, nothing more to do. return content } parts := make([]string, 0, len(clauses)) for _, clause := range clauses { // ParseAccept does not store the parameter "q" in Params. params := clause.Params if clause.Q < 1 { // omit q=1, it's the default if params == nil { params = make(map[string]string, 1) } params["q"] = strconv.FormatFloat(clause.Q, 'g', 3, 32) } parts = append(parts, mime.FormatMediaType(fmt.Sprintf("%s/%s", clause.Type, clause.SubType), params)) } content.AcceptContentTypes = strings.Join(parts, ",") return content } // GetRateLimiter returns rate limiter for a given client, or nil if it's called on a nil client func (c *RESTClient) GetRateLimiter() flowcontrol.RateLimiter { if c == nil { return nil } return c.rateLimiter } // readExpBackoffConfig handles the internal logic of determining what the // backoff policy is. By default if no information is available, NoBackoff. // TODO Generalize this see #17727 . func readExpBackoffConfig() BackoffManager { backoffBase := os.Getenv(envBackoffBase) backoffDuration := os.Getenv(envBackoffDuration) backoffBaseInt, errBase := strconv.ParseInt(backoffBase, 10, 64) backoffDurationInt, errDuration := strconv.ParseInt(backoffDuration, 10, 64) if errBase != nil || errDuration != nil { return &NoBackoff{} } return &URLBackoff{ Backoff: flowcontrol.NewBackOff( time.Duration(backoffBaseInt)*time.Second, time.Duration(backoffDurationInt)*time.Second)} } // Verb begins a request with a verb (GET, POST, PUT, DELETE). // // Example usage of RESTClient's request building interface: // c, err := NewRESTClient(...) // if err != nil { ... } // resp, err := c.Verb("GET"). // // Path("pods"). // SelectorParam("labels", "area=staging"). // Timeout(10*time.Second). // Do() // // if err != nil { ... } // list, ok := resp.(*api.PodList) func (c *RESTClient) Verb(verb string) *Request { return NewRequest(c).Verb(verb) } // Post begins a POST request. Short for c.Verb("POST"). func (c *RESTClient) Post() *Request { return c.Verb("POST") } // Put begins a PUT request. Short for c.Verb("PUT"). func (c *RESTClient) Put() *Request { return c.Verb("PUT") } // Patch begins a PATCH request. Short for c.Verb("Patch"). func (c *RESTClient) Patch(pt types.PatchType) *Request { return c.Verb("PATCH").SetHeader("Content-Type", string(pt)) } // Get begins a GET request. Short for c.Verb("GET"). func (c *RESTClient) Get() *Request { return c.Verb("GET") } // Delete begins a DELETE request. Short for c.Verb("DELETE"). func (c *RESTClient) Delete() *Request { return c.Verb("DELETE") } // APIVersion returns the APIVersion this RESTClient is expected to use. func (c *RESTClient) APIVersion() schema.GroupVersion { config, _ := c.content.GetClientContentConfig() return config.GroupVersion } // requestClientContentConfigProvider observes HTTP 415 (Unsupported Media Type) responses to detect // that the server does not understand CBOR. Once this has happened, future requests are forced to // use JSON so they can succeed. This is convenient for client users that want to prefer CBOR, but // also need to interoperate with older servers so requests do not permanently fail. The clients // will not default to using CBOR until at least all supported kube-apiservers have enable-CBOR // locked to true, so this path will be rarely taken. Additionally, all generated clients accessing // built-in kube resources are forced to protobuf, so those will not degrade to JSON. type requestClientContentConfigProvider struct { base ClientContentConfig // Becomes permanently true if a server responds with HTTP 415 (Unsupported Media Type) to a // request with "Content-Type" header containing the CBOR media type. sawUnsupportedMediaTypeForCBOR atomic.Bool } // GetClientContentConfig returns the ClientContentConfig that should be used for new requests by // this client and true if the request ContentType was selected by default. func (p *requestClientContentConfigProvider) GetClientContentConfig() (ClientContentConfig, bool) { config := p.base defaulted := config.ContentType == "" if defaulted { config.ContentType = "application/json" } if !clientfeatures.FeatureGates().Enabled(clientfeatures.ClientsAllowCBOR) { return config, defaulted } if defaulted && clientfeatures.FeatureGates().Enabled(clientfeatures.ClientsPreferCBOR) { config.ContentType = "application/cbor" } if sawUnsupportedMediaTypeForCBOR := p.sawUnsupportedMediaTypeForCBOR.Load(); !sawUnsupportedMediaTypeForCBOR { return config, defaulted } if mediaType, _, _ := mime.ParseMediaType(config.ContentType); mediaType != runtime.ContentTypeCBOR { return config, defaulted } // The effective ContentType is CBOR and the client has previously received an HTTP 415 in // response to a CBOR request. Override ContentType to JSON. config.ContentType = runtime.ContentTypeJSON return config, defaulted } // UnsupportedMediaType reports that the server has responded to a request with HTTP 415 Unsupported // Media Type. func (p *requestClientContentConfigProvider) UnsupportedMediaType(requestContentType string) { if !clientfeatures.FeatureGates().Enabled(clientfeatures.ClientsAllowCBOR) { return } // This could be extended to consider the Content-Encoding request header, the Accept and // Accept-Encoding response headers, the request method, and URI (as mentioned in // https://www.rfc-editor.org/rfc/rfc9110.html#section-15.5.16). The request Content-Type // header is sufficient to implement a blanket CBOR fallback mechanism. requestContentType, _, _ = mime.ParseMediaType(requestContentType) switch requestContentType { case runtime.ContentTypeCBOR, string(types.ApplyCBORPatchType): p.sawUnsupportedMediaTypeForCBOR.Store(true) } } // clientNegotiatorWithCBORSequenceStreamDecoder is a ClientNegotiator that delegates to another // ClientNegotiator to select the appropriate Encoder or Decoder for a given media type. As a // special case, it will resolve "application/cbor-seq" (a CBOR Sequence, the concatenation of zero // or more CBOR data items) as an alias for "application/cbor" (exactly one CBOR data item) when // selecting a stream decoder. type clientNegotiatorWithCBORSequenceStreamDecoder struct { negotiator runtime.ClientNegotiator } func (n clientNegotiatorWithCBORSequenceStreamDecoder) Encoder(contentType string, params map[string]string) (runtime.Encoder, error) { return n.negotiator.Encoder(contentType, params) } func (n clientNegotiatorWithCBORSequenceStreamDecoder) Decoder(contentType string, params map[string]string) (runtime.Decoder, error) { return n.negotiator.Decoder(contentType, params) } func (n clientNegotiatorWithCBORSequenceStreamDecoder) StreamDecoder(contentType string, params map[string]string) (runtime.Decoder, runtime.Serializer, runtime.Framer, error) { if !clientfeatures.FeatureGates().Enabled(clientfeatures.ClientsAllowCBOR) { return n.negotiator.StreamDecoder(contentType, params) } switch contentType { case runtime.ContentTypeCBORSequence: return n.negotiator.StreamDecoder(runtime.ContentTypeCBOR, params) case runtime.ContentTypeCBOR: // This media type is only appropriate for exactly one data item, not the zero or // more events of a watch stream. return nil, nil, nil, runtime.NegotiateError{ContentType: contentType, Stream: true} default: return n.negotiator.StreamDecoder(contentType, params) } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/rest/zz_generated.deepcopy.go
vendor/k8s.io/client-go/rest/zz_generated.deepcopy.go
//go:build !ignore_autogenerated // +build !ignore_autogenerated /* Copyright The Kubernetes 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. */ // Code generated by deepcopy-gen. DO NOT EDIT. package rest // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TLSClientConfig) DeepCopyInto(out *TLSClientConfig) { *out = *in if in.CertData != nil { in, out := &in.CertData, &out.CertData *out = make([]byte, len(*in)) copy(*out, *in) } if in.KeyData != nil { in, out := &in.KeyData, &out.KeyData *out = make([]byte, len(*in)) copy(*out, *in) } if in.CAData != nil { in, out := &in.CAData, &out.CAData *out = make([]byte, len(*in)) copy(*out, *in) } if in.NextProtos != nil { in, out := &in.NextProtos, &out.NextProtos *out = make([]string, len(*in)) copy(*out, *in) } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSClientConfig. func (in *TLSClientConfig) DeepCopy() *TLSClientConfig { if in == nil { return nil } out := new(TLSClientConfig) in.DeepCopyInto(out) return out }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/rest/urlbackoff.go
vendor/k8s.io/client-go/rest/urlbackoff.go
/* Copyright 2015 The Kubernetes 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. */ package rest import ( "net/url" "time" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/client-go/util/flowcontrol" "k8s.io/klog/v2" ) // Set of resp. Codes that we backoff for. // In general these should be errors that indicate a server is overloaded. // These shouldn't be configured by any user, we set them based on conventions // described in var serverIsOverloadedSet = sets.NewInt(429) var maxResponseCode = 499 type BackoffManager interface { UpdateBackoff(actualUrl *url.URL, err error, responseCode int) CalculateBackoff(actualUrl *url.URL) time.Duration Sleep(d time.Duration) } // URLBackoff struct implements the semantics on top of Backoff which // we need for URL specific exponential backoff. type URLBackoff struct { // Uses backoff as underlying implementation. Backoff *flowcontrol.Backoff } // NoBackoff is a stub implementation, can be used for mocking or else as a default. type NoBackoff struct { } func (n *NoBackoff) UpdateBackoff(actualUrl *url.URL, err error, responseCode int) { // do nothing. } func (n *NoBackoff) CalculateBackoff(actualUrl *url.URL) time.Duration { return 0 * time.Second } func (n *NoBackoff) Sleep(d time.Duration) { time.Sleep(d) } // Disable makes the backoff trivial, i.e., sets it to zero. This might be used // by tests which want to run 1000s of mock requests without slowing down. func (b *URLBackoff) Disable() { klog.V(4).Infof("Disabling backoff strategy") b.Backoff = flowcontrol.NewBackOff(0*time.Second, 0*time.Second) } // baseUrlKey returns the key which urls will be mapped to. // For example, 127.0.0.1:8080/api/v2/abcde -> 127.0.0.1:8080. func (b *URLBackoff) baseUrlKey(rawurl *url.URL) string { // Simple implementation for now, just the host. // We may backoff specific paths (i.e. "pods") differentially // in the future. host, err := url.Parse(rawurl.String()) if err != nil { klog.V(4).Infof("Error extracting url: %v", rawurl) panic("bad url!") } return host.Host } // UpdateBackoff updates backoff metadata func (b *URLBackoff) UpdateBackoff(actualUrl *url.URL, err error, responseCode int) { // range for retry counts that we store is [0,13] if responseCode > maxResponseCode || serverIsOverloadedSet.Has(responseCode) { b.Backoff.Next(b.baseUrlKey(actualUrl), b.Backoff.Clock.Now()) return } else if responseCode >= 300 || err != nil { klog.V(4).Infof("Client is returning errors: code %v, error %v", responseCode, err) } //If we got this far, there is no backoff required for this URL anymore. b.Backoff.Reset(b.baseUrlKey(actualUrl)) } // CalculateBackoff takes a url and back's off exponentially, // based on its knowledge of existing failures. func (b *URLBackoff) CalculateBackoff(actualUrl *url.URL) time.Duration { return b.Backoff.Get(b.baseUrlKey(actualUrl)) } func (b *URLBackoff) Sleep(d time.Duration) { b.Backoff.Clock.Sleep(d) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/rest/config.go
vendor/k8s.io/client-go/rest/config.go
/* Copyright 2016 The Kubernetes 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. */ package rest import ( "context" "errors" "fmt" "net" "net/http" "net/url" "os" "path/filepath" gruntime "runtime" "strings" "time" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer" "k8s.io/apimachinery/pkg/runtime/serializer/cbor" "k8s.io/client-go/features" "k8s.io/client-go/pkg/version" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/client-go/transport" certutil "k8s.io/client-go/util/cert" "k8s.io/client-go/util/flowcontrol" "k8s.io/klog/v2" ) const ( DefaultQPS float32 = 5.0 DefaultBurst int = 10 ) var ErrNotInCluster = errors.New("unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined") // Config holds the common attributes that can be passed to a Kubernetes client on // initialization. type Config struct { // Host must be a host string, a host:port pair, or a URL to the base of the apiserver. // If a URL is given then the (optional) Path of that URL represents a prefix that must // be appended to all request URIs used to access the apiserver. This allows a frontend // proxy to easily relocate all of the apiserver endpoints. Host string // APIPath is a sub-path that points to an API root. APIPath string // ContentConfig contains settings that affect how objects are transformed when // sent to the server. ContentConfig // Server requires Basic authentication Username string Password string `datapolicy:"password"` // Server requires Bearer authentication. This client will not attempt to use // refresh tokens for an OAuth2 flow. // TODO: demonstrate an OAuth2 compatible client. BearerToken string `datapolicy:"token"` // Path to a file containing a BearerToken. // If set, the contents are periodically read. // The last successfully read value takes precedence over BearerToken. BearerTokenFile string // Impersonate is the configuration that RESTClient will use for impersonation. Impersonate ImpersonationConfig // Server requires plugin-specified authentication. AuthProvider *clientcmdapi.AuthProviderConfig // Callback to persist config for AuthProvider. AuthConfigPersister AuthProviderConfigPersister // Exec-based authentication provider. ExecProvider *clientcmdapi.ExecConfig // TLSClientConfig contains settings to enable transport layer security TLSClientConfig // UserAgent is an optional field that specifies the caller of this request. UserAgent string // DisableCompression bypasses automatic GZip compression requests to the // server. DisableCompression bool // Transport may be used for custom HTTP behavior. This attribute may not // be specified with the TLS client certificate options. Use WrapTransport // to provide additional per-server middleware behavior. Transport http.RoundTripper // WrapTransport will be invoked for custom HTTP behavior after the underlying // transport is initialized (either the transport created from TLSClientConfig, // Transport, or http.DefaultTransport). The config may layer other RoundTrippers // on top of the returned RoundTripper. // // A future release will change this field to an array. Use config.Wrap() // instead of setting this value directly. WrapTransport transport.WrapperFunc // QPS indicates the maximum QPS to the master from this client. // If it's zero, the created RESTClient will use DefaultQPS: 5 // // Setting this to a negative value will disable client-side ratelimiting // unless `Ratelimiter` is also set. QPS float32 // Maximum burst for throttle. // If it's zero, the created RESTClient will use DefaultBurst: 10. Burst int // Rate limiter for limiting connections to the master from this client. If present overwrites QPS/Burst RateLimiter flowcontrol.RateLimiter // WarningHandler handles warnings in server responses. // If not set, the default warning handler is used. // See documentation for SetDefaultWarningHandler() for details. WarningHandler WarningHandler // The maximum length of time to wait before giving up on a server request. A value of zero means no timeout. Timeout time.Duration // Dial specifies the dial function for creating unencrypted TCP connections. Dial func(ctx context.Context, network, address string) (net.Conn, error) // Proxy is the proxy func to be used for all requests made by this // transport. If Proxy is nil, http.ProxyFromEnvironment is used. If Proxy // returns a nil *URL, no proxy is used. // // socks5 proxying does not currently support spdy streaming endpoints. Proxy func(*http.Request) (*url.URL, error) // Version forces a specific version to be used (if registered) // Do we need this? // Version string } var _ fmt.Stringer = new(Config) var _ fmt.GoStringer = new(Config) type sanitizedConfig *Config type sanitizedAuthConfigPersister struct{ AuthProviderConfigPersister } func (sanitizedAuthConfigPersister) GoString() string { return "rest.AuthProviderConfigPersister(--- REDACTED ---)" } func (sanitizedAuthConfigPersister) String() string { return "rest.AuthProviderConfigPersister(--- REDACTED ---)" } type sanitizedObject struct{ runtime.Object } func (sanitizedObject) GoString() string { return "runtime.Object(--- REDACTED ---)" } func (sanitizedObject) String() string { return "runtime.Object(--- REDACTED ---)" } // GoString implements fmt.GoStringer and sanitizes sensitive fields of Config // to prevent accidental leaking via logs. func (c *Config) GoString() string { return c.String() } // String implements fmt.Stringer and sanitizes sensitive fields of Config to // prevent accidental leaking via logs. func (c *Config) String() string { if c == nil { return "<nil>" } cc := sanitizedConfig(CopyConfig(c)) // Explicitly mark non-empty credential fields as redacted. if cc.Password != "" { cc.Password = "--- REDACTED ---" } if cc.BearerToken != "" { cc.BearerToken = "--- REDACTED ---" } if cc.AuthConfigPersister != nil { cc.AuthConfigPersister = sanitizedAuthConfigPersister{cc.AuthConfigPersister} } if cc.ExecProvider != nil && cc.ExecProvider.Config != nil { cc.ExecProvider.Config = sanitizedObject{Object: cc.ExecProvider.Config} } return fmt.Sprintf("%#v", cc) } // ImpersonationConfig has all the available impersonation options type ImpersonationConfig struct { // UserName is the username to impersonate on each request. UserName string // UID is a unique value that identifies the user. UID string // Groups are the groups to impersonate on each request. Groups []string // Extra is a free-form field which can be used to link some authentication information // to authorization information. This field allows you to impersonate it. Extra map[string][]string } // +k8s:deepcopy-gen=true // TLSClientConfig contains settings to enable transport layer security type TLSClientConfig struct { // Server should be accessed without verifying the TLS certificate. For testing only. Insecure bool // ServerName is passed to the server for SNI and is used in the client to check server // certificates against. If ServerName is empty, the hostname used to contact the // server is used. ServerName string // Server requires TLS client certificate authentication CertFile string // Server requires TLS client certificate authentication KeyFile string // Trusted root certificates for server CAFile string // CertData holds PEM-encoded bytes (typically read from a client certificate file). // CertData takes precedence over CertFile CertData []byte // KeyData holds PEM-encoded bytes (typically read from a client certificate key file). // KeyData takes precedence over KeyFile KeyData []byte `datapolicy:"security-key"` // CAData holds PEM-encoded bytes (typically read from a root certificates bundle). // CAData takes precedence over CAFile CAData []byte // NextProtos is a list of supported application level protocols, in order of preference. // Used to populate tls.Config.NextProtos. // To indicate to the server http/1.1 is preferred over http/2, set to ["http/1.1", "h2"] (though the server is free to ignore that preference). // To use only http/1.1, set to ["http/1.1"]. NextProtos []string } var _ fmt.Stringer = TLSClientConfig{} var _ fmt.GoStringer = TLSClientConfig{} type sanitizedTLSClientConfig TLSClientConfig // GoString implements fmt.GoStringer and sanitizes sensitive fields of // TLSClientConfig to prevent accidental leaking via logs. func (c TLSClientConfig) GoString() string { return c.String() } // String implements fmt.Stringer and sanitizes sensitive fields of // TLSClientConfig to prevent accidental leaking via logs. func (c TLSClientConfig) String() string { cc := sanitizedTLSClientConfig{ Insecure: c.Insecure, ServerName: c.ServerName, CertFile: c.CertFile, KeyFile: c.KeyFile, CAFile: c.CAFile, CertData: c.CertData, KeyData: c.KeyData, CAData: c.CAData, NextProtos: c.NextProtos, } // Explicitly mark non-empty credential fields as redacted. if len(cc.CertData) != 0 { cc.CertData = []byte("--- TRUNCATED ---") } if len(cc.KeyData) != 0 { cc.KeyData = []byte("--- REDACTED ---") } return fmt.Sprintf("%#v", cc) } type ContentConfig struct { // AcceptContentTypes specifies the types the client will accept and is optional. // If not set, ContentType will be used to define the Accept header AcceptContentTypes string // ContentType specifies the wire format used to communicate with the server. // This value will be set as the Accept header on requests made to the server, and // as the default content type on any object sent to the server. If not set, // "application/json" is used. ContentType string // GroupVersion is the API version to talk to. Must be provided when initializing // a RESTClient directly. When initializing a Client, will be set with the default // code version. GroupVersion *schema.GroupVersion // NegotiatedSerializer is used for obtaining encoders and decoders for multiple // supported media types. // // TODO: NegotiatedSerializer will be phased out as internal clients are removed // from Kubernetes. NegotiatedSerializer runtime.NegotiatedSerializer } // RESTClientFor returns a RESTClient that satisfies the requested attributes on a client Config // object. Note that a RESTClient may require fields that are optional when initializing a Client. // A RESTClient created by this method is generic - it expects to operate on an API that follows // the Kubernetes conventions, but may not be the Kubernetes API. // RESTClientFor is equivalent to calling RESTClientForConfigAndClient(config, httpClient), // where httpClient was generated with HTTPClientFor(config). func RESTClientFor(config *Config) (*RESTClient, error) { if config.GroupVersion == nil { return nil, fmt.Errorf("GroupVersion is required when initializing a RESTClient") } if config.NegotiatedSerializer == nil { return nil, fmt.Errorf("NegotiatedSerializer is required when initializing a RESTClient") } // Validate config.Host before constructing the transport/client so we can fail fast. // ServerURL will be obtained later in RESTClientForConfigAndClient() _, _, err := DefaultServerUrlFor(config) if err != nil { return nil, err } httpClient, err := HTTPClientFor(config) if err != nil { return nil, err } return RESTClientForConfigAndClient(config, httpClient) } // RESTClientForConfigAndClient returns a RESTClient that satisfies the requested attributes on a // client Config object. // Unlike RESTClientFor, RESTClientForConfigAndClient allows to pass an http.Client that is shared // between all the API Groups and Versions. // Note that the http client takes precedence over the transport values configured. // The http client defaults to the `http.DefaultClient` if nil. func RESTClientForConfigAndClient(config *Config, httpClient *http.Client) (*RESTClient, error) { if config.GroupVersion == nil { return nil, fmt.Errorf("GroupVersion is required when initializing a RESTClient") } if config.NegotiatedSerializer == nil { return nil, fmt.Errorf("NegotiatedSerializer is required when initializing a RESTClient") } baseURL, versionedAPIPath, err := DefaultServerUrlFor(config) if err != nil { return nil, err } rateLimiter := config.RateLimiter if rateLimiter == nil { qps := config.QPS if config.QPS == 0.0 { qps = DefaultQPS } burst := config.Burst if config.Burst == 0 { burst = DefaultBurst } if qps > 0 { rateLimiter = flowcontrol.NewTokenBucketRateLimiter(qps, burst) } } var gv schema.GroupVersion if config.GroupVersion != nil { gv = *config.GroupVersion } clientContent := ClientContentConfig{ AcceptContentTypes: config.AcceptContentTypes, ContentType: config.ContentType, GroupVersion: gv, Negotiator: runtime.NewClientNegotiator(config.NegotiatedSerializer, gv), } restClient, err := NewRESTClient(baseURL, versionedAPIPath, clientContent, rateLimiter, httpClient) if err == nil && config.WarningHandler != nil { restClient.warningHandler = config.WarningHandler } return restClient, err } // UnversionedRESTClientFor is the same as RESTClientFor, except that it allows // the config.Version to be empty. func UnversionedRESTClientFor(config *Config) (*RESTClient, error) { if config.NegotiatedSerializer == nil { return nil, fmt.Errorf("NegotiatedSerializer is required when initializing a RESTClient") } // Validate config.Host before constructing the transport/client so we can fail fast. // ServerURL will be obtained later in UnversionedRESTClientForConfigAndClient() _, _, err := DefaultServerUrlFor(config) if err != nil { return nil, err } httpClient, err := HTTPClientFor(config) if err != nil { return nil, err } return UnversionedRESTClientForConfigAndClient(config, httpClient) } // UnversionedRESTClientForConfigAndClient is the same as RESTClientForConfigAndClient, // except that it allows the config.Version to be empty. func UnversionedRESTClientForConfigAndClient(config *Config, httpClient *http.Client) (*RESTClient, error) { if config.NegotiatedSerializer == nil { return nil, fmt.Errorf("NegotiatedSerializer is required when initializing a RESTClient") } baseURL, versionedAPIPath, err := DefaultServerUrlFor(config) if err != nil { return nil, err } rateLimiter := config.RateLimiter if rateLimiter == nil { qps := config.QPS if config.QPS == 0.0 { qps = DefaultQPS } burst := config.Burst if config.Burst == 0 { burst = DefaultBurst } if qps > 0 { rateLimiter = flowcontrol.NewTokenBucketRateLimiter(qps, burst) } } gv := metav1.SchemeGroupVersion if config.GroupVersion != nil { gv = *config.GroupVersion } clientContent := ClientContentConfig{ AcceptContentTypes: config.AcceptContentTypes, ContentType: config.ContentType, GroupVersion: gv, Negotiator: runtime.NewClientNegotiator(config.NegotiatedSerializer, gv), } restClient, err := NewRESTClient(baseURL, versionedAPIPath, clientContent, rateLimiter, httpClient) if err == nil && config.WarningHandler != nil { restClient.warningHandler = config.WarningHandler } return restClient, err } // SetKubernetesDefaults sets default values on the provided client config for accessing the // Kubernetes API or returns an error if any of the defaults are impossible or invalid. func SetKubernetesDefaults(config *Config) error { if len(config.UserAgent) == 0 { config.UserAgent = DefaultKubernetesUserAgent() } return nil } // adjustCommit returns sufficient significant figures of the commit's git hash. func adjustCommit(c string) string { if len(c) == 0 { return "unknown" } if len(c) > 7 { return c[:7] } return c } // adjustVersion strips "alpha", "beta", etc. from version in form // major.minor.patch-[alpha|beta|etc]. func adjustVersion(v string) string { if len(v) == 0 { return "unknown" } seg := strings.SplitN(v, "-", 2) return seg[0] } // adjustCommand returns the last component of the // OS-specific command path for use in User-Agent. func adjustCommand(p string) string { // Unlikely, but better than returning "". if len(p) == 0 { return "unknown" } return filepath.Base(p) } // buildUserAgent builds a User-Agent string from given args. func buildUserAgent(command, version, os, arch, commit string) string { return fmt.Sprintf( "%s/%s (%s/%s) kubernetes/%s", command, version, os, arch, commit) } // DefaultKubernetesUserAgent returns a User-Agent string built from static global vars. func DefaultKubernetesUserAgent() string { return buildUserAgent( adjustCommand(os.Args[0]), adjustVersion(version.Get().GitVersion), gruntime.GOOS, gruntime.GOARCH, adjustCommit(version.Get().GitCommit)) } // InClusterConfig returns a config object which uses the service account // kubernetes gives to pods. It's intended for clients that expect to be // running inside a pod running on kubernetes. It will return ErrNotInCluster // if called from a process not running in a kubernetes environment. func InClusterConfig() (*Config, error) { const ( tokenFile = "/var/run/secrets/kubernetes.io/serviceaccount/token" rootCAFile = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" ) host, port := os.Getenv("KUBERNETES_SERVICE_HOST"), os.Getenv("KUBERNETES_SERVICE_PORT") if len(host) == 0 || len(port) == 0 { return nil, ErrNotInCluster } token, err := os.ReadFile(tokenFile) if err != nil { return nil, err } tlsClientConfig := TLSClientConfig{} if _, err := certutil.NewPool(rootCAFile); err != nil { klog.Errorf("Expected to load root CA config from %s, but got err: %v", rootCAFile, err) } else { tlsClientConfig.CAFile = rootCAFile } return &Config{ // TODO: switch to using cluster DNS. Host: "https://" + net.JoinHostPort(host, port), TLSClientConfig: tlsClientConfig, BearerToken: string(token), BearerTokenFile: tokenFile, }, nil } // IsConfigTransportTLS returns true if and only if the provided // config will result in a protected connection to the server when it // is passed to restclient.RESTClientFor(). Use to determine when to // send credentials over the wire. // // Note: the Insecure flag is ignored when testing for this value, so MITM attacks are // still possible. func IsConfigTransportTLS(config Config) bool { baseURL, _, err := DefaultServerUrlFor(&config) if err != nil { return false } return baseURL.Scheme == "https" } // LoadTLSFiles copies the data from the CertFile, KeyFile, and CAFile fields into the CertData, // KeyData, and CAFile fields, or returns an error. If no error is returned, all three fields are // either populated or were empty to start. func LoadTLSFiles(c *Config) error { var err error c.CAData, err = dataFromSliceOrFile(c.CAData, c.CAFile) if err != nil { return err } c.CertData, err = dataFromSliceOrFile(c.CertData, c.CertFile) if err != nil { return err } c.KeyData, err = dataFromSliceOrFile(c.KeyData, c.KeyFile) return err } // dataFromSliceOrFile returns data from the slice (if non-empty), or from the file, // or an error if an error occurred reading the file func dataFromSliceOrFile(data []byte, file string) ([]byte, error) { if len(data) > 0 { return data, nil } if len(file) > 0 { fileData, err := os.ReadFile(file) if err != nil { return []byte{}, err } return fileData, nil } return nil, nil } func AddUserAgent(config *Config, userAgent string) *Config { fullUserAgent := DefaultKubernetesUserAgent() + "/" + userAgent config.UserAgent = fullUserAgent return config } // AnonymousClientConfig returns a copy of the given config with all user credentials (cert/key, bearer token, and username/password) and custom transports (WrapTransport, Transport) removed func AnonymousClientConfig(config *Config) *Config { // copy only known safe fields return &Config{ Host: config.Host, APIPath: config.APIPath, ContentConfig: config.ContentConfig, TLSClientConfig: TLSClientConfig{ Insecure: config.Insecure, ServerName: config.ServerName, CAFile: config.TLSClientConfig.CAFile, CAData: config.TLSClientConfig.CAData, NextProtos: config.TLSClientConfig.NextProtos, }, RateLimiter: config.RateLimiter, WarningHandler: config.WarningHandler, UserAgent: config.UserAgent, DisableCompression: config.DisableCompression, QPS: config.QPS, Burst: config.Burst, Timeout: config.Timeout, Dial: config.Dial, Proxy: config.Proxy, } } // CopyConfig returns a copy of the given config func CopyConfig(config *Config) *Config { c := &Config{ Host: config.Host, APIPath: config.APIPath, ContentConfig: config.ContentConfig, Username: config.Username, Password: config.Password, BearerToken: config.BearerToken, BearerTokenFile: config.BearerTokenFile, Impersonate: ImpersonationConfig{ UserName: config.Impersonate.UserName, UID: config.Impersonate.UID, Groups: config.Impersonate.Groups, Extra: config.Impersonate.Extra, }, AuthProvider: config.AuthProvider, AuthConfigPersister: config.AuthConfigPersister, ExecProvider: config.ExecProvider, TLSClientConfig: TLSClientConfig{ Insecure: config.TLSClientConfig.Insecure, ServerName: config.TLSClientConfig.ServerName, CertFile: config.TLSClientConfig.CertFile, KeyFile: config.TLSClientConfig.KeyFile, CAFile: config.TLSClientConfig.CAFile, CertData: config.TLSClientConfig.CertData, KeyData: config.TLSClientConfig.KeyData, CAData: config.TLSClientConfig.CAData, NextProtos: config.TLSClientConfig.NextProtos, }, UserAgent: config.UserAgent, DisableCompression: config.DisableCompression, Transport: config.Transport, WrapTransport: config.WrapTransport, QPS: config.QPS, Burst: config.Burst, RateLimiter: config.RateLimiter, WarningHandler: config.WarningHandler, Timeout: config.Timeout, Dial: config.Dial, Proxy: config.Proxy, } if config.ExecProvider != nil && config.ExecProvider.Config != nil { c.ExecProvider.Config = config.ExecProvider.Config.DeepCopyObject() } return c } // CodecFactoryForGeneratedClient returns the provided CodecFactory if there are no enabled client // feature gates affecting serialization. Otherwise, it constructs and returns a new CodecFactory // from the provided Scheme. // // This is supported ONLY for use by clients generated with client-gen. The caller is responsible // for ensuring that the CodecFactory argument was constructed using the Scheme argument. func CodecFactoryForGeneratedClient(scheme *runtime.Scheme, codecs serializer.CodecFactory) serializer.CodecFactory { if !features.FeatureGates().Enabled(features.ClientsAllowCBOR) { // NOTE: This assumes client-gen will not generate CBOR-enabled Codecs as long as // the feature gate exists. return codecs } return serializer.NewCodecFactory(scheme, serializer.WithSerializer(cbor.NewSerializerInfo)) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/rest/with_retry.go
vendor/k8s.io/client-go/rest/with_retry.go
/* Copyright 2021 The Kubernetes 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. */ package rest import ( "context" "fmt" "io" "net/http" "net/url" "time" "k8s.io/klog/v2" ) // IsRetryableErrorFunc allows the client to provide its own function // that determines whether the specified err from the server is retryable. // // request: the original request sent to the server // err: the server sent this error to us // // The function returns true if the error is retryable and the request // can be retried, otherwise it returns false. // We have four mode of communications - 'Stream', 'Watch', 'Do' and 'DoRaw', this // function allows us to customize the retryability aspect of each. type IsRetryableErrorFunc func(request *http.Request, err error) bool func (r IsRetryableErrorFunc) IsErrorRetryable(request *http.Request, err error) bool { return r(request, err) } var neverRetryError = IsRetryableErrorFunc(func(_ *http.Request, _ error) bool { return false }) // WithRetry allows the client to retry a request up to a certain number of times // Note that WithRetry is not safe for concurrent use by multiple // goroutines without additional locking or coordination. type WithRetry interface { // IsNextRetry advances the retry counter appropriately // and returns true if the request should be retried, // otherwise it returns false, if: // - we have already reached the maximum retry threshold. // - the error does not fall into the retryable category. // - the server has not sent us a 429, or 5xx status code and the // 'Retry-After' response header is not set with a value. // - we need to seek to the beginning of the request body before we // initiate the next retry, the function should log an error and // return false if it fails to do so. // // restReq: the associated rest.Request // httpReq: the HTTP Request sent to the server // resp: the response sent from the server, it is set if err is nil // err: the server sent this error to us, if err is set then resp is nil. // f: a IsRetryableErrorFunc function provided by the client that determines // if the err sent by the server is retryable. IsNextRetry(ctx context.Context, restReq *Request, httpReq *http.Request, resp *http.Response, err error, f IsRetryableErrorFunc) bool // Before should be invoked prior to each attempt, including // the first one. If an error is returned, the request should // be aborted immediately. // // Before may also be additionally responsible for preparing // the request for the next retry, namely in terms of resetting // the request body in case it has been read. Before(ctx context.Context, r *Request) error // After should be invoked immediately after an attempt is made. After(ctx context.Context, r *Request, resp *http.Response, err error) // WrapPreviousError wraps the error from any previous attempt into // the final error specified in 'finalErr', so the user has more // context why the request failed. // For example, if a request times out after multiple retries then // we see a generic context.Canceled or context.DeadlineExceeded // error which is not very useful in debugging. This function can // wrap any error from previous attempt(s) to provide more context to // the user. The error returned in 'err' must satisfy the // following conditions: // a: errors.Unwrap(err) = errors.Unwrap(finalErr) if finalErr // implements Unwrap // b: errors.Unwrap(err) = finalErr if finalErr does not // implements Unwrap // c: errors.Is(err, otherErr) = errors.Is(finalErr, otherErr) WrapPreviousError(finalErr error) (err error) } // RetryAfter holds information associated with the next retry. type RetryAfter struct { // Wait is the duration the server has asked us to wait before // the next retry is initiated. // This is the value of the 'Retry-After' response header in seconds. Wait time.Duration // Attempt is the Nth attempt after which we have received a retryable // error or a 'Retry-After' response header from the server. Attempt int // Reason describes why we are retrying the request Reason string } type withRetry struct { maxRetries int attempts int // retry after parameters that pertain to the attempt that is to // be made soon, so as to enable 'Before' and 'After' to refer // to the retry parameters. // - for the first attempt, it will always be nil // - for consecutive attempts, it is non nil and holds the // retry after parameters for the next attempt to be made. retryAfter *RetryAfter // we keep track of two most recent errors, if the most // recent attempt is labeled as 'N' then: // - currentErr represents the error returned by attempt N, it // can be nil if attempt N did not return an error. // - previousErr represents an error from an attempt 'M' which // precedes attempt 'N' (N - M >= 1), it is non nil only when: // - for a sequence of attempt(s) 1..n (n>1), there // is an attempt k (k<n) that returned an error. previousErr, currentErr error } func (r *withRetry) trackPreviousError(err error) { // keep track of two most recent errors if r.currentErr != nil { r.previousErr = r.currentErr } r.currentErr = err } func (r *withRetry) IsNextRetry(ctx context.Context, restReq *Request, httpReq *http.Request, resp *http.Response, err error, f IsRetryableErrorFunc) bool { defer r.trackPreviousError(err) if httpReq == nil || (resp == nil && err == nil) { // bad input, we do nothing. return false } if restReq.body != nil { // we have an opaque reader, we can't safely reset it return false } r.attempts++ r.retryAfter = &RetryAfter{Attempt: r.attempts} if r.attempts > r.maxRetries { return false } // if the server returned an error, it takes precedence over the http response. var errIsRetryable bool if f != nil && err != nil && f.IsErrorRetryable(httpReq, err) { errIsRetryable = true // we have a retryable error, for which we will create an // artificial "Retry-After" response. resp = retryAfterResponse() } if err != nil && !errIsRetryable { return false } // if we are here, we have either a or b: // a: we have a retryable error, for which we already // have an artificial "Retry-After" response. // b: we have a response from the server for which we // need to check if it is retryable seconds, wait := checkWait(resp) if !wait { return false } r.retryAfter.Wait = time.Duration(seconds) * time.Second r.retryAfter.Reason = getRetryReason(r.attempts, seconds, resp, err) return true } func (r *withRetry) Before(ctx context.Context, request *Request) error { // If the request context is already canceled there // is no need to retry. if ctx.Err() != nil { r.trackPreviousError(ctx.Err()) return ctx.Err() } url := request.URL() // r.retryAfter represents the retry after parameters calculated // from the (response, err) tuple from the last attempt, so 'Before' // can apply these retry after parameters prior to the next attempt. // 'r.retryAfter == nil' indicates that this is the very first attempt. if r.retryAfter == nil { // we do a backoff sleep before the first attempt is made, // (preserving current behavior). if request.backoff != nil { request.backoff.Sleep(request.backoff.CalculateBackoff(url)) } return nil } // if we are here, we have made attempt(s) at least once before. if request.backoff != nil { delay := request.backoff.CalculateBackoff(url) if r.retryAfter.Wait > delay { delay = r.retryAfter.Wait } request.backoff.Sleep(delay) } // We are retrying the request that we already send to // apiserver at least once before. This request should // also be throttled with the client-internal rate limiter. if err := request.tryThrottleWithInfo(ctx, r.retryAfter.Reason); err != nil { r.trackPreviousError(ctx.Err()) return err } klog.V(4).Infof("Got a Retry-After %s response for attempt %d to %v", r.retryAfter.Wait, r.retryAfter.Attempt, request.URL().String()) return nil } func (r *withRetry) After(ctx context.Context, request *Request, resp *http.Response, err error) { // 'After' is invoked immediately after an attempt is made, let's label // the attempt we have just made as attempt 'N'. // the current value of r.retryAfter represents the retry after // parameters calculated from the (response, err) tuple from // attempt N-1, so r.retryAfter is outdated and should not be // referred to here. isRetry := r.retryAfter != nil r.retryAfter = nil // the client finishes a single request after N attempts (1..N) // - all attempts (1..N) are counted to the rest_client_requests_total // metric (current behavior). // - every attempt after the first (2..N) are counted to the // rest_client_request_retries_total metric. updateRequestResultMetric(ctx, request, resp, err) if isRetry { // this is attempt 2 or later updateRequestRetryMetric(ctx, request, resp, err) } if request.c.base != nil { if err != nil { request.backoff.UpdateBackoff(request.URL(), err, 0) } else { request.backoff.UpdateBackoff(request.URL(), err, resp.StatusCode) } } } func (r *withRetry) WrapPreviousError(currentErr error) error { if currentErr == nil || r.previousErr == nil { return currentErr } // if both previous and current error objects represent the error, // then there is no need to wrap the previous error. if currentErr.Error() == r.previousErr.Error() { return currentErr } previousErr := r.previousErr // net/http wraps the underlying error with an url.Error, if the // previous err object is an instance of url.Error, then we can // unwrap it to get to the inner error object, this is so we can // avoid error message like: // Error: Get "http://foo.bar/api/v1": context deadline exceeded - error \ // from a previous attempt: Error: Get "http://foo.bar/api/v1": EOF if urlErr, ok := r.previousErr.(*url.Error); ok && urlErr != nil { if urlErr.Unwrap() != nil { previousErr = urlErr.Unwrap() } } return &wrapPreviousError{ currentErr: currentErr, previousError: previousErr, } } type wrapPreviousError struct { currentErr, previousError error } func (w *wrapPreviousError) Unwrap() error { return w.currentErr } func (w *wrapPreviousError) Error() string { return fmt.Sprintf("%s - error from a previous attempt: %s", w.currentErr.Error(), w.previousError.Error()) } // checkWait returns true along with a number of seconds if // the server instructed us to wait before retrying. func checkWait(resp *http.Response) (int, bool) { switch r := resp.StatusCode; { // any 500 error code and 429 can trigger a wait case r == http.StatusTooManyRequests, r >= 500: default: return 0, false } i, ok := retryAfterSeconds(resp) return i, ok } func getRetryReason(retries, seconds int, resp *http.Response, err error) string { // priority and fairness sets the UID of the FlowSchema // associated with a request in the following response Header. const responseHeaderMatchedFlowSchemaUID = "X-Kubernetes-PF-FlowSchema-UID" message := fmt.Sprintf("retries: %d, retry-after: %ds", retries, seconds) switch { case resp.StatusCode == http.StatusTooManyRequests: // it is server-side throttling from priority and fairness flowSchemaUID := resp.Header.Get(responseHeaderMatchedFlowSchemaUID) return fmt.Sprintf("%s - retry-reason: due to server-side throttling, FlowSchema UID: %q", message, flowSchemaUID) case err != nil: // it's a retryable error return fmt.Sprintf("%s - retry-reason: due to retryable error, error: %v", message, err) default: return fmt.Sprintf("%s - retry-reason: %d", message, resp.StatusCode) } } func readAndCloseResponseBody(resp *http.Response) { if resp == nil { return } // Ensure the response body is fully read and closed // before we reconnect, so that we reuse the same TCP // connection. const maxBodySlurpSize = 2 << 10 defer resp.Body.Close() if resp.ContentLength <= maxBodySlurpSize { io.Copy(io.Discard, &io.LimitedReader{R: resp.Body, N: maxBodySlurpSize}) } } func retryAfterResponse() *http.Response { return retryAfterResponseWithDelay("1") } func retryAfterResponseWithDelay(delay string) *http.Response { return retryAfterResponseWithCodeAndDelay(http.StatusInternalServerError, delay) } func retryAfterResponseWithCodeAndDelay(code int, delay string) *http.Response { return &http.Response{ StatusCode: code, Header: http.Header{"Retry-After": []string{delay}}, } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/rest/transport.go
vendor/k8s.io/client-go/rest/transport.go
/* Copyright 2014 The Kubernetes 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. */ package rest import ( "crypto/tls" "errors" "net/http" "k8s.io/client-go/pkg/apis/clientauthentication" "k8s.io/client-go/plugin/pkg/client/auth/exec" "k8s.io/client-go/transport" ) // HTTPClientFor returns an http.Client that will provide the authentication // or transport level security defined by the provided Config. Will return the // default http.DefaultClient if no special case behavior is needed. func HTTPClientFor(config *Config) (*http.Client, error) { transport, err := TransportFor(config) if err != nil { return nil, err } var httpClient *http.Client if transport != http.DefaultTransport || config.Timeout > 0 { httpClient = &http.Client{ Transport: transport, Timeout: config.Timeout, } } else { httpClient = http.DefaultClient } return httpClient, nil } // TLSConfigFor returns a tls.Config that will provide the transport level security defined // by the provided Config. Will return nil if no transport level security is requested. func TLSConfigFor(config *Config) (*tls.Config, error) { cfg, err := config.TransportConfig() if err != nil { return nil, err } return transport.TLSConfigFor(cfg) } // TransportFor returns an http.RoundTripper that will provide the authentication // or transport level security defined by the provided Config. Will return the // default http.DefaultTransport if no special case behavior is needed. func TransportFor(config *Config) (http.RoundTripper, error) { cfg, err := config.TransportConfig() if err != nil { return nil, err } return transport.New(cfg) } // HTTPWrappersForConfig wraps a round tripper with any relevant layered behavior from the // config. Exposed to allow more clients that need HTTP-like behavior but then must hijack // the underlying connection (like WebSocket or HTTP2 clients). Pure HTTP clients should use // the higher level TransportFor or RESTClientFor methods. func HTTPWrappersForConfig(config *Config, rt http.RoundTripper) (http.RoundTripper, error) { cfg, err := config.TransportConfig() if err != nil { return nil, err } return transport.HTTPWrappersForConfig(cfg, rt) } // TransportConfig converts a client config to an appropriate transport config. func (c *Config) TransportConfig() (*transport.Config, error) { conf := &transport.Config{ UserAgent: c.UserAgent, Transport: c.Transport, WrapTransport: c.WrapTransport, DisableCompression: c.DisableCompression, TLS: transport.TLSConfig{ Insecure: c.Insecure, ServerName: c.ServerName, CAFile: c.CAFile, CAData: c.CAData, CertFile: c.CertFile, CertData: c.CertData, KeyFile: c.KeyFile, KeyData: c.KeyData, NextProtos: c.NextProtos, }, Username: c.Username, Password: c.Password, BearerToken: c.BearerToken, BearerTokenFile: c.BearerTokenFile, Impersonate: transport.ImpersonationConfig{ UserName: c.Impersonate.UserName, UID: c.Impersonate.UID, Groups: c.Impersonate.Groups, Extra: c.Impersonate.Extra, }, Proxy: c.Proxy, } if c.Dial != nil { conf.DialHolder = &transport.DialHolder{Dial: c.Dial} } if c.ExecProvider != nil && c.AuthProvider != nil { return nil, errors.New("execProvider and authProvider cannot be used in combination") } if c.ExecProvider != nil { var cluster *clientauthentication.Cluster if c.ExecProvider.ProvideClusterInfo { var err error cluster, err = ConfigToExecCluster(c) if err != nil { return nil, err } } provider, err := exec.GetAuthenticator(c.ExecProvider, cluster) if err != nil { return nil, err } if err := provider.UpdateTransportConfig(conf); err != nil { return nil, err } } if c.AuthProvider != nil { provider, err := GetAuthProvider(c.Host, c.AuthProvider, c.AuthConfigPersister) if err != nil { return nil, err } conf.Wrap(provider.WrapTransport) } return conf, nil } // Wrap adds a transport middleware function that will give the caller // an opportunity to wrap the underlying http.RoundTripper prior to the // first API call being made. The provided function is invoked after any // existing transport wrappers are invoked. func (c *Config) Wrap(fn transport.WrapperFunc) { c.WrapTransport = transport.Wrappers(c.WrapTransport, fn) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/rest/plugin.go
vendor/k8s.io/client-go/rest/plugin.go
/* Copyright 2016 The Kubernetes 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. */ package rest import ( "fmt" "net/http" "sync" "k8s.io/klog/v2" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" ) type AuthProvider interface { // WrapTransport allows the plugin to create a modified RoundTripper that // attaches authorization headers (or other info) to requests. WrapTransport(http.RoundTripper) http.RoundTripper // Login allows the plugin to initialize its configuration. It must not // require direct user interaction. Login() error } // Factory generates an AuthProvider plugin. // // clusterAddress is the address of the current cluster. // config is the initial configuration for this plugin. // persister allows the plugin to save updated configuration. type Factory func(clusterAddress string, config map[string]string, persister AuthProviderConfigPersister) (AuthProvider, error) // AuthProviderConfigPersister allows a plugin to persist configuration info // for just itself. type AuthProviderConfigPersister interface { Persist(map[string]string) error } type noopPersister struct{} func (n *noopPersister) Persist(_ map[string]string) error { // no operation persister return nil } // All registered auth provider plugins. var pluginsLock sync.Mutex var plugins = make(map[string]Factory) func RegisterAuthProviderPlugin(name string, plugin Factory) error { pluginsLock.Lock() defer pluginsLock.Unlock() if _, found := plugins[name]; found { return fmt.Errorf("auth Provider Plugin %q was registered twice", name) } klog.V(4).Infof("Registered Auth Provider Plugin %q", name) plugins[name] = plugin return nil } func GetAuthProvider(clusterAddress string, apc *clientcmdapi.AuthProviderConfig, persister AuthProviderConfigPersister) (AuthProvider, error) { pluginsLock.Lock() defer pluginsLock.Unlock() p, ok := plugins[apc.Name] if !ok { return nil, fmt.Errorf("no Auth Provider found for name %q", apc.Name) } if persister == nil { persister = &noopPersister{} } return p(clusterAddress, apc.Config, persister) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/rest/url_utils.go
vendor/k8s.io/client-go/rest/url_utils.go
/* Copyright 2016 The Kubernetes 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. */ package rest import ( "fmt" "net/url" "path" "k8s.io/apimachinery/pkg/runtime/schema" ) // DefaultServerURL converts a host, host:port, or URL string to the default base server API path // to use with a Client at a given API version following the standard conventions for a // Kubernetes API. func DefaultServerURL(host, apiPath string, groupVersion schema.GroupVersion, defaultTLS bool) (*url.URL, string, error) { if host == "" { return nil, "", fmt.Errorf("host must be a URL or a host:port pair") } base := host hostURL, err := url.Parse(base) if err != nil || hostURL.Scheme == "" || hostURL.Host == "" { scheme := "http://" if defaultTLS { scheme = "https://" } hostURL, err = url.Parse(scheme + base) if err != nil { return nil, "", err } if hostURL.Path != "" && hostURL.Path != "/" { return nil, "", fmt.Errorf("host must be a URL or a host:port pair: %q", base) } } // hostURL.Path is optional; a non-empty Path is treated as a prefix that is to be applied to // all URIs used to access the host. this is useful when there's a proxy in front of the // apiserver that has relocated the apiserver endpoints, forwarding all requests from, for // example, /a/b/c to the apiserver. in this case the Path should be /a/b/c. // // if running without a frontend proxy (that changes the location of the apiserver), then // hostURL.Path should be blank. // // versionedAPIPath, a path relative to baseURL.Path, points to a versioned API base versionedAPIPath := DefaultVersionedAPIPath(apiPath, groupVersion) return hostURL, versionedAPIPath, nil } // DefaultVersionedAPIPath constructs the default path for the given group version, assuming the given // API path, following the standard conventions of the Kubernetes API. func DefaultVersionedAPIPath(apiPath string, groupVersion schema.GroupVersion) string { versionedAPIPath := path.Join("/", apiPath) // Add the version to the end of the path if len(groupVersion.Group) > 0 { versionedAPIPath = path.Join(versionedAPIPath, groupVersion.Group, groupVersion.Version) } else { versionedAPIPath = path.Join(versionedAPIPath, groupVersion.Version) } return versionedAPIPath } // DefaultServerUrlFor is shared between IsConfigTransportTLS and RESTClientFor. It // requires Host and Version to be set prior to being called. func DefaultServerUrlFor(config *Config) (*url.URL, string, error) { // TODO: move the default to secure when the apiserver supports TLS by default // config.Insecure is taken to mean "I want HTTPS but don't bother checking the certs against a CA." hasCA := len(config.CAFile) != 0 || len(config.CAData) != 0 hasCert := len(config.CertFile) != 0 || len(config.CertData) != 0 defaultTLS := hasCA || hasCert || config.Insecure host := config.Host if host == "" { host = "localhost" } if config.GroupVersion != nil { return DefaultServerURL(host, config.APIPath, *config.GroupVersion, defaultTLS) } return DefaultServerURL(host, config.APIPath, schema.GroupVersion{}, defaultTLS) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/rest/fake/fake.go
vendor/k8s.io/client-go/rest/fake/fake.go
/* Copyright 2014 The Kubernetes 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. */ // This is made a separate package and should only be imported by tests, because // it imports testapi package fake import ( "net/http" "net/url" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" restclient "k8s.io/client-go/rest" "k8s.io/client-go/util/flowcontrol" ) // CreateHTTPClient creates an http.Client that will invoke the provided roundTripper func // when a request is made. func CreateHTTPClient(roundTripper func(*http.Request) (*http.Response, error)) *http.Client { return &http.Client{ Transport: roundTripperFunc(roundTripper), } } type roundTripperFunc func(*http.Request) (*http.Response, error) func (f roundTripperFunc) RoundTrip(req *http.Request) (*http.Response, error) { return f(req) } // RESTClient provides a fake RESTClient interface. It is used to mock network // interactions via a rest.Request, or to make them via the provided Client to // a specific server. type RESTClient struct { NegotiatedSerializer runtime.NegotiatedSerializer GroupVersion schema.GroupVersion VersionedAPIPath string // Err is returned when any request would be made to the server. If Err is set, // Req will not be recorded, Resp will not be returned, and Client will not be // invoked. Err error // Req is set to the last request that was executed (had the methods Do/DoRaw) invoked. Req *http.Request // If Client is specified, the client will be invoked instead of returning Resp if // Err is not set. Client *http.Client // Resp is returned to the caller after Req is recorded, unless Err or Client are set. Resp *http.Response } func (c *RESTClient) Get() *restclient.Request { return c.Verb("GET") } func (c *RESTClient) Put() *restclient.Request { return c.Verb("PUT") } func (c *RESTClient) Patch(pt types.PatchType) *restclient.Request { return c.Verb("PATCH").SetHeader("Content-Type", string(pt)) } func (c *RESTClient) Post() *restclient.Request { return c.Verb("POST") } func (c *RESTClient) Delete() *restclient.Request { return c.Verb("DELETE") } func (c *RESTClient) Verb(verb string) *restclient.Request { return c.Request().Verb(verb) } func (c *RESTClient) APIVersion() schema.GroupVersion { return c.GroupVersion } func (c *RESTClient) GetRateLimiter() flowcontrol.RateLimiter { return nil } func (c *RESTClient) Request() *restclient.Request { config := restclient.ClientContentConfig{ ContentType: runtime.ContentTypeJSON, GroupVersion: c.GroupVersion, Negotiator: runtime.NewClientNegotiator(c.NegotiatedSerializer, c.GroupVersion), } return restclient.NewRequestWithClient(&url.URL{Scheme: "https", Host: "localhost"}, c.VersionedAPIPath, config, CreateHTTPClient(c.do)) } // do is invoked when a Request() created by this client is executed. func (c *RESTClient) do(req *http.Request) (*http.Response, error) { if c.Err != nil { return nil, c.Err } c.Req = req if c.Client != nil { return c.Client.Do(req) } return c.Resp, nil }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/rest/watch/decoder.go
vendor/k8s.io/client-go/rest/watch/decoder.go
/* Copyright 2014 The Kubernetes 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. */ package watch import ( "fmt" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/serializer/streaming" "k8s.io/apimachinery/pkg/watch" ) // Decoder implements the watch.Decoder interface for io.ReadClosers that // have contents which consist of a series of watchEvent objects encoded // with the given streaming decoder. The internal objects will be then // decoded by the embedded decoder. type Decoder struct { decoder streaming.Decoder embeddedDecoder runtime.Decoder } // NewDecoder creates an Decoder for the given writer and codec. func NewDecoder(decoder streaming.Decoder, embeddedDecoder runtime.Decoder) *Decoder { return &Decoder{ decoder: decoder, embeddedDecoder: embeddedDecoder, } } // Decode blocks until it can return the next object in the reader. Returns an error // if the reader is closed or an object can't be decoded. func (d *Decoder) Decode() (watch.EventType, runtime.Object, error) { var got metav1.WatchEvent res, _, err := d.decoder.Decode(nil, &got) if err != nil { return "", nil, err } if res != &got { return "", nil, fmt.Errorf("unable to decode to metav1.WatchEvent") } switch got.Type { case string(watch.Added), string(watch.Modified), string(watch.Deleted), string(watch.Error), string(watch.Bookmark): default: return "", nil, fmt.Errorf("got invalid watch event type: %v", got.Type) } obj, err := runtime.Decode(d.embeddedDecoder, got.Object.Raw) if err != nil { return "", nil, fmt.Errorf("unable to decode watch event: %v", err) } return watch.EventType(got.Type), obj, nil } // Close closes the underlying r. func (d *Decoder) Close() { d.decoder.Close() }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/rest/watch/encoder.go
vendor/k8s.io/client-go/rest/watch/encoder.go
/* Copyright 2014 The Kubernetes 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. */ package watch import ( "encoding/json" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/serializer/streaming" "k8s.io/apimachinery/pkg/watch" ) // Encoder serializes watch.Events into io.Writer. The internal objects // are encoded using embedded encoder, and the outer Event is serialized // using encoder. // TODO: this type is only used by tests type Encoder struct { encoder streaming.Encoder embeddedEncoder runtime.Encoder } func NewEncoder(encoder streaming.Encoder, embeddedEncoder runtime.Encoder) *Encoder { return &Encoder{ encoder: encoder, embeddedEncoder: embeddedEncoder, } } // Encode writes an event to the writer. Returns an error // if the writer is closed or an object can't be encoded. func (e *Encoder) Encode(event *watch.Event) error { data, err := runtime.Encode(e.embeddedEncoder, event.Object) if err != nil { return err } // FIXME: get rid of json.RawMessage. return e.encoder.Encode(&metav1.WatchEvent{ Type: string(event.Type), Object: runtime.RawExtension{Raw: json.RawMessage(data)}, }) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/transport/cache_go118.go
vendor/k8s.io/client-go/transport/cache_go118.go
//go:build go1.18 /* Copyright 2022 The Kubernetes 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. */ package transport // this is just to make the "unused" linter rule happy var _ = isCacheKeyComparable[tlsCacheKey] // assert at compile time that tlsCacheKey is comparable in a way that will never panic at runtime. // // Golang 1.20 introduced an exception to type constraints that allows comparable, but not // necessarily strictly comparable type arguments to satisfy the `comparable` type constraint, // thus allowing interfaces to fulfil the `comparable` constraint. // However, by definition, "A comparison of two interface values with identical // dynamic types causes a run-time panic if that type is not comparable". // // We want to make sure that comparing two `tlsCacheKey` elements won't cause a // runtime panic. In order to do that, we'll force the `tlsCacheKey` to be strictly // comparable, thus making it impossible for it to contain interfaces. // To assert strict comparability, we'll use another definition: "Type // parameters are comparable if they are strictly comparable". // Below, we first construct a type parameter from the `tlsCacheKey` type so that // we can then push this type parameter to a comparable check, thus checking these // are strictly comparable. // // Original suggestion from https://github.com/golang/go/issues/56548#issuecomment-1317673963 func isCacheKeyComparable[K tlsCacheKey]() { _ = isComparable[K] } func isComparable[T comparable]() {}
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/transport/cache.go
vendor/k8s.io/client-go/transport/cache.go
/* Copyright 2015 The Kubernetes 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. */ package transport import ( "context" "fmt" "net" "net/http" "strings" "sync" "time" utilnet "k8s.io/apimachinery/pkg/util/net" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/tools/metrics" ) // TlsTransportCache caches TLS http.RoundTrippers different configurations. The // same RoundTripper will be returned for configs with identical TLS options If // the config has no custom TLS options, http.DefaultTransport is returned. type tlsTransportCache struct { mu sync.Mutex transports map[tlsCacheKey]*http.Transport } // DialerStopCh is stop channel that is passed down to dynamic cert dialer. // It's exposed as variable for testing purposes to avoid testing for goroutine // leakages. var DialerStopCh = wait.NeverStop const idleConnsPerHost = 25 var tlsCache = &tlsTransportCache{transports: make(map[tlsCacheKey]*http.Transport)} type tlsCacheKey struct { insecure bool caData string certData string keyData string `datapolicy:"security-key"` certFile string keyFile string serverName string nextProtos string disableCompression bool // these functions are wrapped to allow them to be used as map keys getCert *GetCertHolder dial *DialHolder } func (t tlsCacheKey) String() string { keyText := "<none>" if len(t.keyData) > 0 { keyText = "<redacted>" } return fmt.Sprintf("insecure:%v, caData:%#v, certData:%#v, keyData:%s, serverName:%s, disableCompression:%t, getCert:%p, dial:%p", t.insecure, t.caData, t.certData, keyText, t.serverName, t.disableCompression, t.getCert, t.dial) } func (c *tlsTransportCache) get(config *Config) (http.RoundTripper, error) { key, canCache, err := tlsConfigKey(config) if err != nil { return nil, err } if canCache { // Ensure we only create a single transport for the given TLS options c.mu.Lock() defer c.mu.Unlock() defer metrics.TransportCacheEntries.Observe(len(c.transports)) // See if we already have a custom transport for this config if t, ok := c.transports[key]; ok { metrics.TransportCreateCalls.Increment("hit") return t, nil } metrics.TransportCreateCalls.Increment("miss") } else { metrics.TransportCreateCalls.Increment("uncacheable") } // Get the TLS options for this client config tlsConfig, err := TLSConfigFor(config) if err != nil { return nil, err } // The options didn't require a custom TLS config if tlsConfig == nil && config.DialHolder == nil && config.Proxy == nil { return http.DefaultTransport, nil } var dial func(ctx context.Context, network, address string) (net.Conn, error) if config.DialHolder != nil { dial = config.DialHolder.Dial } else { dial = (&net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, }).DialContext } // If we use are reloading files, we need to handle certificate rotation properly // TODO(jackkleeman): We can also add rotation here when config.HasCertCallback() is true if config.TLS.ReloadTLSFiles && tlsConfig != nil && tlsConfig.GetClientCertificate != nil { dynamicCertDialer := certRotatingDialer(tlsConfig.GetClientCertificate, dial) tlsConfig.GetClientCertificate = dynamicCertDialer.GetClientCertificate dial = dynamicCertDialer.connDialer.DialContext go dynamicCertDialer.Run(DialerStopCh) } proxy := http.ProxyFromEnvironment if config.Proxy != nil { proxy = config.Proxy } transport := utilnet.SetTransportDefaults(&http.Transport{ Proxy: proxy, TLSHandshakeTimeout: 10 * time.Second, TLSClientConfig: tlsConfig, MaxIdleConnsPerHost: idleConnsPerHost, DialContext: dial, DisableCompression: config.DisableCompression, }) if canCache { // Cache a single transport for these options c.transports[key] = transport } return transport, nil } // tlsConfigKey returns a unique key for tls.Config objects returned from TLSConfigFor func tlsConfigKey(c *Config) (tlsCacheKey, bool, error) { // Make sure ca/key/cert content is loaded if err := loadTLSFiles(c); err != nil { return tlsCacheKey{}, false, err } if c.Proxy != nil { // cannot determine equality for functions return tlsCacheKey{}, false, nil } k := tlsCacheKey{ insecure: c.TLS.Insecure, caData: string(c.TLS.CAData), serverName: c.TLS.ServerName, nextProtos: strings.Join(c.TLS.NextProtos, ","), disableCompression: c.DisableCompression, getCert: c.TLS.GetCertHolder, dial: c.DialHolder, } if c.TLS.ReloadTLSFiles { k.certFile = c.TLS.CertFile k.keyFile = c.TLS.KeyFile } else { k.certData = string(c.TLS.CertData) k.keyData = string(c.TLS.KeyData) } return k, true, nil }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/transport/config.go
vendor/k8s.io/client-go/transport/config.go
/* Copyright 2015 The Kubernetes 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. */ package transport import ( "context" "crypto/tls" "net" "net/http" "net/url" ) // Config holds various options for establishing a transport. type Config struct { // UserAgent is an optional field that specifies the caller of this // request. UserAgent string // The base TLS configuration for this transport. TLS TLSConfig // Username and password for basic authentication Username string Password string `datapolicy:"password"` // Bearer token for authentication BearerToken string `datapolicy:"token"` // Path to a file containing a BearerToken. // If set, the contents are periodically read. // The last successfully read value takes precedence over BearerToken. BearerTokenFile string // Impersonate is the config that this Config will impersonate using Impersonate ImpersonationConfig // DisableCompression bypasses automatic GZip compression requests to the // server. DisableCompression bool // Transport may be used for custom HTTP behavior. This attribute may // not be specified with the TLS client certificate options. Use // WrapTransport for most client level operations. Transport http.RoundTripper // WrapTransport will be invoked for custom HTTP behavior after the // underlying transport is initialized (either the transport created // from TLSClientConfig, Transport, or http.DefaultTransport). The // config may layer other RoundTrippers on top of the returned // RoundTripper. // // A future release will change this field to an array. Use config.Wrap() // instead of setting this value directly. WrapTransport WrapperFunc // DialHolder specifies the dial function for creating unencrypted TCP connections. // This struct indirection is used to make transport configs cacheable. DialHolder *DialHolder // Proxy is the proxy func to be used for all requests made by this // transport. If Proxy is nil, http.ProxyFromEnvironment is used. If Proxy // returns a nil *URL, no proxy is used. // // socks5 proxying does not currently support spdy streaming endpoints. Proxy func(*http.Request) (*url.URL, error) } // DialHolder is used to make the wrapped function comparable so that it can be used as a map key. type DialHolder struct { Dial func(ctx context.Context, network, address string) (net.Conn, error) } // ImpersonationConfig has all the available impersonation options type ImpersonationConfig struct { // UserName matches user.Info.GetName() UserName string // UID matches user.Info.GetUID() UID string // Groups matches user.Info.GetGroups() Groups []string // Extra matches user.Info.GetExtra() Extra map[string][]string } // HasCA returns whether the configuration has a certificate authority or not. func (c *Config) HasCA() bool { return len(c.TLS.CAData) > 0 || len(c.TLS.CAFile) > 0 } // HasBasicAuth returns whether the configuration has basic authentication or not. func (c *Config) HasBasicAuth() bool { return len(c.Username) != 0 } // HasTokenAuth returns whether the configuration has token authentication or not. func (c *Config) HasTokenAuth() bool { return len(c.BearerToken) != 0 || len(c.BearerTokenFile) != 0 } // HasCertAuth returns whether the configuration has certificate authentication or not. func (c *Config) HasCertAuth() bool { return (len(c.TLS.CertData) != 0 || len(c.TLS.CertFile) != 0) && (len(c.TLS.KeyData) != 0 || len(c.TLS.KeyFile) != 0) } // HasCertCallback returns whether the configuration has certificate callback or not. func (c *Config) HasCertCallback() bool { return c.TLS.GetCertHolder != nil } // Wrap adds a transport middleware function that will give the caller // an opportunity to wrap the underlying http.RoundTripper prior to the // first API call being made. The provided function is invoked after any // existing transport wrappers are invoked. func (c *Config) Wrap(fn WrapperFunc) { c.WrapTransport = Wrappers(c.WrapTransport, fn) } // TLSConfig holds the information needed to set up a TLS transport. type TLSConfig struct { CAFile string // Path of the PEM-encoded server trusted root certificates. CertFile string // Path of the PEM-encoded client certificate. KeyFile string // Path of the PEM-encoded client key. ReloadTLSFiles bool // Set to indicate that the original config provided files, and that they should be reloaded Insecure bool // Server should be accessed without verifying the certificate. For testing only. ServerName string // Override for the server name passed to the server for SNI and used to verify certificates. CAData []byte // Bytes of the PEM-encoded server trusted root certificates. Supercedes CAFile. CertData []byte // Bytes of the PEM-encoded client certificate. Supercedes CertFile. KeyData []byte // Bytes of the PEM-encoded client key. Supercedes KeyFile. // NextProtos is a list of supported application level protocols, in order of preference. // Used to populate tls.Config.NextProtos. // To indicate to the server http/1.1 is preferred over http/2, set to ["http/1.1", "h2"] (though the server is free to ignore that preference). // To use only http/1.1, set to ["http/1.1"]. NextProtos []string // Callback that returns a TLS client certificate. CertData, CertFile, KeyData and KeyFile supercede this field. // This struct indirection is used to make transport configs cacheable. GetCertHolder *GetCertHolder } // GetCertHolder is used to make the wrapped function comparable so that it can be used as a map key. type GetCertHolder struct { GetCert func() (*tls.Certificate, error) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/transport/round_trippers.go
vendor/k8s.io/client-go/transport/round_trippers.go
/* Copyright 2015 The Kubernetes 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. */ package transport import ( "crypto/tls" "fmt" "net/http" "net/http/httptrace" "strings" "sync" "time" "golang.org/x/oauth2" utilnet "k8s.io/apimachinery/pkg/util/net" "k8s.io/klog/v2" ) // HTTPWrappersForConfig wraps a round tripper with any relevant layered // behavior from the config. Exposed to allow more clients that need HTTP-like // behavior but then must hijack the underlying connection (like WebSocket or // HTTP2 clients). Pure HTTP clients should use the RoundTripper returned from // New. func HTTPWrappersForConfig(config *Config, rt http.RoundTripper) (http.RoundTripper, error) { if config.WrapTransport != nil { rt = config.WrapTransport(rt) } rt = DebugWrappers(rt) // Set authentication wrappers switch { case config.HasBasicAuth() && config.HasTokenAuth(): return nil, fmt.Errorf("username/password or bearer token may be set, but not both") case config.HasTokenAuth(): var err error rt, err = NewBearerAuthWithRefreshRoundTripper(config.BearerToken, config.BearerTokenFile, rt) if err != nil { return nil, err } case config.HasBasicAuth(): rt = NewBasicAuthRoundTripper(config.Username, config.Password, rt) } if len(config.UserAgent) > 0 { rt = NewUserAgentRoundTripper(config.UserAgent, rt) } if len(config.Impersonate.UserName) > 0 || len(config.Impersonate.UID) > 0 || len(config.Impersonate.Groups) > 0 || len(config.Impersonate.Extra) > 0 { rt = NewImpersonatingRoundTripper(config.Impersonate, rt) } return rt, nil } // DebugWrappers wraps a round tripper and logs based on the current log level. func DebugWrappers(rt http.RoundTripper) http.RoundTripper { switch { case bool(klog.V(9).Enabled()): rt = NewDebuggingRoundTripper(rt, DebugCurlCommand, DebugURLTiming, DebugDetailedTiming, DebugResponseHeaders) case bool(klog.V(8).Enabled()): rt = NewDebuggingRoundTripper(rt, DebugJustURL, DebugRequestHeaders, DebugResponseStatus, DebugResponseHeaders) case bool(klog.V(7).Enabled()): rt = NewDebuggingRoundTripper(rt, DebugJustURL, DebugRequestHeaders, DebugResponseStatus) case bool(klog.V(6).Enabled()): rt = NewDebuggingRoundTripper(rt, DebugURLTiming) } return rt } type authProxyRoundTripper struct { username string uid string groups []string extra map[string][]string rt http.RoundTripper } var _ utilnet.RoundTripperWrapper = &authProxyRoundTripper{} // NewAuthProxyRoundTripper provides a roundtripper which will add auth proxy fields to requests for // authentication terminating proxy cases // assuming you pull the user from the context: // username is the user.Info.GetName() of the user // uid is the user.Info.GetUID() of the user // groups is the user.Info.GetGroups() of the user // extra is the user.Info.GetExtra() of the user // extra can contain any additional information that the authenticator // thought was interesting, for example authorization scopes. // In order to faithfully round-trip through an impersonation flow, these keys // MUST be lowercase. func NewAuthProxyRoundTripper(username, uid string, groups []string, extra map[string][]string, rt http.RoundTripper) http.RoundTripper { return &authProxyRoundTripper{ username: username, uid: uid, groups: groups, extra: extra, rt: rt, } } func (rt *authProxyRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { req = utilnet.CloneRequest(req) SetAuthProxyHeaders(req, rt.username, rt.uid, rt.groups, rt.extra) return rt.rt.RoundTrip(req) } // SetAuthProxyHeaders stomps the auth proxy header fields. It mutates its argument. func SetAuthProxyHeaders(req *http.Request, username, uid string, groups []string, extra map[string][]string) { req.Header.Del("X-Remote-User") req.Header.Del("X-Remote-Uid") req.Header.Del("X-Remote-Group") for key := range req.Header { if strings.HasPrefix(strings.ToLower(key), strings.ToLower("X-Remote-Extra-")) { req.Header.Del(key) } } req.Header.Set("X-Remote-User", username) if len(uid) > 0 { req.Header.Set("X-Remote-Uid", uid) } for _, group := range groups { req.Header.Add("X-Remote-Group", group) } for key, values := range extra { for _, value := range values { req.Header.Add("X-Remote-Extra-"+headerKeyEscape(key), value) } } } func (rt *authProxyRoundTripper) CancelRequest(req *http.Request) { tryCancelRequest(rt.WrappedRoundTripper(), req) } func (rt *authProxyRoundTripper) WrappedRoundTripper() http.RoundTripper { return rt.rt } type userAgentRoundTripper struct { agent string rt http.RoundTripper } var _ utilnet.RoundTripperWrapper = &userAgentRoundTripper{} // NewUserAgentRoundTripper will add User-Agent header to a request unless it has already been set. func NewUserAgentRoundTripper(agent string, rt http.RoundTripper) http.RoundTripper { return &userAgentRoundTripper{agent, rt} } func (rt *userAgentRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { if len(req.Header.Get("User-Agent")) != 0 { return rt.rt.RoundTrip(req) } req = utilnet.CloneRequest(req) req.Header.Set("User-Agent", rt.agent) return rt.rt.RoundTrip(req) } func (rt *userAgentRoundTripper) CancelRequest(req *http.Request) { tryCancelRequest(rt.WrappedRoundTripper(), req) } func (rt *userAgentRoundTripper) WrappedRoundTripper() http.RoundTripper { return rt.rt } type basicAuthRoundTripper struct { username string password string `datapolicy:"password"` rt http.RoundTripper } var _ utilnet.RoundTripperWrapper = &basicAuthRoundTripper{} // NewBasicAuthRoundTripper will apply a BASIC auth authorization header to a // request unless it has already been set. func NewBasicAuthRoundTripper(username, password string, rt http.RoundTripper) http.RoundTripper { return &basicAuthRoundTripper{username, password, rt} } func (rt *basicAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { if len(req.Header.Get("Authorization")) != 0 { return rt.rt.RoundTrip(req) } req = utilnet.CloneRequest(req) req.SetBasicAuth(rt.username, rt.password) return rt.rt.RoundTrip(req) } func (rt *basicAuthRoundTripper) CancelRequest(req *http.Request) { tryCancelRequest(rt.WrappedRoundTripper(), req) } func (rt *basicAuthRoundTripper) WrappedRoundTripper() http.RoundTripper { return rt.rt } // These correspond to the headers used in pkg/apis/authentication. We don't want the package dependency, // but you must not change the values. const ( // ImpersonateUserHeader is used to impersonate a particular user during an API server request ImpersonateUserHeader = "Impersonate-User" // ImpersonateUIDHeader is used to impersonate a particular UID during an API server request ImpersonateUIDHeader = "Impersonate-Uid" // ImpersonateGroupHeader is used to impersonate a particular group during an API server request. // It can be repeated multiplied times for multiple groups. ImpersonateGroupHeader = "Impersonate-Group" // ImpersonateUserExtraHeaderPrefix is a prefix for a header used to impersonate an entry in the // extra map[string][]string for user.Info. The key for the `extra` map is suffix. // The same key can be repeated multiple times to have multiple elements in the slice under a single key. // For instance: // Impersonate-Extra-Foo: one // Impersonate-Extra-Foo: two // results in extra["Foo"] = []string{"one", "two"} ImpersonateUserExtraHeaderPrefix = "Impersonate-Extra-" ) type impersonatingRoundTripper struct { impersonate ImpersonationConfig delegate http.RoundTripper } var _ utilnet.RoundTripperWrapper = &impersonatingRoundTripper{} // NewImpersonatingRoundTripper will add an Act-As header to a request unless it has already been set. func NewImpersonatingRoundTripper(impersonate ImpersonationConfig, delegate http.RoundTripper) http.RoundTripper { return &impersonatingRoundTripper{impersonate, delegate} } func (rt *impersonatingRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { // use the user header as marker for the rest. if len(req.Header.Get(ImpersonateUserHeader)) != 0 { return rt.delegate.RoundTrip(req) } req = utilnet.CloneRequest(req) req.Header.Set(ImpersonateUserHeader, rt.impersonate.UserName) if rt.impersonate.UID != "" { req.Header.Set(ImpersonateUIDHeader, rt.impersonate.UID) } for _, group := range rt.impersonate.Groups { req.Header.Add(ImpersonateGroupHeader, group) } for k, vv := range rt.impersonate.Extra { for _, v := range vv { req.Header.Add(ImpersonateUserExtraHeaderPrefix+headerKeyEscape(k), v) } } return rt.delegate.RoundTrip(req) } func (rt *impersonatingRoundTripper) CancelRequest(req *http.Request) { tryCancelRequest(rt.WrappedRoundTripper(), req) } func (rt *impersonatingRoundTripper) WrappedRoundTripper() http.RoundTripper { return rt.delegate } type bearerAuthRoundTripper struct { bearer string source oauth2.TokenSource rt http.RoundTripper } var _ utilnet.RoundTripperWrapper = &bearerAuthRoundTripper{} // NewBearerAuthRoundTripper adds the provided bearer token to a request // unless the authorization header has already been set. func NewBearerAuthRoundTripper(bearer string, rt http.RoundTripper) http.RoundTripper { return &bearerAuthRoundTripper{bearer, nil, rt} } // NewBearerAuthWithRefreshRoundTripper adds the provided bearer token to a request // unless the authorization header has already been set. // If tokenFile is non-empty, it is periodically read, // and the last successfully read content is used as the bearer token. // If tokenFile is non-empty and bearer is empty, the tokenFile is read // immediately to populate the initial bearer token. func NewBearerAuthWithRefreshRoundTripper(bearer string, tokenFile string, rt http.RoundTripper) (http.RoundTripper, error) { if len(tokenFile) == 0 { return &bearerAuthRoundTripper{bearer, nil, rt}, nil } source := NewCachedFileTokenSource(tokenFile) if len(bearer) == 0 { token, err := source.Token() if err != nil { return nil, err } bearer = token.AccessToken } return &bearerAuthRoundTripper{bearer, source, rt}, nil } func (rt *bearerAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { if len(req.Header.Get("Authorization")) != 0 { return rt.rt.RoundTrip(req) } req = utilnet.CloneRequest(req) token := rt.bearer if rt.source != nil { if refreshedToken, err := rt.source.Token(); err == nil { token = refreshedToken.AccessToken } } req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) return rt.rt.RoundTrip(req) } func (rt *bearerAuthRoundTripper) CancelRequest(req *http.Request) { tryCancelRequest(rt.WrappedRoundTripper(), req) } func (rt *bearerAuthRoundTripper) WrappedRoundTripper() http.RoundTripper { return rt.rt } // requestInfo keeps track of information about a request/response combination type requestInfo struct { RequestHeaders http.Header `datapolicy:"token"` RequestVerb string RequestURL string ResponseStatus string ResponseHeaders http.Header ResponseErr error muTrace sync.Mutex // Protect trace fields DNSLookup time.Duration Dialing time.Duration GetConnection time.Duration TLSHandshake time.Duration ServerProcessing time.Duration ConnectionReused bool Duration time.Duration } // newRequestInfo creates a new RequestInfo based on an http request func newRequestInfo(req *http.Request) *requestInfo { return &requestInfo{ RequestURL: req.URL.String(), RequestVerb: req.Method, RequestHeaders: req.Header, } } // complete adds information about the response to the requestInfo func (r *requestInfo) complete(response *http.Response, err error) { if err != nil { r.ResponseErr = err return } r.ResponseStatus = response.Status r.ResponseHeaders = response.Header } // toCurl returns a string that can be run as a command in a terminal (minus the body) func (r *requestInfo) toCurl() string { headers := "" for key, values := range r.RequestHeaders { for _, value := range values { value = maskValue(key, value) headers += fmt.Sprintf(` -H %q`, fmt.Sprintf("%s: %s", key, value)) } } return fmt.Sprintf("curl -v -X%s %s '%s'", r.RequestVerb, headers, r.RequestURL) } // debuggingRoundTripper will display information about the requests passing // through it based on what is configured type debuggingRoundTripper struct { delegatedRoundTripper http.RoundTripper levels map[DebugLevel]bool } var _ utilnet.RoundTripperWrapper = &debuggingRoundTripper{} // DebugLevel is used to enable debugging of certain // HTTP requests and responses fields via the debuggingRoundTripper. type DebugLevel int const ( // DebugJustURL will add to the debug output HTTP requests method and url. DebugJustURL DebugLevel = iota // DebugURLTiming will add to the debug output the duration of HTTP requests. DebugURLTiming // DebugCurlCommand will add to the debug output the curl command equivalent to the // HTTP request. DebugCurlCommand // DebugRequestHeaders will add to the debug output the HTTP requests headers. DebugRequestHeaders // DebugResponseStatus will add to the debug output the HTTP response status. DebugResponseStatus // DebugResponseHeaders will add to the debug output the HTTP response headers. DebugResponseHeaders // DebugDetailedTiming will add to the debug output the duration of the HTTP requests events. DebugDetailedTiming ) // NewDebuggingRoundTripper allows to display in the logs output debug information // on the API requests performed by the client. func NewDebuggingRoundTripper(rt http.RoundTripper, levels ...DebugLevel) http.RoundTripper { drt := &debuggingRoundTripper{ delegatedRoundTripper: rt, levels: make(map[DebugLevel]bool, len(levels)), } for _, v := range levels { drt.levels[v] = true } return drt } func (rt *debuggingRoundTripper) CancelRequest(req *http.Request) { tryCancelRequest(rt.WrappedRoundTripper(), req) } var knownAuthTypes = map[string]bool{ "bearer": true, "basic": true, "negotiate": true, } // maskValue masks credential content from authorization headers // See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization func maskValue(key string, value string) string { if !strings.EqualFold(key, "Authorization") { return value } if len(value) == 0 { return "" } var authType string if i := strings.Index(value, " "); i > 0 { authType = value[0:i] } else { authType = value } if !knownAuthTypes[strings.ToLower(authType)] { return "<masked>" } if len(value) > len(authType)+1 { value = authType + " <masked>" } else { value = authType } return value } func (rt *debuggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { reqInfo := newRequestInfo(req) if rt.levels[DebugJustURL] { klog.Infof("%s %s", reqInfo.RequestVerb, reqInfo.RequestURL) } if rt.levels[DebugCurlCommand] { klog.Infof("%s", reqInfo.toCurl()) } if rt.levels[DebugRequestHeaders] { klog.Info("Request Headers:") for key, values := range reqInfo.RequestHeaders { for _, value := range values { value = maskValue(key, value) klog.Infof(" %s: %s", key, value) } } } startTime := time.Now() if rt.levels[DebugDetailedTiming] { var getConn, dnsStart, dialStart, tlsStart, serverStart time.Time var host string trace := &httptrace.ClientTrace{ // DNS DNSStart: func(info httptrace.DNSStartInfo) { reqInfo.muTrace.Lock() defer reqInfo.muTrace.Unlock() dnsStart = time.Now() host = info.Host }, DNSDone: func(info httptrace.DNSDoneInfo) { reqInfo.muTrace.Lock() defer reqInfo.muTrace.Unlock() reqInfo.DNSLookup = time.Since(dnsStart) klog.Infof("HTTP Trace: DNS Lookup for %s resolved to %v", host, info.Addrs) }, // Dial ConnectStart: func(network, addr string) { reqInfo.muTrace.Lock() defer reqInfo.muTrace.Unlock() dialStart = time.Now() }, ConnectDone: func(network, addr string, err error) { reqInfo.muTrace.Lock() defer reqInfo.muTrace.Unlock() reqInfo.Dialing = time.Since(dialStart) if err != nil { klog.Infof("HTTP Trace: Dial to %s:%s failed: %v", network, addr, err) } else { klog.Infof("HTTP Trace: Dial to %s:%s succeed", network, addr) } }, // TLS TLSHandshakeStart: func() { tlsStart = time.Now() }, TLSHandshakeDone: func(_ tls.ConnectionState, _ error) { reqInfo.muTrace.Lock() defer reqInfo.muTrace.Unlock() reqInfo.TLSHandshake = time.Since(tlsStart) }, // Connection (it can be DNS + Dial or just the time to get one from the connection pool) GetConn: func(hostPort string) { getConn = time.Now() }, GotConn: func(info httptrace.GotConnInfo) { reqInfo.muTrace.Lock() defer reqInfo.muTrace.Unlock() reqInfo.GetConnection = time.Since(getConn) reqInfo.ConnectionReused = info.Reused }, // Server Processing (time since we wrote the request until first byte is received) WroteRequest: func(info httptrace.WroteRequestInfo) { reqInfo.muTrace.Lock() defer reqInfo.muTrace.Unlock() serverStart = time.Now() }, GotFirstResponseByte: func() { reqInfo.muTrace.Lock() defer reqInfo.muTrace.Unlock() reqInfo.ServerProcessing = time.Since(serverStart) }, } req = req.WithContext(httptrace.WithClientTrace(req.Context(), trace)) } response, err := rt.delegatedRoundTripper.RoundTrip(req) reqInfo.Duration = time.Since(startTime) reqInfo.complete(response, err) if rt.levels[DebugURLTiming] { klog.Infof("%s %s %s in %d milliseconds", reqInfo.RequestVerb, reqInfo.RequestURL, reqInfo.ResponseStatus, reqInfo.Duration.Nanoseconds()/int64(time.Millisecond)) } if rt.levels[DebugDetailedTiming] { stats := "" if !reqInfo.ConnectionReused { stats += fmt.Sprintf(`DNSLookup %d ms Dial %d ms TLSHandshake %d ms`, reqInfo.DNSLookup.Nanoseconds()/int64(time.Millisecond), reqInfo.Dialing.Nanoseconds()/int64(time.Millisecond), reqInfo.TLSHandshake.Nanoseconds()/int64(time.Millisecond), ) } else { stats += fmt.Sprintf(`GetConnection %d ms`, reqInfo.GetConnection.Nanoseconds()/int64(time.Millisecond)) } if reqInfo.ServerProcessing != 0 { stats += fmt.Sprintf(` ServerProcessing %d ms`, reqInfo.ServerProcessing.Nanoseconds()/int64(time.Millisecond)) } stats += fmt.Sprintf(` Duration %d ms`, reqInfo.Duration.Nanoseconds()/int64(time.Millisecond)) klog.Infof("HTTP Statistics: %s", stats) } if rt.levels[DebugResponseStatus] { klog.Infof("Response Status: %s in %d milliseconds", reqInfo.ResponseStatus, reqInfo.Duration.Nanoseconds()/int64(time.Millisecond)) } if rt.levels[DebugResponseHeaders] { klog.Info("Response Headers:") for key, values := range reqInfo.ResponseHeaders { for _, value := range values { klog.Infof(" %s: %s", key, value) } } } return response, err } func (rt *debuggingRoundTripper) WrappedRoundTripper() http.RoundTripper { return rt.delegatedRoundTripper } func legalHeaderByte(b byte) bool { return int(b) < len(legalHeaderKeyBytes) && legalHeaderKeyBytes[b] } func shouldEscape(b byte) bool { // url.PathUnescape() returns an error if any '%' is not followed by two // hexadecimal digits, so we'll intentionally encode it. return !legalHeaderByte(b) || b == '%' } func headerKeyEscape(key string) string { buf := strings.Builder{} for i := 0; i < len(key); i++ { b := key[i] if shouldEscape(b) { // %-encode bytes that should be escaped: // https://tools.ietf.org/html/rfc3986#section-2.1 fmt.Fprintf(&buf, "%%%02X", b) continue } buf.WriteByte(b) } return buf.String() } // legalHeaderKeyBytes was copied from net/http/lex.go's isTokenTable. // See https://httpwg.github.io/specs/rfc7230.html#rule.token.separators var legalHeaderKeyBytes = [127]bool{ '%': true, '!': true, '#': true, '$': true, '&': true, '\'': true, '*': true, '+': true, '-': true, '.': true, '0': true, '1': true, '2': true, '3': true, '4': true, '5': true, '6': true, '7': true, '8': true, '9': true, 'A': true, 'B': true, 'C': true, 'D': true, 'E': true, 'F': true, 'G': true, 'H': true, 'I': true, 'J': true, 'K': true, 'L': true, 'M': true, 'N': true, 'O': true, 'P': true, 'Q': true, 'R': true, 'S': true, 'T': true, 'U': true, 'W': true, 'V': true, 'X': true, 'Y': true, 'Z': true, '^': true, '_': true, '`': true, 'a': true, 'b': true, 'c': true, 'd': true, 'e': true, 'f': true, 'g': true, 'h': true, 'i': true, 'j': true, 'k': true, 'l': true, 'm': true, 'n': true, 'o': true, 'p': true, 'q': true, 'r': true, 's': true, 't': true, 'u': true, 'v': true, 'w': true, 'x': true, 'y': true, 'z': true, '|': true, '~': true, }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/transport/cert_rotation.go
vendor/k8s.io/client-go/transport/cert_rotation.go
/* Copyright 2020 The Kubernetes 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. */ package transport import ( "bytes" "crypto/tls" "fmt" "reflect" "sync" "time" utilnet "k8s.io/apimachinery/pkg/util/net" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/util/connrotation" "k8s.io/client-go/util/workqueue" "k8s.io/klog/v2" ) const workItemKey = "key" // CertCallbackRefreshDuration is exposed so that integration tests can crank up the reload speed. var CertCallbackRefreshDuration = 5 * time.Minute type reloadFunc func(*tls.CertificateRequestInfo) (*tls.Certificate, error) type dynamicClientCert struct { clientCert *tls.Certificate certMtx sync.RWMutex reload reloadFunc connDialer *connrotation.Dialer // queue only ever has one item, but it has nice error handling backoff/retry semantics queue workqueue.TypedRateLimitingInterface[string] } func certRotatingDialer(reload reloadFunc, dial utilnet.DialFunc) *dynamicClientCert { d := &dynamicClientCert{ reload: reload, connDialer: connrotation.NewDialer(connrotation.DialFunc(dial)), queue: workqueue.NewTypedRateLimitingQueueWithConfig( workqueue.DefaultTypedControllerRateLimiter[string](), workqueue.TypedRateLimitingQueueConfig[string]{Name: "DynamicClientCertificate"}, ), } return d } // loadClientCert calls the callback and rotates connections if needed func (c *dynamicClientCert) loadClientCert() (*tls.Certificate, error) { cert, err := c.reload(nil) if err != nil { return nil, err } // check to see if we have a change. If the values are the same, do nothing. c.certMtx.RLock() haveCert := c.clientCert != nil if certsEqual(c.clientCert, cert) { c.certMtx.RUnlock() return c.clientCert, nil } c.certMtx.RUnlock() c.certMtx.Lock() c.clientCert = cert c.certMtx.Unlock() // The first certificate requested is not a rotation that is worth closing connections for if !haveCert { return cert, nil } klog.V(1).Infof("certificate rotation detected, shutting down client connections to start using new credentials") c.connDialer.CloseAll() return cert, nil } // certsEqual compares tls Certificates, ignoring the Leaf which may get filled in dynamically func certsEqual(left, right *tls.Certificate) bool { if left == nil || right == nil { return left == right } if !byteMatrixEqual(left.Certificate, right.Certificate) { return false } if !reflect.DeepEqual(left.PrivateKey, right.PrivateKey) { return false } if !byteMatrixEqual(left.SignedCertificateTimestamps, right.SignedCertificateTimestamps) { return false } if !bytes.Equal(left.OCSPStaple, right.OCSPStaple) { return false } return true } func byteMatrixEqual(left, right [][]byte) bool { if len(left) != len(right) { return false } for i := range left { if !bytes.Equal(left[i], right[i]) { return false } } return true } // run starts the controller and blocks until stopCh is closed. func (c *dynamicClientCert) Run(stopCh <-chan struct{}) { defer utilruntime.HandleCrash() defer c.queue.ShutDown() klog.V(3).Infof("Starting client certificate rotation controller") defer klog.V(3).Infof("Shutting down client certificate rotation controller") go wait.Until(c.runWorker, time.Second, stopCh) go wait.PollImmediateUntil(CertCallbackRefreshDuration, func() (bool, error) { c.queue.Add(workItemKey) return false, nil }, stopCh) <-stopCh } func (c *dynamicClientCert) runWorker() { for c.processNextWorkItem() { } } func (c *dynamicClientCert) processNextWorkItem() bool { dsKey, quit := c.queue.Get() if quit { return false } defer c.queue.Done(dsKey) _, err := c.loadClientCert() if err == nil { c.queue.Forget(dsKey) return true } utilruntime.HandleError(fmt.Errorf("%v failed with : %v", dsKey, err)) c.queue.AddRateLimited(dsKey) return true } func (c *dynamicClientCert) GetClientCertificate(*tls.CertificateRequestInfo) (*tls.Certificate, error) { return c.loadClientCert() }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/transport/token_source.go
vendor/k8s.io/client-go/transport/token_source.go
/* Copyright 2018 The Kubernetes 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. */ package transport import ( "fmt" "net/http" "os" "strings" "sync" "time" "golang.org/x/oauth2" utilnet "k8s.io/apimachinery/pkg/util/net" "k8s.io/klog/v2" ) // TokenSourceWrapTransport returns a WrapTransport that injects bearer tokens // authentication from an oauth2.TokenSource. func TokenSourceWrapTransport(ts oauth2.TokenSource) func(http.RoundTripper) http.RoundTripper { return func(rt http.RoundTripper) http.RoundTripper { return &tokenSourceTransport{ base: rt, ort: &oauth2.Transport{ Source: ts, Base: rt, }, } } } type ResettableTokenSource interface { oauth2.TokenSource ResetTokenOlderThan(time.Time) } // ResettableTokenSourceWrapTransport returns a WrapTransport that injects bearer tokens // authentication from an ResettableTokenSource. func ResettableTokenSourceWrapTransport(ts ResettableTokenSource) func(http.RoundTripper) http.RoundTripper { return func(rt http.RoundTripper) http.RoundTripper { return &tokenSourceTransport{ base: rt, ort: &oauth2.Transport{ Source: ts, Base: rt, }, src: ts, } } } // NewCachedFileTokenSource returns a resettable token source which reads a // token from a file at a specified path and periodically reloads it. func NewCachedFileTokenSource(path string) *cachingTokenSource { return &cachingTokenSource{ now: time.Now, leeway: 10 * time.Second, base: &fileTokenSource{ path: path, // This period was picked because it is half of the duration between when the kubelet // refreshes a projected service account token and when the original token expires. // Default token lifetime is 10 minutes, and the kubelet starts refreshing at 80% of lifetime. // This should induce re-reading at a frequency that works with the token volume source. period: time.Minute, }, } } // NewCachedTokenSource returns resettable token source with caching. It reads // a token from a designed TokenSource if not in cache or expired. func NewCachedTokenSource(ts oauth2.TokenSource) *cachingTokenSource { return &cachingTokenSource{ now: time.Now, base: ts, } } type tokenSourceTransport struct { base http.RoundTripper ort http.RoundTripper src ResettableTokenSource } var _ utilnet.RoundTripperWrapper = &tokenSourceTransport{} func (tst *tokenSourceTransport) RoundTrip(req *http.Request) (*http.Response, error) { // This is to allow --token to override other bearer token providers. if req.Header.Get("Authorization") != "" { return tst.base.RoundTrip(req) } // record time before RoundTrip to make sure newly acquired Unauthorized // token would not be reset. Another request from user is required to reset // and proceed. start := time.Now() resp, err := tst.ort.RoundTrip(req) if err == nil && resp != nil && resp.StatusCode == 401 && tst.src != nil { tst.src.ResetTokenOlderThan(start) } return resp, err } func (tst *tokenSourceTransport) CancelRequest(req *http.Request) { if req.Header.Get("Authorization") != "" { tryCancelRequest(tst.base, req) return } tryCancelRequest(tst.ort, req) } func (tst *tokenSourceTransport) WrappedRoundTripper() http.RoundTripper { return tst.base } type fileTokenSource struct { path string period time.Duration } var _ = oauth2.TokenSource(&fileTokenSource{}) func (ts *fileTokenSource) Token() (*oauth2.Token, error) { tokb, err := os.ReadFile(ts.path) if err != nil { return nil, fmt.Errorf("failed to read token file %q: %v", ts.path, err) } tok := strings.TrimSpace(string(tokb)) if len(tok) == 0 { return nil, fmt.Errorf("read empty token from file %q", ts.path) } return &oauth2.Token{ AccessToken: tok, Expiry: time.Now().Add(ts.period), }, nil } type cachingTokenSource struct { base oauth2.TokenSource leeway time.Duration sync.RWMutex tok *oauth2.Token t time.Time // for testing now func() time.Time } func (ts *cachingTokenSource) Token() (*oauth2.Token, error) { now := ts.now() // fast path ts.RLock() tok := ts.tok ts.RUnlock() if tok != nil && tok.Expiry.Add(-1*ts.leeway).After(now) { return tok, nil } // slow path ts.Lock() defer ts.Unlock() if tok := ts.tok; tok != nil && tok.Expiry.Add(-1*ts.leeway).After(now) { return tok, nil } tok, err := ts.base.Token() if err != nil { if ts.tok == nil { return nil, err } klog.Errorf("Unable to rotate token: %v", err) return ts.tok, nil } ts.t = ts.now() ts.tok = tok return tok, nil } func (ts *cachingTokenSource) ResetTokenOlderThan(t time.Time) { ts.Lock() defer ts.Unlock() if ts.t.Before(t) { ts.tok = nil ts.t = time.Time{} } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/transport/transport.go
vendor/k8s.io/client-go/transport/transport.go
/* Copyright 2015 The Kubernetes 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. */ package transport import ( "context" "crypto/tls" "crypto/x509" "encoding/pem" "fmt" "net/http" "os" "sync" "time" utilnet "k8s.io/apimachinery/pkg/util/net" "k8s.io/klog/v2" ) // New returns an http.RoundTripper that will provide the authentication // or transport level security defined by the provided Config. func New(config *Config) (http.RoundTripper, error) { // Set transport level security if config.Transport != nil && (config.HasCA() || config.HasCertAuth() || config.HasCertCallback() || config.TLS.Insecure) { return nil, fmt.Errorf("using a custom transport with TLS certificate options or the insecure flag is not allowed") } if !isValidHolders(config) { return nil, fmt.Errorf("misconfigured holder for dialer or cert callback") } var ( rt http.RoundTripper err error ) if config.Transport != nil { rt = config.Transport } else { rt, err = tlsCache.get(config) if err != nil { return nil, err } } return HTTPWrappersForConfig(config, rt) } func isValidHolders(config *Config) bool { if config.TLS.GetCertHolder != nil && config.TLS.GetCertHolder.GetCert == nil { return false } if config.DialHolder != nil && config.DialHolder.Dial == nil { return false } return true } // TLSConfigFor returns a tls.Config that will provide the transport level security defined // by the provided Config. Will return nil if no transport level security is requested. func TLSConfigFor(c *Config) (*tls.Config, error) { if !(c.HasCA() || c.HasCertAuth() || c.HasCertCallback() || c.TLS.Insecure || len(c.TLS.ServerName) > 0 || len(c.TLS.NextProtos) > 0) { return nil, nil } if c.HasCA() && c.TLS.Insecure { return nil, fmt.Errorf("specifying a root certificates file with the insecure flag is not allowed") } if err := loadTLSFiles(c); err != nil { return nil, err } tlsConfig := &tls.Config{ // Can't use SSLv3 because of POODLE and BEAST // Can't use TLSv1.0 because of POODLE and BEAST using CBC cipher // Can't use TLSv1.1 because of RC4 cipher usage MinVersion: tls.VersionTLS12, InsecureSkipVerify: c.TLS.Insecure, ServerName: c.TLS.ServerName, NextProtos: c.TLS.NextProtos, } if c.HasCA() { /* kubernetes mutual (2-way) x509 between client and apiserver: 1. apiserver sending its apiserver certificate along with its publickey to client >2. client verifies the apiserver certificate sent against its cluster certificate authority data 3. client sending its client certificate along with its public key to the apiserver 4. apiserver verifies the client certificate sent against its cluster certificate authority data description: here, with this block, cluster certificate authority data gets loaded into TLS before the handshake process for client to later during the handshake verify the apiserver certificate normal args related to this stage: --certificate-authority='': Path to a cert file for the certificate authority (retrievable from "kubectl options" command) (suggested by @deads2k) see also: - for the step 1, see: staging/src/k8s.io/apiserver/pkg/server/options/serving.go - for the step 3, see: a few lines below in this file - for the step 4, see: staging/src/k8s.io/apiserver/pkg/authentication/request/x509/x509.go */ rootCAs, err := rootCertPool(c.TLS.CAData) if err != nil { return nil, fmt.Errorf("unable to load root certificates: %w", err) } tlsConfig.RootCAs = rootCAs } var staticCert *tls.Certificate // Treat cert as static if either key or cert was data, not a file if c.HasCertAuth() && !c.TLS.ReloadTLSFiles { // If key/cert were provided, verify them before setting up // tlsConfig.GetClientCertificate. cert, err := tls.X509KeyPair(c.TLS.CertData, c.TLS.KeyData) if err != nil { return nil, err } staticCert = &cert } var dynamicCertLoader func() (*tls.Certificate, error) if c.TLS.ReloadTLSFiles { dynamicCertLoader = cachingCertificateLoader(c.TLS.CertFile, c.TLS.KeyFile) } if c.HasCertAuth() || c.HasCertCallback() { /* kubernetes mutual (2-way) x509 between client and apiserver: 1. apiserver sending its apiserver certificate along with its publickey to client 2. client verifies the apiserver certificate sent against its cluster certificate authority data >3. client sending its client certificate along with its public key to the apiserver 4. apiserver verifies the client certificate sent against its cluster certificate authority data description: here, with this callback function, client certificate and pub key get loaded into TLS during the handshake process for apiserver to later in the step 4 verify the client certificate normal args related to this stage: --client-certificate='': Path to a client certificate file for TLS --client-key='': Path to a client key file for TLS (retrievable from "kubectl options" command) (suggested by @deads2k) see also: - for the step 1, see: staging/src/k8s.io/apiserver/pkg/server/options/serving.go - for the step 2, see: a few lines above in this file - for the step 4, see: staging/src/k8s.io/apiserver/pkg/authentication/request/x509/x509.go */ tlsConfig.GetClientCertificate = func(*tls.CertificateRequestInfo) (*tls.Certificate, error) { // Note: static key/cert data always take precedence over cert // callback. if staticCert != nil { return staticCert, nil } // key/cert files lead to ReloadTLSFiles being set - takes precedence over cert callback if dynamicCertLoader != nil { return dynamicCertLoader() } if c.HasCertCallback() { cert, err := c.TLS.GetCertHolder.GetCert() if err != nil { return nil, err } // GetCert may return empty value, meaning no cert. if cert != nil { return cert, nil } } // Both c.TLS.CertData/KeyData were unset and GetCert didn't return // anything. Return an empty tls.Certificate, no client cert will // be sent to the server. return &tls.Certificate{}, nil } } return tlsConfig, nil } // loadTLSFiles copies the data from the CertFile, KeyFile, and CAFile fields into the CertData, // KeyData, and CAFile fields, or returns an error. If no error is returned, all three fields are // either populated or were empty to start. func loadTLSFiles(c *Config) error { var err error c.TLS.CAData, err = dataFromSliceOrFile(c.TLS.CAData, c.TLS.CAFile) if err != nil { return err } // Check that we are purely loading from files if len(c.TLS.CertFile) > 0 && len(c.TLS.CertData) == 0 && len(c.TLS.KeyFile) > 0 && len(c.TLS.KeyData) == 0 { c.TLS.ReloadTLSFiles = true } c.TLS.CertData, err = dataFromSliceOrFile(c.TLS.CertData, c.TLS.CertFile) if err != nil { return err } c.TLS.KeyData, err = dataFromSliceOrFile(c.TLS.KeyData, c.TLS.KeyFile) return err } // dataFromSliceOrFile returns data from the slice (if non-empty), or from the file, // or an error if an error occurred reading the file func dataFromSliceOrFile(data []byte, file string) ([]byte, error) { if len(data) > 0 { return data, nil } if len(file) > 0 { fileData, err := os.ReadFile(file) if err != nil { return []byte{}, err } return fileData, nil } return nil, nil } // rootCertPool returns nil if caData is empty. When passed along, this will mean "use system CAs". // When caData is not empty, it will be the ONLY information used in the CertPool. func rootCertPool(caData []byte) (*x509.CertPool, error) { // What we really want is a copy of x509.systemRootsPool, but that isn't exposed. It's difficult to build (see the go // code for a look at the platform specific insanity), so we'll use the fact that RootCAs == nil gives us the system values // It doesn't allow trusting either/or, but hopefully that won't be an issue if len(caData) == 0 { return nil, nil } // if we have caData, use it certPool := x509.NewCertPool() if ok := certPool.AppendCertsFromPEM(caData); !ok { return nil, createErrorParsingCAData(caData) } return certPool, nil } // createErrorParsingCAData ALWAYS returns an error. We call it because know we failed to AppendCertsFromPEM // but we don't know the specific error because that API is just true/false func createErrorParsingCAData(pemCerts []byte) error { for len(pemCerts) > 0 { var block *pem.Block block, pemCerts = pem.Decode(pemCerts) if block == nil { return fmt.Errorf("unable to parse bytes as PEM block") } if block.Type != "CERTIFICATE" || len(block.Headers) != 0 { continue } if _, err := x509.ParseCertificate(block.Bytes); err != nil { return fmt.Errorf("failed to parse certificate: %w", err) } } return fmt.Errorf("no valid certificate authority data seen") } // WrapperFunc wraps an http.RoundTripper when a new transport // is created for a client, allowing per connection behavior // to be injected. type WrapperFunc func(rt http.RoundTripper) http.RoundTripper // Wrappers accepts any number of wrappers and returns a wrapper // function that is the equivalent of calling each of them in order. Nil // values are ignored, which makes this function convenient for incrementally // wrapping a function. func Wrappers(fns ...WrapperFunc) WrapperFunc { if len(fns) == 0 { return nil } // optimize the common case of wrapping a possibly nil transport wrapper // with an additional wrapper if len(fns) == 2 && fns[0] == nil { return fns[1] } return func(rt http.RoundTripper) http.RoundTripper { base := rt for _, fn := range fns { if fn != nil { base = fn(base) } } return base } } // ContextCanceller prevents new requests after the provided context is finished. // err is returned when the context is closed, allowing the caller to provide a context // appropriate error. func ContextCanceller(ctx context.Context, err error) WrapperFunc { return func(rt http.RoundTripper) http.RoundTripper { return &contextCanceller{ ctx: ctx, rt: rt, err: err, } } } type contextCanceller struct { ctx context.Context rt http.RoundTripper err error } func (b *contextCanceller) RoundTrip(req *http.Request) (*http.Response, error) { select { case <-b.ctx.Done(): return nil, b.err default: return b.rt.RoundTrip(req) } } func tryCancelRequest(rt http.RoundTripper, req *http.Request) { type canceler interface { CancelRequest(*http.Request) } switch rt := rt.(type) { case canceler: rt.CancelRequest(req) case utilnet.RoundTripperWrapper: tryCancelRequest(rt.WrappedRoundTripper(), req) default: klog.Warningf("Unable to cancel request for %T", rt) } } type certificateCacheEntry struct { cert *tls.Certificate err error birth time.Time } // isStale returns true when this cache entry is too old to be usable func (c *certificateCacheEntry) isStale() bool { return time.Since(c.birth) > time.Second } func newCertificateCacheEntry(certFile, keyFile string) certificateCacheEntry { cert, err := tls.LoadX509KeyPair(certFile, keyFile) return certificateCacheEntry{cert: &cert, err: err, birth: time.Now()} } // cachingCertificateLoader ensures that we don't hammer the filesystem when opening many connections // the underlying cert files are read at most once every second func cachingCertificateLoader(certFile, keyFile string) func() (*tls.Certificate, error) { current := newCertificateCacheEntry(certFile, keyFile) var currentMtx sync.RWMutex return func() (*tls.Certificate, error) { currentMtx.RLock() if current.isStale() { currentMtx.RUnlock() currentMtx.Lock() defer currentMtx.Unlock() if current.isStale() { current = newCertificateCacheEntry(certFile, keyFile) } } else { defer currentMtx.RUnlock() } return current.cert, current.err } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/transport/spdy/spdy.go
vendor/k8s.io/client-go/transport/spdy/spdy.go
/* Copyright 2017 The Kubernetes 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. */ package spdy import ( "fmt" "net/http" "net/url" "time" "k8s.io/apimachinery/pkg/util/httpstream" "k8s.io/apimachinery/pkg/util/httpstream/spdy" restclient "k8s.io/client-go/rest" ) // Upgrader validates a response from the server after a SPDY upgrade. type Upgrader interface { // NewConnection validates the response and creates a new Connection. NewConnection(resp *http.Response) (httpstream.Connection, error) } // RoundTripperFor returns a round tripper and upgrader to use with SPDY. func RoundTripperFor(config *restclient.Config) (http.RoundTripper, Upgrader, error) { tlsConfig, err := restclient.TLSConfigFor(config) if err != nil { return nil, nil, err } proxy := http.ProxyFromEnvironment if config.Proxy != nil { proxy = config.Proxy } upgradeRoundTripper, err := spdy.NewRoundTripperWithConfig(spdy.RoundTripperConfig{ TLS: tlsConfig, Proxier: proxy, PingPeriod: time.Second * 5, UpgradeTransport: nil, }) if err != nil { return nil, nil, err } wrapper, err := restclient.HTTPWrappersForConfig(config, upgradeRoundTripper) if err != nil { return nil, nil, err } return wrapper, upgradeRoundTripper, nil } // dialer implements the httpstream.Dialer interface. type dialer struct { client *http.Client upgrader Upgrader method string url *url.URL } var _ httpstream.Dialer = &dialer{} // NewDialer will create a dialer that connects to the provided URL and upgrades the connection to SPDY. func NewDialer(upgrader Upgrader, client *http.Client, method string, url *url.URL) httpstream.Dialer { return &dialer{ client: client, upgrader: upgrader, method: method, url: url, } } func (d *dialer) Dial(protocols ...string) (httpstream.Connection, string, error) { req, err := http.NewRequest(d.method, d.url.String(), nil) if err != nil { return nil, "", fmt.Errorf("error creating request: %v", err) } return Negotiate(d.upgrader, d.client, req, protocols...) } // Negotiate opens a connection to a remote server and attempts to negotiate // a SPDY connection. Upon success, it returns the connection and the protocol selected by // the server. The client transport must use the upgradeRoundTripper - see RoundTripperFor. func Negotiate(upgrader Upgrader, client *http.Client, req *http.Request, protocols ...string) (httpstream.Connection, string, error) { for i := range protocols { req.Header.Add(httpstream.HeaderProtocolVersion, protocols[i]) } resp, err := client.Do(req) if err != nil { return nil, "", fmt.Errorf("error sending request: %v", err) } defer resp.Body.Close() conn, err := upgrader.NewConnection(resp) if err != nil { return nil, "", err } return conn, resp.Header.Get(httpstream.HeaderProtocolVersion), nil }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/transport/websocket/roundtripper.go
vendor/k8s.io/client-go/transport/websocket/roundtripper.go
/* Copyright 2023 The Kubernetes 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. */ package websocket import ( "crypto/tls" "errors" "fmt" "io" "net/http" "net/url" "strings" gwebsocket "github.com/gorilla/websocket" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/serializer" "k8s.io/apimachinery/pkg/util/httpstream" "k8s.io/apimachinery/pkg/util/httpstream/wsstream" utilnet "k8s.io/apimachinery/pkg/util/net" restclient "k8s.io/client-go/rest" "k8s.io/client-go/transport" ) var ( _ utilnet.TLSClientConfigHolder = &RoundTripper{} _ http.RoundTripper = &RoundTripper{} ) var ( statusScheme = runtime.NewScheme() statusCodecs = serializer.NewCodecFactory(statusScheme) ) func init() { statusScheme.AddUnversionedTypes(metav1.SchemeGroupVersion, &metav1.Status{}, ) } // ConnectionHolder defines functions for structure providing // access to the websocket connection. type ConnectionHolder interface { DataBufferSize() int Connection() *gwebsocket.Conn } // RoundTripper knows how to establish a connection to a remote WebSocket endpoint and make it available for use. // RoundTripper must not be reused. type RoundTripper struct { // TLSConfig holds the TLS configuration settings to use when connecting // to the remote server. TLSConfig *tls.Config // Proxier specifies a function to return a proxy for a given // Request. If the function returns a non-nil error, the // request is aborted with the provided error. // If Proxy is nil or returns a nil *URL, no proxy is used. Proxier func(req *http.Request) (*url.URL, error) // Conn holds the WebSocket connection after a round trip. Conn *gwebsocket.Conn } // Connection returns the stored websocket connection. func (rt *RoundTripper) Connection() *gwebsocket.Conn { return rt.Conn } // DataBufferSize returns the size of buffers for the // websocket connection. func (rt *RoundTripper) DataBufferSize() int { return 32 * 1024 } // TLSClientConfig implements pkg/util/net.TLSClientConfigHolder. func (rt *RoundTripper) TLSClientConfig() *tls.Config { return rt.TLSConfig } // RoundTrip connects to the remote websocket using the headers in the request and the TLS // configuration from the config func (rt *RoundTripper) RoundTrip(request *http.Request) (retResp *http.Response, retErr error) { defer func() { if request.Body != nil { err := request.Body.Close() if retErr == nil { retErr = err } } }() // set the protocol version directly on the dialer from the header protocolVersions := request.Header[wsstream.WebSocketProtocolHeader] delete(request.Header, wsstream.WebSocketProtocolHeader) dialer := gwebsocket.Dialer{ Proxy: rt.Proxier, TLSClientConfig: rt.TLSConfig, Subprotocols: protocolVersions, ReadBufferSize: rt.DataBufferSize() + 1024, // add space for the protocol byte indicating which channel the data is for WriteBufferSize: rt.DataBufferSize() + 1024, // add space for the protocol byte indicating which channel the data is for } switch request.URL.Scheme { case "https": request.URL.Scheme = "wss" case "http": request.URL.Scheme = "ws" default: return nil, fmt.Errorf("unknown url scheme: %s", request.URL.Scheme) } wsConn, resp, err := dialer.DialContext(request.Context(), request.URL.String(), request.Header) if err != nil { // BadHandshake error becomes an "UpgradeFailureError" (used for streaming fallback). if errors.Is(err, gwebsocket.ErrBadHandshake) { cause := err // Enhance the error message with the error response if possible. if resp != nil && len(resp.Status) > 0 { defer resp.Body.Close() //nolint:errcheck cause = fmt.Errorf("%w (%s)", err, resp.Status) // Always add the response status responseError := "" responseErrorBytes, readErr := io.ReadAll(io.LimitReader(resp.Body, 64*1024)) if readErr != nil { cause = fmt.Errorf("%w: unable to read error from server response", cause) } else { // If returned error can be decoded as "metav1.Status", return a "StatusError". responseError = strings.TrimSpace(string(responseErrorBytes)) if len(responseError) > 0 { if obj, _, decodeErr := statusCodecs.UniversalDecoder().Decode(responseErrorBytes, nil, &metav1.Status{}); decodeErr == nil { if status, ok := obj.(*metav1.Status); ok { cause = &apierrors.StatusError{ErrStatus: *status} } } else { // Otherwise, append the responseError string. cause = fmt.Errorf("%w: %s", cause, responseError) } } } } return nil, &httpstream.UpgradeFailureError{Cause: cause} } return nil, err } // Ensure we got back a protocol we understand foundProtocol := false for _, protocolVersion := range protocolVersions { if protocolVersion == wsConn.Subprotocol() { foundProtocol = true break } } if !foundProtocol { wsConn.Close() // nolint:errcheck return nil, &httpstream.UpgradeFailureError{Cause: fmt.Errorf("invalid protocol, expected one of %q, got %q", protocolVersions, wsConn.Subprotocol())} } rt.Conn = wsConn return resp, nil } // RoundTripperFor transforms the passed rest config into a wrapped roundtripper, as well // as a pointer to the websocket RoundTripper. The websocket RoundTripper contains the // websocket connection after RoundTrip() on the wrapper. Returns an error if there is // a problem creating the round trippers. func RoundTripperFor(config *restclient.Config) (http.RoundTripper, ConnectionHolder, error) { transportCfg, err := config.TransportConfig() if err != nil { return nil, nil, err } tlsConfig, err := transport.TLSConfigFor(transportCfg) if err != nil { return nil, nil, err } proxy := config.Proxy if proxy == nil { proxy = utilnet.NewProxierWithNoProxyCIDR(http.ProxyFromEnvironment) } upgradeRoundTripper := &RoundTripper{ TLSConfig: tlsConfig, Proxier: proxy, } wrapper, err := transport.HTTPWrappersForConfig(transportCfg, upgradeRoundTripper) if err != nil { return nil, nil, err } return wrapper, upgradeRoundTripper, nil } // Negotiate opens a connection to a remote server and attempts to negotiate // a WebSocket connection. Upon success, it returns the negotiated connection. // The round tripper rt must use the WebSocket round tripper wsRt - see RoundTripperFor. func Negotiate(rt http.RoundTripper, connectionInfo ConnectionHolder, req *http.Request, protocols ...string) (*gwebsocket.Conn, error) { // Plumb protocols to RoundTripper#RoundTrip req.Header[wsstream.WebSocketProtocolHeader] = protocols resp, err := rt.RoundTrip(req) if err != nil { return nil, err } err = resp.Body.Close() if err != nil { connectionInfo.Connection().Close() return nil, fmt.Errorf("error closing response body: %v", err) } return connectionInfo.Connection(), nil }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/clientset.go
vendor/k8s.io/client-go/kubernetes/clientset.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package kubernetes import ( fmt "fmt" http "net/http" discovery "k8s.io/client-go/discovery" 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" authenticationv1alpha1 "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" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" ) type Interface interface { Discovery() discovery.DiscoveryInterface AdmissionregistrationV1() admissionregistrationv1.AdmissionregistrationV1Interface AdmissionregistrationV1alpha1() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface AdmissionregistrationV1beta1() admissionregistrationv1beta1.AdmissionregistrationV1beta1Interface InternalV1alpha1() internalv1alpha1.InternalV1alpha1Interface AppsV1() appsv1.AppsV1Interface AppsV1beta1() appsv1beta1.AppsV1beta1Interface AppsV1beta2() appsv1beta2.AppsV1beta2Interface AuthenticationV1() authenticationv1.AuthenticationV1Interface AuthenticationV1alpha1() authenticationv1alpha1.AuthenticationV1alpha1Interface AuthenticationV1beta1() authenticationv1beta1.AuthenticationV1beta1Interface AuthorizationV1() authorizationv1.AuthorizationV1Interface AuthorizationV1beta1() authorizationv1beta1.AuthorizationV1beta1Interface AutoscalingV1() autoscalingv1.AutoscalingV1Interface AutoscalingV2() autoscalingv2.AutoscalingV2Interface AutoscalingV2beta1() autoscalingv2beta1.AutoscalingV2beta1Interface AutoscalingV2beta2() autoscalingv2beta2.AutoscalingV2beta2Interface BatchV1() batchv1.BatchV1Interface BatchV1beta1() batchv1beta1.BatchV1beta1Interface CertificatesV1() certificatesv1.CertificatesV1Interface CertificatesV1beta1() certificatesv1beta1.CertificatesV1beta1Interface CertificatesV1alpha1() certificatesv1alpha1.CertificatesV1alpha1Interface CoordinationV1alpha2() coordinationv1alpha2.CoordinationV1alpha2Interface CoordinationV1beta1() coordinationv1beta1.CoordinationV1beta1Interface CoordinationV1() coordinationv1.CoordinationV1Interface CoreV1() corev1.CoreV1Interface DiscoveryV1() discoveryv1.DiscoveryV1Interface DiscoveryV1beta1() discoveryv1beta1.DiscoveryV1beta1Interface EventsV1() eventsv1.EventsV1Interface EventsV1beta1() eventsv1beta1.EventsV1beta1Interface ExtensionsV1beta1() extensionsv1beta1.ExtensionsV1beta1Interface FlowcontrolV1() flowcontrolv1.FlowcontrolV1Interface FlowcontrolV1beta1() flowcontrolv1beta1.FlowcontrolV1beta1Interface FlowcontrolV1beta2() flowcontrolv1beta2.FlowcontrolV1beta2Interface FlowcontrolV1beta3() flowcontrolv1beta3.FlowcontrolV1beta3Interface NetworkingV1() networkingv1.NetworkingV1Interface NetworkingV1alpha1() networkingv1alpha1.NetworkingV1alpha1Interface NetworkingV1beta1() networkingv1beta1.NetworkingV1beta1Interface NodeV1() nodev1.NodeV1Interface NodeV1alpha1() nodev1alpha1.NodeV1alpha1Interface NodeV1beta1() nodev1beta1.NodeV1beta1Interface PolicyV1() policyv1.PolicyV1Interface PolicyV1beta1() policyv1beta1.PolicyV1beta1Interface RbacV1() rbacv1.RbacV1Interface RbacV1beta1() rbacv1beta1.RbacV1beta1Interface RbacV1alpha1() rbacv1alpha1.RbacV1alpha1Interface ResourceV1beta1() resourcev1beta1.ResourceV1beta1Interface ResourceV1alpha3() resourcev1alpha3.ResourceV1alpha3Interface SchedulingV1alpha1() schedulingv1alpha1.SchedulingV1alpha1Interface SchedulingV1beta1() schedulingv1beta1.SchedulingV1beta1Interface SchedulingV1() schedulingv1.SchedulingV1Interface StorageV1beta1() storagev1beta1.StorageV1beta1Interface StorageV1() storagev1.StorageV1Interface StorageV1alpha1() storagev1alpha1.StorageV1alpha1Interface StoragemigrationV1alpha1() storagemigrationv1alpha1.StoragemigrationV1alpha1Interface } // Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient admissionregistrationV1 *admissionregistrationv1.AdmissionregistrationV1Client admissionregistrationV1alpha1 *admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Client admissionregistrationV1beta1 *admissionregistrationv1beta1.AdmissionregistrationV1beta1Client internalV1alpha1 *internalv1alpha1.InternalV1alpha1Client appsV1 *appsv1.AppsV1Client appsV1beta1 *appsv1beta1.AppsV1beta1Client appsV1beta2 *appsv1beta2.AppsV1beta2Client authenticationV1 *authenticationv1.AuthenticationV1Client authenticationV1alpha1 *authenticationv1alpha1.AuthenticationV1alpha1Client authenticationV1beta1 *authenticationv1beta1.AuthenticationV1beta1Client authorizationV1 *authorizationv1.AuthorizationV1Client authorizationV1beta1 *authorizationv1beta1.AuthorizationV1beta1Client autoscalingV1 *autoscalingv1.AutoscalingV1Client autoscalingV2 *autoscalingv2.AutoscalingV2Client autoscalingV2beta1 *autoscalingv2beta1.AutoscalingV2beta1Client autoscalingV2beta2 *autoscalingv2beta2.AutoscalingV2beta2Client batchV1 *batchv1.BatchV1Client batchV1beta1 *batchv1beta1.BatchV1beta1Client certificatesV1 *certificatesv1.CertificatesV1Client certificatesV1beta1 *certificatesv1beta1.CertificatesV1beta1Client certificatesV1alpha1 *certificatesv1alpha1.CertificatesV1alpha1Client coordinationV1alpha2 *coordinationv1alpha2.CoordinationV1alpha2Client coordinationV1beta1 *coordinationv1beta1.CoordinationV1beta1Client coordinationV1 *coordinationv1.CoordinationV1Client coreV1 *corev1.CoreV1Client discoveryV1 *discoveryv1.DiscoveryV1Client discoveryV1beta1 *discoveryv1beta1.DiscoveryV1beta1Client eventsV1 *eventsv1.EventsV1Client eventsV1beta1 *eventsv1beta1.EventsV1beta1Client extensionsV1beta1 *extensionsv1beta1.ExtensionsV1beta1Client flowcontrolV1 *flowcontrolv1.FlowcontrolV1Client flowcontrolV1beta1 *flowcontrolv1beta1.FlowcontrolV1beta1Client flowcontrolV1beta2 *flowcontrolv1beta2.FlowcontrolV1beta2Client flowcontrolV1beta3 *flowcontrolv1beta3.FlowcontrolV1beta3Client networkingV1 *networkingv1.NetworkingV1Client networkingV1alpha1 *networkingv1alpha1.NetworkingV1alpha1Client networkingV1beta1 *networkingv1beta1.NetworkingV1beta1Client nodeV1 *nodev1.NodeV1Client nodeV1alpha1 *nodev1alpha1.NodeV1alpha1Client nodeV1beta1 *nodev1beta1.NodeV1beta1Client policyV1 *policyv1.PolicyV1Client policyV1beta1 *policyv1beta1.PolicyV1beta1Client rbacV1 *rbacv1.RbacV1Client rbacV1beta1 *rbacv1beta1.RbacV1beta1Client rbacV1alpha1 *rbacv1alpha1.RbacV1alpha1Client resourceV1beta1 *resourcev1beta1.ResourceV1beta1Client resourceV1alpha3 *resourcev1alpha3.ResourceV1alpha3Client schedulingV1alpha1 *schedulingv1alpha1.SchedulingV1alpha1Client schedulingV1beta1 *schedulingv1beta1.SchedulingV1beta1Client schedulingV1 *schedulingv1.SchedulingV1Client storageV1beta1 *storagev1beta1.StorageV1beta1Client storageV1 *storagev1.StorageV1Client storageV1alpha1 *storagev1alpha1.StorageV1alpha1Client storagemigrationV1alpha1 *storagemigrationv1alpha1.StoragemigrationV1alpha1Client } // AdmissionregistrationV1 retrieves the AdmissionregistrationV1Client func (c *Clientset) AdmissionregistrationV1() admissionregistrationv1.AdmissionregistrationV1Interface { return c.admissionregistrationV1 } // AdmissionregistrationV1alpha1 retrieves the AdmissionregistrationV1alpha1Client func (c *Clientset) AdmissionregistrationV1alpha1() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface { return c.admissionregistrationV1alpha1 } // AdmissionregistrationV1beta1 retrieves the AdmissionregistrationV1beta1Client func (c *Clientset) AdmissionregistrationV1beta1() admissionregistrationv1beta1.AdmissionregistrationV1beta1Interface { return c.admissionregistrationV1beta1 } // InternalV1alpha1 retrieves the InternalV1alpha1Client func (c *Clientset) InternalV1alpha1() internalv1alpha1.InternalV1alpha1Interface { return c.internalV1alpha1 } // AppsV1 retrieves the AppsV1Client func (c *Clientset) AppsV1() appsv1.AppsV1Interface { return c.appsV1 } // AppsV1beta1 retrieves the AppsV1beta1Client func (c *Clientset) AppsV1beta1() appsv1beta1.AppsV1beta1Interface { return c.appsV1beta1 } // AppsV1beta2 retrieves the AppsV1beta2Client func (c *Clientset) AppsV1beta2() appsv1beta2.AppsV1beta2Interface { return c.appsV1beta2 } // AuthenticationV1 retrieves the AuthenticationV1Client func (c *Clientset) AuthenticationV1() authenticationv1.AuthenticationV1Interface { return c.authenticationV1 } // AuthenticationV1alpha1 retrieves the AuthenticationV1alpha1Client func (c *Clientset) AuthenticationV1alpha1() authenticationv1alpha1.AuthenticationV1alpha1Interface { return c.authenticationV1alpha1 } // AuthenticationV1beta1 retrieves the AuthenticationV1beta1Client func (c *Clientset) AuthenticationV1beta1() authenticationv1beta1.AuthenticationV1beta1Interface { return c.authenticationV1beta1 } // AuthorizationV1 retrieves the AuthorizationV1Client func (c *Clientset) AuthorizationV1() authorizationv1.AuthorizationV1Interface { return c.authorizationV1 } // AuthorizationV1beta1 retrieves the AuthorizationV1beta1Client func (c *Clientset) AuthorizationV1beta1() authorizationv1beta1.AuthorizationV1beta1Interface { return c.authorizationV1beta1 } // AutoscalingV1 retrieves the AutoscalingV1Client func (c *Clientset) AutoscalingV1() autoscalingv1.AutoscalingV1Interface { return c.autoscalingV1 } // AutoscalingV2 retrieves the AutoscalingV2Client func (c *Clientset) AutoscalingV2() autoscalingv2.AutoscalingV2Interface { return c.autoscalingV2 } // AutoscalingV2beta1 retrieves the AutoscalingV2beta1Client func (c *Clientset) AutoscalingV2beta1() autoscalingv2beta1.AutoscalingV2beta1Interface { return c.autoscalingV2beta1 } // AutoscalingV2beta2 retrieves the AutoscalingV2beta2Client func (c *Clientset) AutoscalingV2beta2() autoscalingv2beta2.AutoscalingV2beta2Interface { return c.autoscalingV2beta2 } // BatchV1 retrieves the BatchV1Client func (c *Clientset) BatchV1() batchv1.BatchV1Interface { return c.batchV1 } // BatchV1beta1 retrieves the BatchV1beta1Client func (c *Clientset) BatchV1beta1() batchv1beta1.BatchV1beta1Interface { return c.batchV1beta1 } // CertificatesV1 retrieves the CertificatesV1Client func (c *Clientset) CertificatesV1() certificatesv1.CertificatesV1Interface { return c.certificatesV1 } // CertificatesV1beta1 retrieves the CertificatesV1beta1Client func (c *Clientset) CertificatesV1beta1() certificatesv1beta1.CertificatesV1beta1Interface { return c.certificatesV1beta1 } // CertificatesV1alpha1 retrieves the CertificatesV1alpha1Client func (c *Clientset) CertificatesV1alpha1() certificatesv1alpha1.CertificatesV1alpha1Interface { return c.certificatesV1alpha1 } // CoordinationV1alpha2 retrieves the CoordinationV1alpha2Client func (c *Clientset) CoordinationV1alpha2() coordinationv1alpha2.CoordinationV1alpha2Interface { return c.coordinationV1alpha2 } // CoordinationV1beta1 retrieves the CoordinationV1beta1Client func (c *Clientset) CoordinationV1beta1() coordinationv1beta1.CoordinationV1beta1Interface { return c.coordinationV1beta1 } // CoordinationV1 retrieves the CoordinationV1Client func (c *Clientset) CoordinationV1() coordinationv1.CoordinationV1Interface { return c.coordinationV1 } // CoreV1 retrieves the CoreV1Client func (c *Clientset) CoreV1() corev1.CoreV1Interface { return c.coreV1 } // DiscoveryV1 retrieves the DiscoveryV1Client func (c *Clientset) DiscoveryV1() discoveryv1.DiscoveryV1Interface { return c.discoveryV1 } // DiscoveryV1beta1 retrieves the DiscoveryV1beta1Client func (c *Clientset) DiscoveryV1beta1() discoveryv1beta1.DiscoveryV1beta1Interface { return c.discoveryV1beta1 } // EventsV1 retrieves the EventsV1Client func (c *Clientset) EventsV1() eventsv1.EventsV1Interface { return c.eventsV1 } // EventsV1beta1 retrieves the EventsV1beta1Client func (c *Clientset) EventsV1beta1() eventsv1beta1.EventsV1beta1Interface { return c.eventsV1beta1 } // ExtensionsV1beta1 retrieves the ExtensionsV1beta1Client func (c *Clientset) ExtensionsV1beta1() extensionsv1beta1.ExtensionsV1beta1Interface { return c.extensionsV1beta1 } // FlowcontrolV1 retrieves the FlowcontrolV1Client func (c *Clientset) FlowcontrolV1() flowcontrolv1.FlowcontrolV1Interface { return c.flowcontrolV1 } // FlowcontrolV1beta1 retrieves the FlowcontrolV1beta1Client func (c *Clientset) FlowcontrolV1beta1() flowcontrolv1beta1.FlowcontrolV1beta1Interface { return c.flowcontrolV1beta1 } // FlowcontrolV1beta2 retrieves the FlowcontrolV1beta2Client func (c *Clientset) FlowcontrolV1beta2() flowcontrolv1beta2.FlowcontrolV1beta2Interface { return c.flowcontrolV1beta2 } // FlowcontrolV1beta3 retrieves the FlowcontrolV1beta3Client func (c *Clientset) FlowcontrolV1beta3() flowcontrolv1beta3.FlowcontrolV1beta3Interface { return c.flowcontrolV1beta3 } // NetworkingV1 retrieves the NetworkingV1Client func (c *Clientset) NetworkingV1() networkingv1.NetworkingV1Interface { return c.networkingV1 } // NetworkingV1alpha1 retrieves the NetworkingV1alpha1Client func (c *Clientset) NetworkingV1alpha1() networkingv1alpha1.NetworkingV1alpha1Interface { return c.networkingV1alpha1 } // NetworkingV1beta1 retrieves the NetworkingV1beta1Client func (c *Clientset) NetworkingV1beta1() networkingv1beta1.NetworkingV1beta1Interface { return c.networkingV1beta1 } // NodeV1 retrieves the NodeV1Client func (c *Clientset) NodeV1() nodev1.NodeV1Interface { return c.nodeV1 } // NodeV1alpha1 retrieves the NodeV1alpha1Client func (c *Clientset) NodeV1alpha1() nodev1alpha1.NodeV1alpha1Interface { return c.nodeV1alpha1 } // NodeV1beta1 retrieves the NodeV1beta1Client func (c *Clientset) NodeV1beta1() nodev1beta1.NodeV1beta1Interface { return c.nodeV1beta1 } // PolicyV1 retrieves the PolicyV1Client func (c *Clientset) PolicyV1() policyv1.PolicyV1Interface { return c.policyV1 } // PolicyV1beta1 retrieves the PolicyV1beta1Client func (c *Clientset) PolicyV1beta1() policyv1beta1.PolicyV1beta1Interface { return c.policyV1beta1 } // RbacV1 retrieves the RbacV1Client func (c *Clientset) RbacV1() rbacv1.RbacV1Interface { return c.rbacV1 } // RbacV1beta1 retrieves the RbacV1beta1Client func (c *Clientset) RbacV1beta1() rbacv1beta1.RbacV1beta1Interface { return c.rbacV1beta1 } // RbacV1alpha1 retrieves the RbacV1alpha1Client func (c *Clientset) RbacV1alpha1() rbacv1alpha1.RbacV1alpha1Interface { return c.rbacV1alpha1 } // ResourceV1beta1 retrieves the ResourceV1beta1Client func (c *Clientset) ResourceV1beta1() resourcev1beta1.ResourceV1beta1Interface { return c.resourceV1beta1 } // ResourceV1alpha3 retrieves the ResourceV1alpha3Client func (c *Clientset) ResourceV1alpha3() resourcev1alpha3.ResourceV1alpha3Interface { return c.resourceV1alpha3 } // SchedulingV1alpha1 retrieves the SchedulingV1alpha1Client func (c *Clientset) SchedulingV1alpha1() schedulingv1alpha1.SchedulingV1alpha1Interface { return c.schedulingV1alpha1 } // SchedulingV1beta1 retrieves the SchedulingV1beta1Client func (c *Clientset) SchedulingV1beta1() schedulingv1beta1.SchedulingV1beta1Interface { return c.schedulingV1beta1 } // SchedulingV1 retrieves the SchedulingV1Client func (c *Clientset) SchedulingV1() schedulingv1.SchedulingV1Interface { return c.schedulingV1 } // StorageV1beta1 retrieves the StorageV1beta1Client func (c *Clientset) StorageV1beta1() storagev1beta1.StorageV1beta1Interface { return c.storageV1beta1 } // StorageV1 retrieves the StorageV1Client func (c *Clientset) StorageV1() storagev1.StorageV1Interface { return c.storageV1 } // StorageV1alpha1 retrieves the StorageV1alpha1Client func (c *Clientset) StorageV1alpha1() storagev1alpha1.StorageV1alpha1Interface { return c.storageV1alpha1 } // StoragemigrationV1alpha1 retrieves the StoragemigrationV1alpha1Client func (c *Clientset) StoragemigrationV1alpha1() storagemigrationv1alpha1.StoragemigrationV1alpha1Interface { return c.storagemigrationV1alpha1 } // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { return nil } return c.DiscoveryClient } // NewForConfig creates a new Clientset for the given config. // If config's RateLimiter is not set and QPS and Burst are acceptable, // NewForConfig will generate a rate-limiter in configShallowCopy. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). func NewForConfig(c *rest.Config) (*Clientset, error) { configShallowCopy := *c if configShallowCopy.UserAgent == "" { configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() } // share the transport between all clients httpClient, err := rest.HTTPClientFor(&configShallowCopy) if err != nil { return nil, err } return NewForConfigAndClient(&configShallowCopy, httpClient) } // NewForConfigAndClient creates a new Clientset for the given config and http client. // Note the http client provided takes precedence over the configured transport values. // If config's RateLimiter is not set and QPS and Burst are acceptable, // NewForConfigAndClient will generate a rate-limiter in configShallowCopy. func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) { configShallowCopy := *c if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { if configShallowCopy.Burst <= 0 { return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") } configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) } var cs Clientset var err error cs.admissionregistrationV1, err = admissionregistrationv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.admissionregistrationV1alpha1, err = admissionregistrationv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.admissionregistrationV1beta1, err = admissionregistrationv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.internalV1alpha1, err = internalv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.appsV1, err = appsv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.appsV1beta1, err = appsv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.appsV1beta2, err = appsv1beta2.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.authenticationV1, err = authenticationv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.authenticationV1alpha1, err = authenticationv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.authenticationV1beta1, err = authenticationv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.authorizationV1, err = authorizationv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.authorizationV1beta1, err = authorizationv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.autoscalingV1, err = autoscalingv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.autoscalingV2, err = autoscalingv2.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.autoscalingV2beta1, err = autoscalingv2beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.autoscalingV2beta2, err = autoscalingv2beta2.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.batchV1, err = batchv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.batchV1beta1, err = batchv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.certificatesV1, err = certificatesv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.certificatesV1beta1, err = certificatesv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.certificatesV1alpha1, err = certificatesv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.coordinationV1alpha2, err = coordinationv1alpha2.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.coordinationV1beta1, err = coordinationv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.coordinationV1, err = coordinationv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.coreV1, err = corev1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.discoveryV1, err = discoveryv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.discoveryV1beta1, err = discoveryv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.eventsV1, err = eventsv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.eventsV1beta1, err = eventsv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.extensionsV1beta1, err = extensionsv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.flowcontrolV1, err = flowcontrolv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.flowcontrolV1beta1, err = flowcontrolv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.flowcontrolV1beta2, err = flowcontrolv1beta2.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.flowcontrolV1beta3, err = flowcontrolv1beta3.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.networkingV1, err = networkingv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.networkingV1alpha1, err = networkingv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.networkingV1beta1, err = networkingv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.nodeV1, err = nodev1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.nodeV1alpha1, err = nodev1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.nodeV1beta1, err = nodev1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.policyV1, err = policyv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.policyV1beta1, err = policyv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.rbacV1, err = rbacv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.rbacV1beta1, err = rbacv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.rbacV1alpha1, err = rbacv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.resourceV1beta1, err = resourcev1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.resourceV1alpha3, err = resourcev1alpha3.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.schedulingV1alpha1, err = schedulingv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.schedulingV1beta1, err = schedulingv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.schedulingV1, err = schedulingv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.storageV1beta1, err = storagev1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.storageV1, err = storagev1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.storageV1alpha1, err = storagev1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.storagemigrationV1alpha1, err = storagemigrationv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } return &cs, nil } // NewForConfigOrDie creates a new Clientset for the given config and // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *Clientset { cs, err := NewForConfig(c) if err != nil { panic(err) } return cs } // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset cs.admissionregistrationV1 = admissionregistrationv1.New(c) cs.admissionregistrationV1alpha1 = admissionregistrationv1alpha1.New(c) cs.admissionregistrationV1beta1 = admissionregistrationv1beta1.New(c) cs.internalV1alpha1 = internalv1alpha1.New(c) cs.appsV1 = appsv1.New(c) cs.appsV1beta1 = appsv1beta1.New(c) cs.appsV1beta2 = appsv1beta2.New(c) cs.authenticationV1 = authenticationv1.New(c) cs.authenticationV1alpha1 = authenticationv1alpha1.New(c) cs.authenticationV1beta1 = authenticationv1beta1.New(c) cs.authorizationV1 = authorizationv1.New(c) cs.authorizationV1beta1 = authorizationv1beta1.New(c) cs.autoscalingV1 = autoscalingv1.New(c) cs.autoscalingV2 = autoscalingv2.New(c) cs.autoscalingV2beta1 = autoscalingv2beta1.New(c) cs.autoscalingV2beta2 = autoscalingv2beta2.New(c) cs.batchV1 = batchv1.New(c) cs.batchV1beta1 = batchv1beta1.New(c) cs.certificatesV1 = certificatesv1.New(c) cs.certificatesV1beta1 = certificatesv1beta1.New(c) cs.certificatesV1alpha1 = certificatesv1alpha1.New(c) cs.coordinationV1alpha2 = coordinationv1alpha2.New(c) cs.coordinationV1beta1 = coordinationv1beta1.New(c) cs.coordinationV1 = coordinationv1.New(c) cs.coreV1 = corev1.New(c) cs.discoveryV1 = discoveryv1.New(c) cs.discoveryV1beta1 = discoveryv1beta1.New(c) cs.eventsV1 = eventsv1.New(c) cs.eventsV1beta1 = eventsv1beta1.New(c) cs.extensionsV1beta1 = extensionsv1beta1.New(c) cs.flowcontrolV1 = flowcontrolv1.New(c) cs.flowcontrolV1beta1 = flowcontrolv1beta1.New(c) cs.flowcontrolV1beta2 = flowcontrolv1beta2.New(c) cs.flowcontrolV1beta3 = flowcontrolv1beta3.New(c) cs.networkingV1 = networkingv1.New(c) cs.networkingV1alpha1 = networkingv1alpha1.New(c) cs.networkingV1beta1 = networkingv1beta1.New(c) cs.nodeV1 = nodev1.New(c) cs.nodeV1alpha1 = nodev1alpha1.New(c) cs.nodeV1beta1 = nodev1beta1.New(c) cs.policyV1 = policyv1.New(c) cs.policyV1beta1 = policyv1beta1.New(c) cs.rbacV1 = rbacv1.New(c) cs.rbacV1beta1 = rbacv1beta1.New(c) cs.rbacV1alpha1 = rbacv1alpha1.New(c) cs.resourceV1beta1 = resourcev1beta1.New(c) cs.resourceV1alpha3 = resourcev1alpha3.New(c) cs.schedulingV1alpha1 = schedulingv1alpha1.New(c) cs.schedulingV1beta1 = schedulingv1beta1.New(c) cs.schedulingV1 = schedulingv1.New(c) cs.storageV1beta1 = storagev1beta1.New(c) cs.storageV1 = storagev1.New(c) cs.storageV1alpha1 = storagev1alpha1.New(c) cs.storagemigrationV1alpha1 = storagemigrationv1alpha1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/doc.go
vendor/k8s.io/client-go/kubernetes/doc.go
/* Copyright 2023 The Kubernetes 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. */ // Package kubernetes holds packages which implement a clientset for Kubernetes // APIs. package kubernetes // import "k8s.io/client-go/kubernetes"
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/import.go
vendor/k8s.io/client-go/kubernetes/import.go
/* Copyright 2017 The Kubernetes 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. */ // This file exists to enforce this clientset's vanity import path. package kubernetes // import "k8s.io/client-go/kubernetes"
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/scheme/register.go
vendor/k8s.io/client-go/kubernetes/scheme/register.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package scheme import ( admissionregistrationv1 "k8s.io/api/admissionregistration/v1" admissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1" admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" internalv1alpha1 "k8s.io/api/apiserverinternal/v1alpha1" appsv1 "k8s.io/api/apps/v1" appsv1beta1 "k8s.io/api/apps/v1beta1" appsv1beta2 "k8s.io/api/apps/v1beta2" authenticationv1 "k8s.io/api/authentication/v1" authenticationv1alpha1 "k8s.io/api/authentication/v1alpha1" authenticationv1beta1 "k8s.io/api/authentication/v1beta1" authorizationv1 "k8s.io/api/authorization/v1" authorizationv1beta1 "k8s.io/api/authorization/v1beta1" autoscalingv1 "k8s.io/api/autoscaling/v1" autoscalingv2 "k8s.io/api/autoscaling/v2" autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" batchv1 "k8s.io/api/batch/v1" batchv1beta1 "k8s.io/api/batch/v1beta1" certificatesv1 "k8s.io/api/certificates/v1" certificatesv1alpha1 "k8s.io/api/certificates/v1alpha1" certificatesv1beta1 "k8s.io/api/certificates/v1beta1" coordinationv1 "k8s.io/api/coordination/v1" coordinationv1alpha2 "k8s.io/api/coordination/v1alpha2" coordinationv1beta1 "k8s.io/api/coordination/v1beta1" corev1 "k8s.io/api/core/v1" discoveryv1 "k8s.io/api/discovery/v1" discoveryv1beta1 "k8s.io/api/discovery/v1beta1" eventsv1 "k8s.io/api/events/v1" eventsv1beta1 "k8s.io/api/events/v1beta1" extensionsv1beta1 "k8s.io/api/extensions/v1beta1" flowcontrolv1 "k8s.io/api/flowcontrol/v1" flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" flowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2" flowcontrolv1beta3 "k8s.io/api/flowcontrol/v1beta3" networkingv1 "k8s.io/api/networking/v1" networkingv1alpha1 "k8s.io/api/networking/v1alpha1" networkingv1beta1 "k8s.io/api/networking/v1beta1" nodev1 "k8s.io/api/node/v1" nodev1alpha1 "k8s.io/api/node/v1alpha1" nodev1beta1 "k8s.io/api/node/v1beta1" policyv1 "k8s.io/api/policy/v1" policyv1beta1 "k8s.io/api/policy/v1beta1" rbacv1 "k8s.io/api/rbac/v1" rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" rbacv1beta1 "k8s.io/api/rbac/v1beta1" resourcev1alpha3 "k8s.io/api/resource/v1alpha3" resourcev1beta1 "k8s.io/api/resource/v1beta1" schedulingv1 "k8s.io/api/scheduling/v1" schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" storagev1 "k8s.io/api/storage/v1" storagev1alpha1 "k8s.io/api/storage/v1alpha1" storagev1beta1 "k8s.io/api/storage/v1beta1" storagemigrationv1alpha1 "k8s.io/api/storagemigration/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" ) var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ admissionregistrationv1.AddToScheme, admissionregistrationv1alpha1.AddToScheme, admissionregistrationv1beta1.AddToScheme, internalv1alpha1.AddToScheme, appsv1.AddToScheme, appsv1beta1.AddToScheme, appsv1beta2.AddToScheme, authenticationv1.AddToScheme, authenticationv1alpha1.AddToScheme, authenticationv1beta1.AddToScheme, authorizationv1.AddToScheme, authorizationv1beta1.AddToScheme, autoscalingv1.AddToScheme, autoscalingv2.AddToScheme, autoscalingv2beta1.AddToScheme, autoscalingv2beta2.AddToScheme, batchv1.AddToScheme, batchv1beta1.AddToScheme, certificatesv1.AddToScheme, certificatesv1beta1.AddToScheme, certificatesv1alpha1.AddToScheme, coordinationv1alpha2.AddToScheme, coordinationv1beta1.AddToScheme, coordinationv1.AddToScheme, corev1.AddToScheme, discoveryv1.AddToScheme, discoveryv1beta1.AddToScheme, eventsv1.AddToScheme, eventsv1beta1.AddToScheme, extensionsv1beta1.AddToScheme, flowcontrolv1.AddToScheme, flowcontrolv1beta1.AddToScheme, flowcontrolv1beta2.AddToScheme, flowcontrolv1beta3.AddToScheme, networkingv1.AddToScheme, networkingv1alpha1.AddToScheme, networkingv1beta1.AddToScheme, nodev1.AddToScheme, nodev1alpha1.AddToScheme, nodev1beta1.AddToScheme, policyv1.AddToScheme, policyv1beta1.AddToScheme, rbacv1.AddToScheme, rbacv1beta1.AddToScheme, rbacv1alpha1.AddToScheme, resourcev1beta1.AddToScheme, resourcev1alpha3.AddToScheme, schedulingv1alpha1.AddToScheme, schedulingv1beta1.AddToScheme, schedulingv1.AddToScheme, storagev1beta1.AddToScheme, storagev1.AddToScheme, storagev1alpha1.AddToScheme, storagemigrationv1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // // import ( // "k8s.io/client-go/kubernetes" // clientsetscheme "k8s.io/client-go/kubernetes/scheme" // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" // ) // // kclientset, _ := kubernetes.NewForConfig(c) // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. var AddToScheme = localSchemeBuilder.AddToScheme func init() { v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) utilruntime.Must(AddToScheme(Scheme)) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/scheme/doc.go
vendor/k8s.io/client-go/kubernetes/scheme/doc.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. // This package contains the scheme of the automatically generated clientset. package scheme
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/fake/register.go
vendor/k8s.io/client-go/kubernetes/fake/register.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( admissionregistrationv1 "k8s.io/api/admissionregistration/v1" admissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1" admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" internalv1alpha1 "k8s.io/api/apiserverinternal/v1alpha1" appsv1 "k8s.io/api/apps/v1" appsv1beta1 "k8s.io/api/apps/v1beta1" appsv1beta2 "k8s.io/api/apps/v1beta2" authenticationv1 "k8s.io/api/authentication/v1" authenticationv1alpha1 "k8s.io/api/authentication/v1alpha1" authenticationv1beta1 "k8s.io/api/authentication/v1beta1" authorizationv1 "k8s.io/api/authorization/v1" authorizationv1beta1 "k8s.io/api/authorization/v1beta1" autoscalingv1 "k8s.io/api/autoscaling/v1" autoscalingv2 "k8s.io/api/autoscaling/v2" autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" batchv1 "k8s.io/api/batch/v1" batchv1beta1 "k8s.io/api/batch/v1beta1" certificatesv1 "k8s.io/api/certificates/v1" certificatesv1alpha1 "k8s.io/api/certificates/v1alpha1" certificatesv1beta1 "k8s.io/api/certificates/v1beta1" coordinationv1 "k8s.io/api/coordination/v1" coordinationv1alpha2 "k8s.io/api/coordination/v1alpha2" coordinationv1beta1 "k8s.io/api/coordination/v1beta1" corev1 "k8s.io/api/core/v1" discoveryv1 "k8s.io/api/discovery/v1" discoveryv1beta1 "k8s.io/api/discovery/v1beta1" eventsv1 "k8s.io/api/events/v1" eventsv1beta1 "k8s.io/api/events/v1beta1" extensionsv1beta1 "k8s.io/api/extensions/v1beta1" flowcontrolv1 "k8s.io/api/flowcontrol/v1" flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" flowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2" flowcontrolv1beta3 "k8s.io/api/flowcontrol/v1beta3" networkingv1 "k8s.io/api/networking/v1" networkingv1alpha1 "k8s.io/api/networking/v1alpha1" networkingv1beta1 "k8s.io/api/networking/v1beta1" nodev1 "k8s.io/api/node/v1" nodev1alpha1 "k8s.io/api/node/v1alpha1" nodev1beta1 "k8s.io/api/node/v1beta1" policyv1 "k8s.io/api/policy/v1" policyv1beta1 "k8s.io/api/policy/v1beta1" rbacv1 "k8s.io/api/rbac/v1" rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" rbacv1beta1 "k8s.io/api/rbac/v1beta1" resourcev1alpha3 "k8s.io/api/resource/v1alpha3" resourcev1beta1 "k8s.io/api/resource/v1beta1" schedulingv1 "k8s.io/api/scheduling/v1" schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" storagev1 "k8s.io/api/storage/v1" storagev1alpha1 "k8s.io/api/storage/v1alpha1" storagev1beta1 "k8s.io/api/storage/v1beta1" storagemigrationv1alpha1 "k8s.io/api/storagemigration/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" ) var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ admissionregistrationv1.AddToScheme, admissionregistrationv1alpha1.AddToScheme, admissionregistrationv1beta1.AddToScheme, internalv1alpha1.AddToScheme, appsv1.AddToScheme, appsv1beta1.AddToScheme, appsv1beta2.AddToScheme, authenticationv1.AddToScheme, authenticationv1alpha1.AddToScheme, authenticationv1beta1.AddToScheme, authorizationv1.AddToScheme, authorizationv1beta1.AddToScheme, autoscalingv1.AddToScheme, autoscalingv2.AddToScheme, autoscalingv2beta1.AddToScheme, autoscalingv2beta2.AddToScheme, batchv1.AddToScheme, batchv1beta1.AddToScheme, certificatesv1.AddToScheme, certificatesv1beta1.AddToScheme, certificatesv1alpha1.AddToScheme, coordinationv1alpha2.AddToScheme, coordinationv1beta1.AddToScheme, coordinationv1.AddToScheme, corev1.AddToScheme, discoveryv1.AddToScheme, discoveryv1beta1.AddToScheme, eventsv1.AddToScheme, eventsv1beta1.AddToScheme, extensionsv1beta1.AddToScheme, flowcontrolv1.AddToScheme, flowcontrolv1beta1.AddToScheme, flowcontrolv1beta2.AddToScheme, flowcontrolv1beta3.AddToScheme, networkingv1.AddToScheme, networkingv1alpha1.AddToScheme, networkingv1beta1.AddToScheme, nodev1.AddToScheme, nodev1alpha1.AddToScheme, nodev1beta1.AddToScheme, policyv1.AddToScheme, policyv1beta1.AddToScheme, rbacv1.AddToScheme, rbacv1beta1.AddToScheme, rbacv1alpha1.AddToScheme, resourcev1beta1.AddToScheme, resourcev1alpha3.AddToScheme, schedulingv1alpha1.AddToScheme, schedulingv1beta1.AddToScheme, schedulingv1.AddToScheme, storagev1beta1.AddToScheme, storagev1.AddToScheme, storagev1alpha1.AddToScheme, storagemigrationv1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // // import ( // "k8s.io/client-go/kubernetes" // clientsetscheme "k8s.io/client-go/kubernetes/scheme" // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" // ) // // kclientset, _ := kubernetes.NewForConfig(c) // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. var AddToScheme = localSchemeBuilder.AddToScheme func init() { v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) utilruntime.Must(AddToScheme(scheme)) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/fake/clientset_generated.go
vendor/k8s.io/client-go/kubernetes/fake/clientset_generated.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" applyconfigurations "k8s.io/client-go/applyconfigurations" "k8s.io/client-go/discovery" fakediscovery "k8s.io/client-go/discovery/fake" clientset "k8s.io/client-go/kubernetes" admissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1" fakeadmissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake" admissionregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1" fakeadmissionregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake" admissionregistrationv1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1" fakeadmissionregistrationv1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake" internalv1alpha1 "k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1" fakeinternalv1alpha1 "k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/fake" appsv1 "k8s.io/client-go/kubernetes/typed/apps/v1" fakeappsv1 "k8s.io/client-go/kubernetes/typed/apps/v1/fake" appsv1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1" fakeappsv1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake" appsv1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2" fakeappsv1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake" authenticationv1 "k8s.io/client-go/kubernetes/typed/authentication/v1" fakeauthenticationv1 "k8s.io/client-go/kubernetes/typed/authentication/v1/fake" authenticationv1alpha1 "k8s.io/client-go/kubernetes/typed/authentication/v1alpha1" fakeauthenticationv1alpha1 "k8s.io/client-go/kubernetes/typed/authentication/v1alpha1/fake" authenticationv1beta1 "k8s.io/client-go/kubernetes/typed/authentication/v1beta1" fakeauthenticationv1beta1 "k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake" authorizationv1 "k8s.io/client-go/kubernetes/typed/authorization/v1" fakeauthorizationv1 "k8s.io/client-go/kubernetes/typed/authorization/v1/fake" authorizationv1beta1 "k8s.io/client-go/kubernetes/typed/authorization/v1beta1" fakeauthorizationv1beta1 "k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake" autoscalingv1 "k8s.io/client-go/kubernetes/typed/autoscaling/v1" fakeautoscalingv1 "k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake" autoscalingv2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2" fakeautoscalingv2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2/fake" autoscalingv2beta1 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1" fakeautoscalingv2beta1 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/fake" autoscalingv2beta2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2" fakeautoscalingv2beta2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/fake" batchv1 "k8s.io/client-go/kubernetes/typed/batch/v1" fakebatchv1 "k8s.io/client-go/kubernetes/typed/batch/v1/fake" batchv1beta1 "k8s.io/client-go/kubernetes/typed/batch/v1beta1" fakebatchv1beta1 "k8s.io/client-go/kubernetes/typed/batch/v1beta1/fake" certificatesv1 "k8s.io/client-go/kubernetes/typed/certificates/v1" fakecertificatesv1 "k8s.io/client-go/kubernetes/typed/certificates/v1/fake" certificatesv1alpha1 "k8s.io/client-go/kubernetes/typed/certificates/v1alpha1" fakecertificatesv1alpha1 "k8s.io/client-go/kubernetes/typed/certificates/v1alpha1/fake" certificatesv1beta1 "k8s.io/client-go/kubernetes/typed/certificates/v1beta1" fakecertificatesv1beta1 "k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake" coordinationv1 "k8s.io/client-go/kubernetes/typed/coordination/v1" fakecoordinationv1 "k8s.io/client-go/kubernetes/typed/coordination/v1/fake" coordinationv1alpha2 "k8s.io/client-go/kubernetes/typed/coordination/v1alpha2" fakecoordinationv1alpha2 "k8s.io/client-go/kubernetes/typed/coordination/v1alpha2/fake" coordinationv1beta1 "k8s.io/client-go/kubernetes/typed/coordination/v1beta1" fakecoordinationv1beta1 "k8s.io/client-go/kubernetes/typed/coordination/v1beta1/fake" corev1 "k8s.io/client-go/kubernetes/typed/core/v1" fakecorev1 "k8s.io/client-go/kubernetes/typed/core/v1/fake" discoveryv1 "k8s.io/client-go/kubernetes/typed/discovery/v1" fakediscoveryv1 "k8s.io/client-go/kubernetes/typed/discovery/v1/fake" discoveryv1beta1 "k8s.io/client-go/kubernetes/typed/discovery/v1beta1" fakediscoveryv1beta1 "k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake" eventsv1 "k8s.io/client-go/kubernetes/typed/events/v1" fakeeventsv1 "k8s.io/client-go/kubernetes/typed/events/v1/fake" eventsv1beta1 "k8s.io/client-go/kubernetes/typed/events/v1beta1" fakeeventsv1beta1 "k8s.io/client-go/kubernetes/typed/events/v1beta1/fake" extensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1" fakeextensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake" flowcontrolv1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1" fakeflowcontrolv1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1/fake" flowcontrolv1beta1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1" fakeflowcontrolv1beta1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/fake" flowcontrolv1beta2 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2" fakeflowcontrolv1beta2 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/fake" flowcontrolv1beta3 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3" fakeflowcontrolv1beta3 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3/fake" networkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1" fakenetworkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1/fake" networkingv1alpha1 "k8s.io/client-go/kubernetes/typed/networking/v1alpha1" fakenetworkingv1alpha1 "k8s.io/client-go/kubernetes/typed/networking/v1alpha1/fake" networkingv1beta1 "k8s.io/client-go/kubernetes/typed/networking/v1beta1" fakenetworkingv1beta1 "k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake" nodev1 "k8s.io/client-go/kubernetes/typed/node/v1" fakenodev1 "k8s.io/client-go/kubernetes/typed/node/v1/fake" nodev1alpha1 "k8s.io/client-go/kubernetes/typed/node/v1alpha1" fakenodev1alpha1 "k8s.io/client-go/kubernetes/typed/node/v1alpha1/fake" nodev1beta1 "k8s.io/client-go/kubernetes/typed/node/v1beta1" fakenodev1beta1 "k8s.io/client-go/kubernetes/typed/node/v1beta1/fake" policyv1 "k8s.io/client-go/kubernetes/typed/policy/v1" fakepolicyv1 "k8s.io/client-go/kubernetes/typed/policy/v1/fake" policyv1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1" fakepolicyv1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake" rbacv1 "k8s.io/client-go/kubernetes/typed/rbac/v1" fakerbacv1 "k8s.io/client-go/kubernetes/typed/rbac/v1/fake" rbacv1alpha1 "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1" fakerbacv1alpha1 "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake" rbacv1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1" fakerbacv1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake" resourcev1alpha3 "k8s.io/client-go/kubernetes/typed/resource/v1alpha3" fakeresourcev1alpha3 "k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake" resourcev1beta1 "k8s.io/client-go/kubernetes/typed/resource/v1beta1" fakeresourcev1beta1 "k8s.io/client-go/kubernetes/typed/resource/v1beta1/fake" schedulingv1 "k8s.io/client-go/kubernetes/typed/scheduling/v1" fakeschedulingv1 "k8s.io/client-go/kubernetes/typed/scheduling/v1/fake" schedulingv1alpha1 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1" fakeschedulingv1alpha1 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake" schedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1" fakeschedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake" storagev1 "k8s.io/client-go/kubernetes/typed/storage/v1" fakestoragev1 "k8s.io/client-go/kubernetes/typed/storage/v1/fake" storagev1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1" fakestoragev1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake" storagev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1" fakestoragev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake" storagemigrationv1alpha1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1alpha1" fakestoragemigrationv1alpha1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1alpha1/fake" "k8s.io/client-go/testing" ) // NewSimpleClientset returns a clientset that will respond with the provided objects. // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, // without applying any field management, validations and/or defaults. It shouldn't be considered a replacement // for a real clientset and is mostly useful in simple unit tests. // // DEPRECATED: NewClientset replaces this with support for field management, which significantly improves // server side apply testing. NewClientset is only available when apply configurations are generated (e.g. // via --with-applyconfig). func NewSimpleClientset(objects ...runtime.Object) *Clientset { o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) for _, obj := range objects { if err := o.Add(obj); err != nil { panic(err) } } cs := &Clientset{tracker: o} cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} cs.AddReactor("*", "*", testing.ObjectReaction(o)) cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { gvr := action.GetResource() ns := action.GetNamespace() watch, err := o.Watch(gvr, ns) if err != nil { return false, nil, err } return true, watch, nil }) return cs } // Clientset implements clientset.Interface. Meant to be embedded into a // struct to get a default implementation. This makes faking out just the method // you want to test easier. type Clientset struct { testing.Fake discovery *fakediscovery.FakeDiscovery tracker testing.ObjectTracker } func (c *Clientset) Discovery() discovery.DiscoveryInterface { return c.discovery } func (c *Clientset) Tracker() testing.ObjectTracker { return c.tracker } // NewClientset returns a clientset that will respond with the provided objects. // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, // without applying any validations and/or defaults. It shouldn't be considered a replacement // for a real clientset and is mostly useful in simple unit tests. func NewClientset(objects ...runtime.Object) *Clientset { o := testing.NewFieldManagedObjectTracker( scheme, codecs.UniversalDecoder(), applyconfigurations.NewTypeConverter(scheme), ) for _, obj := range objects { if err := o.Add(obj); err != nil { panic(err) } } cs := &Clientset{tracker: o} cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} cs.AddReactor("*", "*", testing.ObjectReaction(o)) cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { gvr := action.GetResource() ns := action.GetNamespace() watch, err := o.Watch(gvr, ns) if err != nil { return false, nil, err } return true, watch, nil }) return cs } var ( _ clientset.Interface = &Clientset{} _ testing.FakeClient = &Clientset{} ) // AdmissionregistrationV1 retrieves the AdmissionregistrationV1Client func (c *Clientset) AdmissionregistrationV1() admissionregistrationv1.AdmissionregistrationV1Interface { return &fakeadmissionregistrationv1.FakeAdmissionregistrationV1{Fake: &c.Fake} } // AdmissionregistrationV1alpha1 retrieves the AdmissionregistrationV1alpha1Client func (c *Clientset) AdmissionregistrationV1alpha1() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface { return &fakeadmissionregistrationv1alpha1.FakeAdmissionregistrationV1alpha1{Fake: &c.Fake} } // AdmissionregistrationV1beta1 retrieves the AdmissionregistrationV1beta1Client func (c *Clientset) AdmissionregistrationV1beta1() admissionregistrationv1beta1.AdmissionregistrationV1beta1Interface { return &fakeadmissionregistrationv1beta1.FakeAdmissionregistrationV1beta1{Fake: &c.Fake} } // InternalV1alpha1 retrieves the InternalV1alpha1Client func (c *Clientset) InternalV1alpha1() internalv1alpha1.InternalV1alpha1Interface { return &fakeinternalv1alpha1.FakeInternalV1alpha1{Fake: &c.Fake} } // AppsV1 retrieves the AppsV1Client func (c *Clientset) AppsV1() appsv1.AppsV1Interface { return &fakeappsv1.FakeAppsV1{Fake: &c.Fake} } // AppsV1beta1 retrieves the AppsV1beta1Client func (c *Clientset) AppsV1beta1() appsv1beta1.AppsV1beta1Interface { return &fakeappsv1beta1.FakeAppsV1beta1{Fake: &c.Fake} } // AppsV1beta2 retrieves the AppsV1beta2Client func (c *Clientset) AppsV1beta2() appsv1beta2.AppsV1beta2Interface { return &fakeappsv1beta2.FakeAppsV1beta2{Fake: &c.Fake} } // AuthenticationV1 retrieves the AuthenticationV1Client func (c *Clientset) AuthenticationV1() authenticationv1.AuthenticationV1Interface { return &fakeauthenticationv1.FakeAuthenticationV1{Fake: &c.Fake} } // AuthenticationV1alpha1 retrieves the AuthenticationV1alpha1Client func (c *Clientset) AuthenticationV1alpha1() authenticationv1alpha1.AuthenticationV1alpha1Interface { return &fakeauthenticationv1alpha1.FakeAuthenticationV1alpha1{Fake: &c.Fake} } // AuthenticationV1beta1 retrieves the AuthenticationV1beta1Client func (c *Clientset) AuthenticationV1beta1() authenticationv1beta1.AuthenticationV1beta1Interface { return &fakeauthenticationv1beta1.FakeAuthenticationV1beta1{Fake: &c.Fake} } // AuthorizationV1 retrieves the AuthorizationV1Client func (c *Clientset) AuthorizationV1() authorizationv1.AuthorizationV1Interface { return &fakeauthorizationv1.FakeAuthorizationV1{Fake: &c.Fake} } // AuthorizationV1beta1 retrieves the AuthorizationV1beta1Client func (c *Clientset) AuthorizationV1beta1() authorizationv1beta1.AuthorizationV1beta1Interface { return &fakeauthorizationv1beta1.FakeAuthorizationV1beta1{Fake: &c.Fake} } // AutoscalingV1 retrieves the AutoscalingV1Client func (c *Clientset) AutoscalingV1() autoscalingv1.AutoscalingV1Interface { return &fakeautoscalingv1.FakeAutoscalingV1{Fake: &c.Fake} } // AutoscalingV2 retrieves the AutoscalingV2Client func (c *Clientset) AutoscalingV2() autoscalingv2.AutoscalingV2Interface { return &fakeautoscalingv2.FakeAutoscalingV2{Fake: &c.Fake} } // AutoscalingV2beta1 retrieves the AutoscalingV2beta1Client func (c *Clientset) AutoscalingV2beta1() autoscalingv2beta1.AutoscalingV2beta1Interface { return &fakeautoscalingv2beta1.FakeAutoscalingV2beta1{Fake: &c.Fake} } // AutoscalingV2beta2 retrieves the AutoscalingV2beta2Client func (c *Clientset) AutoscalingV2beta2() autoscalingv2beta2.AutoscalingV2beta2Interface { return &fakeautoscalingv2beta2.FakeAutoscalingV2beta2{Fake: &c.Fake} } // BatchV1 retrieves the BatchV1Client func (c *Clientset) BatchV1() batchv1.BatchV1Interface { return &fakebatchv1.FakeBatchV1{Fake: &c.Fake} } // BatchV1beta1 retrieves the BatchV1beta1Client func (c *Clientset) BatchV1beta1() batchv1beta1.BatchV1beta1Interface { return &fakebatchv1beta1.FakeBatchV1beta1{Fake: &c.Fake} } // CertificatesV1 retrieves the CertificatesV1Client func (c *Clientset) CertificatesV1() certificatesv1.CertificatesV1Interface { return &fakecertificatesv1.FakeCertificatesV1{Fake: &c.Fake} } // CertificatesV1beta1 retrieves the CertificatesV1beta1Client func (c *Clientset) CertificatesV1beta1() certificatesv1beta1.CertificatesV1beta1Interface { return &fakecertificatesv1beta1.FakeCertificatesV1beta1{Fake: &c.Fake} } // CertificatesV1alpha1 retrieves the CertificatesV1alpha1Client func (c *Clientset) CertificatesV1alpha1() certificatesv1alpha1.CertificatesV1alpha1Interface { return &fakecertificatesv1alpha1.FakeCertificatesV1alpha1{Fake: &c.Fake} } // CoordinationV1alpha2 retrieves the CoordinationV1alpha2Client func (c *Clientset) CoordinationV1alpha2() coordinationv1alpha2.CoordinationV1alpha2Interface { return &fakecoordinationv1alpha2.FakeCoordinationV1alpha2{Fake: &c.Fake} } // CoordinationV1beta1 retrieves the CoordinationV1beta1Client func (c *Clientset) CoordinationV1beta1() coordinationv1beta1.CoordinationV1beta1Interface { return &fakecoordinationv1beta1.FakeCoordinationV1beta1{Fake: &c.Fake} } // CoordinationV1 retrieves the CoordinationV1Client func (c *Clientset) CoordinationV1() coordinationv1.CoordinationV1Interface { return &fakecoordinationv1.FakeCoordinationV1{Fake: &c.Fake} } // CoreV1 retrieves the CoreV1Client func (c *Clientset) CoreV1() corev1.CoreV1Interface { return &fakecorev1.FakeCoreV1{Fake: &c.Fake} } // DiscoveryV1 retrieves the DiscoveryV1Client func (c *Clientset) DiscoveryV1() discoveryv1.DiscoveryV1Interface { return &fakediscoveryv1.FakeDiscoveryV1{Fake: &c.Fake} } // DiscoveryV1beta1 retrieves the DiscoveryV1beta1Client func (c *Clientset) DiscoveryV1beta1() discoveryv1beta1.DiscoveryV1beta1Interface { return &fakediscoveryv1beta1.FakeDiscoveryV1beta1{Fake: &c.Fake} } // EventsV1 retrieves the EventsV1Client func (c *Clientset) EventsV1() eventsv1.EventsV1Interface { return &fakeeventsv1.FakeEventsV1{Fake: &c.Fake} } // EventsV1beta1 retrieves the EventsV1beta1Client func (c *Clientset) EventsV1beta1() eventsv1beta1.EventsV1beta1Interface { return &fakeeventsv1beta1.FakeEventsV1beta1{Fake: &c.Fake} } // ExtensionsV1beta1 retrieves the ExtensionsV1beta1Client func (c *Clientset) ExtensionsV1beta1() extensionsv1beta1.ExtensionsV1beta1Interface { return &fakeextensionsv1beta1.FakeExtensionsV1beta1{Fake: &c.Fake} } // FlowcontrolV1 retrieves the FlowcontrolV1Client func (c *Clientset) FlowcontrolV1() flowcontrolv1.FlowcontrolV1Interface { return &fakeflowcontrolv1.FakeFlowcontrolV1{Fake: &c.Fake} } // FlowcontrolV1beta1 retrieves the FlowcontrolV1beta1Client func (c *Clientset) FlowcontrolV1beta1() flowcontrolv1beta1.FlowcontrolV1beta1Interface { return &fakeflowcontrolv1beta1.FakeFlowcontrolV1beta1{Fake: &c.Fake} } // FlowcontrolV1beta2 retrieves the FlowcontrolV1beta2Client func (c *Clientset) FlowcontrolV1beta2() flowcontrolv1beta2.FlowcontrolV1beta2Interface { return &fakeflowcontrolv1beta2.FakeFlowcontrolV1beta2{Fake: &c.Fake} } // FlowcontrolV1beta3 retrieves the FlowcontrolV1beta3Client func (c *Clientset) FlowcontrolV1beta3() flowcontrolv1beta3.FlowcontrolV1beta3Interface { return &fakeflowcontrolv1beta3.FakeFlowcontrolV1beta3{Fake: &c.Fake} } // NetworkingV1 retrieves the NetworkingV1Client func (c *Clientset) NetworkingV1() networkingv1.NetworkingV1Interface { return &fakenetworkingv1.FakeNetworkingV1{Fake: &c.Fake} } // NetworkingV1alpha1 retrieves the NetworkingV1alpha1Client func (c *Clientset) NetworkingV1alpha1() networkingv1alpha1.NetworkingV1alpha1Interface { return &fakenetworkingv1alpha1.FakeNetworkingV1alpha1{Fake: &c.Fake} } // NetworkingV1beta1 retrieves the NetworkingV1beta1Client func (c *Clientset) NetworkingV1beta1() networkingv1beta1.NetworkingV1beta1Interface { return &fakenetworkingv1beta1.FakeNetworkingV1beta1{Fake: &c.Fake} } // NodeV1 retrieves the NodeV1Client func (c *Clientset) NodeV1() nodev1.NodeV1Interface { return &fakenodev1.FakeNodeV1{Fake: &c.Fake} } // NodeV1alpha1 retrieves the NodeV1alpha1Client func (c *Clientset) NodeV1alpha1() nodev1alpha1.NodeV1alpha1Interface { return &fakenodev1alpha1.FakeNodeV1alpha1{Fake: &c.Fake} } // NodeV1beta1 retrieves the NodeV1beta1Client func (c *Clientset) NodeV1beta1() nodev1beta1.NodeV1beta1Interface { return &fakenodev1beta1.FakeNodeV1beta1{Fake: &c.Fake} } // PolicyV1 retrieves the PolicyV1Client func (c *Clientset) PolicyV1() policyv1.PolicyV1Interface { return &fakepolicyv1.FakePolicyV1{Fake: &c.Fake} } // PolicyV1beta1 retrieves the PolicyV1beta1Client func (c *Clientset) PolicyV1beta1() policyv1beta1.PolicyV1beta1Interface { return &fakepolicyv1beta1.FakePolicyV1beta1{Fake: &c.Fake} } // RbacV1 retrieves the RbacV1Client func (c *Clientset) RbacV1() rbacv1.RbacV1Interface { return &fakerbacv1.FakeRbacV1{Fake: &c.Fake} } // RbacV1beta1 retrieves the RbacV1beta1Client func (c *Clientset) RbacV1beta1() rbacv1beta1.RbacV1beta1Interface { return &fakerbacv1beta1.FakeRbacV1beta1{Fake: &c.Fake} } // RbacV1alpha1 retrieves the RbacV1alpha1Client func (c *Clientset) RbacV1alpha1() rbacv1alpha1.RbacV1alpha1Interface { return &fakerbacv1alpha1.FakeRbacV1alpha1{Fake: &c.Fake} } // ResourceV1beta1 retrieves the ResourceV1beta1Client func (c *Clientset) ResourceV1beta1() resourcev1beta1.ResourceV1beta1Interface { return &fakeresourcev1beta1.FakeResourceV1beta1{Fake: &c.Fake} } // ResourceV1alpha3 retrieves the ResourceV1alpha3Client func (c *Clientset) ResourceV1alpha3() resourcev1alpha3.ResourceV1alpha3Interface { return &fakeresourcev1alpha3.FakeResourceV1alpha3{Fake: &c.Fake} } // SchedulingV1alpha1 retrieves the SchedulingV1alpha1Client func (c *Clientset) SchedulingV1alpha1() schedulingv1alpha1.SchedulingV1alpha1Interface { return &fakeschedulingv1alpha1.FakeSchedulingV1alpha1{Fake: &c.Fake} } // SchedulingV1beta1 retrieves the SchedulingV1beta1Client func (c *Clientset) SchedulingV1beta1() schedulingv1beta1.SchedulingV1beta1Interface { return &fakeschedulingv1beta1.FakeSchedulingV1beta1{Fake: &c.Fake} } // SchedulingV1 retrieves the SchedulingV1Client func (c *Clientset) SchedulingV1() schedulingv1.SchedulingV1Interface { return &fakeschedulingv1.FakeSchedulingV1{Fake: &c.Fake} } // StorageV1beta1 retrieves the StorageV1beta1Client func (c *Clientset) StorageV1beta1() storagev1beta1.StorageV1beta1Interface { return &fakestoragev1beta1.FakeStorageV1beta1{Fake: &c.Fake} } // StorageV1 retrieves the StorageV1Client func (c *Clientset) StorageV1() storagev1.StorageV1Interface { return &fakestoragev1.FakeStorageV1{Fake: &c.Fake} } // StorageV1alpha1 retrieves the StorageV1alpha1Client func (c *Clientset) StorageV1alpha1() storagev1alpha1.StorageV1alpha1Interface { return &fakestoragev1alpha1.FakeStorageV1alpha1{Fake: &c.Fake} } // StoragemigrationV1alpha1 retrieves the StoragemigrationV1alpha1Client func (c *Clientset) StoragemigrationV1alpha1() storagemigrationv1alpha1.StoragemigrationV1alpha1Interface { return &fakestoragemigrationv1alpha1.FakeStoragemigrationV1alpha1{Fake: &c.Fake} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/fake/doc.go
vendor/k8s.io/client-go/kubernetes/fake/doc.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated fake clientset. package fake
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/job.go
vendor/k8s.io/client-go/kubernetes/typed/batch/v1/job.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package v1 import ( context "context" batchv1 "k8s.io/api/batch/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" applyconfigurationsbatchv1 "k8s.io/client-go/applyconfigurations/batch/v1" gentype "k8s.io/client-go/gentype" scheme "k8s.io/client-go/kubernetes/scheme" ) // JobsGetter has a method to return a JobInterface. // A group's client should implement this interface. type JobsGetter interface { Jobs(namespace string) JobInterface } // JobInterface has methods to work with Job resources. type JobInterface interface { Create(ctx context.Context, job *batchv1.Job, opts metav1.CreateOptions) (*batchv1.Job, error) Update(ctx context.Context, job *batchv1.Job, opts metav1.UpdateOptions) (*batchv1.Job, error) // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, job *batchv1.Job, opts metav1.UpdateOptions) (*batchv1.Job, error) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error Get(ctx context.Context, name string, opts metav1.GetOptions) (*batchv1.Job, error) List(ctx context.Context, opts metav1.ListOptions) (*batchv1.JobList, error) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *batchv1.Job, err error) Apply(ctx context.Context, job *applyconfigurationsbatchv1.JobApplyConfiguration, opts metav1.ApplyOptions) (result *batchv1.Job, err error) // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, job *applyconfigurationsbatchv1.JobApplyConfiguration, opts metav1.ApplyOptions) (result *batchv1.Job, err error) JobExpansion } // jobs implements JobInterface type jobs struct { *gentype.ClientWithListAndApply[*batchv1.Job, *batchv1.JobList, *applyconfigurationsbatchv1.JobApplyConfiguration] } // newJobs returns a Jobs func newJobs(c *BatchV1Client, namespace string) *jobs { return &jobs{ gentype.NewClientWithListAndApply[*batchv1.Job, *batchv1.JobList, *applyconfigurationsbatchv1.JobApplyConfiguration]( "jobs", c.RESTClient(), scheme.ParameterCodec, namespace, func() *batchv1.Job { return &batchv1.Job{} }, func() *batchv1.JobList { return &batchv1.JobList{} }, gentype.PrefersProtobuf[*batchv1.Job](), ), } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/batch_client.go
vendor/k8s.io/client-go/kubernetes/typed/batch/v1/batch_client.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package v1 import ( http "net/http" batchv1 "k8s.io/api/batch/v1" scheme "k8s.io/client-go/kubernetes/scheme" rest "k8s.io/client-go/rest" ) type BatchV1Interface interface { RESTClient() rest.Interface CronJobsGetter JobsGetter } // BatchV1Client is used to interact with features provided by the batch group. type BatchV1Client struct { restClient rest.Interface } func (c *BatchV1Client) CronJobs(namespace string) CronJobInterface { return newCronJobs(c, namespace) } func (c *BatchV1Client) Jobs(namespace string) JobInterface { return newJobs(c, namespace) } // NewForConfig creates a new BatchV1Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). func NewForConfig(c *rest.Config) (*BatchV1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err } httpClient, err := rest.HTTPClientFor(&config) if err != nil { return nil, err } return NewForConfigAndClient(&config, httpClient) } // NewForConfigAndClient creates a new BatchV1Client for the given config and http client. // Note the http client provided takes precedence over the configured transport values. func NewForConfigAndClient(c *rest.Config, h *http.Client) (*BatchV1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err } client, err := rest.RESTClientForConfigAndClient(&config, h) if err != nil { return nil, err } return &BatchV1Client{client}, nil } // NewForConfigOrDie creates a new BatchV1Client for the given config and // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *BatchV1Client { client, err := NewForConfig(c) if err != nil { panic(err) } return client } // New creates a new BatchV1Client for the given RESTClient. func New(c rest.Interface) *BatchV1Client { return &BatchV1Client{c} } func setConfigDefaults(config *rest.Config) error { gv := batchv1.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() if config.UserAgent == "" { config.UserAgent = rest.DefaultKubernetesUserAgent() } return nil } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *BatchV1Client) RESTClient() rest.Interface { if c == nil { return nil } return c.restClient }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/generated_expansion.go
vendor/k8s.io/client-go/kubernetes/typed/batch/v1/generated_expansion.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package v1 type CronJobExpansion interface{} type JobExpansion interface{}
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/doc.go
vendor/k8s.io/client-go/kubernetes/typed/batch/v1/doc.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated typed clients. package v1
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/cronjob.go
vendor/k8s.io/client-go/kubernetes/typed/batch/v1/cronjob.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package v1 import ( context "context" batchv1 "k8s.io/api/batch/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" applyconfigurationsbatchv1 "k8s.io/client-go/applyconfigurations/batch/v1" gentype "k8s.io/client-go/gentype" scheme "k8s.io/client-go/kubernetes/scheme" ) // CronJobsGetter has a method to return a CronJobInterface. // A group's client should implement this interface. type CronJobsGetter interface { CronJobs(namespace string) CronJobInterface } // CronJobInterface has methods to work with CronJob resources. type CronJobInterface interface { Create(ctx context.Context, cronJob *batchv1.CronJob, opts metav1.CreateOptions) (*batchv1.CronJob, error) Update(ctx context.Context, cronJob *batchv1.CronJob, opts metav1.UpdateOptions) (*batchv1.CronJob, error) // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, cronJob *batchv1.CronJob, opts metav1.UpdateOptions) (*batchv1.CronJob, error) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error Get(ctx context.Context, name string, opts metav1.GetOptions) (*batchv1.CronJob, error) List(ctx context.Context, opts metav1.ListOptions) (*batchv1.CronJobList, error) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *batchv1.CronJob, err error) Apply(ctx context.Context, cronJob *applyconfigurationsbatchv1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *batchv1.CronJob, err error) // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, cronJob *applyconfigurationsbatchv1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *batchv1.CronJob, err error) CronJobExpansion } // cronJobs implements CronJobInterface type cronJobs struct { *gentype.ClientWithListAndApply[*batchv1.CronJob, *batchv1.CronJobList, *applyconfigurationsbatchv1.CronJobApplyConfiguration] } // newCronJobs returns a CronJobs func newCronJobs(c *BatchV1Client, namespace string) *cronJobs { return &cronJobs{ gentype.NewClientWithListAndApply[*batchv1.CronJob, *batchv1.CronJobList, *applyconfigurationsbatchv1.CronJobApplyConfiguration]( "cronjobs", c.RESTClient(), scheme.ParameterCodec, namespace, func() *batchv1.CronJob { return &batchv1.CronJob{} }, func() *batchv1.CronJobList { return &batchv1.CronJobList{} }, gentype.PrefersProtobuf[*batchv1.CronJob](), ), } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake/fake_job.go
vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake/fake_job.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( v1 "k8s.io/api/batch/v1" batchv1 "k8s.io/client-go/applyconfigurations/batch/v1" gentype "k8s.io/client-go/gentype" typedbatchv1 "k8s.io/client-go/kubernetes/typed/batch/v1" ) // fakeJobs implements JobInterface type fakeJobs struct { *gentype.FakeClientWithListAndApply[*v1.Job, *v1.JobList, *batchv1.JobApplyConfiguration] Fake *FakeBatchV1 } func newFakeJobs(fake *FakeBatchV1, namespace string) typedbatchv1.JobInterface { return &fakeJobs{ gentype.NewFakeClientWithListAndApply[*v1.Job, *v1.JobList, *batchv1.JobApplyConfiguration]( fake.Fake, namespace, v1.SchemeGroupVersion.WithResource("jobs"), v1.SchemeGroupVersion.WithKind("Job"), func() *v1.Job { return &v1.Job{} }, func() *v1.JobList { return &v1.JobList{} }, func(dst, src *v1.JobList) { dst.ListMeta = src.ListMeta }, func(list *v1.JobList) []*v1.Job { return gentype.ToPointerSlice(list.Items) }, func(list *v1.JobList, items []*v1.Job) { list.Items = gentype.FromPointerSlice(items) }, ), fake, } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake/fake_cronjob.go
vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake/fake_cronjob.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( v1 "k8s.io/api/batch/v1" batchv1 "k8s.io/client-go/applyconfigurations/batch/v1" gentype "k8s.io/client-go/gentype" typedbatchv1 "k8s.io/client-go/kubernetes/typed/batch/v1" ) // fakeCronJobs implements CronJobInterface type fakeCronJobs struct { *gentype.FakeClientWithListAndApply[*v1.CronJob, *v1.CronJobList, *batchv1.CronJobApplyConfiguration] Fake *FakeBatchV1 } func newFakeCronJobs(fake *FakeBatchV1, namespace string) typedbatchv1.CronJobInterface { return &fakeCronJobs{ gentype.NewFakeClientWithListAndApply[*v1.CronJob, *v1.CronJobList, *batchv1.CronJobApplyConfiguration]( fake.Fake, namespace, v1.SchemeGroupVersion.WithResource("cronjobs"), v1.SchemeGroupVersion.WithKind("CronJob"), func() *v1.CronJob { return &v1.CronJob{} }, func() *v1.CronJobList { return &v1.CronJobList{} }, func(dst, src *v1.CronJobList) { dst.ListMeta = src.ListMeta }, func(list *v1.CronJobList) []*v1.CronJob { return gentype.ToPointerSlice(list.Items) }, func(list *v1.CronJobList, items []*v1.CronJob) { list.Items = gentype.FromPointerSlice(items) }, ), fake, } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake/doc.go
vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake/doc.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. // Package fake has the automatically generated clients. package fake
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake/fake_batch_client.go
vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake/fake_batch_client.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( v1 "k8s.io/client-go/kubernetes/typed/batch/v1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" ) type FakeBatchV1 struct { *testing.Fake } func (c *FakeBatchV1) CronJobs(namespace string) v1.CronJobInterface { return newFakeCronJobs(c, namespace) } func (c *FakeBatchV1) Jobs(namespace string) v1.JobInterface { return newFakeJobs(c, namespace) } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeBatchV1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/batch_client.go
vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/batch_client.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package v1beta1 import ( http "net/http" batchv1beta1 "k8s.io/api/batch/v1beta1" scheme "k8s.io/client-go/kubernetes/scheme" rest "k8s.io/client-go/rest" ) type BatchV1beta1Interface interface { RESTClient() rest.Interface CronJobsGetter } // BatchV1beta1Client is used to interact with features provided by the batch group. type BatchV1beta1Client struct { restClient rest.Interface } func (c *BatchV1beta1Client) CronJobs(namespace string) CronJobInterface { return newCronJobs(c, namespace) } // NewForConfig creates a new BatchV1beta1Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). func NewForConfig(c *rest.Config) (*BatchV1beta1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err } httpClient, err := rest.HTTPClientFor(&config) if err != nil { return nil, err } return NewForConfigAndClient(&config, httpClient) } // NewForConfigAndClient creates a new BatchV1beta1Client for the given config and http client. // Note the http client provided takes precedence over the configured transport values. func NewForConfigAndClient(c *rest.Config, h *http.Client) (*BatchV1beta1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err } client, err := rest.RESTClientForConfigAndClient(&config, h) if err != nil { return nil, err } return &BatchV1beta1Client{client}, nil } // NewForConfigOrDie creates a new BatchV1beta1Client for the given config and // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *BatchV1beta1Client { client, err := NewForConfig(c) if err != nil { panic(err) } return client } // New creates a new BatchV1beta1Client for the given RESTClient. func New(c rest.Interface) *BatchV1beta1Client { return &BatchV1beta1Client{c} } func setConfigDefaults(config *rest.Config) error { gv := batchv1beta1.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() if config.UserAgent == "" { config.UserAgent = rest.DefaultKubernetesUserAgent() } return nil } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *BatchV1beta1Client) RESTClient() rest.Interface { if c == nil { return nil } return c.restClient }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/generated_expansion.go
vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/generated_expansion.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package v1beta1 type CronJobExpansion interface{}
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/doc.go
vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/doc.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated typed clients. package v1beta1
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/cronjob.go
vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/cronjob.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package v1beta1 import ( context "context" batchv1beta1 "k8s.io/api/batch/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" applyconfigurationsbatchv1beta1 "k8s.io/client-go/applyconfigurations/batch/v1beta1" gentype "k8s.io/client-go/gentype" scheme "k8s.io/client-go/kubernetes/scheme" ) // CronJobsGetter has a method to return a CronJobInterface. // A group's client should implement this interface. type CronJobsGetter interface { CronJobs(namespace string) CronJobInterface } // CronJobInterface has methods to work with CronJob resources. type CronJobInterface interface { Create(ctx context.Context, cronJob *batchv1beta1.CronJob, opts v1.CreateOptions) (*batchv1beta1.CronJob, error) Update(ctx context.Context, cronJob *batchv1beta1.CronJob, opts v1.UpdateOptions) (*batchv1beta1.CronJob, error) // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, cronJob *batchv1beta1.CronJob, opts v1.UpdateOptions) (*batchv1beta1.CronJob, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error Get(ctx context.Context, name string, opts v1.GetOptions) (*batchv1beta1.CronJob, error) List(ctx context.Context, opts v1.ListOptions) (*batchv1beta1.CronJobList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *batchv1beta1.CronJob, err error) Apply(ctx context.Context, cronJob *applyconfigurationsbatchv1beta1.CronJobApplyConfiguration, opts v1.ApplyOptions) (result *batchv1beta1.CronJob, err error) // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, cronJob *applyconfigurationsbatchv1beta1.CronJobApplyConfiguration, opts v1.ApplyOptions) (result *batchv1beta1.CronJob, err error) CronJobExpansion } // cronJobs implements CronJobInterface type cronJobs struct { *gentype.ClientWithListAndApply[*batchv1beta1.CronJob, *batchv1beta1.CronJobList, *applyconfigurationsbatchv1beta1.CronJobApplyConfiguration] } // newCronJobs returns a CronJobs func newCronJobs(c *BatchV1beta1Client, namespace string) *cronJobs { return &cronJobs{ gentype.NewClientWithListAndApply[*batchv1beta1.CronJob, *batchv1beta1.CronJobList, *applyconfigurationsbatchv1beta1.CronJobApplyConfiguration]( "cronjobs", c.RESTClient(), scheme.ParameterCodec, namespace, func() *batchv1beta1.CronJob { return &batchv1beta1.CronJob{} }, func() *batchv1beta1.CronJobList { return &batchv1beta1.CronJobList{} }, gentype.PrefersProtobuf[*batchv1beta1.CronJob](), ), } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/fake/fake_cronjob.go
vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/fake/fake_cronjob.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( v1beta1 "k8s.io/api/batch/v1beta1" batchv1beta1 "k8s.io/client-go/applyconfigurations/batch/v1beta1" gentype "k8s.io/client-go/gentype" typedbatchv1beta1 "k8s.io/client-go/kubernetes/typed/batch/v1beta1" ) // fakeCronJobs implements CronJobInterface type fakeCronJobs struct { *gentype.FakeClientWithListAndApply[*v1beta1.CronJob, *v1beta1.CronJobList, *batchv1beta1.CronJobApplyConfiguration] Fake *FakeBatchV1beta1 } func newFakeCronJobs(fake *FakeBatchV1beta1, namespace string) typedbatchv1beta1.CronJobInterface { return &fakeCronJobs{ gentype.NewFakeClientWithListAndApply[*v1beta1.CronJob, *v1beta1.CronJobList, *batchv1beta1.CronJobApplyConfiguration]( fake.Fake, namespace, v1beta1.SchemeGroupVersion.WithResource("cronjobs"), v1beta1.SchemeGroupVersion.WithKind("CronJob"), func() *v1beta1.CronJob { return &v1beta1.CronJob{} }, func() *v1beta1.CronJobList { return &v1beta1.CronJobList{} }, func(dst, src *v1beta1.CronJobList) { dst.ListMeta = src.ListMeta }, func(list *v1beta1.CronJobList) []*v1beta1.CronJob { return gentype.ToPointerSlice(list.Items) }, func(list *v1beta1.CronJobList, items []*v1beta1.CronJob) { list.Items = gentype.FromPointerSlice(items) }, ), fake, } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/fake/doc.go
vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/fake/doc.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. // Package fake has the automatically generated clients. package fake
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/fake/fake_batch_client.go
vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/fake/fake_batch_client.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( v1beta1 "k8s.io/client-go/kubernetes/typed/batch/v1beta1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" ) type FakeBatchV1beta1 struct { *testing.Fake } func (c *FakeBatchV1beta1) CronJobs(namespace string) v1beta1.CronJobInterface { return newFakeCronJobs(c, namespace) } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeBatchV1beta1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/endpointslice.go
vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/endpointslice.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package v1 import ( context "context" discoveryv1 "k8s.io/api/discovery/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" applyconfigurationsdiscoveryv1 "k8s.io/client-go/applyconfigurations/discovery/v1" gentype "k8s.io/client-go/gentype" scheme "k8s.io/client-go/kubernetes/scheme" ) // EndpointSlicesGetter has a method to return a EndpointSliceInterface. // A group's client should implement this interface. type EndpointSlicesGetter interface { EndpointSlices(namespace string) EndpointSliceInterface } // EndpointSliceInterface has methods to work with EndpointSlice resources. type EndpointSliceInterface interface { Create(ctx context.Context, endpointSlice *discoveryv1.EndpointSlice, opts metav1.CreateOptions) (*discoveryv1.EndpointSlice, error) Update(ctx context.Context, endpointSlice *discoveryv1.EndpointSlice, opts metav1.UpdateOptions) (*discoveryv1.EndpointSlice, error) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error Get(ctx context.Context, name string, opts metav1.GetOptions) (*discoveryv1.EndpointSlice, error) List(ctx context.Context, opts metav1.ListOptions) (*discoveryv1.EndpointSliceList, error) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *discoveryv1.EndpointSlice, err error) Apply(ctx context.Context, endpointSlice *applyconfigurationsdiscoveryv1.EndpointSliceApplyConfiguration, opts metav1.ApplyOptions) (result *discoveryv1.EndpointSlice, err error) EndpointSliceExpansion } // endpointSlices implements EndpointSliceInterface type endpointSlices struct { *gentype.ClientWithListAndApply[*discoveryv1.EndpointSlice, *discoveryv1.EndpointSliceList, *applyconfigurationsdiscoveryv1.EndpointSliceApplyConfiguration] } // newEndpointSlices returns a EndpointSlices func newEndpointSlices(c *DiscoveryV1Client, namespace string) *endpointSlices { return &endpointSlices{ gentype.NewClientWithListAndApply[*discoveryv1.EndpointSlice, *discoveryv1.EndpointSliceList, *applyconfigurationsdiscoveryv1.EndpointSliceApplyConfiguration]( "endpointslices", c.RESTClient(), scheme.ParameterCodec, namespace, func() *discoveryv1.EndpointSlice { return &discoveryv1.EndpointSlice{} }, func() *discoveryv1.EndpointSliceList { return &discoveryv1.EndpointSliceList{} }, gentype.PrefersProtobuf[*discoveryv1.EndpointSlice](), ), } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/discovery_client.go
vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/discovery_client.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package v1 import ( http "net/http" discoveryv1 "k8s.io/api/discovery/v1" scheme "k8s.io/client-go/kubernetes/scheme" rest "k8s.io/client-go/rest" ) type DiscoveryV1Interface interface { RESTClient() rest.Interface EndpointSlicesGetter } // DiscoveryV1Client is used to interact with features provided by the discovery.k8s.io group. type DiscoveryV1Client struct { restClient rest.Interface } func (c *DiscoveryV1Client) EndpointSlices(namespace string) EndpointSliceInterface { return newEndpointSlices(c, namespace) } // NewForConfig creates a new DiscoveryV1Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). func NewForConfig(c *rest.Config) (*DiscoveryV1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err } httpClient, err := rest.HTTPClientFor(&config) if err != nil { return nil, err } return NewForConfigAndClient(&config, httpClient) } // NewForConfigAndClient creates a new DiscoveryV1Client for the given config and http client. // Note the http client provided takes precedence over the configured transport values. func NewForConfigAndClient(c *rest.Config, h *http.Client) (*DiscoveryV1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err } client, err := rest.RESTClientForConfigAndClient(&config, h) if err != nil { return nil, err } return &DiscoveryV1Client{client}, nil } // NewForConfigOrDie creates a new DiscoveryV1Client for the given config and // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *DiscoveryV1Client { client, err := NewForConfig(c) if err != nil { panic(err) } return client } // New creates a new DiscoveryV1Client for the given RESTClient. func New(c rest.Interface) *DiscoveryV1Client { return &DiscoveryV1Client{c} } func setConfigDefaults(config *rest.Config) error { gv := discoveryv1.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() if config.UserAgent == "" { config.UserAgent = rest.DefaultKubernetesUserAgent() } return nil } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *DiscoveryV1Client) RESTClient() rest.Interface { if c == nil { return nil } return c.restClient }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/generated_expansion.go
vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/generated_expansion.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package v1 type EndpointSliceExpansion interface{}
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/doc.go
vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/doc.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated typed clients. package v1
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/fake/fake_discovery_client.go
vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/fake/fake_discovery_client.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( v1 "k8s.io/client-go/kubernetes/typed/discovery/v1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" ) type FakeDiscoveryV1 struct { *testing.Fake } func (c *FakeDiscoveryV1) EndpointSlices(namespace string) v1.EndpointSliceInterface { return newFakeEndpointSlices(c, namespace) } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeDiscoveryV1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/fake/fake_endpointslice.go
vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/fake/fake_endpointslice.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( v1 "k8s.io/api/discovery/v1" discoveryv1 "k8s.io/client-go/applyconfigurations/discovery/v1" gentype "k8s.io/client-go/gentype" typeddiscoveryv1 "k8s.io/client-go/kubernetes/typed/discovery/v1" ) // fakeEndpointSlices implements EndpointSliceInterface type fakeEndpointSlices struct { *gentype.FakeClientWithListAndApply[*v1.EndpointSlice, *v1.EndpointSliceList, *discoveryv1.EndpointSliceApplyConfiguration] Fake *FakeDiscoveryV1 } func newFakeEndpointSlices(fake *FakeDiscoveryV1, namespace string) typeddiscoveryv1.EndpointSliceInterface { return &fakeEndpointSlices{ gentype.NewFakeClientWithListAndApply[*v1.EndpointSlice, *v1.EndpointSliceList, *discoveryv1.EndpointSliceApplyConfiguration]( fake.Fake, namespace, v1.SchemeGroupVersion.WithResource("endpointslices"), v1.SchemeGroupVersion.WithKind("EndpointSlice"), func() *v1.EndpointSlice { return &v1.EndpointSlice{} }, func() *v1.EndpointSliceList { return &v1.EndpointSliceList{} }, func(dst, src *v1.EndpointSliceList) { dst.ListMeta = src.ListMeta }, func(list *v1.EndpointSliceList) []*v1.EndpointSlice { return gentype.ToPointerSlice(list.Items) }, func(list *v1.EndpointSliceList, items []*v1.EndpointSlice) { list.Items = gentype.FromPointerSlice(items) }, ), fake, } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/fake/doc.go
vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/fake/doc.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. // Package fake has the automatically generated clients. package fake
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/endpointslice.go
vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/endpointslice.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package v1beta1 import ( context "context" discoveryv1beta1 "k8s.io/api/discovery/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" applyconfigurationsdiscoveryv1beta1 "k8s.io/client-go/applyconfigurations/discovery/v1beta1" gentype "k8s.io/client-go/gentype" scheme "k8s.io/client-go/kubernetes/scheme" ) // EndpointSlicesGetter has a method to return a EndpointSliceInterface. // A group's client should implement this interface. type EndpointSlicesGetter interface { EndpointSlices(namespace string) EndpointSliceInterface } // EndpointSliceInterface has methods to work with EndpointSlice resources. type EndpointSliceInterface interface { Create(ctx context.Context, endpointSlice *discoveryv1beta1.EndpointSlice, opts v1.CreateOptions) (*discoveryv1beta1.EndpointSlice, error) Update(ctx context.Context, endpointSlice *discoveryv1beta1.EndpointSlice, opts v1.UpdateOptions) (*discoveryv1beta1.EndpointSlice, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error Get(ctx context.Context, name string, opts v1.GetOptions) (*discoveryv1beta1.EndpointSlice, error) List(ctx context.Context, opts v1.ListOptions) (*discoveryv1beta1.EndpointSliceList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *discoveryv1beta1.EndpointSlice, err error) Apply(ctx context.Context, endpointSlice *applyconfigurationsdiscoveryv1beta1.EndpointSliceApplyConfiguration, opts v1.ApplyOptions) (result *discoveryv1beta1.EndpointSlice, err error) EndpointSliceExpansion } // endpointSlices implements EndpointSliceInterface type endpointSlices struct { *gentype.ClientWithListAndApply[*discoveryv1beta1.EndpointSlice, *discoveryv1beta1.EndpointSliceList, *applyconfigurationsdiscoveryv1beta1.EndpointSliceApplyConfiguration] } // newEndpointSlices returns a EndpointSlices func newEndpointSlices(c *DiscoveryV1beta1Client, namespace string) *endpointSlices { return &endpointSlices{ gentype.NewClientWithListAndApply[*discoveryv1beta1.EndpointSlice, *discoveryv1beta1.EndpointSliceList, *applyconfigurationsdiscoveryv1beta1.EndpointSliceApplyConfiguration]( "endpointslices", c.RESTClient(), scheme.ParameterCodec, namespace, func() *discoveryv1beta1.EndpointSlice { return &discoveryv1beta1.EndpointSlice{} }, func() *discoveryv1beta1.EndpointSliceList { return &discoveryv1beta1.EndpointSliceList{} }, gentype.PrefersProtobuf[*discoveryv1beta1.EndpointSlice](), ), } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/discovery_client.go
vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/discovery_client.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package v1beta1 import ( http "net/http" discoveryv1beta1 "k8s.io/api/discovery/v1beta1" scheme "k8s.io/client-go/kubernetes/scheme" rest "k8s.io/client-go/rest" ) type DiscoveryV1beta1Interface interface { RESTClient() rest.Interface EndpointSlicesGetter } // DiscoveryV1beta1Client is used to interact with features provided by the discovery.k8s.io group. type DiscoveryV1beta1Client struct { restClient rest.Interface } func (c *DiscoveryV1beta1Client) EndpointSlices(namespace string) EndpointSliceInterface { return newEndpointSlices(c, namespace) } // NewForConfig creates a new DiscoveryV1beta1Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). func NewForConfig(c *rest.Config) (*DiscoveryV1beta1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err } httpClient, err := rest.HTTPClientFor(&config) if err != nil { return nil, err } return NewForConfigAndClient(&config, httpClient) } // NewForConfigAndClient creates a new DiscoveryV1beta1Client for the given config and http client. // Note the http client provided takes precedence over the configured transport values. func NewForConfigAndClient(c *rest.Config, h *http.Client) (*DiscoveryV1beta1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err } client, err := rest.RESTClientForConfigAndClient(&config, h) if err != nil { return nil, err } return &DiscoveryV1beta1Client{client}, nil } // NewForConfigOrDie creates a new DiscoveryV1beta1Client for the given config and // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *DiscoveryV1beta1Client { client, err := NewForConfig(c) if err != nil { panic(err) } return client } // New creates a new DiscoveryV1beta1Client for the given RESTClient. func New(c rest.Interface) *DiscoveryV1beta1Client { return &DiscoveryV1beta1Client{c} } func setConfigDefaults(config *rest.Config) error { gv := discoveryv1beta1.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() if config.UserAgent == "" { config.UserAgent = rest.DefaultKubernetesUserAgent() } return nil } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *DiscoveryV1beta1Client) RESTClient() rest.Interface { if c == nil { return nil } return c.restClient }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/generated_expansion.go
vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/generated_expansion.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package v1beta1 type EndpointSliceExpansion interface{}
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/doc.go
vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/doc.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated typed clients. package v1beta1
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/fake_discovery_client.go
vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/fake_discovery_client.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( v1beta1 "k8s.io/client-go/kubernetes/typed/discovery/v1beta1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" ) type FakeDiscoveryV1beta1 struct { *testing.Fake } func (c *FakeDiscoveryV1beta1) EndpointSlices(namespace string) v1beta1.EndpointSliceInterface { return newFakeEndpointSlices(c, namespace) } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeDiscoveryV1beta1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/fake_endpointslice.go
vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/fake_endpointslice.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( v1beta1 "k8s.io/api/discovery/v1beta1" discoveryv1beta1 "k8s.io/client-go/applyconfigurations/discovery/v1beta1" gentype "k8s.io/client-go/gentype" typeddiscoveryv1beta1 "k8s.io/client-go/kubernetes/typed/discovery/v1beta1" ) // fakeEndpointSlices implements EndpointSliceInterface type fakeEndpointSlices struct { *gentype.FakeClientWithListAndApply[*v1beta1.EndpointSlice, *v1beta1.EndpointSliceList, *discoveryv1beta1.EndpointSliceApplyConfiguration] Fake *FakeDiscoveryV1beta1 } func newFakeEndpointSlices(fake *FakeDiscoveryV1beta1, namespace string) typeddiscoveryv1beta1.EndpointSliceInterface { return &fakeEndpointSlices{ gentype.NewFakeClientWithListAndApply[*v1beta1.EndpointSlice, *v1beta1.EndpointSliceList, *discoveryv1beta1.EndpointSliceApplyConfiguration]( fake.Fake, namespace, v1beta1.SchemeGroupVersion.WithResource("endpointslices"), v1beta1.SchemeGroupVersion.WithKind("EndpointSlice"), func() *v1beta1.EndpointSlice { return &v1beta1.EndpointSlice{} }, func() *v1beta1.EndpointSliceList { return &v1beta1.EndpointSliceList{} }, func(dst, src *v1beta1.EndpointSliceList) { dst.ListMeta = src.ListMeta }, func(list *v1beta1.EndpointSliceList) []*v1beta1.EndpointSlice { return gentype.ToPointerSlice(list.Items) }, func(list *v1beta1.EndpointSliceList, items []*v1beta1.EndpointSlice) { list.Items = gentype.FromPointerSlice(items) }, ), fake, } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/doc.go
vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/doc.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. // Package fake has the automatically generated clients. package fake
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/storage_client.go
vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/storage_client.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package v1alpha1 import ( http "net/http" storagev1alpha1 "k8s.io/api/storage/v1alpha1" scheme "k8s.io/client-go/kubernetes/scheme" rest "k8s.io/client-go/rest" ) type StorageV1alpha1Interface interface { RESTClient() rest.Interface CSIStorageCapacitiesGetter VolumeAttachmentsGetter VolumeAttributesClassesGetter } // StorageV1alpha1Client is used to interact with features provided by the storage.k8s.io group. type StorageV1alpha1Client struct { restClient rest.Interface } func (c *StorageV1alpha1Client) CSIStorageCapacities(namespace string) CSIStorageCapacityInterface { return newCSIStorageCapacities(c, namespace) } func (c *StorageV1alpha1Client) VolumeAttachments() VolumeAttachmentInterface { return newVolumeAttachments(c) } func (c *StorageV1alpha1Client) VolumeAttributesClasses() VolumeAttributesClassInterface { return newVolumeAttributesClasses(c) } // NewForConfig creates a new StorageV1alpha1Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). func NewForConfig(c *rest.Config) (*StorageV1alpha1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err } httpClient, err := rest.HTTPClientFor(&config) if err != nil { return nil, err } return NewForConfigAndClient(&config, httpClient) } // NewForConfigAndClient creates a new StorageV1alpha1Client for the given config and http client. // Note the http client provided takes precedence over the configured transport values. func NewForConfigAndClient(c *rest.Config, h *http.Client) (*StorageV1alpha1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err } client, err := rest.RESTClientForConfigAndClient(&config, h) if err != nil { return nil, err } return &StorageV1alpha1Client{client}, nil } // NewForConfigOrDie creates a new StorageV1alpha1Client for the given config and // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *StorageV1alpha1Client { client, err := NewForConfig(c) if err != nil { panic(err) } return client } // New creates a new StorageV1alpha1Client for the given RESTClient. func New(c rest.Interface) *StorageV1alpha1Client { return &StorageV1alpha1Client{c} } func setConfigDefaults(config *rest.Config) error { gv := storagev1alpha1.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() if config.UserAgent == "" { config.UserAgent = rest.DefaultKubernetesUserAgent() } return nil } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *StorageV1alpha1Client) RESTClient() rest.Interface { if c == nil { return nil } return c.restClient }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/volumeattachment.go
vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/volumeattachment.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package v1alpha1 import ( context "context" storagev1alpha1 "k8s.io/api/storage/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" applyconfigurationsstoragev1alpha1 "k8s.io/client-go/applyconfigurations/storage/v1alpha1" gentype "k8s.io/client-go/gentype" scheme "k8s.io/client-go/kubernetes/scheme" ) // VolumeAttachmentsGetter has a method to return a VolumeAttachmentInterface. // A group's client should implement this interface. type VolumeAttachmentsGetter interface { VolumeAttachments() VolumeAttachmentInterface } // VolumeAttachmentInterface has methods to work with VolumeAttachment resources. type VolumeAttachmentInterface interface { Create(ctx context.Context, volumeAttachment *storagev1alpha1.VolumeAttachment, opts v1.CreateOptions) (*storagev1alpha1.VolumeAttachment, error) Update(ctx context.Context, volumeAttachment *storagev1alpha1.VolumeAttachment, opts v1.UpdateOptions) (*storagev1alpha1.VolumeAttachment, error) // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, volumeAttachment *storagev1alpha1.VolumeAttachment, opts v1.UpdateOptions) (*storagev1alpha1.VolumeAttachment, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error Get(ctx context.Context, name string, opts v1.GetOptions) (*storagev1alpha1.VolumeAttachment, error) List(ctx context.Context, opts v1.ListOptions) (*storagev1alpha1.VolumeAttachmentList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *storagev1alpha1.VolumeAttachment, err error) Apply(ctx context.Context, volumeAttachment *applyconfigurationsstoragev1alpha1.VolumeAttachmentApplyConfiguration, opts v1.ApplyOptions) (result *storagev1alpha1.VolumeAttachment, err error) // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, volumeAttachment *applyconfigurationsstoragev1alpha1.VolumeAttachmentApplyConfiguration, opts v1.ApplyOptions) (result *storagev1alpha1.VolumeAttachment, err error) VolumeAttachmentExpansion } // volumeAttachments implements VolumeAttachmentInterface type volumeAttachments struct { *gentype.ClientWithListAndApply[*storagev1alpha1.VolumeAttachment, *storagev1alpha1.VolumeAttachmentList, *applyconfigurationsstoragev1alpha1.VolumeAttachmentApplyConfiguration] } // newVolumeAttachments returns a VolumeAttachments func newVolumeAttachments(c *StorageV1alpha1Client) *volumeAttachments { return &volumeAttachments{ gentype.NewClientWithListAndApply[*storagev1alpha1.VolumeAttachment, *storagev1alpha1.VolumeAttachmentList, *applyconfigurationsstoragev1alpha1.VolumeAttachmentApplyConfiguration]( "volumeattachments", c.RESTClient(), scheme.ParameterCodec, "", func() *storagev1alpha1.VolumeAttachment { return &storagev1alpha1.VolumeAttachment{} }, func() *storagev1alpha1.VolumeAttachmentList { return &storagev1alpha1.VolumeAttachmentList{} }, gentype.PrefersProtobuf[*storagev1alpha1.VolumeAttachment](), ), } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/generated_expansion.go
vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/generated_expansion.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package v1alpha1 type CSIStorageCapacityExpansion interface{} type VolumeAttachmentExpansion interface{} type VolumeAttributesClassExpansion interface{}
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/volumeattributesclass.go
vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/volumeattributesclass.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package v1alpha1 import ( context "context" storagev1alpha1 "k8s.io/api/storage/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" applyconfigurationsstoragev1alpha1 "k8s.io/client-go/applyconfigurations/storage/v1alpha1" gentype "k8s.io/client-go/gentype" scheme "k8s.io/client-go/kubernetes/scheme" ) // VolumeAttributesClassesGetter has a method to return a VolumeAttributesClassInterface. // A group's client should implement this interface. type VolumeAttributesClassesGetter interface { VolumeAttributesClasses() VolumeAttributesClassInterface } // VolumeAttributesClassInterface has methods to work with VolumeAttributesClass resources. type VolumeAttributesClassInterface interface { Create(ctx context.Context, volumeAttributesClass *storagev1alpha1.VolumeAttributesClass, opts v1.CreateOptions) (*storagev1alpha1.VolumeAttributesClass, error) Update(ctx context.Context, volumeAttributesClass *storagev1alpha1.VolumeAttributesClass, opts v1.UpdateOptions) (*storagev1alpha1.VolumeAttributesClass, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error Get(ctx context.Context, name string, opts v1.GetOptions) (*storagev1alpha1.VolumeAttributesClass, error) List(ctx context.Context, opts v1.ListOptions) (*storagev1alpha1.VolumeAttributesClassList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *storagev1alpha1.VolumeAttributesClass, err error) Apply(ctx context.Context, volumeAttributesClass *applyconfigurationsstoragev1alpha1.VolumeAttributesClassApplyConfiguration, opts v1.ApplyOptions) (result *storagev1alpha1.VolumeAttributesClass, err error) VolumeAttributesClassExpansion } // volumeAttributesClasses implements VolumeAttributesClassInterface type volumeAttributesClasses struct { *gentype.ClientWithListAndApply[*storagev1alpha1.VolumeAttributesClass, *storagev1alpha1.VolumeAttributesClassList, *applyconfigurationsstoragev1alpha1.VolumeAttributesClassApplyConfiguration] } // newVolumeAttributesClasses returns a VolumeAttributesClasses func newVolumeAttributesClasses(c *StorageV1alpha1Client) *volumeAttributesClasses { return &volumeAttributesClasses{ gentype.NewClientWithListAndApply[*storagev1alpha1.VolumeAttributesClass, *storagev1alpha1.VolumeAttributesClassList, *applyconfigurationsstoragev1alpha1.VolumeAttributesClassApplyConfiguration]( "volumeattributesclasses", c.RESTClient(), scheme.ParameterCodec, "", func() *storagev1alpha1.VolumeAttributesClass { return &storagev1alpha1.VolumeAttributesClass{} }, func() *storagev1alpha1.VolumeAttributesClassList { return &storagev1alpha1.VolumeAttributesClassList{} }, gentype.PrefersProtobuf[*storagev1alpha1.VolumeAttributesClass](), ), } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/doc.go
vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/doc.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated typed clients. package v1alpha1
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/csistoragecapacity.go
vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/csistoragecapacity.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package v1alpha1 import ( context "context" storagev1alpha1 "k8s.io/api/storage/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" applyconfigurationsstoragev1alpha1 "k8s.io/client-go/applyconfigurations/storage/v1alpha1" gentype "k8s.io/client-go/gentype" scheme "k8s.io/client-go/kubernetes/scheme" ) // CSIStorageCapacitiesGetter has a method to return a CSIStorageCapacityInterface. // A group's client should implement this interface. type CSIStorageCapacitiesGetter interface { CSIStorageCapacities(namespace string) CSIStorageCapacityInterface } // CSIStorageCapacityInterface has methods to work with CSIStorageCapacity resources. type CSIStorageCapacityInterface interface { Create(ctx context.Context, cSIStorageCapacity *storagev1alpha1.CSIStorageCapacity, opts v1.CreateOptions) (*storagev1alpha1.CSIStorageCapacity, error) Update(ctx context.Context, cSIStorageCapacity *storagev1alpha1.CSIStorageCapacity, opts v1.UpdateOptions) (*storagev1alpha1.CSIStorageCapacity, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error Get(ctx context.Context, name string, opts v1.GetOptions) (*storagev1alpha1.CSIStorageCapacity, error) List(ctx context.Context, opts v1.ListOptions) (*storagev1alpha1.CSIStorageCapacityList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *storagev1alpha1.CSIStorageCapacity, err error) Apply(ctx context.Context, cSIStorageCapacity *applyconfigurationsstoragev1alpha1.CSIStorageCapacityApplyConfiguration, opts v1.ApplyOptions) (result *storagev1alpha1.CSIStorageCapacity, err error) CSIStorageCapacityExpansion } // cSIStorageCapacities implements CSIStorageCapacityInterface type cSIStorageCapacities struct { *gentype.ClientWithListAndApply[*storagev1alpha1.CSIStorageCapacity, *storagev1alpha1.CSIStorageCapacityList, *applyconfigurationsstoragev1alpha1.CSIStorageCapacityApplyConfiguration] } // newCSIStorageCapacities returns a CSIStorageCapacities func newCSIStorageCapacities(c *StorageV1alpha1Client, namespace string) *cSIStorageCapacities { return &cSIStorageCapacities{ gentype.NewClientWithListAndApply[*storagev1alpha1.CSIStorageCapacity, *storagev1alpha1.CSIStorageCapacityList, *applyconfigurationsstoragev1alpha1.CSIStorageCapacityApplyConfiguration]( "csistoragecapacities", c.RESTClient(), scheme.ParameterCodec, namespace, func() *storagev1alpha1.CSIStorageCapacity { return &storagev1alpha1.CSIStorageCapacity{} }, func() *storagev1alpha1.CSIStorageCapacityList { return &storagev1alpha1.CSIStorageCapacityList{} }, gentype.PrefersProtobuf[*storagev1alpha1.CSIStorageCapacity](), ), } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/fake_volumeattributesclass.go
vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/fake_volumeattributesclass.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( v1alpha1 "k8s.io/api/storage/v1alpha1" storagev1alpha1 "k8s.io/client-go/applyconfigurations/storage/v1alpha1" gentype "k8s.io/client-go/gentype" typedstoragev1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1" ) // fakeVolumeAttributesClasses implements VolumeAttributesClassInterface type fakeVolumeAttributesClasses struct { *gentype.FakeClientWithListAndApply[*v1alpha1.VolumeAttributesClass, *v1alpha1.VolumeAttributesClassList, *storagev1alpha1.VolumeAttributesClassApplyConfiguration] Fake *FakeStorageV1alpha1 } func newFakeVolumeAttributesClasses(fake *FakeStorageV1alpha1) typedstoragev1alpha1.VolumeAttributesClassInterface { return &fakeVolumeAttributesClasses{ gentype.NewFakeClientWithListAndApply[*v1alpha1.VolumeAttributesClass, *v1alpha1.VolumeAttributesClassList, *storagev1alpha1.VolumeAttributesClassApplyConfiguration]( fake.Fake, "", v1alpha1.SchemeGroupVersion.WithResource("volumeattributesclasses"), v1alpha1.SchemeGroupVersion.WithKind("VolumeAttributesClass"), func() *v1alpha1.VolumeAttributesClass { return &v1alpha1.VolumeAttributesClass{} }, func() *v1alpha1.VolumeAttributesClassList { return &v1alpha1.VolumeAttributesClassList{} }, func(dst, src *v1alpha1.VolumeAttributesClassList) { dst.ListMeta = src.ListMeta }, func(list *v1alpha1.VolumeAttributesClassList) []*v1alpha1.VolumeAttributesClass { return gentype.ToPointerSlice(list.Items) }, func(list *v1alpha1.VolumeAttributesClassList, items []*v1alpha1.VolumeAttributesClass) { list.Items = gentype.FromPointerSlice(items) }, ), fake, } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/fake_volumeattachment.go
vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/fake_volumeattachment.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( v1alpha1 "k8s.io/api/storage/v1alpha1" storagev1alpha1 "k8s.io/client-go/applyconfigurations/storage/v1alpha1" gentype "k8s.io/client-go/gentype" typedstoragev1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1" ) // fakeVolumeAttachments implements VolumeAttachmentInterface type fakeVolumeAttachments struct { *gentype.FakeClientWithListAndApply[*v1alpha1.VolumeAttachment, *v1alpha1.VolumeAttachmentList, *storagev1alpha1.VolumeAttachmentApplyConfiguration] Fake *FakeStorageV1alpha1 } func newFakeVolumeAttachments(fake *FakeStorageV1alpha1) typedstoragev1alpha1.VolumeAttachmentInterface { return &fakeVolumeAttachments{ gentype.NewFakeClientWithListAndApply[*v1alpha1.VolumeAttachment, *v1alpha1.VolumeAttachmentList, *storagev1alpha1.VolumeAttachmentApplyConfiguration]( fake.Fake, "", v1alpha1.SchemeGroupVersion.WithResource("volumeattachments"), v1alpha1.SchemeGroupVersion.WithKind("VolumeAttachment"), func() *v1alpha1.VolumeAttachment { return &v1alpha1.VolumeAttachment{} }, func() *v1alpha1.VolumeAttachmentList { return &v1alpha1.VolumeAttachmentList{} }, func(dst, src *v1alpha1.VolumeAttachmentList) { dst.ListMeta = src.ListMeta }, func(list *v1alpha1.VolumeAttachmentList) []*v1alpha1.VolumeAttachment { return gentype.ToPointerSlice(list.Items) }, func(list *v1alpha1.VolumeAttachmentList, items []*v1alpha1.VolumeAttachment) { list.Items = gentype.FromPointerSlice(items) }, ), fake, } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/fake_csistoragecapacity.go
vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/fake_csistoragecapacity.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( v1alpha1 "k8s.io/api/storage/v1alpha1" storagev1alpha1 "k8s.io/client-go/applyconfigurations/storage/v1alpha1" gentype "k8s.io/client-go/gentype" typedstoragev1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1" ) // fakeCSIStorageCapacities implements CSIStorageCapacityInterface type fakeCSIStorageCapacities struct { *gentype.FakeClientWithListAndApply[*v1alpha1.CSIStorageCapacity, *v1alpha1.CSIStorageCapacityList, *storagev1alpha1.CSIStorageCapacityApplyConfiguration] Fake *FakeStorageV1alpha1 } func newFakeCSIStorageCapacities(fake *FakeStorageV1alpha1, namespace string) typedstoragev1alpha1.CSIStorageCapacityInterface { return &fakeCSIStorageCapacities{ gentype.NewFakeClientWithListAndApply[*v1alpha1.CSIStorageCapacity, *v1alpha1.CSIStorageCapacityList, *storagev1alpha1.CSIStorageCapacityApplyConfiguration]( fake.Fake, namespace, v1alpha1.SchemeGroupVersion.WithResource("csistoragecapacities"), v1alpha1.SchemeGroupVersion.WithKind("CSIStorageCapacity"), func() *v1alpha1.CSIStorageCapacity { return &v1alpha1.CSIStorageCapacity{} }, func() *v1alpha1.CSIStorageCapacityList { return &v1alpha1.CSIStorageCapacityList{} }, func(dst, src *v1alpha1.CSIStorageCapacityList) { dst.ListMeta = src.ListMeta }, func(list *v1alpha1.CSIStorageCapacityList) []*v1alpha1.CSIStorageCapacity { return gentype.ToPointerSlice(list.Items) }, func(list *v1alpha1.CSIStorageCapacityList, items []*v1alpha1.CSIStorageCapacity) { list.Items = gentype.FromPointerSlice(items) }, ), fake, } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/fake_storage_client.go
vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/fake_storage_client.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( v1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" ) type FakeStorageV1alpha1 struct { *testing.Fake } func (c *FakeStorageV1alpha1) CSIStorageCapacities(namespace string) v1alpha1.CSIStorageCapacityInterface { return newFakeCSIStorageCapacities(c, namespace) } func (c *FakeStorageV1alpha1) VolumeAttachments() v1alpha1.VolumeAttachmentInterface { return newFakeVolumeAttachments(c) } func (c *FakeStorageV1alpha1) VolumeAttributesClasses() v1alpha1.VolumeAttributesClassInterface { return newFakeVolumeAttributesClasses(c) } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeStorageV1alpha1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/doc.go
vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/doc.go
/* Copyright The Kubernetes 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. */ // Code generated by client-gen. DO NOT EDIT. // Package fake has the automatically generated clients. package fake
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false