From a3d3eb0cc90228d5770d8a70badb341d5d02818d Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Thu, 10 Nov 2022 18:22:07 +0100 Subject: [PATCH] Revert "Remove references to openstack and cinder" This reverts commit 9bbf01bae93600d3314bce0acbff1f3a0a42e74b. Kubernetes-commit: 5b284a50b78cb7d68b12825f5c0cfa29503c1577 --- examples/README.md | 1 + .../create-update-delete-deployment/main.go | 1 + .../main.go | 1 + .../in-cluster-client-configuration/main.go | 1 + .../main.go | 1 + .../client/auth/openstack/openstack_stub.go | 36 +++++++++++++++++++ plugin/pkg/client/auth/plugins_providers.go | 1 + 7 files changed, 42 insertions(+) create mode 100644 plugin/pkg/client/auth/openstack/openstack_stub.go diff --git a/examples/README.md b/examples/README.md index 0ec0e13d6a..984aba00b5 100644 --- a/examples/README.md +++ b/examples/README.md @@ -19,6 +19,7 @@ Or you can load specific auth plugins: import _ "k8s.io/client-go/plugin/pkg/client/auth/azure" import _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" import _ "k8s.io/client-go/plugin/pkg/client/auth/oidc" +import _ "k8s.io/client-go/plugin/pkg/client/auth/openstack" ``` ### Configuration diff --git a/examples/create-update-delete-deployment/main.go b/examples/create-update-delete-deployment/main.go index dae3bc95f1..224dbc1251 100644 --- a/examples/create-update-delete-deployment/main.go +++ b/examples/create-update-delete-deployment/main.go @@ -40,6 +40,7 @@ import ( // _ "k8s.io/client-go/plugin/pkg/client/auth/azure" // _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" // _ "k8s.io/client-go/plugin/pkg/client/auth/oidc" + // _ "k8s.io/client-go/plugin/pkg/client/auth/openstack" ) func main() { diff --git a/examples/dynamic-create-update-delete-deployment/main.go b/examples/dynamic-create-update-delete-deployment/main.go index cc6b122670..b7439e482d 100644 --- a/examples/dynamic-create-update-delete-deployment/main.go +++ b/examples/dynamic-create-update-delete-deployment/main.go @@ -41,6 +41,7 @@ import ( // _ "k8s.io/client-go/plugin/pkg/client/auth/azure" // _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" // _ "k8s.io/client-go/plugin/pkg/client/auth/oidc" + // _ "k8s.io/client-go/plugin/pkg/client/auth/openstack" ) func main() { diff --git a/examples/in-cluster-client-configuration/main.go b/examples/in-cluster-client-configuration/main.go index b583e33733..a8c71612e3 100644 --- a/examples/in-cluster-client-configuration/main.go +++ b/examples/in-cluster-client-configuration/main.go @@ -34,6 +34,7 @@ import ( // _ "k8s.io/client-go/plugin/pkg/client/auth/azure" // _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" // _ "k8s.io/client-go/plugin/pkg/client/auth/oidc" + // _ "k8s.io/client-go/plugin/pkg/client/auth/openstack" ) func main() { diff --git a/examples/out-of-cluster-client-configuration/main.go b/examples/out-of-cluster-client-configuration/main.go index 7698e13218..cf00d48094 100644 --- a/examples/out-of-cluster-client-configuration/main.go +++ b/examples/out-of-cluster-client-configuration/main.go @@ -37,6 +37,7 @@ import ( // _ "k8s.io/client-go/plugin/pkg/client/auth/azure" // _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" // _ "k8s.io/client-go/plugin/pkg/client/auth/oidc" + // _ "k8s.io/client-go/plugin/pkg/client/auth/openstack" ) func main() { diff --git a/plugin/pkg/client/auth/openstack/openstack_stub.go b/plugin/pkg/client/auth/openstack/openstack_stub.go new file mode 100644 index 0000000000..6e404beda2 --- /dev/null +++ b/plugin/pkg/client/auth/openstack/openstack_stub.go @@ -0,0 +1,36 @@ +/* +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 openstack + +import ( + "errors" + + "k8s.io/client-go/rest" + "k8s.io/klog/v2" +) + +func init() { + if err := rest.RegisterAuthProviderPlugin("openstack", newOpenstackAuthProvider); err != nil { + klog.Fatalf("Failed to register openstack auth plugin: %s", err) + } +} + +func newOpenstackAuthProvider(_ string, _ map[string]string, _ rest.AuthProviderConfigPersister) (rest.AuthProvider, error) { + return nil, errors.New(`The openstack auth plugin has been removed. +Please use the "client-keystone-auth" kubectl/client-go credential plugin instead. +See https://github.com/kubernetes/cloud-provider-openstack/blob/master/docs/using-client-keystone-auth.md for further details`) +} diff --git a/plugin/pkg/client/auth/plugins_providers.go b/plugin/pkg/client/auth/plugins_providers.go index 3f0688774e..ebfbd715c0 100644 --- a/plugin/pkg/client/auth/plugins_providers.go +++ b/plugin/pkg/client/auth/plugins_providers.go @@ -23,4 +23,5 @@ import ( // Initialize client auth plugins for cloud providers. _ "k8s.io/client-go/plugin/pkg/client/auth/azure" _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" + _ "k8s.io/client-go/plugin/pkg/client/auth/openstack" )