mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-10-05 13:46:51 +08:00
namespace api + server + refactor
This commit is contained in:
85
api/common.pb.go
Normal file
85
api/common.pb.go
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: common.proto
|
||||||
|
|
||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
fmt "fmt"
|
||||||
|
proto "github.com/golang/protobuf/proto"
|
||||||
|
math "math"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||||
|
|
||||||
|
type ListOptions struct {
|
||||||
|
LabelSelector string `protobuf:"bytes,1,opt,name=labelSelector,proto3" json:"labelSelector,omitempty"`
|
||||||
|
FieldSelector string `protobuf:"bytes,2,opt,name=fieldSelector,proto3" json:"fieldSelector,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ListOptions) Reset() { *m = ListOptions{} }
|
||||||
|
func (m *ListOptions) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*ListOptions) ProtoMessage() {}
|
||||||
|
func (*ListOptions) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_555bd8c177793206, []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ListOptions) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_ListOptions.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *ListOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_ListOptions.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *ListOptions) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_ListOptions.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *ListOptions) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_ListOptions.Size(m)
|
||||||
|
}
|
||||||
|
func (m *ListOptions) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_ListOptions.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_ListOptions proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *ListOptions) GetLabelSelector() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.LabelSelector
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ListOptions) GetFieldSelector() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.FieldSelector
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*ListOptions)(nil), "api.ListOptions")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { proto.RegisterFile("common.proto", fileDescriptor_555bd8c177793206) }
|
||||||
|
|
||||||
|
var fileDescriptor_555bd8c177793206 = []byte{
|
||||||
|
// 103 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x49, 0xce, 0xcf, 0xcd,
|
||||||
|
0xcd, 0xcf, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x4e, 0x2c, 0xc8, 0x54, 0x8a, 0xe4,
|
||||||
|
0xe2, 0xf6, 0xc9, 0x2c, 0x2e, 0xf1, 0x2f, 0x28, 0xc9, 0xcc, 0xcf, 0x2b, 0x16, 0x52, 0xe1, 0xe2,
|
||||||
|
0xcd, 0x49, 0x4c, 0x4a, 0xcd, 0x09, 0x4e, 0xcd, 0x49, 0x4d, 0x2e, 0xc9, 0x2f, 0x92, 0x60, 0x54,
|
||||||
|
0x60, 0xd4, 0xe0, 0x0c, 0x42, 0x15, 0x04, 0xa9, 0x4a, 0xcb, 0x4c, 0xcd, 0x49, 0x81, 0xab, 0x62,
|
||||||
|
0x82, 0xa8, 0x42, 0x11, 0x4c, 0x62, 0x03, 0x5b, 0x63, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xdd,
|
||||||
|
0xb8, 0x24, 0x01, 0x76, 0x00, 0x00, 0x00,
|
||||||
|
}
|
8
api/common.proto
Normal file
8
api/common.proto
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package api;
|
||||||
|
|
||||||
|
message ListOptions {
|
||||||
|
string labelSelector = 1;
|
||||||
|
string fieldSelector = 2;
|
||||||
|
}
|
15
api/common.swagger.json
Normal file
15
api/common.swagger.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"swagger": "2.0",
|
||||||
|
"info": {
|
||||||
|
"title": "common.proto",
|
||||||
|
"version": "version not set"
|
||||||
|
},
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"paths": {},
|
||||||
|
"definitions": {}
|
||||||
|
}
|
272
api/namespace.pb.go
Normal file
272
api/namespace.pb.go
Normal file
@@ -0,0 +1,272 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: namespace.proto
|
||||||
|
|
||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
fmt "fmt"
|
||||||
|
proto "github.com/golang/protobuf/proto"
|
||||||
|
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||||
|
grpc "google.golang.org/grpc"
|
||||||
|
codes "google.golang.org/grpc/codes"
|
||||||
|
status "google.golang.org/grpc/status"
|
||||||
|
math "math"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||||
|
|
||||||
|
type ListNamespacesRequest struct {
|
||||||
|
ListOptions *ListOptions `protobuf:"bytes,1,opt,name=listOptions,proto3" json:"listOptions,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ListNamespacesRequest) Reset() { *m = ListNamespacesRequest{} }
|
||||||
|
func (m *ListNamespacesRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*ListNamespacesRequest) ProtoMessage() {}
|
||||||
|
func (*ListNamespacesRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_ecb1e126f615f5dd, []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ListNamespacesRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_ListNamespacesRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *ListNamespacesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_ListNamespacesRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *ListNamespacesRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_ListNamespacesRequest.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *ListNamespacesRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_ListNamespacesRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *ListNamespacesRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_ListNamespacesRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_ListNamespacesRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *ListNamespacesRequest) GetListOptions() *ListOptions {
|
||||||
|
if m != nil {
|
||||||
|
return m.ListOptions
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type ListNamespacesResponse struct {
|
||||||
|
Count int32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"`
|
||||||
|
Namespaces []*Namespace `protobuf:"bytes,2,rep,name=namespaces,proto3" json:"namespaces,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ListNamespacesResponse) Reset() { *m = ListNamespacesResponse{} }
|
||||||
|
func (m *ListNamespacesResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*ListNamespacesResponse) ProtoMessage() {}
|
||||||
|
func (*ListNamespacesResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_ecb1e126f615f5dd, []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ListNamespacesResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_ListNamespacesResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *ListNamespacesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_ListNamespacesResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *ListNamespacesResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_ListNamespacesResponse.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *ListNamespacesResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_ListNamespacesResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *ListNamespacesResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_ListNamespacesResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_ListNamespacesResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *ListNamespacesResponse) GetCount() int32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Count
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ListNamespacesResponse) GetNamespaces() []*Namespace {
|
||||||
|
if m != nil {
|
||||||
|
return m.Namespaces
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type Namespace struct {
|
||||||
|
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
Labels map[string]string `protobuf:"bytes,2,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Namespace) Reset() { *m = Namespace{} }
|
||||||
|
func (m *Namespace) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*Namespace) ProtoMessage() {}
|
||||||
|
func (*Namespace) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_ecb1e126f615f5dd, []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Namespace) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_Namespace.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *Namespace) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_Namespace.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *Namespace) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_Namespace.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *Namespace) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_Namespace.Size(m)
|
||||||
|
}
|
||||||
|
func (m *Namespace) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_Namespace.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_Namespace proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *Namespace) GetName() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Namespace) GetLabels() map[string]string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Labels
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*ListNamespacesRequest)(nil), "api.ListNamespacesRequest")
|
||||||
|
proto.RegisterType((*ListNamespacesResponse)(nil), "api.ListNamespacesResponse")
|
||||||
|
proto.RegisterType((*Namespace)(nil), "api.Namespace")
|
||||||
|
proto.RegisterMapType((map[string]string)(nil), "api.Namespace.LabelsEntry")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { proto.RegisterFile("namespace.proto", fileDescriptor_ecb1e126f615f5dd) }
|
||||||
|
|
||||||
|
var fileDescriptor_ecb1e126f615f5dd = []byte{
|
||||||
|
// 313 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xb1, 0x4e, 0xfb, 0x30,
|
||||||
|
0x10, 0xc6, 0x95, 0xf4, 0xdf, 0x4a, 0xbd, 0xfc, 0x55, 0x2a, 0x0b, 0x50, 0x64, 0x18, 0xaa, 0x4c,
|
||||||
|
0x9d, 0x12, 0x35, 0x2c, 0xc0, 0xce, 0x44, 0x05, 0x92, 0xd9, 0x91, 0xdc, 0xe8, 0x54, 0x59, 0x4d,
|
||||||
|
0x6c, 0x13, 0x3b, 0x91, 0x3a, 0x21, 0xf1, 0x00, 0x2c, 0x3c, 0x1a, 0xaf, 0xc0, 0x83, 0xa0, 0x38,
|
||||||
|
0x6d, 0x9a, 0x02, 0xdb, 0xdd, 0x7d, 0x9f, 0x7f, 0xb6, 0xbf, 0x83, 0x13, 0xc9, 0x0b, 0x34, 0x9a,
|
||||||
|
0x67, 0x18, 0xeb, 0x52, 0x59, 0x45, 0x06, 0x5c, 0x0b, 0x7a, 0xb9, 0x56, 0x6a, 0x9d, 0x63, 0xc2,
|
||||||
|
0xb5, 0x48, 0xb8, 0x94, 0xca, 0x72, 0x2b, 0x94, 0x34, 0xad, 0x85, 0xfe, 0xcf, 0x54, 0x51, 0x28,
|
||||||
|
0xd9, 0x76, 0xd1, 0x3d, 0x9c, 0x2d, 0x85, 0xb1, 0x0f, 0x7b, 0x8e, 0x61, 0xf8, 0x52, 0xa1, 0xb1,
|
||||||
|
0x24, 0x85, 0x20, 0x17, 0xc6, 0x3e, 0x6a, 0x77, 0x36, 0xf4, 0x66, 0xde, 0x3c, 0x48, 0xa7, 0x31,
|
||||||
|
0xd7, 0x22, 0x5e, 0x1e, 0xe6, 0xac, 0x6f, 0x8a, 0x9e, 0xe1, 0xfc, 0x27, 0xcc, 0x68, 0x25, 0x0d,
|
||||||
|
0x92, 0x53, 0x18, 0x66, 0xaa, 0x92, 0xd6, 0x71, 0x86, 0xac, 0x6d, 0x48, 0x0c, 0xd0, 0x7d, 0xc0,
|
||||||
|
0x84, 0xfe, 0x6c, 0x30, 0x0f, 0xd2, 0x89, 0xbb, 0xa2, 0x43, 0xb0, 0x9e, 0x23, 0x7a, 0xf7, 0x60,
|
||||||
|
0xdc, 0x29, 0x84, 0xc0, 0xbf, 0x46, 0x73, 0xc8, 0x31, 0x73, 0x35, 0x49, 0x61, 0x94, 0xf3, 0x15,
|
||||||
|
0xe6, 0x7b, 0x1a, 0x3d, 0xa6, 0xc5, 0x4b, 0x27, 0xde, 0x49, 0x5b, 0x6e, 0xd9, 0xce, 0x49, 0x6f,
|
||||||
|
0x20, 0xe8, 0x8d, 0xc9, 0x14, 0x06, 0x1b, 0xdc, 0xee, 0xa8, 0x4d, 0xd9, 0x3c, 0xbe, 0xe6, 0x79,
|
||||||
|
0x85, 0xa1, 0xef, 0x66, 0x6d, 0x73, 0xeb, 0x5f, 0x7b, 0xe9, 0x2b, 0x4c, 0x3b, 0xf6, 0x13, 0x96,
|
||||||
|
0xb5, 0xc8, 0x90, 0x6c, 0x60, 0x72, 0x1c, 0x02, 0xa1, 0x5d, 0x6a, 0xbf, 0x62, 0xa6, 0x17, 0x7f,
|
||||||
|
0x6a, 0x6d, 0x6a, 0xd1, 0xec, 0xed, 0xf3, 0xeb, 0xc3, 0xa7, 0x24, 0x6c, 0x56, 0x69, 0x92, 0x7a,
|
||||||
|
0xb1, 0x42, 0xcb, 0x17, 0xc9, 0x21, 0x91, 0xd5, 0xc8, 0x6d, 0xf1, 0xea, 0x3b, 0x00, 0x00, 0xff,
|
||||||
|
0xff, 0xce, 0x0e, 0xd9, 0x0d, 0x09, 0x02, 0x00, 0x00,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ context.Context
|
||||||
|
var _ grpc.ClientConn
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the grpc package it is being compiled against.
|
||||||
|
const _ = grpc.SupportPackageIsVersion4
|
||||||
|
|
||||||
|
// NamespaceServiceClient is the client API for NamespaceService service.
|
||||||
|
//
|
||||||
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||||
|
type NamespaceServiceClient interface {
|
||||||
|
ListNamespaces(ctx context.Context, in *ListNamespacesRequest, opts ...grpc.CallOption) (*ListNamespacesResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type namespaceServiceClient struct {
|
||||||
|
cc *grpc.ClientConn
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewNamespaceServiceClient(cc *grpc.ClientConn) NamespaceServiceClient {
|
||||||
|
return &namespaceServiceClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *namespaceServiceClient) ListNamespaces(ctx context.Context, in *ListNamespacesRequest, opts ...grpc.CallOption) (*ListNamespacesResponse, error) {
|
||||||
|
out := new(ListNamespacesResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/api.NamespaceService/ListNamespaces", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamespaceServiceServer is the server API for NamespaceService service.
|
||||||
|
type NamespaceServiceServer interface {
|
||||||
|
ListNamespaces(context.Context, *ListNamespacesRequest) (*ListNamespacesResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedNamespaceServiceServer can be embedded to have forward compatible implementations.
|
||||||
|
type UnimplementedNamespaceServiceServer struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*UnimplementedNamespaceServiceServer) ListNamespaces(ctx context.Context, req *ListNamespacesRequest) (*ListNamespacesResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method ListNamespaces not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterNamespaceServiceServer(s *grpc.Server, srv NamespaceServiceServer) {
|
||||||
|
s.RegisterService(&_NamespaceService_serviceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _NamespaceService_ListNamespaces_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(ListNamespacesRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(NamespaceServiceServer).ListNamespaces(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/api.NamespaceService/ListNamespaces",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(NamespaceServiceServer).ListNamespaces(ctx, req.(*ListNamespacesRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
var _NamespaceService_serviceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "api.NamespaceService",
|
||||||
|
HandlerType: (*NamespaceServiceServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "ListNamespaces",
|
||||||
|
Handler: _NamespaceService_ListNamespaces_Handler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Streams: []grpc.StreamDesc{},
|
||||||
|
Metadata: "namespace.proto",
|
||||||
|
}
|
162
api/namespace.pb.gw.go
Normal file
162
api/namespace.pb.gw.go
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
||||||
|
// source: namespace.proto
|
||||||
|
|
||||||
|
/*
|
||||||
|
Package api is a reverse proxy.
|
||||||
|
|
||||||
|
It translates gRPC into RESTful JSON APIs.
|
||||||
|
*/
|
||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/golang/protobuf/descriptor"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
|
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||||
|
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
||||||
|
"google.golang.org/grpc"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/grpclog"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Suppress "imported and not used" errors
|
||||||
|
var _ codes.Code
|
||||||
|
var _ io.Reader
|
||||||
|
var _ status.Status
|
||||||
|
var _ = runtime.String
|
||||||
|
var _ = utilities.NewDoubleArray
|
||||||
|
var _ = descriptor.ForMessage
|
||||||
|
|
||||||
|
var (
|
||||||
|
filter_NamespaceService_ListNamespaces_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||||
|
)
|
||||||
|
|
||||||
|
func request_NamespaceService_ListNamespaces_0(ctx context.Context, marshaler runtime.Marshaler, client NamespaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var protoReq ListNamespacesRequest
|
||||||
|
var metadata runtime.ServerMetadata
|
||||||
|
|
||||||
|
if err := req.ParseForm(); err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_NamespaceService_ListNamespaces_0); err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
msg, err := client.ListNamespaces(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||||
|
return msg, metadata, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func local_request_NamespaceService_ListNamespaces_0(ctx context.Context, marshaler runtime.Marshaler, server NamespaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var protoReq ListNamespacesRequest
|
||||||
|
var metadata runtime.ServerMetadata
|
||||||
|
|
||||||
|
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_NamespaceService_ListNamespaces_0); err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
msg, err := server.ListNamespaces(ctx, &protoReq)
|
||||||
|
return msg, metadata, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterNamespaceServiceHandlerServer registers the http handlers for service NamespaceService to "mux".
|
||||||
|
// UnaryRPC :call NamespaceServiceServer directly.
|
||||||
|
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||||
|
func RegisterNamespaceServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server NamespaceServiceServer) error {
|
||||||
|
|
||||||
|
mux.Handle("GET", pattern_NamespaceService_ListNamespaces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := local_request_NamespaceService_ListNamespaces_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||||
|
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
forward_NamespaceService_ListNamespaces_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterNamespaceServiceHandlerFromEndpoint is same as RegisterNamespaceServiceHandler but
|
||||||
|
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||||
|
func RegisterNamespaceServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||||
|
conn, err := grpc.Dial(endpoint, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
if err != nil {
|
||||||
|
if cerr := conn.Close(); cerr != nil {
|
||||||
|
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
go func() {
|
||||||
|
<-ctx.Done()
|
||||||
|
if cerr := conn.Close(); cerr != nil {
|
||||||
|
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}()
|
||||||
|
|
||||||
|
return RegisterNamespaceServiceHandler(ctx, mux, conn)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterNamespaceServiceHandler registers the http handlers for service NamespaceService to "mux".
|
||||||
|
// The handlers forward requests to the grpc endpoint over "conn".
|
||||||
|
func RegisterNamespaceServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
||||||
|
return RegisterNamespaceServiceHandlerClient(ctx, mux, NewNamespaceServiceClient(conn))
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterNamespaceServiceHandlerClient registers the http handlers for service NamespaceService
|
||||||
|
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "NamespaceServiceClient".
|
||||||
|
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "NamespaceServiceClient"
|
||||||
|
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
|
||||||
|
// "NamespaceServiceClient" to call the correct interceptors.
|
||||||
|
func RegisterNamespaceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client NamespaceServiceClient) error {
|
||||||
|
|
||||||
|
mux.Handle("GET", pattern_NamespaceService_ListNamespaces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := request_NamespaceService_ListNamespaces_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||||
|
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
forward_NamespaceService_ListNamespaces_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
pattern_NamespaceService_ListNamespaces_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"apis", "v1beta1", "namespaces"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
forward_NamespaceService_ListNamespaces_0 = runtime.ForwardResponseMessage
|
||||||
|
)
|
28
api/namespace.proto
Normal file
28
api/namespace.proto
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package api;
|
||||||
|
|
||||||
|
import "google/api/annotations.proto";
|
||||||
|
import "common.proto";
|
||||||
|
|
||||||
|
service NamespaceService {
|
||||||
|
rpc ListNamespaces (ListNamespacesRequest) returns (ListNamespacesResponse) {
|
||||||
|
option (google.api.http) = {
|
||||||
|
get: "/apis/v1beta1/namespaces"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message ListNamespacesRequest {
|
||||||
|
ListOptions listOptions = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ListNamespacesResponse {
|
||||||
|
int32 count = 1;
|
||||||
|
repeated Namespace namespaces = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Namespace {
|
||||||
|
string name = 1;
|
||||||
|
map<string, string> labels = 2;
|
||||||
|
}
|
87
api/namespace.swagger.json
Normal file
87
api/namespace.swagger.json
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
{
|
||||||
|
"swagger": "2.0",
|
||||||
|
"info": {
|
||||||
|
"title": "namespace.proto",
|
||||||
|
"version": "version not set"
|
||||||
|
},
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/apis/v1beta1/namespaces": {
|
||||||
|
"get": {
|
||||||
|
"operationId": "ListNamespaces",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A successful response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/apiListNamespacesResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "listOptions.labelSelector",
|
||||||
|
"in": "query",
|
||||||
|
"required": false,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "listOptions.fieldSelector",
|
||||||
|
"in": "query",
|
||||||
|
"required": false,
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"NamespaceService"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"definitions": {
|
||||||
|
"apiListNamespacesResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"count": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"namespaces": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/apiNamespace"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"apiListOptions": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"labelSelector": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"fieldSelector": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"apiNamespace": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"labels": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
24
main.go
24
main.go
@@ -51,6 +51,7 @@ func startRPCServer(db *repository.DB, kubeClient *kube.Client) {
|
|||||||
s := grpc.NewServer(grpc.UnaryInterceptor(loggingInterceptor))
|
s := grpc.NewServer(grpc.UnaryInterceptor(loggingInterceptor))
|
||||||
api.RegisterWorkflowServiceServer(s, server.NewWorkflowServer(resourceManager))
|
api.RegisterWorkflowServiceServer(s, server.NewWorkflowServer(resourceManager))
|
||||||
api.RegisterSecretServiceServer(s, server.NewSecretServer(resourceManager))
|
api.RegisterSecretServiceServer(s, server.NewSecretServer(resourceManager))
|
||||||
|
api.RegisterNamespaceServiceServer(s, server.NewNamespaceServer(resourceManager))
|
||||||
|
|
||||||
if err := s.Serve(lis); err != nil {
|
if err := s.Serve(lis); err != nil {
|
||||||
log.Fatalf("Failed to serve RPC server: %v", err)
|
log.Fatalf("Failed to serve RPC server: %v", err)
|
||||||
@@ -68,15 +69,9 @@ func startHTTPProxy() {
|
|||||||
mux := runtime.NewServeMux()
|
mux := runtime.NewServeMux()
|
||||||
opts := []grpc.DialOption{grpc.WithInsecure()}
|
opts := []grpc.DialOption{grpc.WithInsecure()}
|
||||||
|
|
||||||
err := api.RegisterWorkflowServiceHandlerFromEndpoint(ctx, mux, endpoint, opts)
|
registerHandler(api.RegisterWorkflowServiceHandlerFromEndpoint, ctx, mux, endpoint, opts)
|
||||||
if err != nil {
|
registerHandler(api.RegisterSecretServiceHandlerFromEndpoint, ctx, mux, endpoint, opts)
|
||||||
log.Fatalf("Failed to connect to service: %v", err)
|
registerHandler(api.RegisterNamespaceServiceHandlerFromEndpoint, ctx, mux, endpoint, opts)
|
||||||
}
|
|
||||||
|
|
||||||
err = api.RegisterSecretServiceHandlerFromEndpoint(ctx, mux, endpoint, opts)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("Failed to connect to service: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Printf("Starting HTTP proxy on port %v", *httpPort)
|
log.Printf("Starting HTTP proxy on port %v", *httpPort)
|
||||||
|
|
||||||
@@ -91,11 +86,20 @@ func startHTTPProxy() {
|
|||||||
// Allow PUT. Have to include all others as it clears them out.
|
// Allow PUT. Have to include all others as it clears them out.
|
||||||
allowedMethods := handlers.AllowedMethods([]string{"HEAD", "GET", "POST", "PUT"})
|
allowedMethods := handlers.AllowedMethods([]string{"HEAD", "GET", "POST", "PUT"})
|
||||||
|
|
||||||
if err = http.ListenAndServe(*httpPort, wsproxy.WebsocketProxy(handlers.CORS(handlers.AllowedOriginValidator(ogValidator), allowedHeaders, allowedMethods)(mux))); err != nil {
|
if err := http.ListenAndServe(*httpPort, wsproxy.WebsocketProxy(handlers.CORS(handlers.AllowedOriginValidator(ogValidator), allowedHeaders, allowedMethods)(mux))); err != nil {
|
||||||
log.Fatalf("Failed to serve HTTP listener: %v", err)
|
log.Fatalf("Failed to serve HTTP listener: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type registerFunc func(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) error
|
||||||
|
|
||||||
|
func registerHandler(register registerFunc, ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) {
|
||||||
|
err := register(ctx, mux, endpoint, opts)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Failed to register handler: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func loggingInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
|
func loggingInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
|
||||||
log.Printf("%v handler started", info.FullMethod)
|
log.Printf("%v handler started", info.FullMethod)
|
||||||
resp, err = handler(ctx, req)
|
resp, err = handler(ctx, req)
|
||||||
|
@@ -1,15 +1,9 @@
|
|||||||
package manager
|
package manager
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/onepanelio/core/model"
|
"github.com/onepanelio/core/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
var defaultNamespaceLabelKey = labelKeyPrefix + "is-default-namespace"
|
func (r *ResourceManager) ListNamespaces(opts model.ListOptions) (namespaces []*model.Namespace, err error) {
|
||||||
|
return r.kubeClient.ListNamespaces(opts)
|
||||||
func (r *ResourceManager) GetDefaultNamespace() (namespaces []*model.Namespace, err error) {
|
|
||||||
return r.kubeClient.ListNamespaces(model.ListOptions{
|
|
||||||
LabelSelector: fmt.Sprintf("%s=%s", defaultNamespaceLabelKey, "true"),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
45
server/namespace_server.go
Normal file
45
server/namespace_server.go
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
package server
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/onepanelio/core/api"
|
||||||
|
"github.com/onepanelio/core/manager"
|
||||||
|
"github.com/onepanelio/core/model"
|
||||||
|
"github.com/onepanelio/core/util"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
)
|
||||||
|
|
||||||
|
type NamespaceServer struct {
|
||||||
|
resourceManager *manager.ResourceManager
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewNamespaceServer(resourceManager *manager.ResourceManager) *NamespaceServer {
|
||||||
|
return &NamespaceServer{resourceManager: resourceManager}
|
||||||
|
}
|
||||||
|
|
||||||
|
func apiNamespace(ns *model.Namespace) (namespace *api.Namespace) {
|
||||||
|
namespace = &api.Namespace{
|
||||||
|
Name: ns.Name,
|
||||||
|
Labels: ns.Labels,
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *NamespaceServer) ListNamespaces(ctx context.Context, req *api.ListNamespacesRequest) (*api.ListNamespacesResponse, error) {
|
||||||
|
namespaces, err := s.resourceManager.ListNamespaces(modelListOptions(req.ListOptions))
|
||||||
|
if err != nil {
|
||||||
|
return nil, util.NewUserError(codes.Unknown, "Unknown error.")
|
||||||
|
}
|
||||||
|
|
||||||
|
apiNamespaces := []*api.Namespace{}
|
||||||
|
for _, ns := range namespaces {
|
||||||
|
apiNamespaces = append(apiNamespaces, apiNamespace(ns))
|
||||||
|
}
|
||||||
|
|
||||||
|
return &api.ListNamespacesResponse{
|
||||||
|
Count: int32(len(apiNamespaces)),
|
||||||
|
Namespaces: apiNamespaces,
|
||||||
|
}, nil
|
||||||
|
}
|
@@ -1,5 +1,22 @@
|
|||||||
package server
|
package server
|
||||||
|
|
||||||
import "github.com/onepanelio/core/util"
|
import (
|
||||||
|
"github.com/onepanelio/core/api"
|
||||||
|
"github.com/onepanelio/core/model"
|
||||||
|
"github.com/onepanelio/core/util"
|
||||||
|
)
|
||||||
|
|
||||||
var userError *util.UserError
|
var userError *util.UserError
|
||||||
|
|
||||||
|
func modelListOptions(lo *api.ListOptions) (listOptions model.ListOptions) {
|
||||||
|
if lo == nil {
|
||||||
|
listOptions = model.ListOptions{}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
listOptions = model.ListOptions{
|
||||||
|
LabelSelector: lo.LabelSelector,
|
||||||
|
FieldSelector: lo.FieldSelector,
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user