feat: add rbdability type

This commit is contained in:
yangk 2022-12-23 12:04:34 +08:00
parent 37c08f49cf
commit e80f178340
13 changed files with 813 additions and 0 deletions

View File

@ -0,0 +1,67 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: rbdabilities.rainbond.io
spec:
group: rainbond.io
names:
kind: RBDAbility
listKind: RBDAbilityList
plural: rbdabilities
singular: rbdability
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: RBDAbility is the Schema for the rbdplugins API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: RBDAbilitySpec defines the desired state of RBDAbility
properties:
watchGroups:
description: Foo is an example field of RBDAbility. Edit rbdplugin_types.go
to remove/update
items:
description: WatchGroup Defines what types of resources are listed.
For example, if apiVersion is apps/v1, kind is Deployment, it
means that the platform will list all Deployment resources.
properties:
apiVersion:
type: string
kind:
type: string
type: object
type: array
type: object
status:
description: RBDAbilityStatus defines the observed state of RBDAbility
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -0,0 +1,75 @@
// RAINBOND, Application Management Platform
// Copyright (C) 2022-2022 Goodrain Co., Ltd.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. For any non-GPL usage of Rainbond,
// one or multiple Commercial Licenses authorized by Goodrain Co., Ltd.
// must be obtained first.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// RBDAbilitySpec defines the desired state of RBDAbility
type RBDAbilitySpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
// Foo is an example field of RBDAbility. Edit rbdplugin_types.go to remove/update
WatchGroups []WatchGroup `json:"watchGroups,omitempty"`
}
// WatchGroup Defines what types of resources are listed.
// For example, if apiVersion is apps/v1, kind is Deployment,
// it means that the platform will list all Deployment resources.
type WatchGroup struct {
APIVersion string `json:"apiVersion,omitempty"`
Kind string `json:"kind,omitempty"`
}
// RBDAbilityStatus defines the observed state of RBDAbility
type RBDAbilityStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
}
// +genclient
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// RBDAbility is the Schema for the rbdplugins API
type RBDAbility struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec RBDAbilitySpec `json:"spec,omitempty"`
Status RBDAbilityStatus `json:"status,omitempty"`
}
//+kubebuilder:object:root=true
// RBDAbilityList contains a list of RBDAbility
type RBDAbilityList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []RBDAbility `json:"items"`
}
func init() {
SchemeBuilder.Register(&RBDAbility{}, &RBDAbilityList{})
}

View File

@ -395,6 +395,100 @@ func (in *Probe) DeepCopy() *Probe {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RBDAbility) DeepCopyInto(out *RBDAbility) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
out.Status = in.Status
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RBDAbility.
func (in *RBDAbility) DeepCopy() *RBDAbility {
if in == nil {
return nil
}
out := new(RBDAbility)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *RBDAbility) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RBDAbilityList) DeepCopyInto(out *RBDAbilityList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]RBDAbility, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RBDAbilityList.
func (in *RBDAbilityList) DeepCopy() *RBDAbilityList {
if in == nil {
return nil
}
out := new(RBDAbilityList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *RBDAbilityList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RBDAbilitySpec) DeepCopyInto(out *RBDAbilitySpec) {
*out = *in
if in.WatchGroups != nil {
in, out := &in.WatchGroups, &out.WatchGroups
*out = make([]WatchGroup, len(*in))
copy(*out, *in)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RBDAbilitySpec.
func (in *RBDAbilitySpec) DeepCopy() *RBDAbilitySpec {
if in == nil {
return nil
}
out := new(RBDAbilitySpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RBDAbilityStatus) DeepCopyInto(out *RBDAbilityStatus) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RBDAbilityStatus.
func (in *RBDAbilityStatus) DeepCopy() *RBDAbilityStatus {
if in == nil {
return nil
}
out := new(RBDAbilityStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RBDPlugin) DeepCopyInto(out *RBDPlugin) {
*out = *in
@ -701,3 +795,18 @@ func (in *ThirdComponentStatus) DeepCopy() *ThirdComponentStatus {
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WatchGroup) DeepCopyInto(out *WatchGroup) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WatchGroup.
func (in *WatchGroup) DeepCopy() *WatchGroup {
if in == nil {
return nil
}
out := new(WatchGroup)
in.DeepCopyInto(out)
return out
}

View File

@ -38,6 +38,10 @@ func (c *FakeRainbondV1alpha1) HelmApps(namespace string) v1alpha1.HelmAppInterf
return &FakeHelmApps{c, namespace}
}
func (c *FakeRainbondV1alpha1) RBDAbilities(namespace string) v1alpha1.RBDAbilityInterface {
return &FakeRBDAbilities{c, namespace}
}
func (c *FakeRainbondV1alpha1) RBDPlugins(namespace string) v1alpha1.RBDPluginInterface {
return &FakeRBDPlugins{c, namespace}
}

View File

@ -0,0 +1,144 @@
// RAINBOND, Application Management Platform
// Copyright (C) 2014-2021 Goodrain Co., Ltd.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. For any non-GPL usage of Rainbond,
// one or multiple Commercial Licenses authorized by Goodrain Co., Ltd.
// must be obtained first.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/goodrain/rainbond/pkg/apis/rainbond/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"
)
// FakeRBDAbilities implements RBDAbilityInterface
type FakeRBDAbilities struct {
Fake *FakeRainbondV1alpha1
ns string
}
var rbdabilitiesResource = schema.GroupVersionResource{Group: "rainbond.io", Version: "v1alpha1", Resource: "rbdabilities"}
var rbdabilitiesKind = schema.GroupVersionKind{Group: "rainbond.io", Version: "v1alpha1", Kind: "RBDAbility"}
// Get takes name of the rBDAbility, and returns the corresponding rBDAbility object, and an error if there is any.
func (c *FakeRBDAbilities) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.RBDAbility, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(rbdabilitiesResource, c.ns, name), &v1alpha1.RBDAbility{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.RBDAbility), err
}
// List takes label and field selectors, and returns the list of RBDAbilities that match those selectors.
func (c *FakeRBDAbilities) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RBDAbilityList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(rbdabilitiesResource, rbdabilitiesKind, c.ns, opts), &v1alpha1.RBDAbilityList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.RBDAbilityList{ListMeta: obj.(*v1alpha1.RBDAbilityList).ListMeta}
for _, item := range obj.(*v1alpha1.RBDAbilityList).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 rBDAbilities.
func (c *FakeRBDAbilities) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(rbdabilitiesResource, c.ns, opts))
}
// Create takes the representation of a rBDAbility and creates it. Returns the server's representation of the rBDAbility, and an error, if there is any.
func (c *FakeRBDAbilities) Create(ctx context.Context, rBDAbility *v1alpha1.RBDAbility, opts v1.CreateOptions) (result *v1alpha1.RBDAbility, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(rbdabilitiesResource, c.ns, rBDAbility), &v1alpha1.RBDAbility{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.RBDAbility), err
}
// Update takes the representation of a rBDAbility and updates it. Returns the server's representation of the rBDAbility, and an error, if there is any.
func (c *FakeRBDAbilities) Update(ctx context.Context, rBDAbility *v1alpha1.RBDAbility, opts v1.UpdateOptions) (result *v1alpha1.RBDAbility, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(rbdabilitiesResource, c.ns, rBDAbility), &v1alpha1.RBDAbility{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.RBDAbility), 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 *FakeRBDAbilities) UpdateStatus(ctx context.Context, rBDAbility *v1alpha1.RBDAbility, opts v1.UpdateOptions) (*v1alpha1.RBDAbility, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(rbdabilitiesResource, "status", c.ns, rBDAbility), &v1alpha1.RBDAbility{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.RBDAbility), err
}
// Delete takes name of the rBDAbility and deletes it. Returns an error if one occurs.
func (c *FakeRBDAbilities) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(rbdabilitiesResource, c.ns, name, opts), &v1alpha1.RBDAbility{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeRBDAbilities) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(rbdabilitiesResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.RBDAbilityList{})
return err
}
// Patch applies the patch and returns the patched rBDAbility.
func (c *FakeRBDAbilities) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.RBDAbility, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(rbdabilitiesResource, c.ns, name, pt, data, subresources...), &v1alpha1.RBDAbility{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.RBDAbility), err
}

View File

@ -24,6 +24,8 @@ type ComponentDefinitionExpansion interface{}
type HelmAppExpansion interface{}
type RBDAbilityExpansion interface{}
type RBDPluginExpansion interface{}
type ThirdComponentExpansion interface{}

View File

@ -32,6 +32,7 @@ type RainbondV1alpha1Interface interface {
RESTClient() rest.Interface
ComponentDefinitionsGetter
HelmAppsGetter
RBDAbilitiesGetter
RBDPluginsGetter
ThirdComponentsGetter
}
@ -49,6 +50,10 @@ func (c *RainbondV1alpha1Client) HelmApps(namespace string) HelmAppInterface {
return newHelmApps(c, namespace)
}
func (c *RainbondV1alpha1Client) RBDAbilities(namespace string) RBDAbilityInterface {
return newRBDAbilities(c, namespace)
}
func (c *RainbondV1alpha1Client) RBDPlugins(namespace string) RBDPluginInterface {
return newRBDPlugins(c, namespace)
}

View File

@ -0,0 +1,197 @@
// RAINBOND, Application Management Platform
// Copyright (C) 2014-2021 Goodrain Co., Ltd.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. For any non-GPL usage of Rainbond,
// one or multiple Commercial Licenses authorized by Goodrain Co., Ltd.
// must be obtained first.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
v1alpha1 "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1"
scheme "github.com/goodrain/rainbond/pkg/generated/clientset/versioned/scheme"
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"
)
// RBDAbilitiesGetter has a method to return a RBDAbilityInterface.
// A group's client should implement this interface.
type RBDAbilitiesGetter interface {
RBDAbilities(namespace string) RBDAbilityInterface
}
// RBDAbilityInterface has methods to work with RBDAbility resources.
type RBDAbilityInterface interface {
Create(ctx context.Context, rBDAbility *v1alpha1.RBDAbility, opts v1.CreateOptions) (*v1alpha1.RBDAbility, error)
Update(ctx context.Context, rBDAbility *v1alpha1.RBDAbility, opts v1.UpdateOptions) (*v1alpha1.RBDAbility, error)
UpdateStatus(ctx context.Context, rBDAbility *v1alpha1.RBDAbility, opts v1.UpdateOptions) (*v1alpha1.RBDAbility, 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.RBDAbility, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.RBDAbilityList, 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.RBDAbility, err error)
RBDAbilityExpansion
}
// rBDAbilities implements RBDAbilityInterface
type rBDAbilities struct {
client rest.Interface
ns string
}
// newRBDAbilities returns a RBDAbilities
func newRBDAbilities(c *RainbondV1alpha1Client, namespace string) *rBDAbilities {
return &rBDAbilities{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the rBDAbility, and returns the corresponding rBDAbility object, and an error if there is any.
func (c *rBDAbilities) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.RBDAbility, err error) {
result = &v1alpha1.RBDAbility{}
err = c.client.Get().
Namespace(c.ns).
Resource("rbdabilities").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of RBDAbilities that match those selectors.
func (c *rBDAbilities) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RBDAbilityList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.RBDAbilityList{}
err = c.client.Get().
Namespace(c.ns).
Resource("rbdabilities").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested rBDAbilities.
func (c *rBDAbilities) 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("rbdabilities").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a rBDAbility and creates it. Returns the server's representation of the rBDAbility, and an error, if there is any.
func (c *rBDAbilities) Create(ctx context.Context, rBDAbility *v1alpha1.RBDAbility, opts v1.CreateOptions) (result *v1alpha1.RBDAbility, err error) {
result = &v1alpha1.RBDAbility{}
err = c.client.Post().
Namespace(c.ns).
Resource("rbdabilities").
VersionedParams(&opts, scheme.ParameterCodec).
Body(rBDAbility).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a rBDAbility and updates it. Returns the server's representation of the rBDAbility, and an error, if there is any.
func (c *rBDAbilities) Update(ctx context.Context, rBDAbility *v1alpha1.RBDAbility, opts v1.UpdateOptions) (result *v1alpha1.RBDAbility, err error) {
result = &v1alpha1.RBDAbility{}
err = c.client.Put().
Namespace(c.ns).
Resource("rbdabilities").
Name(rBDAbility.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(rBDAbility).
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 *rBDAbilities) UpdateStatus(ctx context.Context, rBDAbility *v1alpha1.RBDAbility, opts v1.UpdateOptions) (result *v1alpha1.RBDAbility, err error) {
result = &v1alpha1.RBDAbility{}
err = c.client.Put().
Namespace(c.ns).
Resource("rbdabilities").
Name(rBDAbility.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(rBDAbility).
Do(ctx).
Into(result)
return
}
// Delete takes name of the rBDAbility and deletes it. Returns an error if one occurs.
func (c *rBDAbilities) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("rbdabilities").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *rBDAbilities) 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("rbdabilities").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched rBDAbility.
func (c *rBDAbilities) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.RBDAbility, err error) {
result = &v1alpha1.RBDAbility{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("rbdabilities").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@ -59,6 +59,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Rainbond().V1alpha1().ComponentDefinitions().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("helmapps"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Rainbond().V1alpha1().HelmApps().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("rbdabilities"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Rainbond().V1alpha1().RBDAbilities().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("rbdplugins"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Rainbond().V1alpha1().RBDPlugins().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("thirdcomponents"):

View File

@ -30,6 +30,8 @@ type Interface interface {
ComponentDefinitions() ComponentDefinitionInformer
// HelmApps returns a HelmAppInformer.
HelmApps() HelmAppInformer
// RBDAbilities returns a RBDAbilityInformer.
RBDAbilities() RBDAbilityInformer
// RBDPlugins returns a RBDPluginInformer.
RBDPlugins() RBDPluginInformer
// ThirdComponents returns a ThirdComponentInformer.
@ -57,6 +59,11 @@ func (v *version) HelmApps() HelmAppInformer {
return &helmAppInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// RBDAbilities returns a RBDAbilityInformer.
func (v *version) RBDAbilities() RBDAbilityInformer {
return &rBDAbilityInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// RBDPlugins returns a RBDPluginInformer.
func (v *version) RBDPlugins() RBDPluginInformer {
return &rBDPluginInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}

View File

@ -0,0 +1,92 @@
// RAINBOND, Application Management Platform
// Copyright (C) 2014-2021 Goodrain Co., Ltd.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. For any non-GPL usage of Rainbond,
// one or multiple Commercial Licenses authorized by Goodrain Co., Ltd.
// must be obtained first.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
time "time"
rainbondv1alpha1 "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1"
versioned "github.com/goodrain/rainbond/pkg/generated/clientset/versioned"
internalinterfaces "github.com/goodrain/rainbond/pkg/generated/informers/externalversions/internalinterfaces"
v1alpha1 "github.com/goodrain/rainbond/pkg/generated/listers/rainbond/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
)
// RBDAbilityInformer provides access to a shared informer and lister for
// RBDAbilities.
type RBDAbilityInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha1.RBDAbilityLister
}
type rBDAbilityInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewRBDAbilityInformer constructs a new informer for RBDAbility type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewRBDAbilityInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredRBDAbilityInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredRBDAbilityInformer constructs a new informer for RBDAbility type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredRBDAbilityInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.RainbondV1alpha1().RBDAbilities(namespace).List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.RainbondV1alpha1().RBDAbilities(namespace).Watch(context.TODO(), options)
},
},
&rainbondv1alpha1.RBDAbility{},
resyncPeriod,
indexers,
)
}
func (f *rBDAbilityInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredRBDAbilityInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *rBDAbilityInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&rainbondv1alpha1.RBDAbility{}, f.defaultInformer)
}
func (f *rBDAbilityInformer) Lister() v1alpha1.RBDAbilityLister {
return v1alpha1.NewRBDAbilityLister(f.Informer().GetIndexer())
}

View File

@ -36,6 +36,14 @@ type HelmAppListerExpansion interface{}
// HelmAppNamespaceLister.
type HelmAppNamespaceListerExpansion interface{}
// RBDAbilityListerExpansion allows custom methods to be added to
// RBDAbilityLister.
type RBDAbilityListerExpansion interface{}
// RBDAbilityNamespaceListerExpansion allows custom methods to be added to
// RBDAbilityNamespaceLister.
type RBDAbilityNamespaceListerExpansion interface{}
// RBDPluginListerExpansion allows custom methods to be added to
// RBDPluginLister.
type RBDPluginListerExpansion interface{}

View File

@ -0,0 +1,101 @@
// RAINBOND, Application Management Platform
// Copyright (C) 2014-2021 Goodrain Co., Ltd.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. For any non-GPL usage of Rainbond,
// one or multiple Commercial Licenses authorized by Goodrain Co., Ltd.
// must be obtained first.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha1
import (
v1alpha1 "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// RBDAbilityLister helps list RBDAbilities.
// All objects returned here must be treated as read-only.
type RBDAbilityLister interface {
// List lists all RBDAbilities in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha1.RBDAbility, err error)
// RBDAbilities returns an object that can list and get RBDAbilities.
RBDAbilities(namespace string) RBDAbilityNamespaceLister
RBDAbilityListerExpansion
}
// rBDAbilityLister implements the RBDAbilityLister interface.
type rBDAbilityLister struct {
indexer cache.Indexer
}
// NewRBDAbilityLister returns a new RBDAbilityLister.
func NewRBDAbilityLister(indexer cache.Indexer) RBDAbilityLister {
return &rBDAbilityLister{indexer: indexer}
}
// List lists all RBDAbilities in the indexer.
func (s *rBDAbilityLister) List(selector labels.Selector) (ret []*v1alpha1.RBDAbility, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.RBDAbility))
})
return ret, err
}
// RBDAbilities returns an object that can list and get RBDAbilities.
func (s *rBDAbilityLister) RBDAbilities(namespace string) RBDAbilityNamespaceLister {
return rBDAbilityNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// RBDAbilityNamespaceLister helps list and get RBDAbilities.
// All objects returned here must be treated as read-only.
type RBDAbilityNamespaceLister interface {
// List lists all RBDAbilities in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha1.RBDAbility, err error)
// Get retrieves the RBDAbility from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1alpha1.RBDAbility, error)
RBDAbilityNamespaceListerExpansion
}
// rBDAbilityNamespaceLister implements the RBDAbilityNamespaceLister
// interface.
type rBDAbilityNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all RBDAbilities in the indexer for a given namespace.
func (s rBDAbilityNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.RBDAbility, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.RBDAbility))
})
return ret, err
}
// Get retrieves the RBDAbility from the indexer for a given namespace and name.
func (s rBDAbilityNamespaceLister) Get(name string) (*v1alpha1.RBDAbility, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha1.Resource("rbdability"), name)
}
return obj.(*v1alpha1.RBDAbility), nil
}