Add service-controller unit tests
Change-Id: I3fd5bc4b62d26c7e6d118ba08b6c001c871fcbd3 Implements: blueprint service-controller-test Signed-off-by: mozhuli <21621232@zju.edu.cn>
This commit is contained in:
parent
7fed3d210b
commit
604dd5b0c9
@ -53,6 +53,7 @@ type FakeOSClient struct {
|
|||||||
Subnets map[string]*subnets.Subnet
|
Subnets map[string]*subnets.Subnet
|
||||||
Routers map[string]*routers.Router
|
Routers map[string]*routers.Router
|
||||||
Ports map[string][]ports.Port
|
Ports map[string][]ports.Port
|
||||||
|
LoadBalancers map[string]*LoadBalancer
|
||||||
CRDClient crdClient.Interface
|
CRDClient crdClient.Interface
|
||||||
PluginName string
|
PluginName string
|
||||||
IntegrationBridge string
|
IntegrationBridge string
|
||||||
@ -70,6 +71,7 @@ func NewFake(crdClient crdClient.Interface) *FakeOSClient {
|
|||||||
Subnets: make(map[string]*subnets.Subnet),
|
Subnets: make(map[string]*subnets.Subnet),
|
||||||
Routers: make(map[string]*routers.Router),
|
Routers: make(map[string]*routers.Router),
|
||||||
Ports: make(map[string][]ports.Port),
|
Ports: make(map[string][]ports.Port),
|
||||||
|
LoadBalancers: make(map[string]*LoadBalancer),
|
||||||
CRDClient: crdClient,
|
CRDClient: crdClient,
|
||||||
PluginName: "ovs",
|
PluginName: "ovs",
|
||||||
IntegrationBridge: "bi-int",
|
IntegrationBridge: "bi-int",
|
||||||
@ -156,14 +158,11 @@ func (f *FakeOSClient) SetUser(userName, userID, tenantID string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetNetwork injects fake network.
|
// SetNetwork injects fake network.
|
||||||
func (f *FakeOSClient) SetNetwork(networkName, networkID string) {
|
func (f *FakeOSClient) SetNetwork(network *drivertypes.Network) {
|
||||||
f.Lock()
|
f.Lock()
|
||||||
defer f.Unlock()
|
defer f.Unlock()
|
||||||
network := &drivertypes.Network{
|
|
||||||
Name: networkName,
|
f.Networks[network.Name] = network
|
||||||
Uid: networkID,
|
|
||||||
}
|
|
||||||
f.Networks[networkName] = network
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPort injects fake port.
|
// SetPort injects fake port.
|
||||||
@ -185,6 +184,14 @@ func (f *FakeOSClient) SetPort(networkID, deviceOwner, deviceID string) {
|
|||||||
f.Ports[networkID] = netPorts
|
f.Ports[networkID] = netPorts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetLoadbalancer injects fake loadbalancer.
|
||||||
|
func (f *FakeOSClient) SetLoadbalancer(lb *LoadBalancer) {
|
||||||
|
f.Lock()
|
||||||
|
defer f.Unlock()
|
||||||
|
|
||||||
|
f.LoadBalancers[lb.Name] = lb
|
||||||
|
}
|
||||||
|
|
||||||
func tenantIDHash(tenantName string) string {
|
func tenantIDHash(tenantName string) string {
|
||||||
return idHash(tenantName)
|
return idHash(tenantName)
|
||||||
}
|
}
|
||||||
@ -537,16 +544,47 @@ func (f *FakeOSClient) UpdatePortsBinding(portID, deviceOwner string) error {
|
|||||||
|
|
||||||
// LoadBalancerExist is a test implementation of Interface.LoadBalancerExist.
|
// LoadBalancerExist is a test implementation of Interface.LoadBalancerExist.
|
||||||
func (f *FakeOSClient) LoadBalancerExist(name string) (bool, error) {
|
func (f *FakeOSClient) LoadBalancerExist(name string) (bool, error) {
|
||||||
|
f.Lock()
|
||||||
|
defer f.Unlock()
|
||||||
|
f.appendCalled("LoadBalancerExist", name)
|
||||||
|
if err := f.getError("LoadBalancerExist"); err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, ok := f.LoadBalancers[name]; !ok {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// EnsureLoadBalancer is a test implementation of Interface.EnsureLoadBalancer.
|
// EnsureLoadBalancer is a test implementation of Interface.EnsureLoadBalancer.
|
||||||
func (f *FakeOSClient) EnsureLoadBalancer(lb *LoadBalancer) (*LoadBalancerStatus, error) {
|
func (f *FakeOSClient) EnsureLoadBalancer(lb *LoadBalancer) (*LoadBalancerStatus, error) {
|
||||||
return nil, nil
|
f.Lock()
|
||||||
|
defer f.Unlock()
|
||||||
|
f.appendCalled("EnsureLoadBalancer", lb)
|
||||||
|
if err := f.getError("EnsureLoadBalancer"); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
f.LoadBalancers[lb.Name] = lb
|
||||||
|
|
||||||
|
return &LoadBalancerStatus{
|
||||||
|
InternalIP: lb.InternalIP,
|
||||||
|
ExternalIP: lb.ExternalIP,
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// EnsureLoadBalancerDeleted is a test implementation of Interface.EnsureLoadBalancerDeleted.
|
// EnsureLoadBalancerDeleted is a test implementation of Interface.EnsureLoadBalancerDeleted.
|
||||||
func (f *FakeOSClient) EnsureLoadBalancerDeleted(name string) error {
|
func (f *FakeOSClient) EnsureLoadBalancerDeleted(name string) error {
|
||||||
|
f.Lock()
|
||||||
|
defer f.Unlock()
|
||||||
|
f.appendCalled("EnsureLoadBalancerDeleted", name)
|
||||||
|
if err := f.getError("EnsureLoadBalancerDeleted"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
delete(f.LoadBalancers, name)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ import (
|
|||||||
|
|
||||||
crdClient "git.openstack.org/openstack/stackube/pkg/kubecrd"
|
crdClient "git.openstack.org/openstack/stackube/pkg/kubecrd"
|
||||||
"git.openstack.org/openstack/stackube/pkg/openstack"
|
"git.openstack.org/openstack/stackube/pkg/openstack"
|
||||||
|
drivertypes "git.openstack.org/openstack/stackube/pkg/openstack/types"
|
||||||
"git.openstack.org/openstack/stackube/pkg/util"
|
"git.openstack.org/openstack/stackube/pkg/util"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
@ -34,6 +35,12 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/util/async"
|
"k8s.io/kubernetes/pkg/util/async"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
defaultNetworkID = "123"
|
||||||
|
defaultPortID = "123"
|
||||||
|
deviceOwner = "network:router_interface"
|
||||||
|
)
|
||||||
|
|
||||||
func newFakeServiceInfo(serviceName string, ip net.IP) *serviceInfo {
|
func newFakeServiceInfo(serviceName string, ip net.IP) *serviceInfo {
|
||||||
return &serviceInfo{
|
return &serviceInfo{
|
||||||
name: serviceName,
|
name: serviceName,
|
||||||
@ -41,6 +48,13 @@ func newFakeServiceInfo(serviceName string, ip net.IP) *serviceInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func defaultNetwork(networkName, uid string) *drivertypes.Network {
|
||||||
|
return &drivertypes.Network{
|
||||||
|
Name: networkName,
|
||||||
|
Uid: uid,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func Test_getServiceIP(t *testing.T) {
|
func Test_getServiceIP(t *testing.T) {
|
||||||
fp := NewFakeProxier(nil, nil)
|
fp := NewFakeProxier(nil, nil)
|
||||||
|
|
||||||
@ -202,9 +216,9 @@ func TestClusterNoEndpoint(t *testing.T) {
|
|||||||
osClient := openstack.NewFake(crdClient)
|
osClient := openstack.NewFake(crdClient)
|
||||||
// Injects fake network.
|
// Injects fake network.
|
||||||
networkName := util.BuildNetworkName(testNamespace, testNamespace)
|
networkName := util.BuildNetworkName(testNamespace, testNamespace)
|
||||||
osClient.SetNetwork(networkName, "123")
|
osClient.SetNetwork(defaultNetwork(networkName, defaultNetworkID))
|
||||||
// Injects fake port.
|
// Injects fake port.
|
||||||
osClient.SetPort("123", "network:router_interface", "123")
|
osClient.SetPort(defaultNetworkID, deviceOwner, defaultPortID)
|
||||||
// Creates a new fake proxier.
|
// Creates a new fake proxier.
|
||||||
fp := NewFakeProxier(ipt, osClient)
|
fp := NewFakeProxier(ipt, osClient)
|
||||||
|
|
||||||
@ -252,9 +266,9 @@ func noClusterIPType(t *testing.T, svcType v1.ServiceType) []Rule {
|
|||||||
osClient := openstack.NewFake(crdClient)
|
osClient := openstack.NewFake(crdClient)
|
||||||
// Injects fake network.
|
// Injects fake network.
|
||||||
networkName := util.BuildNetworkName(testNamespace, testNamespace)
|
networkName := util.BuildNetworkName(testNamespace, testNamespace)
|
||||||
osClient.SetNetwork(networkName, "123")
|
osClient.SetNetwork(defaultNetwork(networkName, defaultNetworkID))
|
||||||
// Injects fake port.
|
// Injects fake port.
|
||||||
osClient.SetPort("123", "network:router_interface", "123")
|
osClient.SetPort(defaultNetworkID, deviceOwner, defaultPortID)
|
||||||
// Creates a new fake proxier.
|
// Creates a new fake proxier.
|
||||||
fp := NewFakeProxier(ipt, osClient)
|
fp := NewFakeProxier(ipt, osClient)
|
||||||
|
|
||||||
@ -315,9 +329,9 @@ func TestClusterIPEndpointsJump(t *testing.T) {
|
|||||||
osClient := openstack.NewFake(crdClient)
|
osClient := openstack.NewFake(crdClient)
|
||||||
// Injects fake network.
|
// Injects fake network.
|
||||||
networkName := util.BuildNetworkName(testNamespace, testNamespace)
|
networkName := util.BuildNetworkName(testNamespace, testNamespace)
|
||||||
osClient.SetNetwork(networkName, "123")
|
osClient.SetNetwork(defaultNetwork(networkName, defaultNetworkID))
|
||||||
// Injects fake port.
|
// Injects fake port.
|
||||||
osClient.SetPort("123", "network:router_interface", "123")
|
osClient.SetPort(defaultNetworkID, deviceOwner, defaultPortID)
|
||||||
// Creates a new fake proxier.
|
// Creates a new fake proxier.
|
||||||
fp := NewFakeProxier(ipt, osClient)
|
fp := NewFakeProxier(ipt, osClient)
|
||||||
|
|
||||||
@ -390,12 +404,12 @@ func TestMultiNamespacesService(t *testing.T) {
|
|||||||
osClient := openstack.NewFake(crdClient)
|
osClient := openstack.NewFake(crdClient)
|
||||||
// Injects fake network.
|
// Injects fake network.
|
||||||
networkName1 := util.BuildNetworkName(ns1, ns1)
|
networkName1 := util.BuildNetworkName(ns1, ns1)
|
||||||
osClient.SetNetwork(networkName1, "123")
|
osClient.SetNetwork(defaultNetwork(networkName1, "123"))
|
||||||
networkName2 := util.BuildNetworkName(ns2, ns2)
|
networkName2 := util.BuildNetworkName(ns2, ns2)
|
||||||
osClient.SetNetwork(networkName2, "456")
|
osClient.SetNetwork(defaultNetwork(networkName2, "456"))
|
||||||
// Injects fake port.
|
// Injects fake port.
|
||||||
osClient.SetPort("123", "network:router_interface", "123")
|
osClient.SetPort("123", deviceOwner, "123")
|
||||||
osClient.SetPort("456", "network:router_interface", "456")
|
osClient.SetPort("456", deviceOwner, "456")
|
||||||
// Creates a new fake proxier.
|
// Creates a new fake proxier.
|
||||||
fp := NewFakeProxier(ipt, osClient)
|
fp := NewFakeProxier(ipt, osClient)
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ type serviceCache struct {
|
|||||||
type ServiceController struct {
|
type ServiceController struct {
|
||||||
cache *serviceCache
|
cache *serviceCache
|
||||||
|
|
||||||
kubeClientset *kubernetes.Clientset
|
kubeClient kubernetes.Interface
|
||||||
osClient openstack.Interface
|
osClient openstack.Interface
|
||||||
factory informers.SharedInformerFactory
|
factory informers.SharedInformerFactory
|
||||||
serviceInformer informersV1.ServiceInformer
|
serviceInformer informersV1.ServiceInformer
|
||||||
@ -84,13 +84,13 @@ type ServiceController struct {
|
|||||||
|
|
||||||
// NewServiceController returns a new service controller to keep openstack lbaas resources
|
// NewServiceController returns a new service controller to keep openstack lbaas resources
|
||||||
// (load balancers) in sync with the registry.
|
// (load balancers) in sync with the registry.
|
||||||
func NewServiceController(kubeClient *kubernetes.Clientset,
|
func NewServiceController(kubeClient kubernetes.Interface,
|
||||||
osClient openstack.Interface) (*ServiceController, error) {
|
osClient openstack.Interface) (*ServiceController, error) {
|
||||||
factory := informers.NewSharedInformerFactory(kubeClient, resyncPeriod)
|
factory := informers.NewSharedInformerFactory(kubeClient, resyncPeriod)
|
||||||
s := &ServiceController{
|
s := &ServiceController{
|
||||||
osClient: osClient,
|
osClient: osClient,
|
||||||
factory: factory,
|
factory: factory,
|
||||||
kubeClientset: kubeClient,
|
kubeClient: kubeClient,
|
||||||
cache: &serviceCache{serviceMap: make(map[string]*cachedService)},
|
cache: &serviceCache{serviceMap: make(map[string]*cachedService)},
|
||||||
workingQueue: workqueue.NewNamedDelayingQueue("service"),
|
workingQueue: workqueue.NewNamedDelayingQueue("service"),
|
||||||
serviceInformer: factory.Core().V1().Services(),
|
serviceInformer: factory.Core().V1().Services(),
|
||||||
@ -296,7 +296,8 @@ func (s *ServiceController) createLoadBalancerIfNeeded(key string, service *v1.S
|
|||||||
func (s *ServiceController) persistUpdate(service *v1.Service) error {
|
func (s *ServiceController) persistUpdate(service *v1.Service) error {
|
||||||
var err error
|
var err error
|
||||||
for i := 0; i < clientRetryCount; i++ {
|
for i := 0; i < clientRetryCount; i++ {
|
||||||
_, err = s.kubeClientset.CoreV1Client.Services(service.Namespace).UpdateStatus(service)
|
_, err = s.kubeClient.Core().Services(service.Namespace).UpdateStatus(service)
|
||||||
|
//_, err = s.kubeClient.CoreV1Client.Services(service.Namespace).UpdateStatus(service)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -348,10 +349,8 @@ func (s *ServiceController) createLoadBalancer(service *v1.Service) (*v1.LoadBal
|
|||||||
// create the loadbalancer.
|
// create the loadbalancer.
|
||||||
lbName := buildLoadBalancerName(service)
|
lbName := buildLoadBalancerName(service)
|
||||||
svcPort := service.Spec.Ports[0]
|
svcPort := service.Spec.Ports[0]
|
||||||
externalIP := ""
|
externalIP := service.Spec.ExternalIPs[0]
|
||||||
if len(service.Spec.ExternalIPs) > 0 {
|
|
||||||
externalIP = service.Spec.ExternalIPs[0]
|
|
||||||
}
|
|
||||||
lb, err := s.osClient.EnsureLoadBalancer(&openstack.LoadBalancer{
|
lb, err := s.osClient.EnsureLoadBalancer(&openstack.LoadBalancer{
|
||||||
Name: lbName,
|
Name: lbName,
|
||||||
Endpoints: endpoints,
|
Endpoints: endpoints,
|
||||||
@ -374,7 +373,7 @@ func (s *ServiceController) createLoadBalancer(service *v1.Service) (*v1.LoadBal
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *ServiceController) getEndpoints(service *v1.Service) ([]openstack.Endpoint, error) {
|
func (s *ServiceController) getEndpoints(service *v1.Service) ([]openstack.Endpoint, error) {
|
||||||
endpoints, err := s.kubeClientset.CoreV1Client.Endpoints(service.Namespace).Get(service.Name, metav1.GetOptions{})
|
endpoints, err := s.kubeClient.Core().Endpoints(service.Namespace).Get(service.Name, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
829
pkg/service-controller/service_controller_test.go
Normal file
829
pkg/service-controller/service_controller_test.go
Normal file
@ -0,0 +1,829 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2017 OpenStack Foundation.
|
||||||
|
|
||||||
|
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 service
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"net/http/httptest"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"git.openstack.org/openstack/stackube/pkg/openstack"
|
||||||
|
drivertypes "git.openstack.org/openstack/stackube/pkg/openstack/types"
|
||||||
|
"k8s.io/api/core/v1"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/types"
|
||||||
|
"k8s.io/client-go/kubernetes"
|
||||||
|
"k8s.io/client-go/kubernetes/fake"
|
||||||
|
"k8s.io/client-go/kubernetes/scheme"
|
||||||
|
restclient "k8s.io/client-go/rest"
|
||||||
|
utiltesting "k8s.io/client-go/util/testing"
|
||||||
|
"k8s.io/kubernetes/pkg/api"
|
||||||
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
LoadBalancerExist = "LoadBalancerExist"
|
||||||
|
EnsureLoadBalancerDeleted = "EnsureLoadBalancerDeleted"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newService(name string, uid types.UID, serviceType v1.ServiceType) *v1.Service {
|
||||||
|
return &v1.Service{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: name,
|
||||||
|
Namespace: "default",
|
||||||
|
UID: uid,
|
||||||
|
SelfLink: testapi.Default.SelfLink("services", name),
|
||||||
|
},
|
||||||
|
Spec: v1.ServiceSpec{
|
||||||
|
Ports: []v1.ServicePort{{
|
||||||
|
Port: 80,
|
||||||
|
}},
|
||||||
|
ExternalIPs: []string{
|
||||||
|
"1.1.1.1",
|
||||||
|
},
|
||||||
|
Type: serviceType,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Wrap newService so that you dont have to call default argumetns again and again.
|
||||||
|
func defaultExternalService() *v1.Service {
|
||||||
|
|
||||||
|
return newService("external-balancer", types.UID("123"), v1.ServiceTypeLoadBalancer)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func defaultNetwork() *drivertypes.Network {
|
||||||
|
subnets := []*drivertypes.Subnet{{Uid: "123"}}
|
||||||
|
return &drivertypes.Network{
|
||||||
|
Name: "kube-default-default",
|
||||||
|
TenantID: "123",
|
||||||
|
Subnets: subnets,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func makeTestServer(t *testing.T, namespace string) (*httptest.Server, *utiltesting.FakeHandler) {
|
||||||
|
fakeEndpointsHandler := utiltesting.FakeHandler{
|
||||||
|
StatusCode: http.StatusOK,
|
||||||
|
ResponseBody: runtime.EncodeOrDie(testapi.Default.Codec(), &v1.Endpoints{}),
|
||||||
|
}
|
||||||
|
mux := http.NewServeMux()
|
||||||
|
mux.Handle(testapi.Default.ResourcePath("endpoints/", namespace, ""), &fakeEndpointsHandler)
|
||||||
|
mux.Handle(testapi.Default.ResourcePath("services/", namespace, ""), &fakeEndpointsHandler)
|
||||||
|
mux.HandleFunc("/", func(res http.ResponseWriter, req *http.Request) {
|
||||||
|
t.Errorf("unexpected request: %v", req.RequestURI)
|
||||||
|
res.WriteHeader(http.StatusNotFound)
|
||||||
|
})
|
||||||
|
return httptest.NewServer(mux), &fakeEndpointsHandler
|
||||||
|
}
|
||||||
|
|
||||||
|
func newController() (*ServiceController, *openstack.FakeOSClient, *fake.Clientset) {
|
||||||
|
osClient := openstack.NewFake(nil)
|
||||||
|
|
||||||
|
client := fake.NewSimpleClientset()
|
||||||
|
|
||||||
|
controller, _ := NewServiceController(client, osClient)
|
||||||
|
|
||||||
|
return controller, osClient, client
|
||||||
|
}
|
||||||
|
|
||||||
|
func newControllerFakeHTTPServer(url, svcName, namespace string) (*ServiceController, *openstack.FakeOSClient) {
|
||||||
|
osClient := openstack.NewFake(nil)
|
||||||
|
|
||||||
|
client := kubernetes.NewForConfigOrDie(&restclient.Config{Host: url, ContentConfig: restclient.ContentConfig{GroupVersion: &api.Registry.GroupOrDie(v1.GroupName).GroupVersion}})
|
||||||
|
|
||||||
|
controller, _ := NewServiceController(client, osClient)
|
||||||
|
|
||||||
|
// Sets fake network.
|
||||||
|
osClient.SetNetwork(defaultNetwork())
|
||||||
|
// Injects fake endpoint.
|
||||||
|
controller.factory.Core().V1().Endpoints().Informer().GetStore().Add(&v1.Endpoints{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: svcName,
|
||||||
|
Namespace: namespace,
|
||||||
|
},
|
||||||
|
Subsets: []v1.EndpointSubset{{
|
||||||
|
Addresses: []v1.EndpointAddress{{IP: "3.3.3.3"}},
|
||||||
|
Ports: []v1.EndpointPort{{Port: 80}},
|
||||||
|
}},
|
||||||
|
})
|
||||||
|
|
||||||
|
return controller, osClient
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestServiceTypeNoLoadBalancer(t *testing.T) {
|
||||||
|
service := &v1.Service{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: "no-external-balancer",
|
||||||
|
Namespace: "default",
|
||||||
|
},
|
||||||
|
Spec: v1.ServiceSpec{
|
||||||
|
Type: v1.ServiceTypeClusterIP,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// test load balencer exist or not.
|
||||||
|
testCases := map[string]bool{
|
||||||
|
"case 1": false,
|
||||||
|
"case 2": true,
|
||||||
|
}
|
||||||
|
|
||||||
|
lb := &openstack.LoadBalancer{
|
||||||
|
Name: buildLoadBalancerName(service),
|
||||||
|
}
|
||||||
|
|
||||||
|
for k, lbExist := range testCases {
|
||||||
|
controller, osClient, client := newController()
|
||||||
|
if lbExist {
|
||||||
|
osClient.SetLoadbalancer(lb)
|
||||||
|
}
|
||||||
|
|
||||||
|
err, _ := controller.createLoadBalancerIfNeeded("foo/bar", service)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("%v: unexpected error: %v", k, err)
|
||||||
|
}
|
||||||
|
actions := client.Actions()
|
||||||
|
|
||||||
|
if osClient.GetCalledNames()[0] != LoadBalancerExist {
|
||||||
|
t.Errorf("%v: unexpected openstack client calls: %v", k, osClient.GetCalledDetails())
|
||||||
|
}
|
||||||
|
|
||||||
|
if lbExist {
|
||||||
|
if osClient.GetCalledNames()[1] != EnsureLoadBalancerDeleted {
|
||||||
|
t.Errorf("%v: unexpected openstack client calls: %v", k, osClient.GetCalledDetails())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(actions) > 0 {
|
||||||
|
t.Errorf("%v: unexpected client actions: %v", k, actions)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCreateExternalLoadBalancer(t *testing.T) {
|
||||||
|
table := []struct {
|
||||||
|
service *v1.Service
|
||||||
|
expectErr bool
|
||||||
|
expectCreated bool
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
service: &v1.Service{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: "svc1",
|
||||||
|
Namespace: "default",
|
||||||
|
SelfLink: testapi.Default.SelfLink("services", "svc1"),
|
||||||
|
},
|
||||||
|
Spec: v1.ServiceSpec{
|
||||||
|
Ports: []v1.ServicePort{
|
||||||
|
{
|
||||||
|
Port: 80,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Port: 8080,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Type: v1.ServiceTypeLoadBalancer,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
expectErr: true,
|
||||||
|
expectCreated: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
service: &v1.Service{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: "svc2",
|
||||||
|
Namespace: "default",
|
||||||
|
SelfLink: testapi.Default.SelfLink("services", "svc2"),
|
||||||
|
},
|
||||||
|
Spec: v1.ServiceSpec{
|
||||||
|
Ports: []v1.ServicePort{{
|
||||||
|
Port: 80,
|
||||||
|
}},
|
||||||
|
ExternalIPs: []string{
|
||||||
|
"1.1.1.1",
|
||||||
|
"2.2.2.2",
|
||||||
|
},
|
||||||
|
Type: v1.ServiceTypeLoadBalancer,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
expectErr: true,
|
||||||
|
expectCreated: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
service: &v1.Service{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: "svc3",
|
||||||
|
Namespace: "default",
|
||||||
|
SelfLink: testapi.Default.SelfLink("services", "svc3"),
|
||||||
|
},
|
||||||
|
Spec: v1.ServiceSpec{
|
||||||
|
Ports: []v1.ServicePort{{
|
||||||
|
Port: 80,
|
||||||
|
}},
|
||||||
|
ExternalIPs: []string{
|
||||||
|
"1.1.1.1",
|
||||||
|
},
|
||||||
|
Type: v1.ServiceTypeLoadBalancer,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
expectErr: false,
|
||||||
|
expectCreated: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, item := range table {
|
||||||
|
testServer, endpointsHandler := makeTestServer(t, "default")
|
||||||
|
defer testServer.Close()
|
||||||
|
|
||||||
|
// Create a new fake service controller.
|
||||||
|
controller, osClient := newControllerFakeHTTPServer(testServer.URL, item.service.Name, item.service.Namespace)
|
||||||
|
|
||||||
|
err, _ := controller.createLoadBalancerIfNeeded("foo/bar", item.service)
|
||||||
|
if !item.expectErr && err != nil {
|
||||||
|
t.Errorf("unexpected error: %v", err)
|
||||||
|
} else if item.expectErr && err == nil {
|
||||||
|
t.Errorf("expected error creating %v, got nil", item.service)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !item.expectCreated {
|
||||||
|
if len(osClient.GetCalledNames()) != 0 {
|
||||||
|
t.Errorf("unexpected openstack client calls: %v", osClient.GetCalledDetails())
|
||||||
|
}
|
||||||
|
endpointsHandler.ValidateRequestCount(t, 0)
|
||||||
|
} else {
|
||||||
|
var balancer *openstack.LoadBalancer
|
||||||
|
for k := range osClient.LoadBalancers {
|
||||||
|
if balancer == nil {
|
||||||
|
b := osClient.LoadBalancers[k]
|
||||||
|
balancer = b
|
||||||
|
} else {
|
||||||
|
t.Errorf("expected one load balancer to be created, got %v", osClient.LoadBalancers)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if balancer == nil {
|
||||||
|
t.Errorf("expected one load balancer to be created, got none")
|
||||||
|
} else if balancer.Name != buildLoadBalancerName(item.service) &&
|
||||||
|
balancer.ServicePort != int(item.service.Spec.Ports[0].Port) &&
|
||||||
|
balancer.ExternalIP != item.service.Spec.ExternalIPs[0] {
|
||||||
|
t.Errorf("created load balancer has incorrect parameters: %v", balancer)
|
||||||
|
}
|
||||||
|
endpointsHandler.ValidateRequestCount(t, 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestProcessServiceUpdate(t *testing.T) {
|
||||||
|
|
||||||
|
var controller *ServiceController
|
||||||
|
var osClient *openstack.FakeOSClient
|
||||||
|
|
||||||
|
//A pair of old and new loadbalancer IP address
|
||||||
|
oldLBIP := "192.168.1.1"
|
||||||
|
newLBIP := "192.168.1.2"
|
||||||
|
|
||||||
|
testServer, _ := makeTestServer(t, "default")
|
||||||
|
defer testServer.Close()
|
||||||
|
|
||||||
|
testCases := []struct {
|
||||||
|
testName string
|
||||||
|
key string
|
||||||
|
updateFn func(*v1.Service) *v1.Service //Manipulate the structure
|
||||||
|
svc *v1.Service
|
||||||
|
expectedFn func(*v1.Service, error, time.Duration) error //Error comparision function
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
testName: "If updating a valid service",
|
||||||
|
key: "validKey",
|
||||||
|
svc: defaultExternalService(),
|
||||||
|
updateFn: func(svc *v1.Service) *v1.Service {
|
||||||
|
|
||||||
|
// Create a new fake service controller.
|
||||||
|
controller, osClient = newControllerFakeHTTPServer(testServer.URL, "external-balancer", "default")
|
||||||
|
controller.cache.getOrCreate("validKey")
|
||||||
|
return svc
|
||||||
|
|
||||||
|
},
|
||||||
|
expectedFn: func(svc *v1.Service, err error, retryDuration time.Duration) error {
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if retryDuration != doNotRetry {
|
||||||
|
return fmt.Errorf("retryDuration Expected=%v Obtained=%v", doNotRetry, retryDuration)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(osClient.GetCalledNames()) != 2 {
|
||||||
|
t.Errorf("unexpected openstack client calls: %v", osClient.GetCalledDetails())
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testName: "If Updating Loadbalancer IP",
|
||||||
|
key: "default/sync-test-name",
|
||||||
|
svc: newService("sync-test-name", types.UID("sync-test-uid"), v1.ServiceTypeLoadBalancer),
|
||||||
|
updateFn: func(svc *v1.Service) *v1.Service {
|
||||||
|
|
||||||
|
svc.Spec.LoadBalancerIP = oldLBIP
|
||||||
|
|
||||||
|
keyExpected := svc.GetObjectMeta().GetNamespace() + "/" + svc.GetObjectMeta().GetName()
|
||||||
|
controller.enqueueService(svc)
|
||||||
|
cachedServiceTest := controller.cache.getOrCreate(keyExpected)
|
||||||
|
cachedServiceTest.state = svc
|
||||||
|
controller.cache.set(keyExpected, cachedServiceTest)
|
||||||
|
|
||||||
|
keyGot, quit := controller.workingQueue.Get()
|
||||||
|
if quit {
|
||||||
|
t.Fatalf("get no workingQueue element")
|
||||||
|
}
|
||||||
|
if keyExpected != keyGot.(string) {
|
||||||
|
t.Fatalf("get service key error, expected: %s, got: %s", keyExpected, keyGot.(string))
|
||||||
|
}
|
||||||
|
|
||||||
|
copy, err := scheme.Scheme.DeepCopy(svc)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("copy service error: %v", err)
|
||||||
|
}
|
||||||
|
newService := copy.(*v1.Service)
|
||||||
|
|
||||||
|
newService.Spec.LoadBalancerIP = newLBIP
|
||||||
|
return newService
|
||||||
|
|
||||||
|
},
|
||||||
|
expectedFn: func(svc *v1.Service, err error, retryDuration time.Duration) error {
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if retryDuration != doNotRetry {
|
||||||
|
return fmt.Errorf("retryDuration Expected=%v Obtained=%v", doNotRetry, retryDuration)
|
||||||
|
}
|
||||||
|
|
||||||
|
keyExpected := svc.GetObjectMeta().GetNamespace() + "/" + svc.GetObjectMeta().GetName()
|
||||||
|
|
||||||
|
cachedServiceGot, exist := controller.cache.get(keyExpected)
|
||||||
|
if !exist {
|
||||||
|
return fmt.Errorf("update service error, workingQueue should contain service: %s", keyExpected)
|
||||||
|
}
|
||||||
|
if cachedServiceGot.state.Spec.LoadBalancerIP != newLBIP {
|
||||||
|
return fmt.Errorf("update LoadBalancerIP error, expected: %s, got: %s", newLBIP, cachedServiceGot.state.Spec.LoadBalancerIP)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(osClient.GetCalledNames()) != 4 {
|
||||||
|
t.Errorf("unexpected openstack client calls: %v", osClient.GetCalledDetails())
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tc := range testCases {
|
||||||
|
newSvc := tc.updateFn(tc.svc)
|
||||||
|
svcCache := controller.cache.getOrCreate(tc.key)
|
||||||
|
obtErr, retryDuration := controller.processServiceUpdate(svcCache, newSvc, tc.key)
|
||||||
|
if err := tc.expectedFn(newSvc, obtErr, retryDuration); err != nil {
|
||||||
|
t.Errorf("%v processServiceUpdate() %v", tc.testName, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSyncService(t *testing.T) {
|
||||||
|
|
||||||
|
var controller *ServiceController
|
||||||
|
var osClient *openstack.FakeOSClient
|
||||||
|
|
||||||
|
testServer, _ := makeTestServer(t, "default")
|
||||||
|
defer testServer.Close()
|
||||||
|
|
||||||
|
testCases := []struct {
|
||||||
|
testName string
|
||||||
|
key string
|
||||||
|
updateFn func() //Function to manipulate the controller element to simulate error
|
||||||
|
expectedFn func(error) error //Expected function if returns nil then test passed, failed otherwise
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
testName: "if an invalid service name is synced",
|
||||||
|
key: "invalid/key/string",
|
||||||
|
updateFn: func() {
|
||||||
|
|
||||||
|
// Create a new fake service controller.
|
||||||
|
controller, osClient = newControllerFakeHTTPServer(testServer.URL, "", "")
|
||||||
|
|
||||||
|
},
|
||||||
|
expectedFn: func(e error) error {
|
||||||
|
//TODO: Expected error is of the format fmt.Errorf("unexpected key format: %q", "invalid/key/string"),
|
||||||
|
//TODO: should find a way to test for dependent package errors in such a way that it wont break
|
||||||
|
//TODO: our tests, currently we only test if there is an error.
|
||||||
|
//Error should be non-nil
|
||||||
|
if e == nil {
|
||||||
|
return fmt.Errorf("Expected=unexpected key format: %q, Obtained=nil", "invalid/key/string")
|
||||||
|
}
|
||||||
|
if len(osClient.GetCalledNames()) != 0 {
|
||||||
|
t.Errorf("unexpected openstack client calls: %v", osClient.GetCalledDetails())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
|
/* We cannot open this test case as syncService(key) currently runtime.HandleError(err) and suppresses frequently occurring errors
|
||||||
|
{
|
||||||
|
testName: "if an invalid service is synced",
|
||||||
|
key: "somethingelse",
|
||||||
|
updateFn: func() {
|
||||||
|
// Create a new fake service controller.
|
||||||
|
controller, osClient = newControllerFakeHTTPServer(testServer.URL, "external-balancer", "default")
|
||||||
|
srv := controller.cache.getOrCreate("external-balancer")
|
||||||
|
srv.state = defaultExternalService()
|
||||||
|
},
|
||||||
|
expectedErr: fmt.Errorf("Service somethingelse not in cache even though the watcher thought it was. Ignoring the deletion."),
|
||||||
|
},
|
||||||
|
*/
|
||||||
|
|
||||||
|
//TODO: see if we can add a test for valid but error throwing service, its difficult right now because synCService() currently runtime.HandleError
|
||||||
|
{
|
||||||
|
testName: "if valid service",
|
||||||
|
key: "external-balancer",
|
||||||
|
updateFn: func() {
|
||||||
|
testSvc := defaultExternalService()
|
||||||
|
// Create a new fake service controller.
|
||||||
|
controller, osClient = newControllerFakeHTTPServer(testServer.URL, "external-balancer", "default")
|
||||||
|
controller.enqueueService(testSvc)
|
||||||
|
svc := controller.cache.getOrCreate("external-balancer")
|
||||||
|
svc.state = testSvc
|
||||||
|
},
|
||||||
|
expectedFn: func(e error) error {
|
||||||
|
//error should be nil
|
||||||
|
if e != nil {
|
||||||
|
return fmt.Errorf("Expected=nil, Obtained=%v", e)
|
||||||
|
}
|
||||||
|
if osClient.GetCalledDetails()[0].Name != EnsureLoadBalancerDeleted {
|
||||||
|
t.Errorf("unexpected openstack client calls: %v", osClient.GetCalledDetails())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tc := range testCases {
|
||||||
|
|
||||||
|
tc.updateFn()
|
||||||
|
obtainedErr := controller.syncService(tc.key)
|
||||||
|
|
||||||
|
//expected matches obtained ??.
|
||||||
|
if exp := tc.expectedFn(obtainedErr); exp != nil {
|
||||||
|
t.Errorf("%v Error:%v", tc.testName, exp)
|
||||||
|
}
|
||||||
|
|
||||||
|
//Post processing, the element should not be in the sync queue.
|
||||||
|
_, exist := controller.cache.get(tc.key)
|
||||||
|
if exist {
|
||||||
|
t.Fatalf("%v working Queue should be empty, but contains %s", tc.testName, tc.key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestProcessServiceDeletion(t *testing.T) {
|
||||||
|
|
||||||
|
var controller *ServiceController
|
||||||
|
var osClient *openstack.FakeOSClient
|
||||||
|
|
||||||
|
testServer, _ := makeTestServer(t, "default")
|
||||||
|
defer testServer.Close()
|
||||||
|
//Add a global svcKey name
|
||||||
|
svcKey := "external-balancer"
|
||||||
|
|
||||||
|
testCases := []struct {
|
||||||
|
testName string
|
||||||
|
updateFn func(*ServiceController) //Update function used to manupulate srv and controller values
|
||||||
|
expectedFn func(svcErr error, retryDuration time.Duration) error //Function to check if the returned value is expected
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
testName: "If an non-existant service is deleted",
|
||||||
|
updateFn: func(controller *ServiceController) {
|
||||||
|
//Does not do anything
|
||||||
|
},
|
||||||
|
expectedFn: func(svcErr error, retryDuration time.Duration) error {
|
||||||
|
|
||||||
|
expectedError := "Service external-balancer not in cache even though the watcher thought it was. Ignoring the deletion."
|
||||||
|
if svcErr == nil || svcErr.Error() != expectedError {
|
||||||
|
//cannot be nil or Wrong error message
|
||||||
|
return fmt.Errorf("Expected=%v Obtained=%v", expectedError, svcErr)
|
||||||
|
}
|
||||||
|
|
||||||
|
if retryDuration != doNotRetry {
|
||||||
|
//Retry duration should match
|
||||||
|
return fmt.Errorf("RetryDuration Expected=%v Obtained=%v", doNotRetry, retryDuration)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(osClient.GetCalledNames()) != 0 {
|
||||||
|
t.Errorf("unexpected openstack client calls: %v", osClient.GetCalledDetails())
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testName: "If openstack failed to delete the LoadBalancer",
|
||||||
|
updateFn: func(controller *ServiceController) {
|
||||||
|
|
||||||
|
svc := controller.cache.getOrCreate(svcKey)
|
||||||
|
svc.state = defaultExternalService()
|
||||||
|
osClient.InjectError("EnsureLoadBalancerDeleted", fmt.Errorf("Error Deleting the Loadbalancer"))
|
||||||
|
|
||||||
|
},
|
||||||
|
expectedFn: func(svcErr error, retryDuration time.Duration) error {
|
||||||
|
|
||||||
|
expectedError := "Error Deleting the Loadbalancer"
|
||||||
|
|
||||||
|
if svcErr == nil || svcErr.Error() != expectedError {
|
||||||
|
return fmt.Errorf("Expected=%v Obtained=%v", expectedError, svcErr)
|
||||||
|
}
|
||||||
|
|
||||||
|
if retryDuration != minRetryDelay {
|
||||||
|
return fmt.Errorf("RetryDuration Expected=%v Obtained=%v", minRetryDelay, retryDuration)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(osClient.GetCalledNames()) != 1 && osClient.GetCalledDetails()[0].Name != EnsureLoadBalancerDeleted {
|
||||||
|
t.Errorf("unexpected openstack client calls: %v", osClient.GetCalledDetails())
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testName: "If openstack delete loadbalancer successfully",
|
||||||
|
updateFn: func(controller *ServiceController) {
|
||||||
|
|
||||||
|
testSvc := defaultExternalService()
|
||||||
|
controller.enqueueService(testSvc)
|
||||||
|
svc := controller.cache.getOrCreate(svcKey)
|
||||||
|
svc.state = testSvc
|
||||||
|
controller.cache.set(svcKey, svc)
|
||||||
|
|
||||||
|
},
|
||||||
|
expectedFn: func(svcErr error, retryDuration time.Duration) error {
|
||||||
|
|
||||||
|
if svcErr != nil {
|
||||||
|
return fmt.Errorf("Expected=nil Obtained=%v", svcErr)
|
||||||
|
}
|
||||||
|
|
||||||
|
if retryDuration != doNotRetry {
|
||||||
|
//Retry duration should match
|
||||||
|
return fmt.Errorf("RetryDuration Expected=%v Obtained=%v", doNotRetry, retryDuration)
|
||||||
|
}
|
||||||
|
|
||||||
|
//It should no longer be in the workqueue.
|
||||||
|
_, exist := controller.cache.get(svcKey)
|
||||||
|
if exist {
|
||||||
|
return fmt.Errorf("delete service error, workingQueue should not contain service: %s any more", svcKey)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(osClient.GetCalledNames()) != 0 && osClient.GetCalledDetails()[0].Name != EnsureLoadBalancerDeleted {
|
||||||
|
t.Errorf("unexpected openstack client calls: %v", osClient.GetCalledDetails())
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tc := range testCases {
|
||||||
|
// Create a new fake service controller.
|
||||||
|
controller, osClient = newControllerFakeHTTPServer(testServer.URL, "external-balancer", "default")
|
||||||
|
tc.updateFn(controller)
|
||||||
|
obtainedErr, retryDuration := controller.processServiceDeletion(svcKey)
|
||||||
|
if err := tc.expectedFn(obtainedErr, retryDuration); err != nil {
|
||||||
|
t.Errorf("%v processServiceDeletion() %v", tc.testName, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestDoesExternalLoadBalancerNeedsUpdate(t *testing.T) {
|
||||||
|
|
||||||
|
var oldSvc, newSvc *v1.Service
|
||||||
|
|
||||||
|
testCases := []struct {
|
||||||
|
testName string //Name of the test case
|
||||||
|
updateFn func() //Function to update the service object
|
||||||
|
expectedNeedsUpdate bool //needsupdate always returns bool
|
||||||
|
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
testName: "If the service type is changed from LoadBalancer to ClusterIP",
|
||||||
|
updateFn: func() {
|
||||||
|
oldSvc = defaultExternalService()
|
||||||
|
newSvc = defaultExternalService()
|
||||||
|
newSvc.Spec.Type = v1.ServiceTypeClusterIP
|
||||||
|
},
|
||||||
|
expectedNeedsUpdate: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testName: "If the service's LoadBalancerSourceRanges changed",
|
||||||
|
updateFn: func() {
|
||||||
|
oldSvc = defaultExternalService()
|
||||||
|
newSvc = defaultExternalService()
|
||||||
|
oldSvc.Spec.LoadBalancerSourceRanges = []string{"old load balancer source range"}
|
||||||
|
newSvc.Spec.LoadBalancerSourceRanges = []string{"new load balancer source range"}
|
||||||
|
},
|
||||||
|
expectedNeedsUpdate: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testName: "If the service's LoadBalancer Port are different",
|
||||||
|
updateFn: func() {
|
||||||
|
oldSvc = defaultExternalService()
|
||||||
|
newSvc = defaultExternalService()
|
||||||
|
oldSvc.Spec.Ports = []v1.ServicePort{
|
||||||
|
{
|
||||||
|
Port: 8000,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
newSvc.Spec.Ports = []v1.ServicePort{
|
||||||
|
{
|
||||||
|
Port: 8001,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
expectedNeedsUpdate: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testName: "If externel ip counts are different",
|
||||||
|
updateFn: func() {
|
||||||
|
oldSvc = defaultExternalService()
|
||||||
|
newSvc = defaultExternalService()
|
||||||
|
oldSvc.Spec.ExternalIPs = []string{"old.IP.1"}
|
||||||
|
newSvc.Spec.ExternalIPs = []string{"new.IP.1", "new.IP.2"}
|
||||||
|
},
|
||||||
|
expectedNeedsUpdate: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testName: "If externel ips are different",
|
||||||
|
updateFn: func() {
|
||||||
|
oldSvc = defaultExternalService()
|
||||||
|
newSvc = defaultExternalService()
|
||||||
|
oldSvc.Spec.ExternalIPs = []string{"old.IP.1", "old.IP.2"}
|
||||||
|
newSvc.Spec.ExternalIPs = []string{"new.IP.1", "new.IP.2"}
|
||||||
|
},
|
||||||
|
expectedNeedsUpdate: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testName: "If UID is different",
|
||||||
|
updateFn: func() {
|
||||||
|
oldSvc = defaultExternalService()
|
||||||
|
newSvc = defaultExternalService()
|
||||||
|
oldSvc.UID = types.UID("UID old")
|
||||||
|
newSvc.UID = types.UID("UID new")
|
||||||
|
},
|
||||||
|
expectedNeedsUpdate: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testName: "If ExternalTrafficPolicy is different",
|
||||||
|
updateFn: func() {
|
||||||
|
oldSvc = defaultExternalService()
|
||||||
|
newSvc = defaultExternalService()
|
||||||
|
newSvc.Spec.ExternalTrafficPolicy = v1.ServiceExternalTrafficPolicyTypeLocal
|
||||||
|
},
|
||||||
|
expectedNeedsUpdate: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
controller, _, _ := newController()
|
||||||
|
for _, tc := range testCases {
|
||||||
|
tc.updateFn()
|
||||||
|
obtainedResult := controller.needsUpdate(oldSvc, newSvc)
|
||||||
|
if obtainedResult != tc.expectedNeedsUpdate {
|
||||||
|
t.Errorf("%v needsUpdate() should have returned %v but returned %v", tc.testName, tc.expectedNeedsUpdate, obtainedResult)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//All the testcases for ServiceCache uses a single cache, these below test cases should be run in order,
|
||||||
|
//as tc1 (addCache would add elements to the cache)
|
||||||
|
//and tc2 (delCache would remove element from the cache without it adding automatically)
|
||||||
|
//Please keep this in mind while adding new test cases.
|
||||||
|
func TestServiceCache(t *testing.T) {
|
||||||
|
|
||||||
|
//ServiceCache a common service cache for all the test cases
|
||||||
|
sc := &serviceCache{serviceMap: make(map[string]*cachedService)}
|
||||||
|
|
||||||
|
testCases := []struct {
|
||||||
|
testName string
|
||||||
|
setCacheFn func()
|
||||||
|
checkCacheFn func() error
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
testName: "Add",
|
||||||
|
setCacheFn: func() {
|
||||||
|
cS := sc.getOrCreate("addTest")
|
||||||
|
cS.state = defaultExternalService()
|
||||||
|
},
|
||||||
|
checkCacheFn: func() error {
|
||||||
|
//There must be exactly one element
|
||||||
|
if len(sc.serviceMap) != 1 {
|
||||||
|
return fmt.Errorf("Expected=1 Obtained=%d", len(sc.serviceMap))
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testName: "Del",
|
||||||
|
setCacheFn: func() {
|
||||||
|
sc.delete("addTest")
|
||||||
|
|
||||||
|
},
|
||||||
|
checkCacheFn: func() error {
|
||||||
|
//Now it should have no element
|
||||||
|
if len(sc.serviceMap) != 0 {
|
||||||
|
return fmt.Errorf("Expected=0 Obtained=%d", len(sc.serviceMap))
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testName: "Set and Get",
|
||||||
|
setCacheFn: func() {
|
||||||
|
sc.set("addTest", &cachedService{state: defaultExternalService()})
|
||||||
|
},
|
||||||
|
checkCacheFn: func() error {
|
||||||
|
//Now it should have one element
|
||||||
|
Cs, bool := sc.get("addTest")
|
||||||
|
if !bool {
|
||||||
|
return fmt.Errorf("is Available Expected=true Obtained=%v", bool)
|
||||||
|
}
|
||||||
|
if Cs == nil {
|
||||||
|
return fmt.Errorf("CachedService expected:non-nil Obtained=nil")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testName: "ListKeys",
|
||||||
|
setCacheFn: func() {
|
||||||
|
//Add one more entry here
|
||||||
|
sc.set("addTest1", &cachedService{state: defaultExternalService()})
|
||||||
|
},
|
||||||
|
checkCacheFn: func() error {
|
||||||
|
//It should have two elements
|
||||||
|
keys := sc.ListKeys()
|
||||||
|
if len(keys) != 2 {
|
||||||
|
return fmt.Errorf("Elementes Expected=2 Obtained=%v", len(keys))
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testName: "GetbyKeys",
|
||||||
|
setCacheFn: nil, //Nothing to set
|
||||||
|
checkCacheFn: func() error {
|
||||||
|
//It should have two elements
|
||||||
|
svc, isKey, err := sc.GetByKey("addTest")
|
||||||
|
if svc == nil || isKey == false || err != nil {
|
||||||
|
return fmt.Errorf("Expected(non-nil, true, nil) Obtained(%v,%v,%v)", svc, isKey, err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testName: "allServices",
|
||||||
|
setCacheFn: nil, //Nothing to set
|
||||||
|
checkCacheFn: func() error {
|
||||||
|
//It should return two elements
|
||||||
|
svcArray := sc.allServices()
|
||||||
|
if len(svcArray) != 2 {
|
||||||
|
return fmt.Errorf("Expected(2) Obtained(%v)", len(svcArray))
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tc := range testCases {
|
||||||
|
if tc.setCacheFn != nil {
|
||||||
|
tc.setCacheFn()
|
||||||
|
}
|
||||||
|
if err := tc.checkCacheFn(); err != nil {
|
||||||
|
t.Errorf("%v returned %v", tc.testName, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
33
vendor/github.com/docker/distribution/digest/BUILD
generated
vendored
Normal file
33
vendor/github.com/docker/distribution/digest/BUILD
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
|
"go_library",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = [
|
||||||
|
"digest.go",
|
||||||
|
"digester.go",
|
||||||
|
"doc.go",
|
||||||
|
"set.go",
|
||||||
|
"verifiers.go",
|
||||||
|
],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
)
|
||||||
|
|
||||||
|
filegroup(
|
||||||
|
name = "package-srcs",
|
||||||
|
srcs = glob(["**"]),
|
||||||
|
tags = ["automanaged"],
|
||||||
|
visibility = ["//visibility:private"],
|
||||||
|
)
|
||||||
|
|
||||||
|
filegroup(
|
||||||
|
name = "all-srcs",
|
||||||
|
srcs = [":package-srcs"],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
)
|
139
vendor/github.com/docker/distribution/digest/digest.go
generated
vendored
Normal file
139
vendor/github.com/docker/distribution/digest/digest.go
generated
vendored
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
package digest
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"hash"
|
||||||
|
"io"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// DigestSha256EmptyTar is the canonical sha256 digest of empty data
|
||||||
|
DigestSha256EmptyTar = "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Digest allows simple protection of hex formatted digest strings, prefixed
|
||||||
|
// by their algorithm. Strings of type Digest have some guarantee of being in
|
||||||
|
// the correct format and it provides quick access to the components of a
|
||||||
|
// digest string.
|
||||||
|
//
|
||||||
|
// The following is an example of the contents of Digest types:
|
||||||
|
//
|
||||||
|
// sha256:7173b809ca12ec5dee4506cd86be934c4596dd234ee82c0662eac04a8c2c71dc
|
||||||
|
//
|
||||||
|
// This allows to abstract the digest behind this type and work only in those
|
||||||
|
// terms.
|
||||||
|
type Digest string
|
||||||
|
|
||||||
|
// NewDigest returns a Digest from alg and a hash.Hash object.
|
||||||
|
func NewDigest(alg Algorithm, h hash.Hash) Digest {
|
||||||
|
return NewDigestFromBytes(alg, h.Sum(nil))
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDigestFromBytes returns a new digest from the byte contents of p.
|
||||||
|
// Typically, this can come from hash.Hash.Sum(...) or xxx.SumXXX(...)
|
||||||
|
// functions. This is also useful for rebuilding digests from binary
|
||||||
|
// serializations.
|
||||||
|
func NewDigestFromBytes(alg Algorithm, p []byte) Digest {
|
||||||
|
return Digest(fmt.Sprintf("%s:%x", alg, p))
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDigestFromHex returns a Digest from alg and a the hex encoded digest.
|
||||||
|
func NewDigestFromHex(alg, hex string) Digest {
|
||||||
|
return Digest(fmt.Sprintf("%s:%s", alg, hex))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DigestRegexp matches valid digest types.
|
||||||
|
var DigestRegexp = regexp.MustCompile(`[a-zA-Z0-9-_+.]+:[a-fA-F0-9]+`)
|
||||||
|
|
||||||
|
// DigestRegexpAnchored matches valid digest types, anchored to the start and end of the match.
|
||||||
|
var DigestRegexpAnchored = regexp.MustCompile(`^` + DigestRegexp.String() + `$`)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// ErrDigestInvalidFormat returned when digest format invalid.
|
||||||
|
ErrDigestInvalidFormat = fmt.Errorf("invalid checksum digest format")
|
||||||
|
|
||||||
|
// ErrDigestInvalidLength returned when digest has invalid length.
|
||||||
|
ErrDigestInvalidLength = fmt.Errorf("invalid checksum digest length")
|
||||||
|
|
||||||
|
// ErrDigestUnsupported returned when the digest algorithm is unsupported.
|
||||||
|
ErrDigestUnsupported = fmt.Errorf("unsupported digest algorithm")
|
||||||
|
)
|
||||||
|
|
||||||
|
// ParseDigest parses s and returns the validated digest object. An error will
|
||||||
|
// be returned if the format is invalid.
|
||||||
|
func ParseDigest(s string) (Digest, error) {
|
||||||
|
d := Digest(s)
|
||||||
|
|
||||||
|
return d, d.Validate()
|
||||||
|
}
|
||||||
|
|
||||||
|
// FromReader returns the most valid digest for the underlying content using
|
||||||
|
// the canonical digest algorithm.
|
||||||
|
func FromReader(rd io.Reader) (Digest, error) {
|
||||||
|
return Canonical.FromReader(rd)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FromBytes digests the input and returns a Digest.
|
||||||
|
func FromBytes(p []byte) Digest {
|
||||||
|
return Canonical.FromBytes(p)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate checks that the contents of d is a valid digest, returning an
|
||||||
|
// error if not.
|
||||||
|
func (d Digest) Validate() error {
|
||||||
|
s := string(d)
|
||||||
|
|
||||||
|
if !DigestRegexpAnchored.MatchString(s) {
|
||||||
|
return ErrDigestInvalidFormat
|
||||||
|
}
|
||||||
|
|
||||||
|
i := strings.Index(s, ":")
|
||||||
|
if i < 0 {
|
||||||
|
return ErrDigestInvalidFormat
|
||||||
|
}
|
||||||
|
|
||||||
|
// case: "sha256:" with no hex.
|
||||||
|
if i+1 == len(s) {
|
||||||
|
return ErrDigestInvalidFormat
|
||||||
|
}
|
||||||
|
|
||||||
|
switch algorithm := Algorithm(s[:i]); algorithm {
|
||||||
|
case SHA256, SHA384, SHA512:
|
||||||
|
if algorithm.Size()*2 != len(s[i+1:]) {
|
||||||
|
return ErrDigestInvalidLength
|
||||||
|
}
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
return ErrDigestUnsupported
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Algorithm returns the algorithm portion of the digest. This will panic if
|
||||||
|
// the underlying digest is not in a valid format.
|
||||||
|
func (d Digest) Algorithm() Algorithm {
|
||||||
|
return Algorithm(d[:d.sepIndex()])
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hex returns the hex digest portion of the digest. This will panic if the
|
||||||
|
// underlying digest is not in a valid format.
|
||||||
|
func (d Digest) Hex() string {
|
||||||
|
return string(d[d.sepIndex()+1:])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d Digest) String() string {
|
||||||
|
return string(d)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d Digest) sepIndex() int {
|
||||||
|
i := strings.Index(string(d), ":")
|
||||||
|
|
||||||
|
if i < 0 {
|
||||||
|
panic("could not find ':' in digest: " + d)
|
||||||
|
}
|
||||||
|
|
||||||
|
return i
|
||||||
|
}
|
155
vendor/github.com/docker/distribution/digest/digester.go
generated
vendored
Normal file
155
vendor/github.com/docker/distribution/digest/digester.go
generated
vendored
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
package digest
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto"
|
||||||
|
"fmt"
|
||||||
|
"hash"
|
||||||
|
"io"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Algorithm identifies and implementation of a digester by an identifier.
|
||||||
|
// Note the that this defines both the hash algorithm used and the string
|
||||||
|
// encoding.
|
||||||
|
type Algorithm string
|
||||||
|
|
||||||
|
// supported digest types
|
||||||
|
const (
|
||||||
|
SHA256 Algorithm = "sha256" // sha256 with hex encoding
|
||||||
|
SHA384 Algorithm = "sha384" // sha384 with hex encoding
|
||||||
|
SHA512 Algorithm = "sha512" // sha512 with hex encoding
|
||||||
|
|
||||||
|
// Canonical is the primary digest algorithm used with the distribution
|
||||||
|
// project. Other digests may be used but this one is the primary storage
|
||||||
|
// digest.
|
||||||
|
Canonical = SHA256
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// TODO(stevvooe): Follow the pattern of the standard crypto package for
|
||||||
|
// registration of digests. Effectively, we are a registerable set and
|
||||||
|
// common symbol access.
|
||||||
|
|
||||||
|
// algorithms maps values to hash.Hash implementations. Other algorithms
|
||||||
|
// may be available but they cannot be calculated by the digest package.
|
||||||
|
algorithms = map[Algorithm]crypto.Hash{
|
||||||
|
SHA256: crypto.SHA256,
|
||||||
|
SHA384: crypto.SHA384,
|
||||||
|
SHA512: crypto.SHA512,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// Available returns true if the digest type is available for use. If this
|
||||||
|
// returns false, New and Hash will return nil.
|
||||||
|
func (a Algorithm) Available() bool {
|
||||||
|
h, ok := algorithms[a]
|
||||||
|
if !ok {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// check availability of the hash, as well
|
||||||
|
return h.Available()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a Algorithm) String() string {
|
||||||
|
return string(a)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Size returns number of bytes returned by the hash.
|
||||||
|
func (a Algorithm) Size() int {
|
||||||
|
h, ok := algorithms[a]
|
||||||
|
if !ok {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return h.Size()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set implemented to allow use of Algorithm as a command line flag.
|
||||||
|
func (a *Algorithm) Set(value string) error {
|
||||||
|
if value == "" {
|
||||||
|
*a = Canonical
|
||||||
|
} else {
|
||||||
|
// just do a type conversion, support is queried with Available.
|
||||||
|
*a = Algorithm(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// New returns a new digester for the specified algorithm. If the algorithm
|
||||||
|
// does not have a digester implementation, nil will be returned. This can be
|
||||||
|
// checked by calling Available before calling New.
|
||||||
|
func (a Algorithm) New() Digester {
|
||||||
|
return &digester{
|
||||||
|
alg: a,
|
||||||
|
hash: a.Hash(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hash returns a new hash as used by the algorithm. If not available, the
|
||||||
|
// method will panic. Check Algorithm.Available() before calling.
|
||||||
|
func (a Algorithm) Hash() hash.Hash {
|
||||||
|
if !a.Available() {
|
||||||
|
// NOTE(stevvooe): A missing hash is usually a programming error that
|
||||||
|
// must be resolved at compile time. We don't import in the digest
|
||||||
|
// package to allow users to choose their hash implementation (such as
|
||||||
|
// when using stevvooe/resumable or a hardware accelerated package).
|
||||||
|
//
|
||||||
|
// Applications that may want to resolve the hash at runtime should
|
||||||
|
// call Algorithm.Available before call Algorithm.Hash().
|
||||||
|
panic(fmt.Sprintf("%v not available (make sure it is imported)", a))
|
||||||
|
}
|
||||||
|
|
||||||
|
return algorithms[a].New()
|
||||||
|
}
|
||||||
|
|
||||||
|
// FromReader returns the digest of the reader using the algorithm.
|
||||||
|
func (a Algorithm) FromReader(rd io.Reader) (Digest, error) {
|
||||||
|
digester := a.New()
|
||||||
|
|
||||||
|
if _, err := io.Copy(digester.Hash(), rd); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return digester.Digest(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// FromBytes digests the input and returns a Digest.
|
||||||
|
func (a Algorithm) FromBytes(p []byte) Digest {
|
||||||
|
digester := a.New()
|
||||||
|
|
||||||
|
if _, err := digester.Hash().Write(p); err != nil {
|
||||||
|
// Writes to a Hash should never fail. None of the existing
|
||||||
|
// hash implementations in the stdlib or hashes vendored
|
||||||
|
// here can return errors from Write. Having a panic in this
|
||||||
|
// condition instead of having FromBytes return an error value
|
||||||
|
// avoids unnecessary error handling paths in all callers.
|
||||||
|
panic("write to hash function returned error: " + err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
return digester.Digest()
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO(stevvooe): Allow resolution of verifiers using the digest type and
|
||||||
|
// this registration system.
|
||||||
|
|
||||||
|
// Digester calculates the digest of written data. Writes should go directly
|
||||||
|
// to the return value of Hash, while calling Digest will return the current
|
||||||
|
// value of the digest.
|
||||||
|
type Digester interface {
|
||||||
|
Hash() hash.Hash // provides direct access to underlying hash instance.
|
||||||
|
Digest() Digest
|
||||||
|
}
|
||||||
|
|
||||||
|
// digester provides a simple digester definition that embeds a hasher.
|
||||||
|
type digester struct {
|
||||||
|
alg Algorithm
|
||||||
|
hash hash.Hash
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *digester) Hash() hash.Hash {
|
||||||
|
return d.hash
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *digester) Digest() Digest {
|
||||||
|
return NewDigest(d.alg, d.hash)
|
||||||
|
}
|
42
vendor/github.com/docker/distribution/digest/doc.go
generated
vendored
Normal file
42
vendor/github.com/docker/distribution/digest/doc.go
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
// Package digest provides a generalized type to opaquely represent message
|
||||||
|
// digests and their operations within the registry. The Digest type is
|
||||||
|
// designed to serve as a flexible identifier in a content-addressable system.
|
||||||
|
// More importantly, it provides tools and wrappers to work with
|
||||||
|
// hash.Hash-based digests with little effort.
|
||||||
|
//
|
||||||
|
// Basics
|
||||||
|
//
|
||||||
|
// The format of a digest is simply a string with two parts, dubbed the
|
||||||
|
// "algorithm" and the "digest", separated by a colon:
|
||||||
|
//
|
||||||
|
// <algorithm>:<digest>
|
||||||
|
//
|
||||||
|
// An example of a sha256 digest representation follows:
|
||||||
|
//
|
||||||
|
// sha256:7173b809ca12ec5dee4506cd86be934c4596dd234ee82c0662eac04a8c2c71dc
|
||||||
|
//
|
||||||
|
// In this case, the string "sha256" is the algorithm and the hex bytes are
|
||||||
|
// the "digest".
|
||||||
|
//
|
||||||
|
// Because the Digest type is simply a string, once a valid Digest is
|
||||||
|
// obtained, comparisons are cheap, quick and simple to express with the
|
||||||
|
// standard equality operator.
|
||||||
|
//
|
||||||
|
// Verification
|
||||||
|
//
|
||||||
|
// The main benefit of using the Digest type is simple verification against a
|
||||||
|
// given digest. The Verifier interface, modeled after the stdlib hash.Hash
|
||||||
|
// interface, provides a common write sink for digest verification. After
|
||||||
|
// writing is complete, calling the Verifier.Verified method will indicate
|
||||||
|
// whether or not the stream of bytes matches the target digest.
|
||||||
|
//
|
||||||
|
// Missing Features
|
||||||
|
//
|
||||||
|
// In addition to the above, we intend to add the following features to this
|
||||||
|
// package:
|
||||||
|
//
|
||||||
|
// 1. A Digester type that supports write sink digest calculation.
|
||||||
|
//
|
||||||
|
// 2. Suspend and resume of ongoing digest calculations to support efficient digest verification in the registry.
|
||||||
|
//
|
||||||
|
package digest
|
245
vendor/github.com/docker/distribution/digest/set.go
generated
vendored
Normal file
245
vendor/github.com/docker/distribution/digest/set.go
generated
vendored
Normal file
@ -0,0 +1,245 @@
|
|||||||
|
package digest
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"sort"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// ErrDigestNotFound is used when a matching digest
|
||||||
|
// could not be found in a set.
|
||||||
|
ErrDigestNotFound = errors.New("digest not found")
|
||||||
|
|
||||||
|
// ErrDigestAmbiguous is used when multiple digests
|
||||||
|
// are found in a set. None of the matching digests
|
||||||
|
// should be considered valid matches.
|
||||||
|
ErrDigestAmbiguous = errors.New("ambiguous digest string")
|
||||||
|
)
|
||||||
|
|
||||||
|
// Set is used to hold a unique set of digests which
|
||||||
|
// may be easily referenced by easily referenced by a string
|
||||||
|
// representation of the digest as well as short representation.
|
||||||
|
// The uniqueness of the short representation is based on other
|
||||||
|
// digests in the set. If digests are omitted from this set,
|
||||||
|
// collisions in a larger set may not be detected, therefore it
|
||||||
|
// is important to always do short representation lookups on
|
||||||
|
// the complete set of digests. To mitigate collisions, an
|
||||||
|
// appropriately long short code should be used.
|
||||||
|
type Set struct {
|
||||||
|
mutex sync.RWMutex
|
||||||
|
entries digestEntries
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewSet creates an empty set of digests
|
||||||
|
// which may have digests added.
|
||||||
|
func NewSet() *Set {
|
||||||
|
return &Set{
|
||||||
|
entries: digestEntries{},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// checkShortMatch checks whether two digests match as either whole
|
||||||
|
// values or short values. This function does not test equality,
|
||||||
|
// rather whether the second value could match against the first
|
||||||
|
// value.
|
||||||
|
func checkShortMatch(alg Algorithm, hex, shortAlg, shortHex string) bool {
|
||||||
|
if len(hex) == len(shortHex) {
|
||||||
|
if hex != shortHex {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if len(shortAlg) > 0 && string(alg) != shortAlg {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else if !strings.HasPrefix(hex, shortHex) {
|
||||||
|
return false
|
||||||
|
} else if len(shortAlg) > 0 && string(alg) != shortAlg {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lookup looks for a digest matching the given string representation.
|
||||||
|
// If no digests could be found ErrDigestNotFound will be returned
|
||||||
|
// with an empty digest value. If multiple matches are found
|
||||||
|
// ErrDigestAmbiguous will be returned with an empty digest value.
|
||||||
|
func (dst *Set) Lookup(d string) (Digest, error) {
|
||||||
|
dst.mutex.RLock()
|
||||||
|
defer dst.mutex.RUnlock()
|
||||||
|
if len(dst.entries) == 0 {
|
||||||
|
return "", ErrDigestNotFound
|
||||||
|
}
|
||||||
|
var (
|
||||||
|
searchFunc func(int) bool
|
||||||
|
alg Algorithm
|
||||||
|
hex string
|
||||||
|
)
|
||||||
|
dgst, err := ParseDigest(d)
|
||||||
|
if err == ErrDigestInvalidFormat {
|
||||||
|
hex = d
|
||||||
|
searchFunc = func(i int) bool {
|
||||||
|
return dst.entries[i].val >= d
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
hex = dgst.Hex()
|
||||||
|
alg = dgst.Algorithm()
|
||||||
|
searchFunc = func(i int) bool {
|
||||||
|
if dst.entries[i].val == hex {
|
||||||
|
return dst.entries[i].alg >= alg
|
||||||
|
}
|
||||||
|
return dst.entries[i].val >= hex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
idx := sort.Search(len(dst.entries), searchFunc)
|
||||||
|
if idx == len(dst.entries) || !checkShortMatch(dst.entries[idx].alg, dst.entries[idx].val, string(alg), hex) {
|
||||||
|
return "", ErrDigestNotFound
|
||||||
|
}
|
||||||
|
if dst.entries[idx].alg == alg && dst.entries[idx].val == hex {
|
||||||
|
return dst.entries[idx].digest, nil
|
||||||
|
}
|
||||||
|
if idx+1 < len(dst.entries) && checkShortMatch(dst.entries[idx+1].alg, dst.entries[idx+1].val, string(alg), hex) {
|
||||||
|
return "", ErrDigestAmbiguous
|
||||||
|
}
|
||||||
|
|
||||||
|
return dst.entries[idx].digest, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add adds the given digest to the set. An error will be returned
|
||||||
|
// if the given digest is invalid. If the digest already exists in the
|
||||||
|
// set, this operation will be a no-op.
|
||||||
|
func (dst *Set) Add(d Digest) error {
|
||||||
|
if err := d.Validate(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
dst.mutex.Lock()
|
||||||
|
defer dst.mutex.Unlock()
|
||||||
|
entry := &digestEntry{alg: d.Algorithm(), val: d.Hex(), digest: d}
|
||||||
|
searchFunc := func(i int) bool {
|
||||||
|
if dst.entries[i].val == entry.val {
|
||||||
|
return dst.entries[i].alg >= entry.alg
|
||||||
|
}
|
||||||
|
return dst.entries[i].val >= entry.val
|
||||||
|
}
|
||||||
|
idx := sort.Search(len(dst.entries), searchFunc)
|
||||||
|
if idx == len(dst.entries) {
|
||||||
|
dst.entries = append(dst.entries, entry)
|
||||||
|
return nil
|
||||||
|
} else if dst.entries[idx].digest == d {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
entries := append(dst.entries, nil)
|
||||||
|
copy(entries[idx+1:], entries[idx:len(entries)-1])
|
||||||
|
entries[idx] = entry
|
||||||
|
dst.entries = entries
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove removes the given digest from the set. An err will be
|
||||||
|
// returned if the given digest is invalid. If the digest does
|
||||||
|
// not exist in the set, this operation will be a no-op.
|
||||||
|
func (dst *Set) Remove(d Digest) error {
|
||||||
|
if err := d.Validate(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
dst.mutex.Lock()
|
||||||
|
defer dst.mutex.Unlock()
|
||||||
|
entry := &digestEntry{alg: d.Algorithm(), val: d.Hex(), digest: d}
|
||||||
|
searchFunc := func(i int) bool {
|
||||||
|
if dst.entries[i].val == entry.val {
|
||||||
|
return dst.entries[i].alg >= entry.alg
|
||||||
|
}
|
||||||
|
return dst.entries[i].val >= entry.val
|
||||||
|
}
|
||||||
|
idx := sort.Search(len(dst.entries), searchFunc)
|
||||||
|
// Not found if idx is after or value at idx is not digest
|
||||||
|
if idx == len(dst.entries) || dst.entries[idx].digest != d {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
entries := dst.entries
|
||||||
|
copy(entries[idx:], entries[idx+1:])
|
||||||
|
entries = entries[:len(entries)-1]
|
||||||
|
dst.entries = entries
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// All returns all the digests in the set
|
||||||
|
func (dst *Set) All() []Digest {
|
||||||
|
dst.mutex.RLock()
|
||||||
|
defer dst.mutex.RUnlock()
|
||||||
|
retValues := make([]Digest, len(dst.entries))
|
||||||
|
for i := range dst.entries {
|
||||||
|
retValues[i] = dst.entries[i].digest
|
||||||
|
}
|
||||||
|
|
||||||
|
return retValues
|
||||||
|
}
|
||||||
|
|
||||||
|
// ShortCodeTable returns a map of Digest to unique short codes. The
|
||||||
|
// length represents the minimum value, the maximum length may be the
|
||||||
|
// entire value of digest if uniqueness cannot be achieved without the
|
||||||
|
// full value. This function will attempt to make short codes as short
|
||||||
|
// as possible to be unique.
|
||||||
|
func ShortCodeTable(dst *Set, length int) map[Digest]string {
|
||||||
|
dst.mutex.RLock()
|
||||||
|
defer dst.mutex.RUnlock()
|
||||||
|
m := make(map[Digest]string, len(dst.entries))
|
||||||
|
l := length
|
||||||
|
resetIdx := 0
|
||||||
|
for i := 0; i < len(dst.entries); i++ {
|
||||||
|
var short string
|
||||||
|
extended := true
|
||||||
|
for extended {
|
||||||
|
extended = false
|
||||||
|
if len(dst.entries[i].val) <= l {
|
||||||
|
short = dst.entries[i].digest.String()
|
||||||
|
} else {
|
||||||
|
short = dst.entries[i].val[:l]
|
||||||
|
for j := i + 1; j < len(dst.entries); j++ {
|
||||||
|
if checkShortMatch(dst.entries[j].alg, dst.entries[j].val, "", short) {
|
||||||
|
if j > resetIdx {
|
||||||
|
resetIdx = j
|
||||||
|
}
|
||||||
|
extended = true
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if extended {
|
||||||
|
l++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m[dst.entries[i].digest] = short
|
||||||
|
if i >= resetIdx {
|
||||||
|
l = length
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
|
||||||
|
type digestEntry struct {
|
||||||
|
alg Algorithm
|
||||||
|
val string
|
||||||
|
digest Digest
|
||||||
|
}
|
||||||
|
|
||||||
|
type digestEntries []*digestEntry
|
||||||
|
|
||||||
|
func (d digestEntries) Len() int {
|
||||||
|
return len(d)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d digestEntries) Less(i, j int) bool {
|
||||||
|
if d[i].val != d[j].val {
|
||||||
|
return d[i].val < d[j].val
|
||||||
|
}
|
||||||
|
return d[i].alg < d[j].alg
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d digestEntries) Swap(i, j int) {
|
||||||
|
d[i], d[j] = d[j], d[i]
|
||||||
|
}
|
44
vendor/github.com/docker/distribution/digest/verifiers.go
generated
vendored
Normal file
44
vendor/github.com/docker/distribution/digest/verifiers.go
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package digest
|
||||||
|
|
||||||
|
import (
|
||||||
|
"hash"
|
||||||
|
"io"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Verifier presents a general verification interface to be used with message
|
||||||
|
// digests and other byte stream verifications. Users instantiate a Verifier
|
||||||
|
// from one of the various methods, write the data under test to it then check
|
||||||
|
// the result with the Verified method.
|
||||||
|
type Verifier interface {
|
||||||
|
io.Writer
|
||||||
|
|
||||||
|
// Verified will return true if the content written to Verifier matches
|
||||||
|
// the digest.
|
||||||
|
Verified() bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDigestVerifier returns a verifier that compares the written bytes
|
||||||
|
// against a passed in digest.
|
||||||
|
func NewDigestVerifier(d Digest) (Verifier, error) {
|
||||||
|
if err := d.Validate(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return hashVerifier{
|
||||||
|
hash: d.Algorithm().Hash(),
|
||||||
|
digest: d,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type hashVerifier struct {
|
||||||
|
digest Digest
|
||||||
|
hash hash.Hash
|
||||||
|
}
|
||||||
|
|
||||||
|
func (hv hashVerifier) Write(p []byte) (n int, err error) {
|
||||||
|
return hv.hash.Write(p)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (hv hashVerifier) Verified() bool {
|
||||||
|
return hv.digest == NewDigest(hv.digest.Algorithm(), hv.hash)
|
||||||
|
}
|
31
vendor/github.com/docker/distribution/reference/BUILD
generated
vendored
Normal file
31
vendor/github.com/docker/distribution/reference/BUILD
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
|
"go_library",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = [
|
||||||
|
"reference.go",
|
||||||
|
"regexp.go",
|
||||||
|
],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
deps = ["//vendor/github.com/docker/distribution/digest:go_default_library"],
|
||||||
|
)
|
||||||
|
|
||||||
|
filegroup(
|
||||||
|
name = "package-srcs",
|
||||||
|
srcs = glob(["**"]),
|
||||||
|
tags = ["automanaged"],
|
||||||
|
visibility = ["//visibility:private"],
|
||||||
|
)
|
||||||
|
|
||||||
|
filegroup(
|
||||||
|
name = "all-srcs",
|
||||||
|
srcs = [":package-srcs"],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
)
|
334
vendor/github.com/docker/distribution/reference/reference.go
generated
vendored
Normal file
334
vendor/github.com/docker/distribution/reference/reference.go
generated
vendored
Normal file
@ -0,0 +1,334 @@
|
|||||||
|
// Package reference provides a general type to represent any way of referencing images within the registry.
|
||||||
|
// Its main purpose is to abstract tags and digests (content-addressable hash).
|
||||||
|
//
|
||||||
|
// Grammar
|
||||||
|
//
|
||||||
|
// reference := name [ ":" tag ] [ "@" digest ]
|
||||||
|
// name := [hostname '/'] component ['/' component]*
|
||||||
|
// hostname := hostcomponent ['.' hostcomponent]* [':' port-number]
|
||||||
|
// hostcomponent := /([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])/
|
||||||
|
// port-number := /[0-9]+/
|
||||||
|
// component := alpha-numeric [separator alpha-numeric]*
|
||||||
|
// alpha-numeric := /[a-z0-9]+/
|
||||||
|
// separator := /[_.]|__|[-]*/
|
||||||
|
//
|
||||||
|
// tag := /[\w][\w.-]{0,127}/
|
||||||
|
//
|
||||||
|
// digest := digest-algorithm ":" digest-hex
|
||||||
|
// digest-algorithm := digest-algorithm-component [ digest-algorithm-separator digest-algorithm-component ]
|
||||||
|
// digest-algorithm-separator := /[+.-_]/
|
||||||
|
// digest-algorithm-component := /[A-Za-z][A-Za-z0-9]*/
|
||||||
|
// digest-hex := /[0-9a-fA-F]{32,}/ ; At least 128 bit digest value
|
||||||
|
package reference
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/docker/distribution/digest"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// NameTotalLengthMax is the maximum total number of characters in a repository name.
|
||||||
|
NameTotalLengthMax = 255
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// ErrReferenceInvalidFormat represents an error while trying to parse a string as a reference.
|
||||||
|
ErrReferenceInvalidFormat = errors.New("invalid reference format")
|
||||||
|
|
||||||
|
// ErrTagInvalidFormat represents an error while trying to parse a string as a tag.
|
||||||
|
ErrTagInvalidFormat = errors.New("invalid tag format")
|
||||||
|
|
||||||
|
// ErrDigestInvalidFormat represents an error while trying to parse a string as a tag.
|
||||||
|
ErrDigestInvalidFormat = errors.New("invalid digest format")
|
||||||
|
|
||||||
|
// ErrNameEmpty is returned for empty, invalid repository names.
|
||||||
|
ErrNameEmpty = errors.New("repository name must have at least one component")
|
||||||
|
|
||||||
|
// ErrNameTooLong is returned when a repository name is longer than NameTotalLengthMax.
|
||||||
|
ErrNameTooLong = fmt.Errorf("repository name must not be more than %v characters", NameTotalLengthMax)
|
||||||
|
)
|
||||||
|
|
||||||
|
// Reference is an opaque object reference identifier that may include
|
||||||
|
// modifiers such as a hostname, name, tag, and digest.
|
||||||
|
type Reference interface {
|
||||||
|
// String returns the full reference
|
||||||
|
String() string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Field provides a wrapper type for resolving correct reference types when
|
||||||
|
// working with encoding.
|
||||||
|
type Field struct {
|
||||||
|
reference Reference
|
||||||
|
}
|
||||||
|
|
||||||
|
// AsField wraps a reference in a Field for encoding.
|
||||||
|
func AsField(reference Reference) Field {
|
||||||
|
return Field{reference}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reference unwraps the reference type from the field to
|
||||||
|
// return the Reference object. This object should be
|
||||||
|
// of the appropriate type to further check for different
|
||||||
|
// reference types.
|
||||||
|
func (f Field) Reference() Reference {
|
||||||
|
return f.reference
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalText serializes the field to byte text which
|
||||||
|
// is the string of the reference.
|
||||||
|
func (f Field) MarshalText() (p []byte, err error) {
|
||||||
|
return []byte(f.reference.String()), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalText parses text bytes by invoking the
|
||||||
|
// reference parser to ensure the appropriately
|
||||||
|
// typed reference object is wrapped by field.
|
||||||
|
func (f *Field) UnmarshalText(p []byte) error {
|
||||||
|
r, err := Parse(string(p))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
f.reference = r
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Named is an object with a full name
|
||||||
|
type Named interface {
|
||||||
|
Reference
|
||||||
|
Name() string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tagged is an object which has a tag
|
||||||
|
type Tagged interface {
|
||||||
|
Reference
|
||||||
|
Tag() string
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedTagged is an object including a name and tag.
|
||||||
|
type NamedTagged interface {
|
||||||
|
Named
|
||||||
|
Tag() string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Digested is an object which has a digest
|
||||||
|
// in which it can be referenced by
|
||||||
|
type Digested interface {
|
||||||
|
Reference
|
||||||
|
Digest() digest.Digest
|
||||||
|
}
|
||||||
|
|
||||||
|
// Canonical reference is an object with a fully unique
|
||||||
|
// name including a name with hostname and digest
|
||||||
|
type Canonical interface {
|
||||||
|
Named
|
||||||
|
Digest() digest.Digest
|
||||||
|
}
|
||||||
|
|
||||||
|
// SplitHostname splits a named reference into a
|
||||||
|
// hostname and name string. If no valid hostname is
|
||||||
|
// found, the hostname is empty and the full value
|
||||||
|
// is returned as name
|
||||||
|
func SplitHostname(named Named) (string, string) {
|
||||||
|
name := named.Name()
|
||||||
|
match := anchoredNameRegexp.FindStringSubmatch(name)
|
||||||
|
if match == nil || len(match) != 3 {
|
||||||
|
return "", name
|
||||||
|
}
|
||||||
|
return match[1], match[2]
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse parses s and returns a syntactically valid Reference.
|
||||||
|
// If an error was encountered it is returned, along with a nil Reference.
|
||||||
|
// NOTE: Parse will not handle short digests.
|
||||||
|
func Parse(s string) (Reference, error) {
|
||||||
|
matches := ReferenceRegexp.FindStringSubmatch(s)
|
||||||
|
if matches == nil {
|
||||||
|
if s == "" {
|
||||||
|
return nil, ErrNameEmpty
|
||||||
|
}
|
||||||
|
// TODO(dmcgowan): Provide more specific and helpful error
|
||||||
|
return nil, ErrReferenceInvalidFormat
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(matches[1]) > NameTotalLengthMax {
|
||||||
|
return nil, ErrNameTooLong
|
||||||
|
}
|
||||||
|
|
||||||
|
ref := reference{
|
||||||
|
name: matches[1],
|
||||||
|
tag: matches[2],
|
||||||
|
}
|
||||||
|
if matches[3] != "" {
|
||||||
|
var err error
|
||||||
|
ref.digest, err = digest.ParseDigest(matches[3])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
r := getBestReferenceType(ref)
|
||||||
|
if r == nil {
|
||||||
|
return nil, ErrNameEmpty
|
||||||
|
}
|
||||||
|
|
||||||
|
return r, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ParseNamed parses s and returns a syntactically valid reference implementing
|
||||||
|
// the Named interface. The reference must have a name, otherwise an error is
|
||||||
|
// returned.
|
||||||
|
// If an error was encountered it is returned, along with a nil Reference.
|
||||||
|
// NOTE: ParseNamed will not handle short digests.
|
||||||
|
func ParseNamed(s string) (Named, error) {
|
||||||
|
ref, err := Parse(s)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
named, isNamed := ref.(Named)
|
||||||
|
if !isNamed {
|
||||||
|
return nil, fmt.Errorf("reference %s has no name", ref.String())
|
||||||
|
}
|
||||||
|
return named, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithName returns a named object representing the given string. If the input
|
||||||
|
// is invalid ErrReferenceInvalidFormat will be returned.
|
||||||
|
func WithName(name string) (Named, error) {
|
||||||
|
if len(name) > NameTotalLengthMax {
|
||||||
|
return nil, ErrNameTooLong
|
||||||
|
}
|
||||||
|
if !anchoredNameRegexp.MatchString(name) {
|
||||||
|
return nil, ErrReferenceInvalidFormat
|
||||||
|
}
|
||||||
|
return repository(name), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTag combines the name from "name" and the tag from "tag" to form a
|
||||||
|
// reference incorporating both the name and the tag.
|
||||||
|
func WithTag(name Named, tag string) (NamedTagged, error) {
|
||||||
|
if !anchoredTagRegexp.MatchString(tag) {
|
||||||
|
return nil, ErrTagInvalidFormat
|
||||||
|
}
|
||||||
|
return taggedReference{
|
||||||
|
name: name.Name(),
|
||||||
|
tag: tag,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDigest combines the name from "name" and the digest from "digest" to form
|
||||||
|
// a reference incorporating both the name and the digest.
|
||||||
|
func WithDigest(name Named, digest digest.Digest) (Canonical, error) {
|
||||||
|
if !anchoredDigestRegexp.MatchString(digest.String()) {
|
||||||
|
return nil, ErrDigestInvalidFormat
|
||||||
|
}
|
||||||
|
return canonicalReference{
|
||||||
|
name: name.Name(),
|
||||||
|
digest: digest,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func getBestReferenceType(ref reference) Reference {
|
||||||
|
if ref.name == "" {
|
||||||
|
// Allow digest only references
|
||||||
|
if ref.digest != "" {
|
||||||
|
return digestReference(ref.digest)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if ref.tag == "" {
|
||||||
|
if ref.digest != "" {
|
||||||
|
return canonicalReference{
|
||||||
|
name: ref.name,
|
||||||
|
digest: ref.digest,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return repository(ref.name)
|
||||||
|
}
|
||||||
|
if ref.digest == "" {
|
||||||
|
return taggedReference{
|
||||||
|
name: ref.name,
|
||||||
|
tag: ref.tag,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ref
|
||||||
|
}
|
||||||
|
|
||||||
|
type reference struct {
|
||||||
|
name string
|
||||||
|
tag string
|
||||||
|
digest digest.Digest
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r reference) String() string {
|
||||||
|
return r.name + ":" + r.tag + "@" + r.digest.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r reference) Name() string {
|
||||||
|
return r.name
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r reference) Tag() string {
|
||||||
|
return r.tag
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r reference) Digest() digest.Digest {
|
||||||
|
return r.digest
|
||||||
|
}
|
||||||
|
|
||||||
|
type repository string
|
||||||
|
|
||||||
|
func (r repository) String() string {
|
||||||
|
return string(r)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r repository) Name() string {
|
||||||
|
return string(r)
|
||||||
|
}
|
||||||
|
|
||||||
|
type digestReference digest.Digest
|
||||||
|
|
||||||
|
func (d digestReference) String() string {
|
||||||
|
return d.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d digestReference) Digest() digest.Digest {
|
||||||
|
return digest.Digest(d)
|
||||||
|
}
|
||||||
|
|
||||||
|
type taggedReference struct {
|
||||||
|
name string
|
||||||
|
tag string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t taggedReference) String() string {
|
||||||
|
return t.name + ":" + t.tag
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t taggedReference) Name() string {
|
||||||
|
return t.name
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t taggedReference) Tag() string {
|
||||||
|
return t.tag
|
||||||
|
}
|
||||||
|
|
||||||
|
type canonicalReference struct {
|
||||||
|
name string
|
||||||
|
digest digest.Digest
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c canonicalReference) String() string {
|
||||||
|
return c.name + "@" + c.digest.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c canonicalReference) Name() string {
|
||||||
|
return c.name
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c canonicalReference) Digest() digest.Digest {
|
||||||
|
return c.digest
|
||||||
|
}
|
124
vendor/github.com/docker/distribution/reference/regexp.go
generated
vendored
Normal file
124
vendor/github.com/docker/distribution/reference/regexp.go
generated
vendored
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
package reference
|
||||||
|
|
||||||
|
import "regexp"
|
||||||
|
|
||||||
|
var (
|
||||||
|
// alphaNumericRegexp defines the alpha numeric atom, typically a
|
||||||
|
// component of names. This only allows lower case characters and digits.
|
||||||
|
alphaNumericRegexp = match(`[a-z0-9]+`)
|
||||||
|
|
||||||
|
// separatorRegexp defines the separators allowed to be embedded in name
|
||||||
|
// components. This allow one period, one or two underscore and multiple
|
||||||
|
// dashes.
|
||||||
|
separatorRegexp = match(`(?:[._]|__|[-]*)`)
|
||||||
|
|
||||||
|
// nameComponentRegexp restricts registry path component names to start
|
||||||
|
// with at least one letter or number, with following parts able to be
|
||||||
|
// separated by one period, one or two underscore and multiple dashes.
|
||||||
|
nameComponentRegexp = expression(
|
||||||
|
alphaNumericRegexp,
|
||||||
|
optional(repeated(separatorRegexp, alphaNumericRegexp)))
|
||||||
|
|
||||||
|
// hostnameComponentRegexp restricts the registry hostname component of a
|
||||||
|
// repository name to start with a component as defined by hostnameRegexp
|
||||||
|
// and followed by an optional port.
|
||||||
|
hostnameComponentRegexp = match(`(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])`)
|
||||||
|
|
||||||
|
// hostnameRegexp defines the structure of potential hostname components
|
||||||
|
// that may be part of image names. This is purposely a subset of what is
|
||||||
|
// allowed by DNS to ensure backwards compatibility with Docker image
|
||||||
|
// names.
|
||||||
|
hostnameRegexp = expression(
|
||||||
|
hostnameComponentRegexp,
|
||||||
|
optional(repeated(literal(`.`), hostnameComponentRegexp)),
|
||||||
|
optional(literal(`:`), match(`[0-9]+`)))
|
||||||
|
|
||||||
|
// TagRegexp matches valid tag names. From docker/docker:graph/tags.go.
|
||||||
|
TagRegexp = match(`[\w][\w.-]{0,127}`)
|
||||||
|
|
||||||
|
// anchoredTagRegexp matches valid tag names, anchored at the start and
|
||||||
|
// end of the matched string.
|
||||||
|
anchoredTagRegexp = anchored(TagRegexp)
|
||||||
|
|
||||||
|
// DigestRegexp matches valid digests.
|
||||||
|
DigestRegexp = match(`[A-Za-z][A-Za-z0-9]*(?:[-_+.][A-Za-z][A-Za-z0-9]*)*[:][[:xdigit:]]{32,}`)
|
||||||
|
|
||||||
|
// anchoredDigestRegexp matches valid digests, anchored at the start and
|
||||||
|
// end of the matched string.
|
||||||
|
anchoredDigestRegexp = anchored(DigestRegexp)
|
||||||
|
|
||||||
|
// NameRegexp is the format for the name component of references. The
|
||||||
|
// regexp has capturing groups for the hostname and name part omitting
|
||||||
|
// the separating forward slash from either.
|
||||||
|
NameRegexp = expression(
|
||||||
|
optional(hostnameRegexp, literal(`/`)),
|
||||||
|
nameComponentRegexp,
|
||||||
|
optional(repeated(literal(`/`), nameComponentRegexp)))
|
||||||
|
|
||||||
|
// anchoredNameRegexp is used to parse a name value, capturing the
|
||||||
|
// hostname and trailing components.
|
||||||
|
anchoredNameRegexp = anchored(
|
||||||
|
optional(capture(hostnameRegexp), literal(`/`)),
|
||||||
|
capture(nameComponentRegexp,
|
||||||
|
optional(repeated(literal(`/`), nameComponentRegexp))))
|
||||||
|
|
||||||
|
// ReferenceRegexp is the full supported format of a reference. The regexp
|
||||||
|
// is anchored and has capturing groups for name, tag, and digest
|
||||||
|
// components.
|
||||||
|
ReferenceRegexp = anchored(capture(NameRegexp),
|
||||||
|
optional(literal(":"), capture(TagRegexp)),
|
||||||
|
optional(literal("@"), capture(DigestRegexp)))
|
||||||
|
)
|
||||||
|
|
||||||
|
// match compiles the string to a regular expression.
|
||||||
|
var match = regexp.MustCompile
|
||||||
|
|
||||||
|
// literal compiles s into a literal regular expression, escaping any regexp
|
||||||
|
// reserved characters.
|
||||||
|
func literal(s string) *regexp.Regexp {
|
||||||
|
re := match(regexp.QuoteMeta(s))
|
||||||
|
|
||||||
|
if _, complete := re.LiteralPrefix(); !complete {
|
||||||
|
panic("must be a literal")
|
||||||
|
}
|
||||||
|
|
||||||
|
return re
|
||||||
|
}
|
||||||
|
|
||||||
|
// expression defines a full expression, where each regular expression must
|
||||||
|
// follow the previous.
|
||||||
|
func expression(res ...*regexp.Regexp) *regexp.Regexp {
|
||||||
|
var s string
|
||||||
|
for _, re := range res {
|
||||||
|
s += re.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
return match(s)
|
||||||
|
}
|
||||||
|
|
||||||
|
// optional wraps the expression in a non-capturing group and makes the
|
||||||
|
// production optional.
|
||||||
|
func optional(res ...*regexp.Regexp) *regexp.Regexp {
|
||||||
|
return match(group(expression(res...)).String() + `?`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// repeated wraps the regexp in a non-capturing group to get one or more
|
||||||
|
// matches.
|
||||||
|
func repeated(res ...*regexp.Regexp) *regexp.Regexp {
|
||||||
|
return match(group(expression(res...)).String() + `+`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// group wraps the regexp in a non-capturing group.
|
||||||
|
func group(res ...*regexp.Regexp) *regexp.Regexp {
|
||||||
|
return match(`(?:` + expression(res...).String() + `)`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// capture wraps the expression in a capturing group.
|
||||||
|
func capture(res ...*regexp.Regexp) *regexp.Regexp {
|
||||||
|
return match(`(` + expression(res...).String() + `)`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// anchored anchors the regular expression by adding start and end delimiters.
|
||||||
|
func anchored(res ...*regexp.Regexp) *regexp.Regexp {
|
||||||
|
return match(`^` + expression(res...).String() + `$`)
|
||||||
|
}
|
33
vendor/k8s.io/api/admission/v1alpha1/BUILD
generated
vendored
Normal file
33
vendor/k8s.io/api/admission/v1alpha1/BUILD
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
|
"go_library",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = [
|
||||||
|
"doc.go",
|
||||||
|
"generated.pb.go",
|
||||||
|
"register.go",
|
||||||
|
"types.generated.go",
|
||||||
|
"types.go",
|
||||||
|
"types_swagger_doc_generated.go",
|
||||||
|
"zz_generated.deepcopy.go",
|
||||||
|
],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
deps = [
|
||||||
|
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
|
||||||
|
"//vendor/github.com/ugorji/go/codec:go_default_library",
|
||||||
|
"//vendor/k8s.io/api/authentication/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||||
|
"//vendor/k8s.io/apiserver/pkg/admission:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
21
vendor/k8s.io/api/admission/v1alpha1/doc.go
generated
vendored
Normal file
21
vendor/k8s.io/api/admission/v1alpha1/doc.go
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen=package,register
|
||||||
|
// +k8s:openapi-gen=false
|
||||||
|
|
||||||
|
// +groupName=admission.k8s.io
|
||||||
|
package v1alpha1 // import "k8s.io/api/admission/v1alpha1"
|
1034
vendor/k8s.io/api/admission/v1alpha1/generated.pb.go
generated
vendored
Normal file
1034
vendor/k8s.io/api/admission/v1alpha1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
95
vendor/k8s.io/api/admission/v1alpha1/generated.proto
generated
vendored
Normal file
95
vendor/k8s.io/api/admission/v1alpha1/generated.proto
generated
vendored
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
/*
|
||||||
|
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 was autogenerated by go-to-protobuf. Do not edit it manually!
|
||||||
|
|
||||||
|
syntax = 'proto2';
|
||||||
|
|
||||||
|
package k8s.io.api.admission.v1alpha1;
|
||||||
|
|
||||||
|
import "k8s.io/api/authentication/v1/generated.proto";
|
||||||
|
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
|
||||||
|
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
|
||||||
|
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
|
||||||
|
import "k8s.io/apimachinery/pkg/util/intstr/generated.proto";
|
||||||
|
|
||||||
|
// Package-wide variables from generator "generated".
|
||||||
|
option go_package = "v1alpha1";
|
||||||
|
|
||||||
|
// AdmissionReview describes an admission request.
|
||||||
|
message AdmissionReview {
|
||||||
|
// Spec describes the attributes for the admission request.
|
||||||
|
// Since this admission controller is non-mutating the webhook should avoid setting this in its response to avoid the
|
||||||
|
// cost of deserializing it.
|
||||||
|
// +optional
|
||||||
|
optional AdmissionReviewSpec spec = 1;
|
||||||
|
|
||||||
|
// Status is filled in by the webhook and indicates whether the admission request should be permitted.
|
||||||
|
// +optional
|
||||||
|
optional AdmissionReviewStatus status = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AdmissionReviewSpec describes the admission.Attributes for the admission request.
|
||||||
|
message AdmissionReviewSpec {
|
||||||
|
// Kind is the type of object being manipulated. For example: Pod
|
||||||
|
optional k8s.io.apimachinery.pkg.apis.meta.v1.GroupVersionKind kind = 1;
|
||||||
|
|
||||||
|
// Object is the object from the incoming request prior to default values being applied
|
||||||
|
optional k8s.io.apimachinery.pkg.runtime.RawExtension object = 2;
|
||||||
|
|
||||||
|
// OldObject is the existing object. Only populated for UPDATE requests.
|
||||||
|
// +optional
|
||||||
|
optional k8s.io.apimachinery.pkg.runtime.RawExtension oldObject = 3;
|
||||||
|
|
||||||
|
// Operation is the operation being performed
|
||||||
|
optional string operation = 4;
|
||||||
|
|
||||||
|
// Name is the name of the object as presented in the request. On a CREATE operation, the client may omit name and
|
||||||
|
// rely on the server to generate the name. If that is the case, this method will return the empty string.
|
||||||
|
// +optional
|
||||||
|
optional string name = 5;
|
||||||
|
|
||||||
|
// Namespace is the namespace associated with the request (if any).
|
||||||
|
// +optional
|
||||||
|
optional string namespace = 6;
|
||||||
|
|
||||||
|
// Resource is the name of the resource being requested. This is not the kind. For example: pods
|
||||||
|
optional k8s.io.apimachinery.pkg.apis.meta.v1.GroupVersionResource resource = 7;
|
||||||
|
|
||||||
|
// SubResource is the name of the subresource being requested. This is a different resource, scoped to the parent
|
||||||
|
// resource, but it may have a different kind. For instance, /pods has the resource "pods" and the kind "Pod", while
|
||||||
|
// /pods/foo/status has the resource "pods", the sub resource "status", and the kind "Pod" (because status operates on
|
||||||
|
// pods). The binding resource for a pod though may be /pods/foo/binding, which has resource "pods", subresource
|
||||||
|
// "binding", and kind "Binding".
|
||||||
|
// +optional
|
||||||
|
optional string subResource = 8;
|
||||||
|
|
||||||
|
// UserInfo is information about the requesting user
|
||||||
|
optional k8s.io.api.authentication.v1.UserInfo userInfo = 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AdmissionReviewStatus describes the status of the admission request.
|
||||||
|
message AdmissionReviewStatus {
|
||||||
|
// Allowed indicates whether or not the admission request was permitted.
|
||||||
|
optional bool allowed = 1;
|
||||||
|
|
||||||
|
// Result contains extra details into why an admission request was denied.
|
||||||
|
// This field IS NOT consulted in any way if "Allowed" is "true".
|
||||||
|
// +optional
|
||||||
|
optional k8s.io.apimachinery.pkg.apis.meta.v1.Status status = 2;
|
||||||
|
}
|
||||||
|
|
51
vendor/k8s.io/api/admission/v1alpha1/register.go
generated
vendored
Normal file
51
vendor/k8s.io/api/admission/v1alpha1/register.go
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
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 v1alpha1
|
||||||
|
|
||||||
|
import (
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GroupName is the group name for this API.
|
||||||
|
const GroupName = "admission.k8s.io"
|
||||||
|
|
||||||
|
// SchemeGroupVersion is group version used to register these objects
|
||||||
|
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
|
||||||
|
|
||||||
|
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||||
|
func Resource(resource string) schema.GroupResource {
|
||||||
|
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
|
||||||
|
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
||||||
|
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
||||||
|
localSchemeBuilder = &SchemeBuilder
|
||||||
|
AddToScheme = localSchemeBuilder.AddToScheme
|
||||||
|
)
|
||||||
|
|
||||||
|
// Adds the list of known types to api.Scheme.
|
||||||
|
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||||
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||||
|
&AdmissionReview{},
|
||||||
|
)
|
||||||
|
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||||
|
return nil
|
||||||
|
}
|
1364
vendor/k8s.io/api/admission/v1alpha1/types.generated.go
generated
vendored
Normal file
1364
vendor/k8s.io/api/admission/v1alpha1/types.generated.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
80
vendor/k8s.io/api/admission/v1alpha1/types.go
generated
vendored
Normal file
80
vendor/k8s.io/api/admission/v1alpha1/types.go
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
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 v1alpha1
|
||||||
|
|
||||||
|
import (
|
||||||
|
authenticationv1 "k8s.io/api/authentication/v1"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apiserver/pkg/admission"
|
||||||
|
)
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// AdmissionReview describes an admission request.
|
||||||
|
type AdmissionReview struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
// Spec describes the attributes for the admission request.
|
||||||
|
// Since this admission controller is non-mutating the webhook should avoid setting this in its response to avoid the
|
||||||
|
// cost of deserializing it.
|
||||||
|
// +optional
|
||||||
|
Spec AdmissionReviewSpec `json:"spec,omitempty" protobuf:"bytes,1,opt,name=spec"`
|
||||||
|
// Status is filled in by the webhook and indicates whether the admission request should be permitted.
|
||||||
|
// +optional
|
||||||
|
Status AdmissionReviewStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AdmissionReviewSpec describes the admission.Attributes for the admission request.
|
||||||
|
type AdmissionReviewSpec struct {
|
||||||
|
// Kind is the type of object being manipulated. For example: Pod
|
||||||
|
Kind metav1.GroupVersionKind `json:"kind,omitempty" protobuf:"bytes,1,opt,name=kind"`
|
||||||
|
// Object is the object from the incoming request prior to default values being applied
|
||||||
|
Object runtime.RawExtension `json:"object,omitempty" protobuf:"bytes,2,opt,name=object"`
|
||||||
|
// OldObject is the existing object. Only populated for UPDATE requests.
|
||||||
|
// +optional
|
||||||
|
OldObject runtime.RawExtension `json:"oldObject,omitempty" protobuf:"bytes,3,opt,name=oldObject"`
|
||||||
|
// Operation is the operation being performed
|
||||||
|
Operation admission.Operation `json:"operation,omitempty" protobuf:"bytes,4,opt,name=operation"`
|
||||||
|
// Name is the name of the object as presented in the request. On a CREATE operation, the client may omit name and
|
||||||
|
// rely on the server to generate the name. If that is the case, this method will return the empty string.
|
||||||
|
// +optional
|
||||||
|
Name string `json:"name,omitempty" protobuf:"bytes,5,opt,name=name"`
|
||||||
|
// Namespace is the namespace associated with the request (if any).
|
||||||
|
// +optional
|
||||||
|
Namespace string `json:"namespace,omitempty" protobuf:"bytes,6,opt,name=namespace"`
|
||||||
|
// Resource is the name of the resource being requested. This is not the kind. For example: pods
|
||||||
|
Resource metav1.GroupVersionResource `json:"resource,omitempty" protobuf:"bytes,7,opt,name=resource"`
|
||||||
|
// SubResource is the name of the subresource being requested. This is a different resource, scoped to the parent
|
||||||
|
// resource, but it may have a different kind. For instance, /pods has the resource "pods" and the kind "Pod", while
|
||||||
|
// /pods/foo/status has the resource "pods", the sub resource "status", and the kind "Pod" (because status operates on
|
||||||
|
// pods). The binding resource for a pod though may be /pods/foo/binding, which has resource "pods", subresource
|
||||||
|
// "binding", and kind "Binding".
|
||||||
|
// +optional
|
||||||
|
SubResource string `json:"subResource,omitempty" protobuf:"bytes,8,opt,name=subResource"`
|
||||||
|
// UserInfo is information about the requesting user
|
||||||
|
UserInfo authenticationv1.UserInfo `json:"userInfo,omitempty" protobuf:"bytes,9,opt,name=userInfo"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AdmissionReviewStatus describes the status of the admission request.
|
||||||
|
type AdmissionReviewStatus struct {
|
||||||
|
// Allowed indicates whether or not the admission request was permitted.
|
||||||
|
Allowed bool `json:"allowed" protobuf:"varint,1,opt,name=allowed"`
|
||||||
|
// Result contains extra details into why an admission request was denied.
|
||||||
|
// This field IS NOT consulted in any way if "Allowed" is "true".
|
||||||
|
// +optional
|
||||||
|
Result *metav1.Status `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"`
|
||||||
|
}
|
67
vendor/k8s.io/api/admission/v1alpha1/types_swagger_doc_generated.go
generated
vendored
Normal file
67
vendor/k8s.io/api/admission/v1alpha1/types_swagger_doc_generated.go
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
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 v1alpha1
|
||||||
|
|
||||||
|
// This file contains a collection of methods that can be used from go-restful to
|
||||||
|
// generate Swagger API documentation for its models. Please read this PR for more
|
||||||
|
// information on the implementation: https://github.com/emicklei/go-restful/pull/215
|
||||||
|
//
|
||||||
|
// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if
|
||||||
|
// they are on one line! For multiple line or blocks that you want to ignore use ---.
|
||||||
|
// Any context after a --- is ignored.
|
||||||
|
//
|
||||||
|
// Those methods can be generated by using hack/update-generated-swagger-docs.sh
|
||||||
|
|
||||||
|
// AUTO-GENERATED FUNCTIONS START HERE
|
||||||
|
var map_AdmissionReview = map[string]string{
|
||||||
|
"": "AdmissionReview describes an admission request.",
|
||||||
|
"spec": "Spec describes the attributes for the admission request. Since this admission controller is non-mutating the webhook should avoid setting this in its response to avoid the cost of deserializing it.",
|
||||||
|
"status": "Status is filled in by the webhook and indicates whether the admission request should be permitted.",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (AdmissionReview) SwaggerDoc() map[string]string {
|
||||||
|
return map_AdmissionReview
|
||||||
|
}
|
||||||
|
|
||||||
|
var map_AdmissionReviewSpec = map[string]string{
|
||||||
|
"": "AdmissionReviewSpec describes the admission.Attributes for the admission request.",
|
||||||
|
"kind": "Kind is the type of object being manipulated. For example: Pod",
|
||||||
|
"object": "Object is the object from the incoming request prior to default values being applied",
|
||||||
|
"oldObject": "OldObject is the existing object. Only populated for UPDATE requests.",
|
||||||
|
"operation": "Operation is the operation being performed",
|
||||||
|
"name": "Name is the name of the object as presented in the request. On a CREATE operation, the client may omit name and rely on the server to generate the name. If that is the case, this method will return the empty string.",
|
||||||
|
"namespace": "Namespace is the namespace associated with the request (if any).",
|
||||||
|
"resource": "Resource is the name of the resource being requested. This is not the kind. For example: pods",
|
||||||
|
"subResource": "SubResource is the name of the subresource being requested. This is a different resource, scoped to the parent resource, but it may have a different kind. For instance, /pods has the resource \"pods\" and the kind \"Pod\", while /pods/foo/status has the resource \"pods\", the sub resource \"status\", and the kind \"Pod\" (because status operates on pods). The binding resource for a pod though may be /pods/foo/binding, which has resource \"pods\", subresource \"binding\", and kind \"Binding\".",
|
||||||
|
"userInfo": "UserInfo is information about the requesting user",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (AdmissionReviewSpec) SwaggerDoc() map[string]string {
|
||||||
|
return map_AdmissionReviewSpec
|
||||||
|
}
|
||||||
|
|
||||||
|
var map_AdmissionReviewStatus = map[string]string{
|
||||||
|
"": "AdmissionReviewStatus describes the status of the admission request.",
|
||||||
|
"allowed": "Allowed indicates whether or not the admission request was permitted.",
|
||||||
|
"status": "Result contains extra details into why an admission request was denied. This field IS NOT consulted in any way if \"Allowed\" is \"true\".",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (AdmissionReviewStatus) SwaggerDoc() map[string]string {
|
||||||
|
return map_AdmissionReviewStatus
|
||||||
|
}
|
||||||
|
|
||||||
|
// AUTO-GENERATED FUNCTIONS END HERE
|
126
vendor/k8s.io/api/admission/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
126
vendor/k8s.io/api/admission/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
// +build !ignore_autogenerated
|
||||||
|
|
||||||
|
/*
|
||||||
|
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 was autogenerated by deepcopy-gen. Do not edit it manually!
|
||||||
|
|
||||||
|
package v1alpha1
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
reflect "reflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Deprecated: register deep-copy functions.
|
||||||
|
func init() {
|
||||||
|
SchemeBuilder.Register(RegisterDeepCopies)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: RegisterDeepCopies adds deep-copy functions to the given scheme. Public
|
||||||
|
// to allow building arbitrary schemes.
|
||||||
|
func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||||
|
return scheme.AddGeneratedDeepCopyFuncs(
|
||||||
|
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||||
|
in.(*AdmissionReview).DeepCopyInto(out.(*AdmissionReview))
|
||||||
|
return nil
|
||||||
|
}, InType: reflect.TypeOf(&AdmissionReview{})},
|
||||||
|
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||||
|
in.(*AdmissionReviewSpec).DeepCopyInto(out.(*AdmissionReviewSpec))
|
||||||
|
return nil
|
||||||
|
}, InType: reflect.TypeOf(&AdmissionReviewSpec{})},
|
||||||
|
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||||
|
in.(*AdmissionReviewStatus).DeepCopyInto(out.(*AdmissionReviewStatus))
|
||||||
|
return nil
|
||||||
|
}, InType: reflect.TypeOf(&AdmissionReviewStatus{})},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *AdmissionReview) DeepCopyInto(out *AdmissionReview) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
in.Spec.DeepCopyInto(&out.Spec)
|
||||||
|
in.Status.DeepCopyInto(&out.Status)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new AdmissionReview.
|
||||||
|
func (x *AdmissionReview) DeepCopy() *AdmissionReview {
|
||||||
|
if x == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(AdmissionReview)
|
||||||
|
x.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (x *AdmissionReview) DeepCopyObject() runtime.Object {
|
||||||
|
if c := x.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *AdmissionReviewSpec) DeepCopyInto(out *AdmissionReviewSpec) {
|
||||||
|
*out = *in
|
||||||
|
out.Kind = in.Kind
|
||||||
|
in.Object.DeepCopyInto(&out.Object)
|
||||||
|
in.OldObject.DeepCopyInto(&out.OldObject)
|
||||||
|
out.Resource = in.Resource
|
||||||
|
in.UserInfo.DeepCopyInto(&out.UserInfo)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new AdmissionReviewSpec.
|
||||||
|
func (x *AdmissionReviewSpec) DeepCopy() *AdmissionReviewSpec {
|
||||||
|
if x == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(AdmissionReviewSpec)
|
||||||
|
x.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *AdmissionReviewStatus) DeepCopyInto(out *AdmissionReviewStatus) {
|
||||||
|
*out = *in
|
||||||
|
if in.Result != nil {
|
||||||
|
in, out := &in.Result, &out.Result
|
||||||
|
if *in == nil {
|
||||||
|
*out = nil
|
||||||
|
} else {
|
||||||
|
*out = new(v1.Status)
|
||||||
|
(*in).DeepCopyInto(*out)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new AdmissionReviewStatus.
|
||||||
|
func (x *AdmissionReviewStatus) DeepCopy() *AdmissionReviewStatus {
|
||||||
|
if x == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(AdmissionReviewStatus)
|
||||||
|
x.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
32
vendor/k8s.io/api/imagepolicy/v1alpha1/BUILD
generated
vendored
Normal file
32
vendor/k8s.io/api/imagepolicy/v1alpha1/BUILD
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
|
"go_library",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = [
|
||||||
|
"doc.go",
|
||||||
|
"generated.pb.go",
|
||||||
|
"register.go",
|
||||||
|
"types.generated.go",
|
||||||
|
"types.go",
|
||||||
|
"types_swagger_doc_generated.go",
|
||||||
|
"zz_generated.deepcopy.go",
|
||||||
|
],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
deps = [
|
||||||
|
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
|
||||||
|
"//vendor/github.com/gogo/protobuf/sortkeys:go_default_library",
|
||||||
|
"//vendor/github.com/ugorji/go/codec:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
21
vendor/k8s.io/api/imagepolicy/v1alpha1/doc.go
generated
vendored
Normal file
21
vendor/k8s.io/api/imagepolicy/v1alpha1/doc.go
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen=package,register
|
||||||
|
// +k8s:openapi-gen=true
|
||||||
|
|
||||||
|
// +groupName=imagepolicy.k8s.io
|
||||||
|
package v1alpha1 // import "k8s.io/api/imagepolicy/v1alpha1"
|
1076
vendor/k8s.io/api/imagepolicy/v1alpha1/generated.pb.go
generated
vendored
Normal file
1076
vendor/k8s.io/api/imagepolicy/v1alpha1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
80
vendor/k8s.io/api/imagepolicy/v1alpha1/generated.proto
generated
vendored
Normal file
80
vendor/k8s.io/api/imagepolicy/v1alpha1/generated.proto
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
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 was autogenerated by go-to-protobuf. Do not edit it manually!
|
||||||
|
|
||||||
|
syntax = 'proto2';
|
||||||
|
|
||||||
|
package k8s.io.api.imagepolicy.v1alpha1;
|
||||||
|
|
||||||
|
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
|
||||||
|
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
|
||||||
|
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
|
||||||
|
import "k8s.io/apimachinery/pkg/util/intstr/generated.proto";
|
||||||
|
|
||||||
|
// Package-wide variables from generator "generated".
|
||||||
|
option go_package = "v1alpha1";
|
||||||
|
|
||||||
|
// ImageReview checks if the set of images in a pod are allowed.
|
||||||
|
message ImageReview {
|
||||||
|
// +optional
|
||||||
|
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||||
|
|
||||||
|
// Spec holds information about the pod being evaluated
|
||||||
|
optional ImageReviewSpec spec = 2;
|
||||||
|
|
||||||
|
// Status is filled in by the backend and indicates whether the pod should be allowed.
|
||||||
|
// +optional
|
||||||
|
optional ImageReviewStatus status = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ImageReviewContainerSpec is a description of a container within the pod creation request.
|
||||||
|
message ImageReviewContainerSpec {
|
||||||
|
// This can be in the form image:tag or image@SHA:012345679abcdef.
|
||||||
|
// +optional
|
||||||
|
optional string image = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ImageReviewSpec is a description of the pod creation request.
|
||||||
|
message ImageReviewSpec {
|
||||||
|
// Containers is a list of a subset of the information in each container of the Pod being created.
|
||||||
|
// +optional
|
||||||
|
repeated ImageReviewContainerSpec containers = 1;
|
||||||
|
|
||||||
|
// Annotations is a list of key-value pairs extracted from the Pod's annotations.
|
||||||
|
// It only includes keys which match the pattern `*.image-policy.k8s.io/*`.
|
||||||
|
// It is up to each webhook backend to determine how to interpret these annotations, if at all.
|
||||||
|
// +optional
|
||||||
|
map<string, string> annotations = 2;
|
||||||
|
|
||||||
|
// Namespace is the namespace the pod is being created in.
|
||||||
|
// +optional
|
||||||
|
optional string namespace = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ImageReviewStatus is the result of the token authentication request.
|
||||||
|
message ImageReviewStatus {
|
||||||
|
// Allowed indicates that all images were allowed to be run.
|
||||||
|
optional bool allowed = 1;
|
||||||
|
|
||||||
|
// Reason should be empty unless Allowed is false in which case it
|
||||||
|
// may contain a short description of what is wrong. Kubernetes
|
||||||
|
// may truncate excessively long errors when displaying to the user.
|
||||||
|
// +optional
|
||||||
|
optional string reason = 2;
|
||||||
|
}
|
||||||
|
|
51
vendor/k8s.io/api/imagepolicy/v1alpha1/register.go
generated
vendored
Normal file
51
vendor/k8s.io/api/imagepolicy/v1alpha1/register.go
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
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 v1alpha1
|
||||||
|
|
||||||
|
import (
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GroupName is the group name for this API.
|
||||||
|
const GroupName = "imagepolicy.k8s.io"
|
||||||
|
|
||||||
|
// SchemeGroupVersion is group version used to register these objects
|
||||||
|
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
|
||||||
|
|
||||||
|
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||||
|
func Resource(resource string) schema.GroupResource {
|
||||||
|
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
|
||||||
|
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
||||||
|
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
||||||
|
localSchemeBuilder = &SchemeBuilder
|
||||||
|
AddToScheme = localSchemeBuilder.AddToScheme
|
||||||
|
)
|
||||||
|
|
||||||
|
// Adds the list of known types to api.Scheme.
|
||||||
|
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||||
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||||
|
&ImageReview{},
|
||||||
|
)
|
||||||
|
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||||
|
return nil
|
||||||
|
}
|
1305
vendor/k8s.io/api/imagepolicy/v1alpha1/types.generated.go
generated
vendored
Normal file
1305
vendor/k8s.io/api/imagepolicy/v1alpha1/types.generated.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
74
vendor/k8s.io/api/imagepolicy/v1alpha1/types.go
generated
vendored
Normal file
74
vendor/k8s.io/api/imagepolicy/v1alpha1/types.go
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
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 v1alpha1
|
||||||
|
|
||||||
|
import (
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// +genclient=true
|
||||||
|
// +nonNamespaced=true
|
||||||
|
// +noMethods=true
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// ImageReview checks if the set of images in a pod are allowed.
|
||||||
|
type ImageReview struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
// +optional
|
||||||
|
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||||
|
|
||||||
|
// Spec holds information about the pod being evaluated
|
||||||
|
Spec ImageReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
|
||||||
|
|
||||||
|
// Status is filled in by the backend and indicates whether the pod should be allowed.
|
||||||
|
// +optional
|
||||||
|
Status ImageReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ImageReviewSpec is a description of the pod creation request.
|
||||||
|
type ImageReviewSpec struct {
|
||||||
|
// Containers is a list of a subset of the information in each container of the Pod being created.
|
||||||
|
// +optional
|
||||||
|
Containers []ImageReviewContainerSpec `json:"containers,omitempty" protobuf:"bytes,1,rep,name=containers"`
|
||||||
|
// Annotations is a list of key-value pairs extracted from the Pod's annotations.
|
||||||
|
// It only includes keys which match the pattern `*.image-policy.k8s.io/*`.
|
||||||
|
// It is up to each webhook backend to determine how to interpret these annotations, if at all.
|
||||||
|
// +optional
|
||||||
|
Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,2,rep,name=annotations"`
|
||||||
|
// Namespace is the namespace the pod is being created in.
|
||||||
|
// +optional
|
||||||
|
Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ImageReviewContainerSpec is a description of a container within the pod creation request.
|
||||||
|
type ImageReviewContainerSpec struct {
|
||||||
|
// This can be in the form image:tag or image@SHA:012345679abcdef.
|
||||||
|
// +optional
|
||||||
|
Image string `json:"image,omitempty" protobuf:"bytes,1,opt,name=image"`
|
||||||
|
// In future, we may add command line overrides, exec health check command lines, and so on.
|
||||||
|
}
|
||||||
|
|
||||||
|
// ImageReviewStatus is the result of the token authentication request.
|
||||||
|
type ImageReviewStatus struct {
|
||||||
|
// Allowed indicates that all images were allowed to be run.
|
||||||
|
Allowed bool `json:"allowed" protobuf:"varint,1,opt,name=allowed"`
|
||||||
|
// Reason should be empty unless Allowed is false in which case it
|
||||||
|
// may contain a short description of what is wrong. Kubernetes
|
||||||
|
// may truncate excessively long errors when displaying to the user.
|
||||||
|
// +optional
|
||||||
|
Reason string `json:"reason,omitempty" protobuf:"bytes,2,opt,name=reason"`
|
||||||
|
}
|
70
vendor/k8s.io/api/imagepolicy/v1alpha1/types_swagger_doc_generated.go
generated
vendored
Normal file
70
vendor/k8s.io/api/imagepolicy/v1alpha1/types_swagger_doc_generated.go
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
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 v1alpha1
|
||||||
|
|
||||||
|
// This file contains a collection of methods that can be used from go-restful to
|
||||||
|
// generate Swagger API documentation for its models. Please read this PR for more
|
||||||
|
// information on the implementation: https://github.com/emicklei/go-restful/pull/215
|
||||||
|
//
|
||||||
|
// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if
|
||||||
|
// they are on one line! For multiple line or blocks that you want to ignore use ---.
|
||||||
|
// Any context after a --- is ignored.
|
||||||
|
//
|
||||||
|
// Those methods can be generated by using hack/update-generated-swagger-docs.sh
|
||||||
|
|
||||||
|
// AUTO-GENERATED FUNCTIONS START HERE
|
||||||
|
var map_ImageReview = map[string]string{
|
||||||
|
"": "ImageReview checks if the set of images in a pod are allowed.",
|
||||||
|
"spec": "Spec holds information about the pod being evaluated",
|
||||||
|
"status": "Status is filled in by the backend and indicates whether the pod should be allowed.",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ImageReview) SwaggerDoc() map[string]string {
|
||||||
|
return map_ImageReview
|
||||||
|
}
|
||||||
|
|
||||||
|
var map_ImageReviewContainerSpec = map[string]string{
|
||||||
|
"": "ImageReviewContainerSpec is a description of a container within the pod creation request.",
|
||||||
|
"image": "This can be in the form image:tag or image@SHA:012345679abcdef.",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ImageReviewContainerSpec) SwaggerDoc() map[string]string {
|
||||||
|
return map_ImageReviewContainerSpec
|
||||||
|
}
|
||||||
|
|
||||||
|
var map_ImageReviewSpec = map[string]string{
|
||||||
|
"": "ImageReviewSpec is a description of the pod creation request.",
|
||||||
|
"containers": "Containers is a list of a subset of the information in each container of the Pod being created.",
|
||||||
|
"annotations": "Annotations is a list of key-value pairs extracted from the Pod's annotations. It only includes keys which match the pattern `*.image-policy.k8s.io/*`. It is up to each webhook backend to determine how to interpret these annotations, if at all.",
|
||||||
|
"namespace": "Namespace is the namespace the pod is being created in.",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ImageReviewSpec) SwaggerDoc() map[string]string {
|
||||||
|
return map_ImageReviewSpec
|
||||||
|
}
|
||||||
|
|
||||||
|
var map_ImageReviewStatus = map[string]string{
|
||||||
|
"": "ImageReviewStatus is the result of the token authentication request.",
|
||||||
|
"allowed": "Allowed indicates that all images were allowed to be run.",
|
||||||
|
"reason": "Reason should be empty unless Allowed is false in which case it may contain a short description of what is wrong. Kubernetes may truncate excessively long errors when displaying to the user.",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ImageReviewStatus) SwaggerDoc() map[string]string {
|
||||||
|
return map_ImageReviewStatus
|
||||||
|
}
|
||||||
|
|
||||||
|
// AUTO-GENERATED FUNCTIONS END HERE
|
144
vendor/k8s.io/api/imagepolicy/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
144
vendor/k8s.io/api/imagepolicy/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
// +build !ignore_autogenerated
|
||||||
|
|
||||||
|
/*
|
||||||
|
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 was autogenerated by deepcopy-gen. Do not edit it manually!
|
||||||
|
|
||||||
|
package v1alpha1
|
||||||
|
|
||||||
|
import (
|
||||||
|
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
reflect "reflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Deprecated: register deep-copy functions.
|
||||||
|
func init() {
|
||||||
|
SchemeBuilder.Register(RegisterDeepCopies)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: RegisterDeepCopies adds deep-copy functions to the given scheme. Public
|
||||||
|
// to allow building arbitrary schemes.
|
||||||
|
func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||||
|
return scheme.AddGeneratedDeepCopyFuncs(
|
||||||
|
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||||
|
in.(*ImageReview).DeepCopyInto(out.(*ImageReview))
|
||||||
|
return nil
|
||||||
|
}, InType: reflect.TypeOf(&ImageReview{})},
|
||||||
|
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||||
|
in.(*ImageReviewContainerSpec).DeepCopyInto(out.(*ImageReviewContainerSpec))
|
||||||
|
return nil
|
||||||
|
}, InType: reflect.TypeOf(&ImageReviewContainerSpec{})},
|
||||||
|
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||||
|
in.(*ImageReviewSpec).DeepCopyInto(out.(*ImageReviewSpec))
|
||||||
|
return nil
|
||||||
|
}, InType: reflect.TypeOf(&ImageReviewSpec{})},
|
||||||
|
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||||
|
in.(*ImageReviewStatus).DeepCopyInto(out.(*ImageReviewStatus))
|
||||||
|
return nil
|
||||||
|
}, InType: reflect.TypeOf(&ImageReviewStatus{})},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *ImageReview) DeepCopyInto(out *ImageReview) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
|
in.Spec.DeepCopyInto(&out.Spec)
|
||||||
|
out.Status = in.Status
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new ImageReview.
|
||||||
|
func (x *ImageReview) DeepCopy() *ImageReview {
|
||||||
|
if x == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(ImageReview)
|
||||||
|
x.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (x *ImageReview) DeepCopyObject() runtime.Object {
|
||||||
|
if c := x.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *ImageReviewContainerSpec) DeepCopyInto(out *ImageReviewContainerSpec) {
|
||||||
|
*out = *in
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new ImageReviewContainerSpec.
|
||||||
|
func (x *ImageReviewContainerSpec) DeepCopy() *ImageReviewContainerSpec {
|
||||||
|
if x == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(ImageReviewContainerSpec)
|
||||||
|
x.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *ImageReviewSpec) DeepCopyInto(out *ImageReviewSpec) {
|
||||||
|
*out = *in
|
||||||
|
if in.Containers != nil {
|
||||||
|
in, out := &in.Containers, &out.Containers
|
||||||
|
*out = make([]ImageReviewContainerSpec, len(*in))
|
||||||
|
copy(*out, *in)
|
||||||
|
}
|
||||||
|
if in.Annotations != nil {
|
||||||
|
in, out := &in.Annotations, &out.Annotations
|
||||||
|
*out = make(map[string]string, len(*in))
|
||||||
|
for key, val := range *in {
|
||||||
|
(*out)[key] = val
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new ImageReviewSpec.
|
||||||
|
func (x *ImageReviewSpec) DeepCopy() *ImageReviewSpec {
|
||||||
|
if x == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(ImageReviewSpec)
|
||||||
|
x.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *ImageReviewStatus) DeepCopyInto(out *ImageReviewStatus) {
|
||||||
|
*out = *in
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new ImageReviewStatus.
|
||||||
|
func (x *ImageReviewStatus) DeepCopy() *ImageReviewStatus {
|
||||||
|
if x == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(ImageReviewStatus)
|
||||||
|
x.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
28
vendor/k8s.io/api/scheduling/v1alpha1/BUILD
generated
vendored
Normal file
28
vendor/k8s.io/api/scheduling/v1alpha1/BUILD
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
|
"go_library",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = [
|
||||||
|
"doc.go",
|
||||||
|
"generated.pb.go",
|
||||||
|
"register.go",
|
||||||
|
"types.go",
|
||||||
|
"types_swagger_doc_generated.go",
|
||||||
|
"zz_generated.deepcopy.go",
|
||||||
|
],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
deps = [
|
||||||
|
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
21
vendor/k8s.io/api/scheduling/v1alpha1/doc.go
generated
vendored
Normal file
21
vendor/k8s.io/api/scheduling/v1alpha1/doc.go
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen=package,register
|
||||||
|
// +k8s:openapi-gen=true
|
||||||
|
|
||||||
|
// +groupName=scheduling.k8s.io
|
||||||
|
package v1alpha1 // import "k8s.io/api/scheduling/v1alpha1"
|
641
vendor/k8s.io/api/scheduling/v1alpha1/generated.pb.go
generated
vendored
Normal file
641
vendor/k8s.io/api/scheduling/v1alpha1/generated.pb.go
generated
vendored
Normal file
@ -0,0 +1,641 @@
|
|||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by protoc-gen-gogo.
|
||||||
|
// source: k8s.io/kubernetes/vendor/k8s.io/api/scheduling/v1alpha1/generated.proto
|
||||||
|
// DO NOT EDIT!
|
||||||
|
|
||||||
|
/*
|
||||||
|
Package v1alpha1 is a generated protocol buffer package.
|
||||||
|
|
||||||
|
It is generated from these files:
|
||||||
|
k8s.io/kubernetes/vendor/k8s.io/api/scheduling/v1alpha1/generated.proto
|
||||||
|
|
||||||
|
It has these top-level messages:
|
||||||
|
PriorityClass
|
||||||
|
PriorityClassList
|
||||||
|
*/
|
||||||
|
package v1alpha1
|
||||||
|
|
||||||
|
import proto "github.com/gogo/protobuf/proto"
|
||||||
|
import fmt "fmt"
|
||||||
|
import math "math"
|
||||||
|
|
||||||
|
import strings "strings"
|
||||||
|
import reflect "reflect"
|
||||||
|
|
||||||
|
import io "io"
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
|
func (m *PriorityClass) Reset() { *m = PriorityClass{} }
|
||||||
|
func (*PriorityClass) ProtoMessage() {}
|
||||||
|
func (*PriorityClass) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
|
||||||
|
|
||||||
|
func (m *PriorityClassList) Reset() { *m = PriorityClassList{} }
|
||||||
|
func (*PriorityClassList) ProtoMessage() {}
|
||||||
|
func (*PriorityClassList) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{1} }
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*PriorityClass)(nil), "k8s.io.api.scheduling.v1alpha1.PriorityClass")
|
||||||
|
proto.RegisterType((*PriorityClassList)(nil), "k8s.io.api.scheduling.v1alpha1.PriorityClassList")
|
||||||
|
}
|
||||||
|
func (m *PriorityClass) Marshal() (dAtA []byte, err error) {
|
||||||
|
size := m.Size()
|
||||||
|
dAtA = make([]byte, size)
|
||||||
|
n, err := m.MarshalTo(dAtA)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return dAtA[:n], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PriorityClass) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
var i int
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
dAtA[i] = 0xa
|
||||||
|
i++
|
||||||
|
i = encodeVarintGenerated(dAtA, i, uint64(m.ObjectMeta.Size()))
|
||||||
|
n1, err := m.ObjectMeta.MarshalTo(dAtA[i:])
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
i += n1
|
||||||
|
dAtA[i] = 0x10
|
||||||
|
i++
|
||||||
|
i = encodeVarintGenerated(dAtA, i, uint64(m.Value))
|
||||||
|
dAtA[i] = 0x18
|
||||||
|
i++
|
||||||
|
if m.GlobalDefault {
|
||||||
|
dAtA[i] = 1
|
||||||
|
} else {
|
||||||
|
dAtA[i] = 0
|
||||||
|
}
|
||||||
|
i++
|
||||||
|
dAtA[i] = 0x22
|
||||||
|
i++
|
||||||
|
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Description)))
|
||||||
|
i += copy(dAtA[i:], m.Description)
|
||||||
|
return i, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PriorityClassList) Marshal() (dAtA []byte, err error) {
|
||||||
|
size := m.Size()
|
||||||
|
dAtA = make([]byte, size)
|
||||||
|
n, err := m.MarshalTo(dAtA)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return dAtA[:n], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PriorityClassList) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
var i int
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
dAtA[i] = 0xa
|
||||||
|
i++
|
||||||
|
i = encodeVarintGenerated(dAtA, i, uint64(m.ListMeta.Size()))
|
||||||
|
n2, err := m.ListMeta.MarshalTo(dAtA[i:])
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
i += n2
|
||||||
|
if len(m.Items) > 0 {
|
||||||
|
for _, msg := range m.Items {
|
||||||
|
dAtA[i] = 0x12
|
||||||
|
i++
|
||||||
|
i = encodeVarintGenerated(dAtA, i, uint64(msg.Size()))
|
||||||
|
n, err := msg.MarshalTo(dAtA[i:])
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
i += n
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return i, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func encodeFixed64Generated(dAtA []byte, offset int, v uint64) int {
|
||||||
|
dAtA[offset] = uint8(v)
|
||||||
|
dAtA[offset+1] = uint8(v >> 8)
|
||||||
|
dAtA[offset+2] = uint8(v >> 16)
|
||||||
|
dAtA[offset+3] = uint8(v >> 24)
|
||||||
|
dAtA[offset+4] = uint8(v >> 32)
|
||||||
|
dAtA[offset+5] = uint8(v >> 40)
|
||||||
|
dAtA[offset+6] = uint8(v >> 48)
|
||||||
|
dAtA[offset+7] = uint8(v >> 56)
|
||||||
|
return offset + 8
|
||||||
|
}
|
||||||
|
func encodeFixed32Generated(dAtA []byte, offset int, v uint32) int {
|
||||||
|
dAtA[offset] = uint8(v)
|
||||||
|
dAtA[offset+1] = uint8(v >> 8)
|
||||||
|
dAtA[offset+2] = uint8(v >> 16)
|
||||||
|
dAtA[offset+3] = uint8(v >> 24)
|
||||||
|
return offset + 4
|
||||||
|
}
|
||||||
|
func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int {
|
||||||
|
for v >= 1<<7 {
|
||||||
|
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||||
|
v >>= 7
|
||||||
|
offset++
|
||||||
|
}
|
||||||
|
dAtA[offset] = uint8(v)
|
||||||
|
return offset + 1
|
||||||
|
}
|
||||||
|
func (m *PriorityClass) Size() (n int) {
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
l = m.ObjectMeta.Size()
|
||||||
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
|
n += 1 + sovGenerated(uint64(m.Value))
|
||||||
|
n += 2
|
||||||
|
l = len(m.Description)
|
||||||
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PriorityClassList) Size() (n int) {
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
l = m.ListMeta.Size()
|
||||||
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
|
if len(m.Items) > 0 {
|
||||||
|
for _, e := range m.Items {
|
||||||
|
l = e.Size()
|
||||||
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func sovGenerated(x uint64) (n int) {
|
||||||
|
for {
|
||||||
|
n++
|
||||||
|
x >>= 7
|
||||||
|
if x == 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
func sozGenerated(x uint64) (n int) {
|
||||||
|
return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||||
|
}
|
||||||
|
func (this *PriorityClass) String() string {
|
||||||
|
if this == nil {
|
||||||
|
return "nil"
|
||||||
|
}
|
||||||
|
s := strings.Join([]string{`&PriorityClass{`,
|
||||||
|
`ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ObjectMeta", 1), `&`, ``, 1) + `,`,
|
||||||
|
`Value:` + fmt.Sprintf("%v", this.Value) + `,`,
|
||||||
|
`GlobalDefault:` + fmt.Sprintf("%v", this.GlobalDefault) + `,`,
|
||||||
|
`Description:` + fmt.Sprintf("%v", this.Description) + `,`,
|
||||||
|
`}`,
|
||||||
|
}, "")
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
func (this *PriorityClassList) String() string {
|
||||||
|
if this == nil {
|
||||||
|
return "nil"
|
||||||
|
}
|
||||||
|
s := strings.Join([]string{`&PriorityClassList{`,
|
||||||
|
`ListMeta:` + strings.Replace(strings.Replace(this.ListMeta.String(), "ListMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ListMeta", 1), `&`, ``, 1) + `,`,
|
||||||
|
`Items:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Items), "PriorityClass", "PriorityClass", 1), `&`, ``, 1) + `,`,
|
||||||
|
`}`,
|
||||||
|
}, "")
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
func valueToStringGenerated(v interface{}) string {
|
||||||
|
rv := reflect.ValueOf(v)
|
||||||
|
if rv.IsNil() {
|
||||||
|
return "nil"
|
||||||
|
}
|
||||||
|
pv := reflect.Indirect(rv).Interface()
|
||||||
|
return fmt.Sprintf("*%v", pv)
|
||||||
|
}
|
||||||
|
func (m *PriorityClass) Unmarshal(dAtA []byte) error {
|
||||||
|
l := len(dAtA)
|
||||||
|
iNdEx := 0
|
||||||
|
for iNdEx < l {
|
||||||
|
preIndex := iNdEx
|
||||||
|
var wire uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowGenerated
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
wire |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fieldNum := int32(wire >> 3)
|
||||||
|
wireType := int(wire & 0x7)
|
||||||
|
if wireType == 4 {
|
||||||
|
return fmt.Errorf("proto: PriorityClass: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: PriorityClass: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
case 1:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType)
|
||||||
|
}
|
||||||
|
var msglen int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowGenerated
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
msglen |= (int(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if msglen < 0 {
|
||||||
|
return ErrInvalidLengthGenerated
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + msglen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 2:
|
||||||
|
if wireType != 0 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
|
||||||
|
}
|
||||||
|
m.Value = 0
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowGenerated
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
m.Value |= (int32(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
if wireType != 0 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field GlobalDefault", wireType)
|
||||||
|
}
|
||||||
|
var v int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowGenerated
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
v |= (int(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m.GlobalDefault = bool(v != 0)
|
||||||
|
case 4:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowGenerated
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthGenerated
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Description = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
default:
|
||||||
|
iNdEx = preIndex
|
||||||
|
skippy, err := skipGenerated(dAtA[iNdEx:])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if skippy < 0 {
|
||||||
|
return ErrInvalidLengthGenerated
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (m *PriorityClassList) Unmarshal(dAtA []byte) error {
|
||||||
|
l := len(dAtA)
|
||||||
|
iNdEx := 0
|
||||||
|
for iNdEx < l {
|
||||||
|
preIndex := iNdEx
|
||||||
|
var wire uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowGenerated
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
wire |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fieldNum := int32(wire >> 3)
|
||||||
|
wireType := int(wire & 0x7)
|
||||||
|
if wireType == 4 {
|
||||||
|
return fmt.Errorf("proto: PriorityClassList: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: PriorityClassList: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
case 1:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType)
|
||||||
|
}
|
||||||
|
var msglen int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowGenerated
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
msglen |= (int(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if msglen < 0 {
|
||||||
|
return ErrInvalidLengthGenerated
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + msglen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType)
|
||||||
|
}
|
||||||
|
var msglen int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowGenerated
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
msglen |= (int(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if msglen < 0 {
|
||||||
|
return ErrInvalidLengthGenerated
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + msglen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Items = append(m.Items, PriorityClass{})
|
||||||
|
if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
iNdEx = postIndex
|
||||||
|
default:
|
||||||
|
iNdEx = preIndex
|
||||||
|
skippy, err := skipGenerated(dAtA[iNdEx:])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if skippy < 0 {
|
||||||
|
return ErrInvalidLengthGenerated
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func skipGenerated(dAtA []byte) (n int, err error) {
|
||||||
|
l := len(dAtA)
|
||||||
|
iNdEx := 0
|
||||||
|
for iNdEx < l {
|
||||||
|
var wire uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return 0, ErrIntOverflowGenerated
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return 0, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
wire |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wireType := int(wire & 0x7)
|
||||||
|
switch wireType {
|
||||||
|
case 0:
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return 0, ErrIntOverflowGenerated
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return 0, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx++
|
||||||
|
if dAtA[iNdEx-1] < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return iNdEx, nil
|
||||||
|
case 1:
|
||||||
|
iNdEx += 8
|
||||||
|
return iNdEx, nil
|
||||||
|
case 2:
|
||||||
|
var length int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return 0, ErrIntOverflowGenerated
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return 0, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
length |= (int(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
iNdEx += length
|
||||||
|
if length < 0 {
|
||||||
|
return 0, ErrInvalidLengthGenerated
|
||||||
|
}
|
||||||
|
return iNdEx, nil
|
||||||
|
case 3:
|
||||||
|
for {
|
||||||
|
var innerWire uint64
|
||||||
|
var start int = iNdEx
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return 0, ErrIntOverflowGenerated
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return 0, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
innerWire |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
innerWireType := int(innerWire & 0x7)
|
||||||
|
if innerWireType == 4 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
next, err := skipGenerated(dAtA[start:])
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
iNdEx = start + next
|
||||||
|
}
|
||||||
|
return iNdEx, nil
|
||||||
|
case 4:
|
||||||
|
return iNdEx, nil
|
||||||
|
case 5:
|
||||||
|
iNdEx += 4
|
||||||
|
return iNdEx, nil
|
||||||
|
default:
|
||||||
|
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
panic("unreachable")
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||||
|
ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow")
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/api/scheduling/v1alpha1/generated.proto", fileDescriptorGenerated)
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileDescriptorGenerated = []byte{
|
||||||
|
// 460 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x8b, 0xd3, 0x40,
|
||||||
|
0x18, 0xc6, 0x33, 0x5d, 0x0b, 0x75, 0x4a, 0x41, 0x23, 0x42, 0xe8, 0x61, 0x36, 0xac, 0x97, 0x5c,
|
||||||
|
0x76, 0xc6, 0xae, 0x7f, 0x10, 0xbc, 0xc5, 0x85, 0x45, 0x50, 0x94, 0x1c, 0x3c, 0x88, 0x07, 0x27,
|
||||||
|
0xc9, 0x6c, 0x3a, 0x36, 0xc9, 0x84, 0x99, 0x37, 0x81, 0xbd, 0x79, 0xf6, 0xe4, 0x97, 0x12, 0x7a,
|
||||||
|
0xdc, 0xe3, 0x9e, 0x16, 0x1b, 0xbf, 0x88, 0x24, 0x4d, 0x37, 0xad, 0x65, 0xd5, 0x5b, 0xe6, 0x79,
|
||||||
|
0x9f, 0xdf, 0x33, 0xf3, 0x3e, 0x04, 0x9f, 0x2d, 0x5e, 0x18, 0x2a, 0x15, 0x5b, 0x94, 0xa1, 0xd0,
|
||||||
|
0xb9, 0x00, 0x61, 0x58, 0x25, 0xf2, 0x58, 0x69, 0xd6, 0x0d, 0x78, 0x21, 0x99, 0x89, 0xe6, 0x22,
|
||||||
|
0x2e, 0x53, 0x99, 0x27, 0xac, 0x9a, 0xf1, 0xb4, 0x98, 0xf3, 0x19, 0x4b, 0x44, 0x2e, 0x34, 0x07,
|
||||||
|
0x11, 0xd3, 0x42, 0x2b, 0x50, 0x36, 0x59, 0xfb, 0x29, 0x2f, 0x24, 0xed, 0xfd, 0x74, 0xe3, 0x9f,
|
||||||
|
0x1e, 0x27, 0x12, 0xe6, 0x65, 0x48, 0x23, 0x95, 0xb1, 0x44, 0x25, 0x8a, 0xb5, 0x58, 0x58, 0x9e,
|
||||||
|
0xb7, 0xa7, 0xf6, 0xd0, 0x7e, 0xad, 0xe3, 0xa6, 0x4f, 0xfb, 0xeb, 0x33, 0x1e, 0xcd, 0x65, 0x2e,
|
||||||
|
0xf4, 0x05, 0x2b, 0x16, 0x49, 0x23, 0x18, 0x96, 0x09, 0xe0, 0xac, 0xda, 0x7b, 0xc4, 0x94, 0xdd,
|
||||||
|
0x46, 0xe9, 0x32, 0x07, 0x99, 0x89, 0x3d, 0xe0, 0xf9, 0xbf, 0x80, 0x66, 0x95, 0x8c, 0xef, 0x71,
|
||||||
|
0x4f, 0x6e, 0xe3, 0x4a, 0x90, 0x29, 0x93, 0x39, 0x18, 0xd0, 0x7f, 0x42, 0x47, 0xdf, 0x06, 0x78,
|
||||||
|
0xf2, 0x5e, 0x4b, 0xa5, 0x25, 0x5c, 0xbc, 0x4a, 0xb9, 0x31, 0xf6, 0x67, 0x3c, 0x6a, 0x56, 0x89,
|
||||||
|
0x39, 0x70, 0x07, 0xb9, 0xc8, 0x1b, 0x9f, 0x3c, 0xa6, 0x7d, 0x8f, 0x37, 0xc9, 0xb4, 0x58, 0x24,
|
||||||
|
0x8d, 0x60, 0x68, 0xe3, 0xa6, 0xd5, 0x8c, 0xbe, 0x0b, 0xbf, 0x88, 0x08, 0xde, 0x0a, 0xe0, 0xbe,
|
||||||
|
0xbd, 0xbc, 0x3e, 0xb4, 0xea, 0xeb, 0x43, 0xdc, 0x6b, 0xc1, 0x4d, 0xaa, 0xfd, 0x08, 0x0f, 0x2b,
|
||||||
|
0x9e, 0x96, 0xc2, 0x19, 0xb8, 0xc8, 0x1b, 0xfa, 0x93, 0xce, 0x3c, 0xfc, 0xd0, 0x88, 0xc1, 0x7a,
|
||||||
|
0x66, 0xbf, 0xc4, 0x93, 0x24, 0x55, 0x21, 0x4f, 0x4f, 0xc5, 0x39, 0x2f, 0x53, 0x70, 0x0e, 0x5c,
|
||||||
|
0xe4, 0x8d, 0xfc, 0x87, 0x9d, 0x79, 0x72, 0xb6, 0x3d, 0x0c, 0x76, 0xbd, 0xf6, 0x33, 0x3c, 0x8e,
|
||||||
|
0x85, 0x89, 0xb4, 0x2c, 0x40, 0xaa, 0xdc, 0xb9, 0xe3, 0x22, 0xef, 0xae, 0xff, 0xa0, 0x43, 0xc7,
|
||||||
|
0xa7, 0xfd, 0x28, 0xd8, 0xf6, 0x1d, 0xfd, 0x40, 0xf8, 0xfe, 0x4e, 0x19, 0x6f, 0xa4, 0x01, 0xfb,
|
||||||
|
0xd3, 0x5e, 0x21, 0xf4, 0xff, 0x0a, 0x69, 0xe8, 0xb6, 0x8e, 0x7b, 0xdd, 0xcd, 0xa3, 0x8d, 0xb2,
|
||||||
|
0x55, 0x46, 0x80, 0x87, 0x12, 0x44, 0x66, 0x9c, 0x81, 0x7b, 0xe0, 0x8d, 0x4f, 0x8e, 0xe9, 0xdf,
|
||||||
|
0xff, 0x59, 0xba, 0xf3, 0xbe, 0xbe, 0xbb, 0xd7, 0x4d, 0x46, 0xb0, 0x8e, 0xf2, 0xe9, 0x72, 0x45,
|
||||||
|
0xac, 0xcb, 0x15, 0xb1, 0xae, 0x56, 0xc4, 0xfa, 0x5a, 0x13, 0xb4, 0xac, 0x09, 0xba, 0xac, 0x09,
|
||||||
|
0xba, 0xaa, 0x09, 0xfa, 0x59, 0x13, 0xf4, 0xfd, 0x17, 0xb1, 0x3e, 0x8e, 0x36, 0x99, 0xbf, 0x03,
|
||||||
|
0x00, 0x00, 0xff, 0xff, 0x44, 0x05, 0xba, 0x7b, 0x71, 0x03, 0x00, 0x00,
|
||||||
|
}
|
65
vendor/k8s.io/api/scheduling/v1alpha1/generated.proto
generated
vendored
Normal file
65
vendor/k8s.io/api/scheduling/v1alpha1/generated.proto
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
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 was autogenerated by go-to-protobuf. Do not edit it manually!
|
||||||
|
|
||||||
|
syntax = 'proto2';
|
||||||
|
|
||||||
|
package k8s.io.api.scheduling.v1alpha1;
|
||||||
|
|
||||||
|
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
|
||||||
|
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
|
||||||
|
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
|
||||||
|
import "k8s.io/apimachinery/pkg/util/intstr/generated.proto";
|
||||||
|
|
||||||
|
// Package-wide variables from generator "generated".
|
||||||
|
option go_package = "v1alpha1";
|
||||||
|
|
||||||
|
// PriorityClass defines mapping from a priority class name to the priority
|
||||||
|
// integer value. The value can be any valid integer.
|
||||||
|
message PriorityClass {
|
||||||
|
// Standard object's metadata.
|
||||||
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
|
// +optional
|
||||||
|
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||||
|
|
||||||
|
// The value of this priority class. This is the actual priority that pods
|
||||||
|
// receive when they have the name of this class in their pod spec.
|
||||||
|
optional int32 value = 2;
|
||||||
|
|
||||||
|
// globalDefault specifies whether this PriorityClass should be considered as
|
||||||
|
// the default priority for pods that do not have any priority class.
|
||||||
|
// +optional
|
||||||
|
optional bool globalDefault = 3;
|
||||||
|
|
||||||
|
// description is an arbitrary string that usually provides guidelines on
|
||||||
|
// when this priority class should be used.
|
||||||
|
// +optional
|
||||||
|
optional string description = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// PriorityClassList is a collection of priority classes.
|
||||||
|
message PriorityClassList {
|
||||||
|
// Standard list metadata
|
||||||
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
|
// +optional
|
||||||
|
optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
|
||||||
|
|
||||||
|
// items is the list of PriorityClasses
|
||||||
|
repeated PriorityClass items = 2;
|
||||||
|
}
|
||||||
|
|
52
vendor/k8s.io/api/scheduling/v1alpha1/register.go
generated
vendored
Normal file
52
vendor/k8s.io/api/scheduling/v1alpha1/register.go
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
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 v1alpha1
|
||||||
|
|
||||||
|
import (
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GroupName is the group name use in this package
|
||||||
|
const GroupName = "scheduling.k8s.io"
|
||||||
|
|
||||||
|
// SchemeGroupVersion is group version used to register these objects
|
||||||
|
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
|
||||||
|
|
||||||
|
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||||
|
func Resource(resource string) schema.GroupResource {
|
||||||
|
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
|
||||||
|
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
||||||
|
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
||||||
|
localSchemeBuilder = &SchemeBuilder
|
||||||
|
AddToScheme = localSchemeBuilder.AddToScheme
|
||||||
|
)
|
||||||
|
|
||||||
|
// Adds the list of known types to api.Scheme.
|
||||||
|
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||||
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||||
|
&PriorityClass{},
|
||||||
|
&PriorityClassList{},
|
||||||
|
)
|
||||||
|
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||||
|
return nil
|
||||||
|
}
|
63
vendor/k8s.io/api/scheduling/v1alpha1/types.go
generated
vendored
Normal file
63
vendor/k8s.io/api/scheduling/v1alpha1/types.go
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
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 v1alpha1
|
||||||
|
|
||||||
|
import (
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// +genclient=true
|
||||||
|
// +nonNamespaced=true
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// PriorityClass defines mapping from a priority class name to the priority
|
||||||
|
// integer value. The value can be any valid integer.
|
||||||
|
type PriorityClass struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
// Standard object's metadata.
|
||||||
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
|
// +optional
|
||||||
|
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||||
|
|
||||||
|
// The value of this priority class. This is the actual priority that pods
|
||||||
|
// receive when they have the name of this class in their pod spec.
|
||||||
|
Value int32 `json:"value" protobuf:"bytes,2,opt,name=value"`
|
||||||
|
|
||||||
|
// globalDefault specifies whether this PriorityClass should be considered as
|
||||||
|
// the default priority for pods that do not have any priority class.
|
||||||
|
// +optional
|
||||||
|
GlobalDefault bool `json:"globalDefault,omitempty" protobuf:"bytes,3,opt,name=globalDefault"`
|
||||||
|
|
||||||
|
// description is an arbitrary string that usually provides guidelines on
|
||||||
|
// when this priority class should be used.
|
||||||
|
// +optional
|
||||||
|
Description string `json:"description,omitempty" protobuf:"bytes,4,opt,name=description"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// PriorityClassList is a collection of priority classes.
|
||||||
|
type PriorityClassList struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
// Standard list metadata
|
||||||
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
|
// +optional
|
||||||
|
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||||
|
|
||||||
|
// items is the list of PriorityClasses
|
||||||
|
Items []PriorityClass `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||||
|
}
|
52
vendor/k8s.io/api/scheduling/v1alpha1/types_swagger_doc_generated.go
generated
vendored
Normal file
52
vendor/k8s.io/api/scheduling/v1alpha1/types_swagger_doc_generated.go
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
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 v1alpha1
|
||||||
|
|
||||||
|
// This file contains a collection of methods that can be used from go-restful to
|
||||||
|
// generate Swagger API documentation for its models. Please read this PR for more
|
||||||
|
// information on the implementation: https://github.com/emicklei/go-restful/pull/215
|
||||||
|
//
|
||||||
|
// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if
|
||||||
|
// they are on one line! For multiple line or blocks that you want to ignore use ---.
|
||||||
|
// Any context after a --- is ignored.
|
||||||
|
//
|
||||||
|
// Those methods can be generated by using hack/update-generated-swagger-docs.sh
|
||||||
|
|
||||||
|
// AUTO-GENERATED FUNCTIONS START HERE
|
||||||
|
var map_PriorityClass = map[string]string{
|
||||||
|
"": "PriorityClass defines mapping from a priority class name to the priority integer value. The value can be any valid integer.",
|
||||||
|
"metadata": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
|
||||||
|
"value": "The value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.",
|
||||||
|
"globalDefault": "globalDefault specifies whether this PriorityClass should be considered as the default priority for pods that do not have any priority class.",
|
||||||
|
"description": "description is an arbitrary string that usually provides guidelines on when this priority class should be used.",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (PriorityClass) SwaggerDoc() map[string]string {
|
||||||
|
return map_PriorityClass
|
||||||
|
}
|
||||||
|
|
||||||
|
var map_PriorityClassList = map[string]string{
|
||||||
|
"": "PriorityClassList is a collection of priority classes.",
|
||||||
|
"metadata": "Standard list metadata More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
|
||||||
|
"items": "items is the list of PriorityClasses",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (PriorityClassList) SwaggerDoc() map[string]string {
|
||||||
|
return map_PriorityClassList
|
||||||
|
}
|
||||||
|
|
||||||
|
// AUTO-GENERATED FUNCTIONS END HERE
|
108
vendor/k8s.io/api/scheduling/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
108
vendor/k8s.io/api/scheduling/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
// +build !ignore_autogenerated
|
||||||
|
|
||||||
|
/*
|
||||||
|
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 was autogenerated by deepcopy-gen. Do not edit it manually!
|
||||||
|
|
||||||
|
package v1alpha1
|
||||||
|
|
||||||
|
import (
|
||||||
|
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
reflect "reflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Deprecated: register deep-copy functions.
|
||||||
|
func init() {
|
||||||
|
SchemeBuilder.Register(RegisterDeepCopies)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: RegisterDeepCopies adds deep-copy functions to the given scheme. Public
|
||||||
|
// to allow building arbitrary schemes.
|
||||||
|
func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||||
|
return scheme.AddGeneratedDeepCopyFuncs(
|
||||||
|
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||||
|
in.(*PriorityClass).DeepCopyInto(out.(*PriorityClass))
|
||||||
|
return nil
|
||||||
|
}, InType: reflect.TypeOf(&PriorityClass{})},
|
||||||
|
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||||
|
in.(*PriorityClassList).DeepCopyInto(out.(*PriorityClassList))
|
||||||
|
return nil
|
||||||
|
}, InType: reflect.TypeOf(&PriorityClassList{})},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *PriorityClass) DeepCopyInto(out *PriorityClass) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new PriorityClass.
|
||||||
|
func (x *PriorityClass) DeepCopy() *PriorityClass {
|
||||||
|
if x == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(PriorityClass)
|
||||||
|
x.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (x *PriorityClass) DeepCopyObject() runtime.Object {
|
||||||
|
if c := x.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *PriorityClassList) DeepCopyInto(out *PriorityClassList) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
out.ListMeta = in.ListMeta
|
||||||
|
if in.Items != nil {
|
||||||
|
in, out := &in.Items, &out.Items
|
||||||
|
*out = make([]PriorityClass, len(*in))
|
||||||
|
for i := range *in {
|
||||||
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new PriorityClassList.
|
||||||
|
func (x *PriorityClassList) DeepCopy() *PriorityClassList {
|
||||||
|
if x == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(PriorityClassList)
|
||||||
|
x.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (x *PriorityClassList) DeepCopyObject() runtime.Object {
|
||||||
|
if c := x.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
31
vendor/k8s.io/apimachinery/pkg/apimachinery/BUILD
generated
vendored
Normal file
31
vendor/k8s.io/apimachinery/pkg/apimachinery/BUILD
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
|
"go_library",
|
||||||
|
"go_test",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_test(
|
||||||
|
name = "go_default_test",
|
||||||
|
srcs = ["types_test.go"],
|
||||||
|
library = ":go_default_library",
|
||||||
|
tags = ["automanaged"],
|
||||||
|
deps = ["//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library"],
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = [
|
||||||
|
"doc.go",
|
||||||
|
"types.go",
|
||||||
|
],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
deps = [
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/api/meta:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
35
vendor/k8s.io/apimachinery/pkg/apimachinery/announced/BUILD
generated
vendored
Normal file
35
vendor/k8s.io/apimachinery/pkg/apimachinery/announced/BUILD
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
|
"go_library",
|
||||||
|
"go_test",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_test(
|
||||||
|
name = "go_default_test",
|
||||||
|
srcs = ["announced_test.go"],
|
||||||
|
library = ":go_default_library",
|
||||||
|
tags = ["automanaged"],
|
||||||
|
deps = ["//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library"],
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = [
|
||||||
|
"announced.go",
|
||||||
|
"group_factory.go",
|
||||||
|
],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
deps = [
|
||||||
|
"//vendor/github.com/golang/glog:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/api/meta:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/apimachinery:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/apimachinery/registered:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
99
vendor/k8s.io/apimachinery/pkg/apimachinery/announced/announced.go
generated
vendored
Normal file
99
vendor/k8s.io/apimachinery/pkg/apimachinery/announced/announced.go
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
/*
|
||||||
|
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 announced contains tools for announcing API group factories. This is
|
||||||
|
// distinct from registration (in the 'registered' package) in that it's safe
|
||||||
|
// to announce every possible group linked in, but only groups requested at
|
||||||
|
// runtime should be registered. This package contains both a registry, and
|
||||||
|
// factory code (which was formerly copy-pasta in every install package).
|
||||||
|
package announced
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"k8s.io/apimachinery/pkg/apimachinery/registered"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
// APIGroupFactoryRegistry allows for groups and versions to announce themselves,
|
||||||
|
// which simply makes them available and doesn't take other actions. Later,
|
||||||
|
// users of the registry can select which groups and versions they'd actually
|
||||||
|
// like to register with an APIRegistrationManager.
|
||||||
|
//
|
||||||
|
// (Right now APIRegistrationManager has separate 'registration' and 'enabled'
|
||||||
|
// concepts-- APIGroupFactory is going to take over the former function;
|
||||||
|
// they will overlap untill the refactoring is finished.)
|
||||||
|
//
|
||||||
|
// The key is the group name. After initialization, this should be treated as
|
||||||
|
// read-only. It is implemented as a map from group name to group factory, and
|
||||||
|
// it is safe to use this knowledge to manually pick out groups to register
|
||||||
|
// (e.g., for testing).
|
||||||
|
type APIGroupFactoryRegistry map[string]*GroupMetaFactory
|
||||||
|
|
||||||
|
func (gar APIGroupFactoryRegistry) group(groupName string) *GroupMetaFactory {
|
||||||
|
gmf, ok := gar[groupName]
|
||||||
|
if !ok {
|
||||||
|
gmf = &GroupMetaFactory{VersionArgs: map[string]*GroupVersionFactoryArgs{}}
|
||||||
|
gar[groupName] = gmf
|
||||||
|
}
|
||||||
|
return gmf
|
||||||
|
}
|
||||||
|
|
||||||
|
// AnnounceGroupVersion adds the particular arguments for this group version to the group factory.
|
||||||
|
func (gar APIGroupFactoryRegistry) AnnounceGroupVersion(gvf *GroupVersionFactoryArgs) error {
|
||||||
|
gmf := gar.group(gvf.GroupName)
|
||||||
|
if _, ok := gmf.VersionArgs[gvf.VersionName]; ok {
|
||||||
|
return fmt.Errorf("version %q in group %q has already been announced", gvf.VersionName, gvf.GroupName)
|
||||||
|
}
|
||||||
|
gmf.VersionArgs[gvf.VersionName] = gvf
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AnnounceGroup adds the group-wide arguments to the group factory.
|
||||||
|
func (gar APIGroupFactoryRegistry) AnnounceGroup(args *GroupMetaFactoryArgs) error {
|
||||||
|
gmf := gar.group(args.GroupName)
|
||||||
|
if gmf.GroupArgs != nil {
|
||||||
|
return fmt.Errorf("group %q has already been announced", args.GroupName)
|
||||||
|
}
|
||||||
|
gmf.GroupArgs = args
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterAndEnableAll throws every factory at the specified API registration
|
||||||
|
// manager, and lets it decide which to register. (If you want to do this a la
|
||||||
|
// cart, you may look through gar itself-- it's just a map.)
|
||||||
|
func (gar APIGroupFactoryRegistry) RegisterAndEnableAll(m *registered.APIRegistrationManager, scheme *runtime.Scheme) error {
|
||||||
|
for groupName, gmf := range gar {
|
||||||
|
if err := gmf.Register(m); err != nil {
|
||||||
|
return fmt.Errorf("error registering %v: %v", groupName, err)
|
||||||
|
}
|
||||||
|
if err := gmf.Enable(m, scheme); err != nil {
|
||||||
|
return fmt.Errorf("error enabling %v: %v", groupName, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AnnouncePreconstructedFactory announces a factory which you've manually assembled.
|
||||||
|
// You may call this instead of calling AnnounceGroup and AnnounceGroupVersion.
|
||||||
|
func (gar APIGroupFactoryRegistry) AnnouncePreconstructedFactory(gmf *GroupMetaFactory) error {
|
||||||
|
name := gmf.GroupArgs.GroupName
|
||||||
|
if _, exists := gar[name]; exists {
|
||||||
|
return fmt.Errorf("the group %q has already been announced.", name)
|
||||||
|
}
|
||||||
|
gar[name] = gmf
|
||||||
|
return nil
|
||||||
|
}
|
252
vendor/k8s.io/apimachinery/pkg/apimachinery/announced/group_factory.go
generated
vendored
Normal file
252
vendor/k8s.io/apimachinery/pkg/apimachinery/announced/group_factory.go
generated
vendored
Normal file
@ -0,0 +1,252 @@
|
|||||||
|
/*
|
||||||
|
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 announced
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/golang/glog"
|
||||||
|
|
||||||
|
"k8s.io/apimachinery/pkg/api/meta"
|
||||||
|
"k8s.io/apimachinery/pkg/apimachinery"
|
||||||
|
"k8s.io/apimachinery/pkg/apimachinery/registered"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
|
)
|
||||||
|
|
||||||
|
type SchemeFunc func(*runtime.Scheme) error
|
||||||
|
type VersionToSchemeFunc map[string]SchemeFunc
|
||||||
|
|
||||||
|
// GroupVersionFactoryArgs contains all the per-version parts of a GroupMetaFactory.
|
||||||
|
type GroupVersionFactoryArgs struct {
|
||||||
|
GroupName string
|
||||||
|
VersionName string
|
||||||
|
|
||||||
|
AddToScheme SchemeFunc
|
||||||
|
}
|
||||||
|
|
||||||
|
// GroupMetaFactoryArgs contains the group-level args of a GroupMetaFactory.
|
||||||
|
type GroupMetaFactoryArgs struct {
|
||||||
|
// GroupName is the name of the API-Group
|
||||||
|
//
|
||||||
|
// example: 'servicecatalog.k8s.io'
|
||||||
|
GroupName string
|
||||||
|
VersionPreferenceOrder []string
|
||||||
|
// ImportPrefix is the base go package of the API-Group
|
||||||
|
//
|
||||||
|
// example: 'k8s.io/kubernetes/pkg/apis/autoscaling'
|
||||||
|
ImportPrefix string
|
||||||
|
// RootScopedKinds are resources that are not namespaced.
|
||||||
|
RootScopedKinds sets.String // nil is allowed
|
||||||
|
IgnoredKinds sets.String // nil is allowed
|
||||||
|
|
||||||
|
// May be nil if there are no internal objects.
|
||||||
|
AddInternalObjectsToScheme SchemeFunc
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGroupMetaFactory builds the args for you. This is for if you're
|
||||||
|
// constructing a factory all at once and not using the registry.
|
||||||
|
func NewGroupMetaFactory(groupArgs *GroupMetaFactoryArgs, versions VersionToSchemeFunc) *GroupMetaFactory {
|
||||||
|
gmf := &GroupMetaFactory{
|
||||||
|
GroupArgs: groupArgs,
|
||||||
|
VersionArgs: map[string]*GroupVersionFactoryArgs{},
|
||||||
|
}
|
||||||
|
for v, f := range versions {
|
||||||
|
gmf.VersionArgs[v] = &GroupVersionFactoryArgs{
|
||||||
|
GroupName: groupArgs.GroupName,
|
||||||
|
VersionName: v,
|
||||||
|
AddToScheme: f,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return gmf
|
||||||
|
}
|
||||||
|
|
||||||
|
// Announce adds this Group factory to the global factory registry. It should
|
||||||
|
// only be called if you constructed the GroupMetaFactory yourself via
|
||||||
|
// NewGroupMetaFactory.
|
||||||
|
// Note that this will panic on an error, since it's expected that you'll be
|
||||||
|
// calling this at initialization time and any error is a result of a
|
||||||
|
// programmer importing the wrong set of packages. If this assumption doesn't
|
||||||
|
// work for you, just call DefaultGroupFactoryRegistry.AnnouncePreconstructedFactory
|
||||||
|
// yourself.
|
||||||
|
func (gmf *GroupMetaFactory) Announce(groupFactoryRegistry APIGroupFactoryRegistry) *GroupMetaFactory {
|
||||||
|
if err := groupFactoryRegistry.AnnouncePreconstructedFactory(gmf); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return gmf
|
||||||
|
}
|
||||||
|
|
||||||
|
// GroupMetaFactory has the logic for actually assembling and registering a group.
|
||||||
|
//
|
||||||
|
// There are two ways of obtaining one of these.
|
||||||
|
// 1. You can announce your group and versions separately, and then let the
|
||||||
|
// GroupFactoryRegistry assemble this object for you. (This allows group and
|
||||||
|
// versions to be imported separately, without referencing each other, to
|
||||||
|
// keep import trees small.)
|
||||||
|
// 2. You can call NewGroupMetaFactory(), which is mostly a drop-in replacement
|
||||||
|
// for the old, bad way of doing things. You can then call .Announce() to
|
||||||
|
// announce your constructed factory to any code that would like to do
|
||||||
|
// things the new, better way.
|
||||||
|
//
|
||||||
|
// Note that GroupMetaFactory actually does construct GroupMeta objects, but
|
||||||
|
// currently it does so in a way that's very entangled with an
|
||||||
|
// APIRegistrationManager. It's a TODO item to cleanly separate that interface.
|
||||||
|
type GroupMetaFactory struct {
|
||||||
|
GroupArgs *GroupMetaFactoryArgs
|
||||||
|
// map of version name to version factory
|
||||||
|
VersionArgs map[string]*GroupVersionFactoryArgs
|
||||||
|
|
||||||
|
// assembled by Register()
|
||||||
|
prioritizedVersionList []schema.GroupVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register constructs the finalized prioritized version list and sanity checks
|
||||||
|
// the announced group & versions. Then it calls register.
|
||||||
|
func (gmf *GroupMetaFactory) Register(m *registered.APIRegistrationManager) error {
|
||||||
|
if gmf.GroupArgs == nil {
|
||||||
|
return fmt.Errorf("partially announced groups are not allowed, only got versions: %#v", gmf.VersionArgs)
|
||||||
|
}
|
||||||
|
if len(gmf.VersionArgs) == 0 {
|
||||||
|
return fmt.Errorf("group %v announced but no versions announced", gmf.GroupArgs.GroupName)
|
||||||
|
}
|
||||||
|
|
||||||
|
pvSet := sets.NewString(gmf.GroupArgs.VersionPreferenceOrder...)
|
||||||
|
if pvSet.Len() != len(gmf.GroupArgs.VersionPreferenceOrder) {
|
||||||
|
return fmt.Errorf("preference order for group %v has duplicates: %v", gmf.GroupArgs.GroupName, gmf.GroupArgs.VersionPreferenceOrder)
|
||||||
|
}
|
||||||
|
prioritizedVersions := []schema.GroupVersion{}
|
||||||
|
for _, v := range gmf.GroupArgs.VersionPreferenceOrder {
|
||||||
|
prioritizedVersions = append(
|
||||||
|
prioritizedVersions,
|
||||||
|
schema.GroupVersion{
|
||||||
|
Group: gmf.GroupArgs.GroupName,
|
||||||
|
Version: v,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Go through versions that weren't explicitly prioritized.
|
||||||
|
unprioritizedVersions := []schema.GroupVersion{}
|
||||||
|
for _, v := range gmf.VersionArgs {
|
||||||
|
if v.GroupName != gmf.GroupArgs.GroupName {
|
||||||
|
return fmt.Errorf("found %v/%v in group %v?", v.GroupName, v.VersionName, gmf.GroupArgs.GroupName)
|
||||||
|
}
|
||||||
|
if pvSet.Has(v.VersionName) {
|
||||||
|
pvSet.Delete(v.VersionName)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
unprioritizedVersions = append(unprioritizedVersions, schema.GroupVersion{Group: v.GroupName, Version: v.VersionName})
|
||||||
|
}
|
||||||
|
if len(unprioritizedVersions) > 1 {
|
||||||
|
glog.Warningf("group %v has multiple unprioritized versions: %#v. They will have an arbitrary preference order!", gmf.GroupArgs.GroupName, unprioritizedVersions)
|
||||||
|
}
|
||||||
|
if pvSet.Len() != 0 {
|
||||||
|
return fmt.Errorf("group %v has versions in the priority list that were never announced: %s", gmf.GroupArgs.GroupName, pvSet)
|
||||||
|
}
|
||||||
|
prioritizedVersions = append(prioritizedVersions, unprioritizedVersions...)
|
||||||
|
m.RegisterVersions(prioritizedVersions)
|
||||||
|
gmf.prioritizedVersionList = prioritizedVersions
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (gmf *GroupMetaFactory) newRESTMapper(scheme *runtime.Scheme, externalVersions []schema.GroupVersion, groupMeta *apimachinery.GroupMeta) meta.RESTMapper {
|
||||||
|
// the list of kinds that are scoped at the root of the api hierarchy
|
||||||
|
// if a kind is not enumerated here, it is assumed to have a namespace scope
|
||||||
|
rootScoped := sets.NewString()
|
||||||
|
if gmf.GroupArgs.RootScopedKinds != nil {
|
||||||
|
rootScoped = gmf.GroupArgs.RootScopedKinds
|
||||||
|
}
|
||||||
|
ignoredKinds := sets.NewString()
|
||||||
|
if gmf.GroupArgs.IgnoredKinds != nil {
|
||||||
|
ignoredKinds = gmf.GroupArgs.IgnoredKinds
|
||||||
|
}
|
||||||
|
|
||||||
|
return meta.NewDefaultRESTMapperFromScheme(
|
||||||
|
externalVersions,
|
||||||
|
groupMeta.InterfacesFor,
|
||||||
|
gmf.GroupArgs.ImportPrefix,
|
||||||
|
ignoredKinds,
|
||||||
|
rootScoped,
|
||||||
|
scheme,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable enables group versions that are allowed, adds methods to the scheme, etc.
|
||||||
|
func (gmf *GroupMetaFactory) Enable(m *registered.APIRegistrationManager, scheme *runtime.Scheme) error {
|
||||||
|
externalVersions := []schema.GroupVersion{}
|
||||||
|
for _, v := range gmf.prioritizedVersionList {
|
||||||
|
if !m.IsAllowedVersion(v) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
externalVersions = append(externalVersions, v)
|
||||||
|
if err := m.EnableVersions(v); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
gmf.VersionArgs[v.Version].AddToScheme(scheme)
|
||||||
|
}
|
||||||
|
if len(externalVersions) == 0 {
|
||||||
|
glog.V(4).Infof("No version is registered for group %v", gmf.GroupArgs.GroupName)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if gmf.GroupArgs.AddInternalObjectsToScheme != nil {
|
||||||
|
gmf.GroupArgs.AddInternalObjectsToScheme(scheme)
|
||||||
|
}
|
||||||
|
|
||||||
|
preferredExternalVersion := externalVersions[0]
|
||||||
|
accessor := meta.NewAccessor()
|
||||||
|
|
||||||
|
groupMeta := &apimachinery.GroupMeta{
|
||||||
|
GroupVersion: preferredExternalVersion,
|
||||||
|
GroupVersions: externalVersions,
|
||||||
|
SelfLinker: runtime.SelfLinker(accessor),
|
||||||
|
}
|
||||||
|
for _, v := range externalVersions {
|
||||||
|
gvf := gmf.VersionArgs[v.Version]
|
||||||
|
if err := groupMeta.AddVersionInterfaces(
|
||||||
|
schema.GroupVersion{Group: gvf.GroupName, Version: gvf.VersionName},
|
||||||
|
&meta.VersionInterfaces{
|
||||||
|
ObjectConvertor: scheme,
|
||||||
|
MetadataAccessor: accessor,
|
||||||
|
},
|
||||||
|
); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
groupMeta.InterfacesFor = groupMeta.DefaultInterfacesFor
|
||||||
|
groupMeta.RESTMapper = gmf.newRESTMapper(scheme, externalVersions, groupMeta)
|
||||||
|
|
||||||
|
if err := m.RegisterGroup(*groupMeta); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterAndEnable is provided only to allow this code to get added in multiple steps.
|
||||||
|
// It's really bad that this is called in init() methods, but supporting this
|
||||||
|
// temporarily lets us do the change incrementally.
|
||||||
|
func (gmf *GroupMetaFactory) RegisterAndEnable(registry *registered.APIRegistrationManager, scheme *runtime.Scheme) error {
|
||||||
|
if err := gmf.Register(registry); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := gmf.Enable(registry, scheme); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
20
vendor/k8s.io/apimachinery/pkg/apimachinery/doc.go
generated
vendored
Normal file
20
vendor/k8s.io/apimachinery/pkg/apimachinery/doc.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
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 apimachinery contains the generic API machinery code that
|
||||||
|
// is common to both server and clients.
|
||||||
|
// This package should never import specific API objects.
|
||||||
|
package apimachinery // import "k8s.io/apimachinery/pkg/apimachinery"
|
33
vendor/k8s.io/apimachinery/pkg/apimachinery/registered/BUILD
generated
vendored
Normal file
33
vendor/k8s.io/apimachinery/pkg/apimachinery/registered/BUILD
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
|
"go_library",
|
||||||
|
"go_test",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_test(
|
||||||
|
name = "go_default_test",
|
||||||
|
srcs = ["registered_test.go"],
|
||||||
|
library = ":go_default_library",
|
||||||
|
tags = ["automanaged"],
|
||||||
|
deps = [
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/apimachinery:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = ["registered.go"],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
deps = [
|
||||||
|
"//vendor/github.com/golang/glog:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/api/meta:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/apimachinery:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
336
vendor/k8s.io/apimachinery/pkg/apimachinery/registered/registered.go
generated
vendored
Normal file
336
vendor/k8s.io/apimachinery/pkg/apimachinery/registered/registered.go
generated
vendored
Normal file
@ -0,0 +1,336 @@
|
|||||||
|
/*
|
||||||
|
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 to keep track of API Versions that can be registered and are enabled in api.Scheme.
|
||||||
|
package registered
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"sort"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/golang/glog"
|
||||||
|
|
||||||
|
"k8s.io/apimachinery/pkg/api/meta"
|
||||||
|
"k8s.io/apimachinery/pkg/apimachinery"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
|
)
|
||||||
|
|
||||||
|
// APIRegistrationManager provides the concept of what API groups are enabled.
|
||||||
|
//
|
||||||
|
// TODO: currently, it also provides a "registered" concept. But it's wrong to
|
||||||
|
// have both concepts in the same object. Therefore the "announced" package is
|
||||||
|
// going to take over the registered concept. After all the install packages
|
||||||
|
// are switched to using the announce package instead of this package, then we
|
||||||
|
// can combine the registered/enabled concepts in this object. Simplifying this
|
||||||
|
// isn't easy right now because there are so many callers of this package.
|
||||||
|
type APIRegistrationManager struct {
|
||||||
|
// registeredGroupVersions stores all API group versions for which RegisterGroup is called.
|
||||||
|
registeredVersions map[schema.GroupVersion]struct{}
|
||||||
|
|
||||||
|
// enabledVersions represents all enabled API versions. It should be a
|
||||||
|
// subset of registeredVersions. Please call EnableVersions() to add
|
||||||
|
// enabled versions.
|
||||||
|
enabledVersions map[schema.GroupVersion]struct{}
|
||||||
|
|
||||||
|
// map of group meta for all groups.
|
||||||
|
groupMetaMap map[string]*apimachinery.GroupMeta
|
||||||
|
|
||||||
|
// envRequestedVersions represents the versions requested via the
|
||||||
|
// KUBE_API_VERSIONS environment variable. The install package of each group
|
||||||
|
// checks this list before add their versions to the latest package and
|
||||||
|
// Scheme. This list is small and order matters, so represent as a slice
|
||||||
|
envRequestedVersions []schema.GroupVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAPIRegistrationManager constructs a new manager. The argument ought to be
|
||||||
|
// the value of the KUBE_API_VERSIONS env var, or a value of this which you
|
||||||
|
// wish to test.
|
||||||
|
func NewAPIRegistrationManager(kubeAPIVersions string) (*APIRegistrationManager, error) {
|
||||||
|
m := &APIRegistrationManager{
|
||||||
|
registeredVersions: map[schema.GroupVersion]struct{}{},
|
||||||
|
enabledVersions: map[schema.GroupVersion]struct{}{},
|
||||||
|
groupMetaMap: map[string]*apimachinery.GroupMeta{},
|
||||||
|
envRequestedVersions: []schema.GroupVersion{},
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(kubeAPIVersions) != 0 {
|
||||||
|
for _, version := range strings.Split(kubeAPIVersions, ",") {
|
||||||
|
gv, err := schema.ParseGroupVersion(version)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("invalid api version: %s in KUBE_API_VERSIONS: %s.",
|
||||||
|
version, kubeAPIVersions)
|
||||||
|
}
|
||||||
|
m.envRequestedVersions = append(m.envRequestedVersions, gv)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewOrDie(kubeAPIVersions string) *APIRegistrationManager {
|
||||||
|
m, err := NewAPIRegistrationManager(kubeAPIVersions)
|
||||||
|
if err != nil {
|
||||||
|
glog.Fatalf("Could not construct version manager: %v (KUBE_API_VERSIONS=%q)", err, kubeAPIVersions)
|
||||||
|
}
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterVersions adds the given group versions to the list of registered group versions.
|
||||||
|
func (m *APIRegistrationManager) RegisterVersions(availableVersions []schema.GroupVersion) {
|
||||||
|
for _, v := range availableVersions {
|
||||||
|
m.registeredVersions[v] = struct{}{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterGroup adds the given group to the list of registered groups.
|
||||||
|
func (m *APIRegistrationManager) RegisterGroup(groupMeta apimachinery.GroupMeta) error {
|
||||||
|
groupName := groupMeta.GroupVersion.Group
|
||||||
|
if _, found := m.groupMetaMap[groupName]; found {
|
||||||
|
return fmt.Errorf("group %q is already registered in groupsMap: %v", groupName, m.groupMetaMap)
|
||||||
|
}
|
||||||
|
m.groupMetaMap[groupName] = &groupMeta
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EnableVersions adds the versions for the given group to the list of enabled versions.
|
||||||
|
// Note that the caller should call RegisterGroup before calling this method.
|
||||||
|
// The caller of this function is responsible to add the versions to scheme and RESTMapper.
|
||||||
|
func (m *APIRegistrationManager) EnableVersions(versions ...schema.GroupVersion) error {
|
||||||
|
var unregisteredVersions []schema.GroupVersion
|
||||||
|
for _, v := range versions {
|
||||||
|
if _, found := m.registeredVersions[v]; !found {
|
||||||
|
unregisteredVersions = append(unregisteredVersions, v)
|
||||||
|
}
|
||||||
|
m.enabledVersions[v] = struct{}{}
|
||||||
|
}
|
||||||
|
if len(unregisteredVersions) != 0 {
|
||||||
|
return fmt.Errorf("Please register versions before enabling them: %v", unregisteredVersions)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsAllowedVersion returns if the version is allowed by the KUBE_API_VERSIONS
|
||||||
|
// environment variable. If the environment variable is empty, then it always
|
||||||
|
// returns true.
|
||||||
|
func (m *APIRegistrationManager) IsAllowedVersion(v schema.GroupVersion) bool {
|
||||||
|
if len(m.envRequestedVersions) == 0 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
for _, envGV := range m.envRequestedVersions {
|
||||||
|
if v == envGV {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsEnabledVersion returns if a version is enabled.
|
||||||
|
func (m *APIRegistrationManager) IsEnabledVersion(v schema.GroupVersion) bool {
|
||||||
|
_, found := m.enabledVersions[v]
|
||||||
|
return found
|
||||||
|
}
|
||||||
|
|
||||||
|
// EnabledVersions returns all enabled versions. Groups are randomly ordered, but versions within groups
|
||||||
|
// are priority order from best to worst
|
||||||
|
func (m *APIRegistrationManager) EnabledVersions() []schema.GroupVersion {
|
||||||
|
ret := []schema.GroupVersion{}
|
||||||
|
for _, groupMeta := range m.groupMetaMap {
|
||||||
|
for _, version := range groupMeta.GroupVersions {
|
||||||
|
if m.IsEnabledVersion(version) {
|
||||||
|
ret = append(ret, version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
|
// EnabledVersionsForGroup returns all enabled versions for a group in order of best to worst
|
||||||
|
func (m *APIRegistrationManager) EnabledVersionsForGroup(group string) []schema.GroupVersion {
|
||||||
|
groupMeta, ok := m.groupMetaMap[group]
|
||||||
|
if !ok {
|
||||||
|
return []schema.GroupVersion{}
|
||||||
|
}
|
||||||
|
|
||||||
|
ret := []schema.GroupVersion{}
|
||||||
|
for _, version := range groupMeta.GroupVersions {
|
||||||
|
if m.IsEnabledVersion(version) {
|
||||||
|
ret = append(ret, version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
|
// Group returns the metadata of a group if the group is registered, otherwise
|
||||||
|
// an error is returned.
|
||||||
|
func (m *APIRegistrationManager) Group(group string) (*apimachinery.GroupMeta, error) {
|
||||||
|
groupMeta, found := m.groupMetaMap[group]
|
||||||
|
if !found {
|
||||||
|
return nil, fmt.Errorf("group %v has not been registered", group)
|
||||||
|
}
|
||||||
|
groupMetaCopy := *groupMeta
|
||||||
|
return &groupMetaCopy, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRegistered takes a string and determines if it's one of the registered groups
|
||||||
|
func (m *APIRegistrationManager) IsRegistered(group string) bool {
|
||||||
|
_, found := m.groupMetaMap[group]
|
||||||
|
return found
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRegisteredVersion returns if a version is registered.
|
||||||
|
func (m *APIRegistrationManager) IsRegisteredVersion(v schema.GroupVersion) bool {
|
||||||
|
_, found := m.registeredVersions[v]
|
||||||
|
return found
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisteredGroupVersions returns all registered group versions.
|
||||||
|
func (m *APIRegistrationManager) RegisteredGroupVersions() []schema.GroupVersion {
|
||||||
|
ret := []schema.GroupVersion{}
|
||||||
|
for groupVersion := range m.registeredVersions {
|
||||||
|
ret = append(ret, groupVersion)
|
||||||
|
}
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
|
// InterfacesFor is a union meta.VersionInterfacesFunc func for all registered types
|
||||||
|
func (m *APIRegistrationManager) InterfacesFor(version schema.GroupVersion) (*meta.VersionInterfaces, error) {
|
||||||
|
groupMeta, err := m.Group(version.Group)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return groupMeta.InterfacesFor(version)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: This is an expedient function, because we don't check if a Group is
|
||||||
|
// supported throughout the code base. We will abandon this function and
|
||||||
|
// checking the error returned by the Group() function.
|
||||||
|
func (m *APIRegistrationManager) GroupOrDie(group string) *apimachinery.GroupMeta {
|
||||||
|
groupMeta, found := m.groupMetaMap[group]
|
||||||
|
if !found {
|
||||||
|
if group == "" {
|
||||||
|
panic("The legacy v1 API is not registered.")
|
||||||
|
} else {
|
||||||
|
panic(fmt.Sprintf("Group %s is not registered.", group))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
groupMetaCopy := *groupMeta
|
||||||
|
return &groupMetaCopy
|
||||||
|
}
|
||||||
|
|
||||||
|
// RESTMapper returns a union RESTMapper of all known types with priorities chosen in the following order:
|
||||||
|
// 1. if KUBE_API_VERSIONS is specified, then KUBE_API_VERSIONS in order, OR
|
||||||
|
// 1. legacy kube group preferred version, extensions preferred version, metrics perferred version, legacy
|
||||||
|
// kube any version, extensions any version, metrics any version, all other groups alphabetical preferred version,
|
||||||
|
// all other groups alphabetical.
|
||||||
|
func (m *APIRegistrationManager) RESTMapper(versionPatterns ...schema.GroupVersion) meta.RESTMapper {
|
||||||
|
unionMapper := meta.MultiRESTMapper{}
|
||||||
|
unionedGroups := sets.NewString()
|
||||||
|
for enabledVersion := range m.enabledVersions {
|
||||||
|
if !unionedGroups.Has(enabledVersion.Group) {
|
||||||
|
unionedGroups.Insert(enabledVersion.Group)
|
||||||
|
groupMeta := m.groupMetaMap[enabledVersion.Group]
|
||||||
|
unionMapper = append(unionMapper, groupMeta.RESTMapper)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(versionPatterns) != 0 {
|
||||||
|
resourcePriority := []schema.GroupVersionResource{}
|
||||||
|
kindPriority := []schema.GroupVersionKind{}
|
||||||
|
for _, versionPriority := range versionPatterns {
|
||||||
|
resourcePriority = append(resourcePriority, versionPriority.WithResource(meta.AnyResource))
|
||||||
|
kindPriority = append(kindPriority, versionPriority.WithKind(meta.AnyKind))
|
||||||
|
}
|
||||||
|
|
||||||
|
return meta.PriorityRESTMapper{Delegate: unionMapper, ResourcePriority: resourcePriority, KindPriority: kindPriority}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(m.envRequestedVersions) != 0 {
|
||||||
|
resourcePriority := []schema.GroupVersionResource{}
|
||||||
|
kindPriority := []schema.GroupVersionKind{}
|
||||||
|
|
||||||
|
for _, versionPriority := range m.envRequestedVersions {
|
||||||
|
resourcePriority = append(resourcePriority, versionPriority.WithResource(meta.AnyResource))
|
||||||
|
kindPriority = append(kindPriority, versionPriority.WithKind(meta.AnyKind))
|
||||||
|
}
|
||||||
|
|
||||||
|
return meta.PriorityRESTMapper{Delegate: unionMapper, ResourcePriority: resourcePriority, KindPriority: kindPriority}
|
||||||
|
}
|
||||||
|
|
||||||
|
prioritizedGroups := []string{"", "extensions", "metrics"}
|
||||||
|
resourcePriority, kindPriority := m.prioritiesForGroups(prioritizedGroups...)
|
||||||
|
|
||||||
|
prioritizedGroupsSet := sets.NewString(prioritizedGroups...)
|
||||||
|
remainingGroups := sets.String{}
|
||||||
|
for enabledVersion := range m.enabledVersions {
|
||||||
|
if !prioritizedGroupsSet.Has(enabledVersion.Group) {
|
||||||
|
remainingGroups.Insert(enabledVersion.Group)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
remainingResourcePriority, remainingKindPriority := m.prioritiesForGroups(remainingGroups.List()...)
|
||||||
|
resourcePriority = append(resourcePriority, remainingResourcePriority...)
|
||||||
|
kindPriority = append(kindPriority, remainingKindPriority...)
|
||||||
|
|
||||||
|
return meta.PriorityRESTMapper{Delegate: unionMapper, ResourcePriority: resourcePriority, KindPriority: kindPriority}
|
||||||
|
}
|
||||||
|
|
||||||
|
// prioritiesForGroups returns the resource and kind priorities for a PriorityRESTMapper, preferring the preferred version of each group first,
|
||||||
|
// then any non-preferred version of the group second.
|
||||||
|
func (m *APIRegistrationManager) prioritiesForGroups(groups ...string) ([]schema.GroupVersionResource, []schema.GroupVersionKind) {
|
||||||
|
resourcePriority := []schema.GroupVersionResource{}
|
||||||
|
kindPriority := []schema.GroupVersionKind{}
|
||||||
|
|
||||||
|
for _, group := range groups {
|
||||||
|
availableVersions := m.EnabledVersionsForGroup(group)
|
||||||
|
if len(availableVersions) > 0 {
|
||||||
|
resourcePriority = append(resourcePriority, availableVersions[0].WithResource(meta.AnyResource))
|
||||||
|
kindPriority = append(kindPriority, availableVersions[0].WithKind(meta.AnyKind))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, group := range groups {
|
||||||
|
resourcePriority = append(resourcePriority, schema.GroupVersionResource{Group: group, Version: meta.AnyVersion, Resource: meta.AnyResource})
|
||||||
|
kindPriority = append(kindPriority, schema.GroupVersionKind{Group: group, Version: meta.AnyVersion, Kind: meta.AnyKind})
|
||||||
|
}
|
||||||
|
|
||||||
|
return resourcePriority, kindPriority
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllPreferredGroupVersions returns the preferred versions of all registered
|
||||||
|
// groups in the form of "group1/version1,group2/version2,..."
|
||||||
|
func (m *APIRegistrationManager) AllPreferredGroupVersions() string {
|
||||||
|
if len(m.groupMetaMap) == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
var defaults []string
|
||||||
|
for _, groupMeta := range m.groupMetaMap {
|
||||||
|
defaults = append(defaults, groupMeta.GroupVersion.String())
|
||||||
|
}
|
||||||
|
sort.Strings(defaults)
|
||||||
|
return strings.Join(defaults, ",")
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateEnvRequestedVersions returns a list of versions that are requested in
|
||||||
|
// the KUBE_API_VERSIONS environment variable, but not enabled.
|
||||||
|
func (m *APIRegistrationManager) ValidateEnvRequestedVersions() []schema.GroupVersion {
|
||||||
|
var missingVersions []schema.GroupVersion
|
||||||
|
for _, v := range m.envRequestedVersions {
|
||||||
|
if _, found := m.enabledVersions[v]; !found {
|
||||||
|
missingVersions = append(missingVersions, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return missingVersions
|
||||||
|
}
|
87
vendor/k8s.io/apimachinery/pkg/apimachinery/types.go
generated
vendored
Normal file
87
vendor/k8s.io/apimachinery/pkg/apimachinery/types.go
generated
vendored
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
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 apimachinery
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"k8s.io/apimachinery/pkg/api/meta"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GroupMeta stores the metadata of a group.
|
||||||
|
type GroupMeta struct {
|
||||||
|
// GroupVersion represents the preferred version of the group.
|
||||||
|
GroupVersion schema.GroupVersion
|
||||||
|
|
||||||
|
// GroupVersions is Group + all versions in that group.
|
||||||
|
GroupVersions []schema.GroupVersion
|
||||||
|
|
||||||
|
// SelfLinker can set or get the SelfLink field of all API types.
|
||||||
|
// TODO: when versioning changes, make this part of each API definition.
|
||||||
|
// TODO(lavalamp): Combine SelfLinker & ResourceVersioner interfaces, force all uses
|
||||||
|
// to go through the InterfacesFor method below.
|
||||||
|
SelfLinker runtime.SelfLinker
|
||||||
|
|
||||||
|
// RESTMapper provides the default mapping between REST paths and the objects declared in api.Scheme and all known
|
||||||
|
// versions.
|
||||||
|
RESTMapper meta.RESTMapper
|
||||||
|
|
||||||
|
// InterfacesFor returns the default Codec and ResourceVersioner for a given version
|
||||||
|
// string, or an error if the version is not known.
|
||||||
|
// TODO: make this stop being a func pointer and always use the default
|
||||||
|
// function provided below once every place that populates this field has been changed.
|
||||||
|
InterfacesFor func(version schema.GroupVersion) (*meta.VersionInterfaces, error)
|
||||||
|
|
||||||
|
// InterfacesByVersion stores the per-version interfaces.
|
||||||
|
InterfacesByVersion map[schema.GroupVersion]*meta.VersionInterfaces
|
||||||
|
}
|
||||||
|
|
||||||
|
// DefaultInterfacesFor returns the default Codec and ResourceVersioner for a given version
|
||||||
|
// string, or an error if the version is not known.
|
||||||
|
// TODO: Remove the "Default" prefix.
|
||||||
|
func (gm *GroupMeta) DefaultInterfacesFor(version schema.GroupVersion) (*meta.VersionInterfaces, error) {
|
||||||
|
if v, ok := gm.InterfacesByVersion[version]; ok {
|
||||||
|
return v, nil
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("unsupported storage version: %s (valid: %v)", version, gm.GroupVersions)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddVersionInterfaces adds the given version to the group. Only call during
|
||||||
|
// init, after that GroupMeta objects should be immutable. Not thread safe.
|
||||||
|
// (If you use this, be sure to set .InterfacesFor = .DefaultInterfacesFor)
|
||||||
|
// TODO: remove the "Interfaces" suffix and make this also maintain the
|
||||||
|
// .GroupVersions member.
|
||||||
|
func (gm *GroupMeta) AddVersionInterfaces(version schema.GroupVersion, interfaces *meta.VersionInterfaces) error {
|
||||||
|
if e, a := gm.GroupVersion.Group, version.Group; a != e {
|
||||||
|
return fmt.Errorf("got a version in group %v, but am in group %v", a, e)
|
||||||
|
}
|
||||||
|
if gm.InterfacesByVersion == nil {
|
||||||
|
gm.InterfacesByVersion = make(map[schema.GroupVersion]*meta.VersionInterfaces)
|
||||||
|
}
|
||||||
|
gm.InterfacesByVersion[version] = interfaces
|
||||||
|
|
||||||
|
// TODO: refactor to make the below error not possible, this function
|
||||||
|
// should *set* GroupVersions rather than depend on it.
|
||||||
|
for _, v := range gm.GroupVersions {
|
||||||
|
if v == version {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fmt.Errorf("added a version interface without the corresponding version %v being in the list %#v", version, gm.GroupVersions)
|
||||||
|
}
|
22
vendor/k8s.io/apimachinery/pkg/util/rand/BUILD
generated
vendored
Normal file
22
vendor/k8s.io/apimachinery/pkg/util/rand/BUILD
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
|
"go_library",
|
||||||
|
"go_test",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_test(
|
||||||
|
name = "go_default_test",
|
||||||
|
srcs = ["rand_test.go"],
|
||||||
|
library = ":go_default_library",
|
||||||
|
tags = ["automanaged"],
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = ["rand.go"],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
)
|
85
vendor/k8s.io/apimachinery/pkg/util/rand/rand.go
generated
vendored
Normal file
85
vendor/k8s.io/apimachinery/pkg/util/rand/rand.go
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
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 rand provides utilities related to randomization.
|
||||||
|
package rand
|
||||||
|
|
||||||
|
import (
|
||||||
|
"math/rand"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
var rng = struct {
|
||||||
|
sync.Mutex
|
||||||
|
rand *rand.Rand
|
||||||
|
}{
|
||||||
|
rand: rand.New(rand.NewSource(time.Now().UTC().UnixNano())),
|
||||||
|
}
|
||||||
|
|
||||||
|
// Intn generates an integer in range [0,max).
|
||||||
|
// By design this should panic if input is invalid, <= 0.
|
||||||
|
func Intn(max int) int {
|
||||||
|
rng.Lock()
|
||||||
|
defer rng.Unlock()
|
||||||
|
return rng.rand.Intn(max)
|
||||||
|
}
|
||||||
|
|
||||||
|
// IntnRange generates an integer in range [min,max).
|
||||||
|
// By design this should panic if input is invalid, <= 0.
|
||||||
|
func IntnRange(min, max int) int {
|
||||||
|
rng.Lock()
|
||||||
|
defer rng.Unlock()
|
||||||
|
return rng.rand.Intn(max-min) + min
|
||||||
|
}
|
||||||
|
|
||||||
|
// IntnRange generates an int64 integer in range [min,max).
|
||||||
|
// By design this should panic if input is invalid, <= 0.
|
||||||
|
func Int63nRange(min, max int64) int64 {
|
||||||
|
rng.Lock()
|
||||||
|
defer rng.Unlock()
|
||||||
|
return rng.rand.Int63n(max-min) + min
|
||||||
|
}
|
||||||
|
|
||||||
|
// Seed seeds the rng with the provided seed.
|
||||||
|
func Seed(seed int64) {
|
||||||
|
rng.Lock()
|
||||||
|
defer rng.Unlock()
|
||||||
|
|
||||||
|
rng.rand = rand.New(rand.NewSource(seed))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perm returns, as a slice of n ints, a pseudo-random permutation of the integers [0,n)
|
||||||
|
// from the default Source.
|
||||||
|
func Perm(n int) []int {
|
||||||
|
rng.Lock()
|
||||||
|
defer rng.Unlock()
|
||||||
|
return rng.rand.Perm(n)
|
||||||
|
}
|
||||||
|
|
||||||
|
// We omit vowels from the set of available characters to reduce the chances
|
||||||
|
// of "bad words" being formed.
|
||||||
|
var alphanums = []rune("bcdfghjklmnpqrstvwxz0123456789")
|
||||||
|
|
||||||
|
// String generates a random alphanumeric string, without vowels, which is n
|
||||||
|
// characters long. This will panic if n is less than zero.
|
||||||
|
func String(length int) string {
|
||||||
|
b := make([]rune, length)
|
||||||
|
for i := range b {
|
||||||
|
b[i] = alphanums[Intn(len(alphanums))]
|
||||||
|
}
|
||||||
|
return string(b)
|
||||||
|
}
|
54
vendor/k8s.io/apiserver/pkg/admission/BUILD
generated
vendored
Normal file
54
vendor/k8s.io/apiserver/pkg/admission/BUILD
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
|
"go_library",
|
||||||
|
"go_test",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_test(
|
||||||
|
name = "go_default_test",
|
||||||
|
srcs = [
|
||||||
|
"chain_test.go",
|
||||||
|
"config_test.go",
|
||||||
|
],
|
||||||
|
library = ":go_default_library",
|
||||||
|
tags = ["automanaged"],
|
||||||
|
deps = [
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
|
"//vendor/k8s.io/apiserver/pkg/apis/apiserver:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = [
|
||||||
|
"attributes.go",
|
||||||
|
"chain.go",
|
||||||
|
"config.go",
|
||||||
|
"errors.go",
|
||||||
|
"handler.go",
|
||||||
|
"interfaces.go",
|
||||||
|
"plugins.go",
|
||||||
|
],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
deps = [
|
||||||
|
"//vendor/github.com/ghodss/yaml:go_default_library",
|
||||||
|
"//vendor/github.com/golang/glog:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/api/meta:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/apimachinery/announced:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/apimachinery/registered:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/util/errors:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||||
|
"//vendor/k8s.io/apiserver/pkg/apis/apiserver:go_default_library",
|
||||||
|
"//vendor/k8s.io/apiserver/pkg/apis/apiserver/install:go_default_library",
|
||||||
|
"//vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1:go_default_library",
|
||||||
|
"//vendor/k8s.io/apiserver/pkg/authentication/user:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
85
vendor/k8s.io/apiserver/pkg/admission/attributes.go
generated
vendored
Normal file
85
vendor/k8s.io/apiserver/pkg/admission/attributes.go
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
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 admission
|
||||||
|
|
||||||
|
import (
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
"k8s.io/apiserver/pkg/authentication/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
type attributesRecord struct {
|
||||||
|
kind schema.GroupVersionKind
|
||||||
|
namespace string
|
||||||
|
name string
|
||||||
|
resource schema.GroupVersionResource
|
||||||
|
subresource string
|
||||||
|
operation Operation
|
||||||
|
object runtime.Object
|
||||||
|
oldObject runtime.Object
|
||||||
|
userInfo user.Info
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewAttributesRecord(object runtime.Object, oldObject runtime.Object, kind schema.GroupVersionKind, namespace, name string, resource schema.GroupVersionResource, subresource string, operation Operation, userInfo user.Info) Attributes {
|
||||||
|
return &attributesRecord{
|
||||||
|
kind: kind,
|
||||||
|
namespace: namespace,
|
||||||
|
name: name,
|
||||||
|
resource: resource,
|
||||||
|
subresource: subresource,
|
||||||
|
operation: operation,
|
||||||
|
object: object,
|
||||||
|
oldObject: oldObject,
|
||||||
|
userInfo: userInfo,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (record *attributesRecord) GetKind() schema.GroupVersionKind {
|
||||||
|
return record.kind
|
||||||
|
}
|
||||||
|
|
||||||
|
func (record *attributesRecord) GetNamespace() string {
|
||||||
|
return record.namespace
|
||||||
|
}
|
||||||
|
|
||||||
|
func (record *attributesRecord) GetName() string {
|
||||||
|
return record.name
|
||||||
|
}
|
||||||
|
|
||||||
|
func (record *attributesRecord) GetResource() schema.GroupVersionResource {
|
||||||
|
return record.resource
|
||||||
|
}
|
||||||
|
|
||||||
|
func (record *attributesRecord) GetSubresource() string {
|
||||||
|
return record.subresource
|
||||||
|
}
|
||||||
|
|
||||||
|
func (record *attributesRecord) GetOperation() Operation {
|
||||||
|
return record.operation
|
||||||
|
}
|
||||||
|
|
||||||
|
func (record *attributesRecord) GetObject() runtime.Object {
|
||||||
|
return record.object
|
||||||
|
}
|
||||||
|
|
||||||
|
func (record *attributesRecord) GetOldObject() runtime.Object {
|
||||||
|
return record.oldObject
|
||||||
|
}
|
||||||
|
|
||||||
|
func (record *attributesRecord) GetUserInfo() user.Info {
|
||||||
|
return record.userInfo
|
||||||
|
}
|
49
vendor/k8s.io/apiserver/pkg/admission/chain.go
generated
vendored
Normal file
49
vendor/k8s.io/apiserver/pkg/admission/chain.go
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
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 admission
|
||||||
|
|
||||||
|
// chainAdmissionHandler is an instance of admission.Interface that performs admission control using a chain of admission handlers
|
||||||
|
type chainAdmissionHandler []Interface
|
||||||
|
|
||||||
|
// NewChainHandler creates a new chain handler from an array of handlers. Used for testing.
|
||||||
|
func NewChainHandler(handlers ...Interface) Interface {
|
||||||
|
return chainAdmissionHandler(handlers)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Admit performs an admission control check using a chain of handlers, and returns immediately on first error
|
||||||
|
func (admissionHandler chainAdmissionHandler) Admit(a Attributes) error {
|
||||||
|
for _, handler := range admissionHandler {
|
||||||
|
if !handler.Handles(a.GetOperation()) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
err := handler.Admit(a)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handles will return true if any of the handlers handles the given operation
|
||||||
|
func (admissionHandler chainAdmissionHandler) Handles(operation Operation) bool {
|
||||||
|
for _, handler := range admissionHandler {
|
||||||
|
if handler.Handles(operation) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
193
vendor/k8s.io/apiserver/pkg/admission/config.go
generated
vendored
Normal file
193
vendor/k8s.io/apiserver/pkg/admission/config.go
generated
vendored
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
/*
|
||||||
|
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 admission
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/ghodss/yaml"
|
||||||
|
"github.com/golang/glog"
|
||||||
|
|
||||||
|
"bytes"
|
||||||
|
|
||||||
|
"k8s.io/apimachinery/pkg/apimachinery/announced"
|
||||||
|
"k8s.io/apimachinery/pkg/apimachinery/registered"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||||
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
|
"k8s.io/apiserver/pkg/apis/apiserver"
|
||||||
|
"k8s.io/apiserver/pkg/apis/apiserver/install"
|
||||||
|
apiserverv1alpha1 "k8s.io/apiserver/pkg/apis/apiserver/v1alpha1"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
groupFactoryRegistry = make(announced.APIGroupFactoryRegistry)
|
||||||
|
registry = registered.NewOrDie(os.Getenv("KUBE_API_VERSIONS"))
|
||||||
|
scheme = runtime.NewScheme()
|
||||||
|
codecs = serializer.NewCodecFactory(scheme)
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
install.Install(groupFactoryRegistry, registry, scheme)
|
||||||
|
}
|
||||||
|
|
||||||
|
func makeAbs(path, base string) (string, error) {
|
||||||
|
if filepath.IsAbs(path) {
|
||||||
|
return path, nil
|
||||||
|
}
|
||||||
|
if len(base) == 0 || base == "." {
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
base = cwd
|
||||||
|
}
|
||||||
|
return filepath.Join(base, path), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadAdmissionConfiguration reads the admission configuration at the specified path.
|
||||||
|
// It returns the loaded admission configuration if the input file aligns with the required syntax.
|
||||||
|
// If it does not align with the provided syntax, it returns a default configuration for the enumerated
|
||||||
|
// set of pluginNames whose config location references the specified configFilePath.
|
||||||
|
// It does this to preserve backward compatibility when admission control files were opaque.
|
||||||
|
// It returns an error if the file did not exist.
|
||||||
|
func ReadAdmissionConfiguration(pluginNames []string, configFilePath string) (ConfigProvider, error) {
|
||||||
|
if configFilePath == "" {
|
||||||
|
return configProvider{config: &apiserver.AdmissionConfiguration{}}, nil
|
||||||
|
}
|
||||||
|
// a file was provided, so we just read it.
|
||||||
|
data, err := ioutil.ReadFile(configFilePath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("unable to read admission control configuration from %q [%v]", configFilePath, err)
|
||||||
|
}
|
||||||
|
decoder := codecs.UniversalDecoder()
|
||||||
|
decodedObj, err := runtime.Decode(decoder, data)
|
||||||
|
// we were able to decode the file successfully
|
||||||
|
if err == nil {
|
||||||
|
decodedConfig, ok := decodedObj.(*apiserver.AdmissionConfiguration)
|
||||||
|
if !ok {
|
||||||
|
return nil, fmt.Errorf("unexpected type: %T", decodedObj)
|
||||||
|
}
|
||||||
|
baseDir := path.Dir(configFilePath)
|
||||||
|
for i := range decodedConfig.Plugins {
|
||||||
|
if decodedConfig.Plugins[i].Path == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
// we update relative file paths to absolute paths
|
||||||
|
absPath, err := makeAbs(decodedConfig.Plugins[i].Path, baseDir)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
decodedConfig.Plugins[i].Path = absPath
|
||||||
|
}
|
||||||
|
return configProvider{config: decodedConfig}, nil
|
||||||
|
}
|
||||||
|
// we got an error where the decode wasn't related to a missing type
|
||||||
|
if !(runtime.IsMissingVersion(err) || runtime.IsMissingKind(err) || runtime.IsNotRegisteredError(err)) {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// convert the legacy format to the new admission control format
|
||||||
|
// in order to preserve backwards compatibility, we set plugins that
|
||||||
|
// previously read input from a non-versioned file configuration to the
|
||||||
|
// current input file.
|
||||||
|
legacyPluginsWithUnversionedConfig := sets.NewString("ImagePolicyWebhook", "PodNodeSelector")
|
||||||
|
externalConfig := &apiserverv1alpha1.AdmissionConfiguration{}
|
||||||
|
for _, pluginName := range pluginNames {
|
||||||
|
if legacyPluginsWithUnversionedConfig.Has(pluginName) {
|
||||||
|
externalConfig.Plugins = append(externalConfig.Plugins,
|
||||||
|
apiserverv1alpha1.AdmissionPluginConfiguration{
|
||||||
|
Name: pluginName,
|
||||||
|
Path: configFilePath})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scheme.Default(externalConfig)
|
||||||
|
internalConfig := &apiserver.AdmissionConfiguration{}
|
||||||
|
if err := scheme.Convert(externalConfig, internalConfig, nil); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return configProvider{config: internalConfig}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type configProvider struct {
|
||||||
|
config *apiserver.AdmissionConfiguration
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetAdmissionPluginConfigurationFor returns a reader that holds the admission plugin configuration.
|
||||||
|
func GetAdmissionPluginConfigurationFor(pluginCfg apiserver.AdmissionPluginConfiguration) (io.Reader, error) {
|
||||||
|
// if there is nothing nested in the object, we return the named location
|
||||||
|
obj := pluginCfg.Configuration
|
||||||
|
if obj != nil {
|
||||||
|
// serialize the configuration and build a reader for it
|
||||||
|
content, err := writeYAML(obj)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return bytes.NewBuffer(content), nil
|
||||||
|
}
|
||||||
|
// there is nothing nested, so we delegate to path
|
||||||
|
if pluginCfg.Path != "" {
|
||||||
|
content, err := ioutil.ReadFile(pluginCfg.Path)
|
||||||
|
if err != nil {
|
||||||
|
glog.Fatalf("Couldn't open admission plugin configuration %s: %#v", pluginCfg.Path, err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return bytes.NewBuffer(content), nil
|
||||||
|
}
|
||||||
|
// there is no special config at all
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetAdmissionPluginConfiguration takes the admission configuration and returns a reader
|
||||||
|
// for the specified plugin. If no specific configuration is present, we return a nil reader.
|
||||||
|
func (p configProvider) ConfigFor(pluginName string) (io.Reader, error) {
|
||||||
|
// there is no config, so there is no potential config
|
||||||
|
if p.config == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
// look for matching plugin and get configuration
|
||||||
|
for _, pluginCfg := range p.config.Plugins {
|
||||||
|
if pluginName != pluginCfg.Name {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
pluginConfig, err := GetAdmissionPluginConfigurationFor(pluginCfg)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return pluginConfig, nil
|
||||||
|
}
|
||||||
|
// there is no registered config that matches on plugin name.
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// writeYAML writes the specified object to a byte array as yaml.
|
||||||
|
func writeYAML(obj runtime.Object) ([]byte, error) {
|
||||||
|
json, err := runtime.Encode(codecs.LegacyCodec(), obj)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
content, err := yaml.JSONToYAML(json)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return content, err
|
||||||
|
}
|
66
vendor/k8s.io/apiserver/pkg/admission/errors.go
generated
vendored
Normal file
66
vendor/k8s.io/apiserver/pkg/admission/errors.go
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
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 admission
|
||||||
|
|
||||||
|
import (
|
||||||
|
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
|
"k8s.io/apimachinery/pkg/api/meta"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
utilerrors "k8s.io/apimachinery/pkg/util/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
func extractResourceName(a Attributes) (name string, resource schema.GroupResource, err error) {
|
||||||
|
name = "Unknown"
|
||||||
|
resource = a.GetResource().GroupResource()
|
||||||
|
obj := a.GetObject()
|
||||||
|
if obj != nil {
|
||||||
|
accessor, err := meta.Accessor(obj)
|
||||||
|
if err != nil {
|
||||||
|
return "", schema.GroupResource{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// this is necessary because name object name generation has not occurred yet
|
||||||
|
if len(accessor.GetName()) > 0 {
|
||||||
|
name = accessor.GetName()
|
||||||
|
} else if len(accessor.GetGenerateName()) > 0 {
|
||||||
|
name = accessor.GetGenerateName()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return name, resource, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForbidden is a utility function to return a well-formatted admission control error response
|
||||||
|
func NewForbidden(a Attributes, internalError error) error {
|
||||||
|
// do not double wrap an error of same type
|
||||||
|
if apierrors.IsForbidden(internalError) {
|
||||||
|
return internalError
|
||||||
|
}
|
||||||
|
name, resource, err := extractResourceName(a)
|
||||||
|
if err != nil {
|
||||||
|
return apierrors.NewInternalError(utilerrors.NewAggregate([]error{internalError, err}))
|
||||||
|
}
|
||||||
|
return apierrors.NewForbidden(resource, name, internalError)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewNotFound is a utility function to return a well-formatted admission control error response
|
||||||
|
func NewNotFound(a Attributes) error {
|
||||||
|
name, resource, err := extractResourceName(a)
|
||||||
|
if err != nil {
|
||||||
|
return apierrors.NewInternalError(err)
|
||||||
|
}
|
||||||
|
return apierrors.NewNotFound(resource, name)
|
||||||
|
}
|
85
vendor/k8s.io/apiserver/pkg/admission/handler.go
generated
vendored
Normal file
85
vendor/k8s.io/apiserver/pkg/admission/handler.go
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
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 admission
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// timeToWaitForReady is the amount of time to wait to let an admission controller to be ready to satisfy a request.
|
||||||
|
// this is useful when admission controllers need to warm their caches before letting requests through.
|
||||||
|
timeToWaitForReady = 10 * time.Second
|
||||||
|
)
|
||||||
|
|
||||||
|
// ReadyFunc is a function that returns true if the admission controller is ready to handle requests.
|
||||||
|
type ReadyFunc func() bool
|
||||||
|
|
||||||
|
// Handler is a base for admission control handlers that
|
||||||
|
// support a predefined set of operations
|
||||||
|
type Handler struct {
|
||||||
|
operations sets.String
|
||||||
|
readyFunc ReadyFunc
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handles returns true for methods that this handler supports
|
||||||
|
func (h *Handler) Handles(operation Operation) bool {
|
||||||
|
return h.operations.Has(string(operation))
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewHandler creates a new base handler that handles the passed
|
||||||
|
// in operations
|
||||||
|
func NewHandler(ops ...Operation) *Handler {
|
||||||
|
operations := sets.NewString()
|
||||||
|
for _, op := range ops {
|
||||||
|
operations.Insert(string(op))
|
||||||
|
}
|
||||||
|
return &Handler{
|
||||||
|
operations: operations,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetReadyFunc allows late registration of a ReadyFunc to know if the handler is ready to process requests.
|
||||||
|
func (h *Handler) SetReadyFunc(readyFunc ReadyFunc) {
|
||||||
|
h.readyFunc = readyFunc
|
||||||
|
}
|
||||||
|
|
||||||
|
// WaitForReady will wait for the readyFunc (if registered) to return ready, and in case of timeout, will return false.
|
||||||
|
func (h *Handler) WaitForReady() bool {
|
||||||
|
// there is no ready func configured, so we return immediately
|
||||||
|
if h.readyFunc == nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return h.waitForReadyInternal(time.After(timeToWaitForReady))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *Handler) waitForReadyInternal(timeout <-chan time.Time) bool {
|
||||||
|
// there is no configured ready func, so return immediately
|
||||||
|
if h.readyFunc == nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
for !h.readyFunc() {
|
||||||
|
select {
|
||||||
|
case <-time.After(100 * time.Millisecond):
|
||||||
|
case <-timeout:
|
||||||
|
return h.readyFunc()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
90
vendor/k8s.io/apiserver/pkg/admission/interfaces.go
generated
vendored
Normal file
90
vendor/k8s.io/apiserver/pkg/admission/interfaces.go
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
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 admission
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
"k8s.io/apiserver/pkg/authentication/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Attributes is an interface used by AdmissionController to get information about a request
|
||||||
|
// that is used to make an admission decision.
|
||||||
|
type Attributes interface {
|
||||||
|
// GetName returns the name of the object as presented in the request. On a CREATE operation, the client
|
||||||
|
// may omit name and rely on the server to generate the name. If that is the case, this method will return
|
||||||
|
// the empty string
|
||||||
|
GetName() string
|
||||||
|
// GetNamespace is the namespace associated with the request (if any)
|
||||||
|
GetNamespace() string
|
||||||
|
// GetResource is the name of the resource being requested. This is not the kind. For example: pods
|
||||||
|
GetResource() schema.GroupVersionResource
|
||||||
|
// GetSubresource is the name of the subresource being requested. This is a different resource, scoped to the parent resource, but it may have a different kind.
|
||||||
|
// For instance, /pods has the resource "pods" and the kind "Pod", while /pods/foo/status has the resource "pods", the sub resource "status", and the kind "Pod"
|
||||||
|
// (because status operates on pods). The binding resource for a pod though may be /pods/foo/binding, which has resource "pods", subresource "binding", and kind "Binding".
|
||||||
|
GetSubresource() string
|
||||||
|
// GetOperation is the operation being performed
|
||||||
|
GetOperation() Operation
|
||||||
|
// GetObject is the object from the incoming request prior to default values being applied
|
||||||
|
GetObject() runtime.Object
|
||||||
|
// GetOldObject is the existing object. Only populated for UPDATE requests.
|
||||||
|
GetOldObject() runtime.Object
|
||||||
|
// GetKind is the type of object being manipulated. For example: Pod
|
||||||
|
GetKind() schema.GroupVersionKind
|
||||||
|
// GetUserInfo is information about the requesting user
|
||||||
|
GetUserInfo() user.Info
|
||||||
|
}
|
||||||
|
|
||||||
|
// Interface is an abstract, pluggable interface for Admission Control decisions.
|
||||||
|
type Interface interface {
|
||||||
|
// Admit makes an admission decision based on the request attributes
|
||||||
|
Admit(a Attributes) (err error)
|
||||||
|
|
||||||
|
// Handles returns true if this admission controller can handle the given operation
|
||||||
|
// where operation can be one of CREATE, UPDATE, DELETE, or CONNECT
|
||||||
|
Handles(operation Operation) bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// Operation is the type of resource operation being checked for admission control
|
||||||
|
type Operation string
|
||||||
|
|
||||||
|
// Operation constants
|
||||||
|
const (
|
||||||
|
Create Operation = "CREATE"
|
||||||
|
Update Operation = "UPDATE"
|
||||||
|
Delete Operation = "DELETE"
|
||||||
|
Connect Operation = "CONNECT"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PluginInitializer is used for initialization of shareable resources between admission plugins.
|
||||||
|
// After initialization the resources have to be set separately
|
||||||
|
type PluginInitializer interface {
|
||||||
|
Initialize(plugin Interface)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validator holds Validate functions, which are responsible for validation of initialized shared resources
|
||||||
|
// and should be implemented on admission plugins
|
||||||
|
type Validator interface {
|
||||||
|
Validate() error
|
||||||
|
}
|
||||||
|
|
||||||
|
// ConfigProvider provides a way to get configuration for an admission plugin based on its name
|
||||||
|
type ConfigProvider interface {
|
||||||
|
ConfigFor(pluginName string) (io.Reader, error)
|
||||||
|
}
|
182
vendor/k8s.io/apiserver/pkg/admission/plugins.go
generated
vendored
Normal file
182
vendor/k8s.io/apiserver/pkg/admission/plugins.go
generated
vendored
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
/*
|
||||||
|
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 admission
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
|
"reflect"
|
||||||
|
"sort"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"github.com/golang/glog"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Factory is a function that returns an Interface for admission decisions.
|
||||||
|
// The config parameter provides an io.Reader handler to the factory in
|
||||||
|
// order to load specific configurations. If no configuration is provided
|
||||||
|
// the parameter is nil.
|
||||||
|
type Factory func(config io.Reader) (Interface, error)
|
||||||
|
|
||||||
|
type Plugins struct {
|
||||||
|
lock sync.Mutex
|
||||||
|
registry map[string]Factory
|
||||||
|
}
|
||||||
|
|
||||||
|
// All registered admission options.
|
||||||
|
var (
|
||||||
|
// PluginEnabledFn checks whether a plugin is enabled. By default, if you ask about it, it's enabled.
|
||||||
|
PluginEnabledFn = func(name string, config io.Reader) bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// PluginEnabledFunc is a function type that can provide an external check on whether an admission plugin may be enabled
|
||||||
|
type PluginEnabledFunc func(name string, config io.Reader) bool
|
||||||
|
|
||||||
|
// Registered enumerates the names of all registered plugins.
|
||||||
|
func (ps *Plugins) Registered() []string {
|
||||||
|
ps.lock.Lock()
|
||||||
|
defer ps.lock.Unlock()
|
||||||
|
keys := []string{}
|
||||||
|
for k := range ps.registry {
|
||||||
|
keys = append(keys, k)
|
||||||
|
}
|
||||||
|
sort.Strings(keys)
|
||||||
|
return keys
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register registers a plugin Factory by name. This
|
||||||
|
// is expected to happen during app startup.
|
||||||
|
func (ps *Plugins) Register(name string, plugin Factory) {
|
||||||
|
ps.lock.Lock()
|
||||||
|
defer ps.lock.Unlock()
|
||||||
|
_, found := ps.registry[name]
|
||||||
|
if found {
|
||||||
|
glog.Fatalf("Admission plugin %q was registered twice", name)
|
||||||
|
}
|
||||||
|
if ps.registry == nil {
|
||||||
|
ps.registry = map[string]Factory{}
|
||||||
|
}
|
||||||
|
glog.V(1).Infof("Registered admission plugin %q", name)
|
||||||
|
ps.registry[name] = plugin
|
||||||
|
}
|
||||||
|
|
||||||
|
// getPlugin creates an instance of the named plugin. It returns `false` if the
|
||||||
|
// the name is not known. The error is returned only when the named provider was
|
||||||
|
// known but failed to initialize. The config parameter specifies the io.Reader
|
||||||
|
// handler of the configuration file for the cloud provider, or nil for no configuration.
|
||||||
|
func (ps *Plugins) getPlugin(name string, config io.Reader) (Interface, bool, error) {
|
||||||
|
ps.lock.Lock()
|
||||||
|
defer ps.lock.Unlock()
|
||||||
|
f, found := ps.registry[name]
|
||||||
|
if !found {
|
||||||
|
return nil, false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
config1, config2, err := splitStream(config)
|
||||||
|
if err != nil {
|
||||||
|
return nil, true, err
|
||||||
|
}
|
||||||
|
if !PluginEnabledFn(name, config1) {
|
||||||
|
return nil, true, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
ret, err := f(config2)
|
||||||
|
return ret, true, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// splitStream reads the stream bytes and constructs two copies of it.
|
||||||
|
func splitStream(config io.Reader) (io.Reader, io.Reader, error) {
|
||||||
|
if config == nil || reflect.ValueOf(config).IsNil() {
|
||||||
|
return nil, nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
configBytes, err := ioutil.ReadAll(config)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return bytes.NewBuffer(configBytes), bytes.NewBuffer(configBytes), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewFromPlugins returns an admission.Interface that will enforce admission control decisions of all
|
||||||
|
// the given plugins.
|
||||||
|
func (ps *Plugins) NewFromPlugins(pluginNames []string, configProvider ConfigProvider, pluginInitializer PluginInitializer) (Interface, error) {
|
||||||
|
plugins := []Interface{}
|
||||||
|
for _, pluginName := range pluginNames {
|
||||||
|
pluginConfig, err := configProvider.ConfigFor(pluginName)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
plugin, err := ps.InitPlugin(pluginName, pluginConfig, pluginInitializer)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if plugin != nil {
|
||||||
|
plugins = append(plugins, plugin)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return chainAdmissionHandler(plugins), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// InitPlugin creates an instance of the named interface.
|
||||||
|
func (ps *Plugins) InitPlugin(name string, config io.Reader, pluginInitializer PluginInitializer) (Interface, error) {
|
||||||
|
if name == "" {
|
||||||
|
glog.Info("No admission plugin specified.")
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
plugin, found, err := ps.getPlugin(name, config)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("Couldn't init admission plugin %q: %v", name, err)
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
return nil, fmt.Errorf("Unknown admission plugin: %s", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
pluginInitializer.Initialize(plugin)
|
||||||
|
// ensure that plugins have been properly initialized
|
||||||
|
if err := Validate(plugin); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return plugin, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate will call the Validate function in each plugin if they implement
|
||||||
|
// the Validator interface.
|
||||||
|
func Validate(plugin Interface) error {
|
||||||
|
if validater, ok := plugin.(Validator); ok {
|
||||||
|
err := validater.Validate()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type PluginInitializers []PluginInitializer
|
||||||
|
|
||||||
|
func (pp PluginInitializers) Initialize(plugin Interface) {
|
||||||
|
for _, p := range pp {
|
||||||
|
p.Initialize(plugin)
|
||||||
|
}
|
||||||
|
}
|
25
vendor/k8s.io/apiserver/pkg/apis/apiserver/BUILD
generated
vendored
Normal file
25
vendor/k8s.io/apiserver/pkg/apis/apiserver/BUILD
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
|
"go_library",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = [
|
||||||
|
"doc.go",
|
||||||
|
"register.go",
|
||||||
|
"types.go",
|
||||||
|
"zz_generated.deepcopy.go",
|
||||||
|
],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
deps = [
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
21
vendor/k8s.io/apiserver/pkg/apis/apiserver/doc.go
generated
vendored
Normal file
21
vendor/k8s.io/apiserver/pkg/apis/apiserver/doc.go
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen=package,register
|
||||||
|
|
||||||
|
// Package apiserver is the internal version of the API.
|
||||||
|
// +groupName=apiserver.k8s.io
|
||||||
|
package apiserver // import "k8s.io/apiserver/pkg/apis/apiserver"
|
22
vendor/k8s.io/apiserver/pkg/apis/apiserver/install/BUILD
generated
vendored
Normal file
22
vendor/k8s.io/apiserver/pkg/apis/apiserver/install/BUILD
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
|
"go_library",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = ["install.go"],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
deps = [
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/apimachinery/announced:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/apimachinery/registered:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||||
|
"//vendor/k8s.io/apiserver/pkg/apis/apiserver:go_default_library",
|
||||||
|
"//vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
44
vendor/k8s.io/apiserver/pkg/apis/apiserver/install/install.go
generated
vendored
Normal file
44
vendor/k8s.io/apiserver/pkg/apis/apiserver/install/install.go
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
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 install
|
||||||
|
|
||||||
|
import (
|
||||||
|
"k8s.io/apimachinery/pkg/apimachinery/announced"
|
||||||
|
"k8s.io/apimachinery/pkg/apimachinery/registered"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
|
"k8s.io/apiserver/pkg/apis/apiserver"
|
||||||
|
"k8s.io/apiserver/pkg/apis/apiserver/v1alpha1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Install registers the API group and adds types to a scheme
|
||||||
|
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
|
||||||
|
if err := announced.NewGroupMetaFactory(
|
||||||
|
&announced.GroupMetaFactoryArgs{
|
||||||
|
GroupName: apiserver.GroupName,
|
||||||
|
RootScopedKinds: sets.NewString("APIService"),
|
||||||
|
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
|
||||||
|
ImportPrefix: "k8s.io/apiserver/pkg/apis/apiserver",
|
||||||
|
AddInternalObjectsToScheme: apiserver.AddToScheme,
|
||||||
|
},
|
||||||
|
announced.VersionToSchemeFunc{
|
||||||
|
v1alpha1.SchemeGroupVersion.Version: v1alpha1.AddToScheme,
|
||||||
|
},
|
||||||
|
).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
50
vendor/k8s.io/apiserver/pkg/apis/apiserver/register.go
generated
vendored
Normal file
50
vendor/k8s.io/apiserver/pkg/apis/apiserver/register.go
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
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 apiserver
|
||||||
|
|
||||||
|
import (
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
)
|
||||||
|
|
||||||
|
const GroupName = "apiserver.k8s.io"
|
||||||
|
|
||||||
|
// SchemeGroupVersion is group version used to register these objects
|
||||||
|
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
|
||||||
|
|
||||||
|
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
|
||||||
|
func Kind(kind string) schema.GroupKind {
|
||||||
|
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resource takes an unqualified resource and returns back a Group qualified GroupResource
|
||||||
|
func Resource(resource string) schema.GroupResource {
|
||||||
|
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
||||||
|
AddToScheme = SchemeBuilder.AddToScheme
|
||||||
|
)
|
||||||
|
|
||||||
|
// Adds the list of known types to api.Scheme.
|
||||||
|
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||||
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||||
|
&AdmissionConfiguration{},
|
||||||
|
)
|
||||||
|
return nil
|
||||||
|
}
|
50
vendor/k8s.io/apiserver/pkg/apis/apiserver/types.go
generated
vendored
Normal file
50
vendor/k8s.io/apiserver/pkg/apis/apiserver/types.go
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
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 apiserver
|
||||||
|
|
||||||
|
import (
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// AdmissionConfiguration provides versioned configuration for admission controllers.
|
||||||
|
type AdmissionConfiguration struct {
|
||||||
|
metav1.TypeMeta
|
||||||
|
|
||||||
|
// Plugins allows specifying a configuration per admission control plugin.
|
||||||
|
// +optional
|
||||||
|
Plugins []AdmissionPluginConfiguration
|
||||||
|
}
|
||||||
|
|
||||||
|
// AdmissionPluginConfiguration provides the configuration for a single plug-in.
|
||||||
|
type AdmissionPluginConfiguration struct {
|
||||||
|
// Name is the name of the admission controller.
|
||||||
|
// It must match the registered admission plugin name.
|
||||||
|
Name string
|
||||||
|
|
||||||
|
// Path is the path to a configuration file that contains the plugin's
|
||||||
|
// configuration
|
||||||
|
// +optional
|
||||||
|
Path string
|
||||||
|
|
||||||
|
// Configuration is an embedded configuration object to be used as the plugin's
|
||||||
|
// configuration. If present, it will be used instead of the path to the configuration file.
|
||||||
|
// +optional
|
||||||
|
Configuration runtime.Object
|
||||||
|
}
|
28
vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/BUILD
generated
vendored
Normal file
28
vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/BUILD
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
|
"go_library",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = [
|
||||||
|
"doc.go",
|
||||||
|
"register.go",
|
||||||
|
"types.go",
|
||||||
|
"zz_generated.conversion.go",
|
||||||
|
"zz_generated.deepcopy.go",
|
||||||
|
"zz_generated.defaults.go",
|
||||||
|
],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
deps = [
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
|
"//vendor/k8s.io/apiserver/pkg/apis/apiserver:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
23
vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/doc.go
generated
vendored
Normal file
23
vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/doc.go
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen=package,register
|
||||||
|
// +k8s:conversion-gen=k8s.io/kubernetes/vendor/k8s.io/apiserver/pkg/apis/apiserver
|
||||||
|
// +k8s:defaulter-gen=TypeMeta
|
||||||
|
|
||||||
|
// Package v1alpha1 is the v1alpha1 version of the API.
|
||||||
|
// +groupName=apiserver.k8s.io
|
||||||
|
package v1alpha1 // import "k8s.io/apiserver/pkg/apis/apiserver/v1alpha1"
|
52
vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/register.go
generated
vendored
Normal file
52
vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/register.go
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
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 v1alpha1
|
||||||
|
|
||||||
|
import (
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
)
|
||||||
|
|
||||||
|
const GroupName = "apiserver.k8s.io"
|
||||||
|
|
||||||
|
// SchemeGroupVersion is group version used to register these objects
|
||||||
|
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
|
||||||
|
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
||||||
|
SchemeBuilder runtime.SchemeBuilder
|
||||||
|
localSchemeBuilder = &SchemeBuilder
|
||||||
|
AddToScheme = localSchemeBuilder.AddToScheme
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// We only register manually written functions here. The registration of the
|
||||||
|
// generated functions takes place in the generated files. The separation
|
||||||
|
// makes the code compile even when the generated files are missing.
|
||||||
|
localSchemeBuilder.Register(addKnownTypes)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adds the list of known types to api.Scheme.
|
||||||
|
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||||
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||||
|
&AdmissionConfiguration{},
|
||||||
|
)
|
||||||
|
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||||
|
return nil
|
||||||
|
}
|
50
vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/types.go
generated
vendored
Normal file
50
vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/types.go
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
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 v1alpha1
|
||||||
|
|
||||||
|
import (
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// AdmissionConfiguration provides versioned configuration for admission controllers.
|
||||||
|
type AdmissionConfiguration struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
|
||||||
|
// Plugins allows specifying a configuration per admission control plugin.
|
||||||
|
// +optional
|
||||||
|
Plugins []AdmissionPluginConfiguration `json:"plugins"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AdmissionPluginConfiguration provides the configuration for a single plug-in.
|
||||||
|
type AdmissionPluginConfiguration struct {
|
||||||
|
// Name is the name of the admission controller.
|
||||||
|
// It must match the registered admission plugin name.
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// Path is the path to a configuration file that contains the plugin's
|
||||||
|
// configuration
|
||||||
|
// +optional
|
||||||
|
Path string `json:"path"`
|
||||||
|
|
||||||
|
// Configuration is an embedded configuration object to be used as the plugin's
|
||||||
|
// configuration. If present, it will be used instead of the path to the configuration file.
|
||||||
|
// +optional
|
||||||
|
Configuration runtime.RawExtension `json:"configuration"`
|
||||||
|
}
|
110
vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/zz_generated.conversion.go
generated
vendored
Normal file
110
vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/zz_generated.conversion.go
generated
vendored
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
// +build !ignore_autogenerated
|
||||||
|
|
||||||
|
/*
|
||||||
|
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 was autogenerated by conversion-gen. Do not edit it manually!
|
||||||
|
|
||||||
|
package v1alpha1
|
||||||
|
|
||||||
|
import (
|
||||||
|
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
apiserver "k8s.io/apiserver/pkg/apis/apiserver"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
localSchemeBuilder.Register(RegisterConversions)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterConversions adds conversion functions to the given scheme.
|
||||||
|
// Public to allow building arbitrary schemes.
|
||||||
|
func RegisterConversions(scheme *runtime.Scheme) error {
|
||||||
|
return scheme.AddGeneratedConversionFuncs(
|
||||||
|
Convert_v1alpha1_AdmissionConfiguration_To_apiserver_AdmissionConfiguration,
|
||||||
|
Convert_apiserver_AdmissionConfiguration_To_v1alpha1_AdmissionConfiguration,
|
||||||
|
Convert_v1alpha1_AdmissionPluginConfiguration_To_apiserver_AdmissionPluginConfiguration,
|
||||||
|
Convert_apiserver_AdmissionPluginConfiguration_To_v1alpha1_AdmissionPluginConfiguration,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1alpha1_AdmissionConfiguration_To_apiserver_AdmissionConfiguration(in *AdmissionConfiguration, out *apiserver.AdmissionConfiguration, s conversion.Scope) error {
|
||||||
|
if in.Plugins != nil {
|
||||||
|
in, out := &in.Plugins, &out.Plugins
|
||||||
|
*out = make([]apiserver.AdmissionPluginConfiguration, len(*in))
|
||||||
|
for i := range *in {
|
||||||
|
if err := Convert_v1alpha1_AdmissionPluginConfiguration_To_apiserver_AdmissionPluginConfiguration(&(*in)[i], &(*out)[i], s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
out.Plugins = nil
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1alpha1_AdmissionConfiguration_To_apiserver_AdmissionConfiguration is an autogenerated conversion function.
|
||||||
|
func Convert_v1alpha1_AdmissionConfiguration_To_apiserver_AdmissionConfiguration(in *AdmissionConfiguration, out *apiserver.AdmissionConfiguration, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1alpha1_AdmissionConfiguration_To_apiserver_AdmissionConfiguration(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_apiserver_AdmissionConfiguration_To_v1alpha1_AdmissionConfiguration(in *apiserver.AdmissionConfiguration, out *AdmissionConfiguration, s conversion.Scope) error {
|
||||||
|
if in.Plugins != nil {
|
||||||
|
in, out := &in.Plugins, &out.Plugins
|
||||||
|
*out = make([]AdmissionPluginConfiguration, len(*in))
|
||||||
|
for i := range *in {
|
||||||
|
if err := Convert_apiserver_AdmissionPluginConfiguration_To_v1alpha1_AdmissionPluginConfiguration(&(*in)[i], &(*out)[i], s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
out.Plugins = make([]AdmissionPluginConfiguration, 0)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_apiserver_AdmissionConfiguration_To_v1alpha1_AdmissionConfiguration is an autogenerated conversion function.
|
||||||
|
func Convert_apiserver_AdmissionConfiguration_To_v1alpha1_AdmissionConfiguration(in *apiserver.AdmissionConfiguration, out *AdmissionConfiguration, s conversion.Scope) error {
|
||||||
|
return autoConvert_apiserver_AdmissionConfiguration_To_v1alpha1_AdmissionConfiguration(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1alpha1_AdmissionPluginConfiguration_To_apiserver_AdmissionPluginConfiguration(in *AdmissionPluginConfiguration, out *apiserver.AdmissionPluginConfiguration, s conversion.Scope) error {
|
||||||
|
out.Name = in.Name
|
||||||
|
out.Path = in.Path
|
||||||
|
if err := runtime.Convert_runtime_RawExtension_To_runtime_Object(&in.Configuration, &out.Configuration, s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1alpha1_AdmissionPluginConfiguration_To_apiserver_AdmissionPluginConfiguration is an autogenerated conversion function.
|
||||||
|
func Convert_v1alpha1_AdmissionPluginConfiguration_To_apiserver_AdmissionPluginConfiguration(in *AdmissionPluginConfiguration, out *apiserver.AdmissionPluginConfiguration, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1alpha1_AdmissionPluginConfiguration_To_apiserver_AdmissionPluginConfiguration(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_apiserver_AdmissionPluginConfiguration_To_v1alpha1_AdmissionPluginConfiguration(in *apiserver.AdmissionPluginConfiguration, out *AdmissionPluginConfiguration, s conversion.Scope) error {
|
||||||
|
out.Name = in.Name
|
||||||
|
out.Path = in.Path
|
||||||
|
if err := runtime.Convert_runtime_Object_To_runtime_RawExtension(&in.Configuration, &out.Configuration, s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_apiserver_AdmissionPluginConfiguration_To_v1alpha1_AdmissionPluginConfiguration is an autogenerated conversion function.
|
||||||
|
func Convert_apiserver_AdmissionPluginConfiguration_To_v1alpha1_AdmissionPluginConfiguration(in *apiserver.AdmissionPluginConfiguration, out *AdmissionPluginConfiguration, s conversion.Scope) error {
|
||||||
|
return autoConvert_apiserver_AdmissionPluginConfiguration_To_v1alpha1_AdmissionPluginConfiguration(in, out, s)
|
||||||
|
}
|
97
vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
97
vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
// +build !ignore_autogenerated
|
||||||
|
|
||||||
|
/*
|
||||||
|
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 was autogenerated by deepcopy-gen. Do not edit it manually!
|
||||||
|
|
||||||
|
package v1alpha1
|
||||||
|
|
||||||
|
import (
|
||||||
|
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
reflect "reflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Deprecated: register deep-copy functions.
|
||||||
|
func init() {
|
||||||
|
SchemeBuilder.Register(RegisterDeepCopies)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: RegisterDeepCopies adds deep-copy functions to the given scheme. Public
|
||||||
|
// to allow building arbitrary schemes.
|
||||||
|
func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||||
|
return scheme.AddGeneratedDeepCopyFuncs(
|
||||||
|
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||||
|
in.(*AdmissionConfiguration).DeepCopyInto(out.(*AdmissionConfiguration))
|
||||||
|
return nil
|
||||||
|
}, InType: reflect.TypeOf(&AdmissionConfiguration{})},
|
||||||
|
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||||
|
in.(*AdmissionPluginConfiguration).DeepCopyInto(out.(*AdmissionPluginConfiguration))
|
||||||
|
return nil
|
||||||
|
}, InType: reflect.TypeOf(&AdmissionPluginConfiguration{})},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *AdmissionConfiguration) DeepCopyInto(out *AdmissionConfiguration) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
if in.Plugins != nil {
|
||||||
|
in, out := &in.Plugins, &out.Plugins
|
||||||
|
*out = make([]AdmissionPluginConfiguration, len(*in))
|
||||||
|
for i := range *in {
|
||||||
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new AdmissionConfiguration.
|
||||||
|
func (x *AdmissionConfiguration) DeepCopy() *AdmissionConfiguration {
|
||||||
|
if x == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(AdmissionConfiguration)
|
||||||
|
x.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (x *AdmissionConfiguration) DeepCopyObject() runtime.Object {
|
||||||
|
if c := x.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *AdmissionPluginConfiguration) DeepCopyInto(out *AdmissionPluginConfiguration) {
|
||||||
|
*out = *in
|
||||||
|
in.Configuration.DeepCopyInto(&out.Configuration)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new AdmissionPluginConfiguration.
|
||||||
|
func (x *AdmissionPluginConfiguration) DeepCopy() *AdmissionPluginConfiguration {
|
||||||
|
if x == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(AdmissionPluginConfiguration)
|
||||||
|
x.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
32
vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/zz_generated.defaults.go
generated
vendored
Normal file
32
vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/zz_generated.defaults.go
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// +build !ignore_autogenerated
|
||||||
|
|
||||||
|
/*
|
||||||
|
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 was autogenerated by defaulter-gen. Do not edit it manually!
|
||||||
|
|
||||||
|
package v1alpha1
|
||||||
|
|
||||||
|
import (
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
// RegisterDefaults adds defaulters functions to the given scheme.
|
||||||
|
// Public to allow building arbitrary schemes.
|
||||||
|
// All generated defaulters are covering - they call all nested defaulters.
|
||||||
|
func RegisterDefaults(scheme *runtime.Scheme) error {
|
||||||
|
return nil
|
||||||
|
}
|
101
vendor/k8s.io/apiserver/pkg/apis/apiserver/zz_generated.deepcopy.go
generated
vendored
Normal file
101
vendor/k8s.io/apiserver/pkg/apis/apiserver/zz_generated.deepcopy.go
generated
vendored
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
// +build !ignore_autogenerated
|
||||||
|
|
||||||
|
/*
|
||||||
|
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 was autogenerated by deepcopy-gen. Do not edit it manually!
|
||||||
|
|
||||||
|
package apiserver
|
||||||
|
|
||||||
|
import (
|
||||||
|
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
reflect "reflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Deprecated: register deep-copy functions.
|
||||||
|
func init() {
|
||||||
|
SchemeBuilder.Register(RegisterDeepCopies)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: RegisterDeepCopies adds deep-copy functions to the given scheme. Public
|
||||||
|
// to allow building arbitrary schemes.
|
||||||
|
func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||||
|
return scheme.AddGeneratedDeepCopyFuncs(
|
||||||
|
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||||
|
in.(*AdmissionConfiguration).DeepCopyInto(out.(*AdmissionConfiguration))
|
||||||
|
return nil
|
||||||
|
}, InType: reflect.TypeOf(&AdmissionConfiguration{})},
|
||||||
|
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||||
|
in.(*AdmissionPluginConfiguration).DeepCopyInto(out.(*AdmissionPluginConfiguration))
|
||||||
|
return nil
|
||||||
|
}, InType: reflect.TypeOf(&AdmissionPluginConfiguration{})},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *AdmissionConfiguration) DeepCopyInto(out *AdmissionConfiguration) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
if in.Plugins != nil {
|
||||||
|
in, out := &in.Plugins, &out.Plugins
|
||||||
|
*out = make([]AdmissionPluginConfiguration, len(*in))
|
||||||
|
for i := range *in {
|
||||||
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new AdmissionConfiguration.
|
||||||
|
func (x *AdmissionConfiguration) DeepCopy() *AdmissionConfiguration {
|
||||||
|
if x == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(AdmissionConfiguration)
|
||||||
|
x.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (x *AdmissionConfiguration) DeepCopyObject() runtime.Object {
|
||||||
|
if c := x.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *AdmissionPluginConfiguration) DeepCopyInto(out *AdmissionPluginConfiguration) {
|
||||||
|
*out = *in
|
||||||
|
if in.Configuration == nil {
|
||||||
|
out.Configuration = nil
|
||||||
|
} else {
|
||||||
|
out.Configuration = in.Configuration.DeepCopyObject()
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new AdmissionPluginConfiguration.
|
||||||
|
func (x *AdmissionPluginConfiguration) DeepCopy() *AdmissionPluginConfiguration {
|
||||||
|
if x == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(AdmissionPluginConfiguration)
|
||||||
|
x.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
17
vendor/k8s.io/apiserver/pkg/authentication/user/BUILD
generated
vendored
Normal file
17
vendor/k8s.io/apiserver/pkg/authentication/user/BUILD
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
|
"go_library",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = [
|
||||||
|
"doc.go",
|
||||||
|
"user.go",
|
||||||
|
],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
)
|
19
vendor/k8s.io/apiserver/pkg/authentication/user/doc.go
generated
vendored
Normal file
19
vendor/k8s.io/apiserver/pkg/authentication/user/doc.go
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
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 user contains utilities for dealing with simple user exchange in the auth
|
||||||
|
// packages. The user.Info interface defines an interface for exchanging that info.
|
||||||
|
package user
|
83
vendor/k8s.io/apiserver/pkg/authentication/user/user.go
generated
vendored
Normal file
83
vendor/k8s.io/apiserver/pkg/authentication/user/user.go
generated
vendored
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
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 user
|
||||||
|
|
||||||
|
// Info describes a user that has been authenticated to the system.
|
||||||
|
type Info interface {
|
||||||
|
// GetName returns the name that uniquely identifies this user among all
|
||||||
|
// other active users.
|
||||||
|
GetName() string
|
||||||
|
// GetUID returns a unique value for a particular user that will change
|
||||||
|
// if the user is removed from the system and another user is added with
|
||||||
|
// the same name.
|
||||||
|
GetUID() string
|
||||||
|
// GetGroups returns the names of the groups the user is a member of
|
||||||
|
GetGroups() []string
|
||||||
|
|
||||||
|
// GetExtra can contain any additional information that the authenticator
|
||||||
|
// thought was interesting. One example would be scopes on a token.
|
||||||
|
// Keys in this map should be namespaced to the authenticator or
|
||||||
|
// authenticator/authorizer pair making use of them.
|
||||||
|
// For instance: "example.org/foo" instead of "foo"
|
||||||
|
// This is a map[string][]string because it needs to be serializeable into
|
||||||
|
// a SubjectAccessReviewSpec.authorization.k8s.io for proper authorization
|
||||||
|
// delegation flows
|
||||||
|
// In order to faithfully round-trip through an impersonation flow, these keys
|
||||||
|
// MUST be lowercase.
|
||||||
|
GetExtra() map[string][]string
|
||||||
|
}
|
||||||
|
|
||||||
|
// DefaultInfo provides a simple user information exchange object
|
||||||
|
// for components that implement the UserInfo interface.
|
||||||
|
type DefaultInfo struct {
|
||||||
|
Name string
|
||||||
|
UID string
|
||||||
|
Groups []string
|
||||||
|
Extra map[string][]string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *DefaultInfo) GetName() string {
|
||||||
|
return i.Name
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *DefaultInfo) GetUID() string {
|
||||||
|
return i.UID
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *DefaultInfo) GetGroups() []string {
|
||||||
|
return i.Groups
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *DefaultInfo) GetExtra() map[string][]string {
|
||||||
|
return i.Extra
|
||||||
|
}
|
||||||
|
|
||||||
|
// well-known user and group names
|
||||||
|
const (
|
||||||
|
SystemPrivilegedGroup = "system:masters"
|
||||||
|
NodesGroup = "system:nodes"
|
||||||
|
AllUnauthenticated = "system:unauthenticated"
|
||||||
|
AllAuthenticated = "system:authenticated"
|
||||||
|
|
||||||
|
Anonymous = "system:anonymous"
|
||||||
|
APIServerUser = "system:apiserver"
|
||||||
|
|
||||||
|
// core kubernetes process identities
|
||||||
|
KubeProxy = "system:kube-proxy"
|
||||||
|
KubeControllerManager = "system:kube-controller-manager"
|
||||||
|
KubeScheduler = "system:kube-scheduler"
|
||||||
|
)
|
89
vendor/k8s.io/client-go/kubernetes/fake/BUILD
generated
vendored
Normal file
89
vendor/k8s.io/client-go/kubernetes/fake/BUILD
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
|
"go_library",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = [
|
||||||
|
"clientset_generated.go",
|
||||||
|
"doc.go",
|
||||||
|
"register.go",
|
||||||
|
],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
deps = [
|
||||||
|
"//vendor/k8s.io/api/admissionregistration/v1alpha1:go_default_library",
|
||||||
|
"//vendor/k8s.io/api/apps/v1beta1:go_default_library",
|
||||||
|
"//vendor/k8s.io/api/authentication/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/api/authentication/v1beta1:go_default_library",
|
||||||
|
"//vendor/k8s.io/api/authorization/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/api/authorization/v1beta1:go_default_library",
|
||||||
|
"//vendor/k8s.io/api/autoscaling/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/api/autoscaling/v2alpha1:go_default_library",
|
||||||
|
"//vendor/k8s.io/api/batch/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/api/batch/v2alpha1:go_default_library",
|
||||||
|
"//vendor/k8s.io/api/certificates/v1beta1:go_default_library",
|
||||||
|
"//vendor/k8s.io/api/core/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/api/extensions/v1beta1:go_default_library",
|
||||||
|
"//vendor/k8s.io/api/networking/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/api/policy/v1beta1:go_default_library",
|
||||||
|
"//vendor/k8s.io/api/rbac/v1alpha1:go_default_library",
|
||||||
|
"//vendor/k8s.io/api/rbac/v1beta1:go_default_library",
|
||||||
|
"//vendor/k8s.io/api/settings/v1alpha1:go_default_library",
|
||||||
|
"//vendor/k8s.io/api/storage/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/api/storage/v1beta1:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/discovery:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/discovery/fake:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/authentication/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/authorization/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/fake:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2alpha1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2alpha1/fake:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/batch/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/batch/v2alpha1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/batch/v2alpha1/fake:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/networking/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/settings/v1alpha1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/settings/v1alpha1/fake:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/storage/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/testing:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
269
vendor/k8s.io/client-go/kubernetes/fake/clientset_generated.go
generated
vendored
Normal file
269
vendor/k8s.io/client-go/kubernetes/fake/clientset_generated.go
generated
vendored
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
/*
|
||||||
|
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 fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/watch"
|
||||||
|
"k8s.io/client-go/discovery"
|
||||||
|
fakediscovery "k8s.io/client-go/discovery/fake"
|
||||||
|
kubernetes "k8s.io/client-go/kubernetes"
|
||||||
|
admissionregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1"
|
||||||
|
fakeadmissionregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake"
|
||||||
|
appsv1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1"
|
||||||
|
fakeappsv1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake"
|
||||||
|
authenticationv1 "k8s.io/client-go/kubernetes/typed/authentication/v1"
|
||||||
|
fakeauthenticationv1 "k8s.io/client-go/kubernetes/typed/authentication/v1/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"
|
||||||
|
autoscalingv2alpha1 "k8s.io/client-go/kubernetes/typed/autoscaling/v2alpha1"
|
||||||
|
fakeautoscalingv2alpha1 "k8s.io/client-go/kubernetes/typed/autoscaling/v2alpha1/fake"
|
||||||
|
batchv1 "k8s.io/client-go/kubernetes/typed/batch/v1"
|
||||||
|
fakebatchv1 "k8s.io/client-go/kubernetes/typed/batch/v1/fake"
|
||||||
|
batchv2alpha1 "k8s.io/client-go/kubernetes/typed/batch/v2alpha1"
|
||||||
|
fakebatchv2alpha1 "k8s.io/client-go/kubernetes/typed/batch/v2alpha1/fake"
|
||||||
|
certificatesv1beta1 "k8s.io/client-go/kubernetes/typed/certificates/v1beta1"
|
||||||
|
fakecertificatesv1beta1 "k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake"
|
||||||
|
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||||
|
fakecorev1 "k8s.io/client-go/kubernetes/typed/core/v1/fake"
|
||||||
|
extensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1"
|
||||||
|
fakeextensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake"
|
||||||
|
networkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1"
|
||||||
|
fakenetworkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1/fake"
|
||||||
|
policyv1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1"
|
||||||
|
fakepolicyv1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1/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"
|
||||||
|
settingsv1alpha1 "k8s.io/client-go/kubernetes/typed/settings/v1alpha1"
|
||||||
|
fakesettingsv1alpha1 "k8s.io/client-go/kubernetes/typed/settings/v1alpha1/fake"
|
||||||
|
storagev1 "k8s.io/client-go/kubernetes/typed/storage/v1"
|
||||||
|
fakestoragev1 "k8s.io/client-go/kubernetes/typed/storage/v1/fake"
|
||||||
|
storagev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1"
|
||||||
|
fakestoragev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1/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 validations and/or defaults. It shouldn't be considered a replacement
|
||||||
|
// for a real clientset and is mostly useful in simple unit tests.
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fakePtr := testing.Fake{}
|
||||||
|
fakePtr.AddReactor("*", "*", testing.ObjectReaction(o))
|
||||||
|
|
||||||
|
fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil))
|
||||||
|
|
||||||
|
return &Clientset{fakePtr}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clientset implements kubernetes.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
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||||
|
return &fakediscovery.FakeDiscovery{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ kubernetes.Interface = &Clientset{}
|
||||||
|
|
||||||
|
// AdmissionregistrationV1alpha1 retrieves the AdmissionregistrationV1alpha1Client
|
||||||
|
func (c *Clientset) AdmissionregistrationV1alpha1() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface {
|
||||||
|
return &fakeadmissionregistrationv1alpha1.FakeAdmissionregistrationV1alpha1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Admissionregistration retrieves the AdmissionregistrationV1alpha1Client
|
||||||
|
func (c *Clientset) Admissionregistration() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface {
|
||||||
|
return &fakeadmissionregistrationv1alpha1.FakeAdmissionregistrationV1alpha1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// AppsV1beta1 retrieves the AppsV1beta1Client
|
||||||
|
func (c *Clientset) AppsV1beta1() appsv1beta1.AppsV1beta1Interface {
|
||||||
|
return &fakeappsv1beta1.FakeAppsV1beta1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apps retrieves the AppsV1beta1Client
|
||||||
|
func (c *Clientset) Apps() appsv1beta1.AppsV1beta1Interface {
|
||||||
|
return &fakeappsv1beta1.FakeAppsV1beta1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// AuthenticationV1 retrieves the AuthenticationV1Client
|
||||||
|
func (c *Clientset) AuthenticationV1() authenticationv1.AuthenticationV1Interface {
|
||||||
|
return &fakeauthenticationv1.FakeAuthenticationV1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Authentication retrieves the AuthenticationV1Client
|
||||||
|
func (c *Clientset) Authentication() authenticationv1.AuthenticationV1Interface {
|
||||||
|
return &fakeauthenticationv1.FakeAuthenticationV1{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}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Authorization retrieves the AuthorizationV1Client
|
||||||
|
func (c *Clientset) Authorization() 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}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Autoscaling retrieves the AutoscalingV1Client
|
||||||
|
func (c *Clientset) Autoscaling() autoscalingv1.AutoscalingV1Interface {
|
||||||
|
return &fakeautoscalingv1.FakeAutoscalingV1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// AutoscalingV2alpha1 retrieves the AutoscalingV2alpha1Client
|
||||||
|
func (c *Clientset) AutoscalingV2alpha1() autoscalingv2alpha1.AutoscalingV2alpha1Interface {
|
||||||
|
return &fakeautoscalingv2alpha1.FakeAutoscalingV2alpha1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// BatchV1 retrieves the BatchV1Client
|
||||||
|
func (c *Clientset) BatchV1() batchv1.BatchV1Interface {
|
||||||
|
return &fakebatchv1.FakeBatchV1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Batch retrieves the BatchV1Client
|
||||||
|
func (c *Clientset) Batch() batchv1.BatchV1Interface {
|
||||||
|
return &fakebatchv1.FakeBatchV1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// BatchV2alpha1 retrieves the BatchV2alpha1Client
|
||||||
|
func (c *Clientset) BatchV2alpha1() batchv2alpha1.BatchV2alpha1Interface {
|
||||||
|
return &fakebatchv2alpha1.FakeBatchV2alpha1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CertificatesV1beta1 retrieves the CertificatesV1beta1Client
|
||||||
|
func (c *Clientset) CertificatesV1beta1() certificatesv1beta1.CertificatesV1beta1Interface {
|
||||||
|
return &fakecertificatesv1beta1.FakeCertificatesV1beta1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Certificates retrieves the CertificatesV1beta1Client
|
||||||
|
func (c *Clientset) Certificates() certificatesv1beta1.CertificatesV1beta1Interface {
|
||||||
|
return &fakecertificatesv1beta1.FakeCertificatesV1beta1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CoreV1 retrieves the CoreV1Client
|
||||||
|
func (c *Clientset) CoreV1() corev1.CoreV1Interface {
|
||||||
|
return &fakecorev1.FakeCoreV1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Core retrieves the CoreV1Client
|
||||||
|
func (c *Clientset) Core() corev1.CoreV1Interface {
|
||||||
|
return &fakecorev1.FakeCoreV1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExtensionsV1beta1 retrieves the ExtensionsV1beta1Client
|
||||||
|
func (c *Clientset) ExtensionsV1beta1() extensionsv1beta1.ExtensionsV1beta1Interface {
|
||||||
|
return &fakeextensionsv1beta1.FakeExtensionsV1beta1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extensions retrieves the ExtensionsV1beta1Client
|
||||||
|
func (c *Clientset) Extensions() extensionsv1beta1.ExtensionsV1beta1Interface {
|
||||||
|
return &fakeextensionsv1beta1.FakeExtensionsV1beta1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NetworkingV1 retrieves the NetworkingV1Client
|
||||||
|
func (c *Clientset) NetworkingV1() networkingv1.NetworkingV1Interface {
|
||||||
|
return &fakenetworkingv1.FakeNetworkingV1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Networking retrieves the NetworkingV1Client
|
||||||
|
func (c *Clientset) Networking() networkingv1.NetworkingV1Interface {
|
||||||
|
return &fakenetworkingv1.FakeNetworkingV1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PolicyV1beta1 retrieves the PolicyV1beta1Client
|
||||||
|
func (c *Clientset) PolicyV1beta1() policyv1beta1.PolicyV1beta1Interface {
|
||||||
|
return &fakepolicyv1beta1.FakePolicyV1beta1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Policy retrieves the PolicyV1beta1Client
|
||||||
|
func (c *Clientset) Policy() policyv1beta1.PolicyV1beta1Interface {
|
||||||
|
return &fakepolicyv1beta1.FakePolicyV1beta1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RbacV1beta1 retrieves the RbacV1beta1Client
|
||||||
|
func (c *Clientset) RbacV1beta1() rbacv1beta1.RbacV1beta1Interface {
|
||||||
|
return &fakerbacv1beta1.FakeRbacV1beta1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rbac retrieves the RbacV1beta1Client
|
||||||
|
func (c *Clientset) Rbac() rbacv1beta1.RbacV1beta1Interface {
|
||||||
|
return &fakerbacv1beta1.FakeRbacV1beta1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RbacV1alpha1 retrieves the RbacV1alpha1Client
|
||||||
|
func (c *Clientset) RbacV1alpha1() rbacv1alpha1.RbacV1alpha1Interface {
|
||||||
|
return &fakerbacv1alpha1.FakeRbacV1alpha1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SettingsV1alpha1 retrieves the SettingsV1alpha1Client
|
||||||
|
func (c *Clientset) SettingsV1alpha1() settingsv1alpha1.SettingsV1alpha1Interface {
|
||||||
|
return &fakesettingsv1alpha1.FakeSettingsV1alpha1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Settings retrieves the SettingsV1alpha1Client
|
||||||
|
func (c *Clientset) Settings() settingsv1alpha1.SettingsV1alpha1Interface {
|
||||||
|
return &fakesettingsv1alpha1.FakeSettingsV1alpha1{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}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Storage retrieves the StorageV1Client
|
||||||
|
func (c *Clientset) Storage() storagev1.StorageV1Interface {
|
||||||
|
return &fakestoragev1.FakeStorageV1{Fake: &c.Fake}
|
||||||
|
}
|
20
vendor/k8s.io/client-go/kubernetes/fake/doc.go
generated
vendored
Normal file
20
vendor/k8s.io/client-go/kubernetes/fake/doc.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
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 package is generated by client-gen with custom arguments.
|
||||||
|
|
||||||
|
// This package has the automatically generated fake clientset.
|
||||||
|
package fake
|
91
vendor/k8s.io/client-go/kubernetes/fake/register.go
generated
vendored
Normal file
91
vendor/k8s.io/client-go/kubernetes/fake/register.go
generated
vendored
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
/*
|
||||||
|
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 fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
admissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
|
||||||
|
appsv1beta1 "k8s.io/api/apps/v1beta1"
|
||||||
|
authenticationv1 "k8s.io/api/authentication/v1"
|
||||||
|
authenticationv1beta1 "k8s.io/api/authentication/v1beta1"
|
||||||
|
authorizationv1 "k8s.io/api/authorization/v1"
|
||||||
|
authorizationv1beta1 "k8s.io/api/authorization/v1beta1"
|
||||||
|
autoscalingv1 "k8s.io/api/autoscaling/v1"
|
||||||
|
autoscalingv2alpha1 "k8s.io/api/autoscaling/v2alpha1"
|
||||||
|
batchv1 "k8s.io/api/batch/v1"
|
||||||
|
batchv2alpha1 "k8s.io/api/batch/v2alpha1"
|
||||||
|
certificatesv1beta1 "k8s.io/api/certificates/v1beta1"
|
||||||
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||||
|
networkingv1 "k8s.io/api/networking/v1"
|
||||||
|
policyv1beta1 "k8s.io/api/policy/v1beta1"
|
||||||
|
rbacv1alpha1 "k8s.io/api/rbac/v1alpha1"
|
||||||
|
rbacv1beta1 "k8s.io/api/rbac/v1beta1"
|
||||||
|
settingsv1alpha1 "k8s.io/api/settings/v1alpha1"
|
||||||
|
storagev1 "k8s.io/api/storage/v1"
|
||||||
|
storagev1beta1 "k8s.io/api/storage/v1beta1"
|
||||||
|
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"
|
||||||
|
)
|
||||||
|
|
||||||
|
var scheme = runtime.NewScheme()
|
||||||
|
var codecs = serializer.NewCodecFactory(scheme)
|
||||||
|
var parameterCodec = runtime.NewParameterCodec(scheme)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"})
|
||||||
|
AddToScheme(scheme)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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/kuberentes/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.
|
||||||
|
func AddToScheme(scheme *runtime.Scheme) {
|
||||||
|
admissionregistrationv1alpha1.AddToScheme(scheme)
|
||||||
|
appsv1beta1.AddToScheme(scheme)
|
||||||
|
authenticationv1.AddToScheme(scheme)
|
||||||
|
authenticationv1beta1.AddToScheme(scheme)
|
||||||
|
authorizationv1.AddToScheme(scheme)
|
||||||
|
authorizationv1beta1.AddToScheme(scheme)
|
||||||
|
autoscalingv1.AddToScheme(scheme)
|
||||||
|
autoscalingv2alpha1.AddToScheme(scheme)
|
||||||
|
batchv1.AddToScheme(scheme)
|
||||||
|
batchv2alpha1.AddToScheme(scheme)
|
||||||
|
certificatesv1beta1.AddToScheme(scheme)
|
||||||
|
corev1.AddToScheme(scheme)
|
||||||
|
extensionsv1beta1.AddToScheme(scheme)
|
||||||
|
networkingv1.AddToScheme(scheme)
|
||||||
|
policyv1beta1.AddToScheme(scheme)
|
||||||
|
rbacv1beta1.AddToScheme(scheme)
|
||||||
|
rbacv1alpha1.AddToScheme(scheme)
|
||||||
|
settingsv1alpha1.AddToScheme(scheme)
|
||||||
|
storagev1beta1.AddToScheme(scheme)
|
||||||
|
storagev1.AddToScheme(scheme)
|
||||||
|
|
||||||
|
}
|
30
vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/BUILD
generated
vendored
Normal file
30
vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/BUILD
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
|
"go_library",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = [
|
||||||
|
"doc.go",
|
||||||
|
"fake_admissionregistration_client.go",
|
||||||
|
"fake_externaladmissionhookconfiguration.go",
|
||||||
|
"fake_initializerconfiguration.go",
|
||||||
|
],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
deps = [
|
||||||
|
"//vendor/k8s.io/api/admissionregistration/v1alpha1:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/rest:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/testing:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
20
vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/doc.go
generated
vendored
Normal file
20
vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/doc.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
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 package is generated by client-gen with custom arguments.
|
||||||
|
|
||||||
|
// Package fake has the automatically generated clients.
|
||||||
|
package fake
|
42
vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/fake_admissionregistration_client.go
generated
vendored
Normal file
42
vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/fake_admissionregistration_client.go
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
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 fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1"
|
||||||
|
rest "k8s.io/client-go/rest"
|
||||||
|
testing "k8s.io/client-go/testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
type FakeAdmissionregistrationV1alpha1 struct {
|
||||||
|
*testing.Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeAdmissionregistrationV1alpha1) ExternalAdmissionHookConfigurations() v1alpha1.ExternalAdmissionHookConfigurationInterface {
|
||||||
|
return &FakeExternalAdmissionHookConfigurations{c}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeAdmissionregistrationV1alpha1) InitializerConfigurations() v1alpha1.InitializerConfigurationInterface {
|
||||||
|
return &FakeInitializerConfigurations{c}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RESTClient returns a RESTClient that is used to communicate
|
||||||
|
// with API server by this client implementation.
|
||||||
|
func (c *FakeAdmissionregistrationV1alpha1) RESTClient() rest.Interface {
|
||||||
|
var ret *rest.RESTClient
|
||||||
|
return ret
|
||||||
|
}
|
112
vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/fake_externaladmissionhookconfiguration.go
generated
vendored
Normal file
112
vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/fake_externaladmissionhookconfiguration.go
generated
vendored
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
/*
|
||||||
|
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 fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
labels "k8s.io/apimachinery/pkg/labels"
|
||||||
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
testing "k8s.io/client-go/testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FakeExternalAdmissionHookConfigurations implements ExternalAdmissionHookConfigurationInterface
|
||||||
|
type FakeExternalAdmissionHookConfigurations struct {
|
||||||
|
Fake *FakeAdmissionregistrationV1alpha1
|
||||||
|
}
|
||||||
|
|
||||||
|
var externaladmissionhookconfigurationsResource = schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Resource: "externaladmissionhookconfigurations"}
|
||||||
|
|
||||||
|
var externaladmissionhookconfigurationsKind = schema.GroupVersionKind{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Kind: "ExternalAdmissionHookConfiguration"}
|
||||||
|
|
||||||
|
func (c *FakeExternalAdmissionHookConfigurations) Create(externalAdmissionHookConfiguration *v1alpha1.ExternalAdmissionHookConfiguration) (result *v1alpha1.ExternalAdmissionHookConfiguration, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootCreateAction(externaladmissionhookconfigurationsResource, externalAdmissionHookConfiguration), &v1alpha1.ExternalAdmissionHookConfiguration{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1alpha1.ExternalAdmissionHookConfiguration), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeExternalAdmissionHookConfigurations) Update(externalAdmissionHookConfiguration *v1alpha1.ExternalAdmissionHookConfiguration) (result *v1alpha1.ExternalAdmissionHookConfiguration, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootUpdateAction(externaladmissionhookconfigurationsResource, externalAdmissionHookConfiguration), &v1alpha1.ExternalAdmissionHookConfiguration{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1alpha1.ExternalAdmissionHookConfiguration), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeExternalAdmissionHookConfigurations) Delete(name string, options *v1.DeleteOptions) error {
|
||||||
|
_, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootDeleteAction(externaladmissionhookconfigurationsResource, name), &v1alpha1.ExternalAdmissionHookConfiguration{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeExternalAdmissionHookConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||||
|
action := testing.NewRootDeleteCollectionAction(externaladmissionhookconfigurationsResource, listOptions)
|
||||||
|
|
||||||
|
_, err := c.Fake.Invokes(action, &v1alpha1.ExternalAdmissionHookConfigurationList{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeExternalAdmissionHookConfigurations) Get(name string, options v1.GetOptions) (result *v1alpha1.ExternalAdmissionHookConfiguration, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootGetAction(externaladmissionhookconfigurationsResource, name), &v1alpha1.ExternalAdmissionHookConfiguration{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1alpha1.ExternalAdmissionHookConfiguration), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeExternalAdmissionHookConfigurations) List(opts v1.ListOptions) (result *v1alpha1.ExternalAdmissionHookConfigurationList, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootListAction(externaladmissionhookconfigurationsResource, externaladmissionhookconfigurationsKind, opts), &v1alpha1.ExternalAdmissionHookConfigurationList{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||||
|
if label == nil {
|
||||||
|
label = labels.Everything()
|
||||||
|
}
|
||||||
|
list := &v1alpha1.ExternalAdmissionHookConfigurationList{}
|
||||||
|
for _, item := range obj.(*v1alpha1.ExternalAdmissionHookConfigurationList).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 externalAdmissionHookConfigurations.
|
||||||
|
func (c *FakeExternalAdmissionHookConfigurations) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
return c.Fake.
|
||||||
|
InvokesWatch(testing.NewRootWatchAction(externaladmissionhookconfigurationsResource, opts))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch applies the patch and returns the patched externalAdmissionHookConfiguration.
|
||||||
|
func (c *FakeExternalAdmissionHookConfigurations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ExternalAdmissionHookConfiguration, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootPatchSubresourceAction(externaladmissionhookconfigurationsResource, name, data, subresources...), &v1alpha1.ExternalAdmissionHookConfiguration{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1alpha1.ExternalAdmissionHookConfiguration), err
|
||||||
|
}
|
112
vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/fake_initializerconfiguration.go
generated
vendored
Normal file
112
vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/fake_initializerconfiguration.go
generated
vendored
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
/*
|
||||||
|
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 fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
labels "k8s.io/apimachinery/pkg/labels"
|
||||||
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
testing "k8s.io/client-go/testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FakeInitializerConfigurations implements InitializerConfigurationInterface
|
||||||
|
type FakeInitializerConfigurations struct {
|
||||||
|
Fake *FakeAdmissionregistrationV1alpha1
|
||||||
|
}
|
||||||
|
|
||||||
|
var initializerconfigurationsResource = schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Resource: "initializerconfigurations"}
|
||||||
|
|
||||||
|
var initializerconfigurationsKind = schema.GroupVersionKind{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Kind: "InitializerConfiguration"}
|
||||||
|
|
||||||
|
func (c *FakeInitializerConfigurations) Create(initializerConfiguration *v1alpha1.InitializerConfiguration) (result *v1alpha1.InitializerConfiguration, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootCreateAction(initializerconfigurationsResource, initializerConfiguration), &v1alpha1.InitializerConfiguration{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1alpha1.InitializerConfiguration), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeInitializerConfigurations) Update(initializerConfiguration *v1alpha1.InitializerConfiguration) (result *v1alpha1.InitializerConfiguration, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootUpdateAction(initializerconfigurationsResource, initializerConfiguration), &v1alpha1.InitializerConfiguration{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1alpha1.InitializerConfiguration), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeInitializerConfigurations) Delete(name string, options *v1.DeleteOptions) error {
|
||||||
|
_, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootDeleteAction(initializerconfigurationsResource, name), &v1alpha1.InitializerConfiguration{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeInitializerConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||||
|
action := testing.NewRootDeleteCollectionAction(initializerconfigurationsResource, listOptions)
|
||||||
|
|
||||||
|
_, err := c.Fake.Invokes(action, &v1alpha1.InitializerConfigurationList{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeInitializerConfigurations) Get(name string, options v1.GetOptions) (result *v1alpha1.InitializerConfiguration, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootGetAction(initializerconfigurationsResource, name), &v1alpha1.InitializerConfiguration{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1alpha1.InitializerConfiguration), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeInitializerConfigurations) List(opts v1.ListOptions) (result *v1alpha1.InitializerConfigurationList, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootListAction(initializerconfigurationsResource, initializerconfigurationsKind, opts), &v1alpha1.InitializerConfigurationList{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||||
|
if label == nil {
|
||||||
|
label = labels.Everything()
|
||||||
|
}
|
||||||
|
list := &v1alpha1.InitializerConfigurationList{}
|
||||||
|
for _, item := range obj.(*v1alpha1.InitializerConfigurationList).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 initializerConfigurations.
|
||||||
|
func (c *FakeInitializerConfigurations) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
return c.Fake.
|
||||||
|
InvokesWatch(testing.NewRootWatchAction(initializerconfigurationsResource, opts))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch applies the patch and returns the patched initializerConfiguration.
|
||||||
|
func (c *FakeInitializerConfigurations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InitializerConfiguration, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootPatchSubresourceAction(initializerconfigurationsResource, name, data, subresources...), &v1alpha1.InitializerConfiguration{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1alpha1.InitializerConfiguration), err
|
||||||
|
}
|
32
vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/BUILD
generated
vendored
Normal file
32
vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/BUILD
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
|
"go_library",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = [
|
||||||
|
"doc.go",
|
||||||
|
"fake_apps_client.go",
|
||||||
|
"fake_controllerrevision.go",
|
||||||
|
"fake_deployment.go",
|
||||||
|
"fake_scale.go",
|
||||||
|
"fake_statefulset.go",
|
||||||
|
],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
deps = [
|
||||||
|
"//vendor/k8s.io/api/apps/v1beta1:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||||
|
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/rest:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/testing:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
20
vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/doc.go
generated
vendored
Normal file
20
vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/doc.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
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 package is generated by client-gen with custom arguments.
|
||||||
|
|
||||||
|
// Package fake has the automatically generated clients.
|
||||||
|
package fake
|
50
vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_apps_client.go
generated
vendored
Normal file
50
vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_apps_client.go
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
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 fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1"
|
||||||
|
rest "k8s.io/client-go/rest"
|
||||||
|
testing "k8s.io/client-go/testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
type FakeAppsV1beta1 struct {
|
||||||
|
*testing.Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeAppsV1beta1) ControllerRevisions(namespace string) v1beta1.ControllerRevisionInterface {
|
||||||
|
return &FakeControllerRevisions{c, namespace}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeAppsV1beta1) Deployments(namespace string) v1beta1.DeploymentInterface {
|
||||||
|
return &FakeDeployments{c, namespace}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeAppsV1beta1) Scales(namespace string) v1beta1.ScaleInterface {
|
||||||
|
return &FakeScales{c, namespace}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeAppsV1beta1) StatefulSets(namespace string) v1beta1.StatefulSetInterface {
|
||||||
|
return &FakeStatefulSets{c, namespace}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RESTClient returns a RESTClient that is used to communicate
|
||||||
|
// with API server by this client implementation.
|
||||||
|
func (c *FakeAppsV1beta1) RESTClient() rest.Interface {
|
||||||
|
var ret *rest.RESTClient
|
||||||
|
return ret
|
||||||
|
}
|
120
vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_controllerrevision.go
generated
vendored
Normal file
120
vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_controllerrevision.go
generated
vendored
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
/*
|
||||||
|
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 fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1beta1 "k8s.io/api/apps/v1beta1"
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
labels "k8s.io/apimachinery/pkg/labels"
|
||||||
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
testing "k8s.io/client-go/testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FakeControllerRevisions implements ControllerRevisionInterface
|
||||||
|
type FakeControllerRevisions struct {
|
||||||
|
Fake *FakeAppsV1beta1
|
||||||
|
ns string
|
||||||
|
}
|
||||||
|
|
||||||
|
var controllerrevisionsResource = schema.GroupVersionResource{Group: "apps", Version: "v1beta1", Resource: "controllerrevisions"}
|
||||||
|
|
||||||
|
var controllerrevisionsKind = schema.GroupVersionKind{Group: "apps", Version: "v1beta1", Kind: "ControllerRevision"}
|
||||||
|
|
||||||
|
func (c *FakeControllerRevisions) Create(controllerRevision *v1beta1.ControllerRevision) (result *v1beta1.ControllerRevision, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewCreateAction(controllerrevisionsResource, c.ns, controllerRevision), &v1beta1.ControllerRevision{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1beta1.ControllerRevision), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeControllerRevisions) Update(controllerRevision *v1beta1.ControllerRevision) (result *v1beta1.ControllerRevision, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewUpdateAction(controllerrevisionsResource, c.ns, controllerRevision), &v1beta1.ControllerRevision{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1beta1.ControllerRevision), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeControllerRevisions) Delete(name string, options *v1.DeleteOptions) error {
|
||||||
|
_, err := c.Fake.
|
||||||
|
Invokes(testing.NewDeleteAction(controllerrevisionsResource, c.ns, name), &v1beta1.ControllerRevision{})
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeControllerRevisions) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||||
|
action := testing.NewDeleteCollectionAction(controllerrevisionsResource, c.ns, listOptions)
|
||||||
|
|
||||||
|
_, err := c.Fake.Invokes(action, &v1beta1.ControllerRevisionList{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeControllerRevisions) Get(name string, options v1.GetOptions) (result *v1beta1.ControllerRevision, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewGetAction(controllerrevisionsResource, c.ns, name), &v1beta1.ControllerRevision{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1beta1.ControllerRevision), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeControllerRevisions) List(opts v1.ListOptions) (result *v1beta1.ControllerRevisionList, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewListAction(controllerrevisionsResource, controllerrevisionsKind, c.ns, opts), &v1beta1.ControllerRevisionList{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||||
|
if label == nil {
|
||||||
|
label = labels.Everything()
|
||||||
|
}
|
||||||
|
list := &v1beta1.ControllerRevisionList{}
|
||||||
|
for _, item := range obj.(*v1beta1.ControllerRevisionList).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 controllerRevisions.
|
||||||
|
func (c *FakeControllerRevisions) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
return c.Fake.
|
||||||
|
InvokesWatch(testing.NewWatchAction(controllerrevisionsResource, c.ns, opts))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch applies the patch and returns the patched controllerRevision.
|
||||||
|
func (c *FakeControllerRevisions) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.ControllerRevision, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewPatchSubresourceAction(controllerrevisionsResource, c.ns, name, data, subresources...), &v1beta1.ControllerRevision{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1beta1.ControllerRevision), err
|
||||||
|
}
|
130
vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_deployment.go
generated
vendored
Normal file
130
vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_deployment.go
generated
vendored
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
/*
|
||||||
|
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 fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1beta1 "k8s.io/api/apps/v1beta1"
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
labels "k8s.io/apimachinery/pkg/labels"
|
||||||
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
testing "k8s.io/client-go/testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FakeDeployments implements DeploymentInterface
|
||||||
|
type FakeDeployments struct {
|
||||||
|
Fake *FakeAppsV1beta1
|
||||||
|
ns string
|
||||||
|
}
|
||||||
|
|
||||||
|
var deploymentsResource = schema.GroupVersionResource{Group: "apps", Version: "v1beta1", Resource: "deployments"}
|
||||||
|
|
||||||
|
var deploymentsKind = schema.GroupVersionKind{Group: "apps", Version: "v1beta1", Kind: "Deployment"}
|
||||||
|
|
||||||
|
func (c *FakeDeployments) Create(deployment *v1beta1.Deployment) (result *v1beta1.Deployment, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewCreateAction(deploymentsResource, c.ns, deployment), &v1beta1.Deployment{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1beta1.Deployment), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeDeployments) Update(deployment *v1beta1.Deployment) (result *v1beta1.Deployment, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewUpdateAction(deploymentsResource, c.ns, deployment), &v1beta1.Deployment{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1beta1.Deployment), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeDeployments) UpdateStatus(deployment *v1beta1.Deployment) (*v1beta1.Deployment, error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewUpdateSubresourceAction(deploymentsResource, "status", c.ns, deployment), &v1beta1.Deployment{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1beta1.Deployment), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeDeployments) Delete(name string, options *v1.DeleteOptions) error {
|
||||||
|
_, err := c.Fake.
|
||||||
|
Invokes(testing.NewDeleteAction(deploymentsResource, c.ns, name), &v1beta1.Deployment{})
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||||
|
action := testing.NewDeleteCollectionAction(deploymentsResource, c.ns, listOptions)
|
||||||
|
|
||||||
|
_, err := c.Fake.Invokes(action, &v1beta1.DeploymentList{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeDeployments) Get(name string, options v1.GetOptions) (result *v1beta1.Deployment, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewGetAction(deploymentsResource, c.ns, name), &v1beta1.Deployment{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1beta1.Deployment), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeDeployments) List(opts v1.ListOptions) (result *v1beta1.DeploymentList, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewListAction(deploymentsResource, deploymentsKind, c.ns, opts), &v1beta1.DeploymentList{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||||
|
if label == nil {
|
||||||
|
label = labels.Everything()
|
||||||
|
}
|
||||||
|
list := &v1beta1.DeploymentList{}
|
||||||
|
for _, item := range obj.(*v1beta1.DeploymentList).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 deployments.
|
||||||
|
func (c *FakeDeployments) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
return c.Fake.
|
||||||
|
InvokesWatch(testing.NewWatchAction(deploymentsResource, c.ns, opts))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch applies the patch and returns the patched deployment.
|
||||||
|
func (c *FakeDeployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Deployment, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewPatchSubresourceAction(deploymentsResource, c.ns, name, data, subresources...), &v1beta1.Deployment{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1beta1.Deployment), err
|
||||||
|
}
|
23
vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_scale.go
generated
vendored
Normal file
23
vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_scale.go
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
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 fake
|
||||||
|
|
||||||
|
// FakeScales implements ScaleInterface
|
||||||
|
type FakeScales struct {
|
||||||
|
Fake *FakeAppsV1beta1
|
||||||
|
ns string
|
||||||
|
}
|
130
vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_statefulset.go
generated
vendored
Normal file
130
vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_statefulset.go
generated
vendored
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
/*
|
||||||
|
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 fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1beta1 "k8s.io/api/apps/v1beta1"
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
labels "k8s.io/apimachinery/pkg/labels"
|
||||||
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
testing "k8s.io/client-go/testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FakeStatefulSets implements StatefulSetInterface
|
||||||
|
type FakeStatefulSets struct {
|
||||||
|
Fake *FakeAppsV1beta1
|
||||||
|
ns string
|
||||||
|
}
|
||||||
|
|
||||||
|
var statefulsetsResource = schema.GroupVersionResource{Group: "apps", Version: "v1beta1", Resource: "statefulsets"}
|
||||||
|
|
||||||
|
var statefulsetsKind = schema.GroupVersionKind{Group: "apps", Version: "v1beta1", Kind: "StatefulSet"}
|
||||||
|
|
||||||
|
func (c *FakeStatefulSets) Create(statefulSet *v1beta1.StatefulSet) (result *v1beta1.StatefulSet, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewCreateAction(statefulsetsResource, c.ns, statefulSet), &v1beta1.StatefulSet{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1beta1.StatefulSet), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeStatefulSets) Update(statefulSet *v1beta1.StatefulSet) (result *v1beta1.StatefulSet, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewUpdateAction(statefulsetsResource, c.ns, statefulSet), &v1beta1.StatefulSet{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1beta1.StatefulSet), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeStatefulSets) UpdateStatus(statefulSet *v1beta1.StatefulSet) (*v1beta1.StatefulSet, error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewUpdateSubresourceAction(statefulsetsResource, "status", c.ns, statefulSet), &v1beta1.StatefulSet{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1beta1.StatefulSet), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeStatefulSets) Delete(name string, options *v1.DeleteOptions) error {
|
||||||
|
_, err := c.Fake.
|
||||||
|
Invokes(testing.NewDeleteAction(statefulsetsResource, c.ns, name), &v1beta1.StatefulSet{})
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeStatefulSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||||
|
action := testing.NewDeleteCollectionAction(statefulsetsResource, c.ns, listOptions)
|
||||||
|
|
||||||
|
_, err := c.Fake.Invokes(action, &v1beta1.StatefulSetList{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeStatefulSets) Get(name string, options v1.GetOptions) (result *v1beta1.StatefulSet, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewGetAction(statefulsetsResource, c.ns, name), &v1beta1.StatefulSet{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1beta1.StatefulSet), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeStatefulSets) List(opts v1.ListOptions) (result *v1beta1.StatefulSetList, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewListAction(statefulsetsResource, statefulsetsKind, c.ns, opts), &v1beta1.StatefulSetList{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||||
|
if label == nil {
|
||||||
|
label = labels.Everything()
|
||||||
|
}
|
||||||
|
list := &v1beta1.StatefulSetList{}
|
||||||
|
for _, item := range obj.(*v1beta1.StatefulSetList).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 statefulSets.
|
||||||
|
func (c *FakeStatefulSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
return c.Fake.
|
||||||
|
InvokesWatch(testing.NewWatchAction(statefulsetsResource, c.ns, opts))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch applies the patch and returns the patched statefulSet.
|
||||||
|
func (c *FakeStatefulSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.StatefulSet, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewPatchSubresourceAction(statefulsetsResource, c.ns, name, data, subresources...), &v1beta1.StatefulSet{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1beta1.StatefulSet), err
|
||||||
|
}
|
25
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/BUILD
generated
vendored
Normal file
25
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/BUILD
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
|
"go_library",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = [
|
||||||
|
"doc.go",
|
||||||
|
"fake_authentication_client.go",
|
||||||
|
"fake_tokenreview.go",
|
||||||
|
"fake_tokenreview_expansion.go",
|
||||||
|
],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
deps = [
|
||||||
|
"//vendor/k8s.io/api/authentication/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/authentication/v1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/rest:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/testing:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
20
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/doc.go
generated
vendored
Normal file
20
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/doc.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
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 package is generated by client-gen with custom arguments.
|
||||||
|
|
||||||
|
// Package fake has the automatically generated clients.
|
||||||
|
package fake
|
38
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/fake_authentication_client.go
generated
vendored
Normal file
38
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/fake_authentication_client.go
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
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 fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1 "k8s.io/client-go/kubernetes/typed/authentication/v1"
|
||||||
|
rest "k8s.io/client-go/rest"
|
||||||
|
testing "k8s.io/client-go/testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
type FakeAuthenticationV1 struct {
|
||||||
|
*testing.Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeAuthenticationV1) TokenReviews() v1.TokenReviewInterface {
|
||||||
|
return &FakeTokenReviews{c}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RESTClient returns a RESTClient that is used to communicate
|
||||||
|
// with API server by this client implementation.
|
||||||
|
func (c *FakeAuthenticationV1) RESTClient() rest.Interface {
|
||||||
|
var ret *rest.RESTClient
|
||||||
|
return ret
|
||||||
|
}
|
22
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/fake_tokenreview.go
generated
vendored
Normal file
22
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/fake_tokenreview.go
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
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 fake
|
||||||
|
|
||||||
|
// FakeTokenReviews implements TokenReviewInterface
|
||||||
|
type FakeTokenReviews struct {
|
||||||
|
Fake *FakeAuthenticationV1
|
||||||
|
}
|
27
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/fake_tokenreview_expansion.go
generated
vendored
Normal file
27
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/fake_tokenreview_expansion.go
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
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 fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
authenticationapi "k8s.io/api/authentication/v1"
|
||||||
|
core "k8s.io/client-go/testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (c *FakeTokenReviews) Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) {
|
||||||
|
obj, err := c.Fake.Invokes(core.NewRootCreateAction(authenticationapi.SchemeGroupVersion.WithResource("tokenreviews"), tokenReview), &authenticationapi.TokenReview{})
|
||||||
|
return obj.(*authenticationapi.TokenReview), err
|
||||||
|
}
|
25
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/BUILD
generated
vendored
Normal file
25
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/BUILD
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
|
"go_library",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = [
|
||||||
|
"doc.go",
|
||||||
|
"fake_authentication_client.go",
|
||||||
|
"fake_tokenreview.go",
|
||||||
|
"fake_tokenreview_expansion.go",
|
||||||
|
],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
deps = [
|
||||||
|
"//vendor/k8s.io/api/authentication/v1beta1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/rest:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/testing:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
20
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/doc.go
generated
vendored
Normal file
20
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/doc.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
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 package is generated by client-gen with custom arguments.
|
||||||
|
|
||||||
|
// Package fake has the automatically generated clients.
|
||||||
|
package fake
|
38
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/fake_authentication_client.go
generated
vendored
Normal file
38
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/fake_authentication_client.go
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
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 fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1beta1 "k8s.io/client-go/kubernetes/typed/authentication/v1beta1"
|
||||||
|
rest "k8s.io/client-go/rest"
|
||||||
|
testing "k8s.io/client-go/testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
type FakeAuthenticationV1beta1 struct {
|
||||||
|
*testing.Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeAuthenticationV1beta1) TokenReviews() v1beta1.TokenReviewInterface {
|
||||||
|
return &FakeTokenReviews{c}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RESTClient returns a RESTClient that is used to communicate
|
||||||
|
// with API server by this client implementation.
|
||||||
|
func (c *FakeAuthenticationV1beta1) RESTClient() rest.Interface {
|
||||||
|
var ret *rest.RESTClient
|
||||||
|
return ret
|
||||||
|
}
|
22
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/fake_tokenreview.go
generated
vendored
Normal file
22
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/fake_tokenreview.go
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
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 fake
|
||||||
|
|
||||||
|
// FakeTokenReviews implements TokenReviewInterface
|
||||||
|
type FakeTokenReviews struct {
|
||||||
|
Fake *FakeAuthenticationV1beta1
|
||||||
|
}
|
27
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/fake_tokenreview_expansion.go
generated
vendored
Normal file
27
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/fake_tokenreview_expansion.go
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
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 (
|
||||||
|
authenticationapi "k8s.io/api/authentication/v1beta1"
|
||||||
|
core "k8s.io/client-go/testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (c *FakeTokenReviews) Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) {
|
||||||
|
obj, err := c.Fake.Invokes(core.NewRootCreateAction(authenticationapi.SchemeGroupVersion.WithResource("tokenreviews"), tokenReview), &authenticationapi.TokenReview{})
|
||||||
|
return obj.(*authenticationapi.TokenReview), err
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user