pipeline crd

Signed-off-by: runzexia <runzexia@yunify.com>
This commit is contained in:
runzexia
2020-03-25 10:58:39 +08:00
parent 7a00f9e3e4
commit 23c8d71a5a
28 changed files with 3031 additions and 612 deletions

View File

@@ -27,6 +27,7 @@ import (
type DevopsV1alpha3Interface interface {
RESTClient() rest.Interface
DevOpsProjectsGetter
PipelinesGetter
}
// DevopsV1alpha3Client is used to interact with features provided by the devops.kubesphere.io group.
@@ -38,6 +39,10 @@ func (c *DevopsV1alpha3Client) DevOpsProjects() DevOpsProjectInterface {
return newDevOpsProjects(c)
}
func (c *DevopsV1alpha3Client) Pipelines(namespace string) PipelineInterface {
return newPipelines(c, namespace)
}
// NewForConfig creates a new DevopsV1alpha3Client for the given config.
func NewForConfig(c *rest.Config) (*DevopsV1alpha3Client, error) {
config := *c

View File

@@ -32,6 +32,10 @@ func (c *FakeDevopsV1alpha3) DevOpsProjects() v1alpha3.DevOpsProjectInterface {
return &FakeDevOpsProjects{c}
}
func (c *FakeDevopsV1alpha3) Pipelines(namespace string) v1alpha3.PipelineInterface {
return &FakePipelines{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeDevopsV1alpha3) RESTClient() rest.Interface {

View File

@@ -0,0 +1,140 @@
/*
Copyright 2019 The KubeSphere authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
v1 "k8s.io/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"
v1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
)
// FakePipelines implements PipelineInterface
type FakePipelines struct {
Fake *FakeDevopsV1alpha3
ns string
}
var pipelinesResource = schema.GroupVersionResource{Group: "devops.kubesphere.io", Version: "v1alpha3", Resource: "pipelines"}
var pipelinesKind = schema.GroupVersionKind{Group: "devops.kubesphere.io", Version: "v1alpha3", Kind: "Pipeline"}
// Get takes name of the pipeline, and returns the corresponding pipeline object, and an error if there is any.
func (c *FakePipelines) Get(name string, options v1.GetOptions) (result *v1alpha3.Pipeline, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(pipelinesResource, c.ns, name), &v1alpha3.Pipeline{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.Pipeline), err
}
// List takes label and field selectors, and returns the list of Pipelines that match those selectors.
func (c *FakePipelines) List(opts v1.ListOptions) (result *v1alpha3.PipelineList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(pipelinesResource, pipelinesKind, c.ns, opts), &v1alpha3.PipelineList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha3.PipelineList{ListMeta: obj.(*v1alpha3.PipelineList).ListMeta}
for _, item := range obj.(*v1alpha3.PipelineList).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 pipelines.
func (c *FakePipelines) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(pipelinesResource, c.ns, opts))
}
// Create takes the representation of a pipeline and creates it. Returns the server's representation of the pipeline, and an error, if there is any.
func (c *FakePipelines) Create(pipeline *v1alpha3.Pipeline) (result *v1alpha3.Pipeline, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(pipelinesResource, c.ns, pipeline), &v1alpha3.Pipeline{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.Pipeline), err
}
// Update takes the representation of a pipeline and updates it. Returns the server's representation of the pipeline, and an error, if there is any.
func (c *FakePipelines) Update(pipeline *v1alpha3.Pipeline) (result *v1alpha3.Pipeline, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(pipelinesResource, c.ns, pipeline), &v1alpha3.Pipeline{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.Pipeline), 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 *FakePipelines) UpdateStatus(pipeline *v1alpha3.Pipeline) (*v1alpha3.Pipeline, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(pipelinesResource, "status", c.ns, pipeline), &v1alpha3.Pipeline{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.Pipeline), err
}
// Delete takes name of the pipeline and deletes it. Returns an error if one occurs.
func (c *FakePipelines) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(pipelinesResource, c.ns, name), &v1alpha3.Pipeline{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakePipelines) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(pipelinesResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha3.PipelineList{})
return err
}
// Patch applies the patch and returns the patched pipeline.
func (c *FakePipelines) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.Pipeline, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(pipelinesResource, c.ns, name, pt, data, subresources...), &v1alpha3.Pipeline{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.Pipeline), err
}

View File

@@ -19,3 +19,5 @@ limitations under the License.
package v1alpha3
type DevOpsProjectExpansion interface{}
type PipelineExpansion interface{}

View File

@@ -0,0 +1,191 @@
/*
Copyright 2019 The KubeSphere authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha3
import (
"time"
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"
v1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme"
)
// PipelinesGetter has a method to return a PipelineInterface.
// A group's client should implement this interface.
type PipelinesGetter interface {
Pipelines(namespace string) PipelineInterface
}
// PipelineInterface has methods to work with Pipeline resources.
type PipelineInterface interface {
Create(*v1alpha3.Pipeline) (*v1alpha3.Pipeline, error)
Update(*v1alpha3.Pipeline) (*v1alpha3.Pipeline, error)
UpdateStatus(*v1alpha3.Pipeline) (*v1alpha3.Pipeline, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha3.Pipeline, error)
List(opts v1.ListOptions) (*v1alpha3.PipelineList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.Pipeline, err error)
PipelineExpansion
}
// pipelines implements PipelineInterface
type pipelines struct {
client rest.Interface
ns string
}
// newPipelines returns a Pipelines
func newPipelines(c *DevopsV1alpha3Client, namespace string) *pipelines {
return &pipelines{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the pipeline, and returns the corresponding pipeline object, and an error if there is any.
func (c *pipelines) Get(name string, options v1.GetOptions) (result *v1alpha3.Pipeline, err error) {
result = &v1alpha3.Pipeline{}
err = c.client.Get().
Namespace(c.ns).
Resource("pipelines").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Pipelines that match those selectors.
func (c *pipelines) List(opts v1.ListOptions) (result *v1alpha3.PipelineList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha3.PipelineList{}
err = c.client.Get().
Namespace(c.ns).
Resource("pipelines").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested pipelines.
func (c *pipelines) Watch(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("pipelines").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
}
// Create takes the representation of a pipeline and creates it. Returns the server's representation of the pipeline, and an error, if there is any.
func (c *pipelines) Create(pipeline *v1alpha3.Pipeline) (result *v1alpha3.Pipeline, err error) {
result = &v1alpha3.Pipeline{}
err = c.client.Post().
Namespace(c.ns).
Resource("pipelines").
Body(pipeline).
Do().
Into(result)
return
}
// Update takes the representation of a pipeline and updates it. Returns the server's representation of the pipeline, and an error, if there is any.
func (c *pipelines) Update(pipeline *v1alpha3.Pipeline) (result *v1alpha3.Pipeline, err error) {
result = &v1alpha3.Pipeline{}
err = c.client.Put().
Namespace(c.ns).
Resource("pipelines").
Name(pipeline.Name).
Body(pipeline).
Do().
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 *pipelines) UpdateStatus(pipeline *v1alpha3.Pipeline) (result *v1alpha3.Pipeline, err error) {
result = &v1alpha3.Pipeline{}
err = c.client.Put().
Namespace(c.ns).
Resource("pipelines").
Name(pipeline.Name).
SubResource("status").
Body(pipeline).
Do().
Into(result)
return
}
// Delete takes name of the pipeline and deletes it. Returns an error if one occurs.
func (c *pipelines) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("pipelines").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *pipelines) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("pipelines").
VersionedParams(&listOptions, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Error()
}
// Patch applies the patch and returns the patched pipeline.
func (c *pipelines) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.Pipeline, err error) {
result = &v1alpha3.Pipeline{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("pipelines").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}