mirror of
https://github.com/ysoftdevs/gardener-extension-shoot-fleet-agent.git
synced 2026-06-12 00:24:28 +02:00
Initial v1.0.0 commit
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
// +k8s:deepcopy-gen=package
|
||||
// +groupName="shoot-fleet-agent-service.extensions.config.gardener.cloud"
|
||||
|
||||
//go:generate ../../../hack/update-codegen.sh
|
||||
package config
|
||||
@@ -0,0 +1,31 @@
|
||||
package install
|
||||
|
||||
import (
|
||||
"github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis/config"
|
||||
v1alpha1 "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis/config/v1alpha1"
|
||||
v1alpha1fleet "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
)
|
||||
|
||||
var (
|
||||
schemeBuilder = runtime.NewSchemeBuilder(
|
||||
v1alpha1.AddToScheme,
|
||||
v1alpha1fleet.AddToScheme,
|
||||
config.AddToScheme,
|
||||
setVersionPriority,
|
||||
)
|
||||
|
||||
// AddToScheme adds all APIs to the scheme.
|
||||
AddToScheme = schemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
func setVersionPriority(scheme *runtime.Scheme) error {
|
||||
return scheme.SetVersionPriority(v1alpha1.SchemeGroupVersion)
|
||||
}
|
||||
|
||||
// Install installs all APIs in the scheme.
|
||||
func Install(scheme *runtime.Scheme) {
|
||||
utilruntime.Must(AddToScheme(scheme))
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package loader
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis/config"
|
||||
"github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis/config/install"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/json"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/versioning"
|
||||
)
|
||||
|
||||
var (
|
||||
Codec runtime.Codec
|
||||
Scheme *runtime.Scheme
|
||||
)
|
||||
|
||||
func init() {
|
||||
Scheme = runtime.NewScheme()
|
||||
install.Install(Scheme)
|
||||
yamlSerializer := json.NewYAMLSerializer(json.DefaultMetaFactory, Scheme, Scheme)
|
||||
Codec = versioning.NewDefaultingCodecForScheme(
|
||||
Scheme,
|
||||
yamlSerializer,
|
||||
yamlSerializer,
|
||||
schema.GroupVersion{Version: "v1alpha1"},
|
||||
runtime.InternalGroupVersioner,
|
||||
)
|
||||
}
|
||||
|
||||
// LoadFromFile takes a filename and de-serializes the contents into FleetAgentConfig object.
|
||||
func LoadFromFile(filename string) (*config.FleetAgentConfig, error) {
|
||||
bytes, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return Load(bytes)
|
||||
}
|
||||
|
||||
// Load takes a byte slice and de-serializes the contents into FleetAgentConfig object.
|
||||
// Encapsulates de-serialization without assuming the source is a file.
|
||||
func Load(data []byte) (*config.FleetAgentConfig, error) {
|
||||
cfg := &config.FleetAgentConfig{}
|
||||
|
||||
if len(data) == 0 {
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
decoded, _, err := Codec.Decode(data, &schema.GroupVersionKind{Version: "v1alpha1", Kind: "Config"}, cfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return decoded.(*config.FleetAgentConfig), nil
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// GroupName is the group name use in this package
|
||||
const GroupName = "shoot-fleet-agent-service.extensions.config.gardener.cloud"
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
|
||||
|
||||
// Kind takes an unqualified kind and returns a Group qualified GroupKind
|
||||
func Kind(kind string) schema.GroupKind {
|
||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
||||
}
|
||||
|
||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||
func Resource(resource string) schema.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
}
|
||||
|
||||
var (
|
||||
// schemeBuilder used to register the Shoot resource.
|
||||
schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
||||
// AddToScheme is a pointer to schemeBuilder.AddToScheme.
|
||||
AddToScheme = schemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
// Adds the list of known types to api.Scheme.
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&FleetAgentConfig{},
|
||||
)
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
healthcheckconfig "github.com/gardener/gardener/extensions/pkg/controller/healthcheck/config"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
componentbaseconfig "k8s.io/component-base/config"
|
||||
)
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// FleetAgentConfig configuration resource
|
||||
type FleetAgentConfig struct {
|
||||
metav1.TypeMeta
|
||||
|
||||
// ClientConnection specifies the kubeconfig file and client connection
|
||||
// settings for the proxy server to use when communicating with the apiserver.
|
||||
ClientConnection *componentbaseconfig.ClientConnectionConfiguration
|
||||
|
||||
// labels to use in Fleet Cluster registration
|
||||
Labels map[string]string
|
||||
|
||||
//namespace to store clusters registrations in Fleet managers cluster
|
||||
Namespace string
|
||||
|
||||
HealthCheckConfig *healthcheckconfig.HealthCheckConfig
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
||||
return RegisterDefaults(scheme)
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// +k8s:deepcopy-gen=package
|
||||
// +k8s:conversion-gen=github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis/config
|
||||
// +k8s:openapi-gen=true
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
|
||||
//go:generate gen-crd-api-reference-docs -api-dir . -config ../../../../hack/api-reference/config.json -template-dir ../../../../vendor/github.com/gardener/gardener/hack/api-reference/template -out-file ../../../../hack/api-reference/config.md
|
||||
|
||||
// Package v1alpha1 contains the Azure provider configuration API resources.
|
||||
// +groupName=shoot-fleet-agent-service.extensions.config.gardener.cloud
|
||||
package v1alpha1
|
||||
@@ -0,0 +1,40 @@
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// GroupName is the group name use in this package
|
||||
const GroupName = "shoot-fleet-agent-service.extensions.config.gardener.cloud"
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
|
||||
|
||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||
func Resource(resource string) schema.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
}
|
||||
|
||||
var (
|
||||
// SchemeBuilder used to register the Shoot resource.
|
||||
SchemeBuilder runtime.SchemeBuilder
|
||||
localSchemeBuilder = &SchemeBuilder
|
||||
// AddToScheme is a pointer to SchemeBuilder.AddToScheme.
|
||||
AddToScheme = localSchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
func init() {
|
||||
// We only register manually written functions here. The registration of the
|
||||
// generated functions takes place in the generated files. The separation
|
||||
// makes the code compile even when the generated files are missing.
|
||||
localSchemeBuilder.Register(addDefaultingFuncs, addKnownTypes)
|
||||
}
|
||||
|
||||
// Adds the list of known types to api.Scheme.
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&FleetAgentConfig{},
|
||||
)
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
healthcheckconfig "github.com/gardener/gardener/extensions/pkg/controller/healthcheck/config"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
componentbaseconfigv1alpha1 "k8s.io/component-base/config/v1alpha1"
|
||||
)
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// FleetAgentConfig configuration resource
|
||||
type FleetAgentConfig struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
|
||||
// ClientConnection specifies the kubeconfig file and client connection
|
||||
// settings for the proxy server to use when communicating with the apiserver.
|
||||
// +optional
|
||||
ClientConnection *componentbaseconfigv1alpha1.ClientConnectionConfiguration `json:"clientConnection,omitempty"`
|
||||
|
||||
// labels to use in Fleet Cluster registration
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
|
||||
//namespace to store clusters registrations in Fleet managers cluster
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
|
||||
HealthCheckConfig *healthcheckconfig.HealthCheckConfig `json:"healthCheckConfig,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT 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 conversion-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
unsafe "unsafe"
|
||||
|
||||
healthcheckconfig "github.com/gardener/gardener/extensions/pkg/controller/healthcheck/config"
|
||||
config "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis/config"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
componentbaseconfig "k8s.io/component-base/config"
|
||||
configv1alpha1 "k8s.io/component-base/config/v1alpha1"
|
||||
)
|
||||
|
||||
func init() {
|
||||
localSchemeBuilder.Register(RegisterConversions)
|
||||
}
|
||||
|
||||
// RegisterConversions adds conversion functions to the given scheme.
|
||||
// Public to allow building arbitrary schemes.
|
||||
func RegisterConversions(s *runtime.Scheme) error {
|
||||
if err := s.AddGeneratedConversionFunc((*FleetAgentConfig)(nil), (*config.FleetAgentConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha1_FleetAgentConfig_To_config_FleetAgentConfig(a.(*FleetAgentConfig), b.(*config.FleetAgentConfig), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*config.FleetAgentConfig)(nil), (*FleetAgentConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_config_FleetAgentConfig_To_v1alpha1_FleetAgentConfig(a.(*config.FleetAgentConfig), b.(*FleetAgentConfig), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_FleetAgentConfig_To_config_FleetAgentConfig(in *FleetAgentConfig, out *config.FleetAgentConfig, s conversion.Scope) error {
|
||||
out.ClientConnection = (*componentbaseconfig.ClientConnectionConfiguration)(unsafe.Pointer(in.ClientConnection))
|
||||
out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels))
|
||||
out.Namespace = in.Namespace
|
||||
out.HealthCheckConfig = (*healthcheckconfig.HealthCheckConfig)(unsafe.Pointer(in.HealthCheckConfig))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha1_FleetAgentConfig_To_config_FleetAgentConfig is an autogenerated conversion function.
|
||||
func Convert_v1alpha1_FleetAgentConfig_To_config_FleetAgentConfig(in *FleetAgentConfig, out *config.FleetAgentConfig, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_FleetAgentConfig_To_config_FleetAgentConfig(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_config_FleetAgentConfig_To_v1alpha1_FleetAgentConfig(in *config.FleetAgentConfig, out *FleetAgentConfig, s conversion.Scope) error {
|
||||
out.ClientConnection = (*configv1alpha1.ClientConnectionConfiguration)(unsafe.Pointer(in.ClientConnection))
|
||||
out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels))
|
||||
out.Namespace = in.Namespace
|
||||
out.HealthCheckConfig = (*healthcheckconfig.HealthCheckConfig)(unsafe.Pointer(in.HealthCheckConfig))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_config_FleetAgentConfig_To_v1alpha1_FleetAgentConfig is an autogenerated conversion function.
|
||||
func Convert_config_FleetAgentConfig_To_v1alpha1_FleetAgentConfig(in *config.FleetAgentConfig, out *FleetAgentConfig, s conversion.Scope) error {
|
||||
return autoConvert_config_FleetAgentConfig_To_v1alpha1_FleetAgentConfig(in, out, s)
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
config "github.com/gardener/gardener/extensions/pkg/controller/healthcheck/config"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
configv1alpha1 "k8s.io/component-base/config/v1alpha1"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FleetAgentConfig) DeepCopyInto(out *FleetAgentConfig) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
if in.ClientConnection != nil {
|
||||
in, out := &in.ClientConnection, &out.ClientConnection
|
||||
*out = new(configv1alpha1.ClientConnectionConfiguration)
|
||||
**out = **in
|
||||
}
|
||||
if in.Labels != nil {
|
||||
in, out := &in.Labels, &out.Labels
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.HealthCheckConfig != nil {
|
||||
in, out := &in.HealthCheckConfig, &out.HealthCheckConfig
|
||||
*out = new(config.HealthCheckConfig)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FleetAgentConfig.
|
||||
func (in *FleetAgentConfig) DeepCopy() *FleetAgentConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FleetAgentConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *FleetAgentConfig) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT 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
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package config
|
||||
|
||||
import (
|
||||
healthcheckconfig "github.com/gardener/gardener/extensions/pkg/controller/healthcheck/config"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
componentbaseconfig "k8s.io/component-base/config"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FleetAgentConfig) DeepCopyInto(out *FleetAgentConfig) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
if in.ClientConnection != nil {
|
||||
in, out := &in.ClientConnection, &out.ClientConnection
|
||||
*out = new(componentbaseconfig.ClientConnectionConfiguration)
|
||||
**out = **in
|
||||
}
|
||||
if in.Labels != nil {
|
||||
in, out := &in.Labels, &out.Labels
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.HealthCheckConfig != nil {
|
||||
in, out := &in.HealthCheckConfig, &out.HealthCheckConfig
|
||||
*out = new(healthcheckconfig.HealthCheckConfig)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FleetAgentConfig.
|
||||
func (in *FleetAgentConfig) DeepCopy() *FleetAgentConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FleetAgentConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *FleetAgentConfig) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT 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 versioned
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
fleetv1alpha1 "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/typed/fleet.cattle.io/v1alpha1"
|
||||
discovery "k8s.io/client-go/discovery"
|
||||
rest "k8s.io/client-go/rest"
|
||||
flowcontrol "k8s.io/client-go/util/flowcontrol"
|
||||
)
|
||||
|
||||
type Interface interface {
|
||||
Discovery() discovery.DiscoveryInterface
|
||||
FleetV1alpha1() fleetv1alpha1.FleetV1alpha1Interface
|
||||
}
|
||||
|
||||
// Clientset contains the clients for groups. Each group has exactly one
|
||||
// version included in a Clientset.
|
||||
type Clientset struct {
|
||||
*discovery.DiscoveryClient
|
||||
fleetV1alpha1 *fleetv1alpha1.FleetV1alpha1Client
|
||||
}
|
||||
|
||||
// FleetV1alpha1 retrieves the FleetV1alpha1Client
|
||||
func (c *Clientset) FleetV1alpha1() fleetv1alpha1.FleetV1alpha1Interface {
|
||||
return c.fleetV1alpha1
|
||||
}
|
||||
|
||||
// Discovery retrieves the DiscoveryClient
|
||||
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.DiscoveryClient
|
||||
}
|
||||
|
||||
// NewForConfig creates a new Clientset for the given config.
|
||||
// If config's RateLimiter is not set and QPS and Burst are acceptable,
|
||||
// NewForConfig will generate a rate-limiter in configShallowCopy.
|
||||
func NewForConfig(c *rest.Config) (*Clientset, error) {
|
||||
configShallowCopy := *c
|
||||
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
|
||||
if configShallowCopy.Burst <= 0 {
|
||||
return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0")
|
||||
}
|
||||
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
|
||||
}
|
||||
var cs Clientset
|
||||
var err error
|
||||
cs.fleetV1alpha1, err = fleetv1alpha1.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &cs, nil
|
||||
}
|
||||
|
||||
// NewForConfigOrDie creates a new Clientset for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *Clientset {
|
||||
var cs Clientset
|
||||
cs.fleetV1alpha1 = fleetv1alpha1.NewForConfigOrDie(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
|
||||
return &cs
|
||||
}
|
||||
|
||||
// New creates a new Clientset for the given RESTClient.
|
||||
func New(c rest.Interface) *Clientset {
|
||||
var cs Clientset
|
||||
cs.fleetV1alpha1 = fleetv1alpha1.New(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
|
||||
return &cs
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT 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 clientset.
|
||||
package versioned
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT 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 (
|
||||
clientset "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned"
|
||||
fleetv1alpha1 "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/typed/fleet.cattle.io/v1alpha1"
|
||||
fakefleetv1alpha1 "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/typed/fleet.cattle.io/v1alpha1/fake"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/discovery"
|
||||
fakediscovery "k8s.io/client-go/discovery/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{tracker: o}
|
||||
cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
|
||||
cs.AddReactor("*", "*", testing.ObjectReaction(o))
|
||||
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
|
||||
gvr := action.GetResource()
|
||||
ns := action.GetNamespace()
|
||||
watch, err := o.Watch(gvr, ns)
|
||||
if err != nil {
|
||||
return false, nil, err
|
||||
}
|
||||
return true, watch, nil
|
||||
})
|
||||
|
||||
return cs
|
||||
}
|
||||
|
||||
// Clientset implements clientset.Interface. Meant to be embedded into a
|
||||
// struct to get a default implementation. This makes faking out just the method
|
||||
// you want to test easier.
|
||||
type Clientset struct {
|
||||
testing.Fake
|
||||
discovery *fakediscovery.FakeDiscovery
|
||||
tracker testing.ObjectTracker
|
||||
}
|
||||
|
||||
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||
return c.discovery
|
||||
}
|
||||
|
||||
func (c *Clientset) Tracker() testing.ObjectTracker {
|
||||
return c.tracker
|
||||
}
|
||||
|
||||
var _ clientset.Interface = &Clientset{}
|
||||
|
||||
// FleetV1alpha1 retrieves the FleetV1alpha1Client
|
||||
func (c *Clientset) FleetV1alpha1() fleetv1alpha1.FleetV1alpha1Interface {
|
||||
return &fakefleetv1alpha1.FakeFleetV1alpha1{Fake: &c.Fake}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT 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
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT 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 (
|
||||
fleetv1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
)
|
||||
|
||||
var scheme = runtime.NewScheme()
|
||||
var codecs = serializer.NewCodecFactory(scheme)
|
||||
|
||||
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||
fleetv1alpha1.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))
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// This package contains the scheme of the automatically generated clientset.
|
||||
package scheme
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package scheme
|
||||
|
||||
import (
|
||||
fleetv1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
)
|
||||
|
||||
var Scheme = runtime.NewScheme()
|
||||
var Codecs = serializer.NewCodecFactory(Scheme)
|
||||
var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
||||
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||
fleetv1alpha1.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))
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
scheme "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/scheme"
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// BundlesGetter has a method to return a BundleInterface.
|
||||
// A group's client should implement this interface.
|
||||
type BundlesGetter interface {
|
||||
Bundles(namespace string) BundleInterface
|
||||
}
|
||||
|
||||
// BundleInterface has methods to work with Bundle resources.
|
||||
type BundleInterface interface {
|
||||
Create(ctx context.Context, bundle *v1alpha1.Bundle, opts v1.CreateOptions) (*v1alpha1.Bundle, error)
|
||||
Update(ctx context.Context, bundle *v1alpha1.Bundle, opts v1.UpdateOptions) (*v1alpha1.Bundle, error)
|
||||
UpdateStatus(ctx context.Context, bundle *v1alpha1.Bundle, opts v1.UpdateOptions) (*v1alpha1.Bundle, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Bundle, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.BundleList, error)
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Bundle, err error)
|
||||
BundleExpansion
|
||||
}
|
||||
|
||||
// bundles implements BundleInterface
|
||||
type bundles struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newBundles returns a Bundles
|
||||
func newBundles(c *FleetV1alpha1Client, namespace string) *bundles {
|
||||
return &bundles{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the bundle, and returns the corresponding bundle object, and an error if there is any.
|
||||
func (c *bundles) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Bundle, err error) {
|
||||
result = &v1alpha1.Bundle{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("bundles").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Bundles that match those selectors.
|
||||
func (c *bundles) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BundleList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1alpha1.BundleList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("bundles").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested bundles.
|
||||
func (c *bundles) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("bundles").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a bundle and creates it. Returns the server's representation of the bundle, and an error, if there is any.
|
||||
func (c *bundles) Create(ctx context.Context, bundle *v1alpha1.Bundle, opts v1.CreateOptions) (result *v1alpha1.Bundle, err error) {
|
||||
result = &v1alpha1.Bundle{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("bundles").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(bundle).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a bundle and updates it. Returns the server's representation of the bundle, and an error, if there is any.
|
||||
func (c *bundles) Update(ctx context.Context, bundle *v1alpha1.Bundle, opts v1.UpdateOptions) (result *v1alpha1.Bundle, err error) {
|
||||
result = &v1alpha1.Bundle{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("bundles").
|
||||
Name(bundle.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(bundle).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *bundles) UpdateStatus(ctx context.Context, bundle *v1alpha1.Bundle, opts v1.UpdateOptions) (result *v1alpha1.Bundle, err error) {
|
||||
result = &v1alpha1.Bundle{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("bundles").
|
||||
Name(bundle.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(bundle).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the bundle and deletes it. Returns an error if one occurs.
|
||||
func (c *bundles) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("bundles").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *bundles) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("bundles").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched bundle.
|
||||
func (c *bundles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Bundle, err error) {
|
||||
result = &v1alpha1.Bundle{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("bundles").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
+195
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
scheme "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/scheme"
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// BundleDeploymentsGetter has a method to return a BundleDeploymentInterface.
|
||||
// A group's client should implement this interface.
|
||||
type BundleDeploymentsGetter interface {
|
||||
BundleDeployments(namespace string) BundleDeploymentInterface
|
||||
}
|
||||
|
||||
// BundleDeploymentInterface has methods to work with BundleDeployment resources.
|
||||
type BundleDeploymentInterface interface {
|
||||
Create(ctx context.Context, bundleDeployment *v1alpha1.BundleDeployment, opts v1.CreateOptions) (*v1alpha1.BundleDeployment, error)
|
||||
Update(ctx context.Context, bundleDeployment *v1alpha1.BundleDeployment, opts v1.UpdateOptions) (*v1alpha1.BundleDeployment, error)
|
||||
UpdateStatus(ctx context.Context, bundleDeployment *v1alpha1.BundleDeployment, opts v1.UpdateOptions) (*v1alpha1.BundleDeployment, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.BundleDeployment, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.BundleDeploymentList, error)
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BundleDeployment, err error)
|
||||
BundleDeploymentExpansion
|
||||
}
|
||||
|
||||
// bundleDeployments implements BundleDeploymentInterface
|
||||
type bundleDeployments struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newBundleDeployments returns a BundleDeployments
|
||||
func newBundleDeployments(c *FleetV1alpha1Client, namespace string) *bundleDeployments {
|
||||
return &bundleDeployments{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the bundleDeployment, and returns the corresponding bundleDeployment object, and an error if there is any.
|
||||
func (c *bundleDeployments) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.BundleDeployment, err error) {
|
||||
result = &v1alpha1.BundleDeployment{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("bundledeployments").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of BundleDeployments that match those selectors.
|
||||
func (c *bundleDeployments) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BundleDeploymentList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1alpha1.BundleDeploymentList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("bundledeployments").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested bundleDeployments.
|
||||
func (c *bundleDeployments) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("bundledeployments").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a bundleDeployment and creates it. Returns the server's representation of the bundleDeployment, and an error, if there is any.
|
||||
func (c *bundleDeployments) Create(ctx context.Context, bundleDeployment *v1alpha1.BundleDeployment, opts v1.CreateOptions) (result *v1alpha1.BundleDeployment, err error) {
|
||||
result = &v1alpha1.BundleDeployment{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("bundledeployments").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(bundleDeployment).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a bundleDeployment and updates it. Returns the server's representation of the bundleDeployment, and an error, if there is any.
|
||||
func (c *bundleDeployments) Update(ctx context.Context, bundleDeployment *v1alpha1.BundleDeployment, opts v1.UpdateOptions) (result *v1alpha1.BundleDeployment, err error) {
|
||||
result = &v1alpha1.BundleDeployment{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("bundledeployments").
|
||||
Name(bundleDeployment.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(bundleDeployment).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *bundleDeployments) UpdateStatus(ctx context.Context, bundleDeployment *v1alpha1.BundleDeployment, opts v1.UpdateOptions) (result *v1alpha1.BundleDeployment, err error) {
|
||||
result = &v1alpha1.BundleDeployment{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("bundledeployments").
|
||||
Name(bundleDeployment.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(bundleDeployment).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the bundleDeployment and deletes it. Returns an error if one occurs.
|
||||
func (c *bundleDeployments) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("bundledeployments").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *bundleDeployments) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("bundledeployments").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched bundleDeployment.
|
||||
func (c *bundleDeployments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BundleDeployment, err error) {
|
||||
result = &v1alpha1.BundleDeployment{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("bundledeployments").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
+178
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
scheme "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/scheme"
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// BundleNamespaceMappingsGetter has a method to return a BundleNamespaceMappingInterface.
|
||||
// A group's client should implement this interface.
|
||||
type BundleNamespaceMappingsGetter interface {
|
||||
BundleNamespaceMappings(namespace string) BundleNamespaceMappingInterface
|
||||
}
|
||||
|
||||
// BundleNamespaceMappingInterface has methods to work with BundleNamespaceMapping resources.
|
||||
type BundleNamespaceMappingInterface interface {
|
||||
Create(ctx context.Context, bundleNamespaceMapping *v1alpha1.BundleNamespaceMapping, opts v1.CreateOptions) (*v1alpha1.BundleNamespaceMapping, error)
|
||||
Update(ctx context.Context, bundleNamespaceMapping *v1alpha1.BundleNamespaceMapping, opts v1.UpdateOptions) (*v1alpha1.BundleNamespaceMapping, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.BundleNamespaceMapping, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.BundleNamespaceMappingList, error)
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BundleNamespaceMapping, err error)
|
||||
BundleNamespaceMappingExpansion
|
||||
}
|
||||
|
||||
// bundleNamespaceMappings implements BundleNamespaceMappingInterface
|
||||
type bundleNamespaceMappings struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newBundleNamespaceMappings returns a BundleNamespaceMappings
|
||||
func newBundleNamespaceMappings(c *FleetV1alpha1Client, namespace string) *bundleNamespaceMappings {
|
||||
return &bundleNamespaceMappings{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the bundleNamespaceMapping, and returns the corresponding bundleNamespaceMapping object, and an error if there is any.
|
||||
func (c *bundleNamespaceMappings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.BundleNamespaceMapping, err error) {
|
||||
result = &v1alpha1.BundleNamespaceMapping{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("bundlenamespacemappings").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of BundleNamespaceMappings that match those selectors.
|
||||
func (c *bundleNamespaceMappings) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BundleNamespaceMappingList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1alpha1.BundleNamespaceMappingList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("bundlenamespacemappings").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested bundleNamespaceMappings.
|
||||
func (c *bundleNamespaceMappings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("bundlenamespacemappings").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a bundleNamespaceMapping and creates it. Returns the server's representation of the bundleNamespaceMapping, and an error, if there is any.
|
||||
func (c *bundleNamespaceMappings) Create(ctx context.Context, bundleNamespaceMapping *v1alpha1.BundleNamespaceMapping, opts v1.CreateOptions) (result *v1alpha1.BundleNamespaceMapping, err error) {
|
||||
result = &v1alpha1.BundleNamespaceMapping{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("bundlenamespacemappings").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(bundleNamespaceMapping).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a bundleNamespaceMapping and updates it. Returns the server's representation of the bundleNamespaceMapping, and an error, if there is any.
|
||||
func (c *bundleNamespaceMappings) Update(ctx context.Context, bundleNamespaceMapping *v1alpha1.BundleNamespaceMapping, opts v1.UpdateOptions) (result *v1alpha1.BundleNamespaceMapping, err error) {
|
||||
result = &v1alpha1.BundleNamespaceMapping{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("bundlenamespacemappings").
|
||||
Name(bundleNamespaceMapping.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(bundleNamespaceMapping).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the bundleNamespaceMapping and deletes it. Returns an error if one occurs.
|
||||
func (c *bundleNamespaceMappings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("bundlenamespacemappings").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *bundleNamespaceMappings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("bundlenamespacemappings").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched bundleNamespaceMapping.
|
||||
func (c *bundleNamespaceMappings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BundleNamespaceMapping, err error) {
|
||||
result = &v1alpha1.BundleNamespaceMapping{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("bundlenamespacemappings").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
scheme "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/scheme"
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// ClustersGetter has a method to return a ClusterInterface.
|
||||
// A group's client should implement this interface.
|
||||
type ClustersGetter interface {
|
||||
Clusters(namespace string) ClusterInterface
|
||||
}
|
||||
|
||||
// ClusterInterface has methods to work with Cluster resources.
|
||||
type ClusterInterface interface {
|
||||
Create(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.CreateOptions) (*v1alpha1.Cluster, error)
|
||||
Update(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (*v1alpha1.Cluster, error)
|
||||
UpdateStatus(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (*v1alpha1.Cluster, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Cluster, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ClusterList, error)
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Cluster, err error)
|
||||
ClusterExpansion
|
||||
}
|
||||
|
||||
// clusters implements ClusterInterface
|
||||
type clusters struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newClusters returns a Clusters
|
||||
func newClusters(c *FleetV1alpha1Client, namespace string) *clusters {
|
||||
return &clusters{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any.
|
||||
func (c *clusters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Cluster, err error) {
|
||||
result = &v1alpha1.Cluster{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("clusters").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Clusters that match those selectors.
|
||||
func (c *clusters) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1alpha1.ClusterList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("clusters").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested clusters.
|
||||
func (c *clusters) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("clusters").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any.
|
||||
func (c *clusters) Create(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.CreateOptions) (result *v1alpha1.Cluster, err error) {
|
||||
result = &v1alpha1.Cluster{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("clusters").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(cluster).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any.
|
||||
func (c *clusters) Update(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (result *v1alpha1.Cluster, err error) {
|
||||
result = &v1alpha1.Cluster{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("clusters").
|
||||
Name(cluster.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(cluster).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *clusters) UpdateStatus(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (result *v1alpha1.Cluster, err error) {
|
||||
result = &v1alpha1.Cluster{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("clusters").
|
||||
Name(cluster.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(cluster).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the cluster and deletes it. Returns an error if one occurs.
|
||||
func (c *clusters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("clusters").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *clusters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("clusters").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched cluster.
|
||||
func (c *clusters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Cluster, err error) {
|
||||
result = &v1alpha1.Cluster{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("clusters").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
scheme "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/scheme"
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// ClusterGroupsGetter has a method to return a ClusterGroupInterface.
|
||||
// A group's client should implement this interface.
|
||||
type ClusterGroupsGetter interface {
|
||||
ClusterGroups(namespace string) ClusterGroupInterface
|
||||
}
|
||||
|
||||
// ClusterGroupInterface has methods to work with ClusterGroup resources.
|
||||
type ClusterGroupInterface interface {
|
||||
Create(ctx context.Context, clusterGroup *v1alpha1.ClusterGroup, opts v1.CreateOptions) (*v1alpha1.ClusterGroup, error)
|
||||
Update(ctx context.Context, clusterGroup *v1alpha1.ClusterGroup, opts v1.UpdateOptions) (*v1alpha1.ClusterGroup, error)
|
||||
UpdateStatus(ctx context.Context, clusterGroup *v1alpha1.ClusterGroup, opts v1.UpdateOptions) (*v1alpha1.ClusterGroup, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ClusterGroup, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ClusterGroupList, error)
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterGroup, err error)
|
||||
ClusterGroupExpansion
|
||||
}
|
||||
|
||||
// clusterGroups implements ClusterGroupInterface
|
||||
type clusterGroups struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newClusterGroups returns a ClusterGroups
|
||||
func newClusterGroups(c *FleetV1alpha1Client, namespace string) *clusterGroups {
|
||||
return &clusterGroups{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the clusterGroup, and returns the corresponding clusterGroup object, and an error if there is any.
|
||||
func (c *clusterGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterGroup, err error) {
|
||||
result = &v1alpha1.ClusterGroup{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("clustergroups").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ClusterGroups that match those selectors.
|
||||
func (c *clusterGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterGroupList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1alpha1.ClusterGroupList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("clustergroups").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested clusterGroups.
|
||||
func (c *clusterGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("clustergroups").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a clusterGroup and creates it. Returns the server's representation of the clusterGroup, and an error, if there is any.
|
||||
func (c *clusterGroups) Create(ctx context.Context, clusterGroup *v1alpha1.ClusterGroup, opts v1.CreateOptions) (result *v1alpha1.ClusterGroup, err error) {
|
||||
result = &v1alpha1.ClusterGroup{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("clustergroups").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterGroup).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a clusterGroup and updates it. Returns the server's representation of the clusterGroup, and an error, if there is any.
|
||||
func (c *clusterGroups) Update(ctx context.Context, clusterGroup *v1alpha1.ClusterGroup, opts v1.UpdateOptions) (result *v1alpha1.ClusterGroup, err error) {
|
||||
result = &v1alpha1.ClusterGroup{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("clustergroups").
|
||||
Name(clusterGroup.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterGroup).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *clusterGroups) UpdateStatus(ctx context.Context, clusterGroup *v1alpha1.ClusterGroup, opts v1.UpdateOptions) (result *v1alpha1.ClusterGroup, err error) {
|
||||
result = &v1alpha1.ClusterGroup{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("clustergroups").
|
||||
Name(clusterGroup.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterGroup).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the clusterGroup and deletes it. Returns an error if one occurs.
|
||||
func (c *clusterGroups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("clustergroups").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *clusterGroups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("clustergroups").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched clusterGroup.
|
||||
func (c *clusterGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterGroup, err error) {
|
||||
result = &v1alpha1.ClusterGroup{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("clustergroups").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
+195
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
scheme "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/scheme"
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// ClusterRegistrationsGetter has a method to return a ClusterRegistrationInterface.
|
||||
// A group's client should implement this interface.
|
||||
type ClusterRegistrationsGetter interface {
|
||||
ClusterRegistrations(namespace string) ClusterRegistrationInterface
|
||||
}
|
||||
|
||||
// ClusterRegistrationInterface has methods to work with ClusterRegistration resources.
|
||||
type ClusterRegistrationInterface interface {
|
||||
Create(ctx context.Context, clusterRegistration *v1alpha1.ClusterRegistration, opts v1.CreateOptions) (*v1alpha1.ClusterRegistration, error)
|
||||
Update(ctx context.Context, clusterRegistration *v1alpha1.ClusterRegistration, opts v1.UpdateOptions) (*v1alpha1.ClusterRegistration, error)
|
||||
UpdateStatus(ctx context.Context, clusterRegistration *v1alpha1.ClusterRegistration, opts v1.UpdateOptions) (*v1alpha1.ClusterRegistration, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ClusterRegistration, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ClusterRegistrationList, error)
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterRegistration, err error)
|
||||
ClusterRegistrationExpansion
|
||||
}
|
||||
|
||||
// clusterRegistrations implements ClusterRegistrationInterface
|
||||
type clusterRegistrations struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newClusterRegistrations returns a ClusterRegistrations
|
||||
func newClusterRegistrations(c *FleetV1alpha1Client, namespace string) *clusterRegistrations {
|
||||
return &clusterRegistrations{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the clusterRegistration, and returns the corresponding clusterRegistration object, and an error if there is any.
|
||||
func (c *clusterRegistrations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterRegistration, err error) {
|
||||
result = &v1alpha1.ClusterRegistration{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterregistrations").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ClusterRegistrations that match those selectors.
|
||||
func (c *clusterRegistrations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterRegistrationList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1alpha1.ClusterRegistrationList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterregistrations").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested clusterRegistrations.
|
||||
func (c *clusterRegistrations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterregistrations").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a clusterRegistration and creates it. Returns the server's representation of the clusterRegistration, and an error, if there is any.
|
||||
func (c *clusterRegistrations) Create(ctx context.Context, clusterRegistration *v1alpha1.ClusterRegistration, opts v1.CreateOptions) (result *v1alpha1.ClusterRegistration, err error) {
|
||||
result = &v1alpha1.ClusterRegistration{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterregistrations").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterRegistration).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a clusterRegistration and updates it. Returns the server's representation of the clusterRegistration, and an error, if there is any.
|
||||
func (c *clusterRegistrations) Update(ctx context.Context, clusterRegistration *v1alpha1.ClusterRegistration, opts v1.UpdateOptions) (result *v1alpha1.ClusterRegistration, err error) {
|
||||
result = &v1alpha1.ClusterRegistration{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterregistrations").
|
||||
Name(clusterRegistration.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterRegistration).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *clusterRegistrations) UpdateStatus(ctx context.Context, clusterRegistration *v1alpha1.ClusterRegistration, opts v1.UpdateOptions) (result *v1alpha1.ClusterRegistration, err error) {
|
||||
result = &v1alpha1.ClusterRegistration{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterregistrations").
|
||||
Name(clusterRegistration.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterRegistration).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the clusterRegistration and deletes it. Returns an error if one occurs.
|
||||
func (c *clusterRegistrations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterregistrations").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *clusterRegistrations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterregistrations").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched clusterRegistration.
|
||||
func (c *clusterRegistrations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterRegistration, err error) {
|
||||
result = &v1alpha1.ClusterRegistration{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("clusterregistrations").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
+195
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
scheme "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/scheme"
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// ClusterRegistrationTokensGetter has a method to return a ClusterRegistrationTokenInterface.
|
||||
// A group's client should implement this interface.
|
||||
type ClusterRegistrationTokensGetter interface {
|
||||
ClusterRegistrationTokens(namespace string) ClusterRegistrationTokenInterface
|
||||
}
|
||||
|
||||
// ClusterRegistrationTokenInterface has methods to work with ClusterRegistrationToken resources.
|
||||
type ClusterRegistrationTokenInterface interface {
|
||||
Create(ctx context.Context, clusterRegistrationToken *v1alpha1.ClusterRegistrationToken, opts v1.CreateOptions) (*v1alpha1.ClusterRegistrationToken, error)
|
||||
Update(ctx context.Context, clusterRegistrationToken *v1alpha1.ClusterRegistrationToken, opts v1.UpdateOptions) (*v1alpha1.ClusterRegistrationToken, error)
|
||||
UpdateStatus(ctx context.Context, clusterRegistrationToken *v1alpha1.ClusterRegistrationToken, opts v1.UpdateOptions) (*v1alpha1.ClusterRegistrationToken, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ClusterRegistrationToken, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ClusterRegistrationTokenList, error)
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterRegistrationToken, err error)
|
||||
ClusterRegistrationTokenExpansion
|
||||
}
|
||||
|
||||
// clusterRegistrationTokens implements ClusterRegistrationTokenInterface
|
||||
type clusterRegistrationTokens struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newClusterRegistrationTokens returns a ClusterRegistrationTokens
|
||||
func newClusterRegistrationTokens(c *FleetV1alpha1Client, namespace string) *clusterRegistrationTokens {
|
||||
return &clusterRegistrationTokens{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the clusterRegistrationToken, and returns the corresponding clusterRegistrationToken object, and an error if there is any.
|
||||
func (c *clusterRegistrationTokens) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterRegistrationToken, err error) {
|
||||
result = &v1alpha1.ClusterRegistrationToken{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterregistrationtokens").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ClusterRegistrationTokens that match those selectors.
|
||||
func (c *clusterRegistrationTokens) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterRegistrationTokenList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1alpha1.ClusterRegistrationTokenList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterregistrationtokens").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested clusterRegistrationTokens.
|
||||
func (c *clusterRegistrationTokens) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterregistrationtokens").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a clusterRegistrationToken and creates it. Returns the server's representation of the clusterRegistrationToken, and an error, if there is any.
|
||||
func (c *clusterRegistrationTokens) Create(ctx context.Context, clusterRegistrationToken *v1alpha1.ClusterRegistrationToken, opts v1.CreateOptions) (result *v1alpha1.ClusterRegistrationToken, err error) {
|
||||
result = &v1alpha1.ClusterRegistrationToken{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterregistrationtokens").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterRegistrationToken).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a clusterRegistrationToken and updates it. Returns the server's representation of the clusterRegistrationToken, and an error, if there is any.
|
||||
func (c *clusterRegistrationTokens) Update(ctx context.Context, clusterRegistrationToken *v1alpha1.ClusterRegistrationToken, opts v1.UpdateOptions) (result *v1alpha1.ClusterRegistrationToken, err error) {
|
||||
result = &v1alpha1.ClusterRegistrationToken{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterregistrationtokens").
|
||||
Name(clusterRegistrationToken.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterRegistrationToken).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *clusterRegistrationTokens) UpdateStatus(ctx context.Context, clusterRegistrationToken *v1alpha1.ClusterRegistrationToken, opts v1.UpdateOptions) (result *v1alpha1.ClusterRegistrationToken, err error) {
|
||||
result = &v1alpha1.ClusterRegistrationToken{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterregistrationtokens").
|
||||
Name(clusterRegistrationToken.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterRegistrationToken).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the clusterRegistrationToken and deletes it. Returns an error if one occurs.
|
||||
func (c *clusterRegistrationTokens) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterregistrationtokens").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *clusterRegistrationTokens) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterregistrationtokens").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched clusterRegistrationToken.
|
||||
func (c *clusterRegistrationTokens) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterRegistrationToken, err error) {
|
||||
result = &v1alpha1.ClusterRegistrationToken{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("clusterregistrationtokens").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
scheme "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/scheme"
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// ContentsGetter has a method to return a ContentInterface.
|
||||
// A group's client should implement this interface.
|
||||
type ContentsGetter interface {
|
||||
Contents() ContentInterface
|
||||
}
|
||||
|
||||
// ContentInterface has methods to work with Content resources.
|
||||
type ContentInterface interface {
|
||||
Create(ctx context.Context, content *v1alpha1.Content, opts v1.CreateOptions) (*v1alpha1.Content, error)
|
||||
Update(ctx context.Context, content *v1alpha1.Content, opts v1.UpdateOptions) (*v1alpha1.Content, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Content, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ContentList, error)
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Content, err error)
|
||||
ContentExpansion
|
||||
}
|
||||
|
||||
// contents implements ContentInterface
|
||||
type contents struct {
|
||||
client rest.Interface
|
||||
}
|
||||
|
||||
// newContents returns a Contents
|
||||
func newContents(c *FleetV1alpha1Client) *contents {
|
||||
return &contents{
|
||||
client: c.RESTClient(),
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the content, and returns the corresponding content object, and an error if there is any.
|
||||
func (c *contents) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Content, err error) {
|
||||
result = &v1alpha1.Content{}
|
||||
err = c.client.Get().
|
||||
Resource("contents").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Contents that match those selectors.
|
||||
func (c *contents) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ContentList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1alpha1.ContentList{}
|
||||
err = c.client.Get().
|
||||
Resource("contents").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested contents.
|
||||
func (c *contents) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Resource("contents").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a content and creates it. Returns the server's representation of the content, and an error, if there is any.
|
||||
func (c *contents) Create(ctx context.Context, content *v1alpha1.Content, opts v1.CreateOptions) (result *v1alpha1.Content, err error) {
|
||||
result = &v1alpha1.Content{}
|
||||
err = c.client.Post().
|
||||
Resource("contents").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(content).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a content and updates it. Returns the server's representation of the content, and an error, if there is any.
|
||||
func (c *contents) Update(ctx context.Context, content *v1alpha1.Content, opts v1.UpdateOptions) (result *v1alpha1.Content, err error) {
|
||||
result = &v1alpha1.Content{}
|
||||
err = c.client.Put().
|
||||
Resource("contents").
|
||||
Name(content.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(content).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the content and deletes it. Returns an error if one occurs.
|
||||
func (c *contents) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Resource("contents").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *contents) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Resource("contents").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched content.
|
||||
func (c *contents) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Content, err error) {
|
||||
result = &v1alpha1.Content{}
|
||||
err = c.client.Patch(pt).
|
||||
Resource("contents").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v1alpha1
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT 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
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT 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 (
|
||||
"context"
|
||||
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/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"
|
||||
)
|
||||
|
||||
// FakeBundles implements BundleInterface
|
||||
type FakeBundles struct {
|
||||
Fake *FakeFleetV1alpha1
|
||||
ns string
|
||||
}
|
||||
|
||||
var bundlesResource = schema.GroupVersionResource{Group: "fleet.cattle.io", Version: "v1alpha1", Resource: "bundles"}
|
||||
|
||||
var bundlesKind = schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "Bundle"}
|
||||
|
||||
// Get takes name of the bundle, and returns the corresponding bundle object, and an error if there is any.
|
||||
func (c *FakeBundles) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Bundle, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(bundlesResource, c.ns, name), &v1alpha1.Bundle{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Bundle), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Bundles that match those selectors.
|
||||
func (c *FakeBundles) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BundleList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(bundlesResource, bundlesKind, c.ns, opts), &v1alpha1.BundleList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.BundleList{ListMeta: obj.(*v1alpha1.BundleList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.BundleList).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 bundles.
|
||||
func (c *FakeBundles) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(bundlesResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a bundle and creates it. Returns the server's representation of the bundle, and an error, if there is any.
|
||||
func (c *FakeBundles) Create(ctx context.Context, bundle *v1alpha1.Bundle, opts v1.CreateOptions) (result *v1alpha1.Bundle, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(bundlesResource, c.ns, bundle), &v1alpha1.Bundle{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Bundle), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a bundle and updates it. Returns the server's representation of the bundle, and an error, if there is any.
|
||||
func (c *FakeBundles) Update(ctx context.Context, bundle *v1alpha1.Bundle, opts v1.UpdateOptions) (result *v1alpha1.Bundle, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(bundlesResource, c.ns, bundle), &v1alpha1.Bundle{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Bundle), 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 *FakeBundles) UpdateStatus(ctx context.Context, bundle *v1alpha1.Bundle, opts v1.UpdateOptions) (*v1alpha1.Bundle, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(bundlesResource, "status", c.ns, bundle), &v1alpha1.Bundle{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Bundle), err
|
||||
}
|
||||
|
||||
// Delete takes name of the bundle and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeBundles) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(bundlesResource, c.ns, name), &v1alpha1.Bundle{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeBundles) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(bundlesResource, c.ns, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.BundleList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched bundle.
|
||||
func (c *FakeBundles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Bundle, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(bundlesResource, c.ns, name, pt, data, subresources...), &v1alpha1.Bundle{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Bundle), err
|
||||
}
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT 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 (
|
||||
"context"
|
||||
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/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"
|
||||
)
|
||||
|
||||
// FakeBundleDeployments implements BundleDeploymentInterface
|
||||
type FakeBundleDeployments struct {
|
||||
Fake *FakeFleetV1alpha1
|
||||
ns string
|
||||
}
|
||||
|
||||
var bundledeploymentsResource = schema.GroupVersionResource{Group: "fleet.cattle.io", Version: "v1alpha1", Resource: "bundledeployments"}
|
||||
|
||||
var bundledeploymentsKind = schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "BundleDeployment"}
|
||||
|
||||
// Get takes name of the bundleDeployment, and returns the corresponding bundleDeployment object, and an error if there is any.
|
||||
func (c *FakeBundleDeployments) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.BundleDeployment, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(bundledeploymentsResource, c.ns, name), &v1alpha1.BundleDeployment{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.BundleDeployment), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of BundleDeployments that match those selectors.
|
||||
func (c *FakeBundleDeployments) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BundleDeploymentList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(bundledeploymentsResource, bundledeploymentsKind, c.ns, opts), &v1alpha1.BundleDeploymentList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.BundleDeploymentList{ListMeta: obj.(*v1alpha1.BundleDeploymentList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.BundleDeploymentList).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 bundleDeployments.
|
||||
func (c *FakeBundleDeployments) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(bundledeploymentsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a bundleDeployment and creates it. Returns the server's representation of the bundleDeployment, and an error, if there is any.
|
||||
func (c *FakeBundleDeployments) Create(ctx context.Context, bundleDeployment *v1alpha1.BundleDeployment, opts v1.CreateOptions) (result *v1alpha1.BundleDeployment, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(bundledeploymentsResource, c.ns, bundleDeployment), &v1alpha1.BundleDeployment{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.BundleDeployment), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a bundleDeployment and updates it. Returns the server's representation of the bundleDeployment, and an error, if there is any.
|
||||
func (c *FakeBundleDeployments) Update(ctx context.Context, bundleDeployment *v1alpha1.BundleDeployment, opts v1.UpdateOptions) (result *v1alpha1.BundleDeployment, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(bundledeploymentsResource, c.ns, bundleDeployment), &v1alpha1.BundleDeployment{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.BundleDeployment), 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 *FakeBundleDeployments) UpdateStatus(ctx context.Context, bundleDeployment *v1alpha1.BundleDeployment, opts v1.UpdateOptions) (*v1alpha1.BundleDeployment, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(bundledeploymentsResource, "status", c.ns, bundleDeployment), &v1alpha1.BundleDeployment{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.BundleDeployment), err
|
||||
}
|
||||
|
||||
// Delete takes name of the bundleDeployment and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeBundleDeployments) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(bundledeploymentsResource, c.ns, name), &v1alpha1.BundleDeployment{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeBundleDeployments) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(bundledeploymentsResource, c.ns, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.BundleDeploymentList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched bundleDeployment.
|
||||
func (c *FakeBundleDeployments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BundleDeployment, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(bundledeploymentsResource, c.ns, name, pt, data, subresources...), &v1alpha1.BundleDeployment{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.BundleDeployment), err
|
||||
}
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT 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 (
|
||||
"context"
|
||||
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/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"
|
||||
)
|
||||
|
||||
// FakeBundleNamespaceMappings implements BundleNamespaceMappingInterface
|
||||
type FakeBundleNamespaceMappings struct {
|
||||
Fake *FakeFleetV1alpha1
|
||||
ns string
|
||||
}
|
||||
|
||||
var bundlenamespacemappingsResource = schema.GroupVersionResource{Group: "fleet.cattle.io", Version: "v1alpha1", Resource: "bundlenamespacemappings"}
|
||||
|
||||
var bundlenamespacemappingsKind = schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "BundleNamespaceMapping"}
|
||||
|
||||
// Get takes name of the bundleNamespaceMapping, and returns the corresponding bundleNamespaceMapping object, and an error if there is any.
|
||||
func (c *FakeBundleNamespaceMappings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.BundleNamespaceMapping, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(bundlenamespacemappingsResource, c.ns, name), &v1alpha1.BundleNamespaceMapping{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.BundleNamespaceMapping), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of BundleNamespaceMappings that match those selectors.
|
||||
func (c *FakeBundleNamespaceMappings) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BundleNamespaceMappingList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(bundlenamespacemappingsResource, bundlenamespacemappingsKind, c.ns, opts), &v1alpha1.BundleNamespaceMappingList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.BundleNamespaceMappingList{ListMeta: obj.(*v1alpha1.BundleNamespaceMappingList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.BundleNamespaceMappingList).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 bundleNamespaceMappings.
|
||||
func (c *FakeBundleNamespaceMappings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(bundlenamespacemappingsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a bundleNamespaceMapping and creates it. Returns the server's representation of the bundleNamespaceMapping, and an error, if there is any.
|
||||
func (c *FakeBundleNamespaceMappings) Create(ctx context.Context, bundleNamespaceMapping *v1alpha1.BundleNamespaceMapping, opts v1.CreateOptions) (result *v1alpha1.BundleNamespaceMapping, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(bundlenamespacemappingsResource, c.ns, bundleNamespaceMapping), &v1alpha1.BundleNamespaceMapping{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.BundleNamespaceMapping), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a bundleNamespaceMapping and updates it. Returns the server's representation of the bundleNamespaceMapping, and an error, if there is any.
|
||||
func (c *FakeBundleNamespaceMappings) Update(ctx context.Context, bundleNamespaceMapping *v1alpha1.BundleNamespaceMapping, opts v1.UpdateOptions) (result *v1alpha1.BundleNamespaceMapping, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(bundlenamespacemappingsResource, c.ns, bundleNamespaceMapping), &v1alpha1.BundleNamespaceMapping{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.BundleNamespaceMapping), err
|
||||
}
|
||||
|
||||
// Delete takes name of the bundleNamespaceMapping and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeBundleNamespaceMappings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(bundlenamespacemappingsResource, c.ns, name), &v1alpha1.BundleNamespaceMapping{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeBundleNamespaceMappings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(bundlenamespacemappingsResource, c.ns, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.BundleNamespaceMappingList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched bundleNamespaceMapping.
|
||||
func (c *FakeBundleNamespaceMappings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BundleNamespaceMapping, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(bundlenamespacemappingsResource, c.ns, name, pt, data, subresources...), &v1alpha1.BundleNamespaceMapping{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.BundleNamespaceMapping), err
|
||||
}
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT 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 (
|
||||
"context"
|
||||
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/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"
|
||||
)
|
||||
|
||||
// FakeClusters implements ClusterInterface
|
||||
type FakeClusters struct {
|
||||
Fake *FakeFleetV1alpha1
|
||||
ns string
|
||||
}
|
||||
|
||||
var clustersResource = schema.GroupVersionResource{Group: "fleet.cattle.io", Version: "v1alpha1", Resource: "clusters"}
|
||||
|
||||
var clustersKind = schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "Cluster"}
|
||||
|
||||
// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any.
|
||||
func (c *FakeClusters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Cluster, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(clustersResource, c.ns, name), &v1alpha1.Cluster{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Cluster), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Clusters that match those selectors.
|
||||
func (c *FakeClusters) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(clustersResource, clustersKind, c.ns, opts), &v1alpha1.ClusterList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.ClusterList{ListMeta: obj.(*v1alpha1.ClusterList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.ClusterList).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 clusters.
|
||||
func (c *FakeClusters) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(clustersResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any.
|
||||
func (c *FakeClusters) Create(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.CreateOptions) (result *v1alpha1.Cluster, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(clustersResource, c.ns, cluster), &v1alpha1.Cluster{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Cluster), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any.
|
||||
func (c *FakeClusters) Update(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (result *v1alpha1.Cluster, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(clustersResource, c.ns, cluster), &v1alpha1.Cluster{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Cluster), 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 *FakeClusters) UpdateStatus(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (*v1alpha1.Cluster, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(clustersResource, "status", c.ns, cluster), &v1alpha1.Cluster{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Cluster), err
|
||||
}
|
||||
|
||||
// Delete takes name of the cluster and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeClusters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(clustersResource, c.ns, name), &v1alpha1.Cluster{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeClusters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(clustersResource, c.ns, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.ClusterList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched cluster.
|
||||
func (c *FakeClusters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Cluster, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(clustersResource, c.ns, name, pt, data, subresources...), &v1alpha1.Cluster{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Cluster), err
|
||||
}
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT 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 (
|
||||
"context"
|
||||
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/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"
|
||||
)
|
||||
|
||||
// FakeClusterGroups implements ClusterGroupInterface
|
||||
type FakeClusterGroups struct {
|
||||
Fake *FakeFleetV1alpha1
|
||||
ns string
|
||||
}
|
||||
|
||||
var clustergroupsResource = schema.GroupVersionResource{Group: "fleet.cattle.io", Version: "v1alpha1", Resource: "clustergroups"}
|
||||
|
||||
var clustergroupsKind = schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "ClusterGroup"}
|
||||
|
||||
// Get takes name of the clusterGroup, and returns the corresponding clusterGroup object, and an error if there is any.
|
||||
func (c *FakeClusterGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterGroup, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(clustergroupsResource, c.ns, name), &v1alpha1.ClusterGroup{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ClusterGroup), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ClusterGroups that match those selectors.
|
||||
func (c *FakeClusterGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterGroupList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(clustergroupsResource, clustergroupsKind, c.ns, opts), &v1alpha1.ClusterGroupList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.ClusterGroupList{ListMeta: obj.(*v1alpha1.ClusterGroupList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.ClusterGroupList).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 clusterGroups.
|
||||
func (c *FakeClusterGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(clustergroupsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a clusterGroup and creates it. Returns the server's representation of the clusterGroup, and an error, if there is any.
|
||||
func (c *FakeClusterGroups) Create(ctx context.Context, clusterGroup *v1alpha1.ClusterGroup, opts v1.CreateOptions) (result *v1alpha1.ClusterGroup, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(clustergroupsResource, c.ns, clusterGroup), &v1alpha1.ClusterGroup{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ClusterGroup), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a clusterGroup and updates it. Returns the server's representation of the clusterGroup, and an error, if there is any.
|
||||
func (c *FakeClusterGroups) Update(ctx context.Context, clusterGroup *v1alpha1.ClusterGroup, opts v1.UpdateOptions) (result *v1alpha1.ClusterGroup, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(clustergroupsResource, c.ns, clusterGroup), &v1alpha1.ClusterGroup{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ClusterGroup), 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 *FakeClusterGroups) UpdateStatus(ctx context.Context, clusterGroup *v1alpha1.ClusterGroup, opts v1.UpdateOptions) (*v1alpha1.ClusterGroup, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(clustergroupsResource, "status", c.ns, clusterGroup), &v1alpha1.ClusterGroup{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ClusterGroup), err
|
||||
}
|
||||
|
||||
// Delete takes name of the clusterGroup and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeClusterGroups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(clustergroupsResource, c.ns, name), &v1alpha1.ClusterGroup{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeClusterGroups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(clustergroupsResource, c.ns, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.ClusterGroupList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched clusterGroup.
|
||||
func (c *FakeClusterGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterGroup, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(clustergroupsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ClusterGroup{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ClusterGroup), err
|
||||
}
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT 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 (
|
||||
"context"
|
||||
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/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"
|
||||
)
|
||||
|
||||
// FakeClusterRegistrations implements ClusterRegistrationInterface
|
||||
type FakeClusterRegistrations struct {
|
||||
Fake *FakeFleetV1alpha1
|
||||
ns string
|
||||
}
|
||||
|
||||
var clusterregistrationsResource = schema.GroupVersionResource{Group: "fleet.cattle.io", Version: "v1alpha1", Resource: "clusterregistrations"}
|
||||
|
||||
var clusterregistrationsKind = schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "ClusterRegistration"}
|
||||
|
||||
// Get takes name of the clusterRegistration, and returns the corresponding clusterRegistration object, and an error if there is any.
|
||||
func (c *FakeClusterRegistrations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterRegistration, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(clusterregistrationsResource, c.ns, name), &v1alpha1.ClusterRegistration{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ClusterRegistration), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ClusterRegistrations that match those selectors.
|
||||
func (c *FakeClusterRegistrations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterRegistrationList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(clusterregistrationsResource, clusterregistrationsKind, c.ns, opts), &v1alpha1.ClusterRegistrationList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.ClusterRegistrationList{ListMeta: obj.(*v1alpha1.ClusterRegistrationList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.ClusterRegistrationList).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 clusterRegistrations.
|
||||
func (c *FakeClusterRegistrations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(clusterregistrationsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a clusterRegistration and creates it. Returns the server's representation of the clusterRegistration, and an error, if there is any.
|
||||
func (c *FakeClusterRegistrations) Create(ctx context.Context, clusterRegistration *v1alpha1.ClusterRegistration, opts v1.CreateOptions) (result *v1alpha1.ClusterRegistration, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(clusterregistrationsResource, c.ns, clusterRegistration), &v1alpha1.ClusterRegistration{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ClusterRegistration), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a clusterRegistration and updates it. Returns the server's representation of the clusterRegistration, and an error, if there is any.
|
||||
func (c *FakeClusterRegistrations) Update(ctx context.Context, clusterRegistration *v1alpha1.ClusterRegistration, opts v1.UpdateOptions) (result *v1alpha1.ClusterRegistration, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(clusterregistrationsResource, c.ns, clusterRegistration), &v1alpha1.ClusterRegistration{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ClusterRegistration), 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 *FakeClusterRegistrations) UpdateStatus(ctx context.Context, clusterRegistration *v1alpha1.ClusterRegistration, opts v1.UpdateOptions) (*v1alpha1.ClusterRegistration, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(clusterregistrationsResource, "status", c.ns, clusterRegistration), &v1alpha1.ClusterRegistration{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ClusterRegistration), err
|
||||
}
|
||||
|
||||
// Delete takes name of the clusterRegistration and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeClusterRegistrations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(clusterregistrationsResource, c.ns, name), &v1alpha1.ClusterRegistration{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeClusterRegistrations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(clusterregistrationsResource, c.ns, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.ClusterRegistrationList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched clusterRegistration.
|
||||
func (c *FakeClusterRegistrations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterRegistration, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(clusterregistrationsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ClusterRegistration{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ClusterRegistration), err
|
||||
}
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT 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 (
|
||||
"context"
|
||||
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/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"
|
||||
)
|
||||
|
||||
// FakeClusterRegistrationTokens implements ClusterRegistrationTokenInterface
|
||||
type FakeClusterRegistrationTokens struct {
|
||||
Fake *FakeFleetV1alpha1
|
||||
ns string
|
||||
}
|
||||
|
||||
var clusterregistrationtokensResource = schema.GroupVersionResource{Group: "fleet.cattle.io", Version: "v1alpha1", Resource: "clusterregistrationtokens"}
|
||||
|
||||
var clusterregistrationtokensKind = schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "ClusterRegistrationToken"}
|
||||
|
||||
// Get takes name of the clusterRegistrationToken, and returns the corresponding clusterRegistrationToken object, and an error if there is any.
|
||||
func (c *FakeClusterRegistrationTokens) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterRegistrationToken, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(clusterregistrationtokensResource, c.ns, name), &v1alpha1.ClusterRegistrationToken{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ClusterRegistrationToken), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ClusterRegistrationTokens that match those selectors.
|
||||
func (c *FakeClusterRegistrationTokens) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterRegistrationTokenList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(clusterregistrationtokensResource, clusterregistrationtokensKind, c.ns, opts), &v1alpha1.ClusterRegistrationTokenList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.ClusterRegistrationTokenList{ListMeta: obj.(*v1alpha1.ClusterRegistrationTokenList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.ClusterRegistrationTokenList).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 clusterRegistrationTokens.
|
||||
func (c *FakeClusterRegistrationTokens) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(clusterregistrationtokensResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a clusterRegistrationToken and creates it. Returns the server's representation of the clusterRegistrationToken, and an error, if there is any.
|
||||
func (c *FakeClusterRegistrationTokens) Create(ctx context.Context, clusterRegistrationToken *v1alpha1.ClusterRegistrationToken, opts v1.CreateOptions) (result *v1alpha1.ClusterRegistrationToken, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(clusterregistrationtokensResource, c.ns, clusterRegistrationToken), &v1alpha1.ClusterRegistrationToken{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ClusterRegistrationToken), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a clusterRegistrationToken and updates it. Returns the server's representation of the clusterRegistrationToken, and an error, if there is any.
|
||||
func (c *FakeClusterRegistrationTokens) Update(ctx context.Context, clusterRegistrationToken *v1alpha1.ClusterRegistrationToken, opts v1.UpdateOptions) (result *v1alpha1.ClusterRegistrationToken, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(clusterregistrationtokensResource, c.ns, clusterRegistrationToken), &v1alpha1.ClusterRegistrationToken{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ClusterRegistrationToken), 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 *FakeClusterRegistrationTokens) UpdateStatus(ctx context.Context, clusterRegistrationToken *v1alpha1.ClusterRegistrationToken, opts v1.UpdateOptions) (*v1alpha1.ClusterRegistrationToken, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(clusterregistrationtokensResource, "status", c.ns, clusterRegistrationToken), &v1alpha1.ClusterRegistrationToken{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ClusterRegistrationToken), err
|
||||
}
|
||||
|
||||
// Delete takes name of the clusterRegistrationToken and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeClusterRegistrationTokens) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(clusterregistrationtokensResource, c.ns, name), &v1alpha1.ClusterRegistrationToken{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeClusterRegistrationTokens) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(clusterregistrationtokensResource, c.ns, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.ClusterRegistrationTokenList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched clusterRegistrationToken.
|
||||
func (c *FakeClusterRegistrationTokens) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterRegistrationToken, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(clusterregistrationtokensResource, c.ns, name, pt, data, subresources...), &v1alpha1.ClusterRegistrationToken{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ClusterRegistrationToken), err
|
||||
}
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT 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 (
|
||||
"context"
|
||||
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/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"
|
||||
)
|
||||
|
||||
// FakeContents implements ContentInterface
|
||||
type FakeContents struct {
|
||||
Fake *FakeFleetV1alpha1
|
||||
}
|
||||
|
||||
var contentsResource = schema.GroupVersionResource{Group: "fleet.cattle.io", Version: "v1alpha1", Resource: "contents"}
|
||||
|
||||
var contentsKind = schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "Content"}
|
||||
|
||||
// Get takes name of the content, and returns the corresponding content object, and an error if there is any.
|
||||
func (c *FakeContents) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Content, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetAction(contentsResource, name), &v1alpha1.Content{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Content), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Contents that match those selectors.
|
||||
func (c *FakeContents) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ContentList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListAction(contentsResource, contentsKind, opts), &v1alpha1.ContentList{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.ContentList{ListMeta: obj.(*v1alpha1.ContentList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.ContentList).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 contents.
|
||||
func (c *FakeContents) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchAction(contentsResource, opts))
|
||||
}
|
||||
|
||||
// Create takes the representation of a content and creates it. Returns the server's representation of the content, and an error, if there is any.
|
||||
func (c *FakeContents) Create(ctx context.Context, content *v1alpha1.Content, opts v1.CreateOptions) (result *v1alpha1.Content, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootCreateAction(contentsResource, content), &v1alpha1.Content{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Content), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a content and updates it. Returns the server's representation of the content, and an error, if there is any.
|
||||
func (c *FakeContents) Update(ctx context.Context, content *v1alpha1.Content, opts v1.UpdateOptions) (result *v1alpha1.Content, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateAction(contentsResource, content), &v1alpha1.Content{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Content), err
|
||||
}
|
||||
|
||||
// Delete takes name of the content and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeContents) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewRootDeleteAction(contentsResource, name), &v1alpha1.Content{})
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeContents) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewRootDeleteCollectionAction(contentsResource, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.ContentList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched content.
|
||||
func (c *FakeContents) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Content, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(contentsResource, name, pt, data, subresources...), &v1alpha1.Content{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Content), err
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT 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 "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/typed/fleet.cattle.io/v1alpha1"
|
||||
rest "k8s.io/client-go/rest"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
type FakeFleetV1alpha1 struct {
|
||||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeFleetV1alpha1) Bundles(namespace string) v1alpha1.BundleInterface {
|
||||
return &FakeBundles{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeFleetV1alpha1) BundleDeployments(namespace string) v1alpha1.BundleDeploymentInterface {
|
||||
return &FakeBundleDeployments{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeFleetV1alpha1) BundleNamespaceMappings(namespace string) v1alpha1.BundleNamespaceMappingInterface {
|
||||
return &FakeBundleNamespaceMappings{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeFleetV1alpha1) Clusters(namespace string) v1alpha1.ClusterInterface {
|
||||
return &FakeClusters{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeFleetV1alpha1) ClusterGroups(namespace string) v1alpha1.ClusterGroupInterface {
|
||||
return &FakeClusterGroups{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeFleetV1alpha1) ClusterRegistrations(namespace string) v1alpha1.ClusterRegistrationInterface {
|
||||
return &FakeClusterRegistrations{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeFleetV1alpha1) ClusterRegistrationTokens(namespace string) v1alpha1.ClusterRegistrationTokenInterface {
|
||||
return &FakeClusterRegistrationTokens{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeFleetV1alpha1) Contents() v1alpha1.ContentInterface {
|
||||
return &FakeContents{c}
|
||||
}
|
||||
|
||||
func (c *FakeFleetV1alpha1) GitRepos(namespace string) v1alpha1.GitRepoInterface {
|
||||
return &FakeGitRepos{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeFleetV1alpha1) GitRepoRestrictions(namespace string) v1alpha1.GitRepoRestrictionInterface {
|
||||
return &FakeGitRepoRestrictions{c, namespace}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeFleetV1alpha1) RESTClient() rest.Interface {
|
||||
var ret *rest.RESTClient
|
||||
return ret
|
||||
}
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT 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 (
|
||||
"context"
|
||||
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/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"
|
||||
)
|
||||
|
||||
// FakeGitRepos implements GitRepoInterface
|
||||
type FakeGitRepos struct {
|
||||
Fake *FakeFleetV1alpha1
|
||||
ns string
|
||||
}
|
||||
|
||||
var gitreposResource = schema.GroupVersionResource{Group: "fleet.cattle.io", Version: "v1alpha1", Resource: "gitrepos"}
|
||||
|
||||
var gitreposKind = schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "GitRepo"}
|
||||
|
||||
// Get takes name of the gitRepo, and returns the corresponding gitRepo object, and an error if there is any.
|
||||
func (c *FakeGitRepos) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.GitRepo, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(gitreposResource, c.ns, name), &v1alpha1.GitRepo{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.GitRepo), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of GitRepos that match those selectors.
|
||||
func (c *FakeGitRepos) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.GitRepoList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(gitreposResource, gitreposKind, c.ns, opts), &v1alpha1.GitRepoList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.GitRepoList{ListMeta: obj.(*v1alpha1.GitRepoList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.GitRepoList).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 gitRepos.
|
||||
func (c *FakeGitRepos) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(gitreposResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a gitRepo and creates it. Returns the server's representation of the gitRepo, and an error, if there is any.
|
||||
func (c *FakeGitRepos) Create(ctx context.Context, gitRepo *v1alpha1.GitRepo, opts v1.CreateOptions) (result *v1alpha1.GitRepo, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(gitreposResource, c.ns, gitRepo), &v1alpha1.GitRepo{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.GitRepo), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a gitRepo and updates it. Returns the server's representation of the gitRepo, and an error, if there is any.
|
||||
func (c *FakeGitRepos) Update(ctx context.Context, gitRepo *v1alpha1.GitRepo, opts v1.UpdateOptions) (result *v1alpha1.GitRepo, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(gitreposResource, c.ns, gitRepo), &v1alpha1.GitRepo{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.GitRepo), 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 *FakeGitRepos) UpdateStatus(ctx context.Context, gitRepo *v1alpha1.GitRepo, opts v1.UpdateOptions) (*v1alpha1.GitRepo, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(gitreposResource, "status", c.ns, gitRepo), &v1alpha1.GitRepo{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.GitRepo), err
|
||||
}
|
||||
|
||||
// Delete takes name of the gitRepo and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeGitRepos) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(gitreposResource, c.ns, name), &v1alpha1.GitRepo{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeGitRepos) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(gitreposResource, c.ns, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.GitRepoList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched gitRepo.
|
||||
func (c *FakeGitRepos) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GitRepo, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(gitreposResource, c.ns, name, pt, data, subresources...), &v1alpha1.GitRepo{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.GitRepo), err
|
||||
}
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT 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 (
|
||||
"context"
|
||||
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/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"
|
||||
)
|
||||
|
||||
// FakeGitRepoRestrictions implements GitRepoRestrictionInterface
|
||||
type FakeGitRepoRestrictions struct {
|
||||
Fake *FakeFleetV1alpha1
|
||||
ns string
|
||||
}
|
||||
|
||||
var gitreporestrictionsResource = schema.GroupVersionResource{Group: "fleet.cattle.io", Version: "v1alpha1", Resource: "gitreporestrictions"}
|
||||
|
||||
var gitreporestrictionsKind = schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "GitRepoRestriction"}
|
||||
|
||||
// Get takes name of the gitRepoRestriction, and returns the corresponding gitRepoRestriction object, and an error if there is any.
|
||||
func (c *FakeGitRepoRestrictions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.GitRepoRestriction, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(gitreporestrictionsResource, c.ns, name), &v1alpha1.GitRepoRestriction{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.GitRepoRestriction), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of GitRepoRestrictions that match those selectors.
|
||||
func (c *FakeGitRepoRestrictions) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.GitRepoRestrictionList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(gitreporestrictionsResource, gitreporestrictionsKind, c.ns, opts), &v1alpha1.GitRepoRestrictionList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.GitRepoRestrictionList{ListMeta: obj.(*v1alpha1.GitRepoRestrictionList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.GitRepoRestrictionList).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 gitRepoRestrictions.
|
||||
func (c *FakeGitRepoRestrictions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(gitreporestrictionsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a gitRepoRestriction and creates it. Returns the server's representation of the gitRepoRestriction, and an error, if there is any.
|
||||
func (c *FakeGitRepoRestrictions) Create(ctx context.Context, gitRepoRestriction *v1alpha1.GitRepoRestriction, opts v1.CreateOptions) (result *v1alpha1.GitRepoRestriction, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(gitreporestrictionsResource, c.ns, gitRepoRestriction), &v1alpha1.GitRepoRestriction{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.GitRepoRestriction), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a gitRepoRestriction and updates it. Returns the server's representation of the gitRepoRestriction, and an error, if there is any.
|
||||
func (c *FakeGitRepoRestrictions) Update(ctx context.Context, gitRepoRestriction *v1alpha1.GitRepoRestriction, opts v1.UpdateOptions) (result *v1alpha1.GitRepoRestriction, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(gitreporestrictionsResource, c.ns, gitRepoRestriction), &v1alpha1.GitRepoRestriction{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.GitRepoRestriction), err
|
||||
}
|
||||
|
||||
// Delete takes name of the gitRepoRestriction and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeGitRepoRestrictions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(gitreporestrictionsResource, c.ns, name), &v1alpha1.GitRepoRestriction{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeGitRepoRestrictions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(gitreporestrictionsResource, c.ns, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.GitRepoRestrictionList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched gitRepoRestriction.
|
||||
func (c *FakeGitRepoRestrictions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GitRepoRestriction, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(gitreporestrictionsResource, c.ns, name, pt, data, subresources...), &v1alpha1.GitRepoRestriction{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.GitRepoRestriction), err
|
||||
}
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/scheme"
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
type FleetV1alpha1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
BundlesGetter
|
||||
BundleDeploymentsGetter
|
||||
BundleNamespaceMappingsGetter
|
||||
ClustersGetter
|
||||
ClusterGroupsGetter
|
||||
ClusterRegistrationsGetter
|
||||
ClusterRegistrationTokensGetter
|
||||
ContentsGetter
|
||||
GitReposGetter
|
||||
GitRepoRestrictionsGetter
|
||||
}
|
||||
|
||||
// FleetV1alpha1Client is used to interact with features provided by the fleet.cattle.io group.
|
||||
type FleetV1alpha1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *FleetV1alpha1Client) Bundles(namespace string) BundleInterface {
|
||||
return newBundles(c, namespace)
|
||||
}
|
||||
|
||||
func (c *FleetV1alpha1Client) BundleDeployments(namespace string) BundleDeploymentInterface {
|
||||
return newBundleDeployments(c, namespace)
|
||||
}
|
||||
|
||||
func (c *FleetV1alpha1Client) BundleNamespaceMappings(namespace string) BundleNamespaceMappingInterface {
|
||||
return newBundleNamespaceMappings(c, namespace)
|
||||
}
|
||||
|
||||
func (c *FleetV1alpha1Client) Clusters(namespace string) ClusterInterface {
|
||||
return newClusters(c, namespace)
|
||||
}
|
||||
|
||||
func (c *FleetV1alpha1Client) ClusterGroups(namespace string) ClusterGroupInterface {
|
||||
return newClusterGroups(c, namespace)
|
||||
}
|
||||
|
||||
func (c *FleetV1alpha1Client) ClusterRegistrations(namespace string) ClusterRegistrationInterface {
|
||||
return newClusterRegistrations(c, namespace)
|
||||
}
|
||||
|
||||
func (c *FleetV1alpha1Client) ClusterRegistrationTokens(namespace string) ClusterRegistrationTokenInterface {
|
||||
return newClusterRegistrationTokens(c, namespace)
|
||||
}
|
||||
|
||||
func (c *FleetV1alpha1Client) Contents() ContentInterface {
|
||||
return newContents(c)
|
||||
}
|
||||
|
||||
func (c *FleetV1alpha1Client) GitRepos(namespace string) GitRepoInterface {
|
||||
return newGitRepos(c, namespace)
|
||||
}
|
||||
|
||||
func (c *FleetV1alpha1Client) GitRepoRestrictions(namespace string) GitRepoRestrictionInterface {
|
||||
return newGitRepoRestrictions(c, namespace)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new FleetV1alpha1Client for the given config.
|
||||
func NewForConfig(c *rest.Config) (*FleetV1alpha1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client, err := rest.RESTClientFor(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &FleetV1alpha1Client{client}, nil
|
||||
}
|
||||
|
||||
// NewForConfigOrDie creates a new FleetV1alpha1Client for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *FleetV1alpha1Client {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// New creates a new FleetV1alpha1Client for the given RESTClient.
|
||||
func New(c rest.Interface) *FleetV1alpha1Client {
|
||||
return &FleetV1alpha1Client{c}
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
gv := v1alpha1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FleetV1alpha1Client) RESTClient() rest.Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.restClient
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
type BundleExpansion interface{}
|
||||
|
||||
type BundleDeploymentExpansion interface{}
|
||||
|
||||
type BundleNamespaceMappingExpansion interface{}
|
||||
|
||||
type ClusterExpansion interface{}
|
||||
|
||||
type ClusterGroupExpansion interface{}
|
||||
|
||||
type ClusterRegistrationExpansion interface{}
|
||||
|
||||
type ClusterRegistrationTokenExpansion interface{}
|
||||
|
||||
type ContentExpansion interface{}
|
||||
|
||||
type GitRepoExpansion interface{}
|
||||
|
||||
type GitRepoRestrictionExpansion interface{}
|
||||
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
scheme "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/scheme"
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// GitReposGetter has a method to return a GitRepoInterface.
|
||||
// A group's client should implement this interface.
|
||||
type GitReposGetter interface {
|
||||
GitRepos(namespace string) GitRepoInterface
|
||||
}
|
||||
|
||||
// GitRepoInterface has methods to work with GitRepo resources.
|
||||
type GitRepoInterface interface {
|
||||
Create(ctx context.Context, gitRepo *v1alpha1.GitRepo, opts v1.CreateOptions) (*v1alpha1.GitRepo, error)
|
||||
Update(ctx context.Context, gitRepo *v1alpha1.GitRepo, opts v1.UpdateOptions) (*v1alpha1.GitRepo, error)
|
||||
UpdateStatus(ctx context.Context, gitRepo *v1alpha1.GitRepo, opts v1.UpdateOptions) (*v1alpha1.GitRepo, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.GitRepo, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.GitRepoList, error)
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GitRepo, err error)
|
||||
GitRepoExpansion
|
||||
}
|
||||
|
||||
// gitRepos implements GitRepoInterface
|
||||
type gitRepos struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newGitRepos returns a GitRepos
|
||||
func newGitRepos(c *FleetV1alpha1Client, namespace string) *gitRepos {
|
||||
return &gitRepos{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the gitRepo, and returns the corresponding gitRepo object, and an error if there is any.
|
||||
func (c *gitRepos) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.GitRepo, err error) {
|
||||
result = &v1alpha1.GitRepo{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("gitrepos").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of GitRepos that match those selectors.
|
||||
func (c *gitRepos) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.GitRepoList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1alpha1.GitRepoList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("gitrepos").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested gitRepos.
|
||||
func (c *gitRepos) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("gitrepos").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a gitRepo and creates it. Returns the server's representation of the gitRepo, and an error, if there is any.
|
||||
func (c *gitRepos) Create(ctx context.Context, gitRepo *v1alpha1.GitRepo, opts v1.CreateOptions) (result *v1alpha1.GitRepo, err error) {
|
||||
result = &v1alpha1.GitRepo{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("gitrepos").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(gitRepo).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a gitRepo and updates it. Returns the server's representation of the gitRepo, and an error, if there is any.
|
||||
func (c *gitRepos) Update(ctx context.Context, gitRepo *v1alpha1.GitRepo, opts v1.UpdateOptions) (result *v1alpha1.GitRepo, err error) {
|
||||
result = &v1alpha1.GitRepo{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("gitrepos").
|
||||
Name(gitRepo.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(gitRepo).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *gitRepos) UpdateStatus(ctx context.Context, gitRepo *v1alpha1.GitRepo, opts v1.UpdateOptions) (result *v1alpha1.GitRepo, err error) {
|
||||
result = &v1alpha1.GitRepo{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("gitrepos").
|
||||
Name(gitRepo.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(gitRepo).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the gitRepo and deletes it. Returns an error if one occurs.
|
||||
func (c *gitRepos) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("gitrepos").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *gitRepos) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("gitrepos").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched gitRepo.
|
||||
func (c *gitRepos) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GitRepo, err error) {
|
||||
result = &v1alpha1.GitRepo{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("gitrepos").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
+178
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
scheme "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/scheme"
|
||||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// GitRepoRestrictionsGetter has a method to return a GitRepoRestrictionInterface.
|
||||
// A group's client should implement this interface.
|
||||
type GitRepoRestrictionsGetter interface {
|
||||
GitRepoRestrictions(namespace string) GitRepoRestrictionInterface
|
||||
}
|
||||
|
||||
// GitRepoRestrictionInterface has methods to work with GitRepoRestriction resources.
|
||||
type GitRepoRestrictionInterface interface {
|
||||
Create(ctx context.Context, gitRepoRestriction *v1alpha1.GitRepoRestriction, opts v1.CreateOptions) (*v1alpha1.GitRepoRestriction, error)
|
||||
Update(ctx context.Context, gitRepoRestriction *v1alpha1.GitRepoRestriction, opts v1.UpdateOptions) (*v1alpha1.GitRepoRestriction, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.GitRepoRestriction, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.GitRepoRestrictionList, error)
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GitRepoRestriction, err error)
|
||||
GitRepoRestrictionExpansion
|
||||
}
|
||||
|
||||
// gitRepoRestrictions implements GitRepoRestrictionInterface
|
||||
type gitRepoRestrictions struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newGitRepoRestrictions returns a GitRepoRestrictions
|
||||
func newGitRepoRestrictions(c *FleetV1alpha1Client, namespace string) *gitRepoRestrictions {
|
||||
return &gitRepoRestrictions{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the gitRepoRestriction, and returns the corresponding gitRepoRestriction object, and an error if there is any.
|
||||
func (c *gitRepoRestrictions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.GitRepoRestriction, err error) {
|
||||
result = &v1alpha1.GitRepoRestriction{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("gitreporestrictions").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of GitRepoRestrictions that match those selectors.
|
||||
func (c *gitRepoRestrictions) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.GitRepoRestrictionList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1alpha1.GitRepoRestrictionList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("gitreporestrictions").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested gitRepoRestrictions.
|
||||
func (c *gitRepoRestrictions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("gitreporestrictions").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a gitRepoRestriction and creates it. Returns the server's representation of the gitRepoRestriction, and an error, if there is any.
|
||||
func (c *gitRepoRestrictions) Create(ctx context.Context, gitRepoRestriction *v1alpha1.GitRepoRestriction, opts v1.CreateOptions) (result *v1alpha1.GitRepoRestriction, err error) {
|
||||
result = &v1alpha1.GitRepoRestriction{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("gitreporestrictions").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(gitRepoRestriction).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a gitRepoRestriction and updates it. Returns the server's representation of the gitRepoRestriction, and an error, if there is any.
|
||||
func (c *gitRepoRestrictions) Update(ctx context.Context, gitRepoRestriction *v1alpha1.GitRepoRestriction, opts v1.UpdateOptions) (result *v1alpha1.GitRepoRestriction, err error) {
|
||||
result = &v1alpha1.GitRepoRestriction{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("gitreporestrictions").
|
||||
Name(gitRepoRestriction.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(gitRepoRestriction).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the gitRepoRestriction and deletes it. Returns an error if one occurs.
|
||||
func (c *gitRepoRestrictions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("gitreporestrictions").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *gitRepoRestrictions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("gitreporestrictions").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched gitRepoRestriction.
|
||||
func (c *gitRepoRestrictions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GitRepoRestriction, err error) {
|
||||
result = &v1alpha1.GitRepoRestriction{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("gitreporestrictions").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
// Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT 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 cmd
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/controller"
|
||||
apisconfig "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis/config"
|
||||
"github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis/config/v1alpha1"
|
||||
controllerconfig "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/controller/config"
|
||||
"github.com/gardener/gardener/extensions/pkg/controller/cmd"
|
||||
healthcheckconfig "github.com/gardener/gardener/extensions/pkg/controller/healthcheck/config"
|
||||
extensionshealthcheckcontroller "github.com/gardener/gardener/extensions/pkg/controller/healthcheck"
|
||||
healthcheckcontroller "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/controller/healthcheck"
|
||||
"github.com/spf13/pflag"
|
||||
"io/ioutil"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
)
|
||||
|
||||
var (
|
||||
scheme *runtime.Scheme
|
||||
decoder runtime.Decoder
|
||||
)
|
||||
|
||||
func init() {
|
||||
scheme = runtime.NewScheme()
|
||||
utilruntime.Must(apisconfig.AddToScheme(scheme))
|
||||
utilruntime.Must(v1alpha1.AddToScheme(scheme))
|
||||
|
||||
decoder = serializer.NewCodecFactory(scheme).UniversalDecoder()
|
||||
}
|
||||
|
||||
|
||||
// FleetServiceOptions holds options related to the fleet agent service.
|
||||
type FleetServiceOptions struct {
|
||||
ConfigLocation string
|
||||
config *FleetServiceConfig
|
||||
}
|
||||
|
||||
// AddFlags implements Flagger.AddFlags.
|
||||
func (o *FleetServiceOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
fs.StringVar(&o.ConfigLocation, "config", "", "Path to fleet agent service configuration")
|
||||
}
|
||||
|
||||
// Complete implements Completer.Complete.
|
||||
func (o *FleetServiceOptions) Complete() error {
|
||||
if o.ConfigLocation == "" {
|
||||
return errors.New("config location is not set")
|
||||
}
|
||||
|
||||
data, err := ioutil.ReadFile(o.ConfigLocation)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
config := apisconfig.FleetAgentConfig{}
|
||||
_, _, err = decoder.Decode(data, nil, &config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
o.config = &FleetServiceConfig{
|
||||
config: config,
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Completed returns the decoded FleetServiceConfiguration instance. Only call this if `Complete` was successful.
|
||||
func (o *FleetServiceOptions) Completed() *FleetServiceConfig {
|
||||
return o.config
|
||||
}
|
||||
|
||||
// FleetServiceConfig contains configuration information about the fleet service.
|
||||
type FleetServiceConfig struct {
|
||||
config apisconfig.FleetAgentConfig
|
||||
}
|
||||
|
||||
// Apply applies the FleetServiceOptions to the passed ControllerOptions instance.
|
||||
func (c *FleetServiceConfig) Apply(config *controllerconfig.Config) {
|
||||
config.FleetAgentConfig = c.config
|
||||
}
|
||||
|
||||
// ControllerSwitches are the cmd.SwitchOptions for the provider controllers.
|
||||
func ControllerSwitches() *cmd.SwitchOptions {
|
||||
return cmd.NewSwitchOptions(
|
||||
cmd.Switch(controller.ControllerName, controller.AddToManager),
|
||||
cmd.Switch(extensionshealthcheckcontroller.ControllerName, healthcheckcontroller.AddToManager),
|
||||
)
|
||||
}
|
||||
|
||||
func (c *FleetServiceConfig) ApplyHealthCheckConfig(config *healthcheckconfig.HealthCheckConfig) {
|
||||
if c.config.HealthCheckConfig != nil {
|
||||
*config = *c.config.HealthCheckConfig
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
// Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT 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 controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
b64 "encoding/base64"
|
||||
"fmt"
|
||||
"github.com/gardener/gardener/pkg/extensions"
|
||||
"github.com/go-logr/logr"
|
||||
fleetv1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
"k8s.io/client-go/util/retry"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/log"
|
||||
|
||||
"github.com/gardener/gardener/extensions/pkg/controller"
|
||||
"github.com/gardener/gardener/extensions/pkg/controller/extension"
|
||||
"github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/controller/config"
|
||||
|
||||
extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1"
|
||||
kutil "github.com/gardener/gardener/pkg/utils/kubernetes"
|
||||
)
|
||||
|
||||
// ActuatorName is the name of the Fleet agent actuator.
|
||||
const ActuatorName = "shoot-fleet-agent-actuator"
|
||||
const KubeconfigSecretName = "kubecfg"
|
||||
const KubeconfigKey = "kubeconfig"
|
||||
|
||||
// NewActuator returns an actuator responsible for Extension resources.
|
||||
func NewActuator(config config.Config) extension.Actuator {
|
||||
fleetKubeConfig, _ := b64.StdEncoding.DecodeString(config.FleetAgentConfig.ClientConnection.Kubeconfig)
|
||||
var kubeconfigPath string
|
||||
var err error
|
||||
if kubeconfigPath, err = writeKubeconfigToTempFile(fleetKubeConfig); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fleetClientConfig, _ := clientcmd.BuildConfigFromFlags("", kubeconfigPath)
|
||||
fleetManager, err := NewManagerForConfig(fleetClientConfig, "clusters")//TODO get from config
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return &actuator{
|
||||
logger: log.Log.WithName(ActuatorName),
|
||||
serviceConfig: config,
|
||||
fleetManager: fleetManager,
|
||||
}
|
||||
}
|
||||
|
||||
type actuator struct {
|
||||
client client.Client
|
||||
config *rest.Config
|
||||
decoder runtime.Decoder
|
||||
fleetManager *FleetManager
|
||||
|
||||
serviceConfig config.Config
|
||||
|
||||
logger logr.Logger
|
||||
}
|
||||
|
||||
// Reconcile the Extension resource.
|
||||
func (a *actuator) Reconcile(ctx context.Context, ex *extensionsv1alpha1.Extension) error {
|
||||
namespace := ex.GetNamespace()
|
||||
a.logger.Info("Component is being reconciled", "component", "fleet-agent-management", "namespace", namespace)
|
||||
cluster, err := controller.GetCluster(ctx, a.client, namespace)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cfg := &config.Config{}
|
||||
if ex.Spec.ProviderConfig != nil {//here we parse providerconfig
|
||||
if _, _, err := a.decoder.Decode(ex.Spec.ProviderConfig.Raw, nil, cfg); err != nil {
|
||||
return fmt.Errorf("failed to decode provider config: %+v", err)
|
||||
}
|
||||
}
|
||||
|
||||
a.registerClusterInFleetManager(ctx, namespace, cluster)
|
||||
return a.updateStatus(ctx, ex)
|
||||
}
|
||||
|
||||
// Delete the Extension resource.
|
||||
func (a *actuator) Delete(ctx context.Context, ex *extensionsv1alpha1.Extension) error {
|
||||
namespace := ex.GetNamespace()
|
||||
a.logger.Info("Component is being deleted", "component", "fleet-agent-management", "namespace", namespace)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Restore the Extension resource.
|
||||
func (a *actuator) Restore(ctx context.Context, ex *extensionsv1alpha1.Extension) error {
|
||||
a.logger.Info("Component is being restored", "component", "fleet-agent-management")
|
||||
return a.Reconcile(ctx, ex)
|
||||
}
|
||||
|
||||
// Migrate the Extension resource.
|
||||
func (a *actuator) Migrate(ctx context.Context, ex *extensionsv1alpha1.Extension) error {
|
||||
a.logger.Info("Component is being migrated", "component", "fleet-agent-management")
|
||||
|
||||
return a.Delete(ctx, ex)
|
||||
}
|
||||
|
||||
// InjectConfig injects the rest config to this actuator.
|
||||
func (a *actuator) InjectConfig(config *rest.Config) error {
|
||||
a.config = config
|
||||
return nil
|
||||
}
|
||||
|
||||
// InjectClient injects the controller runtime client into the reconciler.
|
||||
func (a *actuator) InjectClient(client client.Client) error {
|
||||
a.client = client
|
||||
return nil
|
||||
}
|
||||
|
||||
// InjectScheme injects the given scheme into the reconciler.
|
||||
func (a *actuator) InjectScheme(scheme *runtime.Scheme) error {
|
||||
a.decoder = serializer.NewCodecFactory(scheme).UniversalDecoder()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *actuator) registerClusterInFleetManager(ctx context.Context, namespace string, cluster *extensions.Cluster) {
|
||||
a.logger.Info("Starting with already registered check")
|
||||
registered, err := a.fleetManager.GetCluster(ctx, cluster.Shoot.Name)
|
||||
if !errors.IsNotFound(err) {
|
||||
a.logger.Info("Cluster already registered - skipping registration", "clientId", registered.Spec.ClientID)
|
||||
return
|
||||
} else {
|
||||
a.logger.Info("Cluster registration not found.")
|
||||
}
|
||||
a.logger.Info("Starting cluster registration process")
|
||||
secret := &corev1.Secret{}
|
||||
|
||||
labels := make(map[string]string)
|
||||
labels["corebundle"] = "true"
|
||||
labels["region"] = cluster.Shoot.Spec.Region
|
||||
labels["cluster"] = cluster.Shoot.Name
|
||||
if a.serviceConfig.FleetAgentConfig.Labels != nil && len(a.serviceConfig.FleetAgentConfig.Labels) > 0 {//adds labels from configuration
|
||||
for key, value := range a.serviceConfig.Labels{
|
||||
labels[key] = value
|
||||
}
|
||||
}
|
||||
a.logger.Info("Looking up Secret with KubeConfig for given Shoot.", "namespace", namespace, "secretName", KubeconfigSecretName)
|
||||
|
||||
if err := a.client.Get(ctx, kutil.Key(namespace, KubeconfigSecretName), secret); err == nil {
|
||||
secretData := make(map[string][]byte)
|
||||
secretData["value"] = secret.Data[KubeconfigKey]
|
||||
a.logger.Info("Loaded kubeconfig from secret", "kubeconfig", secret, "namespace", namespace)
|
||||
|
||||
const fleetRegisterNamespace = "clusters"
|
||||
kubeconfigSecret := corev1.Secret{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "kubecfg-" + cluster.Shoot.Name,
|
||||
Namespace: fleetRegisterNamespace,
|
||||
},
|
||||
Data: secretData,
|
||||
}
|
||||
|
||||
clusterRegistration := fleetv1alpha1.Cluster{
|
||||
TypeMeta: metav1.TypeMeta{},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: cluster.Shoot.Name,
|
||||
Namespace: fleetRegisterNamespace,
|
||||
Labels: labels,
|
||||
},
|
||||
Spec: fleetv1alpha1.ClusterSpec{
|
||||
KubeConfigSecret: "kubecfg-" + cluster.Shoot.Name,
|
||||
},
|
||||
}
|
||||
a.logger.Info("Creating kubeconfig secret for Fleet registration.")
|
||||
if _, err = a.fleetManager.CreateKubeconfigSecret(ctx, &kubeconfigSecret); err != nil {
|
||||
a.logger.Error(err, "Failed to create secret with kubeconfig for Fleet registration")
|
||||
}
|
||||
a.logger.Info("Creating Cluster registration for Fleet registration.")
|
||||
if _, err = a.fleetManager.CreateCluster(ctx, &clusterRegistration); err != nil {
|
||||
a.logger.Error(err, "Failed to create Cluster for Fleet registration")
|
||||
}
|
||||
a.logger.Info("Registered shoot cluster in Fleet Manager ", "registration", clusterRegistration)
|
||||
} else {
|
||||
a.logger.Error(err, "Failed to find Secret with kubeconfig for Fleet registration.")
|
||||
}
|
||||
}
|
||||
|
||||
func (a *actuator) updateStatus(ctx context.Context, ex *extensionsv1alpha1.Extension) error {
|
||||
return controller.TryUpdateStatus(ctx, retry.DefaultBackoff, a.client, ex, func() error {
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT 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 controller
|
||||
|
||||
import (
|
||||
controllerconfig "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/controller/config"
|
||||
|
||||
"github.com/gardener/gardener/extensions/pkg/controller/extension"
|
||||
"sigs.k8s.io/controller-runtime/pkg/controller"
|
||||
"sigs.k8s.io/controller-runtime/pkg/manager"
|
||||
)
|
||||
|
||||
const (
|
||||
// Type is the type of Extension resource.
|
||||
Type = "shoot-fleet-agent"
|
||||
// ControllerName is the name of the shoot fleet agent service controller.
|
||||
ControllerName = "shoot_fleet_agent"
|
||||
// FinalizerSuffix is the finalizer suffix for the shoot fleet agent service controller.
|
||||
FinalizerSuffix = "shoot-fleet-agent"
|
||||
)
|
||||
|
||||
var (
|
||||
// DefaultAddOptions are the default AddOptions for AddToManager.
|
||||
DefaultAddOptions = AddOptions{}
|
||||
)
|
||||
|
||||
// AddOptions are options to apply when adding the shoot fleet agent service controller to the manager.
|
||||
type AddOptions struct {
|
||||
// ControllerOptions contains options for the controller.
|
||||
ControllerOptions controller.Options
|
||||
// ServiceConfig contains configuration for the shoot fleet agent service.
|
||||
ServiceConfig controllerconfig.Config
|
||||
// IgnoreOperationAnnotation specifies whether to ignore the operation annotation or not.
|
||||
IgnoreOperationAnnotation bool
|
||||
}
|
||||
|
||||
// AddToManager adds a controller with the default Options to the given Controller Manager.
|
||||
func AddToManager(mgr manager.Manager) error {
|
||||
return AddToManagerWithOptions(mgr, DefaultAddOptions.ControllerOptions, DefaultAddOptions.ServiceConfig)
|
||||
}
|
||||
|
||||
// AddToManagerWithOptions adds a controller with the given Options to the given manager.
|
||||
// The opts.Reconciler is being set with a newly instantiated actuator.
|
||||
func AddToManagerWithOptions(mgr manager.Manager, opts controller.Options, config controllerconfig.Config) error {
|
||||
return extension.Add(mgr, extension.AddArgs{
|
||||
Actuator: NewActuator(config),
|
||||
ControllerOptions: opts,
|
||||
Name: ControllerName,
|
||||
FinalizerSuffix: FinalizerSuffix,
|
||||
Resync: 0,
|
||||
Predicates: extension.DefaultPredicates(DefaultAddOptions.IgnoreOperationAnnotation),
|
||||
Type: Type,
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
import "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis/config"
|
||||
|
||||
type Config struct {
|
||||
config.FleetAgentConfig
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
clientset "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned"
|
||||
"github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
type FleetManager struct {
|
||||
secretClient kubernetes.Clientset
|
||||
fleetClient clientset.Interface
|
||||
namespace string
|
||||
}
|
||||
|
||||
func NewManagerForConfig(c *rest.Config, namespace string) (*FleetManager, error) {
|
||||
secretClient, err := kubernetes.NewForConfig(c)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fleetClient, err := clientset.NewForConfig(c)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &FleetManager{
|
||||
secretClient: *secretClient,
|
||||
fleetClient: fleetClient,
|
||||
namespace: namespace,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (f *FleetManager) CreateCluster(ctx context.Context, cluster *v1alpha1.Cluster) (*v1alpha1.Cluster, error) {
|
||||
return f.fleetClient.FleetV1alpha1().Clusters(f.namespace).Create(ctx, cluster, metav1.CreateOptions{})
|
||||
}
|
||||
|
||||
func (f *FleetManager) UpdateCluster(ctx context.Context, cluster *v1alpha1.Cluster) (*v1alpha1.Cluster, error) {
|
||||
return f.fleetClient.FleetV1alpha1().Clusters(f.namespace).Update(ctx, cluster, metav1.UpdateOptions{})
|
||||
}
|
||||
|
||||
func (f *FleetManager) GetCluster(ctx context.Context, clusterName string) (*v1alpha1.Cluster, error) {
|
||||
return f.fleetClient.FleetV1alpha1().Clusters(f.namespace).Get(ctx, clusterName, metav1.GetOptions{})
|
||||
}
|
||||
|
||||
func (f *FleetManager) CreateKubeconfigSecret(ctx context.Context, secret *corev1.Secret) (*corev1.Secret, error) {
|
||||
return f.secretClient.CoreV1().Secrets(f.namespace).Create(ctx, secret, metav1.CreateOptions{})
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
// Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT 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 healthcheck
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
fleetcontroller "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/controller"
|
||||
|
||||
"github.com/gardener/gardener/extensions/pkg/controller/healthcheck"
|
||||
healthcheckconfig "github.com/gardener/gardener/extensions/pkg/controller/healthcheck/config"
|
||||
extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"sigs.k8s.io/controller-runtime/pkg/manager"
|
||||
)
|
||||
|
||||
var (
|
||||
defaultSyncPeriod = time.Second * 30
|
||||
// DefaultAddOptions are the default DefaultAddArgs for AddToManager.
|
||||
DefaultAddOptions = healthcheck.DefaultAddArgs{
|
||||
HealthCheckConfig: healthcheckconfig.HealthCheckConfig{SyncPeriod: metav1.Duration{Duration: defaultSyncPeriod}},
|
||||
}
|
||||
)
|
||||
|
||||
// RegisterHealthChecks registers health checks for each extension resource
|
||||
// HealthChecks are grouped by extension (e.g worker), extension.type (e.g aws) and Health Check Type (e.g SystemComponentsHealthy)
|
||||
func RegisterHealthChecks(mgr manager.Manager, opts healthcheck.DefaultAddArgs) error {
|
||||
return healthcheck.DefaultRegistration(
|
||||
fleetcontroller.Type,
|
||||
extensionsv1alpha1.SchemeGroupVersion.WithKind(extensionsv1alpha1.ExtensionResource),
|
||||
func() client.ObjectList { return &extensionsv1alpha1.ExtensionList{} },
|
||||
func() extensionsv1alpha1.Object { return &extensionsv1alpha1.Extension{} },
|
||||
mgr,
|
||||
opts,
|
||||
nil,
|
||||
[]healthcheck.ConditionTypeToHealthCheck{},
|
||||
)
|
||||
}
|
||||
|
||||
// AddToManager adds a controller with the default Options.
|
||||
func AddToManager(mgr manager.Manager) error {
|
||||
return RegisterHealthChecks(mgr, DefaultAddOptions)
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
|
||||
func writeKubeconfigToTempFile(kubeconfig []byte) (path string, error error) {
|
||||
tmpFile, err := ioutil.TempFile(os.TempDir(), "kubeconfig-")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if _, err = tmpFile.Write(kubeconfig); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// Close the file
|
||||
if err := tmpFile.Close(); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return tmpFile.Name(), nil
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
// Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//enables image vector override functionality
|
||||
//go:generate packr2
|
||||
|
||||
package imagevector
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/gardener/gardener/pkg/utils/imagevector"
|
||||
"github.com/gobuffalo/packr/v2"
|
||||
"k8s.io/apimachinery/pkg/util/runtime"
|
||||
)
|
||||
|
||||
var imageVector imagevector.ImageVector
|
||||
|
||||
func init() {
|
||||
box := packr.New("charts", "../../charts")
|
||||
|
||||
imagesYaml, err := box.FindString("images.yaml")
|
||||
runtime.Must(err)
|
||||
|
||||
imageVector, err = imagevector.Read(strings.NewReader(imagesYaml))
|
||||
runtime.Must(err)
|
||||
|
||||
imageVector, err = imagevector.WithEnvOverride(imageVector)
|
||||
runtime.Must(err)
|
||||
}
|
||||
|
||||
// ImageVector is the image vector that contains all the needed images.
|
||||
func ImageVector() imagevector.ImageVector {
|
||||
return imageVector
|
||||
}
|
||||
Reference in New Issue
Block a user