Add cluster API type and ability to generate .proto from the API types

This commit is contained in:
Jesse Suen 2018-02-16 13:39:13 -08:00
parent ec3b3dc83b
commit 2ef524d8d4
No known key found for this signature in database
GPG key ID: 95AE9BEA7206422B
13 changed files with 880 additions and 158 deletions

52
Gopkg.lock generated
View file

@ -19,6 +19,18 @@
packages = ["."]
revision = "de5bf2ad457846296e2031421a34e2568e304e35"
[[projects]]
name = "github.com/argoproj/argo"
packages = [".","pkg/apis/workflow"]
revision = "0978b9c61cb7435d31ef8d252b80e03708a70adc"
version = "v2.0.0"
[[projects]]
name = "github.com/cockroachdb/cockroach"
packages = ["pkg/util/httputil","pkg/util/protoutil","pkg/util/syncutil"]
revision = "ec52ded95a5235d71f26b6cbc59924bd6733fb3a"
version = "v1.1.5"
[[projects]]
name = "github.com/emicklei/go-restful"
packages = [".","log"]
@ -57,7 +69,7 @@
[[projects]]
name = "github.com/gogo/protobuf"
packages = ["proto","sortkeys"]
packages = ["jsonpb","proto","sortkeys","types"]
revision = "1adfc126b41513cc696b209667c8656ea7aac67c"
version = "v1.0.0"
@ -151,6 +163,24 @@
revision = "5f041e8faa004a95c88a202771f4cc3e991971e6"
version = "v2.0.1"
[[projects]]
branch = "master"
name = "github.com/petermattis/goid"
packages = ["."]
revision = "b0b1615b78e5ee59739545bb38426383b2cda4c9"
[[projects]]
name = "github.com/pkg/errors"
packages = ["."]
revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
version = "v0.8.0"
[[projects]]
name = "github.com/sasha-s/go-deadlock"
packages = ["."]
revision = "03d40e5dbd5488667a13b3c2600b2f7c2886f02f"
version = "v0.2.0"
[[projects]]
name = "github.com/sirupsen/logrus"
packages = ["."]
@ -205,6 +235,12 @@
packages = ["collate","collate/build","internal/colltab","internal/gen","internal/tag","internal/triegen","internal/ucd","language","secure/bidirule","transform","unicode/bidi","unicode/cldr","unicode/norm","unicode/rangetable","width"]
revision = "4e4a3210bb54bb31f6ab2cdca2edcc0b50c420c1"
[[projects]]
branch = "master"
name = "golang.org/x/tools"
packages = ["go/ast/astutil","imports"]
revision = "ce871d178848e3eea1e8795e5cfb74053dde4bb9"
[[projects]]
name = "google.golang.org/appengine"
packages = [".","internal","internal/app_identity","internal/base","internal/datastore","internal/log","internal/modules","internal/remote_api","internal/urlfetch","urlfetch"]
@ -259,6 +295,18 @@
packages = ["discovery","discovery/fake","kubernetes","kubernetes/scheme","kubernetes/typed/admissionregistration/v1alpha1","kubernetes/typed/admissionregistration/v1beta1","kubernetes/typed/apps/v1","kubernetes/typed/apps/v1beta1","kubernetes/typed/apps/v1beta2","kubernetes/typed/authentication/v1","kubernetes/typed/authentication/v1beta1","kubernetes/typed/authorization/v1","kubernetes/typed/authorization/v1beta1","kubernetes/typed/autoscaling/v1","kubernetes/typed/autoscaling/v2beta1","kubernetes/typed/batch/v1","kubernetes/typed/batch/v1beta1","kubernetes/typed/batch/v2alpha1","kubernetes/typed/certificates/v1beta1","kubernetes/typed/core/v1","kubernetes/typed/events/v1beta1","kubernetes/typed/extensions/v1beta1","kubernetes/typed/networking/v1","kubernetes/typed/policy/v1beta1","kubernetes/typed/rbac/v1","kubernetes/typed/rbac/v1alpha1","kubernetes/typed/rbac/v1beta1","kubernetes/typed/scheduling/v1alpha1","kubernetes/typed/settings/v1alpha1","kubernetes/typed/storage/v1","kubernetes/typed/storage/v1alpha1","kubernetes/typed/storage/v1beta1","pkg/version","plugin/pkg/client/auth/gcp","plugin/pkg/client/auth/oidc","rest","rest/watch","testing","third_party/forked/golang/template","tools/auth","tools/clientcmd","tools/clientcmd/api","tools/clientcmd/api/latest","tools/clientcmd/api/v1","tools/metrics","tools/reference","transport","util/cert","util/flowcontrol","util/homedir","util/integer","util/jsonpath"]
revision = "9389c055a838d4f208b699b3c7c51b70f2368861"
[[projects]]
branch = "release-1.9"
name = "k8s.io/code-generator"
packages = ["cmd/go-to-protobuf","cmd/go-to-protobuf/protobuf","third_party/forked/golang/reflect"]
revision = "91d3f6a57905178524105a085085901bb73bd3dc"
[[projects]]
branch = "master"
name = "k8s.io/gengo"
packages = ["args","generator","namer","parser","types"]
revision = "8394c995ab8fbe52216f38d0e1a37de36d820528"
[[projects]]
branch = "master"
name = "k8s.io/kube-openapi"
@ -268,6 +316,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "0ebdd723e771cc4a24642889db53f014125d792cf00dcab95050caad2944e303"
inputs-digest = "be9bff72b9e9e5876f18eaa46b8531836d6473939ad3ace65c77a267e40d64fd"
solver-name = "gps-cdcl"
solver-version = 1

View file

@ -1,3 +1,7 @@
required = [
"k8s.io/code-generator/cmd/go-to-protobuf",
]
[[constraint]]
name = "google.golang.org/grpc"
version = "1.9.2"

View file

@ -5,21 +5,36 @@ set -o errexit
set -o nounset
set -o pipefail
PROJECT_ROOT=$(cd $(dirname "$0")/.. ; pwd)
PROJECT_ROOT=$(cd $(dirname ${BASH_SOURCE})/..; pwd)
CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${PROJECT_ROOT}; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)}
PROTO_FILES=$(find ${PROJECT_ROOT} -name "*.proto" -not -path "${PROJECT_ROOT}/vendor/*")
go build -i -o dist/go-to-protobuf ./vendor/k8s.io/code-generator/cmd/go-to-protobuf
go build -i -o dist/protoc-gen-gogo ./vendor/k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo
PATH="${PROJECT_ROOT}/dist:${PATH}"
# Generate protobufs for our types
PACKAGES=(
github.com/argoproj/argo-cd/pkg/apis/cluster/v1alpha1
)
go-to-protobuf \
--logtostderr \
--go-header-file=${PROJECT_ROOT}/hack/custom-boilerplate.go.txt \
--packages=$(IFS=, ; echo "${PACKAGES[*]}") \
--apimachinery-packages=-k8s.io/apimachinery/pkg/apis/meta/v1 \
--proto-import=./vendor
# Generate protobufs for our services
PROTO_FILES=$(find ${PROJECT_ROOT}/server -name "*.proto" -not -path "${PROJECT_ROOT}/vendor/*")
for i in ${PROTO_FILES}; do
echo $i
dir=$(dirname $i)
#pkgname=$(echo "${dirname}" | sed s%${PROJECT_ROOT}/%%g)
protofile=$(basename $i)
# Both /root/go and ${PROJECT_ROOT} are added to the protoc includes, in order to support
# the requirement of running make inside docker and on desktop, respectively.
#cd ${dir}
protoc \
-I${PROJECT_ROOT} \
-I/usr/local/include \
-I./vendor \
-I$GOPATH/src \
-I/root/go/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
-I${PROJECT_ROOT}/vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
--go_out=plugins=grpc:$GOPATH/src \

View file

@ -0,0 +1,678 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: github.com/argoproj/argo-cd/pkg/apis/cluster/v1alpha1/generated.proto
/*
Package v1alpha1 is a generated protocol buffer package.
It is generated from these files:
github.com/argoproj/argo-cd/pkg/apis/cluster/v1alpha1/generated.proto
It has these top-level messages:
Cluster
ClusterList
ClusterSpec
*/
package v1alpha1
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import strings "strings"
import reflect "reflect"
import io "io"
// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package
func (m *Cluster) Reset() { *m = Cluster{} }
func (*Cluster) ProtoMessage() {}
func (*Cluster) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
func (m *ClusterList) Reset() { *m = ClusterList{} }
func (*ClusterList) ProtoMessage() {}
func (*ClusterList) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{1} }
func (m *ClusterSpec) Reset() { *m = ClusterSpec{} }
func (*ClusterSpec) ProtoMessage() {}
func (*ClusterSpec) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{2} }
func init() {
proto.RegisterType((*Cluster)(nil), "github.com.argoproj.argo_cd.pkg.apis.cluster.v1alpha1.Cluster")
proto.RegisterType((*ClusterList)(nil), "github.com.argoproj.argo_cd.pkg.apis.cluster.v1alpha1.ClusterList")
proto.RegisterType((*ClusterSpec)(nil), "github.com.argoproj.argo_cd.pkg.apis.cluster.v1alpha1.ClusterSpec")
}
func (m *Cluster) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Cluster) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
dAtA[i] = 0xa
i++
i = encodeVarintGenerated(dAtA, i, uint64(m.ObjectMeta.Size()))
n1, err := m.ObjectMeta.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n1
dAtA[i] = 0x12
i++
i = encodeVarintGenerated(dAtA, i, uint64(m.Spec.Size()))
n2, err := m.Spec.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n2
return i, nil
}
func (m *ClusterList) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *ClusterList) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
dAtA[i] = 0xa
i++
i = encodeVarintGenerated(dAtA, i, uint64(m.ListMeta.Size()))
n3, err := m.ListMeta.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n3
if len(m.Items) > 0 {
for _, msg := range m.Items {
dAtA[i] = 0x12
i++
i = encodeVarintGenerated(dAtA, i, uint64(msg.Size()))
n, err := msg.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n
}
}
return i, nil
}
func (m *ClusterSpec) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *ClusterSpec) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
dAtA[i] = 0xa
i++
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Server)))
i += copy(dAtA[i:], m.Server)
return i, nil
}
func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int {
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return offset + 1
}
func (m *Cluster) Size() (n int) {
var l int
_ = l
l = m.ObjectMeta.Size()
n += 1 + l + sovGenerated(uint64(l))
l = m.Spec.Size()
n += 1 + l + sovGenerated(uint64(l))
return n
}
func (m *ClusterList) Size() (n int) {
var l int
_ = l
l = m.ListMeta.Size()
n += 1 + l + sovGenerated(uint64(l))
if len(m.Items) > 0 {
for _, e := range m.Items {
l = e.Size()
n += 1 + l + sovGenerated(uint64(l))
}
}
return n
}
func (m *ClusterSpec) Size() (n int) {
var l int
_ = l
l = len(m.Server)
n += 1 + l + sovGenerated(uint64(l))
return n
}
func sovGenerated(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
}
func sozGenerated(x uint64) (n int) {
return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (this *Cluster) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&Cluster{`,
`ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ObjectMeta", 1), `&`, ``, 1) + `,`,
`Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ClusterSpec", "ClusterSpec", 1), `&`, ``, 1) + `,`,
`}`,
}, "")
return s
}
func (this *ClusterList) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&ClusterList{`,
`ListMeta:` + strings.Replace(strings.Replace(this.ListMeta.String(), "ListMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ListMeta", 1), `&`, ``, 1) + `,`,
`Items:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Items), "Cluster", "Cluster", 1), `&`, ``, 1) + `,`,
`}`,
}, "")
return s
}
func (this *ClusterSpec) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&ClusterSpec{`,
`Server:` + fmt.Sprintf("%v", this.Server) + `,`,
`}`,
}, "")
return s
}
func valueToStringGenerated(v interface{}) string {
rv := reflect.ValueOf(v)
if rv.IsNil() {
return "nil"
}
pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("*%v", pv)
}
func (m *Cluster) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Cluster: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Cluster: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenerated
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenerated
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenerated(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthGenerated
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *ClusterList) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: ClusterList: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ClusterList: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenerated
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenerated
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Items = append(m.Items, Cluster{})
if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenerated(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthGenerated
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *ClusterSpec) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: ClusterSpec: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ClusterSpec: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Server", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthGenerated
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Server = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenerated(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthGenerated
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipGenerated(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenerated
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenerated
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
return iNdEx, nil
case 1:
iNdEx += 8
return iNdEx, nil
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenerated
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
iNdEx += length
if length < 0 {
return 0, ErrInvalidLengthGenerated
}
return iNdEx, nil
case 3:
for {
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenerated
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
innerWire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
innerWireType := int(innerWire & 0x7)
if innerWireType == 4 {
break
}
next, err := skipGenerated(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
}
return iNdEx, nil
case 4:
return iNdEx, nil
case 5:
iNdEx += 4
return iNdEx, nil
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
}
panic("unreachable")
}
var (
ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow")
)
func init() {
proto.RegisterFile("github.com/argoproj/argo-cd/pkg/apis/cluster/v1alpha1/generated.proto", fileDescriptorGenerated)
}
var fileDescriptorGenerated = []byte{
// 393 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x90, 0x31, 0x8f, 0xd3, 0x30,
0x14, 0xc7, 0xe3, 0xe3, 0xee, 0x28, 0x2e, 0x20, 0x94, 0xa9, 0xba, 0xc1, 0x77, 0xea, 0x80, 0x6e,
0xb9, 0x67, 0x5a, 0x51, 0x89, 0x89, 0x21, 0x88, 0x01, 0x09, 0x84, 0x94, 0x6e, 0x08, 0x09, 0x5c,
0xc7, 0xa4, 0x69, 0x9b, 0xda, 0x72, 0xdc, 0x48, 0x6c, 0x7c, 0x04, 0x3e, 0x56, 0xc7, 0xb2, 0x75,
0xaa, 0x68, 0xf8, 0x22, 0xc8, 0x8e, 0xd3, 0x54, 0xea, 0x82, 0xb8, 0xed, 0xbd, 0xe7, 0xf7, 0x7e,
0xff, 0xff, 0xdf, 0xf8, 0x6d, 0x9a, 0x99, 0xe9, 0x6a, 0x02, 0x5c, 0xe6, 0x94, 0xe9, 0x54, 0x2a,
0x2d, 0x67, 0xae, 0xb8, 0xe3, 0x09, 0x55, 0xf3, 0x94, 0x32, 0x95, 0x15, 0x94, 0x2f, 0x56, 0x85,
0x11, 0x9a, 0x96, 0x03, 0xb6, 0x50, 0x53, 0x36, 0xa0, 0xa9, 0x58, 0x0a, 0xcd, 0x8c, 0x48, 0x40,
0x69, 0x69, 0x64, 0x38, 0x6a, 0x31, 0xd0, 0x60, 0x5c, 0xf1, 0x85, 0x27, 0xa0, 0xe6, 0x29, 0x58,
0x0c, 0x78, 0x0c, 0x34, 0x98, 0xab, 0xbb, 0x23, 0xf5, 0x54, 0xa6, 0x92, 0x3a, 0xda, 0x64, 0xf5,
0xcd, 0x75, 0xae, 0x71, 0x55, 0xad, 0x72, 0xf5, 0x72, 0xfe, 0xaa, 0x80, 0x4c, 0x5a, 0x4f, 0x39,
0xe3, 0xd3, 0x6c, 0x29, 0xf4, 0xf7, 0xd6, 0x64, 0x2e, 0x0c, 0xa3, 0xe5, 0x89, 0xb7, 0xfe, 0x2f,
0x84, 0x1f, 0xbe, 0xa9, 0x95, 0xc3, 0xaf, 0xb8, 0x63, 0xd7, 0x12, 0x66, 0x58, 0x0f, 0xdd, 0xa0,
0xdb, 0xee, 0xf0, 0x05, 0xd4, 0x50, 0x38, 0x86, 0xb6, 0x96, 0xed, 0x36, 0x94, 0x03, 0xf8, 0x38,
0x99, 0x09, 0x6e, 0x3e, 0x08, 0xc3, 0xa2, 0x70, 0xbd, 0xbb, 0x0e, 0xaa, 0xdd, 0x35, 0x6e, 0x67,
0xf1, 0x81, 0x1a, 0x26, 0xf8, 0xbc, 0x50, 0x82, 0xf7, 0xce, 0x1c, 0x3d, 0x82, 0xff, 0xfa, 0x18,
0xf0, 0x7e, 0xc7, 0x4a, 0xf0, 0xe8, 0xb1, 0xd7, 0x3b, 0xb7, 0x5d, 0xec, 0xe8, 0xfd, 0x0d, 0xc2,
0x5d, 0xbf, 0xf3, 0x3e, 0x2b, 0x4c, 0xf8, 0xf9, 0x24, 0x17, 0xfc, 0x5b, 0x2e, 0x7b, 0xed, 0x52,
0x3d, 0xf3, 0x2a, 0x9d, 0x66, 0x72, 0x94, 0x89, 0xe3, 0x8b, 0xcc, 0x88, 0xbc, 0xe8, 0x9d, 0xdd,
0x3c, 0xb8, 0xed, 0x0e, 0x5f, 0xdf, 0x2f, 0x54, 0xf4, 0xc4, 0x4b, 0x5d, 0xbc, 0xb3, 0xd0, 0xb8,
0x66, 0xf7, 0x47, 0x87, 0x44, 0x36, 0x67, 0xf8, 0x1c, 0x5f, 0x16, 0x42, 0x97, 0x42, 0xbb, 0x3c,
0x8f, 0xa2, 0xa7, 0xfe, 0xe8, 0x72, 0xec, 0xa6, 0xb1, 0x7f, 0x8d, 0x60, 0xbd, 0x27, 0xc1, 0x66,
0x4f, 0x82, 0xed, 0x9e, 0x04, 0x3f, 0x2a, 0x82, 0xd6, 0x15, 0x41, 0x9b, 0x8a, 0xa0, 0x6d, 0x45,
0xd0, 0xef, 0x8a, 0xa0, 0x9f, 0x7f, 0x48, 0xf0, 0xa9, 0xd3, 0x98, 0xf8, 0x1b, 0x00, 0x00, 0xff,
0xff, 0xbf, 0xd1, 0xa9, 0xa0, 0xf1, 0x02, 0x00, 0x00,
}

View file

@ -0,0 +1,31 @@
// This file was autogenerated by go-to-protobuf. Do not edit it manually!
syntax = 'proto2';
package github.com.argoproj.argo_cd.pkg.apis.cluster.v1alpha1;
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
// Package-wide variables from generator "generated".
option go_package = "v1alpha1";
// Cluster is the definition of a cluster resource
message Cluster {
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
optional ClusterSpec spec = 2;
}
// ClusterList is a collection of Clusters.
message ClusterList {
optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
repeated Cluster items = 2;
}
// ClusterSpec is the cluster specification
message ClusterSpec {
optional string server = 1;
}

View file

@ -0,0 +1,24 @@
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// Cluster is the definition of a cluster resource
type Cluster struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
Spec ClusterSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
}
// ClusterSpec is the cluster specification
type ClusterSpec struct {
Server string `json:"server" protobuf:"bytes,1,req,name=server"`
}
// ClusterList is a collection of Clusters.
type ClusterList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
Items []Cluster `json:"items" protobuf:"bytes,2,rep,name=items"`
}

View file

@ -6,14 +6,12 @@ Package cluster is a generated protocol buffer package.
Cluster Service
Cluster Service API allows
Cluster Service API performs CRUD actions against cluster resources
It is generated from these files:
server/cluster/cluster.proto
It has these top-level messages:
ClusterMessage
ClusterListMessage
ClusterQuery
*/
package cluster
@ -22,7 +20,9 @@ import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "google.golang.org/genproto/googleapis/api/annotations"
import _ "k8s.io/apimachinery/pkg/apis/meta/v1"
import core "github.com/argoproj/argo-cd/server/core"
import github_com_argoproj_argo_cd_pkg_apis_cluster_v1alpha1 "github.com/argoproj/argo-cd/pkg/apis/cluster/v1alpha1"
import (
context "golang.org/x/net/context"
@ -40,83 +40,16 @@ var _ = math.Inf
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
// ClusterMessage holds Kuberentes cluster information
type ClusterMessage struct {
Name string `protobuf:"bytes,1,opt,name=Name" json:"Name,omitempty"`
Server string `protobuf:"bytes,2,opt,name=Server" json:"Server,omitempty"`
Certificate string `protobuf:"bytes,3,opt,name=Certificate" json:"Certificate,omitempty"`
Token string `protobuf:"bytes,4,opt,name=Token" json:"Token,omitempty"`
Description string `protobuf:"bytes,5,opt,name=Description" json:"Description,omitempty"`
}
func (m *ClusterMessage) Reset() { *m = ClusterMessage{} }
func (m *ClusterMessage) String() string { return proto.CompactTextString(m) }
func (*ClusterMessage) ProtoMessage() {}
func (*ClusterMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *ClusterMessage) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *ClusterMessage) GetServer() string {
if m != nil {
return m.Server
}
return ""
}
func (m *ClusterMessage) GetCertificate() string {
if m != nil {
return m.Certificate
}
return ""
}
func (m *ClusterMessage) GetToken() string {
if m != nil {
return m.Token
}
return ""
}
func (m *ClusterMessage) GetDescription() string {
if m != nil {
return m.Description
}
return ""
}
// ClusterListMessage holds multiple clusters
type ClusterListMessage struct {
Items []*ClusterMessage `protobuf:"bytes,1,rep,name=items" json:"items,omitempty"`
}
func (m *ClusterListMessage) Reset() { *m = ClusterListMessage{} }
func (m *ClusterListMessage) String() string { return proto.CompactTextString(m) }
func (*ClusterListMessage) ProtoMessage() {}
func (*ClusterListMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
func (m *ClusterListMessage) GetItems() []*ClusterMessage {
if m != nil {
return m.Items
}
return nil
}
type ClusterQuery struct {
XXX_unrecognized []byte `json:"-"`
}
func (m *ClusterQuery) Reset() { *m = ClusterQuery{} }
func (m *ClusterQuery) String() string { return proto.CompactTextString(m) }
func (*ClusterQuery) ProtoMessage() {}
func (*ClusterQuery) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
func (*ClusterQuery) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func init() {
proto.RegisterType((*ClusterMessage)(nil), "cluster.ClusterMessage")
proto.RegisterType((*ClusterListMessage)(nil), "cluster.ClusterListMessage")
proto.RegisterType((*ClusterQuery)(nil), "cluster.ClusterQuery")
}
@ -132,9 +65,9 @@ const _ = grpc.SupportPackageIsVersion4
type ClusterServiceClient interface {
// GetClusters returns list of clusters
GetClusters(ctx context.Context, in *ClusterQuery, opts ...grpc.CallOption) (*ClusterListMessage, error)
GetClusters(ctx context.Context, in *ClusterQuery, opts ...grpc.CallOption) (*github_com_argoproj_argo_cd_pkg_apis_cluster_v1alpha1.ClusterList, error)
// GetCluster returns a cluster by name
GetCluster(ctx context.Context, in *core.NameMessage, opts ...grpc.CallOption) (*ClusterMessage, error)
GetCluster(ctx context.Context, in *core.NameMessage, opts ...grpc.CallOption) (*github_com_argoproj_argo_cd_pkg_apis_cluster_v1alpha1.Cluster, error)
}
type clusterServiceClient struct {
@ -145,8 +78,8 @@ func NewClusterServiceClient(cc *grpc.ClientConn) ClusterServiceClient {
return &clusterServiceClient{cc}
}
func (c *clusterServiceClient) GetClusters(ctx context.Context, in *ClusterQuery, opts ...grpc.CallOption) (*ClusterListMessage, error) {
out := new(ClusterListMessage)
func (c *clusterServiceClient) GetClusters(ctx context.Context, in *ClusterQuery, opts ...grpc.CallOption) (*github_com_argoproj_argo_cd_pkg_apis_cluster_v1alpha1.ClusterList, error) {
out := new(github_com_argoproj_argo_cd_pkg_apis_cluster_v1alpha1.ClusterList)
err := grpc.Invoke(ctx, "/cluster.ClusterService/GetClusters", in, out, c.cc, opts...)
if err != nil {
return nil, err
@ -154,8 +87,8 @@ func (c *clusterServiceClient) GetClusters(ctx context.Context, in *ClusterQuery
return out, nil
}
func (c *clusterServiceClient) GetCluster(ctx context.Context, in *core.NameMessage, opts ...grpc.CallOption) (*ClusterMessage, error) {
out := new(ClusterMessage)
func (c *clusterServiceClient) GetCluster(ctx context.Context, in *core.NameMessage, opts ...grpc.CallOption) (*github_com_argoproj_argo_cd_pkg_apis_cluster_v1alpha1.Cluster, error) {
out := new(github_com_argoproj_argo_cd_pkg_apis_cluster_v1alpha1.Cluster)
err := grpc.Invoke(ctx, "/cluster.ClusterService/GetCluster", in, out, c.cc, opts...)
if err != nil {
return nil, err
@ -167,9 +100,9 @@ func (c *clusterServiceClient) GetCluster(ctx context.Context, in *core.NameMess
type ClusterServiceServer interface {
// GetClusters returns list of clusters
GetClusters(context.Context, *ClusterQuery) (*ClusterListMessage, error)
GetClusters(context.Context, *ClusterQuery) (*github_com_argoproj_argo_cd_pkg_apis_cluster_v1alpha1.ClusterList, error)
// GetCluster returns a cluster by name
GetCluster(context.Context, *core.NameMessage) (*ClusterMessage, error)
GetCluster(context.Context, *core.NameMessage) (*github_com_argoproj_argo_cd_pkg_apis_cluster_v1alpha1.Cluster, error)
}
func RegisterClusterServiceServer(s *grpc.Server, srv ClusterServiceServer) {
@ -232,27 +165,25 @@ var _ClusterService_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("server/cluster/cluster.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 343 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0xcd, 0x4a, 0xc3, 0x40,
0x10, 0x26, 0xfd, 0x13, 0xb7, 0x52, 0x74, 0xd0, 0x76, 0x8d, 0x05, 0x4b, 0x4e, 0x45, 0x6c, 0x82,
0xf5, 0x0d, 0xac, 0xe0, 0x45, 0x05, 0xab, 0x17, 0xf5, 0xb4, 0x8d, 0x63, 0x5c, 0x6d, 0xb3, 0x61,
0x77, 0x5b, 0x10, 0xf1, 0xe2, 0x2b, 0x08, 0x3e, 0x93, 0x77, 0x5f, 0xc1, 0x07, 0x91, 0x4c, 0x12,
0xfa, 0x03, 0x5e, 0x92, 0x9d, 0x6f, 0xf6, 0xfb, 0x98, 0xef, 0x9b, 0x65, 0x6d, 0x83, 0x7a, 0x86,
0x3a, 0x08, 0xc7, 0x53, 0x63, 0xe7, 0x7f, 0x3f, 0xd1, 0xca, 0x2a, 0x58, 0xcb, 0x4b, 0xb7, 0x1d,
0x29, 0x15, 0x8d, 0x31, 0x10, 0x89, 0x0c, 0x44, 0x1c, 0x2b, 0x2b, 0xac, 0x54, 0xb1, 0xc9, 0xae,
0xb9, 0xcd, 0x42, 0x44, 0x69, 0xa4, 0x4f, 0x86, 0x7b, 0x5f, 0x0e, 0x6b, 0x0c, 0x32, 0x85, 0x0b,
0x34, 0x46, 0x44, 0x08, 0xc0, 0x2a, 0x97, 0x62, 0x82, 0xdc, 0xe9, 0x38, 0xdd, 0xf5, 0x21, 0x9d,
0xa1, 0xc9, 0x6a, 0xd7, 0x24, 0xc0, 0x4b, 0x84, 0xe6, 0x15, 0x74, 0x58, 0x7d, 0x80, 0xda, 0xca,
0x47, 0x19, 0x0a, 0x8b, 0xbc, 0x4c, 0xcd, 0x45, 0x08, 0xb6, 0x59, 0xf5, 0x46, 0xbd, 0x60, 0xcc,
0x2b, 0xd4, 0xcb, 0x8a, 0x94, 0x77, 0x8a, 0x26, 0xd4, 0x32, 0x49, 0x87, 0xe4, 0xd5, 0x8c, 0xb7,
0x00, 0x79, 0x03, 0x06, 0xf9, 0x5c, 0xe7, 0xd2, 0xd8, 0x62, 0xb6, 0x1e, 0xab, 0x4a, 0x8b, 0x13,
0xc3, 0x9d, 0x4e, 0xb9, 0x5b, 0xef, 0xb7, 0xfc, 0x22, 0x8c, 0x65, 0x0f, 0xc3, 0xec, 0x96, 0xd7,
0x60, 0x1b, 0x79, 0xe3, 0x6a, 0x8a, 0xfa, 0xb5, 0xff, 0x3d, 0x77, 0x9b, 0x1a, 0x90, 0x21, 0xc2,
0x3d, 0xab, 0x9f, 0xa1, 0xcd, 0x41, 0x03, 0x3b, 0xab, 0x8a, 0x44, 0x74, 0xf7, 0x56, 0xe1, 0x85,
0xa1, 0x3c, 0xfe, 0xf1, 0xf3, 0xfb, 0x59, 0x02, 0xd8, 0xa4, 0xec, 0x67, 0x47, 0xc5, 0x86, 0x0c,
0xdc, 0x32, 0x36, 0x17, 0x87, 0x2d, 0x9f, 0x82, 0x4f, 0x03, 0xcd, 0xa9, 0xee, 0x7f, 0x06, 0xbc,
0x7d, 0xd2, 0xdc, 0x85, 0xd6, 0xaa, 0x66, 0xf0, 0x96, 0xf2, 0xdf, 0x4f, 0x0e, 0xef, 0x0e, 0x22,
0x69, 0x9f, 0xa6, 0x23, 0x3f, 0x54, 0x93, 0x40, 0xe8, 0x48, 0x25, 0x5a, 0x3d, 0xd3, 0xa1, 0x17,
0x3e, 0x04, 0xcb, 0x6f, 0x66, 0x54, 0xa3, 0x6d, 0x1f, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x47,
0xcc, 0x8b, 0x56, 0x4c, 0x02, 0x00, 0x00,
// 311 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x91, 0xc1, 0x4a, 0x03, 0x31,
0x10, 0x86, 0x69, 0x2f, 0x42, 0x94, 0xa2, 0x01, 0x51, 0x97, 0x82, 0xd0, 0xa3, 0x68, 0x42, 0x8b,
0x07, 0x4f, 0x1e, 0x2a, 0xe2, 0x45, 0x05, 0xf1, 0xe6, 0x45, 0xc6, 0x74, 0x48, 0x63, 0xbb, 0x49,
0x48, 0xb2, 0x0b, 0x45, 0x04, 0xe9, 0x2b, 0x78, 0xf1, 0xbd, 0x7c, 0x05, 0x1f, 0x44, 0x36, 0xbb,
0xe9, 0x8a, 0x82, 0x08, 0x5e, 0x76, 0x27, 0x93, 0xf9, 0xf3, 0x7f, 0xf9, 0x43, 0xfa, 0x1e, 0x5d,
0x89, 0x8e, 0x8b, 0x79, 0xe1, 0x43, 0xfb, 0x67, 0xd6, 0x99, 0x60, 0xe8, 0x5a, 0xb3, 0xcc, 0xfa,
0xd2, 0x18, 0x39, 0x47, 0x0e, 0x56, 0x71, 0xd0, 0xda, 0x04, 0x08, 0xca, 0x68, 0x5f, 0x8f, 0x65,
0xc7, 0xb3, 0x13, 0xcf, 0x94, 0xa9, 0x76, 0x73, 0x10, 0x53, 0xa5, 0xd1, 0x2d, 0xb8, 0x9d, 0xc9,
0xaa, 0xe1, 0x79, 0x8e, 0x01, 0x78, 0x39, 0xe4, 0x12, 0x35, 0x3a, 0x08, 0x38, 0x69, 0x54, 0x23,
0xa9, 0xc2, 0xb4, 0x78, 0x60, 0xc2, 0xe4, 0x1c, 0x9c, 0x34, 0xd6, 0x99, 0xc7, 0x58, 0x1c, 0x89,
0x09, 0x4f, 0x58, 0xc6, 0x61, 0xfc, 0x34, 0x9a, 0xf3, 0xdf, 0x34, 0x2b, 0xc7, 0x74, 0x99, 0x72,
0x08, 0x73, 0x3b, 0x85, 0x1f, 0xd6, 0x83, 0x1e, 0xd9, 0x38, 0xab, 0x67, 0x6e, 0x0a, 0x74, 0x8b,
0xd1, 0x5b, 0x97, 0xf4, 0x9a, 0xc6, 0x2d, 0xba, 0x52, 0x09, 0xa4, 0xcb, 0x0e, 0x59, 0xbf, 0xc0,
0xd0, 0x74, 0x3d, 0xdd, 0x66, 0x29, 0x9a, 0xaf, 0xca, 0x6c, 0xcc, 0x5a, 0x22, 0x96, 0x88, 0x62,
0x71, 0x2f, 0x26, 0xcc, 0xce, 0x24, 0xab, 0x88, 0x56, 0xda, 0x44, 0x94, 0x0e, 0xb9, 0x54, 0x3e,
0x0c, 0x76, 0x97, 0xef, 0x1f, 0xaf, 0x5d, 0x4a, 0x37, 0x63, 0xbc, 0xe5, 0x30, 0xf1, 0x7b, 0xfa,
0xd2, 0x21, 0xa4, 0x85, 0xa0, 0x5b, 0x2c, 0x46, 0x71, 0x0d, 0x39, 0x5e, 0xa1, 0xf7, 0x20, 0x31,
0x3b, 0xfd, 0x9f, 0xff, 0x60, 0x3f, 0x7a, 0xef, 0xd1, 0x9d, 0xef, 0xde, 0xfc, 0x49, 0x43, 0x8e,
0xcf, 0xe3, 0xc3, 0xbb, 0x83, 0xbf, 0xbc, 0x53, 0xad, 0xfa, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xba,
0x61, 0xac, 0xc5, 0x4f, 0x02, 0x00, 0x00,
}

View file

@ -49,15 +49,15 @@ func request_ClusterService_GetCluster_0(ctx context.Context, marshaler runtime.
_ = err
)
val, ok = pathParams["Name"]
val, ok = pathParams["name"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "Name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
}
protoReq.Name, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "Name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
}
msg, err := client.GetCluster(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
@ -167,7 +167,7 @@ func RegisterClusterServiceHandlerClient(ctx context.Context, mux *runtime.Serve
var (
pattern_ClusterService_GetClusters_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "clusters"}, ""))
pattern_ClusterService_GetCluster_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v1", "clusters", "Name"}, ""))
pattern_ClusterService_GetCluster_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v1", "clusters", "name"}, ""))
)
var (

View file

@ -1,45 +1,28 @@
syntax = "proto3";
syntax = "proto2";
option go_package = "github.com/argoproj/argo-cd/server/cluster";
// Cluster Service
//
// Cluster Service API allows
// Cluster Service API performs CRUD actions against cluster resources
package cluster;
import "google/api/annotations.proto";
import "server/core/core.proto";
// ClusterMessage holds Kuberentes cluster information
message ClusterMessage {
string Name = 1;
string Server = 2;
string Certificate = 3;
string Token = 4;
string Description = 5;
}
// ClusterListMessage holds multiple clusters
message ClusterListMessage {
repeated ClusterMessage items = 1;
}
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
import "github.com/argoproj/argo-cd/server/core/core.proto";
import "github.com/argoproj/argo-cd/pkg/apis/cluster/v1alpha1/generated.proto";
message ClusterQuery {}
// ClusterService
service ClusterService {
// GetClusters returns list of clusters
rpc GetClusters(ClusterQuery) returns (ClusterListMessage) {
option (google.api.http) = {
get: "/api/v1/clusters"
};
rpc GetClusters(ClusterQuery) returns (github.com.argoproj.argo_cd.pkg.apis.cluster.v1alpha1.ClusterList) {
option (google.api.http).get = "/api/v1/clusters";
}
// GetCluster returns a cluster by name
rpc GetCluster(core.NameMessage) returns (ClusterMessage) {
option (google.api.http) = {
get: "/api/v1/clusters/{Name}"
};
rpc GetCluster(core.NameMessage) returns (github.com.argoproj.argo_cd.pkg.apis.cluster.v1alpha1.Cluster) {
option (google.api.http).get = "/api/v1/clusters/{name}";
}
}

View file

@ -1,18 +1,20 @@
package cluster
import (
clusterv1 "github.com/argoproj/argo-cd/pkg/apis/cluster/v1alpha1"
"github.com/argoproj/argo-cd/server/core"
"golang.org/x/net/context"
)
// Server provides a Cluster service
type Server struct{}
// GetClusters returns list of clusters
func (s *Server) GetClusters(ctx context.Context, in *ClusterQuery) (*ClusterListMessage, error) {
return &ClusterListMessage{}, nil
func (s *Server) GetClusters(ctx context.Context, in *ClusterQuery) (*clusterv1.ClusterList, error) {
return &clusterv1.ClusterList{}, nil
}
// GetCluster returns list of clusters
func (s *Server) GetCluster(ctx context.Context, in *core.NameMessage) (*ClusterMessage, error) {
return &ClusterMessage{}, nil
func (s *Server) GetCluster(ctx context.Context, in *core.NameMessage) (*clusterv1.Cluster, error) {
return &clusterv1.Cluster{}, nil
}

View file

@ -31,7 +31,7 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
// NameMessage is a name of a resource
type NameMessage struct {
Name string `protobuf:"bytes,1,opt,name=Name" json:"Name,omitempty"`
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
}
func (m *NameMessage) Reset() { *m = NameMessage{} }
@ -53,13 +53,13 @@ func init() {
func init() { proto.RegisterFile("server/core/core.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 114 bytes of a gzipped FileDescriptorProto
// 116 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2b, 0x4e, 0x2d, 0x2a,
0x4b, 0x2d, 0xd2, 0x4f, 0xce, 0x2f, 0x4a, 0x05, 0x13, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42,
0x2c, 0x20, 0xb6, 0x92, 0x22, 0x17, 0xb7, 0x5f, 0x62, 0x6e, 0xaa, 0x6f, 0x6a, 0x71, 0x71, 0x62,
0x7a, 0xaa, 0x90, 0x10, 0x17, 0x0b, 0x88, 0x2b, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0x04, 0x66,
0x3b, 0x69, 0x46, 0xa9, 0xa7, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x27,
0x16, 0xa5, 0xe7, 0x17, 0x14, 0xe5, 0x67, 0x81, 0x19, 0xba, 0xc9, 0x29, 0xfa, 0x48, 0xc6, 0x27,
0xb1, 0x81, 0x8d, 0x36, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x92, 0x63, 0xdf, 0x1d, 0x74, 0x00,
0x00, 0x00,
0x7a, 0xaa, 0x90, 0x10, 0x17, 0x4b, 0x5e, 0x62, 0x6e, 0xaa, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67,
0x10, 0x98, 0xed, 0xa4, 0x19, 0xa5, 0x9e, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f,
0xab, 0x9f, 0x58, 0x94, 0x9e, 0x5f, 0x50, 0x94, 0x9f, 0x05, 0x66, 0xe8, 0x26, 0xa7, 0xe8, 0x23,
0x19, 0x9f, 0xc4, 0x06, 0x36, 0xda, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xcf, 0xc3, 0xb8, 0x2f,
0x74, 0x00, 0x00, 0x00,
}

View file

@ -6,5 +6,5 @@ package core;
// NameMessage is a name of a resource
message NameMessage {
string Name = 1;
string name = 1;
}

View file

@ -9,6 +9,7 @@ import (
argocd "github.com/argoproj/argo-cd"
"github.com/argoproj/argo-cd/server/cluster"
"github.com/argoproj/argo-cd/server/version"
"github.com/cockroachdb/cockroach/pkg/util/protoutil"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
log "github.com/sirupsen/logrus"
"github.com/soheilhy/cmux"
@ -33,6 +34,9 @@ func NewServer() *ArgoCDServer {
}
// Run runs the API Server
// We use k8s.io/code-generator/cmd/go-to-protobuf to generate the .proto files from the API types.
// k8s.io/ go-to-protobuf uses protoc-gen-gogo, which comes from gogo/protobuf (a fork of
// golang/protobuf).
func (a *ArgoCDServer) Run() {
ctx := context.Background()
ctx, cancel := context.WithCancel(ctx)
@ -43,10 +47,8 @@ func (a *ArgoCDServer) Run() {
panic(err)
}
// Create a cmux.
// Cmux is used to support servicing gRPC and HTTP1.1+JSON on the same port
m := cmux.New(conn)
// Match connections in order: First gRPC, then HTTP
grpcL := m.Match(cmux.HTTP2HeaderField("content-type", "application/grpc"))
httpL := m.Match(cmux.HTTP1Fast())
@ -56,8 +58,12 @@ func (a *ArgoCDServer) Run() {
cluster.RegisterClusterServiceServer(grpcS, &cluster.Server{})
// HTTP 1.1+JSON Server
// grpc-ecosystem/grpc-gateway is used to proxy HTTP requests to the corresponding gRPC call
mux := http.NewServeMux()
gwmux := runtime.NewServeMux()
// The following option is used with grpc-gateway to work around the following issue:
// https://github.com/gogo/protobuf/issues/212#issuecomment-253709966
gwMuxOpts := runtime.WithMarshalerOption(runtime.MIMEWildcard, new(protoutil.JSONPb))
gwmux := runtime.NewServeMux(gwMuxOpts)
mux.Handle("/", gwmux)
dOpts := []grpc.DialOption{grpc.WithInsecure()}
mustRegisterGWHandler(version.RegisterVersionServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dOpts)