BPA_OPERATOR:=$(CURDIR)/cmd/bpa-operator/
KUD_PATH:=$(CURDIR)/deploy/kud
SDWAN_VERIFIER_PATH:=$(CURDIR)/sdwan/test
-BPA_E2E_SETUP:=https://raw.githubusercontent.com/onap/multicloud-k8s/master/kud/hosting_providers/vagrant/setup.sh
BPA_REST_API:=$(CURDIR)/cmd/bpa-restapi-agent
bpa_op_delete:
pushd $(BPA_OPERATOR) && make delete && popd
-bpa_op_e2e_preinstall:
- wget $(BPA_E2E_SETUP) && bash setup.sh -p libvirt
-
bpa_op_e2e:
pushd $(BPA_OPERATOR) && make e2etest && popd
-bpa_op_verifier: bpa_op_install bpa_op_e2e
+bpa_op_verifier: bpa_op_install bpa_op_e2e
bpa_op_all: bm_all bpa_op_install
metal3_prerequisite \
kud_bm_deploy_mini \
metal3_vm \
+ bpa_op_verifier \
bpa_rest_api_verifier
verifier: verify_all
.PHONY: e2etest
e2etest:
- cd e2etest && ./bpa_e2e_test.sh
+ ./bpa_verifier.sh
--- /dev/null
+#!/bin/bash
+
+# Get MAC and IP addresses of VMs provisioned by metal3
+master0=$(virsh net-dhcp-leases baremetal |grep master-0)
+masterMAC=$(echo $master0 | cut -d " " -f 3)
+masterIP=$(echo $master0 | cut -d " " -f 5)
+masterIP="${masterIP%%/*}"
+
+worker0=$(virsh net-dhcp-leases baremetal |grep worker-0)
+workerMAC=$(echo $worker0 | cut -d " " -f 3)
+workerIP=$(echo $worker0 | cut -d " " -f 5)
+workerIP="${workerIP%%/*}"
+
+# Create Fake DHCP File
+mkdir -p /opt/icn/dhcp
+cat <<EOF > /opt/icn/dhcp/dhcpd.leases
+# The format of this file is documented in the dhcpd.leases(5) manual page.
+# This lease file was written by isc-dhcp-4.3.5
+
+# authoring-byte-order entry is generated, DO NOT DELETE
+authoring-byte-order little-endian;
+
+lease ${masterIP} {
+ starts 4 2019/08/08 22:32:49;
+ ends 4 2019/08/08 23:52:49;
+ cltt 4 2019/08/08 22:32:49;
+ binding state active;
+ next binding state free;
+ rewind binding state free;
+ hardware ethernet ${masterMAC};
+ client-hostname "master-0";
+}
+lease ${workerIP} {
+ starts 4 2019/08/08 22:32:49;
+ ends 4 2019/08/08 23:52:49;
+ cltt 4 2019/08/08 22:32:49;
+ binding state active;
+ next binding state free;
+ rewind binding state free;
+ hardware ethernet ${workerMAC};
+ client-hostname "worker-0";
+}
+EOF
+
+# Build KUD image
+echo "Building KUD image"
+git clone https://github.com/onap/multicloud-k8s.git
+pushd multicloud-k8s
+docker build --rm \
+ --build-arg http_proxy=${http_proxy} \
+ --build-arg HTTP_PROXY=${HTTP_PROXY} \
+ --build-arg https_proxy=${https_proxy} \
+ --build-arg HTTPS_PROXY=${HTTPS_PROXY} \
+ --build-arg no_proxy=${no_proxy} \
+ --build-arg NO_PROXY=${NO_PROXY} \
+ -t github.com/onap/multicloud-k8s:latest . -f kud/build/Dockerfile
+
+popd
+# Create ssh-key-secret required for job
+kubectl create secret generic ssh-key-secret --from-file=id_rsa=/root/.ssh/id_rsa --from-file=id_rsa.pub=/root/.ssh/id_rsa.pub
+
+# Create provisioning CR file for testing
+cat <<EOF > e2e_test_provisioning_cr.yaml
+apiVersion: bpa.akraino.org/v1alpha1
+kind: Provisioning
+metadata:
+ name: e2e-test-provisioning
+ labels:
+ cluster: cluster-test
+ owner: c1
+spec:
+ masters:
+ - master-0:
+ mac-address: ${masterMAC}
+ workers:
+ - worker-0:
+ mac-address: ${workerMAC}
+EOF
+kubectl apply -f e2e_test_provisioning_cr.yaml
+sleep 5
+
+#Check Status of kud job pod
+status="Running"
+
+while [[ $status == "Running" ]]
+do
+ echo "KUD install job still running"
+ sleep 2m
+ stats=$(kubectl get pods |grep -i kud-cluster-test)
+ status=$(echo $stats | cut -d " " -f 3)
+done
+
+if [[ $status == "Completed" ]];
+then
+ printf "KUD Install Job completed\n"
+else
+ printf "KUD Install Job failed\n"
+fi
+
+printf "Checking cluster status\n"
+
+source ../../env/lib/common.sh
+CLUSTER_NAME=cluster-test
+KUBECONFIG=--kubeconfig=/opt/kud/multi-cluster/${CLUSTER_NAME}/artifacts/admin.conf
+APISERVER=$(kubectl ${KUBECONFIG} config view --minify -o jsonpath='{.clusters[0].cluster.server}')
+TOKEN=$(kubectl ${KUBECONFIG} get secret $(kubectl ${KUBECONFIG} get serviceaccount default -o jsonpath='{.secrets[0].name}') -o jsonpath='{.data.token}' | base64 --decode )
+call_api $APISERVER/api --header "Authorization: Bearer $TOKEN" --insecure
+ret=$?
+if [[ $ret != 0 ]];
+then
+ printf "\nKubernetes Cluster Install did not complete successfully\n"
+else
+ printf "\nKubernetes Cluster Install was successful\n"
+fi
+
+
+printf "\n\nBeginning E2E Test Teardown\n\n"
+kubectl delete -f e2e_test_provisioning_cr.yaml
+kubectl delete job kud-cluster-test
+kubectl delete secret ssh-key-secret
+rm e2e_test_provisioning_cr.yaml
+rm -rf /multi-cluster/cluster-test
+rm /opt/icn/dhcp/dhcpd.leases
+rm -rf multicloud-k8s
+make delete
+++ /dev/null
-# -*- mode: ruby -*-
-# vi: set ft=ruby :
-# SPDX-license-identifier: Apache-2.0
-##############################################################################
-# Copyright (c) 2018
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-box = {
- :virtualbox => { :name => "elastic/ubuntu-18.04-x86_64", :version=> '20191020.0.0' },
- :libvirt => { :name => "generic/ubuntu1804", :version=> "1.9.38"}
-}
-
-
-
-provider = (ENV["VAGRANT_DEFAULT_PROVIDER"] || :libvirt).to_sym
-puts "[INFO] Provider: #{provider} "
-
-if ENV["no_proxy"] != nil or ENV["NO_PROXY"]
- $no_proxy = ENV["NO_PROXY"] || ENV["no_proxy"] || "127.0.0.1,localhost,192.168.50.63"
- $subnet = "192.168.121"
- if provider == :virtualbox
- $subnet = "10.0.2"
- end
- # NOTE: This range is based on vagrant-libvirt network definition CIDR 192.168.121.0/27
- (1..31).each do |i|
- $no_proxy += ",#{$subnet}.#{i}"
- end
-end
-
-Vagrant.configure("2") do |config|
- config.vm.box = box[provider][:name]
- config.ssh.insert_key = false
- config.vm.box_version = box[provider][:version]
- config.vm.provision "file", source: "vm_authorized_keys", destination: "/home/vagrant/.ssh/authorized_keys"
-
- config.vm.provision "shell" do |sh|
- sh.inline = "mkdir -p /root/.ssh; cp /home/vagrant/.ssh/authorized_keys /root/.ssh/authorized_keys"
- sh.privileged = true
- end
-
- if ENV["http_proxy"] != nil and ENV["https_proxy"] != nil
- if Vagrant.has_plugin?("vagrant-proxyconf")
- config.proxy.http = ENV["http_proxy"] || ENV["HTTP_PROXY"] || ""
- config.proxy.https = ENV["https_proxy"] || ENV["HTTPS_PROXY"] || ""
- config.proxy.no_proxy = $no_proxy
- config.proxy.enabled = { docker: false }
- end
- end
- config.vm.provider "libvirt" do |v|
- v.nested = true
- v.cpu_mode = "host-passthrough"
- v.management_network_address = "192.168.121.0/27"
- v.random_hostname = true
- end
-
-
- config.vm.define vm_name = "bpa-test-vm" do |config|
- config.vm.hostname = "master-test"
- config.vm.network :private_network, :ip => "192.168.50.63", :type => :static, :mac => "080027efab60"
- end
- config.vm.provider "virtualbox" do |v|
- v.customize ["modifyvm", :id, "--memory", 16384]
- v.customize ["modifyvm", :id, "--cpus", 16]
- end
-
- config.vm.provider "libvirt" do |v|
- v.memory = 16384
- v.cpus = 16
-
- end
- #end
-
- sync_type = "virtualbox"
- if provider == :libvirt
- sync_type = "nfs"
- end
-end
+++ /dev/null
-apiVersion: metal3.io/v1alpha1
-kind: BareMetalHost
-metadata:
- name: bpa-test-bmh
-spec:
- online: true
- bmc:
- address: ipmi://172.31.1.17
- credentialsName: demo-bmc-secret
- image:
- url: "http://172.22.0.1/images/bionic-server-cloudimg-amd64.img"
- checksum: "http://172.22.0.1/images/bionic-server-cloudimg-amd64.md5sum"
- userData:
- name: demo-user-data
- namespace: metal3
- spec:
- bmc:
- address: ipmi://172.31.1.17
- credentialsName: demo-bmc-secret
- bootMACAddress: "3c:fd:fe:9c:88:63"
- description: ""
- externallyProvisioned: false
- hardwareProfile: ""
- image:
- checksum: http://172.22.0.1/images/bionic-server-cloudimg-amd64.md5sum
- url: http://172.22.0.1/images/bionic-server-cloudimg-amd64.img
- online: true
- userData:
- name: demo-user-data
- namespace: metal3
- status:
- errorMessage: ""
- goodCredentials:
- credentials:
- name: demo-bmc-secret
- namespace: metal3
- credentialsVersion: "584398"
- hardware:
- cpu:
- arch: x86_64
- clockMegahertz: 3700
- count: 72
- flags:
- - 3dnowprefetch
- - abm
- - acpi
- - adx
- - aes
- - aperfmperf
- - apic
- - arat
- - arch_perfmon
- - art
- - avx
- - avx2
- - avx512bw
- - avx512cd
- - avx512dq
- - avx512f
- - avx512vl
- - bmi1
- - bmi2
- - bts
- - cat_l3
- - cdp_l3
- - clflush
- - clflushopt
- - clwb
- - cmov
- - constant_tsc
- - cqm
- - cqm_llc
- - cqm_mbm_local
- - cqm_mbm_total
- - cqm_occup_llc
- - cx16
- - cx8
- - dca
- - de
- - ds_cpl
- - dtes64
- - dtherm
- - dts
- - eagerfpu
- - epb
- - ept
- - erms
- - est
- - f16c
- - flexpriority
- - flush_l1d
- - fma
- - fpu
- - fsgsbase
- - fxsr
- - hle
- - ht
- - hwp
- - hwp_act_window
- - hwp_epp
- - hwp_pkg_req
- - ibpb
- - ibrs
- - ida
- - intel_ppin
- - intel_pt
- - intel_stibp
- - invpcid
- - lahf_lm
- - lm
- - mba
- - mca
- - mce
- - md_clear
- - mmx
- - monitor
- - movbe
- - mpx
- - msr
- - mtrr
- - nonstop_tsc
- - nopl
- - nx
- - ospke
- - pae
- - pat
- - pbe
- - pcid
- - pclmulqdq
- - pdcm
- - pdpe1gb
- - pebs
- - pge
- - pku
- - pln
- - pni
- - popcnt
- - pse
- - pse36
- - pts
- - rdrand
- - rdseed
- - rdt_a
- - rdtscp
- - rep_good
- - rtm
- - sdbg
- - sep
- - smap
- - smep
- - smx
- - spec_ctrl
- - ss
- - ssbd
- - sse
- - sse2
- - sse4_1
- - sse4_2
- - ssse3
- - stibp
- - syscall
- - tm
- - tm2
- - tpr_shadow
- - tsc
- - tsc_adjust
- - tsc_deadline_timer
- - vme
- - vmx
- - vnmi
- - vpid
- - x2apic
- - xgetbv1
- - xsave
- - xsavec
- - xsaveopt
- - xtopology
- - xtpr
- model: Intel(R) Xeon(R) Gold 6140M CPU @ 2.30GHz
- firmware:
- bios:
- date: 11/07/2018
- vendor: Intel Corporation
- version: SE5C620.86B.00.01.0015.110720180833
- hostname: localhost.localdomain
- nics:
- - ip: ""
- mac: 08:00:27:00:ab:c0
- model: 0x8086 0x1572
- name: eth3
- pxe: false
- speedGbps: 0
- vlanId: 0
- - ip: ""
- mac: a4:bf:01:64:86:6e
- model: 0x8086 0x37d2
- name: eth4
- pxe: false
- speedGbps: 0
- vlanId: 0
- - ip: ""
- mac: 3c:fd:fe:9c:88:62
- model: 0x8086 0x1572
- name: eth2
- pxe: false
- speedGbps: 0
- vlanId: 0
- - ip: ""
- mac: 3c:fd:fe:9c:88:60
- model: 0x8086 0x1572
- name: eth0
- pxe: false
- speedGbps: 0
- vlanId: 0
- - ip: ""
- mac: 3c:fd:fe:9c:88:61
- model: 0x8086 0x1572
- name: eth1
- pxe: false
- speedGbps: 0
- vlanId: 0
- - ip: ""
- mac: 3c:fd:fe:9c:87:63
- model: 0x8086 0x1572
- name: eth9
- pxe: false
- speedGbps: 0
- vlanId: 0
- - ip: ""
- mac: 3c:fd:fe:9c:87:62
- model: 0x8086 0x1572
- name: eth8
- pxe: false
- speedGbps: 0
- vlanId: 0
- - ip: ""
- mac: 3c:fd:fe:9c:87:60
- model: 0x8086 0x1572
- name: eth6
- pxe: false
- speedGbps: 0
- vlanId: 0
- - ip: ""
- mac: 3c:fd:fe:9c:87:61
- model: 0x8086 0x1572
- name: eth7
- pxe: false
- speedGbps: 0
- vlanId: 0
- - ip: 172.22.0.54
- mac: a4:bf:01:64:86:6f
- model: 0x8086 0x37d2
- name: eth5
- pxe: true
- speedGbps: 0
- vlanId: 0
- ramMebibytes: 262144
- storage:
- - hctl: "6:0:0:0"
- model: INTEL SSDSC2KB48
- name: /dev/sda
- rotational: false
- serialNumber: BTYF8290022M480BGN
- sizeBytes: 480103981056
- vendor: ATA
- wwn: "0x55cd2e414fc888c1"
- wwnWithExtension: "0x55cd2e414fc888c1"
- - hctl: "7:0:0:0"
- model: INTEL SSDSC2KB48
- name: /dev/sdb
- rotational: false
- serialNumber: BTYF83160FDB480BGN
- sizeBytes: 480103981056
- vendor: ATA
- wwn: "0x55cd2e414fd7b5a3"
- wwnWithExtension: "0x55cd2e414fd7b5a3"
- systemVendor:
- manufacturer: Intel Corporation
- productName: S2600WFT (SKU Number)
- serialNumber: BQPW84200264
- hardwareProfile: unknown
- lastUpdated: "2019-07-25T01:52:55Z"
- operationalStatus: OK
- poweredOn: true
- provisioning:
- ID: 36b462c1-02a0-499e-b4f1-cc6087a1c574
- image:
- checksum: http://172.22.0.1/images/bionic-server-cloudimg-amd64.md5sum
- url: http://172.22.0.1/images/bionic-server-cloudimg-amd64.img
- state: provisioned
+++ /dev/null
-#!/bin/bash
-
-cp fake_dhcp_lease /opt/icn/dhcp/dhcpd.leases
-kubectl apply -f bmh-bpa-test.yaml
-cat /root/.ssh/id_rsa.pub > vm_authorized_keys
-vagrant up
-sleep 5
-kubectl apply -f e2e_test_provisioning_cr.yaml
-sleep 2
-status="Running"
-
-while [[ $status == "Running" ]]
-do
- stats=$(kubectl get pods |grep -i kud-cluster-test)
-
- status=$(echo $stats | cut -d " " -f 3)
- echo "KUD install job still running"
- sleep 2m
-done
-
-if [[ $status == "Completed" ]];
-then
- printf "KUD Install completed successfully\n"
-else
- printf "KUD Install failed\n"
-fi
-
-printf "\n\nBeginning E2E Test Teardown\n\n"
-
-kubectl delete -f e2e_test_provisioning_cr.yaml
-kubectl delete -f bmh-bpa-test.yaml
-kubectl delete job kud-cluster-test
-vagrant destroy -f
+++ /dev/null
-apiVersion: bpa.akraino.org/v1alpha1
-kind: Provisioning
-metadata:
- name: e2e-test-provisioning
- labels:
- cluster: cluster-test
- owner: c1
-spec:
- masters:
- - master-test:
- mac-address: 08:00:27:00:ab:c0
+++ /dev/null
-# The format of this file is documented in the dhcpd.leases(5) manual page.
-# This lease file was written by isc-dhcp-4.3.5
-
-# authoring-byte-order entry is generated, DO NOT DELETE
-authoring-byte-order little-endian;
-
-lease 192.168.50.63 {
- starts 4 2019/08/08 22:32:49;
- ends 4 2019/08/08 23:52:49;
- cltt 4 2019/08/08 22:32:49;
- binding state active;
- next binding state free;
- rewind binding state free;
- hardware ethernet 08:00:27:00:ab:c0;
- client-hostname "master-test";
-}
-lease 192.168.50.64 {
- starts 4 2019/08/08 22:32:49;
- ends 4 2019/08/08 23:52:49;
- cltt 4 2019/08/08 22:32:49;
- binding state active;
- next binding state free;
- rewind binding state free;
- hardware ethernet 00:c4:13:04:62:b5;
- client-hostname "bpa-test-2";
-}
-lease 192.168.50.65 {
- starts 4 2019/08/08 22:32:49;
- ends 4 2019/08/08 23:52:49;
- cltt 4 2019/08/08 22:32:49;
- binding state active;
- next binding state free;
- rewind binding state free;
- hardware ethernet 00:c3:11:02:61:b5;
- client-hostname "bpa-test-3";
-}
+++ /dev/null
-ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6e+WXE8sTlmW1jukGFbHKuqOgTY/ZvVh94LClzxGlVt9rPc8sd3Pqjoy1NB40WCqwdixmBEfsj0VPTPnZjHp9Qkh5MS4CBLkmJFtIcUBCDGSJ+PF8rzX5W8/TRvmWAmeGJOkyxiq+GxSEn2OCMoCpX4mz32nbInQcR5yIEPw0EYdtd3QmpLHiR6mf57rGTnr05jOJdUhLuF2I9gviy7FKVm7VnWxGzAbp/XiG3xT2NBpZ+TY4wg4tYa768wP8CKD8ixpfJNPsMaWBSgQOWG8hrYgC206utT5t0cwUJMExUFBSUwck8XpH1DP2/ce5rUtkdHnr6ve8RpyR7fOtB9YH root@AP11-29
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/dynamic"
- "k8s.io/client-go/rest"
"k8s.io/client-go/kubernetes"
"sigs.k8s.io/controller-runtime/pkg/client"
// newReconciler returns a new reconcile.Reconciler
func newReconciler(mgr manager.Manager) reconcile.Reconciler {
- return &ReconcileProvisioning{client: mgr.GetClient(), scheme: mgr.GetScheme()}
+
+ config, err := config.GetConfig()
+ if err != nil {
+ fmt.Printf("Could not get kube config, Error: %v\n", err)
+ }
+
+ clientSet, err := kubernetes.NewForConfig(config)
+ if err != nil {
+ fmt.Printf("Could not create clientset, Error: %v\n", err)
+ }
+ bmhDynamicClient, err := dynamic.NewForConfig(config)
+
+ if err != nil {
+ fmt.Printf("Could not create dynamic client for bareMetalHosts, Error: %v\n", err)
+ }
+
+ return &ReconcileProvisioning{client: mgr.GetClient(), scheme: mgr.GetScheme(), clientset: clientSet, bmhClient: bmhDynamicClient }
}
// add adds a new Controller to mgr with r as the reconcile.Reconciler
// that reads objects from the cache and writes to the apiserver
client client.Client
scheme *runtime.Scheme
+ clientset kubernetes.Interface
+ bmhClient dynamic.Interface
}
// Reconcile reads that state of the cluster for a Provisioning object and makes changes based on the state read
// Result.Requeue is true, otherwise upon completion it will remove the work from the queue.
func (r *ReconcileProvisioning) Reconcile(request reconcile.Request) (reconcile.Result, error) {
reqLogger := log.WithValues("Request.Namespace", request.Namespace, "Request.Name", request.Name)
- //reqLogger.Info("Reconciling Provisioning")
fmt.Printf("\n\n")
reqLogger.Info("Reconciling Custom Resource")
masterTag := "MASTER_"
workerTag := "WORKER_"
- config, err := config.GetConfig()
- if err != nil {
- fmt.Printf("Could not get kube config, Error: %v\n", err)
- return reconcile.Result{}, err
- }
-
- clientset, err := kubernetes.NewForConfig(config)
- if err != nil {
- fmt.Printf("Could not create clientset, Error: %v\n", err)
- return reconcile.Result{}, err
- }
if provisioningCreated {
///////////////////////////////////////////////////////////////////////////////////////////////
multiClusterDir := provisioningInstance.Spec.MultiClusterPath
- bareMetalHostList, _ := listBareMetalHosts(config)
- virtletVMList, _ := listVirtletVMs()
+ bareMetalHostList, _ := listBareMetalHosts(r.bmhClient)
+ virtletVMList, _ := listVirtletVMs(r.clientset)
+
+
+
var allString string
var masterString string
hostFile.SaveTo(iniHostFilePath)
//Install KUD
- err = createKUDinstallerJob(clusterName, request.Namespace, clusterLabel, clientset)
+ err = createKUDinstallerJob(clusterName, request.Namespace, clusterLabel, r.clientset)
if err != nil {
fmt.Printf("Error occured while creating KUD Installer job for cluster %v\n ERROR: %v", clusterName, err)
return reconcile.Result{}, err
//Start separate thread to keep checking job status, Create an IP address configmap
//for cluster if KUD is successfully installed
- go checkJob(clusterName, request.Namespace, clusterData, clusterLabel, clientset)
+ go checkJob(clusterName, request.Namespace, clusterData, clusterLabel, r.clientset)
return reconcile.Result{}, nil
defaultSSHPrivateKey := "/root/.ssh/id_rsa"
//Get IP address configmap for the cluster
- clusterConfigMapData, err := getConfigMapData(request.Namespace, softwareClusterName, clientset)
+ clusterConfigMapData, err := getConfigMapData(request.Namespace, softwareClusterName, r.clientset)
if err != nil {
fmt.Printf("Error occured while retrieving IP address Data for cluster %s, ERROR: %v\n", softwareClusterName, err)
return reconcile.Result{}, err
}
//Function to Get List containing baremetal hosts
-func listBareMetalHosts(config *rest.Config) (*unstructured.UnstructuredList, error) {
-
- //Create Dynamic Client for BareMetalHost CRD
- bmhDynamicClient, err := dynamic.NewForConfig(config)
-
- if err != nil {
- fmt.Println("Could not create dynamic client for bareMetalHosts, Error: %v\n", err)
- return &unstructured.UnstructuredList{}, err
- }
+func listBareMetalHosts(bmhDynamicClient dynamic.Interface) (*unstructured.UnstructuredList, error) {
//Create GVR representing a BareMetalHost CR
bmhGVR := schema.GroupVersionResource{
//Get List containing all BareMetalHosts CRs
bareMetalHosts, err := bmhDynamicClient.Resource(bmhGVR).List(metav1.ListOptions{})
if err != nil {
- fmt.Println("Error occured, cannot get BareMetalHosts list, Error: %v\n", err)
+ fmt.Printf("Error occured, cannot get BareMetalHosts list, Error: %v\n", err)
return &unstructured.UnstructuredList{}, err
}
//Read the dhcp lease file
dhcpFile, err := ioutil.ReadFile(dhcpLeaseFilePath)
if err != nil {
- fmt.Println("Failed to read lease file\n")
+ fmt.Printf("Failed to read lease file\n")
return "", err
}
reg := "lease.*{|ethernet.*|\n. binding state.*"
re, err := regexp.Compile(reg)
if err != nil {
- fmt.Println("Could not create Regexp object, Error %v occured\n", err)
+ fmt.Printf("Could not create Regexp object, Error %v occured\n", err)
return "", err
}
}
//Function to create configmap
-func createConfigMap(data, labels map[string]string, namespace string, clientset *kubernetes.Clientset) error{
+func createConfigMap(data, labels map[string]string, namespace string, clientset kubernetes.Interface) error{
configmapClient := clientset.CoreV1().ConfigMaps(namespace)
}
//Function to get configmap Data
-func getConfigMapData(namespace, clusterName string, clientset *kubernetes.Clientset) (map[string]string, error) {
+func getConfigMapData(namespace, clusterName string, clientset kubernetes.Interface) (map[string]string, error) {
configmapClient := clientset.CoreV1().ConfigMaps(namespace)
configmapName := clusterName + "-configmap"
}
//Function to create job for KUD installation
-func createKUDinstallerJob(clusterName, namespace string, labels map[string]string, clientset *kubernetes.Clientset) error{
+func createKUDinstallerJob(clusterName, namespace string, labels map[string]string, clientset kubernetes.Interface) error{
var backOffLimit int32 = 0
var privi bool = true
}
//Function to Check if job succeeded
-func checkJob(clusterName, namespace string, data, labels map[string]string, clientset *kubernetes.Clientset) {
+func checkJob(clusterName, namespace string, data, labels map[string]string, clientset kubernetes.Interface) {
fmt.Printf("\nChecking job status for cluster %s\n", clusterName)
jobName := "kud-" + clusterName
}
-func listVirtletVMs() ([]VirtletVM, error) {
+func listVirtletVMs(clientset kubernetes.Interface) ([]VirtletVM, error) {
var vmPodList []VirtletVM
- config, err := config.GetConfig()
- if err != nil {
- fmt.Println("Could not get kube config, Error: %v\n", err)
- return []VirtletVM{}, err
- }
-
- // create the clientset
- clientset, err := kubernetes.NewForConfig(config)
- if err != nil {
- fmt.Println("Could not create the client set, Error: %v\n", err)
- return []VirtletVM{}, err
- }
-
pods, err := clientset.CoreV1().Pods("").List(metav1.ListOptions{})
if err != nil {
- fmt.Println("Could not get pod info, Error: %v\n", err)
+ fmt.Printf("Could not get pod info, Error: %v\n", err)
return []VirtletVM{}, err
}
annotation, err := json.Marshal(pod.ObjectMeta.GetAnnotations())
if err != nil {
- fmt.Println("Could not get pod annotations, Error: %v\n", err)
+ fmt.Printf("Could not get pod annotations, Error: %v\n", err)
return []VirtletVM{}, err
}
}
return "", nil
}
+
--- /dev/null
+package provisioning
+
+import (
+
+ "testing"
+ "io/ioutil"
+ "os"
+
+ bpav1alpha1 "github.com/bpa-operator/pkg/apis/bpa/v1alpha1"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/types"
+ "k8s.io/client-go/kubernetes/scheme"
+ "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
+ "sigs.k8s.io/controller-runtime/pkg/client/fake"
+ "sigs.k8s.io/controller-runtime/pkg/reconcile"
+ fakedynamic "k8s.io/client-go/dynamic/fake"
+ fakeclientset "k8s.io/client-go/kubernetes/fake"
+)
+
+func TestProvisioningController(t *testing.T) {
+
+ logf.SetLogger(logf.ZapLogger(true))
+ bpaName1 := "bpa-test-cr"
+ bpaName2 := "bpa-test-2"
+ bpaName3 := "bpa-test-3"
+ namespace := "default"
+ clusterName := "test-cluster"
+ clusterName2 := "test-cluster-2"
+ clusterName3 := "test-cluster-3"
+ macAddress1 := "08:00:27:00:ab:2c"
+ macAddress2 := "08:00:27:00:ab:3d"
+ macAddress3 := "08:00:27:00:ab:1c"
+
+ // Create Fake DHCP file
+ err := createFakeDHCP()
+ if err != nil {
+ t.Fatalf("Cannot create Fake DHCP file for testing\n")
+ }
+
+ // Create Fake baremetalhost
+ bmhList := newBMList()
+
+ // Create Fake Provisioning CR
+ provisioning := newBPA(bpaName1, namespace, clusterName, macAddress1)
+ provisioning2 := newBPA(bpaName2, namespace, clusterName2, macAddress2)
+ provisioning3 := newBPA(bpaName3, namespace, clusterName3, macAddress3)
+
+ // Objects to track in the fake Client
+ objs := []runtime.Object{provisioning, provisioning2, provisioning3}
+
+ // Register operator types with the runtime scheme
+ sc := scheme.Scheme
+
+ sc.AddKnownTypes(bpav1alpha1.SchemeGroupVersion, provisioning, provisioning2, provisioning3)
+
+ // Create Fake Clients and Clientset
+ fakeClient := fake.NewFakeClient(objs...)
+ fakeDyn := fakedynamic.NewSimpleDynamicClient(sc, bmhList,)
+ fakeClientSet := fakeclientset.NewSimpleClientset()
+
+ r := &ReconcileProvisioning{client: fakeClient, scheme: sc, clientset: fakeClientSet, bmhClient: fakeDyn}
+
+ // Mock request to simulate Reconcile() being called on an event for a watched resource
+ req := simulateRequest(provisioning)
+ _, err = r.Reconcile(req)
+ if err != nil {
+ t.Fatalf("reconcile: (%v)", err)
+ }
+
+ // Test 1: Check the job was created with the expected name
+ jobClient := r.clientset.BatchV1().Jobs(namespace)
+ job, err := jobClient.Get("kud-test-cluster", metav1.GetOptions{})
+
+ if err != nil {
+ t.Fatalf("Error occured while getting job: (%v)", err)
+ }
+
+ // Test 2: Check that cluster name metadata in job is the expected cluster name
+ jobClusterName := job.Labels["cluster"]
+ if jobClusterName != clusterName {
+ t.Fatalf("Job cluster Name is wrong")
+ }
+
+
+ // Test 3: Check that the right error is produced when host with MAC address does not exist
+ req = simulateRequest(provisioning2)
+ _, err = r.Reconcile(req)
+ expectedErr := "Host with MAC Address " + macAddress2 + " not found\n"
+ if err.Error() != expectedErr {
+ t.Fatalf("Failed, Unexpected error occured %v\n", err)
+ }
+
+ // Test 4: Check that the right error is produced when MAC address is not found in the DHCP lease file
+ req = simulateRequest(provisioning3)
+ _, err = r.Reconcile(req)
+ expectedErr = "IP address not found for host with MAC address " + macAddress3 + " \n"
+ if err.Error() != expectedErr {
+ t.Fatalf("Failed, Unexpected error occured %v\n", err)
+ }
+
+ // Delete Fake DHCP file and cluster directories
+ err = os.Remove("/var/lib/dhcp/dhcpd.leases")
+ if err != nil {
+ t.Logf("\nUnable to delete fake DHCP file\n")
+ }
+ err = os.RemoveAll("/multi-cluster/" + clusterName)
+ if err != nil {
+ t.Logf("\nUnable to delete cluster directory %s\n", clusterName)
+ }
+ err = os.RemoveAll("/multi-cluster/" + clusterName2)
+ if err != nil {
+ t.Logf("\nUnable to delete cluster directory %s\n", clusterName2)
+ }
+ err = os.RemoveAll("/multi-cluster/" + clusterName3)
+ if err != nil {
+ t.Logf("\nUnable to delete cluster directory %s\n", clusterName3)
+ }
+
+
+}
+
+func simulateRequest(bpaCR *bpav1alpha1.Provisioning) reconcile.Request {
+ namespacedName := types.NamespacedName{
+ Name: bpaCR.ObjectMeta.Name,
+ Namespace: bpaCR.ObjectMeta.Namespace,
+ }
+ return reconcile.Request{NamespacedName: namespacedName}
+}
+
+
+
+func newBPA(name, namespace, clusterName, macAddress string) *bpav1alpha1.Provisioning {
+
+ provisioningCR := &bpav1alpha1.Provisioning{
+ ObjectMeta: metav1.ObjectMeta{
+ Name: name,
+ Namespace: namespace,
+ Labels: map[string]string{
+ "cluster": clusterName,
+ },
+ },
+ Spec: bpav1alpha1.ProvisioningSpec{
+ Masters: []map[string]bpav1alpha1.Master{
+ map[string]bpav1alpha1.Master{
+ "test-master" : bpav1alpha1.Master{
+ MACaddress: macAddress,
+ },
+
+ },
+ },
+ },
+
+ }
+ return provisioningCR
+}
+
+
+func newBMList() *unstructured.UnstructuredList{
+
+ bmMap := map[string]interface{}{
+ "apiVersion": "metal3.io/v1alpha1",
+ "kind": "BareMetalHostList",
+ "metaData": map[string]interface{}{
+ "continue": "",
+ "resourceVersion": "11830058",
+ "selfLink": "/apis/metal3.io/v1alpha1/baremetalhosts",
+
+ },
+ }
+
+
+
+
+ metaData := map[string]interface{}{
+ "creationTimestamp": "2019-10-24T04:51:15Z",
+ "generation":"1",
+ "name": "fake-test-bmh",
+ "namespace": "default",
+ "resourceVersion": "11829263",
+ "selfLink": "/apis/metal3.io/v1alpha1/namespaces/default/baremetalhosts/bpa-test-bmh",
+ "uid": "e92cb312-f619-11e9-90bc-00219ba0c77a",
+ }
+
+
+
+ nicMap1 := map[string]interface{}{
+ "ip": "",
+ "mac": "08:00:27:00:ab:2c",
+ "model": "0x8086 0x1572",
+ "name": "eth3",
+ "pxe": "false",
+ "speedGbps": "0",
+ "vlanId": "0",
+ }
+
+ nicMap2 := map[string]interface{}{
+ "ip": "",
+ "mac": "08:00:27:00:ab:1c",
+ "model": "0x8086 0x1572",
+ "name": "eth4",
+ "pxe": "false",
+ "speedGbps": "0",
+ "vlanId": "0",
+ }
+
+ specMap := map[string]interface{}{
+ "status" : map[string]interface{}{
+ "errorMessage": "",
+ "hardware": map[string]interface{}{
+ "nics": map[string]interface{}{
+ "nic1" : nicMap1,
+ "nic2" : nicMap2,
+ },
+ },
+ },
+
+
+ }
+
+ itemMap := map[string]interface{}{
+ "apiVersion": "metal3.io/v1alpha1",
+ "kind": "BareMetalHost",
+ "metadata": metaData,
+ "spec": specMap,
+ }
+ itemU := unstructured.Unstructured{
+ Object: itemMap,
+ }
+
+ itemsList := []unstructured.Unstructured{itemU,}
+
+ bmhList := &unstructured.UnstructuredList{
+ Object: bmMap,
+ Items: itemsList,
+ }
+
+
+ return bmhList
+}
+
+
+// Create DHCP file for testing
+func createFakeDHCP() error{
+
+
+ dhcpData := []byte(`lease 192.168.50.63 {
+ starts 4 2019/08/08 22:32:49;
+ ends 4 2019/08/08 23:52:49;
+ cltt 4 2019/08/08 22:32:49;
+ binding state active;
+ next binding state free;
+ rewind binding state free;
+ hardware ethernet 08:00:27:00:ab:2c;
+ client-hostname "fake-test-bmh"";
+}`)
+ err := ioutil.WriteFile("/var/lib/dhcp/dhcpd.leases", dhcpData, 0777)
+
+ if (err != nil) {
+ return err
+ }
+
+ return nil
+}
--- /dev/null
+language: go
+
+go:
+ - 1.8
+ - 1.7
+
+install:
+ - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
+ - go get github.com/jessevdk/go-flags
+
+script:
+ - go get
+ - go test -cover ./...
+
+notifications:
+ email: false
--- /dev/null
+Copyright (c) 2014, Evan Phoenix
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+* Neither the name of the Evan Phoenix nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--- /dev/null
+# JSON-Patch
+`jsonpatch` is a library which provides functionallity for both applying
+[RFC6902 JSON patches](http://tools.ietf.org/html/rfc6902) against documents, as
+well as for calculating & applying [RFC7396 JSON merge patches](https://tools.ietf.org/html/rfc7396).
+
+[](http://godoc.org/github.com/evanphx/json-patch)
+[](https://travis-ci.org/evanphx/json-patch)
+[](https://goreportcard.com/report/github.com/evanphx/json-patch)
+
+# Get It!
+
+**Latest and greatest**:
+```bash
+go get -u github.com/evanphx/json-patch
+```
+
+**Stable Versions**:
+* Version 4: `go get -u gopkg.in/evanphx/json-patch.v4`
+
+(previous versions below `v3` are unavailable)
+
+# Use It!
+* [Create and apply a merge patch](#create-and-apply-a-merge-patch)
+* [Create and apply a JSON Patch](#create-and-apply-a-json-patch)
+* [Comparing JSON documents](#comparing-json-documents)
+* [Combine merge patches](#combine-merge-patches)
+
+
+# Configuration
+
+There is a single global configuration variable `jsonpatch.SupportNegativeIndices'. This
+defaults to `true` and enables the non-standard practice of allowing negative indices
+to mean indices starting at the end of an array. This functionality can be disabled
+by setting `jsonpatch.SupportNegativeIndices = false`.
+
+## Create and apply a merge patch
+Given both an original JSON document and a modified JSON document, you can create
+a [Merge Patch](https://tools.ietf.org/html/rfc7396) document.
+
+It can describe the changes needed to convert from the original to the
+modified JSON document.
+
+Once you have a merge patch, you can apply it to other JSON documents using the
+`jsonpatch.MergePatch(document, patch)` function.
+
+```go
+package main
+
+import (
+ "fmt"
+
+ jsonpatch "github.com/evanphx/json-patch"
+)
+
+func main() {
+ // Let's create a merge patch from these two documents...
+ original := []byte(`{"name": "John", "age": 24, "height": 3.21}`)
+ target := []byte(`{"name": "Jane", "age": 24}`)
+
+ patch, err := jsonpatch.CreateMergePatch(original, target)
+ if err != nil {
+ panic(err)
+ }
+
+ // Now lets apply the patch against a different JSON document...
+
+ alternative := []byte(`{"name": "Tina", "age": 28, "height": 3.75}`)
+ modifiedAlternative, err := jsonpatch.MergePatch(alternative, patch)
+
+ fmt.Printf("patch document: %s\n", patch)
+ fmt.Printf("updated alternative doc: %s\n", modifiedAlternative)
+}
+```
+
+When ran, you get the following output:
+
+```bash
+$ go run main.go
+patch document: {"height":null,"name":"Jane"}
+updated tina doc: {"age":28,"name":"Jane"}
+```
+
+## Create and apply a JSON Patch
+You can create patch objects using `DecodePatch([]byte)`, which can then
+be applied against JSON documents.
+
+The following is an example of creating a patch from two operations, and
+applying it against a JSON document.
+
+```go
+package main
+
+import (
+ "fmt"
+
+ jsonpatch "github.com/evanphx/json-patch"
+)
+
+func main() {
+ original := []byte(`{"name": "John", "age": 24, "height": 3.21}`)
+ patchJSON := []byte(`[
+ {"op": "replace", "path": "/name", "value": "Jane"},
+ {"op": "remove", "path": "/height"}
+ ]`)
+
+ patch, err := jsonpatch.DecodePatch(patchJSON)
+ if err != nil {
+ panic(err)
+ }
+
+ modified, err := patch.Apply(original)
+ if err != nil {
+ panic(err)
+ }
+
+ fmt.Printf("Original document: %s\n", original)
+ fmt.Printf("Modified document: %s\n", modified)
+}
+```
+
+When ran, you get the following output:
+
+```bash
+$ go run main.go
+Original document: {"name": "John", "age": 24, "height": 3.21}
+Modified document: {"age":24,"name":"Jane"}
+```
+
+## Comparing JSON documents
+Due to potential whitespace and ordering differences, one cannot simply compare
+JSON strings or byte-arrays directly.
+
+As such, you can instead use `jsonpatch.Equal(document1, document2)` to
+determine if two JSON documents are _structurally_ equal. This ignores
+whitespace differences, and key-value ordering.
+
+```go
+package main
+
+import (
+ "fmt"
+
+ jsonpatch "github.com/evanphx/json-patch"
+)
+
+func main() {
+ original := []byte(`{"name": "John", "age": 24, "height": 3.21}`)
+ similar := []byte(`
+ {
+ "age": 24,
+ "height": 3.21,
+ "name": "John"
+ }
+ `)
+ different := []byte(`{"name": "Jane", "age": 20, "height": 3.37}`)
+
+ if jsonpatch.Equal(original, similar) {
+ fmt.Println(`"original" is structurally equal to "similar"`)
+ }
+
+ if !jsonpatch.Equal(original, different) {
+ fmt.Println(`"original" is _not_ structurally equal to "similar"`)
+ }
+}
+```
+
+When ran, you get the following output:
+```bash
+$ go run main.go
+"original" is structurally equal to "similar"
+"original" is _not_ structurally equal to "similar"
+```
+
+## Combine merge patches
+Given two JSON merge patch documents, it is possible to combine them into a
+single merge patch which can describe both set of changes.
+
+The resulting merge patch can be used such that applying it results in a
+document structurally similar as merging each merge patch to the document
+in succession.
+
+```go
+package main
+
+import (
+ "fmt"
+
+ jsonpatch "github.com/evanphx/json-patch"
+)
+
+func main() {
+ original := []byte(`{"name": "John", "age": 24, "height": 3.21}`)
+
+ nameAndHeight := []byte(`{"height":null,"name":"Jane"}`)
+ ageAndEyes := []byte(`{"age":4.23,"eyes":"blue"}`)
+
+ // Let's combine these merge patch documents...
+ combinedPatch, err := jsonpatch.MergeMergePatches(nameAndHeight, ageAndEyes)
+ if err != nil {
+ panic(err)
+ }
+
+ // Apply each patch individual against the original document
+ withoutCombinedPatch, err := jsonpatch.MergePatch(original, nameAndHeight)
+ if err != nil {
+ panic(err)
+ }
+
+ withoutCombinedPatch, err = jsonpatch.MergePatch(withoutCombinedPatch, ageAndEyes)
+ if err != nil {
+ panic(err)
+ }
+
+ // Apply the combined patch against the original document
+
+ withCombinedPatch, err := jsonpatch.MergePatch(original, combinedPatch)
+ if err != nil {
+ panic(err)
+ }
+
+ // Do both result in the same thing? They should!
+ if jsonpatch.Equal(withCombinedPatch, withoutCombinedPatch) {
+ fmt.Println("Both JSON documents are structurally the same!")
+ }
+
+ fmt.Printf("combined merge patch: %s", combinedPatch)
+}
+```
+
+When ran, you get the following output:
+```bash
+$ go run main.go
+Both JSON documents are structurally the same!
+combined merge patch: {"age":4.23,"eyes":"blue","height":null,"name":"Jane"}
+```
+
+# CLI for comparing JSON documents
+You can install the commandline program `json-patch`.
+
+This program can take multiple JSON patch documents as arguments,
+and fed a JSON document from `stdin`. It will apply the patch(es) against
+the document and output the modified doc.
+
+**patch.1.json**
+```json
+[
+ {"op": "replace", "path": "/name", "value": "Jane"},
+ {"op": "remove", "path": "/height"}
+]
+```
+
+**patch.2.json**
+```json
+[
+ {"op": "add", "path": "/address", "value": "123 Main St"},
+ {"op": "replace", "path": "/age", "value": "21"}
+]
+```
+
+**document.json**
+```json
+{
+ "name": "John",
+ "age": 24,
+ "height": 3.21
+}
+```
+
+You can then run:
+
+```bash
+$ go install github.com/evanphx/json-patch/cmd/json-patch
+$ cat document.json | json-patch -p patch.1.json -p patch.2.json
+{"address":"123 Main St","age":"21","name":"Jane"}
+```
+
+# Help It!
+Contributions are welcomed! Leave [an issue](https://github.com/evanphx/json-patch/issues)
+or [create a PR](https://github.com/evanphx/json-patch/compare).
+
+
+Before creating a pull request, we'd ask that you make sure tests are passing
+and that you have added new tests when applicable.
+
+Contributors can run tests using:
+
+```bash
+go test -cover ./...
+```
+
+Builds for pull requests are tested automatically
+using [TravisCI](https://travis-ci.org/evanphx/json-patch).
--- /dev/null
+package jsonpatch
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "reflect"
+)
+
+func merge(cur, patch *lazyNode, mergeMerge bool) *lazyNode {
+ curDoc, err := cur.intoDoc()
+
+ if err != nil {
+ pruneNulls(patch)
+ return patch
+ }
+
+ patchDoc, err := patch.intoDoc()
+
+ if err != nil {
+ return patch
+ }
+
+ mergeDocs(curDoc, patchDoc, mergeMerge)
+
+ return cur
+}
+
+func mergeDocs(doc, patch *partialDoc, mergeMerge bool) {
+ for k, v := range *patch {
+ if v == nil {
+ if mergeMerge {
+ (*doc)[k] = nil
+ } else {
+ delete(*doc, k)
+ }
+ } else {
+ cur, ok := (*doc)[k]
+
+ if !ok || cur == nil {
+ pruneNulls(v)
+ (*doc)[k] = v
+ } else {
+ (*doc)[k] = merge(cur, v, mergeMerge)
+ }
+ }
+ }
+}
+
+func pruneNulls(n *lazyNode) {
+ sub, err := n.intoDoc()
+
+ if err == nil {
+ pruneDocNulls(sub)
+ } else {
+ ary, err := n.intoAry()
+
+ if err == nil {
+ pruneAryNulls(ary)
+ }
+ }
+}
+
+func pruneDocNulls(doc *partialDoc) *partialDoc {
+ for k, v := range *doc {
+ if v == nil {
+ delete(*doc, k)
+ } else {
+ pruneNulls(v)
+ }
+ }
+
+ return doc
+}
+
+func pruneAryNulls(ary *partialArray) *partialArray {
+ newAry := []*lazyNode{}
+
+ for _, v := range *ary {
+ if v != nil {
+ pruneNulls(v)
+ newAry = append(newAry, v)
+ }
+ }
+
+ *ary = newAry
+
+ return ary
+}
+
+var errBadJSONDoc = fmt.Errorf("Invalid JSON Document")
+var errBadJSONPatch = fmt.Errorf("Invalid JSON Patch")
+var errBadMergeTypes = fmt.Errorf("Mismatched JSON Documents")
+
+// MergeMergePatches merges two merge patches together, such that
+// applying this resulting merged merge patch to a document yields the same
+// as merging each merge patch to the document in succession.
+func MergeMergePatches(patch1Data, patch2Data []byte) ([]byte, error) {
+ return doMergePatch(patch1Data, patch2Data, true)
+}
+
+// MergePatch merges the patchData into the docData.
+func MergePatch(docData, patchData []byte) ([]byte, error) {
+ return doMergePatch(docData, patchData, false)
+}
+
+func doMergePatch(docData, patchData []byte, mergeMerge bool) ([]byte, error) {
+ doc := &partialDoc{}
+
+ docErr := json.Unmarshal(docData, doc)
+
+ patch := &partialDoc{}
+
+ patchErr := json.Unmarshal(patchData, patch)
+
+ if _, ok := docErr.(*json.SyntaxError); ok {
+ return nil, errBadJSONDoc
+ }
+
+ if _, ok := patchErr.(*json.SyntaxError); ok {
+ return nil, errBadJSONPatch
+ }
+
+ if docErr == nil && *doc == nil {
+ return nil, errBadJSONDoc
+ }
+
+ if patchErr == nil && *patch == nil {
+ return nil, errBadJSONPatch
+ }
+
+ if docErr != nil || patchErr != nil {
+ // Not an error, just not a doc, so we turn straight into the patch
+ if patchErr == nil {
+ if mergeMerge {
+ doc = patch
+ } else {
+ doc = pruneDocNulls(patch)
+ }
+ } else {
+ patchAry := &partialArray{}
+ patchErr = json.Unmarshal(patchData, patchAry)
+
+ if patchErr != nil {
+ return nil, errBadJSONPatch
+ }
+
+ pruneAryNulls(patchAry)
+
+ out, patchErr := json.Marshal(patchAry)
+
+ if patchErr != nil {
+ return nil, errBadJSONPatch
+ }
+
+ return out, nil
+ }
+ } else {
+ mergeDocs(doc, patch, mergeMerge)
+ }
+
+ return json.Marshal(doc)
+}
+
+// resemblesJSONArray indicates whether the byte-slice "appears" to be
+// a JSON array or not.
+// False-positives are possible, as this function does not check the internal
+// structure of the array. It only checks that the outer syntax is present and
+// correct.
+func resemblesJSONArray(input []byte) bool {
+ input = bytes.TrimSpace(input)
+
+ hasPrefix := bytes.HasPrefix(input, []byte("["))
+ hasSuffix := bytes.HasSuffix(input, []byte("]"))
+
+ return hasPrefix && hasSuffix
+}
+
+// CreateMergePatch will return a merge patch document capable of converting
+// the original document(s) to the modified document(s).
+// The parameters can be bytes of either two JSON Documents, or two arrays of
+// JSON documents.
+// The merge patch returned follows the specification defined at http://tools.ietf.org/html/draft-ietf-appsawg-json-merge-patch-07
+func CreateMergePatch(originalJSON, modifiedJSON []byte) ([]byte, error) {
+ originalResemblesArray := resemblesJSONArray(originalJSON)
+ modifiedResemblesArray := resemblesJSONArray(modifiedJSON)
+
+ // Do both byte-slices seem like JSON arrays?
+ if originalResemblesArray && modifiedResemblesArray {
+ return createArrayMergePatch(originalJSON, modifiedJSON)
+ }
+
+ // Are both byte-slices are not arrays? Then they are likely JSON objects...
+ if !originalResemblesArray && !modifiedResemblesArray {
+ return createObjectMergePatch(originalJSON, modifiedJSON)
+ }
+
+ // None of the above? Then return an error because of mismatched types.
+ return nil, errBadMergeTypes
+}
+
+// createObjectMergePatch will return a merge-patch document capable of
+// converting the original document to the modified document.
+func createObjectMergePatch(originalJSON, modifiedJSON []byte) ([]byte, error) {
+ originalDoc := map[string]interface{}{}
+ modifiedDoc := map[string]interface{}{}
+
+ err := json.Unmarshal(originalJSON, &originalDoc)
+ if err != nil {
+ return nil, errBadJSONDoc
+ }
+
+ err = json.Unmarshal(modifiedJSON, &modifiedDoc)
+ if err != nil {
+ return nil, errBadJSONDoc
+ }
+
+ dest, err := getDiff(originalDoc, modifiedDoc)
+ if err != nil {
+ return nil, err
+ }
+
+ return json.Marshal(dest)
+}
+
+// createArrayMergePatch will return an array of merge-patch documents capable
+// of converting the original document to the modified document for each
+// pair of JSON documents provided in the arrays.
+// Arrays of mismatched sizes will result in an error.
+func createArrayMergePatch(originalJSON, modifiedJSON []byte) ([]byte, error) {
+ originalDocs := []json.RawMessage{}
+ modifiedDocs := []json.RawMessage{}
+
+ err := json.Unmarshal(originalJSON, &originalDocs)
+ if err != nil {
+ return nil, errBadJSONDoc
+ }
+
+ err = json.Unmarshal(modifiedJSON, &modifiedDocs)
+ if err != nil {
+ return nil, errBadJSONDoc
+ }
+
+ total := len(originalDocs)
+ if len(modifiedDocs) != total {
+ return nil, errBadJSONDoc
+ }
+
+ result := []json.RawMessage{}
+ for i := 0; i < len(originalDocs); i++ {
+ original := originalDocs[i]
+ modified := modifiedDocs[i]
+
+ patch, err := createObjectMergePatch(original, modified)
+ if err != nil {
+ return nil, err
+ }
+
+ result = append(result, json.RawMessage(patch))
+ }
+
+ return json.Marshal(result)
+}
+
+// Returns true if the array matches (must be json types).
+// As is idiomatic for go, an empty array is not the same as a nil array.
+func matchesArray(a, b []interface{}) bool {
+ if len(a) != len(b) {
+ return false
+ }
+ if (a == nil && b != nil) || (a != nil && b == nil) {
+ return false
+ }
+ for i := range a {
+ if !matchesValue(a[i], b[i]) {
+ return false
+ }
+ }
+ return true
+}
+
+// Returns true if the values matches (must be json types)
+// The types of the values must match, otherwise it will always return false
+// If two map[string]interface{} are given, all elements must match.
+func matchesValue(av, bv interface{}) bool {
+ if reflect.TypeOf(av) != reflect.TypeOf(bv) {
+ return false
+ }
+ switch at := av.(type) {
+ case string:
+ bt := bv.(string)
+ if bt == at {
+ return true
+ }
+ case float64:
+ bt := bv.(float64)
+ if bt == at {
+ return true
+ }
+ case bool:
+ bt := bv.(bool)
+ if bt == at {
+ return true
+ }
+ case nil:
+ // Both nil, fine.
+ return true
+ case map[string]interface{}:
+ bt := bv.(map[string]interface{})
+ for key := range at {
+ if !matchesValue(at[key], bt[key]) {
+ return false
+ }
+ }
+ for key := range bt {
+ if !matchesValue(at[key], bt[key]) {
+ return false
+ }
+ }
+ return true
+ case []interface{}:
+ bt := bv.([]interface{})
+ return matchesArray(at, bt)
+ }
+ return false
+}
+
+// getDiff returns the (recursive) difference between a and b as a map[string]interface{}.
+func getDiff(a, b map[string]interface{}) (map[string]interface{}, error) {
+ into := map[string]interface{}{}
+ for key, bv := range b {
+ av, ok := a[key]
+ // value was added
+ if !ok {
+ into[key] = bv
+ continue
+ }
+ // If types have changed, replace completely
+ if reflect.TypeOf(av) != reflect.TypeOf(bv) {
+ into[key] = bv
+ continue
+ }
+ // Types are the same, compare values
+ switch at := av.(type) {
+ case map[string]interface{}:
+ bt := bv.(map[string]interface{})
+ dst := make(map[string]interface{}, len(bt))
+ dst, err := getDiff(at, bt)
+ if err != nil {
+ return nil, err
+ }
+ if len(dst) > 0 {
+ into[key] = dst
+ }
+ case string, float64, bool:
+ if !matchesValue(av, bv) {
+ into[key] = bv
+ }
+ case []interface{}:
+ bt := bv.([]interface{})
+ if !matchesArray(at, bt) {
+ into[key] = bv
+ }
+ case nil:
+ switch bv.(type) {
+ case nil:
+ // Both nil, fine.
+ default:
+ into[key] = bv
+ }
+ default:
+ panic(fmt.Sprintf("Unknown type:%T in key %s", av, key))
+ }
+ }
+ // Now add all deleted values as nil
+ for key := range a {
+ _, found := b[key]
+ if !found {
+ into[key] = nil
+ }
+ }
+ return into, nil
+}
--- /dev/null
+package jsonpatch
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "strconv"
+ "strings"
+)
+
+const (
+ eRaw = iota
+ eDoc
+ eAry
+)
+
+var SupportNegativeIndices bool = true
+
+type lazyNode struct {
+ raw *json.RawMessage
+ doc partialDoc
+ ary partialArray
+ which int
+}
+
+type operation map[string]*json.RawMessage
+
+// Patch is an ordered collection of operations.
+type Patch []operation
+
+type partialDoc map[string]*lazyNode
+type partialArray []*lazyNode
+
+type container interface {
+ get(key string) (*lazyNode, error)
+ set(key string, val *lazyNode) error
+ add(key string, val *lazyNode) error
+ remove(key string) error
+}
+
+func newLazyNode(raw *json.RawMessage) *lazyNode {
+ return &lazyNode{raw: raw, doc: nil, ary: nil, which: eRaw}
+}
+
+func (n *lazyNode) MarshalJSON() ([]byte, error) {
+ switch n.which {
+ case eRaw:
+ return json.Marshal(n.raw)
+ case eDoc:
+ return json.Marshal(n.doc)
+ case eAry:
+ return json.Marshal(n.ary)
+ default:
+ return nil, fmt.Errorf("Unknown type")
+ }
+}
+
+func (n *lazyNode) UnmarshalJSON(data []byte) error {
+ dest := make(json.RawMessage, len(data))
+ copy(dest, data)
+ n.raw = &dest
+ n.which = eRaw
+ return nil
+}
+
+func (n *lazyNode) intoDoc() (*partialDoc, error) {
+ if n.which == eDoc {
+ return &n.doc, nil
+ }
+
+ if n.raw == nil {
+ return nil, fmt.Errorf("Unable to unmarshal nil pointer as partial document")
+ }
+
+ err := json.Unmarshal(*n.raw, &n.doc)
+
+ if err != nil {
+ return nil, err
+ }
+
+ n.which = eDoc
+ return &n.doc, nil
+}
+
+func (n *lazyNode) intoAry() (*partialArray, error) {
+ if n.which == eAry {
+ return &n.ary, nil
+ }
+
+ if n.raw == nil {
+ return nil, fmt.Errorf("Unable to unmarshal nil pointer as partial array")
+ }
+
+ err := json.Unmarshal(*n.raw, &n.ary)
+
+ if err != nil {
+ return nil, err
+ }
+
+ n.which = eAry
+ return &n.ary, nil
+}
+
+func (n *lazyNode) compact() []byte {
+ buf := &bytes.Buffer{}
+
+ if n.raw == nil {
+ return nil
+ }
+
+ err := json.Compact(buf, *n.raw)
+
+ if err != nil {
+ return *n.raw
+ }
+
+ return buf.Bytes()
+}
+
+func (n *lazyNode) tryDoc() bool {
+ if n.raw == nil {
+ return false
+ }
+
+ err := json.Unmarshal(*n.raw, &n.doc)
+
+ if err != nil {
+ return false
+ }
+
+ n.which = eDoc
+ return true
+}
+
+func (n *lazyNode) tryAry() bool {
+ if n.raw == nil {
+ return false
+ }
+
+ err := json.Unmarshal(*n.raw, &n.ary)
+
+ if err != nil {
+ return false
+ }
+
+ n.which = eAry
+ return true
+}
+
+func (n *lazyNode) equal(o *lazyNode) bool {
+ if n.which == eRaw {
+ if !n.tryDoc() && !n.tryAry() {
+ if o.which != eRaw {
+ return false
+ }
+
+ return bytes.Equal(n.compact(), o.compact())
+ }
+ }
+
+ if n.which == eDoc {
+ if o.which == eRaw {
+ if !o.tryDoc() {
+ return false
+ }
+ }
+
+ if o.which != eDoc {
+ return false
+ }
+
+ for k, v := range n.doc {
+ ov, ok := o.doc[k]
+
+ if !ok {
+ return false
+ }
+
+ if v == nil && ov == nil {
+ continue
+ }
+
+ if !v.equal(ov) {
+ return false
+ }
+ }
+
+ return true
+ }
+
+ if o.which != eAry && !o.tryAry() {
+ return false
+ }
+
+ if len(n.ary) != len(o.ary) {
+ return false
+ }
+
+ for idx, val := range n.ary {
+ if !val.equal(o.ary[idx]) {
+ return false
+ }
+ }
+
+ return true
+}
+
+func (o operation) kind() string {
+ if obj, ok := o["op"]; ok && obj != nil {
+ var op string
+
+ err := json.Unmarshal(*obj, &op)
+
+ if err != nil {
+ return "unknown"
+ }
+
+ return op
+ }
+
+ return "unknown"
+}
+
+func (o operation) path() string {
+ if obj, ok := o["path"]; ok && obj != nil {
+ var op string
+
+ err := json.Unmarshal(*obj, &op)
+
+ if err != nil {
+ return "unknown"
+ }
+
+ return op
+ }
+
+ return "unknown"
+}
+
+func (o operation) from() string {
+ if obj, ok := o["from"]; ok && obj != nil {
+ var op string
+
+ err := json.Unmarshal(*obj, &op)
+
+ if err != nil {
+ return "unknown"
+ }
+
+ return op
+ }
+
+ return "unknown"
+}
+
+func (o operation) value() *lazyNode {
+ if obj, ok := o["value"]; ok {
+ return newLazyNode(obj)
+ }
+
+ return nil
+}
+
+func isArray(buf []byte) bool {
+Loop:
+ for _, c := range buf {
+ switch c {
+ case ' ':
+ case '\n':
+ case '\t':
+ continue
+ case '[':
+ return true
+ default:
+ break Loop
+ }
+ }
+
+ return false
+}
+
+func findObject(pd *container, path string) (container, string) {
+ doc := *pd
+
+ split := strings.Split(path, "/")
+
+ if len(split) < 2 {
+ return nil, ""
+ }
+
+ parts := split[1 : len(split)-1]
+
+ key := split[len(split)-1]
+
+ var err error
+
+ for _, part := range parts {
+
+ next, ok := doc.get(decodePatchKey(part))
+
+ if next == nil || ok != nil {
+ return nil, ""
+ }
+
+ if isArray(*next.raw) {
+ doc, err = next.intoAry()
+
+ if err != nil {
+ return nil, ""
+ }
+ } else {
+ doc, err = next.intoDoc()
+
+ if err != nil {
+ return nil, ""
+ }
+ }
+ }
+
+ return doc, decodePatchKey(key)
+}
+
+func (d *partialDoc) set(key string, val *lazyNode) error {
+ (*d)[key] = val
+ return nil
+}
+
+func (d *partialDoc) add(key string, val *lazyNode) error {
+ (*d)[key] = val
+ return nil
+}
+
+func (d *partialDoc) get(key string) (*lazyNode, error) {
+ return (*d)[key], nil
+}
+
+func (d *partialDoc) remove(key string) error {
+ _, ok := (*d)[key]
+ if !ok {
+ return fmt.Errorf("Unable to remove nonexistent key: %s", key)
+ }
+
+ delete(*d, key)
+ return nil
+}
+
+func (d *partialArray) set(key string, val *lazyNode) error {
+ if key == "-" {
+ *d = append(*d, val)
+ return nil
+ }
+
+ idx, err := strconv.Atoi(key)
+ if err != nil {
+ return err
+ }
+
+ sz := len(*d)
+ if idx+1 > sz {
+ sz = idx + 1
+ }
+
+ ary := make([]*lazyNode, sz)
+
+ cur := *d
+
+ copy(ary, cur)
+
+ if idx >= len(ary) {
+ return fmt.Errorf("Unable to access invalid index: %d", idx)
+ }
+
+ ary[idx] = val
+
+ *d = ary
+ return nil
+}
+
+func (d *partialArray) add(key string, val *lazyNode) error {
+ if key == "-" {
+ *d = append(*d, val)
+ return nil
+ }
+
+ idx, err := strconv.Atoi(key)
+ if err != nil {
+ return err
+ }
+
+ ary := make([]*lazyNode, len(*d)+1)
+
+ cur := *d
+
+ if idx >= len(ary) {
+ return fmt.Errorf("Unable to access invalid index: %d", idx)
+ }
+
+ if SupportNegativeIndices {
+ if idx < -len(ary) {
+ return fmt.Errorf("Unable to access invalid index: %d", idx)
+ }
+
+ if idx < 0 {
+ idx += len(ary)
+ }
+ }
+
+ copy(ary[0:idx], cur[0:idx])
+ ary[idx] = val
+ copy(ary[idx+1:], cur[idx:])
+
+ *d = ary
+ return nil
+}
+
+func (d *partialArray) get(key string) (*lazyNode, error) {
+ idx, err := strconv.Atoi(key)
+
+ if err != nil {
+ return nil, err
+ }
+
+ if idx >= len(*d) {
+ return nil, fmt.Errorf("Unable to access invalid index: %d", idx)
+ }
+
+ return (*d)[idx], nil
+}
+
+func (d *partialArray) remove(key string) error {
+ idx, err := strconv.Atoi(key)
+ if err != nil {
+ return err
+ }
+
+ cur := *d
+
+ if idx >= len(cur) {
+ return fmt.Errorf("Unable to access invalid index: %d", idx)
+ }
+
+ if SupportNegativeIndices {
+ if idx < -len(cur) {
+ return fmt.Errorf("Unable to access invalid index: %d", idx)
+ }
+
+ if idx < 0 {
+ idx += len(cur)
+ }
+ }
+
+ ary := make([]*lazyNode, len(cur)-1)
+
+ copy(ary[0:idx], cur[0:idx])
+ copy(ary[idx:], cur[idx+1:])
+
+ *d = ary
+ return nil
+
+}
+
+func (p Patch) add(doc *container, op operation) error {
+ path := op.path()
+
+ con, key := findObject(doc, path)
+
+ if con == nil {
+ return fmt.Errorf("jsonpatch add operation does not apply: doc is missing path: \"%s\"", path)
+ }
+
+ return con.add(key, op.value())
+}
+
+func (p Patch) remove(doc *container, op operation) error {
+ path := op.path()
+
+ con, key := findObject(doc, path)
+
+ if con == nil {
+ return fmt.Errorf("jsonpatch remove operation does not apply: doc is missing path: \"%s\"", path)
+ }
+
+ return con.remove(key)
+}
+
+func (p Patch) replace(doc *container, op operation) error {
+ path := op.path()
+
+ con, key := findObject(doc, path)
+
+ if con == nil {
+ return fmt.Errorf("jsonpatch replace operation does not apply: doc is missing path: %s", path)
+ }
+
+ _, ok := con.get(key)
+ if ok != nil {
+ return fmt.Errorf("jsonpatch replace operation does not apply: doc is missing key: %s", path)
+ }
+
+ return con.set(key, op.value())
+}
+
+func (p Patch) move(doc *container, op operation) error {
+ from := op.from()
+
+ con, key := findObject(doc, from)
+
+ if con == nil {
+ return fmt.Errorf("jsonpatch move operation does not apply: doc is missing from path: %s", from)
+ }
+
+ val, err := con.get(key)
+ if err != nil {
+ return err
+ }
+
+ err = con.remove(key)
+ if err != nil {
+ return err
+ }
+
+ path := op.path()
+
+ con, key = findObject(doc, path)
+
+ if con == nil {
+ return fmt.Errorf("jsonpatch move operation does not apply: doc is missing destination path: %s", path)
+ }
+
+ return con.set(key, val)
+}
+
+func (p Patch) test(doc *container, op operation) error {
+ path := op.path()
+
+ con, key := findObject(doc, path)
+
+ if con == nil {
+ return fmt.Errorf("jsonpatch test operation does not apply: is missing path: %s", path)
+ }
+
+ val, err := con.get(key)
+
+ if err != nil {
+ return err
+ }
+
+ if val == nil {
+ if op.value().raw == nil {
+ return nil
+ }
+ return fmt.Errorf("Testing value %s failed", path)
+ } else if op.value() == nil {
+ return fmt.Errorf("Testing value %s failed", path)
+ }
+
+ if val.equal(op.value()) {
+ return nil
+ }
+
+ return fmt.Errorf("Testing value %s failed", path)
+}
+
+func (p Patch) copy(doc *container, op operation) error {
+ from := op.from()
+
+ con, key := findObject(doc, from)
+
+ if con == nil {
+ return fmt.Errorf("jsonpatch copy operation does not apply: doc is missing from path: %s", from)
+ }
+
+ val, err := con.get(key)
+ if err != nil {
+ return err
+ }
+
+ path := op.path()
+
+ con, key = findObject(doc, path)
+
+ if con == nil {
+ return fmt.Errorf("jsonpatch copy operation does not apply: doc is missing destination path: %s", path)
+ }
+
+ return con.set(key, val)
+}
+
+// Equal indicates if 2 JSON documents have the same structural equality.
+func Equal(a, b []byte) bool {
+ ra := make(json.RawMessage, len(a))
+ copy(ra, a)
+ la := newLazyNode(&ra)
+
+ rb := make(json.RawMessage, len(b))
+ copy(rb, b)
+ lb := newLazyNode(&rb)
+
+ return la.equal(lb)
+}
+
+// DecodePatch decodes the passed JSON document as an RFC 6902 patch.
+func DecodePatch(buf []byte) (Patch, error) {
+ var p Patch
+
+ err := json.Unmarshal(buf, &p)
+
+ if err != nil {
+ return nil, err
+ }
+
+ return p, nil
+}
+
+// Apply mutates a JSON document according to the patch, and returns the new
+// document.
+func (p Patch) Apply(doc []byte) ([]byte, error) {
+ return p.ApplyIndent(doc, "")
+}
+
+// ApplyIndent mutates a JSON document according to the patch, and returns the new
+// document indented.
+func (p Patch) ApplyIndent(doc []byte, indent string) ([]byte, error) {
+ var pd container
+ if doc[0] == '[' {
+ pd = &partialArray{}
+ } else {
+ pd = &partialDoc{}
+ }
+
+ err := json.Unmarshal(doc, pd)
+
+ if err != nil {
+ return nil, err
+ }
+
+ err = nil
+
+ for _, op := range p {
+ switch op.kind() {
+ case "add":
+ err = p.add(&pd, op)
+ case "remove":
+ err = p.remove(&pd, op)
+ case "replace":
+ err = p.replace(&pd, op)
+ case "move":
+ err = p.move(&pd, op)
+ case "test":
+ err = p.test(&pd, op)
+ case "copy":
+ err = p.copy(&pd, op)
+ default:
+ err = fmt.Errorf("Unexpected kind: %s", op.kind())
+ }
+
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ if indent != "" {
+ return json.MarshalIndent(pd, "", indent)
+ }
+
+ return json.Marshal(pd)
+}
+
+// From http://tools.ietf.org/html/rfc6901#section-4 :
+//
+// Evaluation of each reference token begins by decoding any escaped
+// character sequence. This is performed by first transforming any
+// occurrence of the sequence '~1' to '/', and then transforming any
+// occurrence of the sequence '~0' to '~'.
+
+var (
+ rfc6901Decoder = strings.NewReplacer("~1", "/", "~0", "~")
+)
+
+func decodePatchKey(k string) string {
+ return rfc6901Decoder.Replace(k)
+}
--- /dev/null
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
--- /dev/null
+package apis
+
+import (
+ "github.com/metal3-io/baremetal-operator/pkg/apis/metal3/v1alpha1"
+)
+
+func init() {
+ // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
+ AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme)
+}
--- /dev/null
+package apis
+
+import (
+ "k8s.io/apimachinery/pkg/runtime"
+)
+
+// AddToSchemes may be used to add all resources defined in the project to a Scheme
+var AddToSchemes runtime.SchemeBuilder
+
+// AddToScheme adds all Resources to the Scheme
+func AddToScheme(s *runtime.Scheme) error {
+ return AddToSchemes.AddToScheme(s)
+}
--- /dev/null
+package v1alpha1
+
+import (
+ corev1 "k8s.io/api/core/v1"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/types"
+)
+
+// NOTE: json tags are required. Any new fields you add must have
+// json tags for the fields to be serialized.
+
+// NOTE(dhellmann): Update docs/api.md when changing these data structure.
+
+const (
+ // BareMetalHostFinalizer is the name of the finalizer added to
+ // hosts to block delete operations until the physical host can be
+ // deprovisioned.
+ BareMetalHostFinalizer string = "baremetalhost.metal3.io"
+)
+
+// OperationalStatus represents the state of the host
+type OperationalStatus string
+
+const (
+ // OperationalStatusOK is the status value for when the host is
+ // configured correctly and is manageable.
+ OperationalStatusOK OperationalStatus = "OK"
+
+ // OperationalStatusDiscovered is the status value for when the
+ // host is only partially configured, such as when when the BMC
+ // address is known but the login credentials are not.
+ OperationalStatusDiscovered OperationalStatus = "discovered"
+
+ // OperationalStatusError is the status value for when the host
+ // has any sort of error.
+ OperationalStatusError OperationalStatus = "error"
+)
+
+// ProvisioningState defines the states the provisioner will report
+// the host has having.
+type ProvisioningState string
+
+const (
+ // StateNone means the state is unknown
+ StateNone ProvisioningState = ""
+
+ // StateRegistrationError means there was an error registering the
+ // host with the backend
+ StateRegistrationError ProvisioningState = "registration error"
+
+ // StateRegistering means we are telling the backend about the host
+ StateRegistering ProvisioningState = "registering"
+
+ // StateMatchProfile means we are comparing the discovered details
+ // against known hardware profiles
+ StateMatchProfile ProvisioningState = "match profile"
+
+ // StateReady means the host can be consumed
+ StateReady ProvisioningState = "ready"
+
+ // StateValidationError means the provisioning instructions had an
+ // error
+ StateValidationError ProvisioningState = "validation error"
+
+ // StateProvisioning means we are writing an image to the host's
+ // disk(s)
+ StateProvisioning ProvisioningState = "provisioning"
+
+ // StateProvisioningError means we are writing an image to the
+ // host's disk(s)
+ StateProvisioningError ProvisioningState = "provisioning error"
+
+ // StateProvisioned means we have written an image to the host's
+ // disk(s)
+ StateProvisioned ProvisioningState = "provisioned"
+
+ // StateExternallyProvisioned means something else is managing the
+ // image on the host
+ StateExternallyProvisioned ProvisioningState = "externally provisioned"
+
+ // StateDeprovisioning means we are removing an image from the
+ // host's disk(s)
+ StateDeprovisioning ProvisioningState = "deprovisioning"
+
+ // StateInspecting means we are running the agent on the host to
+ // learn about the hardware components available there
+ StateInspecting ProvisioningState = "inspecting"
+
+ // StatePowerManagementError means something went wrong trying to
+ // power the server on or off.
+ StatePowerManagementError ProvisioningState = "power management error"
+)
+
+// BMCDetails contains the information necessary to communicate with
+// the bare metal controller module on host.
+type BMCDetails struct {
+
+ // Address holds the URL for accessing the controller on the
+ // network.
+ Address string `json:"address"`
+
+ // The name of the secret containing the BMC credentials (requires
+ // keys "username" and "password").
+ CredentialsName string `json:"credentialsName"`
+}
+
+// BareMetalHostSpec defines the desired state of BareMetalHost
+type BareMetalHostSpec struct {
+ // Important: Run "operator-sdk generate k8s" to regenerate code
+ // after modifying this file
+
+ // Taints is the full, authoritative list of taints to apply to
+ // the corresponding Machine. This list will overwrite any
+ // modifications made to the Machine on an ongoing basis.
+ // +optional
+ Taints []corev1.Taint `json:"taints,omitempty"`
+
+ // How do we connect to the BMC?
+ BMC BMCDetails `json:"bmc,omitempty"`
+
+ // What is the name of the hardware profile for this host? It
+ // should only be necessary to set this when inspection cannot
+ // automatically determine the profile.
+ HardwareProfile string `json:"hardwareProfile,omitempty"`
+
+ // Which MAC address will PXE boot? This is optional for some
+ // types, but required for libvirt VMs driven by vbmc.
+ // +kubebuilder:validation:Pattern=[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}
+ BootMACAddress string `json:"bootMACAddress,omitempty"`
+
+ // Should the server be online?
+ Online bool `json:"online"`
+
+ // ConsumerRef can be used to store information about something
+ // that is using a host. When it is not empty, the host is
+ // considered "in use".
+ ConsumerRef *corev1.ObjectReference `json:"consumerRef,omitempty"`
+
+ // Image holds the details of the image to be provisioned.
+ Image *Image `json:"image,omitempty"`
+
+ // UserData holds the reference to the Secret containing the user
+ // data to be passed to the host before it boots.
+ UserData *corev1.SecretReference `json:"userData,omitempty"`
+
+ // Description is a human-entered text used to help identify the host
+ Description string `json:"description,omitempty"`
+
+ // ExternallyProvisioned means something else is managing the
+ // image running on the host and the operator should only manage
+ // the power status and hardware inventory inspection. If the
+ // Image field is filled in, this field is ignored.
+ ExternallyProvisioned bool `json:"externallyProvisioned,omitempty"`
+}
+
+// Image holds the details of an image either to provisioned or that
+// has been provisioned.
+type Image struct {
+ // URL is a location of an image to deploy.
+ URL string `json:"url"`
+
+ // Checksum is the checksum for the image.
+ Checksum string `json:"checksum"`
+}
+
+// FIXME(dhellmann): We probably want some other module to own these
+// data structures.
+
+// ClockSpeed is a clock speed in MHz
+type ClockSpeed float64
+
+// ClockSpeed multipliers
+const (
+ MegaHertz ClockSpeed = 1.0
+ GigaHertz = 1000 * MegaHertz
+)
+
+// Capacity is a disk size in Bytes
+type Capacity int64
+
+// Capacity multipliers
+const (
+ Byte Capacity = 1
+ KibiByte = Byte * 1024
+ KiloByte = Byte * 1000
+ MebiByte = KibiByte * 1024
+ MegaByte = KiloByte * 1000
+ GibiByte = MebiByte * 1024
+ GigaByte = MegaByte * 1000
+ TebiByte = GibiByte * 1024
+ TeraByte = GigaByte * 1000
+)
+
+// CPU describes one processor on the host.
+type CPU struct {
+ Arch string `json:"arch"`
+ Model string `json:"model"`
+ ClockMegahertz ClockSpeed `json:"clockMegahertz"`
+ Flags []string `json:"flags"`
+ Count int `json:"count"`
+}
+
+// Storage describes one storage device (disk, SSD, etc.) on the host.
+type Storage struct {
+ // A name for the disk, e.g. "disk 1 (boot)"
+ Name string `json:"name"`
+
+ // Whether this disk represents rotational storage
+ Rotational bool `json:"rotational"`
+
+ // The size of the disk in Bytes
+ SizeBytes Capacity `json:"sizeBytes"`
+
+ // The name of the vendor of the device
+ Vendor string `json:"vendor,omitempty"`
+
+ // Hardware model
+ Model string `json:"model,omitempty"`
+
+ // The serial number of the device
+ SerialNumber string `json:"serialNumber"`
+
+ // The WWN of the device
+ WWN string `json:"wwn,omitempty"`
+
+ // The WWN Vendor extension of the device
+ WWNVendorExtension string `json:"wwnVendorExtension,omitempty"`
+
+ // The WWN with the extension
+ WWNWithExtension string `json:"wwnWithExtension,omitempty"`
+
+ // The SCSI location of the device
+ HCTL string `json:"hctl,omitempty"`
+}
+
+// VLANID is a 12-bit 802.1Q VLAN identifier
+type VLANID int32
+
+// VLAN represents the name and ID of a VLAN
+type VLAN struct {
+ // +kubebuilder:validation:Minimum=0
+ // +kubebuilder:validation:Maximum=4094
+ ID VLANID `json:"id"`
+
+ Name string `json:"name,omitempty"`
+}
+
+// NIC describes one network interface on the host.
+type NIC struct {
+ // The name of the NIC, e.g. "nic-1"
+ Name string `json:"name"`
+
+ // The name of the model, e.g. "virt-io"
+ Model string `json:"model"`
+
+ // The device MAC addr
+ // +kubebuilder:validation:Pattern=[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}
+ MAC string `json:"mac"`
+
+ // The IP address of the device
+ IP string `json:"ip"`
+
+ // The speed of the device
+ SpeedGbps int `json:"speedGbps"`
+
+ // The VLANs available
+ VLANs []VLAN `json:"vlans,omitempty"`
+
+ // The untagged VLAN ID
+ // +kubebuilder:validation:Minimum=0
+ // +kubebuilder:validation:Maximum=4094
+ VLANID VLANID `json:"vlanId"`
+
+ // Whether the NIC is PXE Bootable
+ PXE bool `json:"pxe"`
+}
+
+// Firmware describes the firmware on the host.
+type Firmware struct {
+ // The BIOS for this firmware
+ BIOS BIOS `json:"bios"`
+}
+
+// BIOS describes the BIOS version on the host.
+type BIOS struct {
+ // The release/build date for this BIOS
+ Date string `json:"date"`
+
+ // The vendor name for this BIOS
+ Vendor string `json:"vendor"`
+
+ // The version of the BIOS
+ Version string `json:"version"`
+}
+
+// HardwareDetails collects all of the information about hardware
+// discovered on the host.
+type HardwareDetails struct {
+ SystemVendor HardwareSystemVendor `json:"systemVendor"`
+ Firmware Firmware `json:"firmware"`
+ RAMMebibytes int `json:"ramMebibytes"`
+ NIC []NIC `json:"nics"`
+ Storage []Storage `json:"storage"`
+ CPU CPU `json:"cpu"`
+ Hostname string `json:"hostname"`
+}
+
+// HardwareSystemVendor stores details about the whole hardware system.
+type HardwareSystemVendor struct {
+ Manufacturer string `json:"manufacturer"`
+ ProductName string `json:"productName"`
+ SerialNumber string `json:"serialNumber"`
+}
+
+// CredentialsStatus contains the reference and version of the last
+// set of BMC credentials the controller was able to validate.
+type CredentialsStatus struct {
+ Reference *corev1.SecretReference `json:"credentials,omitempty"`
+ Version string `json:"credentialsVersion,omitempty"`
+}
+
+// Match compares the saved status information with the name and
+// content of a secret object.
+func (cs CredentialsStatus) Match(secret corev1.Secret) bool {
+ switch {
+ case cs.Reference == nil:
+ return false
+ case cs.Reference.Name != secret.ObjectMeta.Name:
+ return false
+ case cs.Reference.Namespace != secret.ObjectMeta.Namespace:
+ return false
+ case cs.Version != secret.ObjectMeta.ResourceVersion:
+ return false
+ }
+ return true
+}
+
+// BareMetalHostStatus defines the observed state of BareMetalHost
+type BareMetalHostStatus struct {
+ // Important: Run "operator-sdk generate k8s" to regenerate code
+ // after modifying this file
+
+ // OperationalStatus holds the status of the host
+ OperationalStatus OperationalStatus `json:"operationalStatus"`
+
+ // LastUpdated identifies when this status was last observed.
+ // +optional
+ LastUpdated *metav1.Time `json:"lastUpdated,omitempty"`
+
+ // The name of the profile matching the hardware details.
+ HardwareProfile string `json:"hardwareProfile"`
+
+ // The hardware discovered to exist on the host.
+ HardwareDetails *HardwareDetails `json:"hardware,omitempty"`
+
+ // Information tracked by the provisioner.
+ Provisioning ProvisionStatus `json:"provisioning"`
+
+ // the last credentials we were able to validate as working
+ GoodCredentials CredentialsStatus `json:"goodCredentials,omitempty"`
+
+ // the last credentials we sent to the provisioning backend
+ TriedCredentials CredentialsStatus `json:"triedCredentials,omitempty"`
+
+ // the last error message reported by the provisioning subsystem
+ ErrorMessage string `json:"errorMessage"`
+
+ // indicator for whether or not the host is powered on
+ PoweredOn bool `json:"poweredOn"`
+}
+
+// ProvisionStatus holds the state information for a single target.
+type ProvisionStatus struct {
+ // An indiciator for what the provisioner is doing with the host.
+ State ProvisioningState `json:"state"`
+
+ // The machine's UUID from the underlying provisioning tool
+ ID string `json:"ID"`
+
+ // Image holds the details of the last image successfully
+ // provisioned to the host.
+ Image Image `json:"image,omitempty"`
+}
+
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+
+// BareMetalHost is the Schema for the baremetalhosts API
+// +k8s:openapi-gen=true
+// +kubebuilder:resource:shortName=bmh;bmhost
+// +kubebuilder:subresource:status
+// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.operationalStatus",description="Operational status"
+// +kubebuilder:printcolumn:name="Provisioning Status",type="string",JSONPath=".status.provisioning.state",description="Provisioning status"
+// +kubebuilder:printcolumn:name="Consumer",type="string",JSONPath=".spec.consumerRef.name",description="Consumer using this host"
+// +kubebuilder:printcolumn:name="BMC",type="string",JSONPath=".spec.bmc.address",description="Address of management controller"
+// +kubebuilder:printcolumn:name="Hardware Profile",type="string",JSONPath=".status.hardwareProfile",description="The type of hardware detected"
+// +kubebuilder:printcolumn:name="Online",type="string",JSONPath=".spec.online",description="Whether the host is online or not"
+// +kubebuilder:printcolumn:name="Error",type="string",JSONPath=".status.errorMessage",description="Most recent error"
+type BareMetalHost struct {
+ metav1.TypeMeta `json:",inline"`
+ metav1.ObjectMeta `json:"metadata,omitempty"`
+
+ Spec BareMetalHostSpec `json:"spec,omitempty"`
+ Status BareMetalHostStatus `json:"status,omitempty"`
+}
+
+// Available returns true if the host is available to be provisioned.
+func (host *BareMetalHost) Available() bool {
+ if host.Spec.ConsumerRef != nil {
+ return false
+ }
+ if host.GetDeletionTimestamp() != nil {
+ return false
+ }
+ if host.HasError() {
+ return false
+ }
+ return true
+}
+
+// SetErrorMessage updates the ErrorMessage in the host Status struct
+// when necessary and returns true when a change is made or false when
+// no change is made.
+func (host *BareMetalHost) SetErrorMessage(message string) (dirty bool) {
+ if host.Status.OperationalStatus != OperationalStatusError {
+ host.Status.OperationalStatus = OperationalStatusError
+ dirty = true
+ }
+ if host.Status.ErrorMessage != message {
+ host.Status.ErrorMessage = message
+ dirty = true
+ }
+ return dirty
+}
+
+// ClearError removes any existing error message.
+func (host *BareMetalHost) ClearError() (dirty bool) {
+ dirty = host.SetOperationalStatus(OperationalStatusOK)
+ if host.Status.ErrorMessage != "" {
+ host.Status.ErrorMessage = ""
+ dirty = true
+ }
+ return dirty
+}
+
+// setLabel updates the given label when necessary and returns true
+// when a change is made or false when no change is made.
+func (host *BareMetalHost) setLabel(name, value string) bool {
+ if host.Labels == nil {
+ host.Labels = make(map[string]string)
+ }
+ if host.Labels[name] != value {
+ host.Labels[name] = value
+ return true
+ }
+ return false
+}
+
+// getLabel returns the value associated with the given label. If
+// there is no value, an empty string is returned.
+func (host *BareMetalHost) getLabel(name string) string {
+ if host.Labels == nil {
+ return ""
+ }
+ return host.Labels[name]
+}
+
+// NeedsHardwareProfile returns true if the profile is not set
+func (host *BareMetalHost) NeedsHardwareProfile() bool {
+ return host.Status.HardwareProfile == ""
+}
+
+// HardwareProfile returns the hardware profile name for the host.
+func (host *BareMetalHost) HardwareProfile() string {
+ return host.Status.HardwareProfile
+}
+
+// SetHardwareProfile updates the hardware profile name and returns
+// true when a change is made or false when no change is made.
+func (host *BareMetalHost) SetHardwareProfile(name string) (dirty bool) {
+ if host.Status.HardwareProfile != name {
+ host.Status.HardwareProfile = name
+ dirty = true
+ }
+ return dirty
+}
+
+// SetOperationalStatus updates the OperationalStatus field and returns
+// true when a change is made or false when no change is made.
+func (host *BareMetalHost) SetOperationalStatus(status OperationalStatus) bool {
+ if host.Status.OperationalStatus != status {
+ host.Status.OperationalStatus = status
+ return true
+ }
+ return false
+}
+
+// OperationalStatus returns the contents of the OperationalStatus
+// field.
+func (host *BareMetalHost) OperationalStatus() OperationalStatus {
+ return host.Status.OperationalStatus
+}
+
+// HasError returns a boolean indicating whether there is an error
+// set for the host.
+func (host *BareMetalHost) HasError() bool {
+ return host.Status.ErrorMessage != ""
+}
+
+// CredentialsKey returns a NamespacedName suitable for loading the
+// Secret containing the credentials associated with the host.
+func (host *BareMetalHost) CredentialsKey() types.NamespacedName {
+ return types.NamespacedName{
+ Name: host.Spec.BMC.CredentialsName,
+ Namespace: host.ObjectMeta.Namespace,
+ }
+}
+
+// NeedsHardwareInspection looks at the state of the host to determine
+// if hardware inspection should be run.
+func (host *BareMetalHost) NeedsHardwareInspection() bool {
+ if host.Spec.ExternallyProvisioned {
+ // Never perform inspection if we already know something is
+ // using the host and we didn't provision it.
+ return false
+ }
+ if host.WasProvisioned() {
+ // Never perform inspection if we have already provisioned
+ // this host, because we don't want to reboot it.
+ return false
+ }
+ return host.Status.HardwareDetails == nil
+}
+
+// NeedsProvisioning compares the settings with the provisioning
+// status and returns true when more work is needed or false
+// otherwise.
+func (host *BareMetalHost) NeedsProvisioning() bool {
+ if host.Spec.ExternallyProvisioned {
+ return false
+ }
+ if !host.Spec.Online {
+ // The host is not supposed to be powered on.
+ return false
+ }
+ if host.Spec.Image == nil {
+ // Without an image, there is nothing to provision.
+ return false
+ }
+ if host.Spec.Image.URL == "" {
+ // We have an Image struct but it is empty
+ return false
+ }
+ if host.Status.Provisioning.Image.URL == "" {
+ // We have an image set, but not provisioned.
+ return true
+ }
+ return false
+}
+
+// WasProvisioned returns true when we think we have placed an image
+// on the host.
+func (host *BareMetalHost) WasProvisioned() bool {
+ if host.Spec.ExternallyProvisioned {
+ return false
+ }
+ if host.Status.Provisioning.Image.URL != "" {
+ // We have an image provisioned.
+ return true
+ }
+ return false
+}
+
+// NeedsDeprovisioning compares the settings with the provisioning
+// status and returns true when the host should be deprovisioned.
+func (host *BareMetalHost) NeedsDeprovisioning() bool {
+ if host.Spec.ExternallyProvisioned {
+ return false
+ }
+ if host.Status.Provisioning.Image.URL == "" {
+ return false
+ }
+ if host.Spec.Image == nil {
+ return true
+ }
+ if host.Spec.Image.URL != host.Status.Provisioning.Image.URL {
+ return true
+ }
+ return false
+}
+
+// UpdateGoodCredentials modifies the GoodCredentials portion of the
+// Status struct to record the details of the secret containing
+// credentials known to work.
+func (host *BareMetalHost) UpdateGoodCredentials(currentSecret corev1.Secret) {
+ host.Status.GoodCredentials.Version = currentSecret.ObjectMeta.ResourceVersion
+ host.Status.GoodCredentials.Reference = &corev1.SecretReference{
+ Name: currentSecret.ObjectMeta.Name,
+ Namespace: currentSecret.ObjectMeta.Namespace,
+ }
+}
+
+// UpdateTriedCredentials modifies the TriedCredentials portion of the
+// Status struct to record the details of the secret containing
+// credentials known to work.
+func (host *BareMetalHost) UpdateTriedCredentials(currentSecret corev1.Secret) {
+ host.Status.TriedCredentials.Version = currentSecret.ObjectMeta.ResourceVersion
+ host.Status.TriedCredentials.Reference = &corev1.SecretReference{
+ Name: currentSecret.ObjectMeta.Name,
+ Namespace: currentSecret.ObjectMeta.Namespace,
+ }
+}
+
+// NewEvent creates a new event associated with the object and ready
+// to be published to the kubernetes API.
+func (host *BareMetalHost) NewEvent(reason, message string) corev1.Event {
+ t := metav1.Now()
+ return corev1.Event{
+ ObjectMeta: metav1.ObjectMeta{
+ GenerateName: reason + "-",
+ Namespace: host.ObjectMeta.Namespace,
+ },
+ InvolvedObject: corev1.ObjectReference{
+ Kind: "BareMetalHost",
+ Namespace: host.Namespace,
+ Name: host.Name,
+ UID: host.UID,
+ APIVersion: SchemeGroupVersion.Version,
+ },
+ Reason: reason,
+ Message: message,
+ Source: corev1.EventSource{
+ Component: "metal3-baremetal-controller",
+ },
+ FirstTimestamp: t,
+ LastTimestamp: t,
+ Count: 1,
+ Type: corev1.EventTypeNormal,
+ ReportingController: "metal3.io/baremetal-controller",
+ Related: host.Spec.ConsumerRef,
+ }
+}
+
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+
+// BareMetalHostList contains a list of BareMetalHost
+type BareMetalHostList struct {
+ metav1.TypeMeta `json:",inline"`
+ metav1.ListMeta `json:"metadata,omitempty"`
+ Items []BareMetalHost `json:"items"`
+}
+
+func init() {
+ SchemeBuilder.Register(&BareMetalHost{}, &BareMetalHostList{})
+}
--- /dev/null
+// Package v1alpha1 contains API Schema definitions for the metal3 v1alpha1 API group
+// +k8s:deepcopy-gen=package,register
+// +groupName=metal3.io
+package v1alpha1
--- /dev/null
+// NOTE: Boilerplate only. Ignore this file.
+
+// Package v1alpha1 contains API Schema definitions for the metal3 v1alpha1 API group
+// +k8s:deepcopy-gen=package,register
+// +groupName=metal3.io
+package v1alpha1
+
+import (
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "sigs.k8s.io/controller-runtime/pkg/runtime/scheme"
+)
+
+var (
+ // SchemeGroupVersion is group version used to register these objects
+ SchemeGroupVersion = schema.GroupVersion{Group: "metal3.io", Version: "v1alpha1"}
+
+ // SchemeBuilder is used to add go types to the GroupVersionKind scheme
+ SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
+)
--- /dev/null
+// +build !ignore_autogenerated
+
+// Code generated by operator-sdk. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ v1 "k8s.io/api/core/v1"
+ runtime "k8s.io/apimachinery/pkg/runtime"
+)
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *BIOS) DeepCopyInto(out *BIOS) {
+ *out = *in
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BIOS.
+func (in *BIOS) DeepCopy() *BIOS {
+ if in == nil {
+ return nil
+ }
+ out := new(BIOS)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *BMCDetails) DeepCopyInto(out *BMCDetails) {
+ *out = *in
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BMCDetails.
+func (in *BMCDetails) DeepCopy() *BMCDetails {
+ if in == nil {
+ return nil
+ }
+ out := new(BMCDetails)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *BareMetalHost) DeepCopyInto(out *BareMetalHost) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
+ in.Spec.DeepCopyInto(&out.Spec)
+ in.Status.DeepCopyInto(&out.Status)
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BareMetalHost.
+func (in *BareMetalHost) DeepCopy() *BareMetalHost {
+ if in == nil {
+ return nil
+ }
+ out := new(BareMetalHost)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *BareMetalHost) DeepCopyObject() runtime.Object {
+ if c := in.DeepCopy(); c != nil {
+ return c
+ }
+ return nil
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *BareMetalHostList) DeepCopyInto(out *BareMetalHostList) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ out.ListMeta = in.ListMeta
+ if in.Items != nil {
+ in, out := &in.Items, &out.Items
+ *out = make([]BareMetalHost, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BareMetalHostList.
+func (in *BareMetalHostList) DeepCopy() *BareMetalHostList {
+ if in == nil {
+ return nil
+ }
+ out := new(BareMetalHostList)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *BareMetalHostList) DeepCopyObject() runtime.Object {
+ if c := in.DeepCopy(); c != nil {
+ return c
+ }
+ return nil
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *BareMetalHostSpec) DeepCopyInto(out *BareMetalHostSpec) {
+ *out = *in
+ if in.Taints != nil {
+ in, out := &in.Taints, &out.Taints
+ *out = make([]v1.Taint, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+ out.BMC = in.BMC
+ if in.ConsumerRef != nil {
+ in, out := &in.ConsumerRef, &out.ConsumerRef
+ *out = new(v1.ObjectReference)
+ **out = **in
+ }
+ if in.Image != nil {
+ in, out := &in.Image, &out.Image
+ *out = new(Image)
+ **out = **in
+ }
+ if in.UserData != nil {
+ in, out := &in.UserData, &out.UserData
+ *out = new(v1.SecretReference)
+ **out = **in
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BareMetalHostSpec.
+func (in *BareMetalHostSpec) DeepCopy() *BareMetalHostSpec {
+ if in == nil {
+ return nil
+ }
+ out := new(BareMetalHostSpec)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *BareMetalHostStatus) DeepCopyInto(out *BareMetalHostStatus) {
+ *out = *in
+ if in.LastUpdated != nil {
+ in, out := &in.LastUpdated, &out.LastUpdated
+ *out = (*in).DeepCopy()
+ }
+ if in.HardwareDetails != nil {
+ in, out := &in.HardwareDetails, &out.HardwareDetails
+ *out = new(HardwareDetails)
+ (*in).DeepCopyInto(*out)
+ }
+ out.Provisioning = in.Provisioning
+ in.GoodCredentials.DeepCopyInto(&out.GoodCredentials)
+ in.TriedCredentials.DeepCopyInto(&out.TriedCredentials)
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BareMetalHostStatus.
+func (in *BareMetalHostStatus) DeepCopy() *BareMetalHostStatus {
+ if in == nil {
+ return nil
+ }
+ out := new(BareMetalHostStatus)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *CPU) DeepCopyInto(out *CPU) {
+ *out = *in
+ if in.Flags != nil {
+ in, out := &in.Flags, &out.Flags
+ *out = make([]string, len(*in))
+ copy(*out, *in)
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CPU.
+func (in *CPU) DeepCopy() *CPU {
+ if in == nil {
+ return nil
+ }
+ out := new(CPU)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *CredentialsStatus) DeepCopyInto(out *CredentialsStatus) {
+ *out = *in
+ if in.Reference != nil {
+ in, out := &in.Reference, &out.Reference
+ *out = new(v1.SecretReference)
+ **out = **in
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CredentialsStatus.
+func (in *CredentialsStatus) DeepCopy() *CredentialsStatus {
+ if in == nil {
+ return nil
+ }
+ out := new(CredentialsStatus)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *Firmware) DeepCopyInto(out *Firmware) {
+ *out = *in
+ out.BIOS = in.BIOS
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Firmware.
+func (in *Firmware) DeepCopy() *Firmware {
+ if in == nil {
+ return nil
+ }
+ out := new(Firmware)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *HardwareDetails) DeepCopyInto(out *HardwareDetails) {
+ *out = *in
+ out.SystemVendor = in.SystemVendor
+ out.Firmware = in.Firmware
+ if in.NIC != nil {
+ in, out := &in.NIC, &out.NIC
+ *out = make([]NIC, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+ if in.Storage != nil {
+ in, out := &in.Storage, &out.Storage
+ *out = make([]Storage, len(*in))
+ copy(*out, *in)
+ }
+ in.CPU.DeepCopyInto(&out.CPU)
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HardwareDetails.
+func (in *HardwareDetails) DeepCopy() *HardwareDetails {
+ if in == nil {
+ return nil
+ }
+ out := new(HardwareDetails)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *HardwareSystemVendor) DeepCopyInto(out *HardwareSystemVendor) {
+ *out = *in
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HardwareSystemVendor.
+func (in *HardwareSystemVendor) DeepCopy() *HardwareSystemVendor {
+ if in == nil {
+ return nil
+ }
+ out := new(HardwareSystemVendor)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *Image) DeepCopyInto(out *Image) {
+ *out = *in
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Image.
+func (in *Image) DeepCopy() *Image {
+ if in == nil {
+ return nil
+ }
+ out := new(Image)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *NIC) DeepCopyInto(out *NIC) {
+ *out = *in
+ if in.VLANs != nil {
+ in, out := &in.VLANs, &out.VLANs
+ *out = make([]VLAN, len(*in))
+ copy(*out, *in)
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NIC.
+func (in *NIC) DeepCopy() *NIC {
+ if in == nil {
+ return nil
+ }
+ out := new(NIC)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ProvisionStatus) DeepCopyInto(out *ProvisionStatus) {
+ *out = *in
+ out.Image = in.Image
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProvisionStatus.
+func (in *ProvisionStatus) DeepCopy() *ProvisionStatus {
+ if in == nil {
+ return nil
+ }
+ out := new(ProvisionStatus)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *Storage) DeepCopyInto(out *Storage) {
+ *out = *in
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Storage.
+func (in *Storage) DeepCopy() *Storage {
+ if in == nil {
+ return nil
+ }
+ out := new(Storage)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *VLAN) DeepCopyInto(out *VLAN) {
+ *out = *in
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLAN.
+func (in *VLAN) DeepCopy() *VLAN {
+ if in == nil {
+ return nil
+ }
+ out := new(VLAN)
+ in.DeepCopyInto(out)
+ return out
+}
--- /dev/null
+// +build !ignore_autogenerated
+
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by defaulter-gen. DO NOT EDIT.
+
+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
+}
--- /dev/null
+// +build !
+
+// This file was autogenerated by openapi-gen. Do not edit it manually!
+
+package v1alpha1
+
+import (
+ spec "github.com/go-openapi/spec"
+ common "k8s.io/kube-openapi/pkg/common"
+)
+
+func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
+ return map[string]common.OpenAPIDefinition{
+ "github.com/metal3-io/baremetal-operator/pkg/apis/metal3/v1alpha1.BareMetalHost": schema_pkg_apis_metal3_v1alpha1_BareMetalHost(ref),
+ }
+}
+
+func schema_pkg_apis_metal3_v1alpha1_BareMetalHost(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "BareMetalHost is the Schema for the baremetalhosts API",
+ Properties: map[string]spec.Schema{
+ "kind": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "apiVersion": {
+ SchemaProps: spec.SchemaProps{
+ Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "metadata": {
+ SchemaProps: spec.SchemaProps{
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
+ },
+ },
+ "spec": {
+ SchemaProps: spec.SchemaProps{
+ Ref: ref("github.com/metal3-io/baremetal-operator/pkg/apis/metal3/v1alpha1.BareMetalHostSpec"),
+ },
+ },
+ "status": {
+ SchemaProps: spec.SchemaProps{
+ Ref: ref("github.com/metal3-io/baremetal-operator/pkg/apis/metal3/v1alpha1.BareMetalHostStatus"),
+ },
+ },
+ },
+ },
+ },
+ Dependencies: []string{
+ "github.com/metal3-io/baremetal-operator/pkg/apis/metal3/v1alpha1.BareMetalHostSpec", "github.com/metal3-io/baremetal-operator/pkg/apis/metal3/v1alpha1.BareMetalHostStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
+ }
+}
--- /dev/null
+/*
+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 (
+ "fmt"
+
+ "github.com/googleapis/gnostic/OpenAPIv2"
+
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "k8s.io/apimachinery/pkg/version"
+ kubeversion "k8s.io/client-go/pkg/version"
+ restclient "k8s.io/client-go/rest"
+ "k8s.io/client-go/testing"
+)
+
+// FakeDiscovery implements discovery.DiscoveryInterface and sometimes calls testing.Fake.Invoke with an action,
+// but doesn't respect the return value if any. There is a way to fake static values like ServerVersion by using the Faked... fields on the struct.
+type FakeDiscovery struct {
+ *testing.Fake
+ FakedServerVersion *version.Info
+}
+
+// ServerResourcesForGroupVersion returns the supported resources for a group
+// and version.
+func (c *FakeDiscovery) ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error) {
+ action := testing.ActionImpl{
+ Verb: "get",
+ Resource: schema.GroupVersionResource{Resource: "resource"},
+ }
+ c.Invokes(action, nil)
+ for _, resourceList := range c.Resources {
+ if resourceList.GroupVersion == groupVersion {
+ return resourceList, nil
+ }
+ }
+ return nil, fmt.Errorf("GroupVersion %q not found", groupVersion)
+}
+
+// ServerResources returns the supported resources for all groups and versions.
+func (c *FakeDiscovery) ServerResources() ([]*metav1.APIResourceList, error) {
+ action := testing.ActionImpl{
+ Verb: "get",
+ Resource: schema.GroupVersionResource{Resource: "resource"},
+ }
+ c.Invokes(action, nil)
+ return c.Resources, nil
+}
+
+// ServerPreferredResources returns the supported resources with the version
+// preferred by the server.
+func (c *FakeDiscovery) ServerPreferredResources() ([]*metav1.APIResourceList, error) {
+ return nil, nil
+}
+
+// ServerPreferredNamespacedResources returns the supported namespaced resources
+// with the version preferred by the server.
+func (c *FakeDiscovery) ServerPreferredNamespacedResources() ([]*metav1.APIResourceList, error) {
+ return nil, nil
+}
+
+// ServerGroups returns the supported groups, with information like supported
+// versions and the preferred version.
+func (c *FakeDiscovery) ServerGroups() (*metav1.APIGroupList, error) {
+ action := testing.ActionImpl{
+ Verb: "get",
+ Resource: schema.GroupVersionResource{Resource: "group"},
+ }
+ c.Invokes(action, nil)
+
+ groups := map[string]*metav1.APIGroup{}
+
+ for _, res := range c.Resources {
+ gv, err := schema.ParseGroupVersion(res.GroupVersion)
+ if err != nil {
+ return nil, err
+ }
+ group := groups[gv.Group]
+ if group == nil {
+ group = &metav1.APIGroup{
+ Name: gv.Group,
+ PreferredVersion: metav1.GroupVersionForDiscovery{
+ GroupVersion: res.GroupVersion,
+ Version: gv.Version,
+ },
+ }
+ groups[gv.Group] = group
+ }
+
+ group.Versions = append(group.Versions, metav1.GroupVersionForDiscovery{
+ GroupVersion: res.GroupVersion,
+ Version: gv.Version,
+ })
+ }
+
+ list := &metav1.APIGroupList{}
+ for _, apiGroup := range groups {
+ list.Groups = append(list.Groups, *apiGroup)
+ }
+
+ return list, nil
+
+}
+
+// ServerVersion retrieves and parses the server's version.
+func (c *FakeDiscovery) ServerVersion() (*version.Info, error) {
+ action := testing.ActionImpl{}
+ action.Verb = "get"
+ action.Resource = schema.GroupVersionResource{Resource: "version"}
+ c.Invokes(action, nil)
+
+ if c.FakedServerVersion != nil {
+ return c.FakedServerVersion, nil
+ }
+
+ versionInfo := kubeversion.Get()
+ return &versionInfo, nil
+}
+
+// OpenAPISchema retrieves and parses the swagger API schema the server supports.
+func (c *FakeDiscovery) OpenAPISchema() (*openapi_v2.Document, error) {
+ return &openapi_v2.Document{}, nil
+}
+
+// RESTClient returns a RESTClient that is used to communicate with API server
+// by this client implementation.
+func (c *FakeDiscovery) RESTClient() restclient.Interface {
+ return nil
+}
--- /dev/null
+/*
+Copyright 2018 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package fake
+
+import (
+ "strings"
+
+ "k8s.io/apimachinery/pkg/api/meta"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
+ "k8s.io/apimachinery/pkg/labels"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "k8s.io/apimachinery/pkg/runtime/serializer"
+ "k8s.io/apimachinery/pkg/types"
+ "k8s.io/apimachinery/pkg/watch"
+ "k8s.io/client-go/dynamic"
+ "k8s.io/client-go/testing"
+)
+
+func NewSimpleDynamicClient(scheme *runtime.Scheme, objects ...runtime.Object) *FakeDynamicClient {
+ // In order to use List with this client, you have to have the v1.List registered in your scheme. Neat thing though
+ // it does NOT have to be the *same* list
+ scheme.AddKnownTypeWithName(schema.GroupVersionKind{Group: "fake-dynamic-client-group", Version: "v1", Kind: "List"}, &unstructured.UnstructuredList{})
+
+ codecs := serializer.NewCodecFactory(scheme)
+ o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
+ for _, obj := range objects {
+ if err := o.Add(obj); err != nil {
+ panic(err)
+ }
+ }
+
+ cs := &FakeDynamicClient{scheme: scheme}
+ cs.AddReactor("*", "*", testing.ObjectReaction(o))
+ cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
+ gvr := action.GetResource()
+ ns := action.GetNamespace()
+ watch, err := o.Watch(gvr, ns)
+ if err != nil {
+ return false, nil, err
+ }
+ return true, watch, nil
+ })
+
+ return cs
+}
+
+// Clientset implements clientset.Interface. Meant to be embedded into a
+// struct to get a default implementation. This makes faking out just the method
+// you want to test easier.
+type FakeDynamicClient struct {
+ testing.Fake
+ scheme *runtime.Scheme
+}
+
+type dynamicResourceClient struct {
+ client *FakeDynamicClient
+ namespace string
+ resource schema.GroupVersionResource
+}
+
+var _ dynamic.Interface = &FakeDynamicClient{}
+
+func (c *FakeDynamicClient) Resource(resource schema.GroupVersionResource) dynamic.NamespaceableResourceInterface {
+ return &dynamicResourceClient{client: c, resource: resource}
+}
+
+func (c *dynamicResourceClient) Namespace(ns string) dynamic.ResourceInterface {
+ ret := *c
+ ret.namespace = ns
+ return &ret
+}
+
+func (c *dynamicResourceClient) Create(obj *unstructured.Unstructured, opts metav1.CreateOptions, subresources ...string) (*unstructured.Unstructured, error) {
+ var uncastRet runtime.Object
+ var err error
+ switch {
+ case len(c.namespace) == 0 && len(subresources) == 0:
+ uncastRet, err = c.client.Fake.
+ Invokes(testing.NewRootCreateAction(c.resource, obj), obj)
+
+ case len(c.namespace) == 0 && len(subresources) > 0:
+ accessor, err := meta.Accessor(obj)
+ if err != nil {
+ return nil, err
+ }
+ name := accessor.GetName()
+ uncastRet, err = c.client.Fake.
+ Invokes(testing.NewRootCreateSubresourceAction(c.resource, name, strings.Join(subresources, "/"), obj), obj)
+
+ case len(c.namespace) > 0 && len(subresources) == 0:
+ uncastRet, err = c.client.Fake.
+ Invokes(testing.NewCreateAction(c.resource, c.namespace, obj), obj)
+
+ case len(c.namespace) > 0 && len(subresources) > 0:
+ accessor, err := meta.Accessor(obj)
+ if err != nil {
+ return nil, err
+ }
+ name := accessor.GetName()
+ uncastRet, err = c.client.Fake.
+ Invokes(testing.NewCreateSubresourceAction(c.resource, name, strings.Join(subresources, "/"), c.namespace, obj), obj)
+
+ }
+
+ if err != nil {
+ return nil, err
+ }
+ if uncastRet == nil {
+ return nil, err
+ }
+
+ ret := &unstructured.Unstructured{}
+ if err := c.client.scheme.Convert(uncastRet, ret, nil); err != nil {
+ return nil, err
+ }
+ return ret, err
+}
+
+func (c *dynamicResourceClient) Update(obj *unstructured.Unstructured, opts metav1.UpdateOptions, subresources ...string) (*unstructured.Unstructured, error) {
+ var uncastRet runtime.Object
+ var err error
+ switch {
+ case len(c.namespace) == 0 && len(subresources) == 0:
+ uncastRet, err = c.client.Fake.
+ Invokes(testing.NewRootUpdateAction(c.resource, obj), obj)
+
+ case len(c.namespace) == 0 && len(subresources) > 0:
+ uncastRet, err = c.client.Fake.
+ Invokes(testing.NewRootUpdateSubresourceAction(c.resource, strings.Join(subresources, "/"), obj), obj)
+
+ case len(c.namespace) > 0 && len(subresources) == 0:
+ uncastRet, err = c.client.Fake.
+ Invokes(testing.NewUpdateAction(c.resource, c.namespace, obj), obj)
+
+ case len(c.namespace) > 0 && len(subresources) > 0:
+ uncastRet, err = c.client.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(c.resource, strings.Join(subresources, "/"), c.namespace, obj), obj)
+
+ }
+
+ if err != nil {
+ return nil, err
+ }
+ if uncastRet == nil {
+ return nil, err
+ }
+
+ ret := &unstructured.Unstructured{}
+ if err := c.client.scheme.Convert(uncastRet, ret, nil); err != nil {
+ return nil, err
+ }
+ return ret, err
+}
+
+func (c *dynamicResourceClient) UpdateStatus(obj *unstructured.Unstructured, opts metav1.UpdateOptions) (*unstructured.Unstructured, error) {
+ var uncastRet runtime.Object
+ var err error
+ switch {
+ case len(c.namespace) == 0:
+ uncastRet, err = c.client.Fake.
+ Invokes(testing.NewRootUpdateSubresourceAction(c.resource, "status", obj), obj)
+
+ case len(c.namespace) > 0:
+ uncastRet, err = c.client.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(c.resource, "status", c.namespace, obj), obj)
+
+ }
+
+ if err != nil {
+ return nil, err
+ }
+ if uncastRet == nil {
+ return nil, err
+ }
+
+ ret := &unstructured.Unstructured{}
+ if err := c.client.scheme.Convert(uncastRet, ret, nil); err != nil {
+ return nil, err
+ }
+ return ret, err
+}
+
+func (c *dynamicResourceClient) Delete(name string, opts *metav1.DeleteOptions, subresources ...string) error {
+ var err error
+ switch {
+ case len(c.namespace) == 0 && len(subresources) == 0:
+ _, err = c.client.Fake.
+ Invokes(testing.NewRootDeleteAction(c.resource, name), &metav1.Status{Status: "dynamic delete fail"})
+
+ case len(c.namespace) == 0 && len(subresources) > 0:
+ _, err = c.client.Fake.
+ Invokes(testing.NewRootDeleteSubresourceAction(c.resource, strings.Join(subresources, "/"), name), &metav1.Status{Status: "dynamic delete fail"})
+
+ case len(c.namespace) > 0 && len(subresources) == 0:
+ _, err = c.client.Fake.
+ Invokes(testing.NewDeleteAction(c.resource, c.namespace, name), &metav1.Status{Status: "dynamic delete fail"})
+
+ case len(c.namespace) > 0 && len(subresources) > 0:
+ _, err = c.client.Fake.
+ Invokes(testing.NewDeleteSubresourceAction(c.resource, strings.Join(subresources, "/"), c.namespace, name), &metav1.Status{Status: "dynamic delete fail"})
+ }
+
+ return err
+}
+
+func (c *dynamicResourceClient) DeleteCollection(opts *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
+ var err error
+ switch {
+ case len(c.namespace) == 0:
+ action := testing.NewRootDeleteCollectionAction(c.resource, listOptions)
+ _, err = c.client.Fake.Invokes(action, &metav1.Status{Status: "dynamic deletecollection fail"})
+
+ case len(c.namespace) > 0:
+ action := testing.NewDeleteCollectionAction(c.resource, c.namespace, listOptions)
+ _, err = c.client.Fake.Invokes(action, &metav1.Status{Status: "dynamic deletecollection fail"})
+
+ }
+
+ return err
+}
+
+func (c *dynamicResourceClient) Get(name string, opts metav1.GetOptions, subresources ...string) (*unstructured.Unstructured, error) {
+ var uncastRet runtime.Object
+ var err error
+ switch {
+ case len(c.namespace) == 0 && len(subresources) == 0:
+ uncastRet, err = c.client.Fake.
+ Invokes(testing.NewRootGetAction(c.resource, name), &metav1.Status{Status: "dynamic get fail"})
+
+ case len(c.namespace) == 0 && len(subresources) > 0:
+ uncastRet, err = c.client.Fake.
+ Invokes(testing.NewRootGetSubresourceAction(c.resource, strings.Join(subresources, "/"), name), &metav1.Status{Status: "dynamic get fail"})
+
+ case len(c.namespace) > 0 && len(subresources) == 0:
+ uncastRet, err = c.client.Fake.
+ Invokes(testing.NewGetAction(c.resource, c.namespace, name), &metav1.Status{Status: "dynamic get fail"})
+
+ case len(c.namespace) > 0 && len(subresources) > 0:
+ uncastRet, err = c.client.Fake.
+ Invokes(testing.NewGetSubresourceAction(c.resource, c.namespace, strings.Join(subresources, "/"), name), &metav1.Status{Status: "dynamic get fail"})
+ }
+
+ if err != nil {
+ return nil, err
+ }
+ if uncastRet == nil {
+ return nil, err
+ }
+
+ ret := &unstructured.Unstructured{}
+ if err := c.client.scheme.Convert(uncastRet, ret, nil); err != nil {
+ return nil, err
+ }
+ return ret, err
+}
+
+func (c *dynamicResourceClient) List(opts metav1.ListOptions) (*unstructured.UnstructuredList, error) {
+ var obj runtime.Object
+ var err error
+ switch {
+ case len(c.namespace) == 0:
+ obj, err = c.client.Fake.
+ Invokes(testing.NewRootListAction(c.resource, schema.GroupVersionKind{Group: "fake-dynamic-client-group", Version: "v1", Kind: "" /*List is appended by the tracker automatically*/}, opts), &metav1.Status{Status: "dynamic list fail"})
+
+ case len(c.namespace) > 0:
+ obj, err = c.client.Fake.
+ Invokes(testing.NewListAction(c.resource, schema.GroupVersionKind{Group: "fake-dynamic-client-group", Version: "v1", Kind: "" /*List is appended by the tracker automatically*/}, c.namespace, opts), &metav1.Status{Status: "dynamic list fail"})
+
+ }
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+
+ retUnstructured := &unstructured.Unstructured{}
+ if err := c.client.scheme.Convert(obj, retUnstructured, nil); err != nil {
+ return nil, err
+ }
+ entireList, err := retUnstructured.ToList()
+ if err != nil {
+ return nil, err
+ }
+
+ list := &unstructured.UnstructuredList{}
+ list.SetResourceVersion(entireList.GetResourceVersion())
+ for i := range entireList.Items {
+ item := &entireList.Items[i]
+ metadata, err := meta.Accessor(item)
+ if err != nil {
+ return nil, err
+ }
+ if label.Matches(labels.Set(metadata.GetLabels())) {
+ list.Items = append(list.Items, *item)
+ }
+ }
+ return list, nil
+}
+
+func (c *dynamicResourceClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
+ switch {
+ case len(c.namespace) == 0:
+ return c.client.Fake.
+ InvokesWatch(testing.NewRootWatchAction(c.resource, opts))
+
+ case len(c.namespace) > 0:
+ return c.client.Fake.
+ InvokesWatch(testing.NewWatchAction(c.resource, c.namespace, opts))
+
+ }
+
+ panic("math broke")
+}
+
+// TODO: opts are currently ignored.
+func (c *dynamicResourceClient) Patch(name string, pt types.PatchType, data []byte, opts metav1.UpdateOptions, subresources ...string) (*unstructured.Unstructured, error) {
+ var uncastRet runtime.Object
+ var err error
+ switch {
+ case len(c.namespace) == 0 && len(subresources) == 0:
+ uncastRet, err = c.client.Fake.
+ Invokes(testing.NewRootPatchAction(c.resource, name, pt, data), &metav1.Status{Status: "dynamic patch fail"})
+
+ case len(c.namespace) == 0 && len(subresources) > 0:
+ uncastRet, err = c.client.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(c.resource, name, pt, data, subresources...), &metav1.Status{Status: "dynamic patch fail"})
+
+ case len(c.namespace) > 0 && len(subresources) == 0:
+ uncastRet, err = c.client.Fake.
+ Invokes(testing.NewPatchAction(c.resource, c.namespace, name, pt, data), &metav1.Status{Status: "dynamic patch fail"})
+
+ case len(c.namespace) > 0 && len(subresources) > 0:
+ uncastRet, err = c.client.Fake.
+ Invokes(testing.NewPatchSubresourceAction(c.resource, c.namespace, name, pt, data, subresources...), &metav1.Status{Status: "dynamic patch fail"})
+
+ }
+
+ if err != nil {
+ return nil, err
+ }
+ if uncastRet == nil {
+ return nil, err
+ }
+
+ ret := &unstructured.Unstructured{}
+ if err := c.client.scheme.Convert(uncastRet, ret, nil); err != nil {
+ return nil, err
+ }
+ return ret, err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/watch"
+ "k8s.io/client-go/discovery"
+ fakediscovery "k8s.io/client-go/discovery/fake"
+ clientset "k8s.io/client-go/kubernetes"
+ admissionregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1"
+ fakeadmissionregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake"
+ admissionregistrationv1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1"
+ fakeadmissionregistrationv1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake"
+ appsv1 "k8s.io/client-go/kubernetes/typed/apps/v1"
+ fakeappsv1 "k8s.io/client-go/kubernetes/typed/apps/v1/fake"
+ appsv1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1"
+ fakeappsv1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake"
+ appsv1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2"
+ fakeappsv1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake"
+ auditregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/auditregistration/v1alpha1"
+ fakeauditregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/auditregistration/v1alpha1/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"
+ autoscalingv2beta1 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1"
+ fakeautoscalingv2beta1 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/fake"
+ autoscalingv2beta2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2"
+ fakeautoscalingv2beta2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/fake"
+ batchv1 "k8s.io/client-go/kubernetes/typed/batch/v1"
+ fakebatchv1 "k8s.io/client-go/kubernetes/typed/batch/v1/fake"
+ batchv1beta1 "k8s.io/client-go/kubernetes/typed/batch/v1beta1"
+ fakebatchv1beta1 "k8s.io/client-go/kubernetes/typed/batch/v1beta1/fake"
+ 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"
+ coordinationv1beta1 "k8s.io/client-go/kubernetes/typed/coordination/v1beta1"
+ fakecoordinationv1beta1 "k8s.io/client-go/kubernetes/typed/coordination/v1beta1/fake"
+ corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
+ fakecorev1 "k8s.io/client-go/kubernetes/typed/core/v1/fake"
+ eventsv1beta1 "k8s.io/client-go/kubernetes/typed/events/v1beta1"
+ fakeeventsv1beta1 "k8s.io/client-go/kubernetes/typed/events/v1beta1/fake"
+ extensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1"
+ fakeextensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake"
+ 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"
+ rbacv1 "k8s.io/client-go/kubernetes/typed/rbac/v1"
+ fakerbacv1 "k8s.io/client-go/kubernetes/typed/rbac/v1/fake"
+ rbacv1alpha1 "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1"
+ fakerbacv1alpha1 "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake"
+ rbacv1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1"
+ fakerbacv1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake"
+ schedulingv1alpha1 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1"
+ fakeschedulingv1alpha1 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake"
+ schedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1"
+ fakeschedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake"
+ 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"
+ storagev1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1"
+ fakestoragev1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake"
+ storagev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1"
+ fakestoragev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake"
+ "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)
+ }
+ }
+
+ cs := &Clientset{}
+ cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
+ cs.AddReactor("*", "*", testing.ObjectReaction(o))
+ cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
+ gvr := action.GetResource()
+ ns := action.GetNamespace()
+ watch, err := o.Watch(gvr, ns)
+ if err != nil {
+ return false, nil, err
+ }
+ return true, watch, nil
+ })
+
+ return cs
+}
+
+// Clientset implements clientset.Interface. Meant to be embedded into a
+// struct to get a default implementation. This makes faking out just the method
+// you want to test easier.
+type Clientset struct {
+ testing.Fake
+ discovery *fakediscovery.FakeDiscovery
+}
+
+func (c *Clientset) Discovery() discovery.DiscoveryInterface {
+ return c.discovery
+}
+
+var _ clientset.Interface = &Clientset{}
+
+// AdmissionregistrationV1alpha1 retrieves the AdmissionregistrationV1alpha1Client
+func (c *Clientset) AdmissionregistrationV1alpha1() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface {
+ return &fakeadmissionregistrationv1alpha1.FakeAdmissionregistrationV1alpha1{Fake: &c.Fake}
+}
+
+// AdmissionregistrationV1beta1 retrieves the AdmissionregistrationV1beta1Client
+func (c *Clientset) AdmissionregistrationV1beta1() admissionregistrationv1beta1.AdmissionregistrationV1beta1Interface {
+ return &fakeadmissionregistrationv1beta1.FakeAdmissionregistrationV1beta1{Fake: &c.Fake}
+}
+
+// Admissionregistration retrieves the AdmissionregistrationV1beta1Client
+func (c *Clientset) Admissionregistration() admissionregistrationv1beta1.AdmissionregistrationV1beta1Interface {
+ return &fakeadmissionregistrationv1beta1.FakeAdmissionregistrationV1beta1{Fake: &c.Fake}
+}
+
+// AppsV1beta1 retrieves the AppsV1beta1Client
+func (c *Clientset) AppsV1beta1() appsv1beta1.AppsV1beta1Interface {
+ return &fakeappsv1beta1.FakeAppsV1beta1{Fake: &c.Fake}
+}
+
+// AppsV1beta2 retrieves the AppsV1beta2Client
+func (c *Clientset) AppsV1beta2() appsv1beta2.AppsV1beta2Interface {
+ return &fakeappsv1beta2.FakeAppsV1beta2{Fake: &c.Fake}
+}
+
+// AppsV1 retrieves the AppsV1Client
+func (c *Clientset) AppsV1() appsv1.AppsV1Interface {
+ return &fakeappsv1.FakeAppsV1{Fake: &c.Fake}
+}
+
+// Apps retrieves the AppsV1Client
+func (c *Clientset) Apps() appsv1.AppsV1Interface {
+ return &fakeappsv1.FakeAppsV1{Fake: &c.Fake}
+}
+
+// AuditregistrationV1alpha1 retrieves the AuditregistrationV1alpha1Client
+func (c *Clientset) AuditregistrationV1alpha1() auditregistrationv1alpha1.AuditregistrationV1alpha1Interface {
+ return &fakeauditregistrationv1alpha1.FakeAuditregistrationV1alpha1{Fake: &c.Fake}
+}
+
+// Auditregistration retrieves the AuditregistrationV1alpha1Client
+func (c *Clientset) Auditregistration() auditregistrationv1alpha1.AuditregistrationV1alpha1Interface {
+ return &fakeauditregistrationv1alpha1.FakeAuditregistrationV1alpha1{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}
+}
+
+// AutoscalingV2beta1 retrieves the AutoscalingV2beta1Client
+func (c *Clientset) AutoscalingV2beta1() autoscalingv2beta1.AutoscalingV2beta1Interface {
+ return &fakeautoscalingv2beta1.FakeAutoscalingV2beta1{Fake: &c.Fake}
+}
+
+// AutoscalingV2beta2 retrieves the AutoscalingV2beta2Client
+func (c *Clientset) AutoscalingV2beta2() autoscalingv2beta2.AutoscalingV2beta2Interface {
+ return &fakeautoscalingv2beta2.FakeAutoscalingV2beta2{Fake: &c.Fake}
+}
+
+// BatchV1 retrieves the BatchV1Client
+func (c *Clientset) BatchV1() batchv1.BatchV1Interface {
+ return &fakebatchv1.FakeBatchV1{Fake: &c.Fake}
+}
+
+// Batch retrieves the BatchV1Client
+func (c *Clientset) Batch() batchv1.BatchV1Interface {
+ return &fakebatchv1.FakeBatchV1{Fake: &c.Fake}
+}
+
+// BatchV1beta1 retrieves the BatchV1beta1Client
+func (c *Clientset) BatchV1beta1() batchv1beta1.BatchV1beta1Interface {
+ return &fakebatchv1beta1.FakeBatchV1beta1{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}
+}
+
+// CoordinationV1beta1 retrieves the CoordinationV1beta1Client
+func (c *Clientset) CoordinationV1beta1() coordinationv1beta1.CoordinationV1beta1Interface {
+ return &fakecoordinationv1beta1.FakeCoordinationV1beta1{Fake: &c.Fake}
+}
+
+// Coordination retrieves the CoordinationV1beta1Client
+func (c *Clientset) Coordination() coordinationv1beta1.CoordinationV1beta1Interface {
+ return &fakecoordinationv1beta1.FakeCoordinationV1beta1{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}
+}
+
+// EventsV1beta1 retrieves the EventsV1beta1Client
+func (c *Clientset) EventsV1beta1() eventsv1beta1.EventsV1beta1Interface {
+ return &fakeeventsv1beta1.FakeEventsV1beta1{Fake: &c.Fake}
+}
+
+// Events retrieves the EventsV1beta1Client
+func (c *Clientset) Events() eventsv1beta1.EventsV1beta1Interface {
+ return &fakeeventsv1beta1.FakeEventsV1beta1{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}
+}
+
+// RbacV1 retrieves the RbacV1Client
+func (c *Clientset) RbacV1() rbacv1.RbacV1Interface {
+ return &fakerbacv1.FakeRbacV1{Fake: &c.Fake}
+}
+
+// Rbac retrieves the RbacV1Client
+func (c *Clientset) Rbac() rbacv1.RbacV1Interface {
+ return &fakerbacv1.FakeRbacV1{Fake: &c.Fake}
+}
+
+// RbacV1beta1 retrieves the RbacV1beta1Client
+func (c *Clientset) RbacV1beta1() rbacv1beta1.RbacV1beta1Interface {
+ return &fakerbacv1beta1.FakeRbacV1beta1{Fake: &c.Fake}
+}
+
+// RbacV1alpha1 retrieves the RbacV1alpha1Client
+func (c *Clientset) RbacV1alpha1() rbacv1alpha1.RbacV1alpha1Interface {
+ return &fakerbacv1alpha1.FakeRbacV1alpha1{Fake: &c.Fake}
+}
+
+// SchedulingV1alpha1 retrieves the SchedulingV1alpha1Client
+func (c *Clientset) SchedulingV1alpha1() schedulingv1alpha1.SchedulingV1alpha1Interface {
+ return &fakeschedulingv1alpha1.FakeSchedulingV1alpha1{Fake: &c.Fake}
+}
+
+// SchedulingV1beta1 retrieves the SchedulingV1beta1Client
+func (c *Clientset) SchedulingV1beta1() schedulingv1beta1.SchedulingV1beta1Interface {
+ return &fakeschedulingv1beta1.FakeSchedulingV1beta1{Fake: &c.Fake}
+}
+
+// Scheduling retrieves the SchedulingV1beta1Client
+func (c *Clientset) Scheduling() schedulingv1beta1.SchedulingV1beta1Interface {
+ return &fakeschedulingv1beta1.FakeSchedulingV1beta1{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}
+}
+
+// StorageV1alpha1 retrieves the StorageV1alpha1Client
+func (c *Clientset) StorageV1alpha1() storagev1alpha1.StorageV1alpha1Interface {
+ return &fakestoragev1alpha1.FakeStorageV1alpha1{Fake: &c.Fake}
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// This package has the automatically generated fake clientset.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ admissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
+ admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1"
+ appsv1 "k8s.io/api/apps/v1"
+ appsv1beta1 "k8s.io/api/apps/v1beta1"
+ appsv1beta2 "k8s.io/api/apps/v1beta2"
+ auditregistrationv1alpha1 "k8s.io/api/auditregistration/v1alpha1"
+ 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"
+ autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1"
+ autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2"
+ batchv1 "k8s.io/api/batch/v1"
+ batchv1beta1 "k8s.io/api/batch/v1beta1"
+ batchv2alpha1 "k8s.io/api/batch/v2alpha1"
+ certificatesv1beta1 "k8s.io/api/certificates/v1beta1"
+ coordinationv1beta1 "k8s.io/api/coordination/v1beta1"
+ corev1 "k8s.io/api/core/v1"
+ eventsv1beta1 "k8s.io/api/events/v1beta1"
+ extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
+ networkingv1 "k8s.io/api/networking/v1"
+ policyv1beta1 "k8s.io/api/policy/v1beta1"
+ rbacv1 "k8s.io/api/rbac/v1"
+ rbacv1alpha1 "k8s.io/api/rbac/v1alpha1"
+ rbacv1beta1 "k8s.io/api/rbac/v1beta1"
+ schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1"
+ schedulingv1beta1 "k8s.io/api/scheduling/v1beta1"
+ settingsv1alpha1 "k8s.io/api/settings/v1alpha1"
+ storagev1 "k8s.io/api/storage/v1"
+ storagev1alpha1 "k8s.io/api/storage/v1alpha1"
+ 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"
+ utilruntime "k8s.io/apimachinery/pkg/util/runtime"
+)
+
+var scheme = runtime.NewScheme()
+var codecs = serializer.NewCodecFactory(scheme)
+var parameterCodec = runtime.NewParameterCodec(scheme)
+var localSchemeBuilder = runtime.SchemeBuilder{
+ admissionregistrationv1alpha1.AddToScheme,
+ admissionregistrationv1beta1.AddToScheme,
+ appsv1beta1.AddToScheme,
+ appsv1beta2.AddToScheme,
+ appsv1.AddToScheme,
+ auditregistrationv1alpha1.AddToScheme,
+ authenticationv1.AddToScheme,
+ authenticationv1beta1.AddToScheme,
+ authorizationv1.AddToScheme,
+ authorizationv1beta1.AddToScheme,
+ autoscalingv1.AddToScheme,
+ autoscalingv2beta1.AddToScheme,
+ autoscalingv2beta2.AddToScheme,
+ batchv1.AddToScheme,
+ batchv1beta1.AddToScheme,
+ batchv2alpha1.AddToScheme,
+ certificatesv1beta1.AddToScheme,
+ coordinationv1beta1.AddToScheme,
+ corev1.AddToScheme,
+ eventsv1beta1.AddToScheme,
+ extensionsv1beta1.AddToScheme,
+ networkingv1.AddToScheme,
+ policyv1beta1.AddToScheme,
+ rbacv1.AddToScheme,
+ rbacv1beta1.AddToScheme,
+ rbacv1alpha1.AddToScheme,
+ schedulingv1alpha1.AddToScheme,
+ schedulingv1beta1.AddToScheme,
+ settingsv1alpha1.AddToScheme,
+ storagev1beta1.AddToScheme,
+ storagev1.AddToScheme,
+ storagev1alpha1.AddToScheme,
+}
+
+// AddToScheme adds all types of this clientset into the given scheme. This allows composition
+// of clientsets, like in:
+//
+// import (
+// "k8s.io/client-go/kubernetes"
+// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
+// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
+// )
+//
+// kclientset, _ := kubernetes.NewForConfig(c)
+// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
+//
+// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
+// correctly.
+var AddToScheme = localSchemeBuilder.AddToScheme
+
+func init() {
+ v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"})
+ utilruntime.Must(AddToScheme(scheme))
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeAdmissionregistrationV1alpha1 struct {
+ *testing.Fake
+}
+
+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
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1alpha1 "k8s.io/api/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"}
+
+// Get takes name of the initializerConfiguration, and returns the corresponding initializerConfiguration object, and an error if there is any.
+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
+}
+
+// List takes label and field selectors, and returns the list of InitializerConfigurations that match those selectors.
+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{ListMeta: obj.(*v1alpha1.InitializerConfigurationList).ListMeta}
+ 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))
+}
+
+// Create takes the representation of a initializerConfiguration and creates it. Returns the server's representation of the initializerConfiguration, and an error, if there is any.
+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
+}
+
+// Update takes the representation of a initializerConfiguration and updates it. Returns the server's representation of the initializerConfiguration, and an error, if there is any.
+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
+}
+
+// Delete takes name of the initializerConfiguration and deletes it. Returns an error if one occurs.
+func (c *FakeInitializerConfigurations) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(initializerconfigurationsResource, name), &v1alpha1.InitializerConfiguration{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+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
+}
+
+// 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, pt, data, subresources...), &v1alpha1.InitializerConfiguration{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.InitializerConfiguration), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeAdmissionregistrationV1beta1 struct {
+ *testing.Fake
+}
+
+func (c *FakeAdmissionregistrationV1beta1) MutatingWebhookConfigurations() v1beta1.MutatingWebhookConfigurationInterface {
+ return &FakeMutatingWebhookConfigurations{c}
+}
+
+func (c *FakeAdmissionregistrationV1beta1) ValidatingWebhookConfigurations() v1beta1.ValidatingWebhookConfigurationInterface {
+ return &FakeValidatingWebhookConfigurations{c}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeAdmissionregistrationV1beta1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/admissionregistration/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"
+)
+
+// FakeMutatingWebhookConfigurations implements MutatingWebhookConfigurationInterface
+type FakeMutatingWebhookConfigurations struct {
+ Fake *FakeAdmissionregistrationV1beta1
+}
+
+var mutatingwebhookconfigurationsResource = schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1beta1", Resource: "mutatingwebhookconfigurations"}
+
+var mutatingwebhookconfigurationsKind = schema.GroupVersionKind{Group: "admissionregistration.k8s.io", Version: "v1beta1", Kind: "MutatingWebhookConfiguration"}
+
+// Get takes name of the mutatingWebhookConfiguration, and returns the corresponding mutatingWebhookConfiguration object, and an error if there is any.
+func (c *FakeMutatingWebhookConfigurations) Get(name string, options v1.GetOptions) (result *v1beta1.MutatingWebhookConfiguration, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(mutatingwebhookconfigurationsResource, name), &v1beta1.MutatingWebhookConfiguration{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.MutatingWebhookConfiguration), err
+}
+
+// List takes label and field selectors, and returns the list of MutatingWebhookConfigurations that match those selectors.
+func (c *FakeMutatingWebhookConfigurations) List(opts v1.ListOptions) (result *v1beta1.MutatingWebhookConfigurationList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(mutatingwebhookconfigurationsResource, mutatingwebhookconfigurationsKind, opts), &v1beta1.MutatingWebhookConfigurationList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta1.MutatingWebhookConfigurationList{ListMeta: obj.(*v1beta1.MutatingWebhookConfigurationList).ListMeta}
+ for _, item := range obj.(*v1beta1.MutatingWebhookConfigurationList).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 mutatingWebhookConfigurations.
+func (c *FakeMutatingWebhookConfigurations) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(mutatingwebhookconfigurationsResource, opts))
+}
+
+// Create takes the representation of a mutatingWebhookConfiguration and creates it. Returns the server's representation of the mutatingWebhookConfiguration, and an error, if there is any.
+func (c *FakeMutatingWebhookConfigurations) Create(mutatingWebhookConfiguration *v1beta1.MutatingWebhookConfiguration) (result *v1beta1.MutatingWebhookConfiguration, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(mutatingwebhookconfigurationsResource, mutatingWebhookConfiguration), &v1beta1.MutatingWebhookConfiguration{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.MutatingWebhookConfiguration), err
+}
+
+// Update takes the representation of a mutatingWebhookConfiguration and updates it. Returns the server's representation of the mutatingWebhookConfiguration, and an error, if there is any.
+func (c *FakeMutatingWebhookConfigurations) Update(mutatingWebhookConfiguration *v1beta1.MutatingWebhookConfiguration) (result *v1beta1.MutatingWebhookConfiguration, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(mutatingwebhookconfigurationsResource, mutatingWebhookConfiguration), &v1beta1.MutatingWebhookConfiguration{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.MutatingWebhookConfiguration), err
+}
+
+// Delete takes name of the mutatingWebhookConfiguration and deletes it. Returns an error if one occurs.
+func (c *FakeMutatingWebhookConfigurations) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(mutatingwebhookconfigurationsResource, name), &v1beta1.MutatingWebhookConfiguration{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeMutatingWebhookConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(mutatingwebhookconfigurationsResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta1.MutatingWebhookConfigurationList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched mutatingWebhookConfiguration.
+func (c *FakeMutatingWebhookConfigurations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.MutatingWebhookConfiguration, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(mutatingwebhookconfigurationsResource, name, pt, data, subresources...), &v1beta1.MutatingWebhookConfiguration{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.MutatingWebhookConfiguration), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/admissionregistration/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"
+)
+
+// FakeValidatingWebhookConfigurations implements ValidatingWebhookConfigurationInterface
+type FakeValidatingWebhookConfigurations struct {
+ Fake *FakeAdmissionregistrationV1beta1
+}
+
+var validatingwebhookconfigurationsResource = schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1beta1", Resource: "validatingwebhookconfigurations"}
+
+var validatingwebhookconfigurationsKind = schema.GroupVersionKind{Group: "admissionregistration.k8s.io", Version: "v1beta1", Kind: "ValidatingWebhookConfiguration"}
+
+// Get takes name of the validatingWebhookConfiguration, and returns the corresponding validatingWebhookConfiguration object, and an error if there is any.
+func (c *FakeValidatingWebhookConfigurations) Get(name string, options v1.GetOptions) (result *v1beta1.ValidatingWebhookConfiguration, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(validatingwebhookconfigurationsResource, name), &v1beta1.ValidatingWebhookConfiguration{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.ValidatingWebhookConfiguration), err
+}
+
+// List takes label and field selectors, and returns the list of ValidatingWebhookConfigurations that match those selectors.
+func (c *FakeValidatingWebhookConfigurations) List(opts v1.ListOptions) (result *v1beta1.ValidatingWebhookConfigurationList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(validatingwebhookconfigurationsResource, validatingwebhookconfigurationsKind, opts), &v1beta1.ValidatingWebhookConfigurationList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta1.ValidatingWebhookConfigurationList{ListMeta: obj.(*v1beta1.ValidatingWebhookConfigurationList).ListMeta}
+ for _, item := range obj.(*v1beta1.ValidatingWebhookConfigurationList).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 validatingWebhookConfigurations.
+func (c *FakeValidatingWebhookConfigurations) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(validatingwebhookconfigurationsResource, opts))
+}
+
+// Create takes the representation of a validatingWebhookConfiguration and creates it. Returns the server's representation of the validatingWebhookConfiguration, and an error, if there is any.
+func (c *FakeValidatingWebhookConfigurations) Create(validatingWebhookConfiguration *v1beta1.ValidatingWebhookConfiguration) (result *v1beta1.ValidatingWebhookConfiguration, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(validatingwebhookconfigurationsResource, validatingWebhookConfiguration), &v1beta1.ValidatingWebhookConfiguration{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.ValidatingWebhookConfiguration), err
+}
+
+// Update takes the representation of a validatingWebhookConfiguration and updates it. Returns the server's representation of the validatingWebhookConfiguration, and an error, if there is any.
+func (c *FakeValidatingWebhookConfigurations) Update(validatingWebhookConfiguration *v1beta1.ValidatingWebhookConfiguration) (result *v1beta1.ValidatingWebhookConfiguration, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(validatingwebhookconfigurationsResource, validatingWebhookConfiguration), &v1beta1.ValidatingWebhookConfiguration{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.ValidatingWebhookConfiguration), err
+}
+
+// Delete takes name of the validatingWebhookConfiguration and deletes it. Returns an error if one occurs.
+func (c *FakeValidatingWebhookConfigurations) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(validatingwebhookconfigurationsResource, name), &v1beta1.ValidatingWebhookConfiguration{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeValidatingWebhookConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(validatingwebhookconfigurationsResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta1.ValidatingWebhookConfigurationList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched validatingWebhookConfiguration.
+func (c *FakeValidatingWebhookConfigurations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.ValidatingWebhookConfiguration, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(validatingwebhookconfigurationsResource, name, pt, data, subresources...), &v1beta1.ValidatingWebhookConfiguration{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.ValidatingWebhookConfiguration), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1 "k8s.io/client-go/kubernetes/typed/apps/v1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeAppsV1 struct {
+ *testing.Fake
+}
+
+func (c *FakeAppsV1) ControllerRevisions(namespace string) v1.ControllerRevisionInterface {
+ return &FakeControllerRevisions{c, namespace}
+}
+
+func (c *FakeAppsV1) DaemonSets(namespace string) v1.DaemonSetInterface {
+ return &FakeDaemonSets{c, namespace}
+}
+
+func (c *FakeAppsV1) Deployments(namespace string) v1.DeploymentInterface {
+ return &FakeDeployments{c, namespace}
+}
+
+func (c *FakeAppsV1) ReplicaSets(namespace string) v1.ReplicaSetInterface {
+ return &FakeReplicaSets{c, namespace}
+}
+
+func (c *FakeAppsV1) StatefulSets(namespace string) v1.StatefulSetInterface {
+ return &FakeStatefulSets{c, namespace}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeAppsV1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ appsv1 "k8s.io/api/apps/v1"
+ 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 *FakeAppsV1
+ ns string
+}
+
+var controllerrevisionsResource = schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "controllerrevisions"}
+
+var controllerrevisionsKind = schema.GroupVersionKind{Group: "apps", Version: "v1", Kind: "ControllerRevision"}
+
+// Get takes name of the controllerRevision, and returns the corresponding controllerRevision object, and an error if there is any.
+func (c *FakeControllerRevisions) Get(name string, options v1.GetOptions) (result *appsv1.ControllerRevision, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(controllerrevisionsResource, c.ns, name), &appsv1.ControllerRevision{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.ControllerRevision), err
+}
+
+// List takes label and field selectors, and returns the list of ControllerRevisions that match those selectors.
+func (c *FakeControllerRevisions) List(opts v1.ListOptions) (result *appsv1.ControllerRevisionList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(controllerrevisionsResource, controllerrevisionsKind, c.ns, opts), &appsv1.ControllerRevisionList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &appsv1.ControllerRevisionList{ListMeta: obj.(*appsv1.ControllerRevisionList).ListMeta}
+ for _, item := range obj.(*appsv1.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))
+
+}
+
+// Create takes the representation of a controllerRevision and creates it. Returns the server's representation of the controllerRevision, and an error, if there is any.
+func (c *FakeControllerRevisions) Create(controllerRevision *appsv1.ControllerRevision) (result *appsv1.ControllerRevision, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(controllerrevisionsResource, c.ns, controllerRevision), &appsv1.ControllerRevision{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.ControllerRevision), err
+}
+
+// Update takes the representation of a controllerRevision and updates it. Returns the server's representation of the controllerRevision, and an error, if there is any.
+func (c *FakeControllerRevisions) Update(controllerRevision *appsv1.ControllerRevision) (result *appsv1.ControllerRevision, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(controllerrevisionsResource, c.ns, controllerRevision), &appsv1.ControllerRevision{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.ControllerRevision), err
+}
+
+// Delete takes name of the controllerRevision and deletes it. Returns an error if one occurs.
+func (c *FakeControllerRevisions) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(controllerrevisionsResource, c.ns, name), &appsv1.ControllerRevision{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeControllerRevisions) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(controllerrevisionsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &appsv1.ControllerRevisionList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched controllerRevision.
+func (c *FakeControllerRevisions) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *appsv1.ControllerRevision, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(controllerrevisionsResource, c.ns, name, pt, data, subresources...), &appsv1.ControllerRevision{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.ControllerRevision), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ appsv1 "k8s.io/api/apps/v1"
+ 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"
+)
+
+// FakeDaemonSets implements DaemonSetInterface
+type FakeDaemonSets struct {
+ Fake *FakeAppsV1
+ ns string
+}
+
+var daemonsetsResource = schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "daemonsets"}
+
+var daemonsetsKind = schema.GroupVersionKind{Group: "apps", Version: "v1", Kind: "DaemonSet"}
+
+// Get takes name of the daemonSet, and returns the corresponding daemonSet object, and an error if there is any.
+func (c *FakeDaemonSets) Get(name string, options v1.GetOptions) (result *appsv1.DaemonSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(daemonsetsResource, c.ns, name), &appsv1.DaemonSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.DaemonSet), err
+}
+
+// List takes label and field selectors, and returns the list of DaemonSets that match those selectors.
+func (c *FakeDaemonSets) List(opts v1.ListOptions) (result *appsv1.DaemonSetList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(daemonsetsResource, daemonsetsKind, c.ns, opts), &appsv1.DaemonSetList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &appsv1.DaemonSetList{ListMeta: obj.(*appsv1.DaemonSetList).ListMeta}
+ for _, item := range obj.(*appsv1.DaemonSetList).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 daemonSets.
+func (c *FakeDaemonSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(daemonsetsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a daemonSet and creates it. Returns the server's representation of the daemonSet, and an error, if there is any.
+func (c *FakeDaemonSets) Create(daemonSet *appsv1.DaemonSet) (result *appsv1.DaemonSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(daemonsetsResource, c.ns, daemonSet), &appsv1.DaemonSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.DaemonSet), err
+}
+
+// Update takes the representation of a daemonSet and updates it. Returns the server's representation of the daemonSet, and an error, if there is any.
+func (c *FakeDaemonSets) Update(daemonSet *appsv1.DaemonSet) (result *appsv1.DaemonSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(daemonsetsResource, c.ns, daemonSet), &appsv1.DaemonSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.DaemonSet), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeDaemonSets) UpdateStatus(daemonSet *appsv1.DaemonSet) (*appsv1.DaemonSet, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(daemonsetsResource, "status", c.ns, daemonSet), &appsv1.DaemonSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.DaemonSet), err
+}
+
+// Delete takes name of the daemonSet and deletes it. Returns an error if one occurs.
+func (c *FakeDaemonSets) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(daemonsetsResource, c.ns, name), &appsv1.DaemonSet{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeDaemonSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(daemonsetsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &appsv1.DaemonSetList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched daemonSet.
+func (c *FakeDaemonSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *appsv1.DaemonSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(daemonsetsResource, c.ns, name, pt, data, subresources...), &appsv1.DaemonSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.DaemonSet), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ appsv1 "k8s.io/api/apps/v1"
+ autoscalingv1 "k8s.io/api/autoscaling/v1"
+ 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 *FakeAppsV1
+ ns string
+}
+
+var deploymentsResource = schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "deployments"}
+
+var deploymentsKind = schema.GroupVersionKind{Group: "apps", Version: "v1", Kind: "Deployment"}
+
+// Get takes name of the deployment, and returns the corresponding deployment object, and an error if there is any.
+func (c *FakeDeployments) Get(name string, options v1.GetOptions) (result *appsv1.Deployment, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(deploymentsResource, c.ns, name), &appsv1.Deployment{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.Deployment), err
+}
+
+// List takes label and field selectors, and returns the list of Deployments that match those selectors.
+func (c *FakeDeployments) List(opts v1.ListOptions) (result *appsv1.DeploymentList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(deploymentsResource, deploymentsKind, c.ns, opts), &appsv1.DeploymentList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &appsv1.DeploymentList{ListMeta: obj.(*appsv1.DeploymentList).ListMeta}
+ for _, item := range obj.(*appsv1.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))
+
+}
+
+// Create takes the representation of a deployment and creates it. Returns the server's representation of the deployment, and an error, if there is any.
+func (c *FakeDeployments) Create(deployment *appsv1.Deployment) (result *appsv1.Deployment, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(deploymentsResource, c.ns, deployment), &appsv1.Deployment{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.Deployment), err
+}
+
+// Update takes the representation of a deployment and updates it. Returns the server's representation of the deployment, and an error, if there is any.
+func (c *FakeDeployments) Update(deployment *appsv1.Deployment) (result *appsv1.Deployment, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(deploymentsResource, c.ns, deployment), &appsv1.Deployment{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.Deployment), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeDeployments) UpdateStatus(deployment *appsv1.Deployment) (*appsv1.Deployment, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(deploymentsResource, "status", c.ns, deployment), &appsv1.Deployment{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.Deployment), err
+}
+
+// Delete takes name of the deployment and deletes it. Returns an error if one occurs.
+func (c *FakeDeployments) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(deploymentsResource, c.ns, name), &appsv1.Deployment{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(deploymentsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &appsv1.DeploymentList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched deployment.
+func (c *FakeDeployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *appsv1.Deployment, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(deploymentsResource, c.ns, name, pt, data, subresources...), &appsv1.Deployment{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.Deployment), err
+}
+
+// GetScale takes name of the deployment, and returns the corresponding scale object, and an error if there is any.
+func (c *FakeDeployments) GetScale(deploymentName string, options v1.GetOptions) (result *autoscalingv1.Scale, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetSubresourceAction(deploymentsResource, c.ns, "scale", deploymentName), &autoscalingv1.Scale{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*autoscalingv1.Scale), err
+}
+
+// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
+func (c *FakeDeployments) UpdateScale(deploymentName string, scale *autoscalingv1.Scale) (result *autoscalingv1.Scale, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(deploymentsResource, "scale", c.ns, scale), &autoscalingv1.Scale{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*autoscalingv1.Scale), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ appsv1 "k8s.io/api/apps/v1"
+ autoscalingv1 "k8s.io/api/autoscaling/v1"
+ 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"
+)
+
+// FakeReplicaSets implements ReplicaSetInterface
+type FakeReplicaSets struct {
+ Fake *FakeAppsV1
+ ns string
+}
+
+var replicasetsResource = schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "replicasets"}
+
+var replicasetsKind = schema.GroupVersionKind{Group: "apps", Version: "v1", Kind: "ReplicaSet"}
+
+// Get takes name of the replicaSet, and returns the corresponding replicaSet object, and an error if there is any.
+func (c *FakeReplicaSets) Get(name string, options v1.GetOptions) (result *appsv1.ReplicaSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(replicasetsResource, c.ns, name), &appsv1.ReplicaSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.ReplicaSet), err
+}
+
+// List takes label and field selectors, and returns the list of ReplicaSets that match those selectors.
+func (c *FakeReplicaSets) List(opts v1.ListOptions) (result *appsv1.ReplicaSetList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(replicasetsResource, replicasetsKind, c.ns, opts), &appsv1.ReplicaSetList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &appsv1.ReplicaSetList{ListMeta: obj.(*appsv1.ReplicaSetList).ListMeta}
+ for _, item := range obj.(*appsv1.ReplicaSetList).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 replicaSets.
+func (c *FakeReplicaSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(replicasetsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a replicaSet and creates it. Returns the server's representation of the replicaSet, and an error, if there is any.
+func (c *FakeReplicaSets) Create(replicaSet *appsv1.ReplicaSet) (result *appsv1.ReplicaSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(replicasetsResource, c.ns, replicaSet), &appsv1.ReplicaSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.ReplicaSet), err
+}
+
+// Update takes the representation of a replicaSet and updates it. Returns the server's representation of the replicaSet, and an error, if there is any.
+func (c *FakeReplicaSets) Update(replicaSet *appsv1.ReplicaSet) (result *appsv1.ReplicaSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(replicasetsResource, c.ns, replicaSet), &appsv1.ReplicaSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.ReplicaSet), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeReplicaSets) UpdateStatus(replicaSet *appsv1.ReplicaSet) (*appsv1.ReplicaSet, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(replicasetsResource, "status", c.ns, replicaSet), &appsv1.ReplicaSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.ReplicaSet), err
+}
+
+// Delete takes name of the replicaSet and deletes it. Returns an error if one occurs.
+func (c *FakeReplicaSets) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(replicasetsResource, c.ns, name), &appsv1.ReplicaSet{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeReplicaSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(replicasetsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &appsv1.ReplicaSetList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched replicaSet.
+func (c *FakeReplicaSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *appsv1.ReplicaSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(replicasetsResource, c.ns, name, pt, data, subresources...), &appsv1.ReplicaSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.ReplicaSet), err
+}
+
+// GetScale takes name of the replicaSet, and returns the corresponding scale object, and an error if there is any.
+func (c *FakeReplicaSets) GetScale(replicaSetName string, options v1.GetOptions) (result *autoscalingv1.Scale, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetSubresourceAction(replicasetsResource, c.ns, "scale", replicaSetName), &autoscalingv1.Scale{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*autoscalingv1.Scale), err
+}
+
+// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
+func (c *FakeReplicaSets) UpdateScale(replicaSetName string, scale *autoscalingv1.Scale) (result *autoscalingv1.Scale, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(replicasetsResource, "scale", c.ns, scale), &autoscalingv1.Scale{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*autoscalingv1.Scale), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ appsv1 "k8s.io/api/apps/v1"
+ autoscalingv1 "k8s.io/api/autoscaling/v1"
+ 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 *FakeAppsV1
+ ns string
+}
+
+var statefulsetsResource = schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "statefulsets"}
+
+var statefulsetsKind = schema.GroupVersionKind{Group: "apps", Version: "v1", Kind: "StatefulSet"}
+
+// Get takes name of the statefulSet, and returns the corresponding statefulSet object, and an error if there is any.
+func (c *FakeStatefulSets) Get(name string, options v1.GetOptions) (result *appsv1.StatefulSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(statefulsetsResource, c.ns, name), &appsv1.StatefulSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.StatefulSet), err
+}
+
+// List takes label and field selectors, and returns the list of StatefulSets that match those selectors.
+func (c *FakeStatefulSets) List(opts v1.ListOptions) (result *appsv1.StatefulSetList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(statefulsetsResource, statefulsetsKind, c.ns, opts), &appsv1.StatefulSetList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &appsv1.StatefulSetList{ListMeta: obj.(*appsv1.StatefulSetList).ListMeta}
+ for _, item := range obj.(*appsv1.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))
+
+}
+
+// Create takes the representation of a statefulSet and creates it. Returns the server's representation of the statefulSet, and an error, if there is any.
+func (c *FakeStatefulSets) Create(statefulSet *appsv1.StatefulSet) (result *appsv1.StatefulSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(statefulsetsResource, c.ns, statefulSet), &appsv1.StatefulSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.StatefulSet), err
+}
+
+// Update takes the representation of a statefulSet and updates it. Returns the server's representation of the statefulSet, and an error, if there is any.
+func (c *FakeStatefulSets) Update(statefulSet *appsv1.StatefulSet) (result *appsv1.StatefulSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(statefulsetsResource, c.ns, statefulSet), &appsv1.StatefulSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.StatefulSet), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeStatefulSets) UpdateStatus(statefulSet *appsv1.StatefulSet) (*appsv1.StatefulSet, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(statefulsetsResource, "status", c.ns, statefulSet), &appsv1.StatefulSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.StatefulSet), err
+}
+
+// Delete takes name of the statefulSet and deletes it. Returns an error if one occurs.
+func (c *FakeStatefulSets) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(statefulsetsResource, c.ns, name), &appsv1.StatefulSet{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeStatefulSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(statefulsetsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &appsv1.StatefulSetList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched statefulSet.
+func (c *FakeStatefulSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *appsv1.StatefulSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(statefulsetsResource, c.ns, name, pt, data, subresources...), &appsv1.StatefulSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*appsv1.StatefulSet), err
+}
+
+// GetScale takes name of the statefulSet, and returns the corresponding scale object, and an error if there is any.
+func (c *FakeStatefulSets) GetScale(statefulSetName string, options v1.GetOptions) (result *autoscalingv1.Scale, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetSubresourceAction(statefulsetsResource, c.ns, "scale", statefulSetName), &autoscalingv1.Scale{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*autoscalingv1.Scale), err
+}
+
+// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
+func (c *FakeStatefulSets) UpdateScale(statefulSetName string, scale *autoscalingv1.Scale) (result *autoscalingv1.Scale, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(statefulsetsResource, "scale", c.ns, scale), &autoscalingv1.Scale{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*autoscalingv1.Scale), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/client-go/kubernetes/typed/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) 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
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/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"}
+
+// Get takes name of the controllerRevision, and returns the corresponding controllerRevision object, and an error if there is any.
+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
+}
+
+// List takes label and field selectors, and returns the list of ControllerRevisions that match those selectors.
+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{ListMeta: obj.(*v1beta1.ControllerRevisionList).ListMeta}
+ 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))
+
+}
+
+// Create takes the representation of a controllerRevision and creates it. Returns the server's representation of the controllerRevision, and an error, if there is any.
+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
+}
+
+// Update takes the representation of a controllerRevision and updates it. Returns the server's representation of the controllerRevision, and an error, if there is any.
+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
+}
+
+// Delete takes name of the controllerRevision and deletes it. Returns an error if one occurs.
+func (c *FakeControllerRevisions) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(controllerrevisionsResource, c.ns, name), &v1beta1.ControllerRevision{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+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
+}
+
+// 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, pt, data, subresources...), &v1beta1.ControllerRevision{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.ControllerRevision), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/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"}
+
+// Get takes name of the deployment, and returns the corresponding deployment object, and an error if there is any.
+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
+}
+
+// List takes label and field selectors, and returns the list of Deployments that match those selectors.
+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{ListMeta: obj.(*v1beta1.DeploymentList).ListMeta}
+ 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))
+
+}
+
+// Create takes the representation of a deployment and creates it. Returns the server's representation of the deployment, and an error, if there is any.
+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
+}
+
+// Update takes the representation of a deployment and updates it. Returns the server's representation of the deployment, and an error, if there is any.
+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
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+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
+}
+
+// Delete takes name of the deployment and deletes it. Returns an error if one occurs.
+func (c *FakeDeployments) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(deploymentsResource, c.ns, name), &v1beta1.Deployment{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+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
+}
+
+// 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, pt, data, subresources...), &v1beta1.Deployment{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Deployment), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/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"}
+
+// Get takes name of the statefulSet, and returns the corresponding statefulSet object, and an error if there is any.
+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
+}
+
+// List takes label and field selectors, and returns the list of StatefulSets that match those selectors.
+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{ListMeta: obj.(*v1beta1.StatefulSetList).ListMeta}
+ 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))
+
+}
+
+// Create takes the representation of a statefulSet and creates it. Returns the server's representation of the statefulSet, and an error, if there is any.
+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
+}
+
+// Update takes the representation of a statefulSet and updates it. Returns the server's representation of the statefulSet, and an error, if there is any.
+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
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+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
+}
+
+// Delete takes name of the statefulSet and deletes it. Returns an error if one occurs.
+func (c *FakeStatefulSets) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(statefulsetsResource, c.ns, name), &v1beta1.StatefulSet{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+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
+}
+
+// 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, pt, data, subresources...), &v1beta1.StatefulSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.StatefulSet), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeAppsV1beta2 struct {
+ *testing.Fake
+}
+
+func (c *FakeAppsV1beta2) ControllerRevisions(namespace string) v1beta2.ControllerRevisionInterface {
+ return &FakeControllerRevisions{c, namespace}
+}
+
+func (c *FakeAppsV1beta2) DaemonSets(namespace string) v1beta2.DaemonSetInterface {
+ return &FakeDaemonSets{c, namespace}
+}
+
+func (c *FakeAppsV1beta2) Deployments(namespace string) v1beta2.DeploymentInterface {
+ return &FakeDeployments{c, namespace}
+}
+
+func (c *FakeAppsV1beta2) ReplicaSets(namespace string) v1beta2.ReplicaSetInterface {
+ return &FakeReplicaSets{c, namespace}
+}
+
+func (c *FakeAppsV1beta2) StatefulSets(namespace string) v1beta2.StatefulSetInterface {
+ return &FakeStatefulSets{c, namespace}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeAppsV1beta2) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta2 "k8s.io/api/apps/v1beta2"
+ 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 *FakeAppsV1beta2
+ ns string
+}
+
+var controllerrevisionsResource = schema.GroupVersionResource{Group: "apps", Version: "v1beta2", Resource: "controllerrevisions"}
+
+var controllerrevisionsKind = schema.GroupVersionKind{Group: "apps", Version: "v1beta2", Kind: "ControllerRevision"}
+
+// Get takes name of the controllerRevision, and returns the corresponding controllerRevision object, and an error if there is any.
+func (c *FakeControllerRevisions) Get(name string, options v1.GetOptions) (result *v1beta2.ControllerRevision, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(controllerrevisionsResource, c.ns, name), &v1beta2.ControllerRevision{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.ControllerRevision), err
+}
+
+// List takes label and field selectors, and returns the list of ControllerRevisions that match those selectors.
+func (c *FakeControllerRevisions) List(opts v1.ListOptions) (result *v1beta2.ControllerRevisionList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(controllerrevisionsResource, controllerrevisionsKind, c.ns, opts), &v1beta2.ControllerRevisionList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta2.ControllerRevisionList{ListMeta: obj.(*v1beta2.ControllerRevisionList).ListMeta}
+ for _, item := range obj.(*v1beta2.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))
+
+}
+
+// Create takes the representation of a controllerRevision and creates it. Returns the server's representation of the controllerRevision, and an error, if there is any.
+func (c *FakeControllerRevisions) Create(controllerRevision *v1beta2.ControllerRevision) (result *v1beta2.ControllerRevision, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(controllerrevisionsResource, c.ns, controllerRevision), &v1beta2.ControllerRevision{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.ControllerRevision), err
+}
+
+// Update takes the representation of a controllerRevision and updates it. Returns the server's representation of the controllerRevision, and an error, if there is any.
+func (c *FakeControllerRevisions) Update(controllerRevision *v1beta2.ControllerRevision) (result *v1beta2.ControllerRevision, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(controllerrevisionsResource, c.ns, controllerRevision), &v1beta2.ControllerRevision{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.ControllerRevision), err
+}
+
+// Delete takes name of the controllerRevision and deletes it. Returns an error if one occurs.
+func (c *FakeControllerRevisions) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(controllerrevisionsResource, c.ns, name), &v1beta2.ControllerRevision{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeControllerRevisions) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(controllerrevisionsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta2.ControllerRevisionList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched controllerRevision.
+func (c *FakeControllerRevisions) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta2.ControllerRevision, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(controllerrevisionsResource, c.ns, name, pt, data, subresources...), &v1beta2.ControllerRevision{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.ControllerRevision), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta2 "k8s.io/api/apps/v1beta2"
+ 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"
+)
+
+// FakeDaemonSets implements DaemonSetInterface
+type FakeDaemonSets struct {
+ Fake *FakeAppsV1beta2
+ ns string
+}
+
+var daemonsetsResource = schema.GroupVersionResource{Group: "apps", Version: "v1beta2", Resource: "daemonsets"}
+
+var daemonsetsKind = schema.GroupVersionKind{Group: "apps", Version: "v1beta2", Kind: "DaemonSet"}
+
+// Get takes name of the daemonSet, and returns the corresponding daemonSet object, and an error if there is any.
+func (c *FakeDaemonSets) Get(name string, options v1.GetOptions) (result *v1beta2.DaemonSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(daemonsetsResource, c.ns, name), &v1beta2.DaemonSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.DaemonSet), err
+}
+
+// List takes label and field selectors, and returns the list of DaemonSets that match those selectors.
+func (c *FakeDaemonSets) List(opts v1.ListOptions) (result *v1beta2.DaemonSetList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(daemonsetsResource, daemonsetsKind, c.ns, opts), &v1beta2.DaemonSetList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta2.DaemonSetList{ListMeta: obj.(*v1beta2.DaemonSetList).ListMeta}
+ for _, item := range obj.(*v1beta2.DaemonSetList).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 daemonSets.
+func (c *FakeDaemonSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(daemonsetsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a daemonSet and creates it. Returns the server's representation of the daemonSet, and an error, if there is any.
+func (c *FakeDaemonSets) Create(daemonSet *v1beta2.DaemonSet) (result *v1beta2.DaemonSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(daemonsetsResource, c.ns, daemonSet), &v1beta2.DaemonSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.DaemonSet), err
+}
+
+// Update takes the representation of a daemonSet and updates it. Returns the server's representation of the daemonSet, and an error, if there is any.
+func (c *FakeDaemonSets) Update(daemonSet *v1beta2.DaemonSet) (result *v1beta2.DaemonSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(daemonsetsResource, c.ns, daemonSet), &v1beta2.DaemonSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.DaemonSet), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeDaemonSets) UpdateStatus(daemonSet *v1beta2.DaemonSet) (*v1beta2.DaemonSet, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(daemonsetsResource, "status", c.ns, daemonSet), &v1beta2.DaemonSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.DaemonSet), err
+}
+
+// Delete takes name of the daemonSet and deletes it. Returns an error if one occurs.
+func (c *FakeDaemonSets) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(daemonsetsResource, c.ns, name), &v1beta2.DaemonSet{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeDaemonSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(daemonsetsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta2.DaemonSetList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched daemonSet.
+func (c *FakeDaemonSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta2.DaemonSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(daemonsetsResource, c.ns, name, pt, data, subresources...), &v1beta2.DaemonSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.DaemonSet), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta2 "k8s.io/api/apps/v1beta2"
+ 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 *FakeAppsV1beta2
+ ns string
+}
+
+var deploymentsResource = schema.GroupVersionResource{Group: "apps", Version: "v1beta2", Resource: "deployments"}
+
+var deploymentsKind = schema.GroupVersionKind{Group: "apps", Version: "v1beta2", Kind: "Deployment"}
+
+// Get takes name of the deployment, and returns the corresponding deployment object, and an error if there is any.
+func (c *FakeDeployments) Get(name string, options v1.GetOptions) (result *v1beta2.Deployment, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(deploymentsResource, c.ns, name), &v1beta2.Deployment{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.Deployment), err
+}
+
+// List takes label and field selectors, and returns the list of Deployments that match those selectors.
+func (c *FakeDeployments) List(opts v1.ListOptions) (result *v1beta2.DeploymentList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(deploymentsResource, deploymentsKind, c.ns, opts), &v1beta2.DeploymentList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta2.DeploymentList{ListMeta: obj.(*v1beta2.DeploymentList).ListMeta}
+ for _, item := range obj.(*v1beta2.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))
+
+}
+
+// Create takes the representation of a deployment and creates it. Returns the server's representation of the deployment, and an error, if there is any.
+func (c *FakeDeployments) Create(deployment *v1beta2.Deployment) (result *v1beta2.Deployment, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(deploymentsResource, c.ns, deployment), &v1beta2.Deployment{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.Deployment), err
+}
+
+// Update takes the representation of a deployment and updates it. Returns the server's representation of the deployment, and an error, if there is any.
+func (c *FakeDeployments) Update(deployment *v1beta2.Deployment) (result *v1beta2.Deployment, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(deploymentsResource, c.ns, deployment), &v1beta2.Deployment{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.Deployment), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeDeployments) UpdateStatus(deployment *v1beta2.Deployment) (*v1beta2.Deployment, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(deploymentsResource, "status", c.ns, deployment), &v1beta2.Deployment{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.Deployment), err
+}
+
+// Delete takes name of the deployment and deletes it. Returns an error if one occurs.
+func (c *FakeDeployments) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(deploymentsResource, c.ns, name), &v1beta2.Deployment{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(deploymentsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta2.DeploymentList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched deployment.
+func (c *FakeDeployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta2.Deployment, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(deploymentsResource, c.ns, name, pt, data, subresources...), &v1beta2.Deployment{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.Deployment), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta2 "k8s.io/api/apps/v1beta2"
+ 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"
+)
+
+// FakeReplicaSets implements ReplicaSetInterface
+type FakeReplicaSets struct {
+ Fake *FakeAppsV1beta2
+ ns string
+}
+
+var replicasetsResource = schema.GroupVersionResource{Group: "apps", Version: "v1beta2", Resource: "replicasets"}
+
+var replicasetsKind = schema.GroupVersionKind{Group: "apps", Version: "v1beta2", Kind: "ReplicaSet"}
+
+// Get takes name of the replicaSet, and returns the corresponding replicaSet object, and an error if there is any.
+func (c *FakeReplicaSets) Get(name string, options v1.GetOptions) (result *v1beta2.ReplicaSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(replicasetsResource, c.ns, name), &v1beta2.ReplicaSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.ReplicaSet), err
+}
+
+// List takes label and field selectors, and returns the list of ReplicaSets that match those selectors.
+func (c *FakeReplicaSets) List(opts v1.ListOptions) (result *v1beta2.ReplicaSetList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(replicasetsResource, replicasetsKind, c.ns, opts), &v1beta2.ReplicaSetList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta2.ReplicaSetList{ListMeta: obj.(*v1beta2.ReplicaSetList).ListMeta}
+ for _, item := range obj.(*v1beta2.ReplicaSetList).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 replicaSets.
+func (c *FakeReplicaSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(replicasetsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a replicaSet and creates it. Returns the server's representation of the replicaSet, and an error, if there is any.
+func (c *FakeReplicaSets) Create(replicaSet *v1beta2.ReplicaSet) (result *v1beta2.ReplicaSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(replicasetsResource, c.ns, replicaSet), &v1beta2.ReplicaSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.ReplicaSet), err
+}
+
+// Update takes the representation of a replicaSet and updates it. Returns the server's representation of the replicaSet, and an error, if there is any.
+func (c *FakeReplicaSets) Update(replicaSet *v1beta2.ReplicaSet) (result *v1beta2.ReplicaSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(replicasetsResource, c.ns, replicaSet), &v1beta2.ReplicaSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.ReplicaSet), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeReplicaSets) UpdateStatus(replicaSet *v1beta2.ReplicaSet) (*v1beta2.ReplicaSet, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(replicasetsResource, "status", c.ns, replicaSet), &v1beta2.ReplicaSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.ReplicaSet), err
+}
+
+// Delete takes name of the replicaSet and deletes it. Returns an error if one occurs.
+func (c *FakeReplicaSets) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(replicasetsResource, c.ns, name), &v1beta2.ReplicaSet{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeReplicaSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(replicasetsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta2.ReplicaSetList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched replicaSet.
+func (c *FakeReplicaSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta2.ReplicaSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(replicasetsResource, c.ns, name, pt, data, subresources...), &v1beta2.ReplicaSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.ReplicaSet), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta2 "k8s.io/api/apps/v1beta2"
+ 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 *FakeAppsV1beta2
+ ns string
+}
+
+var statefulsetsResource = schema.GroupVersionResource{Group: "apps", Version: "v1beta2", Resource: "statefulsets"}
+
+var statefulsetsKind = schema.GroupVersionKind{Group: "apps", Version: "v1beta2", Kind: "StatefulSet"}
+
+// Get takes name of the statefulSet, and returns the corresponding statefulSet object, and an error if there is any.
+func (c *FakeStatefulSets) Get(name string, options v1.GetOptions) (result *v1beta2.StatefulSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(statefulsetsResource, c.ns, name), &v1beta2.StatefulSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.StatefulSet), err
+}
+
+// List takes label and field selectors, and returns the list of StatefulSets that match those selectors.
+func (c *FakeStatefulSets) List(opts v1.ListOptions) (result *v1beta2.StatefulSetList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(statefulsetsResource, statefulsetsKind, c.ns, opts), &v1beta2.StatefulSetList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta2.StatefulSetList{ListMeta: obj.(*v1beta2.StatefulSetList).ListMeta}
+ for _, item := range obj.(*v1beta2.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))
+
+}
+
+// Create takes the representation of a statefulSet and creates it. Returns the server's representation of the statefulSet, and an error, if there is any.
+func (c *FakeStatefulSets) Create(statefulSet *v1beta2.StatefulSet) (result *v1beta2.StatefulSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(statefulsetsResource, c.ns, statefulSet), &v1beta2.StatefulSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.StatefulSet), err
+}
+
+// Update takes the representation of a statefulSet and updates it. Returns the server's representation of the statefulSet, and an error, if there is any.
+func (c *FakeStatefulSets) Update(statefulSet *v1beta2.StatefulSet) (result *v1beta2.StatefulSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(statefulsetsResource, c.ns, statefulSet), &v1beta2.StatefulSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.StatefulSet), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeStatefulSets) UpdateStatus(statefulSet *v1beta2.StatefulSet) (*v1beta2.StatefulSet, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(statefulsetsResource, "status", c.ns, statefulSet), &v1beta2.StatefulSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.StatefulSet), err
+}
+
+// Delete takes name of the statefulSet and deletes it. Returns an error if one occurs.
+func (c *FakeStatefulSets) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(statefulsetsResource, c.ns, name), &v1beta2.StatefulSet{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeStatefulSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(statefulsetsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta2.StatefulSetList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched statefulSet.
+func (c *FakeStatefulSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta2.StatefulSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(statefulsetsResource, c.ns, name, pt, data, subresources...), &v1beta2.StatefulSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.StatefulSet), err
+}
+
+// GetScale takes name of the statefulSet, and returns the corresponding scale object, and an error if there is any.
+func (c *FakeStatefulSets) GetScale(statefulSetName string, options v1.GetOptions) (result *v1beta2.Scale, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetSubresourceAction(statefulsetsResource, c.ns, "scale", statefulSetName), &v1beta2.Scale{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.Scale), err
+}
+
+// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
+func (c *FakeStatefulSets) UpdateScale(statefulSetName string, scale *v1beta2.Scale) (result *v1beta2.Scale, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(statefulsetsResource, "scale", c.ns, scale), &v1beta2.Scale{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta2.Scale), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1alpha1 "k8s.io/client-go/kubernetes/typed/auditregistration/v1alpha1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeAuditregistrationV1alpha1 struct {
+ *testing.Fake
+}
+
+func (c *FakeAuditregistrationV1alpha1) AuditSinks() v1alpha1.AuditSinkInterface {
+ return &FakeAuditSinks{c}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeAuditregistrationV1alpha1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1alpha1 "k8s.io/api/auditregistration/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"
+)
+
+// FakeAuditSinks implements AuditSinkInterface
+type FakeAuditSinks struct {
+ Fake *FakeAuditregistrationV1alpha1
+}
+
+var auditsinksResource = schema.GroupVersionResource{Group: "auditregistration.k8s.io", Version: "v1alpha1", Resource: "auditsinks"}
+
+var auditsinksKind = schema.GroupVersionKind{Group: "auditregistration.k8s.io", Version: "v1alpha1", Kind: "AuditSink"}
+
+// Get takes name of the auditSink, and returns the corresponding auditSink object, and an error if there is any.
+func (c *FakeAuditSinks) Get(name string, options v1.GetOptions) (result *v1alpha1.AuditSink, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(auditsinksResource, name), &v1alpha1.AuditSink{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.AuditSink), err
+}
+
+// List takes label and field selectors, and returns the list of AuditSinks that match those selectors.
+func (c *FakeAuditSinks) List(opts v1.ListOptions) (result *v1alpha1.AuditSinkList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(auditsinksResource, auditsinksKind, opts), &v1alpha1.AuditSinkList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1alpha1.AuditSinkList{ListMeta: obj.(*v1alpha1.AuditSinkList).ListMeta}
+ for _, item := range obj.(*v1alpha1.AuditSinkList).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 auditSinks.
+func (c *FakeAuditSinks) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(auditsinksResource, opts))
+}
+
+// Create takes the representation of a auditSink and creates it. Returns the server's representation of the auditSink, and an error, if there is any.
+func (c *FakeAuditSinks) Create(auditSink *v1alpha1.AuditSink) (result *v1alpha1.AuditSink, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(auditsinksResource, auditSink), &v1alpha1.AuditSink{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.AuditSink), err
+}
+
+// Update takes the representation of a auditSink and updates it. Returns the server's representation of the auditSink, and an error, if there is any.
+func (c *FakeAuditSinks) Update(auditSink *v1alpha1.AuditSink) (result *v1alpha1.AuditSink, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(auditsinksResource, auditSink), &v1alpha1.AuditSink{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.AuditSink), err
+}
+
+// Delete takes name of the auditSink and deletes it. Returns an error if one occurs.
+func (c *FakeAuditSinks) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(auditsinksResource, name), &v1alpha1.AuditSink{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeAuditSinks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(auditsinksResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1alpha1.AuditSinkList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched auditSink.
+func (c *FakeAuditSinks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.AuditSink, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(auditsinksResource, name, pt, data, subresources...), &v1alpha1.AuditSink{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.AuditSink), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1 "k8s.io/client-go/kubernetes/typed/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
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+// FakeTokenReviews implements TokenReviewInterface
+type FakeTokenReviews struct {
+ Fake *FakeAuthenticationV1
+}
--- /dev/null
+/*
+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
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/client-go/kubernetes/typed/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
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+// FakeTokenReviews implements TokenReviewInterface
+type FakeTokenReviews struct {
+ Fake *FakeAuthenticationV1beta1
+}
--- /dev/null
+/*
+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
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1 "k8s.io/client-go/kubernetes/typed/authorization/v1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeAuthorizationV1 struct {
+ *testing.Fake
+}
+
+func (c *FakeAuthorizationV1) LocalSubjectAccessReviews(namespace string) v1.LocalSubjectAccessReviewInterface {
+ return &FakeLocalSubjectAccessReviews{c, namespace}
+}
+
+func (c *FakeAuthorizationV1) SelfSubjectAccessReviews() v1.SelfSubjectAccessReviewInterface {
+ return &FakeSelfSubjectAccessReviews{c}
+}
+
+func (c *FakeAuthorizationV1) SelfSubjectRulesReviews() v1.SelfSubjectRulesReviewInterface {
+ return &FakeSelfSubjectRulesReviews{c}
+}
+
+func (c *FakeAuthorizationV1) SubjectAccessReviews() v1.SubjectAccessReviewInterface {
+ return &FakeSubjectAccessReviews{c}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeAuthorizationV1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+// FakeLocalSubjectAccessReviews implements LocalSubjectAccessReviewInterface
+type FakeLocalSubjectAccessReviews struct {
+ Fake *FakeAuthorizationV1
+ ns string
+}
--- /dev/null
+/*
+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 (
+ authorizationapi "k8s.io/api/authorization/v1"
+ core "k8s.io/client-go/testing"
+)
+
+func (c *FakeLocalSubjectAccessReviews) Create(sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error) {
+ obj, err := c.Fake.Invokes(core.NewCreateAction(authorizationapi.SchemeGroupVersion.WithResource("localsubjectaccessreviews"), c.ns, sar), &authorizationapi.SubjectAccessReview{})
+ return obj.(*authorizationapi.LocalSubjectAccessReview), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+// FakeSelfSubjectAccessReviews implements SelfSubjectAccessReviewInterface
+type FakeSelfSubjectAccessReviews struct {
+ Fake *FakeAuthorizationV1
+}
--- /dev/null
+/*
+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 (
+ authorizationapi "k8s.io/api/authorization/v1"
+ core "k8s.io/client-go/testing"
+)
+
+func (c *FakeSelfSubjectAccessReviews) Create(sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) {
+ obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("selfsubjectaccessreviews"), sar), &authorizationapi.SelfSubjectAccessReview{})
+ return obj.(*authorizationapi.SelfSubjectAccessReview), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+// FakeSelfSubjectRulesReviews implements SelfSubjectRulesReviewInterface
+type FakeSelfSubjectRulesReviews struct {
+ Fake *FakeAuthorizationV1
+}
--- /dev/null
+/*
+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 (
+ authorizationapi "k8s.io/api/authorization/v1"
+ core "k8s.io/client-go/testing"
+)
+
+func (c *FakeSelfSubjectRulesReviews) Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) {
+ obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("selfsubjectrulesreviews"), srr), &authorizationapi.SelfSubjectRulesReview{})
+ return obj.(*authorizationapi.SelfSubjectRulesReview), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+// FakeSubjectAccessReviews implements SubjectAccessReviewInterface
+type FakeSubjectAccessReviews struct {
+ Fake *FakeAuthorizationV1
+}
--- /dev/null
+/*
+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 (
+ authorizationapi "k8s.io/api/authorization/v1"
+ core "k8s.io/client-go/testing"
+)
+
+func (c *FakeSubjectAccessReviews) Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) {
+ obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("subjectaccessreviews"), sar), &authorizationapi.SubjectAccessReview{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*authorizationapi.SubjectAccessReview), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/client-go/kubernetes/typed/authorization/v1beta1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeAuthorizationV1beta1 struct {
+ *testing.Fake
+}
+
+func (c *FakeAuthorizationV1beta1) LocalSubjectAccessReviews(namespace string) v1beta1.LocalSubjectAccessReviewInterface {
+ return &FakeLocalSubjectAccessReviews{c, namespace}
+}
+
+func (c *FakeAuthorizationV1beta1) SelfSubjectAccessReviews() v1beta1.SelfSubjectAccessReviewInterface {
+ return &FakeSelfSubjectAccessReviews{c}
+}
+
+func (c *FakeAuthorizationV1beta1) SelfSubjectRulesReviews() v1beta1.SelfSubjectRulesReviewInterface {
+ return &FakeSelfSubjectRulesReviews{c}
+}
+
+func (c *FakeAuthorizationV1beta1) SubjectAccessReviews() v1beta1.SubjectAccessReviewInterface {
+ return &FakeSubjectAccessReviews{c}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeAuthorizationV1beta1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+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
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+// FakeLocalSubjectAccessReviews implements LocalSubjectAccessReviewInterface
+type FakeLocalSubjectAccessReviews struct {
+ Fake *FakeAuthorizationV1beta1
+ ns string
+}
--- /dev/null
+/*
+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 (
+ authorizationapi "k8s.io/api/authorization/v1beta1"
+ core "k8s.io/client-go/testing"
+)
+
+func (c *FakeLocalSubjectAccessReviews) Create(sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error) {
+ obj, err := c.Fake.Invokes(core.NewCreateAction(authorizationapi.SchemeGroupVersion.WithResource("localsubjectaccessreviews"), c.ns, sar), &authorizationapi.SubjectAccessReview{})
+ return obj.(*authorizationapi.LocalSubjectAccessReview), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+// FakeSelfSubjectAccessReviews implements SelfSubjectAccessReviewInterface
+type FakeSelfSubjectAccessReviews struct {
+ Fake *FakeAuthorizationV1beta1
+}
--- /dev/null
+/*
+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 (
+ authorizationapi "k8s.io/api/authorization/v1beta1"
+ core "k8s.io/client-go/testing"
+)
+
+func (c *FakeSelfSubjectAccessReviews) Create(sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) {
+ obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("selfsubjectaccessreviews"), sar), &authorizationapi.SelfSubjectAccessReview{})
+ return obj.(*authorizationapi.SelfSubjectAccessReview), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+// FakeSelfSubjectRulesReviews implements SelfSubjectRulesReviewInterface
+type FakeSelfSubjectRulesReviews struct {
+ Fake *FakeAuthorizationV1beta1
+}
--- /dev/null
+/*
+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 (
+ authorizationapi "k8s.io/api/authorization/v1beta1"
+ core "k8s.io/client-go/testing"
+)
+
+func (c *FakeSelfSubjectRulesReviews) Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) {
+ obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("selfsubjectrulesreviews"), srr), &authorizationapi.SelfSubjectRulesReview{})
+ return obj.(*authorizationapi.SelfSubjectRulesReview), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+// FakeSubjectAccessReviews implements SubjectAccessReviewInterface
+type FakeSubjectAccessReviews struct {
+ Fake *FakeAuthorizationV1beta1
+}
--- /dev/null
+/*
+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 (
+ authorizationapi "k8s.io/api/authorization/v1beta1"
+ core "k8s.io/client-go/testing"
+)
+
+func (c *FakeSubjectAccessReviews) Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) {
+ obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("subjectaccessreviews"), sar), &authorizationapi.SubjectAccessReview{})
+ return obj.(*authorizationapi.SubjectAccessReview), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1 "k8s.io/client-go/kubernetes/typed/autoscaling/v1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeAutoscalingV1 struct {
+ *testing.Fake
+}
+
+func (c *FakeAutoscalingV1) HorizontalPodAutoscalers(namespace string) v1.HorizontalPodAutoscalerInterface {
+ return &FakeHorizontalPodAutoscalers{c, namespace}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeAutoscalingV1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ autoscalingv1 "k8s.io/api/autoscaling/v1"
+ 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"
+)
+
+// FakeHorizontalPodAutoscalers implements HorizontalPodAutoscalerInterface
+type FakeHorizontalPodAutoscalers struct {
+ Fake *FakeAutoscalingV1
+ ns string
+}
+
+var horizontalpodautoscalersResource = schema.GroupVersionResource{Group: "autoscaling", Version: "v1", Resource: "horizontalpodautoscalers"}
+
+var horizontalpodautoscalersKind = schema.GroupVersionKind{Group: "autoscaling", Version: "v1", Kind: "HorizontalPodAutoscaler"}
+
+// Get takes name of the horizontalPodAutoscaler, and returns the corresponding horizontalPodAutoscaler object, and an error if there is any.
+func (c *FakeHorizontalPodAutoscalers) Get(name string, options v1.GetOptions) (result *autoscalingv1.HorizontalPodAutoscaler, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(horizontalpodautoscalersResource, c.ns, name), &autoscalingv1.HorizontalPodAutoscaler{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*autoscalingv1.HorizontalPodAutoscaler), err
+}
+
+// List takes label and field selectors, and returns the list of HorizontalPodAutoscalers that match those selectors.
+func (c *FakeHorizontalPodAutoscalers) List(opts v1.ListOptions) (result *autoscalingv1.HorizontalPodAutoscalerList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(horizontalpodautoscalersResource, horizontalpodautoscalersKind, c.ns, opts), &autoscalingv1.HorizontalPodAutoscalerList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &autoscalingv1.HorizontalPodAutoscalerList{ListMeta: obj.(*autoscalingv1.HorizontalPodAutoscalerList).ListMeta}
+ for _, item := range obj.(*autoscalingv1.HorizontalPodAutoscalerList).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 horizontalPodAutoscalers.
+func (c *FakeHorizontalPodAutoscalers) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(horizontalpodautoscalersResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a horizontalPodAutoscaler and creates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any.
+func (c *FakeHorizontalPodAutoscalers) Create(horizontalPodAutoscaler *autoscalingv1.HorizontalPodAutoscaler) (result *autoscalingv1.HorizontalPodAutoscaler, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(horizontalpodautoscalersResource, c.ns, horizontalPodAutoscaler), &autoscalingv1.HorizontalPodAutoscaler{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*autoscalingv1.HorizontalPodAutoscaler), err
+}
+
+// Update takes the representation of a horizontalPodAutoscaler and updates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any.
+func (c *FakeHorizontalPodAutoscalers) Update(horizontalPodAutoscaler *autoscalingv1.HorizontalPodAutoscaler) (result *autoscalingv1.HorizontalPodAutoscaler, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(horizontalpodautoscalersResource, c.ns, horizontalPodAutoscaler), &autoscalingv1.HorizontalPodAutoscaler{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*autoscalingv1.HorizontalPodAutoscaler), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeHorizontalPodAutoscalers) UpdateStatus(horizontalPodAutoscaler *autoscalingv1.HorizontalPodAutoscaler) (*autoscalingv1.HorizontalPodAutoscaler, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(horizontalpodautoscalersResource, "status", c.ns, horizontalPodAutoscaler), &autoscalingv1.HorizontalPodAutoscaler{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*autoscalingv1.HorizontalPodAutoscaler), err
+}
+
+// Delete takes name of the horizontalPodAutoscaler and deletes it. Returns an error if one occurs.
+func (c *FakeHorizontalPodAutoscalers) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(horizontalpodautoscalersResource, c.ns, name), &autoscalingv1.HorizontalPodAutoscaler{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeHorizontalPodAutoscalers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(horizontalpodautoscalersResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &autoscalingv1.HorizontalPodAutoscalerList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched horizontalPodAutoscaler.
+func (c *FakeHorizontalPodAutoscalers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *autoscalingv1.HorizontalPodAutoscaler, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(horizontalpodautoscalersResource, c.ns, name, pt, data, subresources...), &autoscalingv1.HorizontalPodAutoscaler{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*autoscalingv1.HorizontalPodAutoscaler), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v2beta1 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeAutoscalingV2beta1 struct {
+ *testing.Fake
+}
+
+func (c *FakeAutoscalingV2beta1) HorizontalPodAutoscalers(namespace string) v2beta1.HorizontalPodAutoscalerInterface {
+ return &FakeHorizontalPodAutoscalers{c, namespace}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeAutoscalingV2beta1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v2beta1 "k8s.io/api/autoscaling/v2beta1"
+ 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"
+)
+
+// FakeHorizontalPodAutoscalers implements HorizontalPodAutoscalerInterface
+type FakeHorizontalPodAutoscalers struct {
+ Fake *FakeAutoscalingV2beta1
+ ns string
+}
+
+var horizontalpodautoscalersResource = schema.GroupVersionResource{Group: "autoscaling", Version: "v2beta1", Resource: "horizontalpodautoscalers"}
+
+var horizontalpodautoscalersKind = schema.GroupVersionKind{Group: "autoscaling", Version: "v2beta1", Kind: "HorizontalPodAutoscaler"}
+
+// Get takes name of the horizontalPodAutoscaler, and returns the corresponding horizontalPodAutoscaler object, and an error if there is any.
+func (c *FakeHorizontalPodAutoscalers) Get(name string, options v1.GetOptions) (result *v2beta1.HorizontalPodAutoscaler, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(horizontalpodautoscalersResource, c.ns, name), &v2beta1.HorizontalPodAutoscaler{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v2beta1.HorizontalPodAutoscaler), err
+}
+
+// List takes label and field selectors, and returns the list of HorizontalPodAutoscalers that match those selectors.
+func (c *FakeHorizontalPodAutoscalers) List(opts v1.ListOptions) (result *v2beta1.HorizontalPodAutoscalerList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(horizontalpodautoscalersResource, horizontalpodautoscalersKind, c.ns, opts), &v2beta1.HorizontalPodAutoscalerList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v2beta1.HorizontalPodAutoscalerList{ListMeta: obj.(*v2beta1.HorizontalPodAutoscalerList).ListMeta}
+ for _, item := range obj.(*v2beta1.HorizontalPodAutoscalerList).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 horizontalPodAutoscalers.
+func (c *FakeHorizontalPodAutoscalers) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(horizontalpodautoscalersResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a horizontalPodAutoscaler and creates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any.
+func (c *FakeHorizontalPodAutoscalers) Create(horizontalPodAutoscaler *v2beta1.HorizontalPodAutoscaler) (result *v2beta1.HorizontalPodAutoscaler, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(horizontalpodautoscalersResource, c.ns, horizontalPodAutoscaler), &v2beta1.HorizontalPodAutoscaler{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v2beta1.HorizontalPodAutoscaler), err
+}
+
+// Update takes the representation of a horizontalPodAutoscaler and updates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any.
+func (c *FakeHorizontalPodAutoscalers) Update(horizontalPodAutoscaler *v2beta1.HorizontalPodAutoscaler) (result *v2beta1.HorizontalPodAutoscaler, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(horizontalpodautoscalersResource, c.ns, horizontalPodAutoscaler), &v2beta1.HorizontalPodAutoscaler{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v2beta1.HorizontalPodAutoscaler), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeHorizontalPodAutoscalers) UpdateStatus(horizontalPodAutoscaler *v2beta1.HorizontalPodAutoscaler) (*v2beta1.HorizontalPodAutoscaler, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(horizontalpodautoscalersResource, "status", c.ns, horizontalPodAutoscaler), &v2beta1.HorizontalPodAutoscaler{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v2beta1.HorizontalPodAutoscaler), err
+}
+
+// Delete takes name of the horizontalPodAutoscaler and deletes it. Returns an error if one occurs.
+func (c *FakeHorizontalPodAutoscalers) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(horizontalpodautoscalersResource, c.ns, name), &v2beta1.HorizontalPodAutoscaler{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeHorizontalPodAutoscalers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(horizontalpodautoscalersResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v2beta1.HorizontalPodAutoscalerList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched horizontalPodAutoscaler.
+func (c *FakeHorizontalPodAutoscalers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2beta1.HorizontalPodAutoscaler, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(horizontalpodautoscalersResource, c.ns, name, pt, data, subresources...), &v2beta1.HorizontalPodAutoscaler{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v2beta1.HorizontalPodAutoscaler), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v2beta2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeAutoscalingV2beta2 struct {
+ *testing.Fake
+}
+
+func (c *FakeAutoscalingV2beta2) HorizontalPodAutoscalers(namespace string) v2beta2.HorizontalPodAutoscalerInterface {
+ return &FakeHorizontalPodAutoscalers{c, namespace}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeAutoscalingV2beta2) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v2beta2 "k8s.io/api/autoscaling/v2beta2"
+ 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"
+)
+
+// FakeHorizontalPodAutoscalers implements HorizontalPodAutoscalerInterface
+type FakeHorizontalPodAutoscalers struct {
+ Fake *FakeAutoscalingV2beta2
+ ns string
+}
+
+var horizontalpodautoscalersResource = schema.GroupVersionResource{Group: "autoscaling", Version: "v2beta2", Resource: "horizontalpodautoscalers"}
+
+var horizontalpodautoscalersKind = schema.GroupVersionKind{Group: "autoscaling", Version: "v2beta2", Kind: "HorizontalPodAutoscaler"}
+
+// Get takes name of the horizontalPodAutoscaler, and returns the corresponding horizontalPodAutoscaler object, and an error if there is any.
+func (c *FakeHorizontalPodAutoscalers) Get(name string, options v1.GetOptions) (result *v2beta2.HorizontalPodAutoscaler, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(horizontalpodautoscalersResource, c.ns, name), &v2beta2.HorizontalPodAutoscaler{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v2beta2.HorizontalPodAutoscaler), err
+}
+
+// List takes label and field selectors, and returns the list of HorizontalPodAutoscalers that match those selectors.
+func (c *FakeHorizontalPodAutoscalers) List(opts v1.ListOptions) (result *v2beta2.HorizontalPodAutoscalerList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(horizontalpodautoscalersResource, horizontalpodautoscalersKind, c.ns, opts), &v2beta2.HorizontalPodAutoscalerList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v2beta2.HorizontalPodAutoscalerList{ListMeta: obj.(*v2beta2.HorizontalPodAutoscalerList).ListMeta}
+ for _, item := range obj.(*v2beta2.HorizontalPodAutoscalerList).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 horizontalPodAutoscalers.
+func (c *FakeHorizontalPodAutoscalers) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(horizontalpodautoscalersResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a horizontalPodAutoscaler and creates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any.
+func (c *FakeHorizontalPodAutoscalers) Create(horizontalPodAutoscaler *v2beta2.HorizontalPodAutoscaler) (result *v2beta2.HorizontalPodAutoscaler, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(horizontalpodautoscalersResource, c.ns, horizontalPodAutoscaler), &v2beta2.HorizontalPodAutoscaler{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v2beta2.HorizontalPodAutoscaler), err
+}
+
+// Update takes the representation of a horizontalPodAutoscaler and updates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any.
+func (c *FakeHorizontalPodAutoscalers) Update(horizontalPodAutoscaler *v2beta2.HorizontalPodAutoscaler) (result *v2beta2.HorizontalPodAutoscaler, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(horizontalpodautoscalersResource, c.ns, horizontalPodAutoscaler), &v2beta2.HorizontalPodAutoscaler{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v2beta2.HorizontalPodAutoscaler), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeHorizontalPodAutoscalers) UpdateStatus(horizontalPodAutoscaler *v2beta2.HorizontalPodAutoscaler) (*v2beta2.HorizontalPodAutoscaler, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(horizontalpodautoscalersResource, "status", c.ns, horizontalPodAutoscaler), &v2beta2.HorizontalPodAutoscaler{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v2beta2.HorizontalPodAutoscaler), err
+}
+
+// Delete takes name of the horizontalPodAutoscaler and deletes it. Returns an error if one occurs.
+func (c *FakeHorizontalPodAutoscalers) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(horizontalpodautoscalersResource, c.ns, name), &v2beta2.HorizontalPodAutoscaler{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeHorizontalPodAutoscalers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(horizontalpodautoscalersResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v2beta2.HorizontalPodAutoscalerList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched horizontalPodAutoscaler.
+func (c *FakeHorizontalPodAutoscalers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2beta2.HorizontalPodAutoscaler, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(horizontalpodautoscalersResource, c.ns, name, pt, data, subresources...), &v2beta2.HorizontalPodAutoscaler{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v2beta2.HorizontalPodAutoscaler), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1 "k8s.io/client-go/kubernetes/typed/batch/v1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeBatchV1 struct {
+ *testing.Fake
+}
+
+func (c *FakeBatchV1) Jobs(namespace string) v1.JobInterface {
+ return &FakeJobs{c, namespace}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeBatchV1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ batchv1 "k8s.io/api/batch/v1"
+ 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"
+)
+
+// FakeJobs implements JobInterface
+type FakeJobs struct {
+ Fake *FakeBatchV1
+ ns string
+}
+
+var jobsResource = schema.GroupVersionResource{Group: "batch", Version: "v1", Resource: "jobs"}
+
+var jobsKind = schema.GroupVersionKind{Group: "batch", Version: "v1", Kind: "Job"}
+
+// Get takes name of the job, and returns the corresponding job object, and an error if there is any.
+func (c *FakeJobs) Get(name string, options v1.GetOptions) (result *batchv1.Job, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(jobsResource, c.ns, name), &batchv1.Job{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*batchv1.Job), err
+}
+
+// List takes label and field selectors, and returns the list of Jobs that match those selectors.
+func (c *FakeJobs) List(opts v1.ListOptions) (result *batchv1.JobList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(jobsResource, jobsKind, c.ns, opts), &batchv1.JobList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &batchv1.JobList{ListMeta: obj.(*batchv1.JobList).ListMeta}
+ for _, item := range obj.(*batchv1.JobList).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 jobs.
+func (c *FakeJobs) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(jobsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a job and creates it. Returns the server's representation of the job, and an error, if there is any.
+func (c *FakeJobs) Create(job *batchv1.Job) (result *batchv1.Job, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(jobsResource, c.ns, job), &batchv1.Job{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*batchv1.Job), err
+}
+
+// Update takes the representation of a job and updates it. Returns the server's representation of the job, and an error, if there is any.
+func (c *FakeJobs) Update(job *batchv1.Job) (result *batchv1.Job, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(jobsResource, c.ns, job), &batchv1.Job{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*batchv1.Job), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeJobs) UpdateStatus(job *batchv1.Job) (*batchv1.Job, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(jobsResource, "status", c.ns, job), &batchv1.Job{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*batchv1.Job), err
+}
+
+// Delete takes name of the job and deletes it. Returns an error if one occurs.
+func (c *FakeJobs) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(jobsResource, c.ns, name), &batchv1.Job{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(jobsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &batchv1.JobList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched job.
+func (c *FakeJobs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *batchv1.Job, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(jobsResource, c.ns, name, pt, data, subresources...), &batchv1.Job{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*batchv1.Job), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/client-go/kubernetes/typed/batch/v1beta1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeBatchV1beta1 struct {
+ *testing.Fake
+}
+
+func (c *FakeBatchV1beta1) CronJobs(namespace string) v1beta1.CronJobInterface {
+ return &FakeCronJobs{c, namespace}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeBatchV1beta1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/batch/v1beta1"
+ 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"
+)
+
+// FakeCronJobs implements CronJobInterface
+type FakeCronJobs struct {
+ Fake *FakeBatchV1beta1
+ ns string
+}
+
+var cronjobsResource = schema.GroupVersionResource{Group: "batch", Version: "v1beta1", Resource: "cronjobs"}
+
+var cronjobsKind = schema.GroupVersionKind{Group: "batch", Version: "v1beta1", Kind: "CronJob"}
+
+// Get takes name of the cronJob, and returns the corresponding cronJob object, and an error if there is any.
+func (c *FakeCronJobs) Get(name string, options v1.GetOptions) (result *v1beta1.CronJob, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(cronjobsResource, c.ns, name), &v1beta1.CronJob{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.CronJob), err
+}
+
+// List takes label and field selectors, and returns the list of CronJobs that match those selectors.
+func (c *FakeCronJobs) List(opts v1.ListOptions) (result *v1beta1.CronJobList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(cronjobsResource, cronjobsKind, c.ns, opts), &v1beta1.CronJobList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta1.CronJobList{ListMeta: obj.(*v1beta1.CronJobList).ListMeta}
+ for _, item := range obj.(*v1beta1.CronJobList).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 cronJobs.
+func (c *FakeCronJobs) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(cronjobsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a cronJob and creates it. Returns the server's representation of the cronJob, and an error, if there is any.
+func (c *FakeCronJobs) Create(cronJob *v1beta1.CronJob) (result *v1beta1.CronJob, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(cronjobsResource, c.ns, cronJob), &v1beta1.CronJob{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.CronJob), err
+}
+
+// Update takes the representation of a cronJob and updates it. Returns the server's representation of the cronJob, and an error, if there is any.
+func (c *FakeCronJobs) Update(cronJob *v1beta1.CronJob) (result *v1beta1.CronJob, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(cronjobsResource, c.ns, cronJob), &v1beta1.CronJob{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.CronJob), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeCronJobs) UpdateStatus(cronJob *v1beta1.CronJob) (*v1beta1.CronJob, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(cronjobsResource, "status", c.ns, cronJob), &v1beta1.CronJob{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.CronJob), err
+}
+
+// Delete takes name of the cronJob and deletes it. Returns an error if one occurs.
+func (c *FakeCronJobs) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(cronjobsResource, c.ns, name), &v1beta1.CronJob{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeCronJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(cronjobsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta1.CronJobList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched cronJob.
+func (c *FakeCronJobs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.CronJob, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(cronjobsResource, c.ns, name, pt, data, subresources...), &v1beta1.CronJob{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.CronJob), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v2alpha1 "k8s.io/client-go/kubernetes/typed/batch/v2alpha1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeBatchV2alpha1 struct {
+ *testing.Fake
+}
+
+func (c *FakeBatchV2alpha1) CronJobs(namespace string) v2alpha1.CronJobInterface {
+ return &FakeCronJobs{c, namespace}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeBatchV2alpha1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v2alpha1 "k8s.io/api/batch/v2alpha1"
+ 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"
+)
+
+// FakeCronJobs implements CronJobInterface
+type FakeCronJobs struct {
+ Fake *FakeBatchV2alpha1
+ ns string
+}
+
+var cronjobsResource = schema.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}
+
+var cronjobsKind = schema.GroupVersionKind{Group: "batch", Version: "v2alpha1", Kind: "CronJob"}
+
+// Get takes name of the cronJob, and returns the corresponding cronJob object, and an error if there is any.
+func (c *FakeCronJobs) Get(name string, options v1.GetOptions) (result *v2alpha1.CronJob, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(cronjobsResource, c.ns, name), &v2alpha1.CronJob{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v2alpha1.CronJob), err
+}
+
+// List takes label and field selectors, and returns the list of CronJobs that match those selectors.
+func (c *FakeCronJobs) List(opts v1.ListOptions) (result *v2alpha1.CronJobList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(cronjobsResource, cronjobsKind, c.ns, opts), &v2alpha1.CronJobList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v2alpha1.CronJobList{ListMeta: obj.(*v2alpha1.CronJobList).ListMeta}
+ for _, item := range obj.(*v2alpha1.CronJobList).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 cronJobs.
+func (c *FakeCronJobs) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(cronjobsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a cronJob and creates it. Returns the server's representation of the cronJob, and an error, if there is any.
+func (c *FakeCronJobs) Create(cronJob *v2alpha1.CronJob) (result *v2alpha1.CronJob, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(cronjobsResource, c.ns, cronJob), &v2alpha1.CronJob{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v2alpha1.CronJob), err
+}
+
+// Update takes the representation of a cronJob and updates it. Returns the server's representation of the cronJob, and an error, if there is any.
+func (c *FakeCronJobs) Update(cronJob *v2alpha1.CronJob) (result *v2alpha1.CronJob, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(cronjobsResource, c.ns, cronJob), &v2alpha1.CronJob{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v2alpha1.CronJob), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeCronJobs) UpdateStatus(cronJob *v2alpha1.CronJob) (*v2alpha1.CronJob, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(cronjobsResource, "status", c.ns, cronJob), &v2alpha1.CronJob{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v2alpha1.CronJob), err
+}
+
+// Delete takes name of the cronJob and deletes it. Returns an error if one occurs.
+func (c *FakeCronJobs) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(cronjobsResource, c.ns, name), &v2alpha1.CronJob{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeCronJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(cronjobsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v2alpha1.CronJobList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched cronJob.
+func (c *FakeCronJobs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2alpha1.CronJob, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(cronjobsResource, c.ns, name, pt, data, subresources...), &v2alpha1.CronJob{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v2alpha1.CronJob), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/client-go/kubernetes/typed/certificates/v1beta1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeCertificatesV1beta1 struct {
+ *testing.Fake
+}
+
+func (c *FakeCertificatesV1beta1) CertificateSigningRequests() v1beta1.CertificateSigningRequestInterface {
+ return &FakeCertificateSigningRequests{c}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeCertificatesV1beta1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/certificates/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"
+)
+
+// FakeCertificateSigningRequests implements CertificateSigningRequestInterface
+type FakeCertificateSigningRequests struct {
+ Fake *FakeCertificatesV1beta1
+}
+
+var certificatesigningrequestsResource = schema.GroupVersionResource{Group: "certificates.k8s.io", Version: "v1beta1", Resource: "certificatesigningrequests"}
+
+var certificatesigningrequestsKind = schema.GroupVersionKind{Group: "certificates.k8s.io", Version: "v1beta1", Kind: "CertificateSigningRequest"}
+
+// Get takes name of the certificateSigningRequest, and returns the corresponding certificateSigningRequest object, and an error if there is any.
+func (c *FakeCertificateSigningRequests) Get(name string, options v1.GetOptions) (result *v1beta1.CertificateSigningRequest, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(certificatesigningrequestsResource, name), &v1beta1.CertificateSigningRequest{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.CertificateSigningRequest), err
+}
+
+// List takes label and field selectors, and returns the list of CertificateSigningRequests that match those selectors.
+func (c *FakeCertificateSigningRequests) List(opts v1.ListOptions) (result *v1beta1.CertificateSigningRequestList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(certificatesigningrequestsResource, certificatesigningrequestsKind, opts), &v1beta1.CertificateSigningRequestList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta1.CertificateSigningRequestList{ListMeta: obj.(*v1beta1.CertificateSigningRequestList).ListMeta}
+ for _, item := range obj.(*v1beta1.CertificateSigningRequestList).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 certificateSigningRequests.
+func (c *FakeCertificateSigningRequests) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(certificatesigningrequestsResource, opts))
+}
+
+// Create takes the representation of a certificateSigningRequest and creates it. Returns the server's representation of the certificateSigningRequest, and an error, if there is any.
+func (c *FakeCertificateSigningRequests) Create(certificateSigningRequest *v1beta1.CertificateSigningRequest) (result *v1beta1.CertificateSigningRequest, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(certificatesigningrequestsResource, certificateSigningRequest), &v1beta1.CertificateSigningRequest{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.CertificateSigningRequest), err
+}
+
+// Update takes the representation of a certificateSigningRequest and updates it. Returns the server's representation of the certificateSigningRequest, and an error, if there is any.
+func (c *FakeCertificateSigningRequests) Update(certificateSigningRequest *v1beta1.CertificateSigningRequest) (result *v1beta1.CertificateSigningRequest, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(certificatesigningrequestsResource, certificateSigningRequest), &v1beta1.CertificateSigningRequest{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.CertificateSigningRequest), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeCertificateSigningRequests) UpdateStatus(certificateSigningRequest *v1beta1.CertificateSigningRequest) (*v1beta1.CertificateSigningRequest, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateSubresourceAction(certificatesigningrequestsResource, "status", certificateSigningRequest), &v1beta1.CertificateSigningRequest{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.CertificateSigningRequest), err
+}
+
+// Delete takes name of the certificateSigningRequest and deletes it. Returns an error if one occurs.
+func (c *FakeCertificateSigningRequests) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(certificatesigningrequestsResource, name), &v1beta1.CertificateSigningRequest{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeCertificateSigningRequests) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(certificatesigningrequestsResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta1.CertificateSigningRequestList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched certificateSigningRequest.
+func (c *FakeCertificateSigningRequests) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.CertificateSigningRequest, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(certificatesigningrequestsResource, name, pt, data, subresources...), &v1beta1.CertificateSigningRequest{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.CertificateSigningRequest), err
+}
--- /dev/null
+/*
+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 (
+ certificates "k8s.io/api/certificates/v1beta1"
+ core "k8s.io/client-go/testing"
+)
+
+func (c *FakeCertificateSigningRequests) UpdateApproval(certificateSigningRequest *certificates.CertificateSigningRequest) (result *certificates.CertificateSigningRequest, err error) {
+ obj, err := c.Fake.
+ Invokes(core.NewRootUpdateSubresourceAction(certificatesigningrequestsResource, "approval", certificateSigningRequest), &certificates.CertificateSigningRequest{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*certificates.CertificateSigningRequest), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/client-go/kubernetes/typed/coordination/v1beta1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeCoordinationV1beta1 struct {
+ *testing.Fake
+}
+
+func (c *FakeCoordinationV1beta1) Leases(namespace string) v1beta1.LeaseInterface {
+ return &FakeLeases{c, namespace}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeCoordinationV1beta1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/coordination/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"
+)
+
+// FakeLeases implements LeaseInterface
+type FakeLeases struct {
+ Fake *FakeCoordinationV1beta1
+ ns string
+}
+
+var leasesResource = schema.GroupVersionResource{Group: "coordination.k8s.io", Version: "v1beta1", Resource: "leases"}
+
+var leasesKind = schema.GroupVersionKind{Group: "coordination.k8s.io", Version: "v1beta1", Kind: "Lease"}
+
+// Get takes name of the lease, and returns the corresponding lease object, and an error if there is any.
+func (c *FakeLeases) Get(name string, options v1.GetOptions) (result *v1beta1.Lease, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(leasesResource, c.ns, name), &v1beta1.Lease{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Lease), err
+}
+
+// List takes label and field selectors, and returns the list of Leases that match those selectors.
+func (c *FakeLeases) List(opts v1.ListOptions) (result *v1beta1.LeaseList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(leasesResource, leasesKind, c.ns, opts), &v1beta1.LeaseList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta1.LeaseList{ListMeta: obj.(*v1beta1.LeaseList).ListMeta}
+ for _, item := range obj.(*v1beta1.LeaseList).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 leases.
+func (c *FakeLeases) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(leasesResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a lease and creates it. Returns the server's representation of the lease, and an error, if there is any.
+func (c *FakeLeases) Create(lease *v1beta1.Lease) (result *v1beta1.Lease, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(leasesResource, c.ns, lease), &v1beta1.Lease{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Lease), err
+}
+
+// Update takes the representation of a lease and updates it. Returns the server's representation of the lease, and an error, if there is any.
+func (c *FakeLeases) Update(lease *v1beta1.Lease) (result *v1beta1.Lease, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(leasesResource, c.ns, lease), &v1beta1.Lease{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Lease), err
+}
+
+// Delete takes name of the lease and deletes it. Returns an error if one occurs.
+func (c *FakeLeases) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(leasesResource, c.ns, name), &v1beta1.Lease{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeLeases) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(leasesResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta1.LeaseList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched lease.
+func (c *FakeLeases) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Lease, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(leasesResource, c.ns, name, pt, data, subresources...), &v1beta1.Lease{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Lease), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ corev1 "k8s.io/api/core/v1"
+ 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"
+)
+
+// FakeComponentStatuses implements ComponentStatusInterface
+type FakeComponentStatuses struct {
+ Fake *FakeCoreV1
+}
+
+var componentstatusesResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "componentstatuses"}
+
+var componentstatusesKind = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "ComponentStatus"}
+
+// Get takes name of the componentStatus, and returns the corresponding componentStatus object, and an error if there is any.
+func (c *FakeComponentStatuses) Get(name string, options v1.GetOptions) (result *corev1.ComponentStatus, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(componentstatusesResource, name), &corev1.ComponentStatus{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ComponentStatus), err
+}
+
+// List takes label and field selectors, and returns the list of ComponentStatuses that match those selectors.
+func (c *FakeComponentStatuses) List(opts v1.ListOptions) (result *corev1.ComponentStatusList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(componentstatusesResource, componentstatusesKind, opts), &corev1.ComponentStatusList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &corev1.ComponentStatusList{ListMeta: obj.(*corev1.ComponentStatusList).ListMeta}
+ for _, item := range obj.(*corev1.ComponentStatusList).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 componentStatuses.
+func (c *FakeComponentStatuses) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(componentstatusesResource, opts))
+}
+
+// Create takes the representation of a componentStatus and creates it. Returns the server's representation of the componentStatus, and an error, if there is any.
+func (c *FakeComponentStatuses) Create(componentStatus *corev1.ComponentStatus) (result *corev1.ComponentStatus, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(componentstatusesResource, componentStatus), &corev1.ComponentStatus{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ComponentStatus), err
+}
+
+// Update takes the representation of a componentStatus and updates it. Returns the server's representation of the componentStatus, and an error, if there is any.
+func (c *FakeComponentStatuses) Update(componentStatus *corev1.ComponentStatus) (result *corev1.ComponentStatus, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(componentstatusesResource, componentStatus), &corev1.ComponentStatus{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ComponentStatus), err
+}
+
+// Delete takes name of the componentStatus and deletes it. Returns an error if one occurs.
+func (c *FakeComponentStatuses) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(componentstatusesResource, name), &corev1.ComponentStatus{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeComponentStatuses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(componentstatusesResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &corev1.ComponentStatusList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched componentStatus.
+func (c *FakeComponentStatuses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *corev1.ComponentStatus, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(componentstatusesResource, name, pt, data, subresources...), &corev1.ComponentStatus{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ComponentStatus), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ corev1 "k8s.io/api/core/v1"
+ 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"
+)
+
+// FakeConfigMaps implements ConfigMapInterface
+type FakeConfigMaps struct {
+ Fake *FakeCoreV1
+ ns string
+}
+
+var configmapsResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "configmaps"}
+
+var configmapsKind = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "ConfigMap"}
+
+// Get takes name of the configMap, and returns the corresponding configMap object, and an error if there is any.
+func (c *FakeConfigMaps) Get(name string, options v1.GetOptions) (result *corev1.ConfigMap, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(configmapsResource, c.ns, name), &corev1.ConfigMap{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ConfigMap), err
+}
+
+// List takes label and field selectors, and returns the list of ConfigMaps that match those selectors.
+func (c *FakeConfigMaps) List(opts v1.ListOptions) (result *corev1.ConfigMapList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(configmapsResource, configmapsKind, c.ns, opts), &corev1.ConfigMapList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &corev1.ConfigMapList{ListMeta: obj.(*corev1.ConfigMapList).ListMeta}
+ for _, item := range obj.(*corev1.ConfigMapList).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 configMaps.
+func (c *FakeConfigMaps) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(configmapsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a configMap and creates it. Returns the server's representation of the configMap, and an error, if there is any.
+func (c *FakeConfigMaps) Create(configMap *corev1.ConfigMap) (result *corev1.ConfigMap, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(configmapsResource, c.ns, configMap), &corev1.ConfigMap{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ConfigMap), err
+}
+
+// Update takes the representation of a configMap and updates it. Returns the server's representation of the configMap, and an error, if there is any.
+func (c *FakeConfigMaps) Update(configMap *corev1.ConfigMap) (result *corev1.ConfigMap, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(configmapsResource, c.ns, configMap), &corev1.ConfigMap{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ConfigMap), err
+}
+
+// Delete takes name of the configMap and deletes it. Returns an error if one occurs.
+func (c *FakeConfigMaps) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(configmapsResource, c.ns, name), &corev1.ConfigMap{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeConfigMaps) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(configmapsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &corev1.ConfigMapList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched configMap.
+func (c *FakeConfigMaps) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *corev1.ConfigMap, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(configmapsResource, c.ns, name, pt, data, subresources...), &corev1.ConfigMap{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ConfigMap), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1 "k8s.io/client-go/kubernetes/typed/core/v1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeCoreV1 struct {
+ *testing.Fake
+}
+
+func (c *FakeCoreV1) ComponentStatuses() v1.ComponentStatusInterface {
+ return &FakeComponentStatuses{c}
+}
+
+func (c *FakeCoreV1) ConfigMaps(namespace string) v1.ConfigMapInterface {
+ return &FakeConfigMaps{c, namespace}
+}
+
+func (c *FakeCoreV1) Endpoints(namespace string) v1.EndpointsInterface {
+ return &FakeEndpoints{c, namespace}
+}
+
+func (c *FakeCoreV1) Events(namespace string) v1.EventInterface {
+ return &FakeEvents{c, namespace}
+}
+
+func (c *FakeCoreV1) LimitRanges(namespace string) v1.LimitRangeInterface {
+ return &FakeLimitRanges{c, namespace}
+}
+
+func (c *FakeCoreV1) Namespaces() v1.NamespaceInterface {
+ return &FakeNamespaces{c}
+}
+
+func (c *FakeCoreV1) Nodes() v1.NodeInterface {
+ return &FakeNodes{c}
+}
+
+func (c *FakeCoreV1) PersistentVolumes() v1.PersistentVolumeInterface {
+ return &FakePersistentVolumes{c}
+}
+
+func (c *FakeCoreV1) PersistentVolumeClaims(namespace string) v1.PersistentVolumeClaimInterface {
+ return &FakePersistentVolumeClaims{c, namespace}
+}
+
+func (c *FakeCoreV1) Pods(namespace string) v1.PodInterface {
+ return &FakePods{c, namespace}
+}
+
+func (c *FakeCoreV1) PodTemplates(namespace string) v1.PodTemplateInterface {
+ return &FakePodTemplates{c, namespace}
+}
+
+func (c *FakeCoreV1) ReplicationControllers(namespace string) v1.ReplicationControllerInterface {
+ return &FakeReplicationControllers{c, namespace}
+}
+
+func (c *FakeCoreV1) ResourceQuotas(namespace string) v1.ResourceQuotaInterface {
+ return &FakeResourceQuotas{c, namespace}
+}
+
+func (c *FakeCoreV1) Secrets(namespace string) v1.SecretInterface {
+ return &FakeSecrets{c, namespace}
+}
+
+func (c *FakeCoreV1) Services(namespace string) v1.ServiceInterface {
+ return &FakeServices{c, namespace}
+}
+
+func (c *FakeCoreV1) ServiceAccounts(namespace string) v1.ServiceAccountInterface {
+ return &FakeServiceAccounts{c, namespace}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeCoreV1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ corev1 "k8s.io/api/core/v1"
+ 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"
+)
+
+// FakeEndpoints implements EndpointsInterface
+type FakeEndpoints struct {
+ Fake *FakeCoreV1
+ ns string
+}
+
+var endpointsResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "endpoints"}
+
+var endpointsKind = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "Endpoints"}
+
+// Get takes name of the endpoints, and returns the corresponding endpoints object, and an error if there is any.
+func (c *FakeEndpoints) Get(name string, options v1.GetOptions) (result *corev1.Endpoints, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(endpointsResource, c.ns, name), &corev1.Endpoints{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Endpoints), err
+}
+
+// List takes label and field selectors, and returns the list of Endpoints that match those selectors.
+func (c *FakeEndpoints) List(opts v1.ListOptions) (result *corev1.EndpointsList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(endpointsResource, endpointsKind, c.ns, opts), &corev1.EndpointsList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &corev1.EndpointsList{ListMeta: obj.(*corev1.EndpointsList).ListMeta}
+ for _, item := range obj.(*corev1.EndpointsList).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 endpoints.
+func (c *FakeEndpoints) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(endpointsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a endpoints and creates it. Returns the server's representation of the endpoints, and an error, if there is any.
+func (c *FakeEndpoints) Create(endpoints *corev1.Endpoints) (result *corev1.Endpoints, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(endpointsResource, c.ns, endpoints), &corev1.Endpoints{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Endpoints), err
+}
+
+// Update takes the representation of a endpoints and updates it. Returns the server's representation of the endpoints, and an error, if there is any.
+func (c *FakeEndpoints) Update(endpoints *corev1.Endpoints) (result *corev1.Endpoints, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(endpointsResource, c.ns, endpoints), &corev1.Endpoints{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Endpoints), err
+}
+
+// Delete takes name of the endpoints and deletes it. Returns an error if one occurs.
+func (c *FakeEndpoints) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(endpointsResource, c.ns, name), &corev1.Endpoints{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeEndpoints) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(endpointsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &corev1.EndpointsList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched endpoints.
+func (c *FakeEndpoints) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *corev1.Endpoints, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(endpointsResource, c.ns, name, pt, data, subresources...), &corev1.Endpoints{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Endpoints), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ corev1 "k8s.io/api/core/v1"
+ 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"
+)
+
+// FakeEvents implements EventInterface
+type FakeEvents struct {
+ Fake *FakeCoreV1
+ ns string
+}
+
+var eventsResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "events"}
+
+var eventsKind = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "Event"}
+
+// Get takes name of the event, and returns the corresponding event object, and an error if there is any.
+func (c *FakeEvents) Get(name string, options v1.GetOptions) (result *corev1.Event, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(eventsResource, c.ns, name), &corev1.Event{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Event), err
+}
+
+// List takes label and field selectors, and returns the list of Events that match those selectors.
+func (c *FakeEvents) List(opts v1.ListOptions) (result *corev1.EventList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(eventsResource, eventsKind, c.ns, opts), &corev1.EventList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &corev1.EventList{ListMeta: obj.(*corev1.EventList).ListMeta}
+ for _, item := range obj.(*corev1.EventList).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 events.
+func (c *FakeEvents) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(eventsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a event and creates it. Returns the server's representation of the event, and an error, if there is any.
+func (c *FakeEvents) Create(event *corev1.Event) (result *corev1.Event, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(eventsResource, c.ns, event), &corev1.Event{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Event), err
+}
+
+// Update takes the representation of a event and updates it. Returns the server's representation of the event, and an error, if there is any.
+func (c *FakeEvents) Update(event *corev1.Event) (result *corev1.Event, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(eventsResource, c.ns, event), &corev1.Event{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Event), err
+}
+
+// Delete takes name of the event and deletes it. Returns an error if one occurs.
+func (c *FakeEvents) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(eventsResource, c.ns, name), &corev1.Event{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeEvents) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(eventsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &corev1.EventList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched event.
+func (c *FakeEvents) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *corev1.Event, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(eventsResource, c.ns, name, pt, data, subresources...), &corev1.Event{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Event), err
+}
--- /dev/null
+/*
+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 fake
+
+import (
+ "k8s.io/api/core/v1"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/fields"
+ "k8s.io/apimachinery/pkg/runtime"
+ types "k8s.io/apimachinery/pkg/types"
+ core "k8s.io/client-go/testing"
+)
+
+func (c *FakeEvents) CreateWithEventNamespace(event *v1.Event) (*v1.Event, error) {
+ action := core.NewRootCreateAction(eventsResource, event)
+ if c.ns != "" {
+ action = core.NewCreateAction(eventsResource, c.ns, event)
+ }
+ obj, err := c.Fake.Invokes(action, event)
+ if obj == nil {
+ return nil, err
+ }
+
+ return obj.(*v1.Event), err
+}
+
+// Update replaces an existing event. Returns the copy of the event the server returns, or an error.
+func (c *FakeEvents) UpdateWithEventNamespace(event *v1.Event) (*v1.Event, error) {
+ action := core.NewRootUpdateAction(eventsResource, event)
+ if c.ns != "" {
+ action = core.NewUpdateAction(eventsResource, c.ns, event)
+ }
+ obj, err := c.Fake.Invokes(action, event)
+ if obj == nil {
+ return nil, err
+ }
+
+ return obj.(*v1.Event), err
+}
+
+// PatchWithEventNamespace patches an existing event. Returns the copy of the event the server returns, or an error.
+// TODO: Should take a PatchType as an argument probably.
+func (c *FakeEvents) PatchWithEventNamespace(event *v1.Event, data []byte) (*v1.Event, error) {
+ // TODO: Should be configurable to support additional patch strategies.
+ pt := types.StrategicMergePatchType
+ action := core.NewRootPatchAction(eventsResource, event.Name, pt, data)
+ if c.ns != "" {
+ action = core.NewPatchAction(eventsResource, c.ns, event.Name, pt, data)
+ }
+ obj, err := c.Fake.Invokes(action, event)
+ if obj == nil {
+ return nil, err
+ }
+
+ return obj.(*v1.Event), err
+}
+
+// Search returns a list of events matching the specified object.
+func (c *FakeEvents) Search(scheme *runtime.Scheme, objOrRef runtime.Object) (*v1.EventList, error) {
+ action := core.NewRootListAction(eventsResource, eventsKind, metav1.ListOptions{})
+ if c.ns != "" {
+ action = core.NewListAction(eventsResource, eventsKind, c.ns, metav1.ListOptions{})
+ }
+ obj, err := c.Fake.Invokes(action, &v1.EventList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ return obj.(*v1.EventList), err
+}
+
+func (c *FakeEvents) GetFieldSelector(involvedObjectName, involvedObjectNamespace, involvedObjectKind, involvedObjectUID *string) fields.Selector {
+ action := core.GenericActionImpl{}
+ action.Verb = "get-field-selector"
+ action.Resource = eventsResource
+
+ c.Fake.Invokes(action, nil)
+ return fields.Everything()
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ corev1 "k8s.io/api/core/v1"
+ 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"
+)
+
+// FakeLimitRanges implements LimitRangeInterface
+type FakeLimitRanges struct {
+ Fake *FakeCoreV1
+ ns string
+}
+
+var limitrangesResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "limitranges"}
+
+var limitrangesKind = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "LimitRange"}
+
+// Get takes name of the limitRange, and returns the corresponding limitRange object, and an error if there is any.
+func (c *FakeLimitRanges) Get(name string, options v1.GetOptions) (result *corev1.LimitRange, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(limitrangesResource, c.ns, name), &corev1.LimitRange{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.LimitRange), err
+}
+
+// List takes label and field selectors, and returns the list of LimitRanges that match those selectors.
+func (c *FakeLimitRanges) List(opts v1.ListOptions) (result *corev1.LimitRangeList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(limitrangesResource, limitrangesKind, c.ns, opts), &corev1.LimitRangeList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &corev1.LimitRangeList{ListMeta: obj.(*corev1.LimitRangeList).ListMeta}
+ for _, item := range obj.(*corev1.LimitRangeList).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 limitRanges.
+func (c *FakeLimitRanges) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(limitrangesResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a limitRange and creates it. Returns the server's representation of the limitRange, and an error, if there is any.
+func (c *FakeLimitRanges) Create(limitRange *corev1.LimitRange) (result *corev1.LimitRange, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(limitrangesResource, c.ns, limitRange), &corev1.LimitRange{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.LimitRange), err
+}
+
+// Update takes the representation of a limitRange and updates it. Returns the server's representation of the limitRange, and an error, if there is any.
+func (c *FakeLimitRanges) Update(limitRange *corev1.LimitRange) (result *corev1.LimitRange, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(limitrangesResource, c.ns, limitRange), &corev1.LimitRange{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.LimitRange), err
+}
+
+// Delete takes name of the limitRange and deletes it. Returns an error if one occurs.
+func (c *FakeLimitRanges) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(limitrangesResource, c.ns, name), &corev1.LimitRange{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeLimitRanges) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(limitrangesResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &corev1.LimitRangeList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched limitRange.
+func (c *FakeLimitRanges) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *corev1.LimitRange, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(limitrangesResource, c.ns, name, pt, data, subresources...), &corev1.LimitRange{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.LimitRange), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ corev1 "k8s.io/api/core/v1"
+ 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"
+)
+
+// FakeNamespaces implements NamespaceInterface
+type FakeNamespaces struct {
+ Fake *FakeCoreV1
+}
+
+var namespacesResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "namespaces"}
+
+var namespacesKind = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "Namespace"}
+
+// Get takes name of the namespace, and returns the corresponding namespace object, and an error if there is any.
+func (c *FakeNamespaces) Get(name string, options v1.GetOptions) (result *corev1.Namespace, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(namespacesResource, name), &corev1.Namespace{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Namespace), err
+}
+
+// List takes label and field selectors, and returns the list of Namespaces that match those selectors.
+func (c *FakeNamespaces) List(opts v1.ListOptions) (result *corev1.NamespaceList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(namespacesResource, namespacesKind, opts), &corev1.NamespaceList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &corev1.NamespaceList{ListMeta: obj.(*corev1.NamespaceList).ListMeta}
+ for _, item := range obj.(*corev1.NamespaceList).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 namespaces.
+func (c *FakeNamespaces) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(namespacesResource, opts))
+}
+
+// Create takes the representation of a namespace and creates it. Returns the server's representation of the namespace, and an error, if there is any.
+func (c *FakeNamespaces) Create(namespace *corev1.Namespace) (result *corev1.Namespace, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(namespacesResource, namespace), &corev1.Namespace{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Namespace), err
+}
+
+// Update takes the representation of a namespace and updates it. Returns the server's representation of the namespace, and an error, if there is any.
+func (c *FakeNamespaces) Update(namespace *corev1.Namespace) (result *corev1.Namespace, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(namespacesResource, namespace), &corev1.Namespace{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Namespace), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeNamespaces) UpdateStatus(namespace *corev1.Namespace) (*corev1.Namespace, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateSubresourceAction(namespacesResource, "status", namespace), &corev1.Namespace{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Namespace), err
+}
+
+// Delete takes name of the namespace and deletes it. Returns an error if one occurs.
+func (c *FakeNamespaces) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(namespacesResource, name), &corev1.Namespace{})
+ return err
+}
+
+// Patch applies the patch and returns the patched namespace.
+func (c *FakeNamespaces) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *corev1.Namespace, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(namespacesResource, name, pt, data, subresources...), &corev1.Namespace{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Namespace), err
+}
--- /dev/null
+/*
+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 fake
+
+import (
+ "k8s.io/api/core/v1"
+ core "k8s.io/client-go/testing"
+)
+
+func (c *FakeNamespaces) Finalize(namespace *v1.Namespace) (*v1.Namespace, error) {
+ action := core.CreateActionImpl{}
+ action.Verb = "create"
+ action.Resource = namespacesResource
+ action.Subresource = "finalize"
+ action.Object = namespace
+
+ obj, err := c.Fake.Invokes(action, namespace)
+ if obj == nil {
+ return nil, err
+ }
+
+ return obj.(*v1.Namespace), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ corev1 "k8s.io/api/core/v1"
+ 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"
+)
+
+// FakeNodes implements NodeInterface
+type FakeNodes struct {
+ Fake *FakeCoreV1
+}
+
+var nodesResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "nodes"}
+
+var nodesKind = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "Node"}
+
+// Get takes name of the node, and returns the corresponding node object, and an error if there is any.
+func (c *FakeNodes) Get(name string, options v1.GetOptions) (result *corev1.Node, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(nodesResource, name), &corev1.Node{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Node), err
+}
+
+// List takes label and field selectors, and returns the list of Nodes that match those selectors.
+func (c *FakeNodes) List(opts v1.ListOptions) (result *corev1.NodeList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(nodesResource, nodesKind, opts), &corev1.NodeList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &corev1.NodeList{ListMeta: obj.(*corev1.NodeList).ListMeta}
+ for _, item := range obj.(*corev1.NodeList).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 nodes.
+func (c *FakeNodes) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(nodesResource, opts))
+}
+
+// Create takes the representation of a node and creates it. Returns the server's representation of the node, and an error, if there is any.
+func (c *FakeNodes) Create(node *corev1.Node) (result *corev1.Node, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(nodesResource, node), &corev1.Node{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Node), err
+}
+
+// Update takes the representation of a node and updates it. Returns the server's representation of the node, and an error, if there is any.
+func (c *FakeNodes) Update(node *corev1.Node) (result *corev1.Node, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(nodesResource, node), &corev1.Node{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Node), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeNodes) UpdateStatus(node *corev1.Node) (*corev1.Node, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateSubresourceAction(nodesResource, "status", node), &corev1.Node{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Node), err
+}
+
+// Delete takes name of the node and deletes it. Returns an error if one occurs.
+func (c *FakeNodes) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(nodesResource, name), &corev1.Node{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeNodes) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(nodesResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &corev1.NodeList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched node.
+func (c *FakeNodes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *corev1.Node, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(nodesResource, name, pt, data, subresources...), &corev1.Node{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Node), err
+}
--- /dev/null
+/*
+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 (
+ "k8s.io/api/core/v1"
+ types "k8s.io/apimachinery/pkg/types"
+ core "k8s.io/client-go/testing"
+)
+
+// TODO: Should take a PatchType as an argument probably.
+func (c *FakeNodes) PatchStatus(nodeName string, data []byte) (*v1.Node, error) {
+ // TODO: Should be configurable to support additional patch strategies.
+ pt := types.StrategicMergePatchType
+ obj, err := c.Fake.Invokes(
+ core.NewRootPatchSubresourceAction(nodesResource, nodeName, pt, data, "status"), &v1.Node{})
+ if obj == nil {
+ return nil, err
+ }
+
+ return obj.(*v1.Node), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ corev1 "k8s.io/api/core/v1"
+ 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"
+)
+
+// FakePersistentVolumes implements PersistentVolumeInterface
+type FakePersistentVolumes struct {
+ Fake *FakeCoreV1
+}
+
+var persistentvolumesResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "persistentvolumes"}
+
+var persistentvolumesKind = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "PersistentVolume"}
+
+// Get takes name of the persistentVolume, and returns the corresponding persistentVolume object, and an error if there is any.
+func (c *FakePersistentVolumes) Get(name string, options v1.GetOptions) (result *corev1.PersistentVolume, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(persistentvolumesResource, name), &corev1.PersistentVolume{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.PersistentVolume), err
+}
+
+// List takes label and field selectors, and returns the list of PersistentVolumes that match those selectors.
+func (c *FakePersistentVolumes) List(opts v1.ListOptions) (result *corev1.PersistentVolumeList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(persistentvolumesResource, persistentvolumesKind, opts), &corev1.PersistentVolumeList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &corev1.PersistentVolumeList{ListMeta: obj.(*corev1.PersistentVolumeList).ListMeta}
+ for _, item := range obj.(*corev1.PersistentVolumeList).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 persistentVolumes.
+func (c *FakePersistentVolumes) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(persistentvolumesResource, opts))
+}
+
+// Create takes the representation of a persistentVolume and creates it. Returns the server's representation of the persistentVolume, and an error, if there is any.
+func (c *FakePersistentVolumes) Create(persistentVolume *corev1.PersistentVolume) (result *corev1.PersistentVolume, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(persistentvolumesResource, persistentVolume), &corev1.PersistentVolume{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.PersistentVolume), err
+}
+
+// Update takes the representation of a persistentVolume and updates it. Returns the server's representation of the persistentVolume, and an error, if there is any.
+func (c *FakePersistentVolumes) Update(persistentVolume *corev1.PersistentVolume) (result *corev1.PersistentVolume, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(persistentvolumesResource, persistentVolume), &corev1.PersistentVolume{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.PersistentVolume), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakePersistentVolumes) UpdateStatus(persistentVolume *corev1.PersistentVolume) (*corev1.PersistentVolume, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateSubresourceAction(persistentvolumesResource, "status", persistentVolume), &corev1.PersistentVolume{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.PersistentVolume), err
+}
+
+// Delete takes name of the persistentVolume and deletes it. Returns an error if one occurs.
+func (c *FakePersistentVolumes) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(persistentvolumesResource, name), &corev1.PersistentVolume{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakePersistentVolumes) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(persistentvolumesResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &corev1.PersistentVolumeList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched persistentVolume.
+func (c *FakePersistentVolumes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *corev1.PersistentVolume, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(persistentvolumesResource, name, pt, data, subresources...), &corev1.PersistentVolume{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.PersistentVolume), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ corev1 "k8s.io/api/core/v1"
+ 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"
+)
+
+// FakePersistentVolumeClaims implements PersistentVolumeClaimInterface
+type FakePersistentVolumeClaims struct {
+ Fake *FakeCoreV1
+ ns string
+}
+
+var persistentvolumeclaimsResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "persistentvolumeclaims"}
+
+var persistentvolumeclaimsKind = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "PersistentVolumeClaim"}
+
+// Get takes name of the persistentVolumeClaim, and returns the corresponding persistentVolumeClaim object, and an error if there is any.
+func (c *FakePersistentVolumeClaims) Get(name string, options v1.GetOptions) (result *corev1.PersistentVolumeClaim, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(persistentvolumeclaimsResource, c.ns, name), &corev1.PersistentVolumeClaim{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.PersistentVolumeClaim), err
+}
+
+// List takes label and field selectors, and returns the list of PersistentVolumeClaims that match those selectors.
+func (c *FakePersistentVolumeClaims) List(opts v1.ListOptions) (result *corev1.PersistentVolumeClaimList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(persistentvolumeclaimsResource, persistentvolumeclaimsKind, c.ns, opts), &corev1.PersistentVolumeClaimList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &corev1.PersistentVolumeClaimList{ListMeta: obj.(*corev1.PersistentVolumeClaimList).ListMeta}
+ for _, item := range obj.(*corev1.PersistentVolumeClaimList).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 persistentVolumeClaims.
+func (c *FakePersistentVolumeClaims) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(persistentvolumeclaimsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a persistentVolumeClaim and creates it. Returns the server's representation of the persistentVolumeClaim, and an error, if there is any.
+func (c *FakePersistentVolumeClaims) Create(persistentVolumeClaim *corev1.PersistentVolumeClaim) (result *corev1.PersistentVolumeClaim, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(persistentvolumeclaimsResource, c.ns, persistentVolumeClaim), &corev1.PersistentVolumeClaim{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.PersistentVolumeClaim), err
+}
+
+// Update takes the representation of a persistentVolumeClaim and updates it. Returns the server's representation of the persistentVolumeClaim, and an error, if there is any.
+func (c *FakePersistentVolumeClaims) Update(persistentVolumeClaim *corev1.PersistentVolumeClaim) (result *corev1.PersistentVolumeClaim, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(persistentvolumeclaimsResource, c.ns, persistentVolumeClaim), &corev1.PersistentVolumeClaim{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.PersistentVolumeClaim), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakePersistentVolumeClaims) UpdateStatus(persistentVolumeClaim *corev1.PersistentVolumeClaim) (*corev1.PersistentVolumeClaim, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(persistentvolumeclaimsResource, "status", c.ns, persistentVolumeClaim), &corev1.PersistentVolumeClaim{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.PersistentVolumeClaim), err
+}
+
+// Delete takes name of the persistentVolumeClaim and deletes it. Returns an error if one occurs.
+func (c *FakePersistentVolumeClaims) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(persistentvolumeclaimsResource, c.ns, name), &corev1.PersistentVolumeClaim{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakePersistentVolumeClaims) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(persistentvolumeclaimsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &corev1.PersistentVolumeClaimList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched persistentVolumeClaim.
+func (c *FakePersistentVolumeClaims) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *corev1.PersistentVolumeClaim, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(persistentvolumeclaimsResource, c.ns, name, pt, data, subresources...), &corev1.PersistentVolumeClaim{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.PersistentVolumeClaim), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ corev1 "k8s.io/api/core/v1"
+ 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"
+)
+
+// FakePods implements PodInterface
+type FakePods struct {
+ Fake *FakeCoreV1
+ ns string
+}
+
+var podsResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"}
+
+var podsKind = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "Pod"}
+
+// Get takes name of the pod, and returns the corresponding pod object, and an error if there is any.
+func (c *FakePods) Get(name string, options v1.GetOptions) (result *corev1.Pod, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(podsResource, c.ns, name), &corev1.Pod{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Pod), err
+}
+
+// List takes label and field selectors, and returns the list of Pods that match those selectors.
+func (c *FakePods) List(opts v1.ListOptions) (result *corev1.PodList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(podsResource, podsKind, c.ns, opts), &corev1.PodList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &corev1.PodList{ListMeta: obj.(*corev1.PodList).ListMeta}
+ for _, item := range obj.(*corev1.PodList).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 pods.
+func (c *FakePods) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(podsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a pod and creates it. Returns the server's representation of the pod, and an error, if there is any.
+func (c *FakePods) Create(pod *corev1.Pod) (result *corev1.Pod, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(podsResource, c.ns, pod), &corev1.Pod{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Pod), err
+}
+
+// Update takes the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any.
+func (c *FakePods) Update(pod *corev1.Pod) (result *corev1.Pod, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(podsResource, c.ns, pod), &corev1.Pod{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Pod), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakePods) UpdateStatus(pod *corev1.Pod) (*corev1.Pod, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(podsResource, "status", c.ns, pod), &corev1.Pod{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Pod), err
+}
+
+// Delete takes name of the pod and deletes it. Returns an error if one occurs.
+func (c *FakePods) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(podsResource, c.ns, name), &corev1.Pod{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakePods) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(podsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &corev1.PodList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched pod.
+func (c *FakePods) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *corev1.Pod, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(podsResource, c.ns, name, pt, data, subresources...), &corev1.Pod{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Pod), err
+}
--- /dev/null
+/*
+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 fake
+
+import (
+ "k8s.io/api/core/v1"
+ policy "k8s.io/api/policy/v1beta1"
+ restclient "k8s.io/client-go/rest"
+ core "k8s.io/client-go/testing"
+)
+
+func (c *FakePods) Bind(binding *v1.Binding) error {
+ action := core.CreateActionImpl{}
+ action.Verb = "create"
+ action.Namespace = binding.Namespace
+ action.Resource = podsResource
+ action.Subresource = "binding"
+ action.Object = binding
+
+ _, err := c.Fake.Invokes(action, binding)
+ return err
+}
+
+func (c *FakePods) GetBinding(name string) (result *v1.Binding, err error) {
+ obj, err := c.Fake.
+ Invokes(core.NewGetSubresourceAction(podsResource, c.ns, "binding", name), &v1.Binding{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1.Binding), err
+}
+
+func (c *FakePods) GetLogs(name string, opts *v1.PodLogOptions) *restclient.Request {
+ action := core.GenericActionImpl{}
+ action.Verb = "get"
+ action.Namespace = c.ns
+ action.Resource = podsResource
+ action.Subresource = "log"
+ action.Value = opts
+
+ _, _ = c.Fake.Invokes(action, &v1.Pod{})
+ return &restclient.Request{}
+}
+
+func (c *FakePods) Evict(eviction *policy.Eviction) error {
+ action := core.CreateActionImpl{}
+ action.Verb = "create"
+ action.Resource = podsResource
+ action.Subresource = "eviction"
+ action.Object = eviction
+
+ _, err := c.Fake.Invokes(action, eviction)
+ return err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ corev1 "k8s.io/api/core/v1"
+ 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"
+)
+
+// FakePodTemplates implements PodTemplateInterface
+type FakePodTemplates struct {
+ Fake *FakeCoreV1
+ ns string
+}
+
+var podtemplatesResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "podtemplates"}
+
+var podtemplatesKind = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "PodTemplate"}
+
+// Get takes name of the podTemplate, and returns the corresponding podTemplate object, and an error if there is any.
+func (c *FakePodTemplates) Get(name string, options v1.GetOptions) (result *corev1.PodTemplate, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(podtemplatesResource, c.ns, name), &corev1.PodTemplate{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.PodTemplate), err
+}
+
+// List takes label and field selectors, and returns the list of PodTemplates that match those selectors.
+func (c *FakePodTemplates) List(opts v1.ListOptions) (result *corev1.PodTemplateList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(podtemplatesResource, podtemplatesKind, c.ns, opts), &corev1.PodTemplateList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &corev1.PodTemplateList{ListMeta: obj.(*corev1.PodTemplateList).ListMeta}
+ for _, item := range obj.(*corev1.PodTemplateList).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 podTemplates.
+func (c *FakePodTemplates) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(podtemplatesResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a podTemplate and creates it. Returns the server's representation of the podTemplate, and an error, if there is any.
+func (c *FakePodTemplates) Create(podTemplate *corev1.PodTemplate) (result *corev1.PodTemplate, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(podtemplatesResource, c.ns, podTemplate), &corev1.PodTemplate{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.PodTemplate), err
+}
+
+// Update takes the representation of a podTemplate and updates it. Returns the server's representation of the podTemplate, and an error, if there is any.
+func (c *FakePodTemplates) Update(podTemplate *corev1.PodTemplate) (result *corev1.PodTemplate, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(podtemplatesResource, c.ns, podTemplate), &corev1.PodTemplate{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.PodTemplate), err
+}
+
+// Delete takes name of the podTemplate and deletes it. Returns an error if one occurs.
+func (c *FakePodTemplates) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(podtemplatesResource, c.ns, name), &corev1.PodTemplate{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakePodTemplates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(podtemplatesResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &corev1.PodTemplateList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched podTemplate.
+func (c *FakePodTemplates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *corev1.PodTemplate, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(podtemplatesResource, c.ns, name, pt, data, subresources...), &corev1.PodTemplate{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.PodTemplate), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ autoscalingv1 "k8s.io/api/autoscaling/v1"
+ corev1 "k8s.io/api/core/v1"
+ 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"
+)
+
+// FakeReplicationControllers implements ReplicationControllerInterface
+type FakeReplicationControllers struct {
+ Fake *FakeCoreV1
+ ns string
+}
+
+var replicationcontrollersResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "replicationcontrollers"}
+
+var replicationcontrollersKind = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "ReplicationController"}
+
+// Get takes name of the replicationController, and returns the corresponding replicationController object, and an error if there is any.
+func (c *FakeReplicationControllers) Get(name string, options v1.GetOptions) (result *corev1.ReplicationController, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(replicationcontrollersResource, c.ns, name), &corev1.ReplicationController{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ReplicationController), err
+}
+
+// List takes label and field selectors, and returns the list of ReplicationControllers that match those selectors.
+func (c *FakeReplicationControllers) List(opts v1.ListOptions) (result *corev1.ReplicationControllerList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(replicationcontrollersResource, replicationcontrollersKind, c.ns, opts), &corev1.ReplicationControllerList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &corev1.ReplicationControllerList{ListMeta: obj.(*corev1.ReplicationControllerList).ListMeta}
+ for _, item := range obj.(*corev1.ReplicationControllerList).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 replicationControllers.
+func (c *FakeReplicationControllers) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(replicationcontrollersResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a replicationController and creates it. Returns the server's representation of the replicationController, and an error, if there is any.
+func (c *FakeReplicationControllers) Create(replicationController *corev1.ReplicationController) (result *corev1.ReplicationController, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(replicationcontrollersResource, c.ns, replicationController), &corev1.ReplicationController{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ReplicationController), err
+}
+
+// Update takes the representation of a replicationController and updates it. Returns the server's representation of the replicationController, and an error, if there is any.
+func (c *FakeReplicationControllers) Update(replicationController *corev1.ReplicationController) (result *corev1.ReplicationController, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(replicationcontrollersResource, c.ns, replicationController), &corev1.ReplicationController{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ReplicationController), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeReplicationControllers) UpdateStatus(replicationController *corev1.ReplicationController) (*corev1.ReplicationController, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(replicationcontrollersResource, "status", c.ns, replicationController), &corev1.ReplicationController{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ReplicationController), err
+}
+
+// Delete takes name of the replicationController and deletes it. Returns an error if one occurs.
+func (c *FakeReplicationControllers) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(replicationcontrollersResource, c.ns, name), &corev1.ReplicationController{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeReplicationControllers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(replicationcontrollersResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &corev1.ReplicationControllerList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched replicationController.
+func (c *FakeReplicationControllers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *corev1.ReplicationController, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(replicationcontrollersResource, c.ns, name, pt, data, subresources...), &corev1.ReplicationController{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ReplicationController), err
+}
+
+// GetScale takes name of the replicationController, and returns the corresponding scale object, and an error if there is any.
+func (c *FakeReplicationControllers) GetScale(replicationControllerName string, options v1.GetOptions) (result *autoscalingv1.Scale, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetSubresourceAction(replicationcontrollersResource, c.ns, "scale", replicationControllerName), &autoscalingv1.Scale{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*autoscalingv1.Scale), err
+}
+
+// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
+func (c *FakeReplicationControllers) UpdateScale(replicationControllerName string, scale *autoscalingv1.Scale) (result *autoscalingv1.Scale, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(replicationcontrollersResource, "scale", c.ns, scale), &autoscalingv1.Scale{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*autoscalingv1.Scale), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ corev1 "k8s.io/api/core/v1"
+ 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"
+)
+
+// FakeResourceQuotas implements ResourceQuotaInterface
+type FakeResourceQuotas struct {
+ Fake *FakeCoreV1
+ ns string
+}
+
+var resourcequotasResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "resourcequotas"}
+
+var resourcequotasKind = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "ResourceQuota"}
+
+// Get takes name of the resourceQuota, and returns the corresponding resourceQuota object, and an error if there is any.
+func (c *FakeResourceQuotas) Get(name string, options v1.GetOptions) (result *corev1.ResourceQuota, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(resourcequotasResource, c.ns, name), &corev1.ResourceQuota{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ResourceQuota), err
+}
+
+// List takes label and field selectors, and returns the list of ResourceQuotas that match those selectors.
+func (c *FakeResourceQuotas) List(opts v1.ListOptions) (result *corev1.ResourceQuotaList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(resourcequotasResource, resourcequotasKind, c.ns, opts), &corev1.ResourceQuotaList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &corev1.ResourceQuotaList{ListMeta: obj.(*corev1.ResourceQuotaList).ListMeta}
+ for _, item := range obj.(*corev1.ResourceQuotaList).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 resourceQuotas.
+func (c *FakeResourceQuotas) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(resourcequotasResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a resourceQuota and creates it. Returns the server's representation of the resourceQuota, and an error, if there is any.
+func (c *FakeResourceQuotas) Create(resourceQuota *corev1.ResourceQuota) (result *corev1.ResourceQuota, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(resourcequotasResource, c.ns, resourceQuota), &corev1.ResourceQuota{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ResourceQuota), err
+}
+
+// Update takes the representation of a resourceQuota and updates it. Returns the server's representation of the resourceQuota, and an error, if there is any.
+func (c *FakeResourceQuotas) Update(resourceQuota *corev1.ResourceQuota) (result *corev1.ResourceQuota, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(resourcequotasResource, c.ns, resourceQuota), &corev1.ResourceQuota{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ResourceQuota), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeResourceQuotas) UpdateStatus(resourceQuota *corev1.ResourceQuota) (*corev1.ResourceQuota, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(resourcequotasResource, "status", c.ns, resourceQuota), &corev1.ResourceQuota{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ResourceQuota), err
+}
+
+// Delete takes name of the resourceQuota and deletes it. Returns an error if one occurs.
+func (c *FakeResourceQuotas) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(resourcequotasResource, c.ns, name), &corev1.ResourceQuota{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeResourceQuotas) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(resourcequotasResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &corev1.ResourceQuotaList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched resourceQuota.
+func (c *FakeResourceQuotas) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *corev1.ResourceQuota, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(resourcequotasResource, c.ns, name, pt, data, subresources...), &corev1.ResourceQuota{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ResourceQuota), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ corev1 "k8s.io/api/core/v1"
+ 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"
+)
+
+// FakeSecrets implements SecretInterface
+type FakeSecrets struct {
+ Fake *FakeCoreV1
+ ns string
+}
+
+var secretsResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "secrets"}
+
+var secretsKind = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "Secret"}
+
+// Get takes name of the secret, and returns the corresponding secret object, and an error if there is any.
+func (c *FakeSecrets) Get(name string, options v1.GetOptions) (result *corev1.Secret, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(secretsResource, c.ns, name), &corev1.Secret{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Secret), err
+}
+
+// List takes label and field selectors, and returns the list of Secrets that match those selectors.
+func (c *FakeSecrets) List(opts v1.ListOptions) (result *corev1.SecretList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(secretsResource, secretsKind, c.ns, opts), &corev1.SecretList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &corev1.SecretList{ListMeta: obj.(*corev1.SecretList).ListMeta}
+ for _, item := range obj.(*corev1.SecretList).Items {
+ if label.Matches(labels.Set(item.Labels)) {
+ list.Items = append(list.Items, item)
+ }
+ }
+ return list, err
+}
+
+// Watch returns a watch.Interface that watches the requested secrets.
+func (c *FakeSecrets) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(secretsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a secret and creates it. Returns the server's representation of the secret, and an error, if there is any.
+func (c *FakeSecrets) Create(secret *corev1.Secret) (result *corev1.Secret, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(secretsResource, c.ns, secret), &corev1.Secret{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Secret), err
+}
+
+// Update takes the representation of a secret and updates it. Returns the server's representation of the secret, and an error, if there is any.
+func (c *FakeSecrets) Update(secret *corev1.Secret) (result *corev1.Secret, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(secretsResource, c.ns, secret), &corev1.Secret{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Secret), err
+}
+
+// Delete takes name of the secret and deletes it. Returns an error if one occurs.
+func (c *FakeSecrets) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(secretsResource, c.ns, name), &corev1.Secret{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeSecrets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(secretsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &corev1.SecretList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched secret.
+func (c *FakeSecrets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *corev1.Secret, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(secretsResource, c.ns, name, pt, data, subresources...), &corev1.Secret{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Secret), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ corev1 "k8s.io/api/core/v1"
+ 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"
+)
+
+// FakeServices implements ServiceInterface
+type FakeServices struct {
+ Fake *FakeCoreV1
+ ns string
+}
+
+var servicesResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "services"}
+
+var servicesKind = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "Service"}
+
+// Get takes name of the service, and returns the corresponding service object, and an error if there is any.
+func (c *FakeServices) Get(name string, options v1.GetOptions) (result *corev1.Service, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(servicesResource, c.ns, name), &corev1.Service{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Service), err
+}
+
+// List takes label and field selectors, and returns the list of Services that match those selectors.
+func (c *FakeServices) List(opts v1.ListOptions) (result *corev1.ServiceList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(servicesResource, servicesKind, c.ns, opts), &corev1.ServiceList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &corev1.ServiceList{ListMeta: obj.(*corev1.ServiceList).ListMeta}
+ for _, item := range obj.(*corev1.ServiceList).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 services.
+func (c *FakeServices) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(servicesResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a service and creates it. Returns the server's representation of the service, and an error, if there is any.
+func (c *FakeServices) Create(service *corev1.Service) (result *corev1.Service, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(servicesResource, c.ns, service), &corev1.Service{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Service), err
+}
+
+// Update takes the representation of a service and updates it. Returns the server's representation of the service, and an error, if there is any.
+func (c *FakeServices) Update(service *corev1.Service) (result *corev1.Service, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(servicesResource, c.ns, service), &corev1.Service{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Service), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeServices) UpdateStatus(service *corev1.Service) (*corev1.Service, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(servicesResource, "status", c.ns, service), &corev1.Service{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Service), err
+}
+
+// Delete takes name of the service and deletes it. Returns an error if one occurs.
+func (c *FakeServices) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(servicesResource, c.ns, name), &corev1.Service{})
+
+ return err
+}
+
+// Patch applies the patch and returns the patched service.
+func (c *FakeServices) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *corev1.Service, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(servicesResource, c.ns, name, pt, data, subresources...), &corev1.Service{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.Service), err
+}
--- /dev/null
+/*
+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 fake
+
+import (
+ restclient "k8s.io/client-go/rest"
+ core "k8s.io/client-go/testing"
+)
+
+func (c *FakeServices) ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper {
+ return c.Fake.InvokesProxy(core.NewProxyGetAction(servicesResource, c.ns, scheme, name, port, path, params))
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ corev1 "k8s.io/api/core/v1"
+ 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"
+)
+
+// FakeServiceAccounts implements ServiceAccountInterface
+type FakeServiceAccounts struct {
+ Fake *FakeCoreV1
+ ns string
+}
+
+var serviceaccountsResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "serviceaccounts"}
+
+var serviceaccountsKind = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "ServiceAccount"}
+
+// Get takes name of the serviceAccount, and returns the corresponding serviceAccount object, and an error if there is any.
+func (c *FakeServiceAccounts) Get(name string, options v1.GetOptions) (result *corev1.ServiceAccount, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(serviceaccountsResource, c.ns, name), &corev1.ServiceAccount{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ServiceAccount), err
+}
+
+// List takes label and field selectors, and returns the list of ServiceAccounts that match those selectors.
+func (c *FakeServiceAccounts) List(opts v1.ListOptions) (result *corev1.ServiceAccountList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(serviceaccountsResource, serviceaccountsKind, c.ns, opts), &corev1.ServiceAccountList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &corev1.ServiceAccountList{ListMeta: obj.(*corev1.ServiceAccountList).ListMeta}
+ for _, item := range obj.(*corev1.ServiceAccountList).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 serviceAccounts.
+func (c *FakeServiceAccounts) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(serviceaccountsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a serviceAccount and creates it. Returns the server's representation of the serviceAccount, and an error, if there is any.
+func (c *FakeServiceAccounts) Create(serviceAccount *corev1.ServiceAccount) (result *corev1.ServiceAccount, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(serviceaccountsResource, c.ns, serviceAccount), &corev1.ServiceAccount{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ServiceAccount), err
+}
+
+// Update takes the representation of a serviceAccount and updates it. Returns the server's representation of the serviceAccount, and an error, if there is any.
+func (c *FakeServiceAccounts) Update(serviceAccount *corev1.ServiceAccount) (result *corev1.ServiceAccount, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(serviceaccountsResource, c.ns, serviceAccount), &corev1.ServiceAccount{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ServiceAccount), err
+}
+
+// Delete takes name of the serviceAccount and deletes it. Returns an error if one occurs.
+func (c *FakeServiceAccounts) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(serviceaccountsResource, c.ns, name), &corev1.ServiceAccount{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeServiceAccounts) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(serviceaccountsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &corev1.ServiceAccountList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched serviceAccount.
+func (c *FakeServiceAccounts) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *corev1.ServiceAccount, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(serviceaccountsResource, c.ns, name, pt, data, subresources...), &corev1.ServiceAccount{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*corev1.ServiceAccount), err
+}
--- /dev/null
+/*
+Copyright 2018 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package fake
+
+import (
+ authenticationv1 "k8s.io/api/authentication/v1"
+ core "k8s.io/client-go/testing"
+)
+
+func (c *FakeServiceAccounts) CreateToken(name string, tr *authenticationv1.TokenRequest) (*authenticationv1.TokenRequest, error) {
+ obj, err := c.Fake.Invokes(core.NewCreateSubresourceAction(serviceaccountsResource, name, "token", c.ns, tr), &authenticationv1.TokenRequest{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*authenticationv1.TokenRequest), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/events/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"
+)
+
+// FakeEvents implements EventInterface
+type FakeEvents struct {
+ Fake *FakeEventsV1beta1
+ ns string
+}
+
+var eventsResource = schema.GroupVersionResource{Group: "events.k8s.io", Version: "v1beta1", Resource: "events"}
+
+var eventsKind = schema.GroupVersionKind{Group: "events.k8s.io", Version: "v1beta1", Kind: "Event"}
+
+// Get takes name of the event, and returns the corresponding event object, and an error if there is any.
+func (c *FakeEvents) Get(name string, options v1.GetOptions) (result *v1beta1.Event, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(eventsResource, c.ns, name), &v1beta1.Event{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Event), err
+}
+
+// List takes label and field selectors, and returns the list of Events that match those selectors.
+func (c *FakeEvents) List(opts v1.ListOptions) (result *v1beta1.EventList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(eventsResource, eventsKind, c.ns, opts), &v1beta1.EventList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta1.EventList{ListMeta: obj.(*v1beta1.EventList).ListMeta}
+ for _, item := range obj.(*v1beta1.EventList).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 events.
+func (c *FakeEvents) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(eventsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a event and creates it. Returns the server's representation of the event, and an error, if there is any.
+func (c *FakeEvents) Create(event *v1beta1.Event) (result *v1beta1.Event, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(eventsResource, c.ns, event), &v1beta1.Event{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Event), err
+}
+
+// Update takes the representation of a event and updates it. Returns the server's representation of the event, and an error, if there is any.
+func (c *FakeEvents) Update(event *v1beta1.Event) (result *v1beta1.Event, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(eventsResource, c.ns, event), &v1beta1.Event{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Event), err
+}
+
+// Delete takes name of the event and deletes it. Returns an error if one occurs.
+func (c *FakeEvents) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(eventsResource, c.ns, name), &v1beta1.Event{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeEvents) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(eventsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta1.EventList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched event.
+func (c *FakeEvents) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Event, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(eventsResource, c.ns, name, pt, data, subresources...), &v1beta1.Event{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Event), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/client-go/kubernetes/typed/events/v1beta1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeEventsV1beta1 struct {
+ *testing.Fake
+}
+
+func (c *FakeEventsV1beta1) Events(namespace string) v1beta1.EventInterface {
+ return &FakeEvents{c, namespace}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeEventsV1beta1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/extensions/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"
+)
+
+// FakeDaemonSets implements DaemonSetInterface
+type FakeDaemonSets struct {
+ Fake *FakeExtensionsV1beta1
+ ns string
+}
+
+var daemonsetsResource = schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "daemonsets"}
+
+var daemonsetsKind = schema.GroupVersionKind{Group: "extensions", Version: "v1beta1", Kind: "DaemonSet"}
+
+// Get takes name of the daemonSet, and returns the corresponding daemonSet object, and an error if there is any.
+func (c *FakeDaemonSets) Get(name string, options v1.GetOptions) (result *v1beta1.DaemonSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(daemonsetsResource, c.ns, name), &v1beta1.DaemonSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.DaemonSet), err
+}
+
+// List takes label and field selectors, and returns the list of DaemonSets that match those selectors.
+func (c *FakeDaemonSets) List(opts v1.ListOptions) (result *v1beta1.DaemonSetList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(daemonsetsResource, daemonsetsKind, c.ns, opts), &v1beta1.DaemonSetList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta1.DaemonSetList{ListMeta: obj.(*v1beta1.DaemonSetList).ListMeta}
+ for _, item := range obj.(*v1beta1.DaemonSetList).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 daemonSets.
+func (c *FakeDaemonSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(daemonsetsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a daemonSet and creates it. Returns the server's representation of the daemonSet, and an error, if there is any.
+func (c *FakeDaemonSets) Create(daemonSet *v1beta1.DaemonSet) (result *v1beta1.DaemonSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(daemonsetsResource, c.ns, daemonSet), &v1beta1.DaemonSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.DaemonSet), err
+}
+
+// Update takes the representation of a daemonSet and updates it. Returns the server's representation of the daemonSet, and an error, if there is any.
+func (c *FakeDaemonSets) Update(daemonSet *v1beta1.DaemonSet) (result *v1beta1.DaemonSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(daemonsetsResource, c.ns, daemonSet), &v1beta1.DaemonSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.DaemonSet), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeDaemonSets) UpdateStatus(daemonSet *v1beta1.DaemonSet) (*v1beta1.DaemonSet, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(daemonsetsResource, "status", c.ns, daemonSet), &v1beta1.DaemonSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.DaemonSet), err
+}
+
+// Delete takes name of the daemonSet and deletes it. Returns an error if one occurs.
+func (c *FakeDaemonSets) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(daemonsetsResource, c.ns, name), &v1beta1.DaemonSet{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeDaemonSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(daemonsetsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta1.DaemonSetList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched daemonSet.
+func (c *FakeDaemonSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.DaemonSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(daemonsetsResource, c.ns, name, pt, data, subresources...), &v1beta1.DaemonSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.DaemonSet), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/extensions/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 *FakeExtensionsV1beta1
+ ns string
+}
+
+var deploymentsResource = schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "deployments"}
+
+var deploymentsKind = schema.GroupVersionKind{Group: "extensions", Version: "v1beta1", Kind: "Deployment"}
+
+// Get takes name of the deployment, and returns the corresponding deployment object, and an error if there is any.
+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
+}
+
+// List takes label and field selectors, and returns the list of Deployments that match those selectors.
+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{ListMeta: obj.(*v1beta1.DeploymentList).ListMeta}
+ 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))
+
+}
+
+// Create takes the representation of a deployment and creates it. Returns the server's representation of the deployment, and an error, if there is any.
+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
+}
+
+// Update takes the representation of a deployment and updates it. Returns the server's representation of the deployment, and an error, if there is any.
+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
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+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
+}
+
+// Delete takes name of the deployment and deletes it. Returns an error if one occurs.
+func (c *FakeDeployments) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(deploymentsResource, c.ns, name), &v1beta1.Deployment{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+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
+}
+
+// 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, pt, data, subresources...), &v1beta1.Deployment{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Deployment), err
+}
+
+// GetScale takes name of the deployment, and returns the corresponding scale object, and an error if there is any.
+func (c *FakeDeployments) GetScale(deploymentName string, options v1.GetOptions) (result *v1beta1.Scale, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetSubresourceAction(deploymentsResource, c.ns, "scale", deploymentName), &v1beta1.Scale{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Scale), err
+}
+
+// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
+func (c *FakeDeployments) UpdateScale(deploymentName string, scale *v1beta1.Scale) (result *v1beta1.Scale, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(deploymentsResource, "scale", c.ns, scale), &v1beta1.Scale{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Scale), err
+}
--- /dev/null
+/*
+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 fake
+
+import (
+ "k8s.io/api/extensions/v1beta1"
+ core "k8s.io/client-go/testing"
+)
+
+func (c *FakeDeployments) Rollback(deploymentRollback *v1beta1.DeploymentRollback) error {
+ action := core.CreateActionImpl{}
+ action.Verb = "create"
+ action.Resource = deploymentsResource
+ action.Subresource = "rollback"
+ action.Object = deploymentRollback
+
+ _, err := c.Fake.Invokes(action, deploymentRollback)
+ return err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeExtensionsV1beta1 struct {
+ *testing.Fake
+}
+
+func (c *FakeExtensionsV1beta1) DaemonSets(namespace string) v1beta1.DaemonSetInterface {
+ return &FakeDaemonSets{c, namespace}
+}
+
+func (c *FakeExtensionsV1beta1) Deployments(namespace string) v1beta1.DeploymentInterface {
+ return &FakeDeployments{c, namespace}
+}
+
+func (c *FakeExtensionsV1beta1) Ingresses(namespace string) v1beta1.IngressInterface {
+ return &FakeIngresses{c, namespace}
+}
+
+func (c *FakeExtensionsV1beta1) PodSecurityPolicies() v1beta1.PodSecurityPolicyInterface {
+ return &FakePodSecurityPolicies{c}
+}
+
+func (c *FakeExtensionsV1beta1) ReplicaSets(namespace string) v1beta1.ReplicaSetInterface {
+ return &FakeReplicaSets{c, namespace}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeExtensionsV1beta1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/extensions/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"
+)
+
+// FakeIngresses implements IngressInterface
+type FakeIngresses struct {
+ Fake *FakeExtensionsV1beta1
+ ns string
+}
+
+var ingressesResource = schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "ingresses"}
+
+var ingressesKind = schema.GroupVersionKind{Group: "extensions", Version: "v1beta1", Kind: "Ingress"}
+
+// Get takes name of the ingress, and returns the corresponding ingress object, and an error if there is any.
+func (c *FakeIngresses) Get(name string, options v1.GetOptions) (result *v1beta1.Ingress, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(ingressesResource, c.ns, name), &v1beta1.Ingress{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Ingress), err
+}
+
+// List takes label and field selectors, and returns the list of Ingresses that match those selectors.
+func (c *FakeIngresses) List(opts v1.ListOptions) (result *v1beta1.IngressList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(ingressesResource, ingressesKind, c.ns, opts), &v1beta1.IngressList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta1.IngressList{ListMeta: obj.(*v1beta1.IngressList).ListMeta}
+ for _, item := range obj.(*v1beta1.IngressList).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 ingresses.
+func (c *FakeIngresses) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(ingressesResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a ingress and creates it. Returns the server's representation of the ingress, and an error, if there is any.
+func (c *FakeIngresses) Create(ingress *v1beta1.Ingress) (result *v1beta1.Ingress, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(ingressesResource, c.ns, ingress), &v1beta1.Ingress{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Ingress), err
+}
+
+// Update takes the representation of a ingress and updates it. Returns the server's representation of the ingress, and an error, if there is any.
+func (c *FakeIngresses) Update(ingress *v1beta1.Ingress) (result *v1beta1.Ingress, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(ingressesResource, c.ns, ingress), &v1beta1.Ingress{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Ingress), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeIngresses) UpdateStatus(ingress *v1beta1.Ingress) (*v1beta1.Ingress, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(ingressesResource, "status", c.ns, ingress), &v1beta1.Ingress{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Ingress), err
+}
+
+// Delete takes name of the ingress and deletes it. Returns an error if one occurs.
+func (c *FakeIngresses) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(ingressesResource, c.ns, name), &v1beta1.Ingress{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeIngresses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(ingressesResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta1.IngressList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched ingress.
+func (c *FakeIngresses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Ingress, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(ingressesResource, c.ns, name, pt, data, subresources...), &v1beta1.Ingress{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Ingress), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/extensions/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"
+)
+
+// FakePodSecurityPolicies implements PodSecurityPolicyInterface
+type FakePodSecurityPolicies struct {
+ Fake *FakeExtensionsV1beta1
+}
+
+var podsecuritypoliciesResource = schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "podsecuritypolicies"}
+
+var podsecuritypoliciesKind = schema.GroupVersionKind{Group: "extensions", Version: "v1beta1", Kind: "PodSecurityPolicy"}
+
+// Get takes name of the podSecurityPolicy, and returns the corresponding podSecurityPolicy object, and an error if there is any.
+func (c *FakePodSecurityPolicies) Get(name string, options v1.GetOptions) (result *v1beta1.PodSecurityPolicy, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(podsecuritypoliciesResource, name), &v1beta1.PodSecurityPolicy{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.PodSecurityPolicy), err
+}
+
+// List takes label and field selectors, and returns the list of PodSecurityPolicies that match those selectors.
+func (c *FakePodSecurityPolicies) List(opts v1.ListOptions) (result *v1beta1.PodSecurityPolicyList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(podsecuritypoliciesResource, podsecuritypoliciesKind, opts), &v1beta1.PodSecurityPolicyList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta1.PodSecurityPolicyList{ListMeta: obj.(*v1beta1.PodSecurityPolicyList).ListMeta}
+ for _, item := range obj.(*v1beta1.PodSecurityPolicyList).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 podSecurityPolicies.
+func (c *FakePodSecurityPolicies) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(podsecuritypoliciesResource, opts))
+}
+
+// Create takes the representation of a podSecurityPolicy and creates it. Returns the server's representation of the podSecurityPolicy, and an error, if there is any.
+func (c *FakePodSecurityPolicies) Create(podSecurityPolicy *v1beta1.PodSecurityPolicy) (result *v1beta1.PodSecurityPolicy, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(podsecuritypoliciesResource, podSecurityPolicy), &v1beta1.PodSecurityPolicy{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.PodSecurityPolicy), err
+}
+
+// Update takes the representation of a podSecurityPolicy and updates it. Returns the server's representation of the podSecurityPolicy, and an error, if there is any.
+func (c *FakePodSecurityPolicies) Update(podSecurityPolicy *v1beta1.PodSecurityPolicy) (result *v1beta1.PodSecurityPolicy, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(podsecuritypoliciesResource, podSecurityPolicy), &v1beta1.PodSecurityPolicy{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.PodSecurityPolicy), err
+}
+
+// Delete takes name of the podSecurityPolicy and deletes it. Returns an error if one occurs.
+func (c *FakePodSecurityPolicies) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(podsecuritypoliciesResource, name), &v1beta1.PodSecurityPolicy{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakePodSecurityPolicies) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(podsecuritypoliciesResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta1.PodSecurityPolicyList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched podSecurityPolicy.
+func (c *FakePodSecurityPolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.PodSecurityPolicy, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(podsecuritypoliciesResource, name, pt, data, subresources...), &v1beta1.PodSecurityPolicy{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.PodSecurityPolicy), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/extensions/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"
+)
+
+// FakeReplicaSets implements ReplicaSetInterface
+type FakeReplicaSets struct {
+ Fake *FakeExtensionsV1beta1
+ ns string
+}
+
+var replicasetsResource = schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "replicasets"}
+
+var replicasetsKind = schema.GroupVersionKind{Group: "extensions", Version: "v1beta1", Kind: "ReplicaSet"}
+
+// Get takes name of the replicaSet, and returns the corresponding replicaSet object, and an error if there is any.
+func (c *FakeReplicaSets) Get(name string, options v1.GetOptions) (result *v1beta1.ReplicaSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(replicasetsResource, c.ns, name), &v1beta1.ReplicaSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.ReplicaSet), err
+}
+
+// List takes label and field selectors, and returns the list of ReplicaSets that match those selectors.
+func (c *FakeReplicaSets) List(opts v1.ListOptions) (result *v1beta1.ReplicaSetList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(replicasetsResource, replicasetsKind, c.ns, opts), &v1beta1.ReplicaSetList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta1.ReplicaSetList{ListMeta: obj.(*v1beta1.ReplicaSetList).ListMeta}
+ for _, item := range obj.(*v1beta1.ReplicaSetList).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 replicaSets.
+func (c *FakeReplicaSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(replicasetsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a replicaSet and creates it. Returns the server's representation of the replicaSet, and an error, if there is any.
+func (c *FakeReplicaSets) Create(replicaSet *v1beta1.ReplicaSet) (result *v1beta1.ReplicaSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(replicasetsResource, c.ns, replicaSet), &v1beta1.ReplicaSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.ReplicaSet), err
+}
+
+// Update takes the representation of a replicaSet and updates it. Returns the server's representation of the replicaSet, and an error, if there is any.
+func (c *FakeReplicaSets) Update(replicaSet *v1beta1.ReplicaSet) (result *v1beta1.ReplicaSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(replicasetsResource, c.ns, replicaSet), &v1beta1.ReplicaSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.ReplicaSet), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeReplicaSets) UpdateStatus(replicaSet *v1beta1.ReplicaSet) (*v1beta1.ReplicaSet, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(replicasetsResource, "status", c.ns, replicaSet), &v1beta1.ReplicaSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.ReplicaSet), err
+}
+
+// Delete takes name of the replicaSet and deletes it. Returns an error if one occurs.
+func (c *FakeReplicaSets) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(replicasetsResource, c.ns, name), &v1beta1.ReplicaSet{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeReplicaSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(replicasetsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta1.ReplicaSetList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched replicaSet.
+func (c *FakeReplicaSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.ReplicaSet, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(replicasetsResource, c.ns, name, pt, data, subresources...), &v1beta1.ReplicaSet{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.ReplicaSet), err
+}
+
+// GetScale takes name of the replicaSet, and returns the corresponding scale object, and an error if there is any.
+func (c *FakeReplicaSets) GetScale(replicaSetName string, options v1.GetOptions) (result *v1beta1.Scale, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetSubresourceAction(replicasetsResource, c.ns, "scale", replicaSetName), &v1beta1.Scale{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Scale), err
+}
+
+// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
+func (c *FakeReplicaSets) UpdateScale(replicaSetName string, scale *v1beta1.Scale) (result *v1beta1.Scale, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(replicasetsResource, "scale", c.ns, scale), &v1beta1.Scale{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Scale), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1 "k8s.io/client-go/kubernetes/typed/networking/v1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeNetworkingV1 struct {
+ *testing.Fake
+}
+
+func (c *FakeNetworkingV1) NetworkPolicies(namespace string) v1.NetworkPolicyInterface {
+ return &FakeNetworkPolicies{c, namespace}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeNetworkingV1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ networkingv1 "k8s.io/api/networking/v1"
+ 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"
+)
+
+// FakeNetworkPolicies implements NetworkPolicyInterface
+type FakeNetworkPolicies struct {
+ Fake *FakeNetworkingV1
+ ns string
+}
+
+var networkpoliciesResource = schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1", Resource: "networkpolicies"}
+
+var networkpoliciesKind = schema.GroupVersionKind{Group: "networking.k8s.io", Version: "v1", Kind: "NetworkPolicy"}
+
+// Get takes name of the networkPolicy, and returns the corresponding networkPolicy object, and an error if there is any.
+func (c *FakeNetworkPolicies) Get(name string, options v1.GetOptions) (result *networkingv1.NetworkPolicy, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(networkpoliciesResource, c.ns, name), &networkingv1.NetworkPolicy{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*networkingv1.NetworkPolicy), err
+}
+
+// List takes label and field selectors, and returns the list of NetworkPolicies that match those selectors.
+func (c *FakeNetworkPolicies) List(opts v1.ListOptions) (result *networkingv1.NetworkPolicyList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(networkpoliciesResource, networkpoliciesKind, c.ns, opts), &networkingv1.NetworkPolicyList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &networkingv1.NetworkPolicyList{ListMeta: obj.(*networkingv1.NetworkPolicyList).ListMeta}
+ for _, item := range obj.(*networkingv1.NetworkPolicyList).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 networkPolicies.
+func (c *FakeNetworkPolicies) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(networkpoliciesResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a networkPolicy and creates it. Returns the server's representation of the networkPolicy, and an error, if there is any.
+func (c *FakeNetworkPolicies) Create(networkPolicy *networkingv1.NetworkPolicy) (result *networkingv1.NetworkPolicy, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(networkpoliciesResource, c.ns, networkPolicy), &networkingv1.NetworkPolicy{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*networkingv1.NetworkPolicy), err
+}
+
+// Update takes the representation of a networkPolicy and updates it. Returns the server's representation of the networkPolicy, and an error, if there is any.
+func (c *FakeNetworkPolicies) Update(networkPolicy *networkingv1.NetworkPolicy) (result *networkingv1.NetworkPolicy, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(networkpoliciesResource, c.ns, networkPolicy), &networkingv1.NetworkPolicy{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*networkingv1.NetworkPolicy), err
+}
+
+// Delete takes name of the networkPolicy and deletes it. Returns an error if one occurs.
+func (c *FakeNetworkPolicies) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(networkpoliciesResource, c.ns, name), &networkingv1.NetworkPolicy{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeNetworkPolicies) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(networkpoliciesResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &networkingv1.NetworkPolicyList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched networkPolicy.
+func (c *FakeNetworkPolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *networkingv1.NetworkPolicy, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(networkpoliciesResource, c.ns, name, pt, data, subresources...), &networkingv1.NetworkPolicy{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*networkingv1.NetworkPolicy), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+// FakeEvictions implements EvictionInterface
+type FakeEvictions struct {
+ Fake *FakePolicyV1beta1
+ ns string
+}
--- /dev/null
+/*
+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 (
+ policy "k8s.io/api/policy/v1beta1"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ core "k8s.io/client-go/testing"
+)
+
+func (c *FakeEvictions) Evict(eviction *policy.Eviction) error {
+ action := core.GetActionImpl{}
+ action.Verb = "post"
+ action.Namespace = c.ns
+ action.Resource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"}
+ action.Subresource = "eviction"
+ action.Name = eviction.Name
+ _, err := c.Fake.Invokes(action, eviction)
+ return err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/policy/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"
+)
+
+// FakePodDisruptionBudgets implements PodDisruptionBudgetInterface
+type FakePodDisruptionBudgets struct {
+ Fake *FakePolicyV1beta1
+ ns string
+}
+
+var poddisruptionbudgetsResource = schema.GroupVersionResource{Group: "policy", Version: "v1beta1", Resource: "poddisruptionbudgets"}
+
+var poddisruptionbudgetsKind = schema.GroupVersionKind{Group: "policy", Version: "v1beta1", Kind: "PodDisruptionBudget"}
+
+// Get takes name of the podDisruptionBudget, and returns the corresponding podDisruptionBudget object, and an error if there is any.
+func (c *FakePodDisruptionBudgets) Get(name string, options v1.GetOptions) (result *v1beta1.PodDisruptionBudget, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(poddisruptionbudgetsResource, c.ns, name), &v1beta1.PodDisruptionBudget{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.PodDisruptionBudget), err
+}
+
+// List takes label and field selectors, and returns the list of PodDisruptionBudgets that match those selectors.
+func (c *FakePodDisruptionBudgets) List(opts v1.ListOptions) (result *v1beta1.PodDisruptionBudgetList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(poddisruptionbudgetsResource, poddisruptionbudgetsKind, c.ns, opts), &v1beta1.PodDisruptionBudgetList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta1.PodDisruptionBudgetList{ListMeta: obj.(*v1beta1.PodDisruptionBudgetList).ListMeta}
+ for _, item := range obj.(*v1beta1.PodDisruptionBudgetList).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 podDisruptionBudgets.
+func (c *FakePodDisruptionBudgets) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(poddisruptionbudgetsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a podDisruptionBudget and creates it. Returns the server's representation of the podDisruptionBudget, and an error, if there is any.
+func (c *FakePodDisruptionBudgets) Create(podDisruptionBudget *v1beta1.PodDisruptionBudget) (result *v1beta1.PodDisruptionBudget, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(poddisruptionbudgetsResource, c.ns, podDisruptionBudget), &v1beta1.PodDisruptionBudget{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.PodDisruptionBudget), err
+}
+
+// Update takes the representation of a podDisruptionBudget and updates it. Returns the server's representation of the podDisruptionBudget, and an error, if there is any.
+func (c *FakePodDisruptionBudgets) Update(podDisruptionBudget *v1beta1.PodDisruptionBudget) (result *v1beta1.PodDisruptionBudget, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(poddisruptionbudgetsResource, c.ns, podDisruptionBudget), &v1beta1.PodDisruptionBudget{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.PodDisruptionBudget), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakePodDisruptionBudgets) UpdateStatus(podDisruptionBudget *v1beta1.PodDisruptionBudget) (*v1beta1.PodDisruptionBudget, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(poddisruptionbudgetsResource, "status", c.ns, podDisruptionBudget), &v1beta1.PodDisruptionBudget{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.PodDisruptionBudget), err
+}
+
+// Delete takes name of the podDisruptionBudget and deletes it. Returns an error if one occurs.
+func (c *FakePodDisruptionBudgets) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(poddisruptionbudgetsResource, c.ns, name), &v1beta1.PodDisruptionBudget{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakePodDisruptionBudgets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(poddisruptionbudgetsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta1.PodDisruptionBudgetList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched podDisruptionBudget.
+func (c *FakePodDisruptionBudgets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.PodDisruptionBudget, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(poddisruptionbudgetsResource, c.ns, name, pt, data, subresources...), &v1beta1.PodDisruptionBudget{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.PodDisruptionBudget), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/policy/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"
+)
+
+// FakePodSecurityPolicies implements PodSecurityPolicyInterface
+type FakePodSecurityPolicies struct {
+ Fake *FakePolicyV1beta1
+}
+
+var podsecuritypoliciesResource = schema.GroupVersionResource{Group: "policy", Version: "v1beta1", Resource: "podsecuritypolicies"}
+
+var podsecuritypoliciesKind = schema.GroupVersionKind{Group: "policy", Version: "v1beta1", Kind: "PodSecurityPolicy"}
+
+// Get takes name of the podSecurityPolicy, and returns the corresponding podSecurityPolicy object, and an error if there is any.
+func (c *FakePodSecurityPolicies) Get(name string, options v1.GetOptions) (result *v1beta1.PodSecurityPolicy, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(podsecuritypoliciesResource, name), &v1beta1.PodSecurityPolicy{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.PodSecurityPolicy), err
+}
+
+// List takes label and field selectors, and returns the list of PodSecurityPolicies that match those selectors.
+func (c *FakePodSecurityPolicies) List(opts v1.ListOptions) (result *v1beta1.PodSecurityPolicyList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(podsecuritypoliciesResource, podsecuritypoliciesKind, opts), &v1beta1.PodSecurityPolicyList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta1.PodSecurityPolicyList{ListMeta: obj.(*v1beta1.PodSecurityPolicyList).ListMeta}
+ for _, item := range obj.(*v1beta1.PodSecurityPolicyList).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 podSecurityPolicies.
+func (c *FakePodSecurityPolicies) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(podsecuritypoliciesResource, opts))
+}
+
+// Create takes the representation of a podSecurityPolicy and creates it. Returns the server's representation of the podSecurityPolicy, and an error, if there is any.
+func (c *FakePodSecurityPolicies) Create(podSecurityPolicy *v1beta1.PodSecurityPolicy) (result *v1beta1.PodSecurityPolicy, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(podsecuritypoliciesResource, podSecurityPolicy), &v1beta1.PodSecurityPolicy{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.PodSecurityPolicy), err
+}
+
+// Update takes the representation of a podSecurityPolicy and updates it. Returns the server's representation of the podSecurityPolicy, and an error, if there is any.
+func (c *FakePodSecurityPolicies) Update(podSecurityPolicy *v1beta1.PodSecurityPolicy) (result *v1beta1.PodSecurityPolicy, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(podsecuritypoliciesResource, podSecurityPolicy), &v1beta1.PodSecurityPolicy{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.PodSecurityPolicy), err
+}
+
+// Delete takes name of the podSecurityPolicy and deletes it. Returns an error if one occurs.
+func (c *FakePodSecurityPolicies) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(podsecuritypoliciesResource, name), &v1beta1.PodSecurityPolicy{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakePodSecurityPolicies) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(podsecuritypoliciesResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta1.PodSecurityPolicyList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched podSecurityPolicy.
+func (c *FakePodSecurityPolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.PodSecurityPolicy, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(podsecuritypoliciesResource, name, pt, data, subresources...), &v1beta1.PodSecurityPolicy{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.PodSecurityPolicy), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakePolicyV1beta1 struct {
+ *testing.Fake
+}
+
+func (c *FakePolicyV1beta1) Evictions(namespace string) v1beta1.EvictionInterface {
+ return &FakeEvictions{c, namespace}
+}
+
+func (c *FakePolicyV1beta1) PodDisruptionBudgets(namespace string) v1beta1.PodDisruptionBudgetInterface {
+ return &FakePodDisruptionBudgets{c, namespace}
+}
+
+func (c *FakePolicyV1beta1) PodSecurityPolicies() v1beta1.PodSecurityPolicyInterface {
+ return &FakePodSecurityPolicies{c}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakePolicyV1beta1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ rbacv1 "k8s.io/api/rbac/v1"
+ 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"
+)
+
+// FakeClusterRoles implements ClusterRoleInterface
+type FakeClusterRoles struct {
+ Fake *FakeRbacV1
+}
+
+var clusterrolesResource = schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1", Resource: "clusterroles"}
+
+var clusterrolesKind = schema.GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1", Kind: "ClusterRole"}
+
+// Get takes name of the clusterRole, and returns the corresponding clusterRole object, and an error if there is any.
+func (c *FakeClusterRoles) Get(name string, options v1.GetOptions) (result *rbacv1.ClusterRole, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(clusterrolesResource, name), &rbacv1.ClusterRole{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*rbacv1.ClusterRole), err
+}
+
+// List takes label and field selectors, and returns the list of ClusterRoles that match those selectors.
+func (c *FakeClusterRoles) List(opts v1.ListOptions) (result *rbacv1.ClusterRoleList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(clusterrolesResource, clusterrolesKind, opts), &rbacv1.ClusterRoleList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &rbacv1.ClusterRoleList{ListMeta: obj.(*rbacv1.ClusterRoleList).ListMeta}
+ for _, item := range obj.(*rbacv1.ClusterRoleList).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 clusterRoles.
+func (c *FakeClusterRoles) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(clusterrolesResource, opts))
+}
+
+// Create takes the representation of a clusterRole and creates it. Returns the server's representation of the clusterRole, and an error, if there is any.
+func (c *FakeClusterRoles) Create(clusterRole *rbacv1.ClusterRole) (result *rbacv1.ClusterRole, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(clusterrolesResource, clusterRole), &rbacv1.ClusterRole{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*rbacv1.ClusterRole), err
+}
+
+// Update takes the representation of a clusterRole and updates it. Returns the server's representation of the clusterRole, and an error, if there is any.
+func (c *FakeClusterRoles) Update(clusterRole *rbacv1.ClusterRole) (result *rbacv1.ClusterRole, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(clusterrolesResource, clusterRole), &rbacv1.ClusterRole{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*rbacv1.ClusterRole), err
+}
+
+// Delete takes name of the clusterRole and deletes it. Returns an error if one occurs.
+func (c *FakeClusterRoles) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(clusterrolesResource, name), &rbacv1.ClusterRole{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeClusterRoles) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(clusterrolesResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &rbacv1.ClusterRoleList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched clusterRole.
+func (c *FakeClusterRoles) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *rbacv1.ClusterRole, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(clusterrolesResource, name, pt, data, subresources...), &rbacv1.ClusterRole{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*rbacv1.ClusterRole), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ rbacv1 "k8s.io/api/rbac/v1"
+ 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"
+)
+
+// FakeClusterRoleBindings implements ClusterRoleBindingInterface
+type FakeClusterRoleBindings struct {
+ Fake *FakeRbacV1
+}
+
+var clusterrolebindingsResource = schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1", Resource: "clusterrolebindings"}
+
+var clusterrolebindingsKind = schema.GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1", Kind: "ClusterRoleBinding"}
+
+// Get takes name of the clusterRoleBinding, and returns the corresponding clusterRoleBinding object, and an error if there is any.
+func (c *FakeClusterRoleBindings) Get(name string, options v1.GetOptions) (result *rbacv1.ClusterRoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(clusterrolebindingsResource, name), &rbacv1.ClusterRoleBinding{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*rbacv1.ClusterRoleBinding), err
+}
+
+// List takes label and field selectors, and returns the list of ClusterRoleBindings that match those selectors.
+func (c *FakeClusterRoleBindings) List(opts v1.ListOptions) (result *rbacv1.ClusterRoleBindingList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(clusterrolebindingsResource, clusterrolebindingsKind, opts), &rbacv1.ClusterRoleBindingList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &rbacv1.ClusterRoleBindingList{ListMeta: obj.(*rbacv1.ClusterRoleBindingList).ListMeta}
+ for _, item := range obj.(*rbacv1.ClusterRoleBindingList).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 clusterRoleBindings.
+func (c *FakeClusterRoleBindings) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(clusterrolebindingsResource, opts))
+}
+
+// Create takes the representation of a clusterRoleBinding and creates it. Returns the server's representation of the clusterRoleBinding, and an error, if there is any.
+func (c *FakeClusterRoleBindings) Create(clusterRoleBinding *rbacv1.ClusterRoleBinding) (result *rbacv1.ClusterRoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(clusterrolebindingsResource, clusterRoleBinding), &rbacv1.ClusterRoleBinding{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*rbacv1.ClusterRoleBinding), err
+}
+
+// Update takes the representation of a clusterRoleBinding and updates it. Returns the server's representation of the clusterRoleBinding, and an error, if there is any.
+func (c *FakeClusterRoleBindings) Update(clusterRoleBinding *rbacv1.ClusterRoleBinding) (result *rbacv1.ClusterRoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(clusterrolebindingsResource, clusterRoleBinding), &rbacv1.ClusterRoleBinding{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*rbacv1.ClusterRoleBinding), err
+}
+
+// Delete takes name of the clusterRoleBinding and deletes it. Returns an error if one occurs.
+func (c *FakeClusterRoleBindings) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(clusterrolebindingsResource, name), &rbacv1.ClusterRoleBinding{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeClusterRoleBindings) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(clusterrolebindingsResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &rbacv1.ClusterRoleBindingList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched clusterRoleBinding.
+func (c *FakeClusterRoleBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *rbacv1.ClusterRoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(clusterrolebindingsResource, name, pt, data, subresources...), &rbacv1.ClusterRoleBinding{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*rbacv1.ClusterRoleBinding), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1 "k8s.io/client-go/kubernetes/typed/rbac/v1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeRbacV1 struct {
+ *testing.Fake
+}
+
+func (c *FakeRbacV1) ClusterRoles() v1.ClusterRoleInterface {
+ return &FakeClusterRoles{c}
+}
+
+func (c *FakeRbacV1) ClusterRoleBindings() v1.ClusterRoleBindingInterface {
+ return &FakeClusterRoleBindings{c}
+}
+
+func (c *FakeRbacV1) Roles(namespace string) v1.RoleInterface {
+ return &FakeRoles{c, namespace}
+}
+
+func (c *FakeRbacV1) RoleBindings(namespace string) v1.RoleBindingInterface {
+ return &FakeRoleBindings{c, namespace}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeRbacV1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ rbacv1 "k8s.io/api/rbac/v1"
+ 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"
+)
+
+// FakeRoles implements RoleInterface
+type FakeRoles struct {
+ Fake *FakeRbacV1
+ ns string
+}
+
+var rolesResource = schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1", Resource: "roles"}
+
+var rolesKind = schema.GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1", Kind: "Role"}
+
+// Get takes name of the role, and returns the corresponding role object, and an error if there is any.
+func (c *FakeRoles) Get(name string, options v1.GetOptions) (result *rbacv1.Role, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(rolesResource, c.ns, name), &rbacv1.Role{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*rbacv1.Role), err
+}
+
+// List takes label and field selectors, and returns the list of Roles that match those selectors.
+func (c *FakeRoles) List(opts v1.ListOptions) (result *rbacv1.RoleList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(rolesResource, rolesKind, c.ns, opts), &rbacv1.RoleList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &rbacv1.RoleList{ListMeta: obj.(*rbacv1.RoleList).ListMeta}
+ for _, item := range obj.(*rbacv1.RoleList).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 roles.
+func (c *FakeRoles) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(rolesResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a role and creates it. Returns the server's representation of the role, and an error, if there is any.
+func (c *FakeRoles) Create(role *rbacv1.Role) (result *rbacv1.Role, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(rolesResource, c.ns, role), &rbacv1.Role{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*rbacv1.Role), err
+}
+
+// Update takes the representation of a role and updates it. Returns the server's representation of the role, and an error, if there is any.
+func (c *FakeRoles) Update(role *rbacv1.Role) (result *rbacv1.Role, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(rolesResource, c.ns, role), &rbacv1.Role{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*rbacv1.Role), err
+}
+
+// Delete takes name of the role and deletes it. Returns an error if one occurs.
+func (c *FakeRoles) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(rolesResource, c.ns, name), &rbacv1.Role{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeRoles) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(rolesResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &rbacv1.RoleList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched role.
+func (c *FakeRoles) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *rbacv1.Role, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(rolesResource, c.ns, name, pt, data, subresources...), &rbacv1.Role{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*rbacv1.Role), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ rbacv1 "k8s.io/api/rbac/v1"
+ 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"
+)
+
+// FakeRoleBindings implements RoleBindingInterface
+type FakeRoleBindings struct {
+ Fake *FakeRbacV1
+ ns string
+}
+
+var rolebindingsResource = schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1", Resource: "rolebindings"}
+
+var rolebindingsKind = schema.GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1", Kind: "RoleBinding"}
+
+// Get takes name of the roleBinding, and returns the corresponding roleBinding object, and an error if there is any.
+func (c *FakeRoleBindings) Get(name string, options v1.GetOptions) (result *rbacv1.RoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(rolebindingsResource, c.ns, name), &rbacv1.RoleBinding{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*rbacv1.RoleBinding), err
+}
+
+// List takes label and field selectors, and returns the list of RoleBindings that match those selectors.
+func (c *FakeRoleBindings) List(opts v1.ListOptions) (result *rbacv1.RoleBindingList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(rolebindingsResource, rolebindingsKind, c.ns, opts), &rbacv1.RoleBindingList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &rbacv1.RoleBindingList{ListMeta: obj.(*rbacv1.RoleBindingList).ListMeta}
+ for _, item := range obj.(*rbacv1.RoleBindingList).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 roleBindings.
+func (c *FakeRoleBindings) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(rolebindingsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a roleBinding and creates it. Returns the server's representation of the roleBinding, and an error, if there is any.
+func (c *FakeRoleBindings) Create(roleBinding *rbacv1.RoleBinding) (result *rbacv1.RoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(rolebindingsResource, c.ns, roleBinding), &rbacv1.RoleBinding{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*rbacv1.RoleBinding), err
+}
+
+// Update takes the representation of a roleBinding and updates it. Returns the server's representation of the roleBinding, and an error, if there is any.
+func (c *FakeRoleBindings) Update(roleBinding *rbacv1.RoleBinding) (result *rbacv1.RoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(rolebindingsResource, c.ns, roleBinding), &rbacv1.RoleBinding{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*rbacv1.RoleBinding), err
+}
+
+// Delete takes name of the roleBinding and deletes it. Returns an error if one occurs.
+func (c *FakeRoleBindings) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(rolebindingsResource, c.ns, name), &rbacv1.RoleBinding{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeRoleBindings) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(rolebindingsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &rbacv1.RoleBindingList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched roleBinding.
+func (c *FakeRoleBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *rbacv1.RoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(rolebindingsResource, c.ns, name, pt, data, subresources...), &rbacv1.RoleBinding{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*rbacv1.RoleBinding), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1alpha1 "k8s.io/api/rbac/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"
+)
+
+// FakeClusterRoles implements ClusterRoleInterface
+type FakeClusterRoles struct {
+ Fake *FakeRbacV1alpha1
+}
+
+var clusterrolesResource = schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Resource: "clusterroles"}
+
+var clusterrolesKind = schema.GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Kind: "ClusterRole"}
+
+// Get takes name of the clusterRole, and returns the corresponding clusterRole object, and an error if there is any.
+func (c *FakeClusterRoles) Get(name string, options v1.GetOptions) (result *v1alpha1.ClusterRole, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(clusterrolesResource, name), &v1alpha1.ClusterRole{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.ClusterRole), err
+}
+
+// List takes label and field selectors, and returns the list of ClusterRoles that match those selectors.
+func (c *FakeClusterRoles) List(opts v1.ListOptions) (result *v1alpha1.ClusterRoleList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(clusterrolesResource, clusterrolesKind, opts), &v1alpha1.ClusterRoleList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1alpha1.ClusterRoleList{ListMeta: obj.(*v1alpha1.ClusterRoleList).ListMeta}
+ for _, item := range obj.(*v1alpha1.ClusterRoleList).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 clusterRoles.
+func (c *FakeClusterRoles) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(clusterrolesResource, opts))
+}
+
+// Create takes the representation of a clusterRole and creates it. Returns the server's representation of the clusterRole, and an error, if there is any.
+func (c *FakeClusterRoles) Create(clusterRole *v1alpha1.ClusterRole) (result *v1alpha1.ClusterRole, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(clusterrolesResource, clusterRole), &v1alpha1.ClusterRole{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.ClusterRole), err
+}
+
+// Update takes the representation of a clusterRole and updates it. Returns the server's representation of the clusterRole, and an error, if there is any.
+func (c *FakeClusterRoles) Update(clusterRole *v1alpha1.ClusterRole) (result *v1alpha1.ClusterRole, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(clusterrolesResource, clusterRole), &v1alpha1.ClusterRole{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.ClusterRole), err
+}
+
+// Delete takes name of the clusterRole and deletes it. Returns an error if one occurs.
+func (c *FakeClusterRoles) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(clusterrolesResource, name), &v1alpha1.ClusterRole{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeClusterRoles) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(clusterrolesResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1alpha1.ClusterRoleList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched clusterRole.
+func (c *FakeClusterRoles) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ClusterRole, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(clusterrolesResource, name, pt, data, subresources...), &v1alpha1.ClusterRole{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.ClusterRole), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1alpha1 "k8s.io/api/rbac/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"
+)
+
+// FakeClusterRoleBindings implements ClusterRoleBindingInterface
+type FakeClusterRoleBindings struct {
+ Fake *FakeRbacV1alpha1
+}
+
+var clusterrolebindingsResource = schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Resource: "clusterrolebindings"}
+
+var clusterrolebindingsKind = schema.GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Kind: "ClusterRoleBinding"}
+
+// Get takes name of the clusterRoleBinding, and returns the corresponding clusterRoleBinding object, and an error if there is any.
+func (c *FakeClusterRoleBindings) Get(name string, options v1.GetOptions) (result *v1alpha1.ClusterRoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(clusterrolebindingsResource, name), &v1alpha1.ClusterRoleBinding{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.ClusterRoleBinding), err
+}
+
+// List takes label and field selectors, and returns the list of ClusterRoleBindings that match those selectors.
+func (c *FakeClusterRoleBindings) List(opts v1.ListOptions) (result *v1alpha1.ClusterRoleBindingList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(clusterrolebindingsResource, clusterrolebindingsKind, opts), &v1alpha1.ClusterRoleBindingList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1alpha1.ClusterRoleBindingList{ListMeta: obj.(*v1alpha1.ClusterRoleBindingList).ListMeta}
+ for _, item := range obj.(*v1alpha1.ClusterRoleBindingList).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 clusterRoleBindings.
+func (c *FakeClusterRoleBindings) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(clusterrolebindingsResource, opts))
+}
+
+// Create takes the representation of a clusterRoleBinding and creates it. Returns the server's representation of the clusterRoleBinding, and an error, if there is any.
+func (c *FakeClusterRoleBindings) Create(clusterRoleBinding *v1alpha1.ClusterRoleBinding) (result *v1alpha1.ClusterRoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(clusterrolebindingsResource, clusterRoleBinding), &v1alpha1.ClusterRoleBinding{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.ClusterRoleBinding), err
+}
+
+// Update takes the representation of a clusterRoleBinding and updates it. Returns the server's representation of the clusterRoleBinding, and an error, if there is any.
+func (c *FakeClusterRoleBindings) Update(clusterRoleBinding *v1alpha1.ClusterRoleBinding) (result *v1alpha1.ClusterRoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(clusterrolebindingsResource, clusterRoleBinding), &v1alpha1.ClusterRoleBinding{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.ClusterRoleBinding), err
+}
+
+// Delete takes name of the clusterRoleBinding and deletes it. Returns an error if one occurs.
+func (c *FakeClusterRoleBindings) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(clusterrolebindingsResource, name), &v1alpha1.ClusterRoleBinding{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeClusterRoleBindings) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(clusterrolebindingsResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1alpha1.ClusterRoleBindingList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched clusterRoleBinding.
+func (c *FakeClusterRoleBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ClusterRoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(clusterrolebindingsResource, name, pt, data, subresources...), &v1alpha1.ClusterRoleBinding{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.ClusterRoleBinding), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1alpha1 "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeRbacV1alpha1 struct {
+ *testing.Fake
+}
+
+func (c *FakeRbacV1alpha1) ClusterRoles() v1alpha1.ClusterRoleInterface {
+ return &FakeClusterRoles{c}
+}
+
+func (c *FakeRbacV1alpha1) ClusterRoleBindings() v1alpha1.ClusterRoleBindingInterface {
+ return &FakeClusterRoleBindings{c}
+}
+
+func (c *FakeRbacV1alpha1) Roles(namespace string) v1alpha1.RoleInterface {
+ return &FakeRoles{c, namespace}
+}
+
+func (c *FakeRbacV1alpha1) RoleBindings(namespace string) v1alpha1.RoleBindingInterface {
+ return &FakeRoleBindings{c, namespace}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeRbacV1alpha1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1alpha1 "k8s.io/api/rbac/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"
+)
+
+// FakeRoles implements RoleInterface
+type FakeRoles struct {
+ Fake *FakeRbacV1alpha1
+ ns string
+}
+
+var rolesResource = schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Resource: "roles"}
+
+var rolesKind = schema.GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Kind: "Role"}
+
+// Get takes name of the role, and returns the corresponding role object, and an error if there is any.
+func (c *FakeRoles) Get(name string, options v1.GetOptions) (result *v1alpha1.Role, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(rolesResource, c.ns, name), &v1alpha1.Role{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.Role), err
+}
+
+// List takes label and field selectors, and returns the list of Roles that match those selectors.
+func (c *FakeRoles) List(opts v1.ListOptions) (result *v1alpha1.RoleList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(rolesResource, rolesKind, c.ns, opts), &v1alpha1.RoleList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1alpha1.RoleList{ListMeta: obj.(*v1alpha1.RoleList).ListMeta}
+ for _, item := range obj.(*v1alpha1.RoleList).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 roles.
+func (c *FakeRoles) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(rolesResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a role and creates it. Returns the server's representation of the role, and an error, if there is any.
+func (c *FakeRoles) Create(role *v1alpha1.Role) (result *v1alpha1.Role, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(rolesResource, c.ns, role), &v1alpha1.Role{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.Role), err
+}
+
+// Update takes the representation of a role and updates it. Returns the server's representation of the role, and an error, if there is any.
+func (c *FakeRoles) Update(role *v1alpha1.Role) (result *v1alpha1.Role, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(rolesResource, c.ns, role), &v1alpha1.Role{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.Role), err
+}
+
+// Delete takes name of the role and deletes it. Returns an error if one occurs.
+func (c *FakeRoles) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(rolesResource, c.ns, name), &v1alpha1.Role{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeRoles) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(rolesResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1alpha1.RoleList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched role.
+func (c *FakeRoles) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Role, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(rolesResource, c.ns, name, pt, data, subresources...), &v1alpha1.Role{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.Role), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1alpha1 "k8s.io/api/rbac/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"
+)
+
+// FakeRoleBindings implements RoleBindingInterface
+type FakeRoleBindings struct {
+ Fake *FakeRbacV1alpha1
+ ns string
+}
+
+var rolebindingsResource = schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Resource: "rolebindings"}
+
+var rolebindingsKind = schema.GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Kind: "RoleBinding"}
+
+// Get takes name of the roleBinding, and returns the corresponding roleBinding object, and an error if there is any.
+func (c *FakeRoleBindings) Get(name string, options v1.GetOptions) (result *v1alpha1.RoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(rolebindingsResource, c.ns, name), &v1alpha1.RoleBinding{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.RoleBinding), err
+}
+
+// List takes label and field selectors, and returns the list of RoleBindings that match those selectors.
+func (c *FakeRoleBindings) List(opts v1.ListOptions) (result *v1alpha1.RoleBindingList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(rolebindingsResource, rolebindingsKind, c.ns, opts), &v1alpha1.RoleBindingList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1alpha1.RoleBindingList{ListMeta: obj.(*v1alpha1.RoleBindingList).ListMeta}
+ for _, item := range obj.(*v1alpha1.RoleBindingList).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 roleBindings.
+func (c *FakeRoleBindings) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(rolebindingsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a roleBinding and creates it. Returns the server's representation of the roleBinding, and an error, if there is any.
+func (c *FakeRoleBindings) Create(roleBinding *v1alpha1.RoleBinding) (result *v1alpha1.RoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(rolebindingsResource, c.ns, roleBinding), &v1alpha1.RoleBinding{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.RoleBinding), err
+}
+
+// Update takes the representation of a roleBinding and updates it. Returns the server's representation of the roleBinding, and an error, if there is any.
+func (c *FakeRoleBindings) Update(roleBinding *v1alpha1.RoleBinding) (result *v1alpha1.RoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(rolebindingsResource, c.ns, roleBinding), &v1alpha1.RoleBinding{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.RoleBinding), err
+}
+
+// Delete takes name of the roleBinding and deletes it. Returns an error if one occurs.
+func (c *FakeRoleBindings) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(rolebindingsResource, c.ns, name), &v1alpha1.RoleBinding{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeRoleBindings) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(rolebindingsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1alpha1.RoleBindingList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched roleBinding.
+func (c *FakeRoleBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.RoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(rolebindingsResource, c.ns, name, pt, data, subresources...), &v1alpha1.RoleBinding{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.RoleBinding), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/rbac/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"
+)
+
+// FakeClusterRoles implements ClusterRoleInterface
+type FakeClusterRoles struct {
+ Fake *FakeRbacV1beta1
+}
+
+var clusterrolesResource = schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Resource: "clusterroles"}
+
+var clusterrolesKind = schema.GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Kind: "ClusterRole"}
+
+// Get takes name of the clusterRole, and returns the corresponding clusterRole object, and an error if there is any.
+func (c *FakeClusterRoles) Get(name string, options v1.GetOptions) (result *v1beta1.ClusterRole, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(clusterrolesResource, name), &v1beta1.ClusterRole{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.ClusterRole), err
+}
+
+// List takes label and field selectors, and returns the list of ClusterRoles that match those selectors.
+func (c *FakeClusterRoles) List(opts v1.ListOptions) (result *v1beta1.ClusterRoleList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(clusterrolesResource, clusterrolesKind, opts), &v1beta1.ClusterRoleList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta1.ClusterRoleList{ListMeta: obj.(*v1beta1.ClusterRoleList).ListMeta}
+ for _, item := range obj.(*v1beta1.ClusterRoleList).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 clusterRoles.
+func (c *FakeClusterRoles) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(clusterrolesResource, opts))
+}
+
+// Create takes the representation of a clusterRole and creates it. Returns the server's representation of the clusterRole, and an error, if there is any.
+func (c *FakeClusterRoles) Create(clusterRole *v1beta1.ClusterRole) (result *v1beta1.ClusterRole, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(clusterrolesResource, clusterRole), &v1beta1.ClusterRole{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.ClusterRole), err
+}
+
+// Update takes the representation of a clusterRole and updates it. Returns the server's representation of the clusterRole, and an error, if there is any.
+func (c *FakeClusterRoles) Update(clusterRole *v1beta1.ClusterRole) (result *v1beta1.ClusterRole, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(clusterrolesResource, clusterRole), &v1beta1.ClusterRole{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.ClusterRole), err
+}
+
+// Delete takes name of the clusterRole and deletes it. Returns an error if one occurs.
+func (c *FakeClusterRoles) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(clusterrolesResource, name), &v1beta1.ClusterRole{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeClusterRoles) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(clusterrolesResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta1.ClusterRoleList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched clusterRole.
+func (c *FakeClusterRoles) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.ClusterRole, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(clusterrolesResource, name, pt, data, subresources...), &v1beta1.ClusterRole{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.ClusterRole), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/rbac/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"
+)
+
+// FakeClusterRoleBindings implements ClusterRoleBindingInterface
+type FakeClusterRoleBindings struct {
+ Fake *FakeRbacV1beta1
+}
+
+var clusterrolebindingsResource = schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Resource: "clusterrolebindings"}
+
+var clusterrolebindingsKind = schema.GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Kind: "ClusterRoleBinding"}
+
+// Get takes name of the clusterRoleBinding, and returns the corresponding clusterRoleBinding object, and an error if there is any.
+func (c *FakeClusterRoleBindings) Get(name string, options v1.GetOptions) (result *v1beta1.ClusterRoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(clusterrolebindingsResource, name), &v1beta1.ClusterRoleBinding{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.ClusterRoleBinding), err
+}
+
+// List takes label and field selectors, and returns the list of ClusterRoleBindings that match those selectors.
+func (c *FakeClusterRoleBindings) List(opts v1.ListOptions) (result *v1beta1.ClusterRoleBindingList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(clusterrolebindingsResource, clusterrolebindingsKind, opts), &v1beta1.ClusterRoleBindingList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta1.ClusterRoleBindingList{ListMeta: obj.(*v1beta1.ClusterRoleBindingList).ListMeta}
+ for _, item := range obj.(*v1beta1.ClusterRoleBindingList).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 clusterRoleBindings.
+func (c *FakeClusterRoleBindings) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(clusterrolebindingsResource, opts))
+}
+
+// Create takes the representation of a clusterRoleBinding and creates it. Returns the server's representation of the clusterRoleBinding, and an error, if there is any.
+func (c *FakeClusterRoleBindings) Create(clusterRoleBinding *v1beta1.ClusterRoleBinding) (result *v1beta1.ClusterRoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(clusterrolebindingsResource, clusterRoleBinding), &v1beta1.ClusterRoleBinding{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.ClusterRoleBinding), err
+}
+
+// Update takes the representation of a clusterRoleBinding and updates it. Returns the server's representation of the clusterRoleBinding, and an error, if there is any.
+func (c *FakeClusterRoleBindings) Update(clusterRoleBinding *v1beta1.ClusterRoleBinding) (result *v1beta1.ClusterRoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(clusterrolebindingsResource, clusterRoleBinding), &v1beta1.ClusterRoleBinding{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.ClusterRoleBinding), err
+}
+
+// Delete takes name of the clusterRoleBinding and deletes it. Returns an error if one occurs.
+func (c *FakeClusterRoleBindings) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(clusterrolebindingsResource, name), &v1beta1.ClusterRoleBinding{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeClusterRoleBindings) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(clusterrolebindingsResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta1.ClusterRoleBindingList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched clusterRoleBinding.
+func (c *FakeClusterRoleBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.ClusterRoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(clusterrolebindingsResource, name, pt, data, subresources...), &v1beta1.ClusterRoleBinding{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.ClusterRoleBinding), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeRbacV1beta1 struct {
+ *testing.Fake
+}
+
+func (c *FakeRbacV1beta1) ClusterRoles() v1beta1.ClusterRoleInterface {
+ return &FakeClusterRoles{c}
+}
+
+func (c *FakeRbacV1beta1) ClusterRoleBindings() v1beta1.ClusterRoleBindingInterface {
+ return &FakeClusterRoleBindings{c}
+}
+
+func (c *FakeRbacV1beta1) Roles(namespace string) v1beta1.RoleInterface {
+ return &FakeRoles{c, namespace}
+}
+
+func (c *FakeRbacV1beta1) RoleBindings(namespace string) v1beta1.RoleBindingInterface {
+ return &FakeRoleBindings{c, namespace}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeRbacV1beta1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/rbac/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"
+)
+
+// FakeRoles implements RoleInterface
+type FakeRoles struct {
+ Fake *FakeRbacV1beta1
+ ns string
+}
+
+var rolesResource = schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Resource: "roles"}
+
+var rolesKind = schema.GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Kind: "Role"}
+
+// Get takes name of the role, and returns the corresponding role object, and an error if there is any.
+func (c *FakeRoles) Get(name string, options v1.GetOptions) (result *v1beta1.Role, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(rolesResource, c.ns, name), &v1beta1.Role{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Role), err
+}
+
+// List takes label and field selectors, and returns the list of Roles that match those selectors.
+func (c *FakeRoles) List(opts v1.ListOptions) (result *v1beta1.RoleList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(rolesResource, rolesKind, c.ns, opts), &v1beta1.RoleList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta1.RoleList{ListMeta: obj.(*v1beta1.RoleList).ListMeta}
+ for _, item := range obj.(*v1beta1.RoleList).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 roles.
+func (c *FakeRoles) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(rolesResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a role and creates it. Returns the server's representation of the role, and an error, if there is any.
+func (c *FakeRoles) Create(role *v1beta1.Role) (result *v1beta1.Role, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(rolesResource, c.ns, role), &v1beta1.Role{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Role), err
+}
+
+// Update takes the representation of a role and updates it. Returns the server's representation of the role, and an error, if there is any.
+func (c *FakeRoles) Update(role *v1beta1.Role) (result *v1beta1.Role, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(rolesResource, c.ns, role), &v1beta1.Role{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Role), err
+}
+
+// Delete takes name of the role and deletes it. Returns an error if one occurs.
+func (c *FakeRoles) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(rolesResource, c.ns, name), &v1beta1.Role{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeRoles) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(rolesResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta1.RoleList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched role.
+func (c *FakeRoles) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Role, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(rolesResource, c.ns, name, pt, data, subresources...), &v1beta1.Role{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.Role), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/rbac/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"
+)
+
+// FakeRoleBindings implements RoleBindingInterface
+type FakeRoleBindings struct {
+ Fake *FakeRbacV1beta1
+ ns string
+}
+
+var rolebindingsResource = schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Resource: "rolebindings"}
+
+var rolebindingsKind = schema.GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Kind: "RoleBinding"}
+
+// Get takes name of the roleBinding, and returns the corresponding roleBinding object, and an error if there is any.
+func (c *FakeRoleBindings) Get(name string, options v1.GetOptions) (result *v1beta1.RoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(rolebindingsResource, c.ns, name), &v1beta1.RoleBinding{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.RoleBinding), err
+}
+
+// List takes label and field selectors, and returns the list of RoleBindings that match those selectors.
+func (c *FakeRoleBindings) List(opts v1.ListOptions) (result *v1beta1.RoleBindingList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(rolebindingsResource, rolebindingsKind, c.ns, opts), &v1beta1.RoleBindingList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta1.RoleBindingList{ListMeta: obj.(*v1beta1.RoleBindingList).ListMeta}
+ for _, item := range obj.(*v1beta1.RoleBindingList).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 roleBindings.
+func (c *FakeRoleBindings) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(rolebindingsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a roleBinding and creates it. Returns the server's representation of the roleBinding, and an error, if there is any.
+func (c *FakeRoleBindings) Create(roleBinding *v1beta1.RoleBinding) (result *v1beta1.RoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(rolebindingsResource, c.ns, roleBinding), &v1beta1.RoleBinding{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.RoleBinding), err
+}
+
+// Update takes the representation of a roleBinding and updates it. Returns the server's representation of the roleBinding, and an error, if there is any.
+func (c *FakeRoleBindings) Update(roleBinding *v1beta1.RoleBinding) (result *v1beta1.RoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(rolebindingsResource, c.ns, roleBinding), &v1beta1.RoleBinding{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.RoleBinding), err
+}
+
+// Delete takes name of the roleBinding and deletes it. Returns an error if one occurs.
+func (c *FakeRoleBindings) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(rolebindingsResource, c.ns, name), &v1beta1.RoleBinding{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeRoleBindings) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(rolebindingsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta1.RoleBindingList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched roleBinding.
+func (c *FakeRoleBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.RoleBinding, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(rolebindingsResource, c.ns, name, pt, data, subresources...), &v1beta1.RoleBinding{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.RoleBinding), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1alpha1 "k8s.io/api/scheduling/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"
+)
+
+// FakePriorityClasses implements PriorityClassInterface
+type FakePriorityClasses struct {
+ Fake *FakeSchedulingV1alpha1
+}
+
+var priorityclassesResource = schema.GroupVersionResource{Group: "scheduling.k8s.io", Version: "v1alpha1", Resource: "priorityclasses"}
+
+var priorityclassesKind = schema.GroupVersionKind{Group: "scheduling.k8s.io", Version: "v1alpha1", Kind: "PriorityClass"}
+
+// Get takes name of the priorityClass, and returns the corresponding priorityClass object, and an error if there is any.
+func (c *FakePriorityClasses) Get(name string, options v1.GetOptions) (result *v1alpha1.PriorityClass, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(priorityclassesResource, name), &v1alpha1.PriorityClass{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.PriorityClass), err
+}
+
+// List takes label and field selectors, and returns the list of PriorityClasses that match those selectors.
+func (c *FakePriorityClasses) List(opts v1.ListOptions) (result *v1alpha1.PriorityClassList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(priorityclassesResource, priorityclassesKind, opts), &v1alpha1.PriorityClassList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1alpha1.PriorityClassList{ListMeta: obj.(*v1alpha1.PriorityClassList).ListMeta}
+ for _, item := range obj.(*v1alpha1.PriorityClassList).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 priorityClasses.
+func (c *FakePriorityClasses) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(priorityclassesResource, opts))
+}
+
+// Create takes the representation of a priorityClass and creates it. Returns the server's representation of the priorityClass, and an error, if there is any.
+func (c *FakePriorityClasses) Create(priorityClass *v1alpha1.PriorityClass) (result *v1alpha1.PriorityClass, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(priorityclassesResource, priorityClass), &v1alpha1.PriorityClass{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.PriorityClass), err
+}
+
+// Update takes the representation of a priorityClass and updates it. Returns the server's representation of the priorityClass, and an error, if there is any.
+func (c *FakePriorityClasses) Update(priorityClass *v1alpha1.PriorityClass) (result *v1alpha1.PriorityClass, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(priorityclassesResource, priorityClass), &v1alpha1.PriorityClass{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.PriorityClass), err
+}
+
+// Delete takes name of the priorityClass and deletes it. Returns an error if one occurs.
+func (c *FakePriorityClasses) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(priorityclassesResource, name), &v1alpha1.PriorityClass{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakePriorityClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(priorityclassesResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1alpha1.PriorityClassList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched priorityClass.
+func (c *FakePriorityClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.PriorityClass, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(priorityclassesResource, name, pt, data, subresources...), &v1alpha1.PriorityClass{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.PriorityClass), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1alpha1 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeSchedulingV1alpha1 struct {
+ *testing.Fake
+}
+
+func (c *FakeSchedulingV1alpha1) PriorityClasses() v1alpha1.PriorityClassInterface {
+ return &FakePriorityClasses{c}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeSchedulingV1alpha1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/scheduling/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"
+)
+
+// FakePriorityClasses implements PriorityClassInterface
+type FakePriorityClasses struct {
+ Fake *FakeSchedulingV1beta1
+}
+
+var priorityclassesResource = schema.GroupVersionResource{Group: "scheduling.k8s.io", Version: "v1beta1", Resource: "priorityclasses"}
+
+var priorityclassesKind = schema.GroupVersionKind{Group: "scheduling.k8s.io", Version: "v1beta1", Kind: "PriorityClass"}
+
+// Get takes name of the priorityClass, and returns the corresponding priorityClass object, and an error if there is any.
+func (c *FakePriorityClasses) Get(name string, options v1.GetOptions) (result *v1beta1.PriorityClass, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(priorityclassesResource, name), &v1beta1.PriorityClass{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.PriorityClass), err
+}
+
+// List takes label and field selectors, and returns the list of PriorityClasses that match those selectors.
+func (c *FakePriorityClasses) List(opts v1.ListOptions) (result *v1beta1.PriorityClassList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(priorityclassesResource, priorityclassesKind, opts), &v1beta1.PriorityClassList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta1.PriorityClassList{ListMeta: obj.(*v1beta1.PriorityClassList).ListMeta}
+ for _, item := range obj.(*v1beta1.PriorityClassList).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 priorityClasses.
+func (c *FakePriorityClasses) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(priorityclassesResource, opts))
+}
+
+// Create takes the representation of a priorityClass and creates it. Returns the server's representation of the priorityClass, and an error, if there is any.
+func (c *FakePriorityClasses) Create(priorityClass *v1beta1.PriorityClass) (result *v1beta1.PriorityClass, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(priorityclassesResource, priorityClass), &v1beta1.PriorityClass{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.PriorityClass), err
+}
+
+// Update takes the representation of a priorityClass and updates it. Returns the server's representation of the priorityClass, and an error, if there is any.
+func (c *FakePriorityClasses) Update(priorityClass *v1beta1.PriorityClass) (result *v1beta1.PriorityClass, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(priorityclassesResource, priorityClass), &v1beta1.PriorityClass{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.PriorityClass), err
+}
+
+// Delete takes name of the priorityClass and deletes it. Returns an error if one occurs.
+func (c *FakePriorityClasses) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(priorityclassesResource, name), &v1beta1.PriorityClass{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakePriorityClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(priorityclassesResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta1.PriorityClassList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched priorityClass.
+func (c *FakePriorityClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.PriorityClass, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(priorityclassesResource, name, pt, data, subresources...), &v1beta1.PriorityClass{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.PriorityClass), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeSchedulingV1beta1 struct {
+ *testing.Fake
+}
+
+func (c *FakeSchedulingV1beta1) PriorityClasses() v1beta1.PriorityClassInterface {
+ return &FakePriorityClasses{c}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeSchedulingV1beta1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1alpha1 "k8s.io/api/settings/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"
+)
+
+// FakePodPresets implements PodPresetInterface
+type FakePodPresets struct {
+ Fake *FakeSettingsV1alpha1
+ ns string
+}
+
+var podpresetsResource = schema.GroupVersionResource{Group: "settings.k8s.io", Version: "v1alpha1", Resource: "podpresets"}
+
+var podpresetsKind = schema.GroupVersionKind{Group: "settings.k8s.io", Version: "v1alpha1", Kind: "PodPreset"}
+
+// Get takes name of the podPreset, and returns the corresponding podPreset object, and an error if there is any.
+func (c *FakePodPresets) Get(name string, options v1.GetOptions) (result *v1alpha1.PodPreset, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(podpresetsResource, c.ns, name), &v1alpha1.PodPreset{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.PodPreset), err
+}
+
+// List takes label and field selectors, and returns the list of PodPresets that match those selectors.
+func (c *FakePodPresets) List(opts v1.ListOptions) (result *v1alpha1.PodPresetList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(podpresetsResource, podpresetsKind, c.ns, opts), &v1alpha1.PodPresetList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1alpha1.PodPresetList{ListMeta: obj.(*v1alpha1.PodPresetList).ListMeta}
+ for _, item := range obj.(*v1alpha1.PodPresetList).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 podPresets.
+func (c *FakePodPresets) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(podpresetsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a podPreset and creates it. Returns the server's representation of the podPreset, and an error, if there is any.
+func (c *FakePodPresets) Create(podPreset *v1alpha1.PodPreset) (result *v1alpha1.PodPreset, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(podpresetsResource, c.ns, podPreset), &v1alpha1.PodPreset{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.PodPreset), err
+}
+
+// Update takes the representation of a podPreset and updates it. Returns the server's representation of the podPreset, and an error, if there is any.
+func (c *FakePodPresets) Update(podPreset *v1alpha1.PodPreset) (result *v1alpha1.PodPreset, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(podpresetsResource, c.ns, podPreset), &v1alpha1.PodPreset{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.PodPreset), err
+}
+
+// Delete takes name of the podPreset and deletes it. Returns an error if one occurs.
+func (c *FakePodPresets) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(podpresetsResource, c.ns, name), &v1alpha1.PodPreset{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakePodPresets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(podpresetsResource, c.ns, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1alpha1.PodPresetList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched podPreset.
+func (c *FakePodPresets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.PodPreset, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(podpresetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.PodPreset{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.PodPreset), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1alpha1 "k8s.io/client-go/kubernetes/typed/settings/v1alpha1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeSettingsV1alpha1 struct {
+ *testing.Fake
+}
+
+func (c *FakeSettingsV1alpha1) PodPresets(namespace string) v1alpha1.PodPresetInterface {
+ return &FakePodPresets{c, namespace}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeSettingsV1alpha1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1 "k8s.io/client-go/kubernetes/typed/storage/v1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeStorageV1 struct {
+ *testing.Fake
+}
+
+func (c *FakeStorageV1) StorageClasses() v1.StorageClassInterface {
+ return &FakeStorageClasses{c}
+}
+
+func (c *FakeStorageV1) VolumeAttachments() v1.VolumeAttachmentInterface {
+ return &FakeVolumeAttachments{c}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeStorageV1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ storagev1 "k8s.io/api/storage/v1"
+ 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"
+)
+
+// FakeStorageClasses implements StorageClassInterface
+type FakeStorageClasses struct {
+ Fake *FakeStorageV1
+}
+
+var storageclassesResource = schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1", Resource: "storageclasses"}
+
+var storageclassesKind = schema.GroupVersionKind{Group: "storage.k8s.io", Version: "v1", Kind: "StorageClass"}
+
+// Get takes name of the storageClass, and returns the corresponding storageClass object, and an error if there is any.
+func (c *FakeStorageClasses) Get(name string, options v1.GetOptions) (result *storagev1.StorageClass, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(storageclassesResource, name), &storagev1.StorageClass{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*storagev1.StorageClass), err
+}
+
+// List takes label and field selectors, and returns the list of StorageClasses that match those selectors.
+func (c *FakeStorageClasses) List(opts v1.ListOptions) (result *storagev1.StorageClassList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(storageclassesResource, storageclassesKind, opts), &storagev1.StorageClassList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &storagev1.StorageClassList{ListMeta: obj.(*storagev1.StorageClassList).ListMeta}
+ for _, item := range obj.(*storagev1.StorageClassList).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 storageClasses.
+func (c *FakeStorageClasses) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(storageclassesResource, opts))
+}
+
+// Create takes the representation of a storageClass and creates it. Returns the server's representation of the storageClass, and an error, if there is any.
+func (c *FakeStorageClasses) Create(storageClass *storagev1.StorageClass) (result *storagev1.StorageClass, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(storageclassesResource, storageClass), &storagev1.StorageClass{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*storagev1.StorageClass), err
+}
+
+// Update takes the representation of a storageClass and updates it. Returns the server's representation of the storageClass, and an error, if there is any.
+func (c *FakeStorageClasses) Update(storageClass *storagev1.StorageClass) (result *storagev1.StorageClass, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(storageclassesResource, storageClass), &storagev1.StorageClass{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*storagev1.StorageClass), err
+}
+
+// Delete takes name of the storageClass and deletes it. Returns an error if one occurs.
+func (c *FakeStorageClasses) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(storageclassesResource, name), &storagev1.StorageClass{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeStorageClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(storageclassesResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &storagev1.StorageClassList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched storageClass.
+func (c *FakeStorageClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *storagev1.StorageClass, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(storageclassesResource, name, pt, data, subresources...), &storagev1.StorageClass{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*storagev1.StorageClass), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ storagev1 "k8s.io/api/storage/v1"
+ 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"
+)
+
+// FakeVolumeAttachments implements VolumeAttachmentInterface
+type FakeVolumeAttachments struct {
+ Fake *FakeStorageV1
+}
+
+var volumeattachmentsResource = schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1", Resource: "volumeattachments"}
+
+var volumeattachmentsKind = schema.GroupVersionKind{Group: "storage.k8s.io", Version: "v1", Kind: "VolumeAttachment"}
+
+// Get takes name of the volumeAttachment, and returns the corresponding volumeAttachment object, and an error if there is any.
+func (c *FakeVolumeAttachments) Get(name string, options v1.GetOptions) (result *storagev1.VolumeAttachment, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(volumeattachmentsResource, name), &storagev1.VolumeAttachment{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*storagev1.VolumeAttachment), err
+}
+
+// List takes label and field selectors, and returns the list of VolumeAttachments that match those selectors.
+func (c *FakeVolumeAttachments) List(opts v1.ListOptions) (result *storagev1.VolumeAttachmentList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(volumeattachmentsResource, volumeattachmentsKind, opts), &storagev1.VolumeAttachmentList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &storagev1.VolumeAttachmentList{ListMeta: obj.(*storagev1.VolumeAttachmentList).ListMeta}
+ for _, item := range obj.(*storagev1.VolumeAttachmentList).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 volumeAttachments.
+func (c *FakeVolumeAttachments) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(volumeattachmentsResource, opts))
+}
+
+// Create takes the representation of a volumeAttachment and creates it. Returns the server's representation of the volumeAttachment, and an error, if there is any.
+func (c *FakeVolumeAttachments) Create(volumeAttachment *storagev1.VolumeAttachment) (result *storagev1.VolumeAttachment, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(volumeattachmentsResource, volumeAttachment), &storagev1.VolumeAttachment{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*storagev1.VolumeAttachment), err
+}
+
+// Update takes the representation of a volumeAttachment and updates it. Returns the server's representation of the volumeAttachment, and an error, if there is any.
+func (c *FakeVolumeAttachments) Update(volumeAttachment *storagev1.VolumeAttachment) (result *storagev1.VolumeAttachment, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(volumeattachmentsResource, volumeAttachment), &storagev1.VolumeAttachment{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*storagev1.VolumeAttachment), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeVolumeAttachments) UpdateStatus(volumeAttachment *storagev1.VolumeAttachment) (*storagev1.VolumeAttachment, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateSubresourceAction(volumeattachmentsResource, "status", volumeAttachment), &storagev1.VolumeAttachment{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*storagev1.VolumeAttachment), err
+}
+
+// Delete takes name of the volumeAttachment and deletes it. Returns an error if one occurs.
+func (c *FakeVolumeAttachments) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(volumeattachmentsResource, name), &storagev1.VolumeAttachment{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeVolumeAttachments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(volumeattachmentsResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &storagev1.VolumeAttachmentList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched volumeAttachment.
+func (c *FakeVolumeAttachments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *storagev1.VolumeAttachment, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(volumeattachmentsResource, name, pt, data, subresources...), &storagev1.VolumeAttachment{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*storagev1.VolumeAttachment), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeStorageV1alpha1 struct {
+ *testing.Fake
+}
+
+func (c *FakeStorageV1alpha1) VolumeAttachments() v1alpha1.VolumeAttachmentInterface {
+ return &FakeVolumeAttachments{c}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeStorageV1alpha1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1alpha1 "k8s.io/api/storage/v1alpha1"
+ 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"
+)
+
+// FakeVolumeAttachments implements VolumeAttachmentInterface
+type FakeVolumeAttachments struct {
+ Fake *FakeStorageV1alpha1
+}
+
+var volumeattachmentsResource = schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1alpha1", Resource: "volumeattachments"}
+
+var volumeattachmentsKind = schema.GroupVersionKind{Group: "storage.k8s.io", Version: "v1alpha1", Kind: "VolumeAttachment"}
+
+// Get takes name of the volumeAttachment, and returns the corresponding volumeAttachment object, and an error if there is any.
+func (c *FakeVolumeAttachments) Get(name string, options v1.GetOptions) (result *v1alpha1.VolumeAttachment, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(volumeattachmentsResource, name), &v1alpha1.VolumeAttachment{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.VolumeAttachment), err
+}
+
+// List takes label and field selectors, and returns the list of VolumeAttachments that match those selectors.
+func (c *FakeVolumeAttachments) List(opts v1.ListOptions) (result *v1alpha1.VolumeAttachmentList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(volumeattachmentsResource, volumeattachmentsKind, opts), &v1alpha1.VolumeAttachmentList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1alpha1.VolumeAttachmentList{ListMeta: obj.(*v1alpha1.VolumeAttachmentList).ListMeta}
+ for _, item := range obj.(*v1alpha1.VolumeAttachmentList).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 volumeAttachments.
+func (c *FakeVolumeAttachments) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(volumeattachmentsResource, opts))
+}
+
+// Create takes the representation of a volumeAttachment and creates it. Returns the server's representation of the volumeAttachment, and an error, if there is any.
+func (c *FakeVolumeAttachments) Create(volumeAttachment *v1alpha1.VolumeAttachment) (result *v1alpha1.VolumeAttachment, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(volumeattachmentsResource, volumeAttachment), &v1alpha1.VolumeAttachment{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.VolumeAttachment), err
+}
+
+// Update takes the representation of a volumeAttachment and updates it. Returns the server's representation of the volumeAttachment, and an error, if there is any.
+func (c *FakeVolumeAttachments) Update(volumeAttachment *v1alpha1.VolumeAttachment) (result *v1alpha1.VolumeAttachment, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(volumeattachmentsResource, volumeAttachment), &v1alpha1.VolumeAttachment{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.VolumeAttachment), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeVolumeAttachments) UpdateStatus(volumeAttachment *v1alpha1.VolumeAttachment) (*v1alpha1.VolumeAttachment, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateSubresourceAction(volumeattachmentsResource, "status", volumeAttachment), &v1alpha1.VolumeAttachment{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.VolumeAttachment), err
+}
+
+// Delete takes name of the volumeAttachment and deletes it. Returns an error if one occurs.
+func (c *FakeVolumeAttachments) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(volumeattachmentsResource, name), &v1alpha1.VolumeAttachment{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeVolumeAttachments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(volumeattachmentsResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1alpha1.VolumeAttachmentList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched volumeAttachment.
+func (c *FakeVolumeAttachments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.VolumeAttachment, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(volumeattachmentsResource, name, pt, data, subresources...), &v1alpha1.VolumeAttachment{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.VolumeAttachment), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeStorageV1beta1 struct {
+ *testing.Fake
+}
+
+func (c *FakeStorageV1beta1) StorageClasses() v1beta1.StorageClassInterface {
+ return &FakeStorageClasses{c}
+}
+
+func (c *FakeStorageV1beta1) VolumeAttachments() v1beta1.VolumeAttachmentInterface {
+ return &FakeVolumeAttachments{c}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeStorageV1beta1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/storage/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"
+)
+
+// FakeStorageClasses implements StorageClassInterface
+type FakeStorageClasses struct {
+ Fake *FakeStorageV1beta1
+}
+
+var storageclassesResource = schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1beta1", Resource: "storageclasses"}
+
+var storageclassesKind = schema.GroupVersionKind{Group: "storage.k8s.io", Version: "v1beta1", Kind: "StorageClass"}
+
+// Get takes name of the storageClass, and returns the corresponding storageClass object, and an error if there is any.
+func (c *FakeStorageClasses) Get(name string, options v1.GetOptions) (result *v1beta1.StorageClass, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(storageclassesResource, name), &v1beta1.StorageClass{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.StorageClass), err
+}
+
+// List takes label and field selectors, and returns the list of StorageClasses that match those selectors.
+func (c *FakeStorageClasses) List(opts v1.ListOptions) (result *v1beta1.StorageClassList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(storageclassesResource, storageclassesKind, opts), &v1beta1.StorageClassList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta1.StorageClassList{ListMeta: obj.(*v1beta1.StorageClassList).ListMeta}
+ for _, item := range obj.(*v1beta1.StorageClassList).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 storageClasses.
+func (c *FakeStorageClasses) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(storageclassesResource, opts))
+}
+
+// Create takes the representation of a storageClass and creates it. Returns the server's representation of the storageClass, and an error, if there is any.
+func (c *FakeStorageClasses) Create(storageClass *v1beta1.StorageClass) (result *v1beta1.StorageClass, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(storageclassesResource, storageClass), &v1beta1.StorageClass{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.StorageClass), err
+}
+
+// Update takes the representation of a storageClass and updates it. Returns the server's representation of the storageClass, and an error, if there is any.
+func (c *FakeStorageClasses) Update(storageClass *v1beta1.StorageClass) (result *v1beta1.StorageClass, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(storageclassesResource, storageClass), &v1beta1.StorageClass{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.StorageClass), err
+}
+
+// Delete takes name of the storageClass and deletes it. Returns an error if one occurs.
+func (c *FakeStorageClasses) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(storageclassesResource, name), &v1beta1.StorageClass{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeStorageClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(storageclassesResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta1.StorageClassList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched storageClass.
+func (c *FakeStorageClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.StorageClass, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(storageclassesResource, name, pt, data, subresources...), &v1beta1.StorageClass{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.StorageClass), err
+}
--- /dev/null
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1beta1 "k8s.io/api/storage/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"
+)
+
+// FakeVolumeAttachments implements VolumeAttachmentInterface
+type FakeVolumeAttachments struct {
+ Fake *FakeStorageV1beta1
+}
+
+var volumeattachmentsResource = schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1beta1", Resource: "volumeattachments"}
+
+var volumeattachmentsKind = schema.GroupVersionKind{Group: "storage.k8s.io", Version: "v1beta1", Kind: "VolumeAttachment"}
+
+// Get takes name of the volumeAttachment, and returns the corresponding volumeAttachment object, and an error if there is any.
+func (c *FakeVolumeAttachments) Get(name string, options v1.GetOptions) (result *v1beta1.VolumeAttachment, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootGetAction(volumeattachmentsResource, name), &v1beta1.VolumeAttachment{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.VolumeAttachment), err
+}
+
+// List takes label and field selectors, and returns the list of VolumeAttachments that match those selectors.
+func (c *FakeVolumeAttachments) List(opts v1.ListOptions) (result *v1beta1.VolumeAttachmentList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootListAction(volumeattachmentsResource, volumeattachmentsKind, opts), &v1beta1.VolumeAttachmentList{})
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta1.VolumeAttachmentList{ListMeta: obj.(*v1beta1.VolumeAttachmentList).ListMeta}
+ for _, item := range obj.(*v1beta1.VolumeAttachmentList).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 volumeAttachments.
+func (c *FakeVolumeAttachments) Watch(opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewRootWatchAction(volumeattachmentsResource, opts))
+}
+
+// Create takes the representation of a volumeAttachment and creates it. Returns the server's representation of the volumeAttachment, and an error, if there is any.
+func (c *FakeVolumeAttachments) Create(volumeAttachment *v1beta1.VolumeAttachment) (result *v1beta1.VolumeAttachment, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootCreateAction(volumeattachmentsResource, volumeAttachment), &v1beta1.VolumeAttachment{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.VolumeAttachment), err
+}
+
+// Update takes the representation of a volumeAttachment and updates it. Returns the server's representation of the volumeAttachment, and an error, if there is any.
+func (c *FakeVolumeAttachments) Update(volumeAttachment *v1beta1.VolumeAttachment) (result *v1beta1.VolumeAttachment, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateAction(volumeattachmentsResource, volumeAttachment), &v1beta1.VolumeAttachment{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.VolumeAttachment), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeVolumeAttachments) UpdateStatus(volumeAttachment *v1beta1.VolumeAttachment) (*v1beta1.VolumeAttachment, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootUpdateSubresourceAction(volumeattachmentsResource, "status", volumeAttachment), &v1beta1.VolumeAttachment{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.VolumeAttachment), err
+}
+
+// Delete takes name of the volumeAttachment and deletes it. Returns an error if one occurs.
+func (c *FakeVolumeAttachments) Delete(name string, options *v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewRootDeleteAction(volumeattachmentsResource, name), &v1beta1.VolumeAttachment{})
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeVolumeAttachments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
+ action := testing.NewRootDeleteCollectionAction(volumeattachmentsResource, listOptions)
+
+ _, err := c.Fake.Invokes(action, &v1beta1.VolumeAttachmentList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched volumeAttachment.
+func (c *FakeVolumeAttachments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.VolumeAttachment, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewRootPatchSubresourceAction(volumeattachmentsResource, name, pt, data, subresources...), &v1beta1.VolumeAttachment{})
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.VolumeAttachment), err
+}
--- /dev/null
+/*
+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 testing
+
+import (
+ "fmt"
+ "path"
+ "strings"
+
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/fields"
+ "k8s.io/apimachinery/pkg/labels"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "k8s.io/apimachinery/pkg/types"
+)
+
+func NewRootGetAction(resource schema.GroupVersionResource, name string) GetActionImpl {
+ action := GetActionImpl{}
+ action.Verb = "get"
+ action.Resource = resource
+ action.Name = name
+
+ return action
+}
+
+func NewGetAction(resource schema.GroupVersionResource, namespace, name string) GetActionImpl {
+ action := GetActionImpl{}
+ action.Verb = "get"
+ action.Resource = resource
+ action.Namespace = namespace
+ action.Name = name
+
+ return action
+}
+
+func NewGetSubresourceAction(resource schema.GroupVersionResource, namespace, subresource, name string) GetActionImpl {
+ action := GetActionImpl{}
+ action.Verb = "get"
+ action.Resource = resource
+ action.Subresource = subresource
+ action.Namespace = namespace
+ action.Name = name
+
+ return action
+}
+
+func NewRootGetSubresourceAction(resource schema.GroupVersionResource, subresource, name string) GetActionImpl {
+ action := GetActionImpl{}
+ action.Verb = "get"
+ action.Resource = resource
+ action.Subresource = subresource
+ action.Name = name
+
+ return action
+}
+
+func NewRootListAction(resource schema.GroupVersionResource, kind schema.GroupVersionKind, opts interface{}) ListActionImpl {
+ action := ListActionImpl{}
+ action.Verb = "list"
+ action.Resource = resource
+ action.Kind = kind
+ labelSelector, fieldSelector, _ := ExtractFromListOptions(opts)
+ action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector}
+
+ return action
+}
+
+func NewListAction(resource schema.GroupVersionResource, kind schema.GroupVersionKind, namespace string, opts interface{}) ListActionImpl {
+ action := ListActionImpl{}
+ action.Verb = "list"
+ action.Resource = resource
+ action.Kind = kind
+ action.Namespace = namespace
+ labelSelector, fieldSelector, _ := ExtractFromListOptions(opts)
+ action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector}
+
+ return action
+}
+
+func NewRootCreateAction(resource schema.GroupVersionResource, object runtime.Object) CreateActionImpl {
+ action := CreateActionImpl{}
+ action.Verb = "create"
+ action.Resource = resource
+ action.Object = object
+
+ return action
+}
+
+func NewCreateAction(resource schema.GroupVersionResource, namespace string, object runtime.Object) CreateActionImpl {
+ action := CreateActionImpl{}
+ action.Verb = "create"
+ action.Resource = resource
+ action.Namespace = namespace
+ action.Object = object
+
+ return action
+}
+
+func NewRootCreateSubresourceAction(resource schema.GroupVersionResource, name, subresource string, object runtime.Object) CreateActionImpl {
+ action := CreateActionImpl{}
+ action.Verb = "create"
+ action.Resource = resource
+ action.Subresource = subresource
+ action.Name = name
+ action.Object = object
+
+ return action
+}
+
+func NewCreateSubresourceAction(resource schema.GroupVersionResource, name, subresource, namespace string, object runtime.Object) CreateActionImpl {
+ action := CreateActionImpl{}
+ action.Verb = "create"
+ action.Resource = resource
+ action.Namespace = namespace
+ action.Subresource = subresource
+ action.Name = name
+ action.Object = object
+
+ return action
+}
+
+func NewRootUpdateAction(resource schema.GroupVersionResource, object runtime.Object) UpdateActionImpl {
+ action := UpdateActionImpl{}
+ action.Verb = "update"
+ action.Resource = resource
+ action.Object = object
+
+ return action
+}
+
+func NewUpdateAction(resource schema.GroupVersionResource, namespace string, object runtime.Object) UpdateActionImpl {
+ action := UpdateActionImpl{}
+ action.Verb = "update"
+ action.Resource = resource
+ action.Namespace = namespace
+ action.Object = object
+
+ return action
+}
+
+func NewRootPatchAction(resource schema.GroupVersionResource, name string, pt types.PatchType, patch []byte) PatchActionImpl {
+ action := PatchActionImpl{}
+ action.Verb = "patch"
+ action.Resource = resource
+ action.Name = name
+ action.PatchType = pt
+ action.Patch = patch
+
+ return action
+}
+
+func NewPatchAction(resource schema.GroupVersionResource, namespace string, name string, pt types.PatchType, patch []byte) PatchActionImpl {
+ action := PatchActionImpl{}
+ action.Verb = "patch"
+ action.Resource = resource
+ action.Namespace = namespace
+ action.Name = name
+ action.PatchType = pt
+ action.Patch = patch
+
+ return action
+}
+
+func NewRootPatchSubresourceAction(resource schema.GroupVersionResource, name string, pt types.PatchType, patch []byte, subresources ...string) PatchActionImpl {
+ action := PatchActionImpl{}
+ action.Verb = "patch"
+ action.Resource = resource
+ action.Subresource = path.Join(subresources...)
+ action.Name = name
+ action.PatchType = pt
+ action.Patch = patch
+
+ return action
+}
+
+func NewPatchSubresourceAction(resource schema.GroupVersionResource, namespace, name string, pt types.PatchType, patch []byte, subresources ...string) PatchActionImpl {
+ action := PatchActionImpl{}
+ action.Verb = "patch"
+ action.Resource = resource
+ action.Subresource = path.Join(subresources...)
+ action.Namespace = namespace
+ action.Name = name
+ action.PatchType = pt
+ action.Patch = patch
+
+ return action
+}
+
+func NewRootUpdateSubresourceAction(resource schema.GroupVersionResource, subresource string, object runtime.Object) UpdateActionImpl {
+ action := UpdateActionImpl{}
+ action.Verb = "update"
+ action.Resource = resource
+ action.Subresource = subresource
+ action.Object = object
+
+ return action
+}
+func NewUpdateSubresourceAction(resource schema.GroupVersionResource, subresource string, namespace string, object runtime.Object) UpdateActionImpl {
+ action := UpdateActionImpl{}
+ action.Verb = "update"
+ action.Resource = resource
+ action.Subresource = subresource
+ action.Namespace = namespace
+ action.Object = object
+
+ return action
+}
+
+func NewRootDeleteAction(resource schema.GroupVersionResource, name string) DeleteActionImpl {
+ action := DeleteActionImpl{}
+ action.Verb = "delete"
+ action.Resource = resource
+ action.Name = name
+
+ return action
+}
+
+func NewRootDeleteSubresourceAction(resource schema.GroupVersionResource, subresource string, name string) DeleteActionImpl {
+ action := DeleteActionImpl{}
+ action.Verb = "delete"
+ action.Resource = resource
+ action.Subresource = subresource
+ action.Name = name
+
+ return action
+}
+
+func NewDeleteAction(resource schema.GroupVersionResource, namespace, name string) DeleteActionImpl {
+ action := DeleteActionImpl{}
+ action.Verb = "delete"
+ action.Resource = resource
+ action.Namespace = namespace
+ action.Name = name
+
+ return action
+}
+
+func NewDeleteSubresourceAction(resource schema.GroupVersionResource, subresource, namespace, name string) DeleteActionImpl {
+ action := DeleteActionImpl{}
+ action.Verb = "delete"
+ action.Resource = resource
+ action.Subresource = subresource
+ action.Namespace = namespace
+ action.Name = name
+
+ return action
+}
+
+func NewRootDeleteCollectionAction(resource schema.GroupVersionResource, opts interface{}) DeleteCollectionActionImpl {
+ action := DeleteCollectionActionImpl{}
+ action.Verb = "delete-collection"
+ action.Resource = resource
+ labelSelector, fieldSelector, _ := ExtractFromListOptions(opts)
+ action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector}
+
+ return action
+}
+
+func NewDeleteCollectionAction(resource schema.GroupVersionResource, namespace string, opts interface{}) DeleteCollectionActionImpl {
+ action := DeleteCollectionActionImpl{}
+ action.Verb = "delete-collection"
+ action.Resource = resource
+ action.Namespace = namespace
+ labelSelector, fieldSelector, _ := ExtractFromListOptions(opts)
+ action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector}
+
+ return action
+}
+
+func NewRootWatchAction(resource schema.GroupVersionResource, opts interface{}) WatchActionImpl {
+ action := WatchActionImpl{}
+ action.Verb = "watch"
+ action.Resource = resource
+ labelSelector, fieldSelector, resourceVersion := ExtractFromListOptions(opts)
+ action.WatchRestrictions = WatchRestrictions{labelSelector, fieldSelector, resourceVersion}
+
+ return action
+}
+
+func ExtractFromListOptions(opts interface{}) (labelSelector labels.Selector, fieldSelector fields.Selector, resourceVersion string) {
+ var err error
+ switch t := opts.(type) {
+ case metav1.ListOptions:
+ labelSelector, err = labels.Parse(t.LabelSelector)
+ if err != nil {
+ panic(fmt.Errorf("invalid selector %q: %v", t.LabelSelector, err))
+ }
+ fieldSelector, err = fields.ParseSelector(t.FieldSelector)
+ if err != nil {
+ panic(fmt.Errorf("invalid selector %q: %v", t.FieldSelector, err))
+ }
+ resourceVersion = t.ResourceVersion
+ default:
+ panic(fmt.Errorf("expect a ListOptions %T", opts))
+ }
+ if labelSelector == nil {
+ labelSelector = labels.Everything()
+ }
+ if fieldSelector == nil {
+ fieldSelector = fields.Everything()
+ }
+ return labelSelector, fieldSelector, resourceVersion
+}
+
+func NewWatchAction(resource schema.GroupVersionResource, namespace string, opts interface{}) WatchActionImpl {
+ action := WatchActionImpl{}
+ action.Verb = "watch"
+ action.Resource = resource
+ action.Namespace = namespace
+ labelSelector, fieldSelector, resourceVersion := ExtractFromListOptions(opts)
+ action.WatchRestrictions = WatchRestrictions{labelSelector, fieldSelector, resourceVersion}
+
+ return action
+}
+
+func NewProxyGetAction(resource schema.GroupVersionResource, namespace, scheme, name, port, path string, params map[string]string) ProxyGetActionImpl {
+ action := ProxyGetActionImpl{}
+ action.Verb = "get"
+ action.Resource = resource
+ action.Namespace = namespace
+ action.Scheme = scheme
+ action.Name = name
+ action.Port = port
+ action.Path = path
+ action.Params = params
+ return action
+}
+
+type ListRestrictions struct {
+ Labels labels.Selector
+ Fields fields.Selector
+}
+type WatchRestrictions struct {
+ Labels labels.Selector
+ Fields fields.Selector
+ ResourceVersion string
+}
+
+type Action interface {
+ GetNamespace() string
+ GetVerb() string
+ GetResource() schema.GroupVersionResource
+ GetSubresource() string
+ Matches(verb, resource string) bool
+
+ // DeepCopy is used to copy an action to avoid any risk of accidental mutation. Most people never need to call this
+ // because the invocation logic deep copies before calls to storage and reactors.
+ DeepCopy() Action
+}
+
+type GenericAction interface {
+ Action
+ GetValue() interface{}
+}
+
+type GetAction interface {
+ Action
+ GetName() string
+}
+
+type ListAction interface {
+ Action
+ GetListRestrictions() ListRestrictions
+}
+
+type CreateAction interface {
+ Action
+ GetObject() runtime.Object
+}
+
+type UpdateAction interface {
+ Action
+ GetObject() runtime.Object
+}
+
+type DeleteAction interface {
+ Action
+ GetName() string
+}
+
+type DeleteCollectionAction interface {
+ Action
+ GetListRestrictions() ListRestrictions
+}
+
+type PatchAction interface {
+ Action
+ GetName() string
+ GetPatchType() types.PatchType
+ GetPatch() []byte
+}
+
+type WatchAction interface {
+ Action
+ GetWatchRestrictions() WatchRestrictions
+}
+
+type ProxyGetAction interface {
+ Action
+ GetScheme() string
+ GetName() string
+ GetPort() string
+ GetPath() string
+ GetParams() map[string]string
+}
+
+type ActionImpl struct {
+ Namespace string
+ Verb string
+ Resource schema.GroupVersionResource
+ Subresource string
+}
+
+func (a ActionImpl) GetNamespace() string {
+ return a.Namespace
+}
+func (a ActionImpl) GetVerb() string {
+ return a.Verb
+}
+func (a ActionImpl) GetResource() schema.GroupVersionResource {
+ return a.Resource
+}
+func (a ActionImpl) GetSubresource() string {
+ return a.Subresource
+}
+func (a ActionImpl) Matches(verb, resource string) bool {
+ return strings.ToLower(verb) == strings.ToLower(a.Verb) &&
+ strings.ToLower(resource) == strings.ToLower(a.Resource.Resource)
+}
+func (a ActionImpl) DeepCopy() Action {
+ ret := a
+ return ret
+}
+
+type GenericActionImpl struct {
+ ActionImpl
+ Value interface{}
+}
+
+func (a GenericActionImpl) GetValue() interface{} {
+ return a.Value
+}
+
+func (a GenericActionImpl) DeepCopy() Action {
+ return GenericActionImpl{
+ ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
+ // TODO this is wrong, but no worse than before
+ Value: a.Value,
+ }
+}
+
+type GetActionImpl struct {
+ ActionImpl
+ Name string
+}
+
+func (a GetActionImpl) GetName() string {
+ return a.Name
+}
+
+func (a GetActionImpl) DeepCopy() Action {
+ return GetActionImpl{
+ ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
+ Name: a.Name,
+ }
+}
+
+type ListActionImpl struct {
+ ActionImpl
+ Kind schema.GroupVersionKind
+ Name string
+ ListRestrictions ListRestrictions
+}
+
+func (a ListActionImpl) GetKind() schema.GroupVersionKind {
+ return a.Kind
+}
+
+func (a ListActionImpl) GetListRestrictions() ListRestrictions {
+ return a.ListRestrictions
+}
+
+func (a ListActionImpl) DeepCopy() Action {
+ return ListActionImpl{
+ ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
+ Kind: a.Kind,
+ Name: a.Name,
+ ListRestrictions: ListRestrictions{
+ Labels: a.ListRestrictions.Labels.DeepCopySelector(),
+ Fields: a.ListRestrictions.Fields.DeepCopySelector(),
+ },
+ }
+}
+
+type CreateActionImpl struct {
+ ActionImpl
+ Name string
+ Object runtime.Object
+}
+
+func (a CreateActionImpl) GetObject() runtime.Object {
+ return a.Object
+}
+
+func (a CreateActionImpl) DeepCopy() Action {
+ return CreateActionImpl{
+ ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
+ Name: a.Name,
+ Object: a.Object.DeepCopyObject(),
+ }
+}
+
+type UpdateActionImpl struct {
+ ActionImpl
+ Object runtime.Object
+}
+
+func (a UpdateActionImpl) GetObject() runtime.Object {
+ return a.Object
+}
+
+func (a UpdateActionImpl) DeepCopy() Action {
+ return UpdateActionImpl{
+ ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
+ Object: a.Object.DeepCopyObject(),
+ }
+}
+
+type PatchActionImpl struct {
+ ActionImpl
+ Name string
+ PatchType types.PatchType
+ Patch []byte
+}
+
+func (a PatchActionImpl) GetName() string {
+ return a.Name
+}
+
+func (a PatchActionImpl) GetPatch() []byte {
+ return a.Patch
+}
+
+func (a PatchActionImpl) GetPatchType() types.PatchType {
+ return a.PatchType
+}
+
+func (a PatchActionImpl) DeepCopy() Action {
+ patch := make([]byte, len(a.Patch))
+ copy(patch, a.Patch)
+ return PatchActionImpl{
+ ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
+ Name: a.Name,
+ PatchType: a.PatchType,
+ Patch: patch,
+ }
+}
+
+type DeleteActionImpl struct {
+ ActionImpl
+ Name string
+}
+
+func (a DeleteActionImpl) GetName() string {
+ return a.Name
+}
+
+func (a DeleteActionImpl) DeepCopy() Action {
+ return DeleteActionImpl{
+ ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
+ Name: a.Name,
+ }
+}
+
+type DeleteCollectionActionImpl struct {
+ ActionImpl
+ ListRestrictions ListRestrictions
+}
+
+func (a DeleteCollectionActionImpl) GetListRestrictions() ListRestrictions {
+ return a.ListRestrictions
+}
+
+func (a DeleteCollectionActionImpl) DeepCopy() Action {
+ return DeleteCollectionActionImpl{
+ ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
+ ListRestrictions: ListRestrictions{
+ Labels: a.ListRestrictions.Labels.DeepCopySelector(),
+ Fields: a.ListRestrictions.Fields.DeepCopySelector(),
+ },
+ }
+}
+
+type WatchActionImpl struct {
+ ActionImpl
+ WatchRestrictions WatchRestrictions
+}
+
+func (a WatchActionImpl) GetWatchRestrictions() WatchRestrictions {
+ return a.WatchRestrictions
+}
+
+func (a WatchActionImpl) DeepCopy() Action {
+ return WatchActionImpl{
+ ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
+ WatchRestrictions: WatchRestrictions{
+ Labels: a.WatchRestrictions.Labels.DeepCopySelector(),
+ Fields: a.WatchRestrictions.Fields.DeepCopySelector(),
+ ResourceVersion: a.WatchRestrictions.ResourceVersion,
+ },
+ }
+}
+
+type ProxyGetActionImpl struct {
+ ActionImpl
+ Scheme string
+ Name string
+ Port string
+ Path string
+ Params map[string]string
+}
+
+func (a ProxyGetActionImpl) GetScheme() string {
+ return a.Scheme
+}
+
+func (a ProxyGetActionImpl) GetName() string {
+ return a.Name
+}
+
+func (a ProxyGetActionImpl) GetPort() string {
+ return a.Port
+}
+
+func (a ProxyGetActionImpl) GetPath() string {
+ return a.Path
+}
+
+func (a ProxyGetActionImpl) GetParams() map[string]string {
+ return a.Params
+}
+
+func (a ProxyGetActionImpl) DeepCopy() Action {
+ params := map[string]string{}
+ for k, v := range a.Params {
+ params[k] = v
+ }
+ return ProxyGetActionImpl{
+ ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
+ Scheme: a.Scheme,
+ Name: a.Name,
+ Port: a.Port,
+ Path: a.Path,
+ Params: params,
+ }
+}
--- /dev/null
+/*
+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 testing
+
+import (
+ "fmt"
+ "sync"
+
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/watch"
+ restclient "k8s.io/client-go/rest"
+)
+
+// Fake implements client.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 Fake struct {
+ sync.RWMutex
+ actions []Action // these may be castable to other types, but "Action" is the minimum
+
+ // ReactionChain is the list of reactors that will be attempted for every
+ // request in the order they are tried.
+ ReactionChain []Reactor
+ // WatchReactionChain is the list of watch reactors that will be attempted
+ // for every request in the order they are tried.
+ WatchReactionChain []WatchReactor
+ // ProxyReactionChain is the list of proxy reactors that will be attempted
+ // for every request in the order they are tried.
+ ProxyReactionChain []ProxyReactor
+
+ Resources []*metav1.APIResourceList
+}
+
+// Reactor is an interface to allow the composition of reaction functions.
+type Reactor interface {
+ // Handles indicates whether or not this Reactor deals with a given
+ // action.
+ Handles(action Action) bool
+ // React handles the action and returns results. It may choose to
+ // delegate by indicated handled=false.
+ React(action Action) (handled bool, ret runtime.Object, err error)
+}
+
+// WatchReactor is an interface to allow the composition of watch functions.
+type WatchReactor interface {
+ // Handles indicates whether or not this Reactor deals with a given
+ // action.
+ Handles(action Action) bool
+ // React handles a watch action and returns results. It may choose to
+ // delegate by indicating handled=false.
+ React(action Action) (handled bool, ret watch.Interface, err error)
+}
+
+// ProxyReactor is an interface to allow the composition of proxy get
+// functions.
+type ProxyReactor interface {
+ // Handles indicates whether or not this Reactor deals with a given
+ // action.
+ Handles(action Action) bool
+ // React handles a watch action and returns results. It may choose to
+ // delegate by indicating handled=false.
+ React(action Action) (handled bool, ret restclient.ResponseWrapper, err error)
+}
+
+// ReactionFunc is a function that returns an object or error for a given
+// Action. If "handled" is false, then the test client will ignore the
+// results and continue to the next ReactionFunc. A ReactionFunc can describe
+// reactions on subresources by testing the result of the action's
+// GetSubresource() method.
+type ReactionFunc func(action Action) (handled bool, ret runtime.Object, err error)
+
+// WatchReactionFunc is a function that returns a watch interface. If
+// "handled" is false, then the test client will ignore the results and
+// continue to the next ReactionFunc.
+type WatchReactionFunc func(action Action) (handled bool, ret watch.Interface, err error)
+
+// ProxyReactionFunc is a function that returns a ResponseWrapper interface
+// for a given Action. If "handled" is false, then the test client will
+// ignore the results and continue to the next ProxyReactionFunc.
+type ProxyReactionFunc func(action Action) (handled bool, ret restclient.ResponseWrapper, err error)
+
+// AddReactor appends a reactor to the end of the chain.
+func (c *Fake) AddReactor(verb, resource string, reaction ReactionFunc) {
+ c.ReactionChain = append(c.ReactionChain, &SimpleReactor{verb, resource, reaction})
+}
+
+// PrependReactor adds a reactor to the beginning of the chain.
+func (c *Fake) PrependReactor(verb, resource string, reaction ReactionFunc) {
+ c.ReactionChain = append([]Reactor{&SimpleReactor{verb, resource, reaction}}, c.ReactionChain...)
+}
+
+// AddWatchReactor appends a reactor to the end of the chain.
+func (c *Fake) AddWatchReactor(resource string, reaction WatchReactionFunc) {
+ c.WatchReactionChain = append(c.WatchReactionChain, &SimpleWatchReactor{resource, reaction})
+}
+
+// PrependWatchReactor adds a reactor to the beginning of the chain.
+func (c *Fake) PrependWatchReactor(resource string, reaction WatchReactionFunc) {
+ c.WatchReactionChain = append([]WatchReactor{&SimpleWatchReactor{resource, reaction}}, c.WatchReactionChain...)
+}
+
+// AddProxyReactor appends a reactor to the end of the chain.
+func (c *Fake) AddProxyReactor(resource string, reaction ProxyReactionFunc) {
+ c.ProxyReactionChain = append(c.ProxyReactionChain, &SimpleProxyReactor{resource, reaction})
+}
+
+// PrependProxyReactor adds a reactor to the beginning of the chain.
+func (c *Fake) PrependProxyReactor(resource string, reaction ProxyReactionFunc) {
+ c.ProxyReactionChain = append([]ProxyReactor{&SimpleProxyReactor{resource, reaction}}, c.ProxyReactionChain...)
+}
+
+// Invokes records the provided Action and then invokes the ReactionFunc that
+// handles the action if one exists. defaultReturnObj is expected to be of the
+// same type a normal call would return.
+func (c *Fake) Invokes(action Action, defaultReturnObj runtime.Object) (runtime.Object, error) {
+ c.Lock()
+ defer c.Unlock()
+
+ c.actions = append(c.actions, action.DeepCopy())
+ for _, reactor := range c.ReactionChain {
+ if !reactor.Handles(action) {
+ continue
+ }
+
+ handled, ret, err := reactor.React(action.DeepCopy())
+ if !handled {
+ continue
+ }
+
+ return ret, err
+ }
+
+ return defaultReturnObj, nil
+}
+
+// InvokesWatch records the provided Action and then invokes the ReactionFunc
+// that handles the action if one exists.
+func (c *Fake) InvokesWatch(action Action) (watch.Interface, error) {
+ c.Lock()
+ defer c.Unlock()
+
+ c.actions = append(c.actions, action.DeepCopy())
+ for _, reactor := range c.WatchReactionChain {
+ if !reactor.Handles(action) {
+ continue
+ }
+
+ handled, ret, err := reactor.React(action.DeepCopy())
+ if !handled {
+ continue
+ }
+
+ return ret, err
+ }
+
+ return nil, fmt.Errorf("unhandled watch: %#v", action)
+}
+
+// InvokesProxy records the provided Action and then invokes the ReactionFunc
+// that handles the action if one exists.
+func (c *Fake) InvokesProxy(action Action) restclient.ResponseWrapper {
+ c.Lock()
+ defer c.Unlock()
+
+ c.actions = append(c.actions, action.DeepCopy())
+ for _, reactor := range c.ProxyReactionChain {
+ if !reactor.Handles(action) {
+ continue
+ }
+
+ handled, ret, err := reactor.React(action.DeepCopy())
+ if !handled || err != nil {
+ continue
+ }
+
+ return ret
+ }
+
+ return nil
+}
+
+// ClearActions clears the history of actions called on the fake client.
+func (c *Fake) ClearActions() {
+ c.Lock()
+ defer c.Unlock()
+
+ c.actions = make([]Action, 0)
+}
+
+// Actions returns a chronologically ordered slice fake actions called on the
+// fake client.
+func (c *Fake) Actions() []Action {
+ c.RLock()
+ defer c.RUnlock()
+ fa := make([]Action, len(c.actions))
+ copy(fa, c.actions)
+ return fa
+}
--- /dev/null
+/*
+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 testing
+
+import (
+ "fmt"
+ "sync"
+
+ "github.com/evanphx/json-patch"
+ "k8s.io/apimachinery/pkg/api/errors"
+ "k8s.io/apimachinery/pkg/api/meta"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "k8s.io/apimachinery/pkg/types"
+ "k8s.io/apimachinery/pkg/util/json"
+ "k8s.io/apimachinery/pkg/util/strategicpatch"
+ "k8s.io/apimachinery/pkg/watch"
+ restclient "k8s.io/client-go/rest"
+)
+
+// ObjectTracker keeps track of objects. It is intended to be used to
+// fake calls to a server by returning objects based on their kind,
+// namespace and name.
+type ObjectTracker interface {
+ // Add adds an object to the tracker. If object being added
+ // is a list, its items are added separately.
+ Add(obj runtime.Object) error
+
+ // Get retrieves the object by its kind, namespace and name.
+ Get(gvr schema.GroupVersionResource, ns, name string) (runtime.Object, error)
+
+ // Create adds an object to the tracker in the specified namespace.
+ Create(gvr schema.GroupVersionResource, obj runtime.Object, ns string) error
+
+ // Update updates an existing object in the tracker in the specified namespace.
+ Update(gvr schema.GroupVersionResource, obj runtime.Object, ns string) error
+
+ // List retrieves all objects of a given kind in the given
+ // namespace. Only non-List kinds are accepted.
+ List(gvr schema.GroupVersionResource, gvk schema.GroupVersionKind, ns string) (runtime.Object, error)
+
+ // Delete deletes an existing object from the tracker. If object
+ // didn't exist in the tracker prior to deletion, Delete returns
+ // no error.
+ Delete(gvr schema.GroupVersionResource, ns, name string) error
+
+ // Watch watches objects from the tracker. Watch returns a channel
+ // which will push added / modified / deleted object.
+ Watch(gvr schema.GroupVersionResource, ns string) (watch.Interface, error)
+}
+
+// ObjectScheme abstracts the implementation of common operations on objects.
+type ObjectScheme interface {
+ runtime.ObjectCreater
+ runtime.ObjectTyper
+}
+
+// ObjectReaction returns a ReactionFunc that applies core.Action to
+// the given tracker.
+func ObjectReaction(tracker ObjectTracker) ReactionFunc {
+ return func(action Action) (bool, runtime.Object, error) {
+ ns := action.GetNamespace()
+ gvr := action.GetResource()
+ // Here and below we need to switch on implementation types,
+ // not on interfaces, as some interfaces are identical
+ // (e.g. UpdateAction and CreateAction), so if we use them,
+ // updates and creates end up matching the same case branch.
+ switch action := action.(type) {
+
+ case ListActionImpl:
+ obj, err := tracker.List(gvr, action.GetKind(), ns)
+ return true, obj, err
+
+ case GetActionImpl:
+ obj, err := tracker.Get(gvr, ns, action.GetName())
+ return true, obj, err
+
+ case CreateActionImpl:
+ objMeta, err := meta.Accessor(action.GetObject())
+ if err != nil {
+ return true, nil, err
+ }
+ if action.GetSubresource() == "" {
+ err = tracker.Create(gvr, action.GetObject(), ns)
+ } else {
+ // TODO: Currently we're handling subresource creation as an update
+ // on the enclosing resource. This works for some subresources but
+ // might not be generic enough.
+ err = tracker.Update(gvr, action.GetObject(), ns)
+ }
+ if err != nil {
+ return true, nil, err
+ }
+ obj, err := tracker.Get(gvr, ns, objMeta.GetName())
+ return true, obj, err
+
+ case UpdateActionImpl:
+ objMeta, err := meta.Accessor(action.GetObject())
+ if err != nil {
+ return true, nil, err
+ }
+ err = tracker.Update(gvr, action.GetObject(), ns)
+ if err != nil {
+ return true, nil, err
+ }
+ obj, err := tracker.Get(gvr, ns, objMeta.GetName())
+ return true, obj, err
+
+ case DeleteActionImpl:
+ err := tracker.Delete(gvr, ns, action.GetName())
+ if err != nil {
+ return true, nil, err
+ }
+ return true, nil, nil
+
+ case PatchActionImpl:
+ obj, err := tracker.Get(gvr, ns, action.GetName())
+ if err != nil {
+ // object is not registered
+ return false, nil, err
+ }
+
+ old, err := json.Marshal(obj)
+ if err != nil {
+ return true, nil, err
+ }
+ // Only supports strategic merge patch and JSONPatch as coded.
+ switch action.GetPatchType() {
+ case types.JSONPatchType:
+ patch, err := jsonpatch.DecodePatch(action.GetPatch())
+ if err != nil {
+ return true, nil, err
+ }
+ modified, err := patch.Apply(old)
+ if err != nil {
+ return true, nil, err
+ }
+ if err = json.Unmarshal(modified, obj); err != nil {
+ return true, nil, err
+ }
+ case types.StrategicMergePatchType:
+ mergedByte, err := strategicpatch.StrategicMergePatch(old, action.GetPatch(), obj)
+ if err != nil {
+ return true, nil, err
+ }
+ if err = json.Unmarshal(mergedByte, obj); err != nil {
+ return true, nil, err
+ }
+ default:
+ return true, nil, fmt.Errorf("PatchType is not supported")
+ }
+
+ if err = tracker.Update(gvr, obj, ns); err != nil {
+ return true, nil, err
+ }
+
+ return true, obj, nil
+
+ default:
+ return false, nil, fmt.Errorf("no reaction implemented for %s", action)
+ }
+ }
+}
+
+type tracker struct {
+ scheme ObjectScheme
+ decoder runtime.Decoder
+ lock sync.RWMutex
+ objects map[schema.GroupVersionResource][]runtime.Object
+ // The value type of watchers is a map of which the key is either a namespace or
+ // all/non namespace aka "" and its value is list of fake watchers.
+ // Manipulations on resources will broadcast the notification events into the
+ // watchers' channel. Note that too many unhandled events (currently 100,
+ // see apimachinery/pkg/watch.DefaultChanSize) will cause a panic.
+ watchers map[schema.GroupVersionResource]map[string][]*watch.RaceFreeFakeWatcher
+}
+
+var _ ObjectTracker = &tracker{}
+
+// NewObjectTracker returns an ObjectTracker that can be used to keep track
+// of objects for the fake clientset. Mostly useful for unit tests.
+func NewObjectTracker(scheme ObjectScheme, decoder runtime.Decoder) ObjectTracker {
+ return &tracker{
+ scheme: scheme,
+ decoder: decoder,
+ objects: make(map[schema.GroupVersionResource][]runtime.Object),
+ watchers: make(map[schema.GroupVersionResource]map[string][]*watch.RaceFreeFakeWatcher),
+ }
+}
+
+func (t *tracker) List(gvr schema.GroupVersionResource, gvk schema.GroupVersionKind, ns string) (runtime.Object, error) {
+ // Heuristic for list kind: original kind + List suffix. Might
+ // not always be true but this tracker has a pretty limited
+ // understanding of the actual API model.
+ listGVK := gvk
+ listGVK.Kind = listGVK.Kind + "List"
+ // GVK does have the concept of "internal version". The scheme recognizes
+ // the runtime.APIVersionInternal, but not the empty string.
+ if listGVK.Version == "" {
+ listGVK.Version = runtime.APIVersionInternal
+ }
+
+ list, err := t.scheme.New(listGVK)
+ if err != nil {
+ return nil, err
+ }
+
+ if !meta.IsListType(list) {
+ return nil, fmt.Errorf("%q is not a list type", listGVK.Kind)
+ }
+
+ t.lock.RLock()
+ defer t.lock.RUnlock()
+
+ objs, ok := t.objects[gvr]
+ if !ok {
+ return list, nil
+ }
+
+ matchingObjs, err := filterByNamespaceAndName(objs, ns, "")
+ if err != nil {
+ return nil, err
+ }
+ if err := meta.SetList(list, matchingObjs); err != nil {
+ return nil, err
+ }
+ return list.DeepCopyObject(), nil
+}
+
+func (t *tracker) Watch(gvr schema.GroupVersionResource, ns string) (watch.Interface, error) {
+ t.lock.Lock()
+ defer t.lock.Unlock()
+
+ fakewatcher := watch.NewRaceFreeFake()
+
+ if _, exists := t.watchers[gvr]; !exists {
+ t.watchers[gvr] = make(map[string][]*watch.RaceFreeFakeWatcher)
+ }
+ t.watchers[gvr][ns] = append(t.watchers[gvr][ns], fakewatcher)
+ return fakewatcher, nil
+}
+
+func (t *tracker) Get(gvr schema.GroupVersionResource, ns, name string) (runtime.Object, error) {
+ errNotFound := errors.NewNotFound(gvr.GroupResource(), name)
+
+ t.lock.RLock()
+ defer t.lock.RUnlock()
+
+ objs, ok := t.objects[gvr]
+ if !ok {
+ return nil, errNotFound
+ }
+
+ matchingObjs, err := filterByNamespaceAndName(objs, ns, name)
+ if err != nil {
+ return nil, err
+ }
+ if len(matchingObjs) == 0 {
+ return nil, errNotFound
+ }
+ if len(matchingObjs) > 1 {
+ return nil, fmt.Errorf("more than one object matched gvr %s, ns: %q name: %q", gvr, ns, name)
+ }
+
+ // Only one object should match in the tracker if it works
+ // correctly, as Add/Update methods enforce kind/namespace/name
+ // uniqueness.
+ obj := matchingObjs[0].DeepCopyObject()
+ if status, ok := obj.(*metav1.Status); ok {
+ if status.Status != metav1.StatusSuccess {
+ return nil, &errors.StatusError{ErrStatus: *status}
+ }
+ }
+
+ return obj, nil
+}
+
+func (t *tracker) Add(obj runtime.Object) error {
+ if meta.IsListType(obj) {
+ return t.addList(obj, false)
+ }
+ objMeta, err := meta.Accessor(obj)
+ if err != nil {
+ return err
+ }
+ gvks, _, err := t.scheme.ObjectKinds(obj)
+ if err != nil {
+ return err
+ }
+ if len(gvks) == 0 {
+ return fmt.Errorf("no registered kinds for %v", obj)
+ }
+ for _, gvk := range gvks {
+ // NOTE: UnsafeGuessKindToResource is a heuristic and default match. The
+ // actual registration in apiserver can specify arbitrary route for a
+ // gvk. If a test uses such objects, it cannot preset the tracker with
+ // objects via Add(). Instead, it should trigger the Create() function
+ // of the tracker, where an arbitrary gvr can be specified.
+ gvr, _ := meta.UnsafeGuessKindToResource(gvk)
+ // Resource doesn't have the concept of "__internal" version, just set it to "".
+ if gvr.Version == runtime.APIVersionInternal {
+ gvr.Version = ""
+ }
+
+ err := t.add(gvr, obj, objMeta.GetNamespace(), false)
+ if err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+func (t *tracker) Create(gvr schema.GroupVersionResource, obj runtime.Object, ns string) error {
+ return t.add(gvr, obj, ns, false)
+}
+
+func (t *tracker) Update(gvr schema.GroupVersionResource, obj runtime.Object, ns string) error {
+ return t.add(gvr, obj, ns, true)
+}
+
+func (t *tracker) getWatches(gvr schema.GroupVersionResource, ns string) []*watch.RaceFreeFakeWatcher {
+ watches := []*watch.RaceFreeFakeWatcher{}
+ if t.watchers[gvr] != nil {
+ if w := t.watchers[gvr][ns]; w != nil {
+ watches = append(watches, w...)
+ }
+ if w := t.watchers[gvr][""]; w != nil {
+ watches = append(watches, w...)
+ }
+ }
+ return watches
+}
+
+func (t *tracker) add(gvr schema.GroupVersionResource, obj runtime.Object, ns string, replaceExisting bool) error {
+ t.lock.Lock()
+ defer t.lock.Unlock()
+
+ gr := gvr.GroupResource()
+
+ // To avoid the object from being accidentally modified by caller
+ // after it's been added to the tracker, we always store the deep
+ // copy.
+ obj = obj.DeepCopyObject()
+
+ newMeta, err := meta.Accessor(obj)
+ if err != nil {
+ return err
+ }
+
+ // Propagate namespace to the new object if hasn't already been set.
+ if len(newMeta.GetNamespace()) == 0 {
+ newMeta.SetNamespace(ns)
+ }
+
+ if ns != newMeta.GetNamespace() {
+ msg := fmt.Sprintf("request namespace does not match object namespace, request: %q object: %q", ns, newMeta.GetNamespace())
+ return errors.NewBadRequest(msg)
+ }
+
+ for i, existingObj := range t.objects[gvr] {
+ oldMeta, err := meta.Accessor(existingObj)
+ if err != nil {
+ return err
+ }
+ if oldMeta.GetNamespace() == newMeta.GetNamespace() && oldMeta.GetName() == newMeta.GetName() {
+ if replaceExisting {
+ for _, w := range t.getWatches(gvr, ns) {
+ w.Modify(obj)
+ }
+ t.objects[gvr][i] = obj
+ return nil
+ }
+ return errors.NewAlreadyExists(gr, newMeta.GetName())
+ }
+ }
+
+ if replaceExisting {
+ // Tried to update but no matching object was found.
+ return errors.NewNotFound(gr, newMeta.GetName())
+ }
+
+ t.objects[gvr] = append(t.objects[gvr], obj)
+
+ for _, w := range t.getWatches(gvr, ns) {
+ w.Add(obj)
+ }
+
+ return nil
+}
+
+func (t *tracker) addList(obj runtime.Object, replaceExisting bool) error {
+ list, err := meta.ExtractList(obj)
+ if err != nil {
+ return err
+ }
+ errs := runtime.DecodeList(list, t.decoder)
+ if len(errs) > 0 {
+ return errs[0]
+ }
+ for _, obj := range list {
+ if err := t.Add(obj); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+func (t *tracker) Delete(gvr schema.GroupVersionResource, ns, name string) error {
+ t.lock.Lock()
+ defer t.lock.Unlock()
+
+ found := false
+
+ for i, existingObj := range t.objects[gvr] {
+ objMeta, err := meta.Accessor(existingObj)
+ if err != nil {
+ return err
+ }
+ if objMeta.GetNamespace() == ns && objMeta.GetName() == name {
+ obj := t.objects[gvr][i]
+ t.objects[gvr] = append(t.objects[gvr][:i], t.objects[gvr][i+1:]...)
+ for _, w := range t.getWatches(gvr, ns) {
+ w.Delete(obj)
+ }
+ found = true
+ break
+ }
+ }
+
+ if found {
+ return nil
+ }
+
+ return errors.NewNotFound(gvr.GroupResource(), name)
+}
+
+// filterByNamespaceAndName returns all objects in the collection that
+// match provided namespace and name. Empty namespace matches
+// non-namespaced objects.
+func filterByNamespaceAndName(objs []runtime.Object, ns, name string) ([]runtime.Object, error) {
+ var res []runtime.Object
+
+ for _, obj := range objs {
+ acc, err := meta.Accessor(obj)
+ if err != nil {
+ return nil, err
+ }
+ if ns != "" && acc.GetNamespace() != ns {
+ continue
+ }
+ if name != "" && acc.GetName() != name {
+ continue
+ }
+ res = append(res, obj)
+ }
+
+ return res, nil
+}
+
+func DefaultWatchReactor(watchInterface watch.Interface, err error) WatchReactionFunc {
+ return func(action Action) (bool, watch.Interface, error) {
+ return true, watchInterface, err
+ }
+}
+
+// SimpleReactor is a Reactor. Each reaction function is attached to a given verb,resource tuple. "*" in either field matches everything for that value.
+// For instance, *,pods matches all verbs on pods. This allows for easier composition of reaction functions
+type SimpleReactor struct {
+ Verb string
+ Resource string
+
+ Reaction ReactionFunc
+}
+
+func (r *SimpleReactor) Handles(action Action) bool {
+ verbCovers := r.Verb == "*" || r.Verb == action.GetVerb()
+ if !verbCovers {
+ return false
+ }
+ resourceCovers := r.Resource == "*" || r.Resource == action.GetResource().Resource
+ if !resourceCovers {
+ return false
+ }
+
+ return true
+}
+
+func (r *SimpleReactor) React(action Action) (bool, runtime.Object, error) {
+ return r.Reaction(action)
+}
+
+// SimpleWatchReactor is a WatchReactor. Each reaction function is attached to a given resource. "*" matches everything for that value.
+// For instance, *,pods matches all verbs on pods. This allows for easier composition of reaction functions
+type SimpleWatchReactor struct {
+ Resource string
+
+ Reaction WatchReactionFunc
+}
+
+func (r *SimpleWatchReactor) Handles(action Action) bool {
+ resourceCovers := r.Resource == "*" || r.Resource == action.GetResource().Resource
+ if !resourceCovers {
+ return false
+ }
+
+ return true
+}
+
+func (r *SimpleWatchReactor) React(action Action) (bool, watch.Interface, error) {
+ return r.Reaction(action)
+}
+
+// SimpleProxyReactor is a ProxyReactor. Each reaction function is attached to a given resource. "*" matches everything for that value.
+// For instance, *,pods matches all verbs on pods. This allows for easier composition of reaction functions.
+type SimpleProxyReactor struct {
+ Resource string
+
+ Reaction ProxyReactionFunc
+}
+
+func (r *SimpleProxyReactor) Handles(action Action) bool {
+ resourceCovers := r.Resource == "*" || r.Resource == action.GetResource().Resource
+ if !resourceCovers {
+ return false
+ }
+
+ return true
+}
+
+func (r *SimpleProxyReactor) React(action Action) (bool, restclient.ResponseWrapper, error) {
+ return r.Reaction(action)
+}
# github.com/emicklei/go-restful v2.9.3+incompatible
github.com/emicklei/go-restful
github.com/emicklei/go-restful/log
+# github.com/evanphx/json-patch v4.1.0+incompatible
+github.com/evanphx/json-patch
# github.com/ghodss/yaml v1.0.0
github.com/ghodss/yaml
# github.com/go-logr/logr v0.1.0
github.com/markbates/inflect
# github.com/matttproud/golang_protobuf_extensions v1.0.1
github.com/matttproud/golang_protobuf_extensions/pbutil
+# github.com/metal3-io/baremetal-operator v0.0.0-20191015111357-fc67cc20e40b
+github.com/metal3-io/baremetal-operator/pkg/apis
+github.com/metal3-io/baremetal-operator/pkg/apis/metal3/v1alpha1
# github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
github.com/modern-go/concurrent
# github.com/modern-go/reflect2 v1.0.1
k8s.io/client-go/kubernetes/typed/storage/v1alpha1
k8s.io/client-go/kubernetes/typed/storage/v1beta1
k8s.io/client-go/util/workqueue
+k8s.io/client-go/dynamic/fake
+k8s.io/client-go/kubernetes/fake
k8s.io/client-go/tools/pager
k8s.io/client-go/util/buffer
k8s.io/client-go/util/retry
k8s.io/client-go/tools/clientcmd/api/latest
k8s.io/client-go/util/homedir
k8s.io/client-go/tools/reference
+k8s.io/client-go/testing
+k8s.io/client-go/discovery/fake
+k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake
+k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake
+k8s.io/client-go/kubernetes/typed/apps/v1/fake
+k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake
+k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake
+k8s.io/client-go/kubernetes/typed/auditregistration/v1alpha1/fake
+k8s.io/client-go/kubernetes/typed/authentication/v1/fake
+k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake
+k8s.io/client-go/kubernetes/typed/authorization/v1/fake
+k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake
+k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake
+k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/fake
+k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/fake
+k8s.io/client-go/kubernetes/typed/batch/v1/fake
+k8s.io/client-go/kubernetes/typed/batch/v1beta1/fake
+k8s.io/client-go/kubernetes/typed/batch/v2alpha1/fake
+k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake
+k8s.io/client-go/kubernetes/typed/coordination/v1beta1/fake
+k8s.io/client-go/kubernetes/typed/core/v1/fake
+k8s.io/client-go/kubernetes/typed/events/v1beta1/fake
+k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake
+k8s.io/client-go/kubernetes/typed/networking/v1/fake
+k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake
+k8s.io/client-go/kubernetes/typed/rbac/v1/fake
+k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake
+k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake
+k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake
+k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake
+k8s.io/client-go/kubernetes/typed/settings/v1alpha1/fake
+k8s.io/client-go/kubernetes/typed/storage/v1/fake
+k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake
+k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake
k8s.io/client-go/third_party/forked/golang/template
k8s.io/client-go/tools/clientcmd/api/v1
# k8s.io/gengo v0.0.0-20190327210449-e17681d19d3a
sigs.k8s.io/controller-runtime/pkg/predicate
sigs.k8s.io/controller-runtime/pkg/event
sigs.k8s.io/controller-runtime/pkg/source/internal
+sigs.k8s.io/controller-runtime/pkg/client/fake
sigs.k8s.io/controller-runtime/pkg/cache/internal
sigs.k8s.io/controller-runtime/pkg/patch
sigs.k8s.io/controller-runtime/pkg/webhook/internal/metrics
--- /dev/null
+/*
+Copyright 2018 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package fake
+
+import (
+ "context"
+ "encoding/json"
+ "fmt"
+ "os"
+ "strings"
+
+ "k8s.io/apimachinery/pkg/api/meta"
+ "k8s.io/apimachinery/pkg/labels"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "k8s.io/client-go/kubernetes/scheme"
+ "k8s.io/client-go/testing"
+
+ "sigs.k8s.io/controller-runtime/pkg/client"
+ "sigs.k8s.io/controller-runtime/pkg/client/apiutil"
+ "sigs.k8s.io/controller-runtime/pkg/internal/objectutil"
+ logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
+)
+
+var (
+ log = logf.KBLog.WithName("fake-client")
+)
+
+type fakeClient struct {
+ tracker testing.ObjectTracker
+ scheme *runtime.Scheme
+}
+
+var _ client.Client = &fakeClient{}
+
+// NewFakeClient creates a new fake client for testing.
+// You can choose to initialize it with a slice of runtime.Object.
+func NewFakeClient(initObjs ...runtime.Object) client.Client {
+ return NewFakeClientWithScheme(scheme.Scheme, initObjs...)
+}
+
+// NewFakeClientWithScheme creates a new fake client with the given scheme
+// for testing.
+// You can choose to initialize it with a slice of runtime.Object.
+func NewFakeClientWithScheme(clientScheme *runtime.Scheme, initObjs ...runtime.Object) client.Client {
+ tracker := testing.NewObjectTracker(clientScheme, scheme.Codecs.UniversalDecoder())
+ for _, obj := range initObjs {
+ err := tracker.Add(obj)
+ if err != nil {
+ log.Error(err, "failed to add object to fake client", "object", obj)
+ os.Exit(1)
+ return nil
+ }
+ }
+ return &fakeClient{
+ tracker: tracker,
+ scheme: clientScheme,
+ }
+}
+
+func (c *fakeClient) Get(ctx context.Context, key client.ObjectKey, obj runtime.Object) error {
+ gvr, err := getGVRFromObject(obj, c.scheme)
+ if err != nil {
+ return err
+ }
+ o, err := c.tracker.Get(gvr, key.Namespace, key.Name)
+ if err != nil {
+ return err
+ }
+ j, err := json.Marshal(o)
+ if err != nil {
+ return err
+ }
+ decoder := scheme.Codecs.UniversalDecoder()
+ _, _, err = decoder.Decode(j, nil, obj)
+ return err
+}
+
+func (c *fakeClient) List(ctx context.Context, opts *client.ListOptions, list runtime.Object) error {
+ gvk, err := getGVKFromList(list, c.scheme)
+ if err != nil {
+ // The old fake client required GVK info in Raw.TypeMeta, so check there
+ // before giving up
+ if opts.Raw == nil || opts.Raw.TypeMeta.APIVersion == "" || opts.Raw.TypeMeta.Kind == "" {
+ return err
+ }
+ gvk = opts.Raw.TypeMeta.GroupVersionKind()
+ }
+
+ gvr, _ := meta.UnsafeGuessKindToResource(gvk)
+ o, err := c.tracker.List(gvr, gvk, opts.Namespace)
+ if err != nil {
+ return err
+ }
+ j, err := json.Marshal(o)
+ if err != nil {
+ return err
+ }
+ decoder := scheme.Codecs.UniversalDecoder()
+ _, _, err = decoder.Decode(j, nil, list)
+ if err != nil {
+ return err
+ }
+
+ if opts.LabelSelector != nil {
+ return filterListItems(list, opts.LabelSelector)
+ }
+ return nil
+}
+
+func filterListItems(list runtime.Object, labSel labels.Selector) error {
+ objs, err := meta.ExtractList(list)
+ if err != nil {
+ return err
+ }
+ filteredObjs, err := objectutil.FilterWithLabels(objs, labSel)
+ if err != nil {
+ return err
+ }
+ err = meta.SetList(list, filteredObjs)
+ if err != nil {
+ return err
+ }
+ return nil
+}
+
+func (c *fakeClient) Create(ctx context.Context, obj runtime.Object) error {
+ gvr, err := getGVRFromObject(obj, c.scheme)
+ if err != nil {
+ return err
+ }
+ accessor, err := meta.Accessor(obj)
+ if err != nil {
+ return err
+ }
+ return c.tracker.Create(gvr, obj, accessor.GetNamespace())
+}
+
+func (c *fakeClient) Delete(ctx context.Context, obj runtime.Object, opts ...client.DeleteOptionFunc) error {
+ gvr, err := getGVRFromObject(obj, c.scheme)
+ if err != nil {
+ return err
+ }
+ accessor, err := meta.Accessor(obj)
+ if err != nil {
+ return err
+ }
+ //TODO: implement propagation
+ return c.tracker.Delete(gvr, accessor.GetNamespace(), accessor.GetName())
+}
+
+func (c *fakeClient) Update(ctx context.Context, obj runtime.Object) error {
+ gvr, err := getGVRFromObject(obj, c.scheme)
+ if err != nil {
+ return err
+ }
+ accessor, err := meta.Accessor(obj)
+ if err != nil {
+ return err
+ }
+ return c.tracker.Update(gvr, obj, accessor.GetNamespace())
+}
+
+func (c *fakeClient) Status() client.StatusWriter {
+ return &fakeStatusWriter{client: c}
+}
+
+func getGVRFromObject(obj runtime.Object, scheme *runtime.Scheme) (schema.GroupVersionResource, error) {
+ gvk, err := apiutil.GVKForObject(obj, scheme)
+ if err != nil {
+ return schema.GroupVersionResource{}, err
+ }
+ gvr, _ := meta.UnsafeGuessKindToResource(gvk)
+ return gvr, nil
+}
+
+func getGVKFromList(list runtime.Object, scheme *runtime.Scheme) (schema.GroupVersionKind, error) {
+ gvk, err := apiutil.GVKForObject(list, scheme)
+ if err != nil {
+ return schema.GroupVersionKind{}, err
+ }
+
+ if gvk.Kind == "List" {
+ return schema.GroupVersionKind{}, fmt.Errorf("cannot derive GVK for generic List type %T (kind %q)", list, gvk)
+ }
+
+ if !strings.HasSuffix(gvk.Kind, "List") {
+ return schema.GroupVersionKind{}, fmt.Errorf("non-list type %T (kind %q) passed as output", list, gvk)
+ }
+ // we need the non-list GVK, so chop off the "List" from the end of the kind
+ gvk.Kind = gvk.Kind[:len(gvk.Kind)-4]
+ return gvk, nil
+}
+
+type fakeStatusWriter struct {
+ client *fakeClient
+}
+
+func (sw *fakeStatusWriter) Update(ctx context.Context, obj runtime.Object) error {
+ // TODO(droot): This results in full update of the obj (spec + status). Need
+ // a way to update status field only.
+ return sw.client.Update(ctx, obj)
+}
--- /dev/null
+/*
+Copyright 2018 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+/*
+Package fake provides a fake client for testing.
+
+An fake client is backed by its simple object store indexed by GroupVersionResource.
+You can create a fake client with optional objects.
+
+ client := NewFakeClient(initObjs...) // initObjs is a slice of runtime.Object
+
+You can invoke the methods defined in the Client interface.
+*/
+package fake