mirror of https://github.com/k3s-io/k3s
Merge pull request #29138 from kshafiee/pr-27789
Automatic merge from submit-queue federation: Adding secret API Adding secret API to federation-apiserver and updating the federation client to include secretspull/6/head
commit
1cd07a276c
|
@ -63,6 +63,8 @@ func AddToScheme(scheme *runtime.Scheme) {
|
|||
&api.NamespaceList{},
|
||||
&api.ListOptions{},
|
||||
&api.DeleteOptions{},
|
||||
&api.Secret{},
|
||||
&api.SecretList{},
|
||||
)
|
||||
|
||||
// Register Unversioned types under their own special group
|
||||
|
|
|
@ -42,6 +42,10 @@ func addConversionFuncs(scheme *runtime.Scheme) {
|
|||
v1.Convert_api_ObjectReference_To_v1_ObjectReference,
|
||||
v1.Convert_v1_OwnerReference_To_api_OwnerReference,
|
||||
v1.Convert_api_OwnerReference_To_v1_OwnerReference,
|
||||
v1.Convert_v1_Secret_To_api_Secret,
|
||||
v1.Convert_api_Secret_To_v1_Secret,
|
||||
v1.Convert_v1_SecretList_To_api_SecretList,
|
||||
v1.Convert_api_SecretList_To_v1_SecretList,
|
||||
v1.Convert_v1_Service_To_api_Service,
|
||||
v1.Convert_api_Service_To_v1_Service,
|
||||
v1.Convert_v1_ServiceList_To_api_ServiceList,
|
||||
|
|
|
@ -23,6 +23,7 @@ import (
|
|||
|
||||
func addDefaultingFuncs(scheme *runtime.Scheme) {
|
||||
scheme.AddDefaultingFuncs(
|
||||
v1.SetDefaults_Secret,
|
||||
v1.SetDefaults_ServiceSpec,
|
||||
v1.SetDefaults_NamespaceStatus,
|
||||
)
|
||||
|
|
|
@ -45,6 +45,8 @@ func addKnownTypes(scheme *runtime.Scheme) {
|
|||
&v1.ServiceList{},
|
||||
&v1.ListOptions{},
|
||||
&v1.DeleteOptions{},
|
||||
&v1.Secret{},
|
||||
&v1.SecretList{},
|
||||
)
|
||||
|
||||
// Add common types
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service,api/Namespace,extensions/ReplicaSet] --input=[../../federation/apis/federation/,api/,extensions/]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service,api/Namespace,extensions/ReplicaSet,api/Secret] --input=[../../federation/apis/federation/,api/,extensions/]
|
||||
|
||||
// This package has the automatically generated clientset.
|
||||
package federation_internalclientset
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service,api/Namespace,extensions/ReplicaSet] --input=[../../federation/apis/federation/,api/,extensions/]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service,api/Namespace,extensions/ReplicaSet,api/Secret] --input=[../../federation/apis/federation/,api/,extensions/]
|
||||
|
||||
// This package has the automatically generated fake clientset.
|
||||
package fake
|
||||
|
|
|
@ -25,6 +25,7 @@ import (
|
|||
type CoreInterface interface {
|
||||
GetRESTClient() *restclient.RESTClient
|
||||
NamespacesGetter
|
||||
SecretsGetter
|
||||
ServicesGetter
|
||||
}
|
||||
|
||||
|
@ -37,6 +38,10 @@ func (c *CoreClient) Namespaces() NamespaceInterface {
|
|||
return newNamespaces(c)
|
||||
}
|
||||
|
||||
func (c *CoreClient) Secrets(namespace string) SecretInterface {
|
||||
return newSecrets(c, namespace)
|
||||
}
|
||||
|
||||
func (c *CoreClient) Services(namespace string) ServiceInterface {
|
||||
return newServices(c, namespace)
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service,api/Namespace,extensions/ReplicaSet] --input=[../../federation/apis/federation/,api/,extensions/]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service,api/Namespace,extensions/ReplicaSet,api/Secret] --input=[../../federation/apis/federation/,api/,extensions/]
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package unversioned
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service,api/Namespace,extensions/ReplicaSet] --input=[../../federation/apis/federation/,api/,extensions/]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service,api/Namespace,extensions/ReplicaSet,api/Secret] --input=[../../federation/apis/federation/,api/,extensions/]
|
||||
|
||||
// Package fake has the automatically generated clients.
|
||||
package fake
|
||||
|
|
|
@ -30,6 +30,10 @@ func (c *FakeCore) Namespaces() unversioned.NamespaceInterface {
|
|||
return &FakeNamespaces{c}
|
||||
}
|
||||
|
||||
func (c *FakeCore) Secrets(namespace string) unversioned.SecretInterface {
|
||||
return &FakeSecrets{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeCore) Services(namespace string) unversioned.ServiceInterface {
|
||||
return &FakeServices{c, namespace}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
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 fake
|
||||
|
||||
import (
|
||||
api "k8s.io/kubernetes/pkg/api"
|
||||
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
|
||||
core "k8s.io/kubernetes/pkg/client/testing/core"
|
||||
labels "k8s.io/kubernetes/pkg/labels"
|
||||
watch "k8s.io/kubernetes/pkg/watch"
|
||||
)
|
||||
|
||||
// FakeSecrets implements SecretInterface
|
||||
type FakeSecrets struct {
|
||||
Fake *FakeCore
|
||||
ns string
|
||||
}
|
||||
|
||||
var secretsResource = unversioned.GroupVersionResource{Group: "", Version: "", Resource: "secrets"}
|
||||
|
||||
func (c *FakeSecrets) Create(secret *api.Secret) (result *api.Secret, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewCreateAction(secretsResource, c.ns, secret), &api.Secret{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*api.Secret), err
|
||||
}
|
||||
|
||||
func (c *FakeSecrets) Update(secret *api.Secret) (result *api.Secret, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewUpdateAction(secretsResource, c.ns, secret), &api.Secret{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*api.Secret), err
|
||||
}
|
||||
|
||||
func (c *FakeSecrets) Delete(name string, options *api.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(core.NewDeleteAction(secretsResource, c.ns, name), &api.Secret{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakeSecrets) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
||||
action := core.NewDeleteCollectionAction(secretsResource, c.ns, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &api.SecretList{})
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakeSecrets) Get(name string) (result *api.Secret, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewGetAction(secretsResource, c.ns, name), &api.Secret{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*api.Secret), err
|
||||
}
|
||||
|
||||
func (c *FakeSecrets) List(opts api.ListOptions) (result *api.SecretList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewListAction(secretsResource, c.ns, opts), &api.SecretList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label := opts.LabelSelector
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &api.SecretList{}
|
||||
for _, item := range obj.(*api.SecretList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested secrets.
|
||||
func (c *FakeSecrets) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(core.NewWatchAction(secretsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched secret.
|
||||
func (c *FakeSecrets) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *api.Secret, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewPatchSubresourceAction(secretsResource, c.ns, name, data, subresources...), &api.Secret{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*api.Secret), err
|
||||
}
|
|
@ -16,4 +16,6 @@ limitations under the License.
|
|||
|
||||
package unversioned
|
||||
|
||||
type SecretExpansion interface{}
|
||||
|
||||
type ServiceExpansion interface{}
|
||||
|
|
|
@ -0,0 +1,150 @@
|
|||
/*
|
||||
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 unversioned
|
||||
|
||||
import (
|
||||
api "k8s.io/kubernetes/pkg/api"
|
||||
watch "k8s.io/kubernetes/pkg/watch"
|
||||
)
|
||||
|
||||
// SecretsGetter has a method to return a SecretInterface.
|
||||
// A group's client should implement this interface.
|
||||
type SecretsGetter interface {
|
||||
Secrets(namespace string) SecretInterface
|
||||
}
|
||||
|
||||
// SecretInterface has methods to work with Secret resources.
|
||||
type SecretInterface interface {
|
||||
Create(*api.Secret) (*api.Secret, error)
|
||||
Update(*api.Secret) (*api.Secret, error)
|
||||
Delete(name string, options *api.DeleteOptions) error
|
||||
DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error
|
||||
Get(name string) (*api.Secret, error)
|
||||
List(opts api.ListOptions) (*api.SecretList, error)
|
||||
Watch(opts api.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *api.Secret, err error)
|
||||
SecretExpansion
|
||||
}
|
||||
|
||||
// secrets implements SecretInterface
|
||||
type secrets struct {
|
||||
client *CoreClient
|
||||
ns string
|
||||
}
|
||||
|
||||
// newSecrets returns a Secrets
|
||||
func newSecrets(c *CoreClient, namespace string) *secrets {
|
||||
return &secrets{
|
||||
client: c,
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Create takes the representation of a secret and creates it. Returns the server's representation of the secret, and an error, if there is any.
|
||||
func (c *secrets) Create(secret *api.Secret) (result *api.Secret, err error) {
|
||||
result = &api.Secret{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("secrets").
|
||||
Body(secret).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a secret and updates it. Returns the server's representation of the secret, and an error, if there is any.
|
||||
func (c *secrets) Update(secret *api.Secret) (result *api.Secret, err error) {
|
||||
result = &api.Secret{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("secrets").
|
||||
Name(secret.Name).
|
||||
Body(secret).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the secret and deletes it. Returns an error if one occurs.
|
||||
func (c *secrets) Delete(name string, options *api.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("secrets").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *secrets) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("secrets").
|
||||
VersionedParams(&listOptions, api.ParameterCodec).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Get takes name of the secret, and returns the corresponding secret object, and an error if there is any.
|
||||
func (c *secrets) Get(name string) (result *api.Secret, err error) {
|
||||
result = &api.Secret{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("secrets").
|
||||
Name(name).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Secrets that match those selectors.
|
||||
func (c *secrets) List(opts api.ListOptions) (result *api.SecretList, err error) {
|
||||
result = &api.SecretList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("secrets").
|
||||
VersionedParams(&opts, api.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested secrets.
|
||||
func (c *secrets) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||
return c.client.Get().
|
||||
Prefix("watch").
|
||||
Namespace(c.ns).
|
||||
Resource("secrets").
|
||||
VersionedParams(&opts, api.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched secret.
|
||||
func (c *secrets) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *api.Secret, err error) {
|
||||
result = &api.Secret{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("secrets").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service,api/Namespace,extensions/ReplicaSet] --input=[../../federation/apis/federation/,api/,extensions/]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service,api/Namespace,extensions/ReplicaSet,api/Secret] --input=[../../federation/apis/federation/,api/,extensions/]
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package unversioned
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service,api/Namespace,extensions/ReplicaSet] --input=[../../federation/apis/federation/,api/,extensions/]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service,api/Namespace,extensions/ReplicaSet,api/Secret] --input=[../../federation/apis/federation/,api/,extensions/]
|
||||
|
||||
// Package fake has the automatically generated clients.
|
||||
package fake
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service,api/Namespace,extensions/ReplicaSet] --input=[../../federation/apis/federation/,api/,extensions/]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service,api/Namespace,extensions/ReplicaSet,api/Secret] --input=[../../federation/apis/federation/,api/,extensions/]
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package unversioned
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service,api/Namespace,extensions/ReplicaSet] --input=[../../federation/apis/federation/,api/,extensions/]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service,api/Namespace,extensions/ReplicaSet,api/Secret] --input=[../../federation/apis/federation/,api/,extensions/]
|
||||
|
||||
// Package fake has the automatically generated clients.
|
||||
package fake
|
||||
|
|
|
@ -17,3 +17,5 @@ limitations under the License.
|
|||
package v1
|
||||
|
||||
type ServiceExpansion interface{}
|
||||
|
||||
type SecretExpansion interface{}
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_4 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service,api/v1/Namespace,extensions/v1beta1/ReplicaSet] --input=[../../federation/apis/federation/v1beta1,api/v1,extensions/v1beta1]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_4 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service,api/v1/Namespace,extensions/v1beta1/ReplicaSet,api/v1/Secret] --input=[../../federation/apis/federation/v1beta1,api/v1,extensions/v1beta1]
|
||||
|
||||
// This package has the automatically generated clientset.
|
||||
package federation_release_1_4
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_4 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service,api/v1/Namespace,extensions/v1beta1/ReplicaSet] --input=[../../federation/apis/federation/v1beta1,api/v1,extensions/v1beta1]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_4 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service,api/v1/Namespace,extensions/v1beta1/ReplicaSet,api/v1/Secret] --input=[../../federation/apis/federation/v1beta1,api/v1,extensions/v1beta1]
|
||||
|
||||
// This package has the automatically generated fake clientset.
|
||||
package fake
|
||||
|
|
|
@ -26,6 +26,7 @@ import (
|
|||
type CoreInterface interface {
|
||||
GetRESTClient() *restclient.RESTClient
|
||||
NamespacesGetter
|
||||
SecretsGetter
|
||||
ServicesGetter
|
||||
}
|
||||
|
||||
|
@ -38,6 +39,10 @@ func (c *CoreClient) Namespaces() NamespaceInterface {
|
|||
return newNamespaces(c)
|
||||
}
|
||||
|
||||
func (c *CoreClient) Secrets(namespace string) SecretInterface {
|
||||
return newSecrets(c, namespace)
|
||||
}
|
||||
|
||||
func (c *CoreClient) Services(namespace string) ServiceInterface {
|
||||
return newServices(c, namespace)
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_4 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service,api/v1/Namespace,extensions/v1beta1/ReplicaSet] --input=[../../federation/apis/federation/v1beta1,api/v1,extensions/v1beta1]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_4 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service,api/v1/Namespace,extensions/v1beta1/ReplicaSet,api/v1/Secret] --input=[../../federation/apis/federation/v1beta1,api/v1,extensions/v1beta1]
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v1
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_4 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service,api/v1/Namespace,extensions/v1beta1/ReplicaSet] --input=[../../federation/apis/federation/v1beta1,api/v1,extensions/v1beta1]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_4 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service,api/v1/Namespace,extensions/v1beta1/ReplicaSet,api/v1/Secret] --input=[../../federation/apis/federation/v1beta1,api/v1,extensions/v1beta1]
|
||||
|
||||
// Package fake has the automatically generated clients.
|
||||
package fake
|
||||
|
|
|
@ -30,6 +30,10 @@ func (c *FakeCore) Namespaces() v1.NamespaceInterface {
|
|||
return &FakeNamespaces{c}
|
||||
}
|
||||
|
||||
func (c *FakeCore) Secrets(namespace string) v1.SecretInterface {
|
||||
return &FakeSecrets{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeCore) Services(namespace string) v1.ServiceInterface {
|
||||
return &FakeServices{c, namespace}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
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 fake
|
||||
|
||||
import (
|
||||
api "k8s.io/kubernetes/pkg/api"
|
||||
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
|
||||
v1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
core "k8s.io/kubernetes/pkg/client/testing/core"
|
||||
labels "k8s.io/kubernetes/pkg/labels"
|
||||
watch "k8s.io/kubernetes/pkg/watch"
|
||||
)
|
||||
|
||||
// FakeSecrets implements SecretInterface
|
||||
type FakeSecrets struct {
|
||||
Fake *FakeCore
|
||||
ns string
|
||||
}
|
||||
|
||||
var secretsResource = unversioned.GroupVersionResource{Group: "", Version: "v1", Resource: "secrets"}
|
||||
|
||||
func (c *FakeSecrets) Create(secret *v1.Secret) (result *v1.Secret, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewCreateAction(secretsResource, c.ns, secret), &v1.Secret{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1.Secret), err
|
||||
}
|
||||
|
||||
func (c *FakeSecrets) Update(secret *v1.Secret) (result *v1.Secret, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewUpdateAction(secretsResource, c.ns, secret), &v1.Secret{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1.Secret), err
|
||||
}
|
||||
|
||||
func (c *FakeSecrets) Delete(name string, options *api.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(core.NewDeleteAction(secretsResource, c.ns, name), &v1.Secret{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakeSecrets) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
||||
action := core.NewDeleteCollectionAction(secretsResource, c.ns, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1.SecretList{})
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakeSecrets) Get(name string) (result *v1.Secret, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewGetAction(secretsResource, c.ns, name), &v1.Secret{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1.Secret), err
|
||||
}
|
||||
|
||||
func (c *FakeSecrets) List(opts api.ListOptions) (result *v1.SecretList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewListAction(secretsResource, c.ns, opts), &v1.SecretList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label := opts.LabelSelector
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1.SecretList{}
|
||||
for _, item := range obj.(*v1.SecretList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested secrets.
|
||||
func (c *FakeSecrets) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(core.NewWatchAction(secretsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched secret.
|
||||
func (c *FakeSecrets) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Secret, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(core.NewPatchSubresourceAction(secretsResource, c.ns, name, data, subresources...), &v1.Secret{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1.Secret), err
|
||||
}
|
|
@ -16,4 +16,6 @@ limitations under the License.
|
|||
|
||||
package v1
|
||||
|
||||
type SecretExpansion interface{}
|
||||
|
||||
type ServiceExpansion interface{}
|
||||
|
|
|
@ -0,0 +1,151 @@
|
|||
/*
|
||||
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 v1
|
||||
|
||||
import (
|
||||
api "k8s.io/kubernetes/pkg/api"
|
||||
v1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
watch "k8s.io/kubernetes/pkg/watch"
|
||||
)
|
||||
|
||||
// SecretsGetter has a method to return a SecretInterface.
|
||||
// A group's client should implement this interface.
|
||||
type SecretsGetter interface {
|
||||
Secrets(namespace string) SecretInterface
|
||||
}
|
||||
|
||||
// SecretInterface has methods to work with Secret resources.
|
||||
type SecretInterface interface {
|
||||
Create(*v1.Secret) (*v1.Secret, error)
|
||||
Update(*v1.Secret) (*v1.Secret, error)
|
||||
Delete(name string, options *api.DeleteOptions) error
|
||||
DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error
|
||||
Get(name string) (*v1.Secret, error)
|
||||
List(opts api.ListOptions) (*v1.SecretList, error)
|
||||
Watch(opts api.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Secret, err error)
|
||||
SecretExpansion
|
||||
}
|
||||
|
||||
// secrets implements SecretInterface
|
||||
type secrets struct {
|
||||
client *CoreClient
|
||||
ns string
|
||||
}
|
||||
|
||||
// newSecrets returns a Secrets
|
||||
func newSecrets(c *CoreClient, namespace string) *secrets {
|
||||
return &secrets{
|
||||
client: c,
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Create takes the representation of a secret and creates it. Returns the server's representation of the secret, and an error, if there is any.
|
||||
func (c *secrets) Create(secret *v1.Secret) (result *v1.Secret, err error) {
|
||||
result = &v1.Secret{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("secrets").
|
||||
Body(secret).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a secret and updates it. Returns the server's representation of the secret, and an error, if there is any.
|
||||
func (c *secrets) Update(secret *v1.Secret) (result *v1.Secret, err error) {
|
||||
result = &v1.Secret{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("secrets").
|
||||
Name(secret.Name).
|
||||
Body(secret).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the secret and deletes it. Returns an error if one occurs.
|
||||
func (c *secrets) Delete(name string, options *api.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("secrets").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *secrets) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("secrets").
|
||||
VersionedParams(&listOptions, api.ParameterCodec).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Get takes name of the secret, and returns the corresponding secret object, and an error if there is any.
|
||||
func (c *secrets) Get(name string) (result *v1.Secret, err error) {
|
||||
result = &v1.Secret{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("secrets").
|
||||
Name(name).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Secrets that match those selectors.
|
||||
func (c *secrets) List(opts api.ListOptions) (result *v1.SecretList, err error) {
|
||||
result = &v1.SecretList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("secrets").
|
||||
VersionedParams(&opts, api.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested secrets.
|
||||
func (c *secrets) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||
return c.client.Get().
|
||||
Prefix("watch").
|
||||
Namespace(c.ns).
|
||||
Resource("secrets").
|
||||
VersionedParams(&opts, api.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched secret.
|
||||
func (c *secrets) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Secret, err error) {
|
||||
result = &v1.Secret{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("secrets").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_4 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service,api/v1/Namespace,extensions/v1beta1/ReplicaSet] --input=[../../federation/apis/federation/v1beta1,api/v1,extensions/v1beta1]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_4 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service,api/v1/Namespace,extensions/v1beta1/ReplicaSet,api/v1/Secret] --input=[../../federation/apis/federation/v1beta1,api/v1,extensions/v1beta1]
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v1beta1
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_4 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service,api/v1/Namespace,extensions/v1beta1/ReplicaSet] --input=[../../federation/apis/federation/v1beta1,api/v1,extensions/v1beta1]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_4 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service,api/v1/Namespace,extensions/v1beta1/ReplicaSet,api/v1/Secret] --input=[../../federation/apis/federation/v1beta1,api/v1,extensions/v1beta1]
|
||||
|
||||
// Package fake has the automatically generated clients.
|
||||
package fake
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_4 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service,api/v1/Namespace,extensions/v1beta1/ReplicaSet] --input=[../../federation/apis/federation/v1beta1,api/v1,extensions/v1beta1]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_4 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service,api/v1/Namespace,extensions/v1beta1/ReplicaSet,api/v1/Secret] --input=[../../federation/apis/federation/v1beta1,api/v1,extensions/v1beta1]
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v1beta1
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_4 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service,api/v1/Namespace,extensions/v1beta1/ReplicaSet] --input=[../../federation/apis/federation/v1beta1,api/v1,extensions/v1beta1]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_4 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service,api/v1/Namespace,extensions/v1beta1/ReplicaSet,api/v1/Secret] --input=[../../federation/apis/federation/v1beta1,api/v1,extensions/v1beta1]
|
||||
|
||||
// Package fake has the automatically generated clients.
|
||||
package fake
|
||||
|
|
|
@ -28,13 +28,16 @@ import (
|
|||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/rest"
|
||||
namespaceetcd "k8s.io/kubernetes/pkg/registry/namespace/etcd"
|
||||
secretetcd "k8s.io/kubernetes/pkg/registry/secret/etcd"
|
||||
serviceetcd "k8s.io/kubernetes/pkg/registry/service/etcd"
|
||||
)
|
||||
|
||||
func installCoreAPIs(s *genericoptions.ServerRunOptions, g *genericapiserver.GenericAPIServer, f genericapiserver.StorageFactory) {
|
||||
serviceStore, serviceStatusStore := serviceetcd.NewREST(createRESTOptionsOrDie(s, g, f, api.Resource("service")))
|
||||
namespaceStore, namespaceStatusStore, _ := namespaceetcd.NewREST(createRESTOptionsOrDie(s, g, f, api.Resource("namespaces")))
|
||||
secretStore := secretetcd.NewREST(createRESTOptionsOrDie(s, g, f, api.Resource("secrets")))
|
||||
coreResources := map[string]rest.Storage{
|
||||
"secrets": secretStore,
|
||||
"services": serviceStore,
|
||||
"services/status": serviceStatusStore,
|
||||
"namespaces": namespaceStore,
|
||||
|
|
|
@ -41,8 +41,8 @@ ${clientgen} "$@"
|
|||
${clientgen} -t "$@"
|
||||
${clientgen} --clientset-name="release_1_4" --input="api/v1,extensions/v1beta1,autoscaling/v1,batch/v1"
|
||||
# Clientgen for federation clientset.
|
||||
${clientgen} --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input="../../federation/apis/federation/","api/","extensions/" --included-types-overrides="api/Service,api/Namespace,extensions/ReplicaSet" "$@"
|
||||
${clientgen} --clientset-name=federation_release_1_4 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input="../../federation/apis/federation/v1beta1","api/v1","extensions/v1beta1" --included-types-overrides="api/v1/Service,api/v1/Namespace,extensions/v1beta1/ReplicaSet" "$@"
|
||||
${clientgen} --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input="../../federation/apis/federation/","api/","extensions/" --included-types-overrides="api/Service,api/Namespace,extensions/ReplicaSet,api/Secret" "$@"
|
||||
${clientgen} --clientset-name=federation_release_1_4 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input="../../federation/apis/federation/v1beta1","api/v1","extensions/v1beta1" --included-types-overrides="api/v1/Service,api/v1/Namespace,extensions/v1beta1/ReplicaSet,api/v1/Secret" "$@"
|
||||
${setgen} "$@"
|
||||
|
||||
# You may add additional calls of code generators like set-gen above.
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
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 e2e
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
"k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_4"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
const (
|
||||
FederatedSecretName = "federated-secret"
|
||||
)
|
||||
|
||||
// Create/delete secret api objects
|
||||
var _ = framework.KubeDescribe("Federation secrets [Feature:Federation]", func() {
|
||||
f := framework.NewDefaultFederatedFramework("federated-secret")
|
||||
|
||||
Describe("Secret objects", func() {
|
||||
AfterEach(func() {
|
||||
framework.SkipUnlessFederated(f.Client)
|
||||
|
||||
// Delete registered secrets.
|
||||
// This is if a test failed, it should not affect other tests.
|
||||
secretList, err := f.FederationClientset_1_4.Core().Secrets(f.Namespace.Name).List(api.ListOptions{})
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
for _, secret := range secretList.Items {
|
||||
err := f.FederationClientset_1_4.Core().Secrets(f.Namespace.Name).Delete(secret.Name, &api.DeleteOptions{})
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
}
|
||||
})
|
||||
|
||||
It("should be created and deleted successfully", func() {
|
||||
framework.SkipUnlessFederated(f.Client)
|
||||
secret := createSecretOrFail(f.FederationClientset_1_4, f.Namespace.Name)
|
||||
By(fmt.Sprintf("Creation of secret %q in namespace %q succeeded. Deleting secret.", secret.Name, f.Namespace.Name))
|
||||
// Cleanup
|
||||
err := f.FederationClientset_1_4.Core().Secrets(f.Namespace.Name).Delete(secret.Name, &api.DeleteOptions{})
|
||||
framework.ExpectNoError(err, "Error deleting secret %q in namespace %q", secret.Name, secret.Namespace)
|
||||
By(fmt.Sprintf("Deletion of secret %q in namespace %q succeeded.", secret.Name, f.Namespace.Name))
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
func createSecretOrFail(clientset *federation_release_1_4.Clientset, namespace string) *v1.Secret {
|
||||
if clientset == nil || len(namespace) == 0 {
|
||||
Fail(fmt.Sprintf("Internal error: invalid parameters passed to deleteSecretOrFail: clientset: %v, namespace: %v", clientset, namespace))
|
||||
}
|
||||
By(fmt.Sprintf("Creating federated secret %q in namespace %q", FederatedSecretName, namespace))
|
||||
|
||||
secret := &v1.Secret{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: FederatedSecretName,
|
||||
},
|
||||
}
|
||||
|
||||
By(fmt.Sprintf("Trying to create secret %q in namespace %q", secret.Name, namespace))
|
||||
_, err := clientset.Core().Secrets(namespace).Create(secret)
|
||||
framework.ExpectNoError(err, "Creating secret %q in namespace %q", secret.Name, namespace)
|
||||
By(fmt.Sprintf("Successfully created federated secret %q in namespace %q", FederatedSecretName, namespace))
|
||||
return secret
|
||||
}
|
|
@ -28,6 +28,7 @@ import (
|
|||
"k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset"
|
||||
unversionedfederation "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset/typed/federation/unversioned"
|
||||
"k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_3"
|
||||
"k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_4"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
apierrs "k8s.io/kubernetes/pkg/api/errors"
|
||||
"k8s.io/kubernetes/pkg/client/clientset_generated/release_1_2"
|
||||
|
@ -60,6 +61,7 @@ type Framework struct {
|
|||
// TODO(mml): Remove this. We should generally use the versioned clientset.
|
||||
FederationClientset *federation_internalclientset.Clientset
|
||||
FederationClientset_1_3 *federation_release_1_3.Clientset
|
||||
FederationClientset_1_4 *federation_release_1_4.Clientset
|
||||
// TODO: remove FederationClient, all the client access must be through FederationClientset
|
||||
FederationClient *unversionedfederation.FederationClient
|
||||
|
||||
|
@ -171,6 +173,12 @@ func (f *Framework) BeforeEach() {
|
|||
f.FederationClientset_1_3, err = LoadFederationClientset_1_3()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
}
|
||||
if f.FederationClientset_1_4 == nil {
|
||||
By("Creating a release 1.4 federation Clientset")
|
||||
var err error
|
||||
f.FederationClientset_1_4, err = LoadFederationClientset_1_4()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
}
|
||||
By("Waiting for federation-apiserver to be ready")
|
||||
err := WaitForFederationApiserverReady(f.FederationClientset)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
|
|
@ -41,6 +41,7 @@ import (
|
|||
"k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset"
|
||||
unversionedfederation "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset/typed/federation/unversioned"
|
||||
"k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_3"
|
||||
"k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_4"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
apierrs "k8s.io/kubernetes/pkg/api/errors"
|
||||
"k8s.io/kubernetes/pkg/api/resource"
|
||||
|
@ -1786,6 +1787,21 @@ func LoadFederationClientset_1_3() (*federation_release_1_3.Clientset, error) {
|
|||
return c, nil
|
||||
}
|
||||
|
||||
func LoadFederationClientset_1_4() (*federation_release_1_4.Clientset, error) {
|
||||
config, err := LoadFederatedConfig()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
c, err := federation_release_1_4.NewForConfig(config)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating federation clientset: %v", err.Error())
|
||||
}
|
||||
// Set timeout for each client in the set.
|
||||
setTimeouts(c.DiscoveryClient.Client, c.FederationClient.Client, c.CoreClient.Client)
|
||||
return c, nil
|
||||
}
|
||||
|
||||
func loadFederationClientFromConfig(config *restclient.Config) (*unversionedfederation.FederationClient, error) {
|
||||
c, err := unversionedfederation.NewForConfig(config)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue