mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
Support for cluster update endpoint
This commit is contained in:
56
Gopkg.lock
generated
56
Gopkg.lock
generated
@@ -19,16 +19,6 @@
|
||||
packages = ["."]
|
||||
revision = "de5bf2ad457846296e2031421a34e2568e304e35"
|
||||
|
||||
[[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/davecgh/go-spew"
|
||||
packages = ["spew"]
|
||||
@@ -77,10 +67,32 @@
|
||||
[[projects]]
|
||||
name = "github.com/gogo/protobuf"
|
||||
packages = [
|
||||
"jsonpb",
|
||||
"gogoproto",
|
||||
"plugin/compare",
|
||||
"plugin/defaultcheck",
|
||||
"plugin/description",
|
||||
"plugin/embedcheck",
|
||||
"plugin/enumstringer",
|
||||
"plugin/equal",
|
||||
"plugin/face",
|
||||
"plugin/gostring",
|
||||
"plugin/marshalto",
|
||||
"plugin/oneofcheck",
|
||||
"plugin/populate",
|
||||
"plugin/size",
|
||||
"plugin/stringer",
|
||||
"plugin/testgen",
|
||||
"plugin/union",
|
||||
"plugin/unmarshal",
|
||||
"proto",
|
||||
"protoc-gen-gofast",
|
||||
"protoc-gen-gogo/descriptor",
|
||||
"protoc-gen-gogo/generator",
|
||||
"protoc-gen-gogo/grpc",
|
||||
"protoc-gen-gogo/plugin",
|
||||
"sortkeys",
|
||||
"types"
|
||||
"vanity",
|
||||
"vanity/command"
|
||||
]
|
||||
revision = "1adfc126b41513cc696b209667c8656ea7aac67c"
|
||||
version = "v1.0.0"
|
||||
@@ -209,24 +221,6 @@
|
||||
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 = ["."]
|
||||
@@ -576,6 +570,6 @@
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "1fbd546dd2cccd6830dd624612f202d2ef46f7c5329a9752872634473a87c9ff"
|
||||
inputs-digest = "4dc0497ff23781736bf92a00dd1a9b0bb89f5c8b67d1651890ee8da7ca4c4cb3"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
required = [
|
||||
"github.com/gogo/protobuf/protoc-gen-gofast",
|
||||
"k8s.io/code-generator/cmd/go-to-protobuf",
|
||||
]
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
|
||||
"github.com/argoproj/argo-cd/errors"
|
||||
"github.com/argoproj/argo-cd/server/cluster"
|
||||
"github.com/argoproj/argo-cd/server/core"
|
||||
"github.com/argoproj/argo-cd/util"
|
||||
"github.com/ghodss/yaml"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
"google.golang.org/grpc"
|
||||
@@ -54,9 +54,11 @@ func NewClusterGetCommand() *cobra.Command {
|
||||
conn, clusterIf := NewClusterClient()
|
||||
defer util.Close(conn)
|
||||
for _, clusterName := range args {
|
||||
clst, err := clusterIf.Get(context.Background(), &core.NameMessage{Name: clusterName})
|
||||
clst, err := clusterIf.Get(context.Background(), &cluster.ClusterQuery{Name: clusterName})
|
||||
errors.CheckError(err)
|
||||
fmt.Printf("%v\n", clst)
|
||||
yamlBytes, err := yaml.Marshal(clst)
|
||||
errors.CheckError(err)
|
||||
fmt.Printf("%v\n", string(yamlBytes))
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -75,7 +77,7 @@ func NewClusterRemoveCommand() *cobra.Command {
|
||||
conn, clusterIf := NewClusterClient()
|
||||
defer util.Close(conn)
|
||||
for _, clusterName := range args {
|
||||
_, err := clusterIf.Delete(context.Background(), &core.NameMessage{Name: clusterName})
|
||||
_, err := clusterIf.Delete(context.Background(), &cluster.ClusterQuery{Name: clusterName})
|
||||
errors.CheckError(err)
|
||||
}
|
||||
},
|
||||
|
||||
@@ -19,21 +19,32 @@ go build -i -o dist/protoc-gen-gogo ./vendor/k8s.io/code-generator/cmd/go-to-pro
|
||||
|
||||
# Generate pkg/apis/<group>/<apiversion>/(generated.proto,generated.pb.go)
|
||||
# NOTE: any dependencies of our types to the k8s.io apimachinery types should be added to the
|
||||
# --apimachinery-packages= option so that go-to-protobuf can locate teh types, but prefixed with a
|
||||
# --apimachinery-packages= option so that go-to-protobuf can locate the types, but prefixed with a
|
||||
# '-' so that go-to-protobuf will not generate .proto files for it.
|
||||
PACKAGES=(
|
||||
github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1
|
||||
)
|
||||
APIMACHINERY_PKGS=(
|
||||
+k8s.io/apimachinery/pkg/util/intstr
|
||||
+k8s.io/apimachinery/pkg/api/resource
|
||||
+k8s.io/apimachinery/pkg/runtime/schema
|
||||
+k8s.io/apimachinery/pkg/runtime
|
||||
k8s.io/apimachinery/pkg/apis/meta/v1
|
||||
k8s.io/api/core/v1
|
||||
)
|
||||
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,-k8s.io/api/core/v1,-k8s.io/apimachinery/pkg/runtime/schema \
|
||||
--apimachinery-packages=$(IFS=, ; echo "${APIMACHINERY_PKGS[*]}") \
|
||||
--proto-import=./vendor
|
||||
|
||||
# protobuf tooling required to build server/*/<service>.pb.go and <service>.pb.gw.go files from
|
||||
# .proto files
|
||||
go build -i -o dist/protoc-gen-go ./vendor/github.com/golang/protobuf/protoc-gen-go
|
||||
# protoc-gen-go or protoc-gen-gofast is used to build server/*/<service>.pb.go from .proto files
|
||||
# NOTE: it is possible to use golang/protobuf or gogo/protobuf interchangeably
|
||||
go build -i -o dist/protoc-gen-gofast ./vendor/github.com/gogo/protobuf/protoc-gen-gofast
|
||||
#go build -i -o dist/protoc-gen-go ./vendor/github.com/golang/protobuf/protoc-gen-go
|
||||
|
||||
# protoc-gen-grpc-gateway is used to build <service>.pb.gw.go files from from .proto files
|
||||
go build -i -o dist/protoc-gen-grpc-gateway ./vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
|
||||
|
||||
# Generate server/<service>/(<service>.pb.go|<service>.pb.gw.go)
|
||||
@@ -43,8 +54,10 @@ for i in ${PROTO_FILES}; do
|
||||
# building natively (e.g. from workspace) vs. part of a docker build.
|
||||
if [ -f /.dockerenv ]; then
|
||||
GOOGLE_PROTO_API_PATH=/root/go/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis
|
||||
GOGO_PROTOBUF_PATH=/root/go/src/github.com/gogo/protobuf
|
||||
else
|
||||
GOOGLE_PROTO_API_PATH=${PROJECT_ROOT}/vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis
|
||||
GOGO_PROTOBUF_PATH=${PROJECT_ROOT}/vendor/github.com/gogo/protobuf
|
||||
fi
|
||||
protoc \
|
||||
-I${PROJECT_ROOT} \
|
||||
@@ -52,6 +65,7 @@ for i in ${PROTO_FILES}; do
|
||||
-I./vendor \
|
||||
-I$GOPATH/src \
|
||||
-I${GOOGLE_PROTO_API_PATH} \
|
||||
-I${GOGO_PROTOBUF_PATH} \
|
||||
--go_out=plugins=grpc:$GOPATH/src \
|
||||
--grpc-gateway_out=logtostderr=true:$GOPATH/src \
|
||||
$i
|
||||
|
||||
@@ -1570,50 +1570,51 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
// 707 bytes of a gzipped FileDescriptorProto
|
||||
// 725 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0xcd, 0x4e, 0x14, 0x4b,
|
||||
0x14, 0x9e, 0xe6, 0xef, 0x42, 0xcd, 0x85, 0x0b, 0x7d, 0xa3, 0x19, 0x59, 0x34, 0xa4, 0x17, 0x86,
|
||||
0x85, 0x54, 0x0b, 0x11, 0xa3, 0x1b, 0x13, 0x1b, 0x94, 0x60, 0x30, 0x9a, 0xc2, 0x85, 0x31, 0x26,
|
||||
0x5a, 0xd4, 0x1c, 0x7a, 0x8a, 0x99, 0xee, 0xea, 0x54, 0x55, 0x4f, 0xe2, 0xce, 0x47, 0xf0, 0x69,
|
||||
0x7c, 0x05, 0x59, 0x92, 0xa0, 0x09, 0x0b, 0x43, 0x64, 0x7c, 0x0b, 0x57, 0xa6, 0x6b, 0x6a, 0xe8,
|
||||
0x9e, 0x19, 0x48, 0x8c, 0x10, 0x76, 0x5d, 0x55, 0xe7, 0x7c, 0xdf, 0xf9, 0xce, 0xf9, 0xfa, 0xa0,
|
||||
0xad, 0x88, 0xeb, 0x46, 0xb6, 0x8b, 0x99, 0x88, 0x03, 0x2a, 0x23, 0x91, 0x4a, 0xb1, 0x6f, 0x3e,
|
||||
0x96, 0x59, 0x3d, 0x48, 0x9b, 0x51, 0x40, 0x53, 0xae, 0x02, 0x9a, 0xa6, 0x2d, 0xce, 0xa8, 0xe6,
|
||||
0x22, 0x09, 0xda, 0x2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, 0x7b, 0x27, 0x05, 0x16, 0xfe, 0x6b, 0x79, 0xc7, 0xf2, 0x13, 0x31, 0x2c, 0xae, 0x46, 0x13,
|
||||
0x4a, 0x53, 0x9d, 0xa9, 0xda, 0xa8, 0xe1, 0xdb, 0xbe, 0x22, 0x3e, 0x83, 0x19, 0xce, 0x58, 0xc6,
|
||||
0x89, 0xee, 0x99, 0x58, 0x2e, 0xff, 0xbb, 0x83, 0xfe, 0x2b, 0x45, 0x6f, 0x73, 0xa5, 0xdd, 0xb7,
|
||||
0x43, 0x9d, 0xc5, 0x7f, 0xd6, 0xd9, 0x3c, 0xdb, 0xf4, 0x75, 0xd6, 0xb2, 0x4d, 0xf6, 0x6e, 0x4a,
|
||||
0x5d, 0x6d, 0xa2, 0x71, 0xae, 0x21, 0x56, 0xb5, 0x91, 0xc5, 0xd1, 0xa5, 0xea, 0xea, 0xd3, 0xab,
|
||||
0x91, 0x19, 0x4e, 0x5b, 0xca, 0xf1, 0xad, 0x1c, 0x9c, 0x74, 0x39, 0xfc, 0x23, 0x07, 0xcd, 0x95,
|
||||
0x9b, 0x21, 0x32, 0xc9, 0xc0, 0x05, 0x34, 0x1d, 0x71, 0x4d, 0x20, 0x15, 0x3b, 0xc0, 0x24, 0x68,
|
||||
0xab, 0x72, 0xa9, 0xa4, 0x12, 0xe7, 0xa6, 0x37, 0x9a, 0x04, 0xa3, 0xad, 0xae, 0x3d, 0x08, 0xec,
|
||||
0x81, 0x84, 0x84, 0x41, 0x78, 0xc3, 0x92, 0x4d, 0x6f, 0x96, 0x61, 0x48, 0x3f, 0xaa, 0xbb, 0x88,
|
||||
0xc6, 0x52, 0xaa, 0x1b, 0xc6, 0x3f, 0x53, 0xc5, 0xcc, 0x5f, 0x52, 0xdd, 0x20, 0xe6, 0xc5, 0x5d,
|
||||
0x43, 0x55, 0x48, 0xda, 0x5c, 0x8a, 0x24, 0x86, 0x44, 0x9b, 0xc1, 0x4f, 0x85, 0xff, 0xdb, 0xc0,
|
||||
0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 0x8e, 0xe5, 0x37, 0xa2, 0x59, 0x6c, 0x85,
|
||||
0x26, 0xa4, 0xa2, 0x2a, 0x93, 0xb5, 0x51, 0xcd, 0xb7, 0x7d, 0x49, 0x7c, 0x1a, 0xd3, 0x9f, 0x31,
|
||||
0x8c, 0x13, 0x9d, 0x3b, 0x31, 0x5c, 0xee, 0x37, 0x0b, 0xfd, 0x57, 0xf2, 0xde, 0x66, 0x52, 0xd9,
|
||||
0x6f, 0x06, 0x3a, 0x8b, 0xff, 0xac, 0xb3, 0x79, 0xb4, 0xee, 0xeb, 0xac, 0x61, 0x9b, 0xec, 0xbe,
|
||||
0x94, 0xba, 0xda, 0x44, 0xe3, 0x4c, 0x41, 0x2c, 0x6b, 0x23, 0x8b, 0xa3, 0x4b, 0xd5, 0xd5, 0x27,
|
||||
0x97, 0x53, 0xa6, 0x3f, 0x6d, 0x28, 0xc7, 0xb7, 0x72, 0x70, 0xd2, 0xe1, 0x70, 0x8f, 0x2c, 0x34,
|
||||
0x57, 0x6e, 0x06, 0xcf, 0x44, 0x00, 0x36, 0xa0, 0xe9, 0x90, 0x29, 0x02, 0x29, 0xdf, 0x81, 0x40,
|
||||
0x80, 0x32, 0x55, 0x2e, 0x95, 0xaa, 0xc4, 0xf9, 0xd7, 0xd2, 0x35, 0xf1, 0x80, 0x46, 0x1d, 0x79,
|
||||
0x10, 0xd8, 0x03, 0x01, 0x49, 0x00, 0xfe, 0x35, 0x43, 0x36, 0xbd, 0x59, 0x86, 0x21, 0xbd, 0xa8,
|
||||
0xf6, 0x22, 0x1a, 0x4b, 0xa9, 0x6a, 0x68, 0xfd, 0x4c, 0x15, 0x33, 0x7f, 0x41, 0x55, 0x83, 0x68,
|
||||
0x8b, 0xbd, 0x86, 0xaa, 0x90, 0xb4, 0x98, 0xe0, 0x49, 0x0c, 0x89, 0xd2, 0x83, 0x9f, 0xf2, 0xff,
|
||||
0x37, 0x8e, 0xd5, 0xc7, 0x85, 0x89, 0x94, 0xfd, 0xdc, 0xcf, 0xbd, 0x43, 0xcb, 0x45, 0x64, 0x3f,
|
||||
0x44, 0x33, 0x8a, 0x8a, 0x10, 0x14, 0x81, 0x16, 0x93, 0x8c, 0x27, 0xba, 0xa8, 0x29, 0xff, 0xba,
|
||||
0x41, 0x9b, 0x79, 0xd9, 0x63, 0x25, 0x7d, 0xde, 0x5a, 0x7e, 0xba, 0x3b, 0x46, 0xee, 0x97, 0x25,
|
||||
0x3f, 0x8d, 0x59, 0x92, 0x9f, 0xbe, 0x13, 0xc3, 0xe5, 0x7e, 0xea, 0x9b, 0x8f, 0x16, 0xa5, 0xfd,
|
||||
0x0a, 0xcd, 0x06, 0x3c, 0x4e, 0xa9, 0x60, 0x92, 0x27, 0x04, 0x64, 0x16, 0x29, 0x53, 0xcd, 0x2d,
|
||||
0x83, 0x33, 0xbb, 0xde, 0x67, 0xff, 0x79, 0xce, 0x1b, 0x19, 0x40, 0xb1, 0x37, 0xd1, 0x5c, 0x9d,
|
||||
0xed, 0x99, 0x31, 0x6e, 0x80, 0xa2, 0x2c, 0x92, 0x66, 0x3e, 0x37, 0x0c, 0xf4, 0xdc, 0x46, 0xbf,
|
||||
0x03, 0x19, 0x8c, 0x71, 0xbf, 0x5a, 0xe8, 0x9f, 0xf5, 0x28, 0x93, 0x0a, 0xc4, 0x15, 0x6c, 0xa2,
|
||||
0x46, 0xcf, 0x26, 0xba, 0xc8, 0x97, 0x31, 0x39, 0x0f, 0xdb, 0x42, 0xee, 0x17, 0x0b, 0x55, 0x8d,
|
||||
0xcf, 0x15, 0xec, 0x82, 0xb0, 0x77, 0x17, 0xf8, 0x17, 0x2f, 0x6c, 0xc8, 0x1e, 0x58, 0x3b, 0xab,
|
||||
0x4a, 0x7f, 0x96, 0x9b, 0x68, 0x42, 0x82, 0x68, 0x81, 0x30, 0xb2, 0x2a, 0xe4, 0xa9, 0x5f, 0x89,
|
||||
0xb1, 0xfa, 0xf8, 0xe0, 0xd4, 0xa9, 0x1c, 0x9e, 0x3a, 0x95, 0xe3, 0x53, 0xa7, 0xf2, 0xa1, 0xed,
|
||||
0x58, 0x07, 0x6d, 0xc7, 0x3a, 0x6c, 0x3b, 0xd6, 0x71, 0xdb, 0xb1, 0xbe, 0xb7, 0x1d, 0xeb, 0xe3,
|
||||
0x0f, 0xa7, 0xf2, 0x7a, 0xb2, 0x9b, 0xc4, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9c, 0x48, 0xe0,
|
||||
0x3e, 0x51, 0x08, 0x00, 0x00,
|
||||
}
|
||||
|
||||
@@ -7,7 +7,9 @@ package github.com.argoproj.argo_cd.pkg.apis.application.v1alpha1;
|
||||
|
||||
import "k8s.io/api/core/v1/generated.proto";
|
||||
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
|
||||
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
|
||||
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
|
||||
import "k8s.io/apimachinery/pkg/util/intstr/generated.proto";
|
||||
|
||||
// Package-wide variables from generator "generated".
|
||||
option go_package = "v1alpha1";
|
||||
|
||||
@@ -69,6 +69,29 @@ type Cluster struct {
|
||||
Spec ClusterSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
|
||||
}
|
||||
|
||||
// objectMeta and corresponding GetMetadata() methods is a hack to allow us to use grpc-gateway
|
||||
// side-by-side with k8s protobuf codegen. The grpc-gateway generated .gw.pb.go files expect a
|
||||
// GetMetadata() method to be generated because it assumes the .proto files were generated from
|
||||
// protoc --go_out=plugins=grpc. Instead, kubernetes uses go-to-protobuf to generate .proto files
|
||||
// from go types, and this method is not auto-generated (presumably since ObjectMeta is embedded but
|
||||
// is nested in the 'metadata' field in JSON form).
|
||||
type objectMeta struct {
|
||||
Name *string
|
||||
}
|
||||
|
||||
func (a *Application) GetMetadata() *objectMeta {
|
||||
namePtr := &a.Name
|
||||
return &objectMeta{
|
||||
Name: namePtr,
|
||||
}
|
||||
}
|
||||
func (c *Cluster) GetMetadata() *objectMeta {
|
||||
namePtr := &c.Name
|
||||
return &objectMeta{
|
||||
Name: namePtr,
|
||||
}
|
||||
}
|
||||
|
||||
// ClusterList is a collection of Clusters.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type ClusterList struct {
|
||||
|
||||
@@ -13,16 +13,16 @@ It is generated from these files:
|
||||
|
||||
It has these top-level messages:
|
||||
ClusterQuery
|
||||
ClusterResponse
|
||||
*/
|
||||
package cluster
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "github.com/gogo/protobuf/gogoproto"
|
||||
import _ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
import google_protobuf1 "github.com/golang/protobuf/ptypes/empty"
|
||||
import _ "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
import core "github.com/argoproj/argo-cd/server/core"
|
||||
import k8s_io_api_core_v1 "k8s.io/api/core/v1"
|
||||
import github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
|
||||
|
||||
import (
|
||||
@@ -41,8 +41,9 @@ var _ = math.Inf
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
// ClusterQuery is a query for cluster resources
|
||||
type ClusterQuery struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ClusterQuery) Reset() { *m = ClusterQuery{} }
|
||||
@@ -50,8 +51,24 @@ func (m *ClusterQuery) String() string { return proto.CompactTextStri
|
||||
func (*ClusterQuery) ProtoMessage() {}
|
||||
func (*ClusterQuery) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func (m *ClusterQuery) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ClusterResponse struct {
|
||||
}
|
||||
|
||||
func (m *ClusterResponse) Reset() { *m = ClusterResponse{} }
|
||||
func (m *ClusterResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ClusterResponse) ProtoMessage() {}
|
||||
func (*ClusterResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*ClusterQuery)(nil), "cluster.ClusterQuery")
|
||||
proto.RegisterType((*ClusterResponse)(nil), "cluster.ClusterResponse")
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@@ -70,9 +87,13 @@ type ClusterServiceClient interface {
|
||||
// Create creates a cluster
|
||||
Create(ctx context.Context, in *github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Cluster, opts ...grpc.CallOption) (*github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Cluster, error)
|
||||
// Get returns a cluster by name
|
||||
Get(ctx context.Context, in *core.NameMessage, opts ...grpc.CallOption) (*github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Cluster, error)
|
||||
// DeleteCluster updates a cluster
|
||||
Delete(ctx context.Context, in *core.NameMessage, opts ...grpc.CallOption) (*google_protobuf1.Empty, error)
|
||||
Get(ctx context.Context, in *ClusterQuery, opts ...grpc.CallOption) (*github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Cluster, error)
|
||||
// Update updates a cluster
|
||||
Update(ctx context.Context, in *github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Cluster, opts ...grpc.CallOption) (*github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Cluster, error)
|
||||
// Delete updates a cluster
|
||||
Delete(ctx context.Context, in *ClusterQuery, opts ...grpc.CallOption) (*ClusterResponse, error)
|
||||
// ListPods returns pods in a cluster
|
||||
ListPods(ctx context.Context, in *ClusterQuery, opts ...grpc.CallOption) (*k8s_io_api_core_v1.PodList, error)
|
||||
}
|
||||
|
||||
type clusterServiceClient struct {
|
||||
@@ -101,7 +122,7 @@ func (c *clusterServiceClient) Create(ctx context.Context, in *github_com_argopr
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *clusterServiceClient) Get(ctx context.Context, in *core.NameMessage, opts ...grpc.CallOption) (*github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Cluster, error) {
|
||||
func (c *clusterServiceClient) Get(ctx context.Context, in *ClusterQuery, opts ...grpc.CallOption) (*github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Cluster, error) {
|
||||
out := new(github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Cluster)
|
||||
err := grpc.Invoke(ctx, "/cluster.ClusterService/Get", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
@@ -110,8 +131,17 @@ func (c *clusterServiceClient) Get(ctx context.Context, in *core.NameMessage, op
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *clusterServiceClient) Delete(ctx context.Context, in *core.NameMessage, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) {
|
||||
out := new(google_protobuf1.Empty)
|
||||
func (c *clusterServiceClient) Update(ctx context.Context, in *github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Cluster, opts ...grpc.CallOption) (*github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Cluster, error) {
|
||||
out := new(github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Cluster)
|
||||
err := grpc.Invoke(ctx, "/cluster.ClusterService/Update", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *clusterServiceClient) Delete(ctx context.Context, in *ClusterQuery, opts ...grpc.CallOption) (*ClusterResponse, error) {
|
||||
out := new(ClusterResponse)
|
||||
err := grpc.Invoke(ctx, "/cluster.ClusterService/Delete", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -119,6 +149,15 @@ func (c *clusterServiceClient) Delete(ctx context.Context, in *core.NameMessage,
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *clusterServiceClient) ListPods(ctx context.Context, in *ClusterQuery, opts ...grpc.CallOption) (*k8s_io_api_core_v1.PodList, error) {
|
||||
out := new(k8s_io_api_core_v1.PodList)
|
||||
err := grpc.Invoke(ctx, "/cluster.ClusterService/ListPods", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for ClusterService service
|
||||
|
||||
type ClusterServiceServer interface {
|
||||
@@ -127,9 +166,13 @@ type ClusterServiceServer interface {
|
||||
// Create creates a cluster
|
||||
Create(context.Context, *github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Cluster) (*github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Cluster, error)
|
||||
// Get returns a cluster by name
|
||||
Get(context.Context, *core.NameMessage) (*github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Cluster, error)
|
||||
// DeleteCluster updates a cluster
|
||||
Delete(context.Context, *core.NameMessage) (*google_protobuf1.Empty, error)
|
||||
Get(context.Context, *ClusterQuery) (*github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Cluster, error)
|
||||
// Update updates a cluster
|
||||
Update(context.Context, *github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Cluster) (*github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Cluster, error)
|
||||
// Delete updates a cluster
|
||||
Delete(context.Context, *ClusterQuery) (*ClusterResponse, error)
|
||||
// ListPods returns pods in a cluster
|
||||
ListPods(context.Context, *ClusterQuery) (*k8s_io_api_core_v1.PodList, error)
|
||||
}
|
||||
|
||||
func RegisterClusterServiceServer(s *grpc.Server, srv ClusterServiceServer) {
|
||||
@@ -173,7 +216,7 @@ func _ClusterService_Create_Handler(srv interface{}, ctx context.Context, dec fu
|
||||
}
|
||||
|
||||
func _ClusterService_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(core.NameMessage)
|
||||
in := new(ClusterQuery)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -185,13 +228,31 @@ func _ClusterService_Get_Handler(srv interface{}, ctx context.Context, dec func(
|
||||
FullMethod: "/cluster.ClusterService/Get",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ClusterServiceServer).Get(ctx, req.(*core.NameMessage))
|
||||
return srv.(ClusterServiceServer).Get(ctx, req.(*ClusterQuery))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ClusterService_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Cluster)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ClusterServiceServer).Update(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cluster.ClusterService/Update",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ClusterServiceServer).Update(ctx, req.(*github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Cluster))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ClusterService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(core.NameMessage)
|
||||
in := new(ClusterQuery)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -203,7 +264,25 @@ func _ClusterService_Delete_Handler(srv interface{}, ctx context.Context, dec fu
|
||||
FullMethod: "/cluster.ClusterService/Delete",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ClusterServiceServer).Delete(ctx, req.(*core.NameMessage))
|
||||
return srv.(ClusterServiceServer).Delete(ctx, req.(*ClusterQuery))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ClusterService_ListPods_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ClusterQuery)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ClusterServiceServer).ListPods(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cluster.ClusterService/ListPods",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ClusterServiceServer).ListPods(ctx, req.(*ClusterQuery))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@@ -224,10 +303,18 @@ var _ClusterService_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "Get",
|
||||
Handler: _ClusterService_Get_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Update",
|
||||
Handler: _ClusterService_Update_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Delete",
|
||||
Handler: _ClusterService_Delete_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListPods",
|
||||
Handler: _ClusterService_ListPods_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "server/cluster/cluster.proto",
|
||||
@@ -236,29 +323,33 @@ var _ClusterService_serviceDesc = grpc.ServiceDesc{
|
||||
func init() { proto.RegisterFile("server/cluster/cluster.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 373 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0xdd, 0x4a, 0xf3, 0x30,
|
||||
0x1c, 0xc6, 0x79, 0x5f, 0xc7, 0x84, 0x22, 0x43, 0x03, 0x7e, 0xd5, 0x81, 0xb0, 0xc3, 0xa1, 0x09,
|
||||
0x1b, 0x1e, 0x78, 0xbc, 0xf9, 0x81, 0xa0, 0x82, 0xe8, 0x91, 0x27, 0x92, 0x65, 0x7f, 0xb3, 0xb8,
|
||||
0xb6, 0x09, 0x49, 0x5a, 0x18, 0x32, 0x04, 0x6f, 0x61, 0x77, 0xe1, 0xed, 0x78, 0x0b, 0x5e, 0x88,
|
||||
0x34, 0x6d, 0xdc, 0x70, 0x2a, 0x82, 0x3b, 0x69, 0xf3, 0xd1, 0xe7, 0x79, 0x7e, 0x4d, 0x9e, 0xa0,
|
||||
0x6e, 0x40, 0x67, 0xa0, 0x09, 0x8b, 0x52, 0x63, 0xa7, 0x6f, 0xac, 0xb4, 0xb4, 0x12, 0x2d, 0x97,
|
||||
0xd3, 0xb0, 0xce, 0xa5, 0xe4, 0x11, 0x10, 0xaa, 0x04, 0xa1, 0x49, 0x22, 0x2d, 0xb5, 0x42, 0x26,
|
||||
0xa6, 0xf8, 0x2c, 0xdc, 0x29, 0x77, 0xdd, 0xac, 0x97, 0xde, 0x13, 0x88, 0x95, 0x1d, 0x95, 0x9b,
|
||||
0x07, 0xc3, 0x43, 0x83, 0x85, 0xcc, 0xa5, 0x31, 0x65, 0x03, 0x91, 0x80, 0x1e, 0x11, 0x35, 0xe4,
|
||||
0xf9, 0x82, 0x21, 0x31, 0x58, 0x4a, 0xb2, 0x16, 0xe1, 0x90, 0x80, 0xa6, 0x16, 0xfa, 0xa5, 0xaa,
|
||||
0xcd, 0x85, 0x1d, 0xa4, 0x3d, 0xcc, 0x64, 0x4c, 0xa8, 0xe6, 0x52, 0x69, 0xf9, 0xe0, 0x06, 0xfb,
|
||||
0xac, 0x4f, 0x3c, 0xb3, 0xd4, 0xe0, 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df, 0xd4, 0xb4, 0x50, 0xbd, 0x07, 0x00, 0x00, 0xff, 0xff, 0x53, 0xdd, 0x33,
|
||||
0x04, 0x6b, 0x03, 0x00, 0x00,
|
||||
// 444 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0xcf, 0xaa, 0xd3, 0x40,
|
||||
0x14, 0xc6, 0x89, 0x96, 0xa8, 0x83, 0xf8, 0x67, 0xb0, 0x58, 0xd3, 0xa2, 0x25, 0x28, 0x48, 0xd5,
|
||||
0x19, 0xa2, 0x1b, 0x71, 0xd9, 0x8a, 0x22, 0xb8, 0xa8, 0x15, 0x37, 0xdd, 0xc8, 0x34, 0x73, 0x98,
|
||||
0xc6, 0xa6, 0x99, 0x61, 0x66, 0x1a, 0x10, 0x11, 0xd1, 0x57, 0xf0, 0x39, 0x7c, 0x04, 0xd7, 0xf7,
|
||||
0x01, 0xee, 0x2b, 0xdc, 0x07, 0xb9, 0xcc, 0x34, 0xa1, 0xbd, 0x2d, 0xb9, 0x9b, 0xdb, 0xc5, 0x5d,
|
||||
0xe5, 0x64, 0x66, 0xf2, 0x7d, 0xbf, 0x7c, 0x39, 0x27, 0xa8, 0x67, 0x40, 0x97, 0xa0, 0x69, 0x9a,
|
||||
0xaf, 0x8c, 0xdd, 0x5c, 0x89, 0xd2, 0xd2, 0x4a, 0x7c, 0xad, 0xba, 0x8d, 0xee, 0x09, 0x29, 0xa4,
|
||||
0x5f, 0xa3, 0xae, 0x5a, 0x6f, 0x47, 0x3d, 0x21, 0xa5, 0xc8, 0x81, 0x32, 0x95, 0x51, 0x56, 0x14,
|
||||
0xd2, 0x32, 0x9b, 0xc9, 0xc2, 0x54, 0xbb, 0xf1, 0xe2, 0xb5, 0x21, 0x99, 0xf4, 0xbb, 0xa9, 0xd4,
|
||||
0x40, 0xcb, 0x84, 0x0a, 0x28, 0x40, 0x33, 0x0b, 0xbc, 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7c, 0x7f, 0xd7, 0x9f, 0xfe, 0x70, 0x5f, 0xf6, 0x27,
|
||||
0xfe, 0x1f, 0xa0, 0xf0, 0x8b, 0xe2, 0x97, 0x29, 0xb3, 0x67, 0x9e, 0xf9, 0x49, 0xd4, 0xdf, 0x67,
|
||||
0x5e, 0x82, 0x65, 0x9c, 0x59, 0x46, 0x3c, 0xbc, 0xcb, 0x70, 0x8a, 0xc2, 0xb7, 0x90, 0x83, 0x85,
|
||||
0xa6, 0x14, 0x3b, 0xbb, 0xcb, 0x75, 0x0b, 0xd7, 0xd9, 0x0c, 0x1a, 0xb3, 0xe1, 0xe8, 0xba, 0xeb,
|
||||
0xb8, 0xb1, 0xe4, 0xa6, 0x49, 0xbd, 0x4b, 0xd6, 0xd3, 0xea, 0x5e, 0x8b, 0xb8, 0x69, 0x25, 0x65,
|
||||
0x42, 0xc6, 0x92, 0xfb, 0x4e, 0x7d, 0xec, 0x0d, 0x1e, 0xe2, 0x5e, 0x83, 0x01, 0x55, 0x92, 0x9b,
|
||||
0xe1, 0xf3, 0xe9, 0xe0, 0xbc, 0x69, 0x3e, 0xfb, 0xa3, 0x99, 0x85, 0x7e, 0x6a, 0x5f, 0x9d, 0x06,
|
||||
0x00, 0x00, 0xff, 0xff, 0x8f, 0xcc, 0xe9, 0x6e, 0x81, 0x04, 0x00, 0x00,
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
|
||||
"github.com/argoproj/argo-cd/server/core"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
||||
@@ -30,24 +29,28 @@ var _ status.Status
|
||||
var _ = runtime.String
|
||||
var _ = utilities.NewDoubleArray
|
||||
|
||||
var (
|
||||
filter_ClusterService_List_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_ClusterService_List_0(ctx context.Context, marshaler runtime.Marshaler, client ClusterServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ClusterQuery
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ClusterService_List_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.List(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_ClusterService_Create_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_ClusterService_Create_0(ctx context.Context, marshaler runtime.Marshaler, client ClusterServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq v1alpha1.Cluster
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ClusterService_Create_0); err != nil {
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
@@ -57,7 +60,7 @@ func request_ClusterService_Create_0(ctx context.Context, marshaler runtime.Mars
|
||||
}
|
||||
|
||||
func request_ClusterService_Get_0(ctx context.Context, marshaler runtime.Marshaler, client ClusterServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq core.NameMessage
|
||||
var protoReq ClusterQuery
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
@@ -83,8 +86,39 @@ func request_ClusterService_Get_0(ctx context.Context, marshaler runtime.Marshal
|
||||
|
||||
}
|
||||
|
||||
func request_ClusterService_Update_0(ctx context.Context, marshaler runtime.Marshaler, client ClusterServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq v1alpha1.Cluster
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["metadata.name"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "metadata.name")
|
||||
}
|
||||
|
||||
protoReq.GetMetadata().Name, err = runtime.StringP(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "metadata.name", err)
|
||||
}
|
||||
|
||||
msg, err := client.Update(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_ClusterService_Delete_0(ctx context.Context, marshaler runtime.Marshaler, client ClusterServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq core.NameMessage
|
||||
var protoReq ClusterQuery
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
@@ -110,6 +144,33 @@ func request_ClusterService_Delete_0(ctx context.Context, marshaler runtime.Mars
|
||||
|
||||
}
|
||||
|
||||
func request_ClusterService_ListPods_0(ctx context.Context, marshaler runtime.Marshaler, client ClusterServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ClusterQuery
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["name"]
|
||||
if !ok {
|
||||
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)
|
||||
}
|
||||
|
||||
msg, err := client.ListPods(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
// RegisterClusterServiceHandlerFromEndpoint is same as RegisterClusterServiceHandler but
|
||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||
func RegisterClusterServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||
@@ -235,6 +296,35 @@ func RegisterClusterServiceHandlerClient(ctx context.Context, mux *runtime.Serve
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("PUT", pattern_ClusterService_Update_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
if cn, ok := w.(http.CloseNotifier); ok {
|
||||
go func(done <-chan struct{}, closed <-chan bool) {
|
||||
select {
|
||||
case <-done:
|
||||
case <-closed:
|
||||
cancel()
|
||||
}
|
||||
}(ctx.Done(), cn.CloseNotify())
|
||||
}
|
||||
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_ClusterService_Update_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_ClusterService_Update_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("DELETE", pattern_ClusterService_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@@ -264,6 +354,35 @@ func RegisterClusterServiceHandlerClient(ctx context.Context, mux *runtime.Serve
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_ClusterService_ListPods_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
if cn, ok := w.(http.CloseNotifier); ok {
|
||||
go func(done <-chan struct{}, closed <-chan bool) {
|
||||
select {
|
||||
case <-done:
|
||||
case <-closed:
|
||||
cancel()
|
||||
}
|
||||
}(ctx.Done(), cn.CloseNotify())
|
||||
}
|
||||
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_ClusterService_ListPods_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_ClusterService_ListPods_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -274,7 +393,11 @@ var (
|
||||
|
||||
pattern_ClusterService_Get_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_Update_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v1", "clusters", "metadata.name"}, ""))
|
||||
|
||||
pattern_ClusterService_Delete_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_ListPods_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"api", "v1", "clusters", "name", "pods"}, ""))
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -284,5 +407,9 @@ var (
|
||||
|
||||
forward_ClusterService_Get_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_ClusterService_Update_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_ClusterService_Delete_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_ClusterService_ListPods_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
syntax = "proto2";
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/argoproj/argo-cd/server/cluster";
|
||||
|
||||
// Cluster Service
|
||||
@@ -6,16 +6,22 @@ option go_package = "github.com/argoproj/argo-cd/server/cluster";
|
||||
// Cluster Service API performs CRUD actions against cluster resources
|
||||
package cluster;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
|
||||
import "github.com/argoproj/argo-cd/server/core/core.proto";
|
||||
import "k8s.io/api/core/v1/generated.proto";
|
||||
import "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1/generated.proto";
|
||||
|
||||
message ClusterQuery {}
|
||||
|
||||
// ClusterQuery is a query for cluster resources
|
||||
message ClusterQuery {
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message ClusterResponse {}
|
||||
|
||||
// ClusterService
|
||||
service ClusterService {
|
||||
|
||||
// List returns list of clusters
|
||||
rpc List(ClusterQuery) returns (github.com.argoproj.argo_cd.pkg.apis.application.v1alpha1.ClusterList) {
|
||||
option (google.api.http).get = "/api/v1/clusters";
|
||||
@@ -23,21 +29,33 @@ service ClusterService {
|
||||
|
||||
// Create creates a cluster
|
||||
rpc Create(github.com.argoproj.argo_cd.pkg.apis.application.v1alpha1.Cluster) returns (github.com.argoproj.argo_cd.pkg.apis.application.v1alpha1.Cluster) {
|
||||
option (google.api.http).post = "/api/v1/clusters";
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/clusters"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Get returns a cluster by name
|
||||
rpc Get(core.NameMessage) returns (github.com.argoproj.argo_cd.pkg.apis.application.v1alpha1.Cluster) {
|
||||
rpc Get(ClusterQuery) returns (github.com.argoproj.argo_cd.pkg.apis.application.v1alpha1.Cluster) {
|
||||
option (google.api.http).get = "/api/v1/clusters/{name}";
|
||||
}
|
||||
|
||||
// // UpdateCluster updates a cluster
|
||||
// rpc UpdateCluster(github.com.argoproj.argo_cd.pkg.apis.application.v1alpha1.Cluster) returns (github.com.argoproj.argo_cd.pkg.apis.application.v1alpha1.Cluster) {
|
||||
// option (google.api.http).put = "/api/v1/clusters/{metadata.name}";
|
||||
// }
|
||||
// Update updates a cluster
|
||||
rpc Update(github.com.argoproj.argo_cd.pkg.apis.application.v1alpha1.Cluster) returns (github.com.argoproj.argo_cd.pkg.apis.application.v1alpha1.Cluster) {
|
||||
option (google.api.http) = {
|
||||
put: "/api/v1/clusters/{metadata.name}"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// DeleteCluster updates a cluster
|
||||
rpc Delete(core.NameMessage) returns (google.protobuf.Empty) {
|
||||
// Delete updates a cluster
|
||||
rpc Delete(ClusterQuery) returns (ClusterResponse) {
|
||||
option (google.api.http).delete = "/api/v1/clusters/{name}";
|
||||
}
|
||||
|
||||
// ListPods returns pods in a cluster
|
||||
rpc ListPods(ClusterQuery) returns (k8s.io.api.core.v1.PodList) {
|
||||
option (google.api.http).get = "/api/v1/clusters/{name}/pods";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,26 +3,34 @@ package cluster
|
||||
import (
|
||||
clusterv1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
|
||||
appclientset "github.com/argoproj/argo-cd/pkg/client/clientset/versioned"
|
||||
"github.com/argoproj/argo-cd/server/core"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"golang.org/x/net/context"
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
)
|
||||
|
||||
// Server provides a Cluster service
|
||||
type Server struct {
|
||||
ns string
|
||||
appclientset appclientset.Interface
|
||||
ns string
|
||||
kubeclientset kubernetes.Interface
|
||||
appclientset appclientset.Interface
|
||||
}
|
||||
|
||||
// NewServer returns a new instance of the Cluster service
|
||||
func NewServer(appclientset appclientset.Interface) *Server {
|
||||
func NewServer(kubeclientset kubernetes.Interface, appclientset appclientset.Interface) *Server {
|
||||
return &Server{
|
||||
ns: "default",
|
||||
appclientset: appclientset,
|
||||
ns: "default",
|
||||
appclientset: appclientset,
|
||||
kubeclientset: kubeclientset,
|
||||
}
|
||||
}
|
||||
|
||||
// ListPods returns application related pods in a cluster
|
||||
func (s *Server) ListPods(ctx context.Context, in *ClusterQuery) (*apiv1.PodList, error) {
|
||||
// TODO: filter by the app label
|
||||
return s.kubeclientset.CoreV1().Pods(s.ns).List(metav1.ListOptions{})
|
||||
}
|
||||
|
||||
// List returns list of clusters
|
||||
func (s *Server) List(ctx context.Context, in *ClusterQuery) (*clusterv1.ClusterList, error) {
|
||||
return s.appclientset.ArgoprojV1alpha1().Clusters(s.ns).List(metav1.ListOptions{})
|
||||
@@ -33,13 +41,24 @@ func (s *Server) Create(ctx context.Context, c *clusterv1.Cluster) (*clusterv1.C
|
||||
return s.appclientset.ArgoprojV1alpha1().Clusters(s.ns).Create(c)
|
||||
}
|
||||
|
||||
// Get returns list of clusters
|
||||
func (s *Server) Get(ctx context.Context, name *core.NameMessage) (*clusterv1.Cluster, error) {
|
||||
return s.appclientset.ArgoprojV1alpha1().Clusters(s.ns).Get(name.Name, metav1.GetOptions{})
|
||||
// Get returns a cluster from a query
|
||||
func (s *Server) Get(ctx context.Context, q *ClusterQuery) (*clusterv1.Cluster, error) {
|
||||
return s.appclientset.ArgoprojV1alpha1().Clusters(s.ns).Get(q.Name, metav1.GetOptions{})
|
||||
}
|
||||
|
||||
// Delete deletes a cluster by name
|
||||
func (s *Server) Delete(ctx context.Context, name *core.NameMessage) (*empty.Empty, error) {
|
||||
err := s.appclientset.ArgoprojV1alpha1().Clusters(s.ns).Delete(name.Name, &metav1.DeleteOptions{})
|
||||
return &empty.Empty{}, err
|
||||
// Update updates a cluster
|
||||
func (s *Server) Update(ctx context.Context, c *clusterv1.Cluster) (*clusterv1.Cluster, error) {
|
||||
return s.appclientset.ArgoprojV1alpha1().Clusters(s.ns).Update(c)
|
||||
}
|
||||
|
||||
// //Update updates a cluster
|
||||
// func (s *Server) Update(ctx context.Context, req *ClusterUpdateRequest) (*clusterv1.Cluster, error) {
|
||||
// log.Info(req)
|
||||
// return s.appclientset.ArgoprojV1alpha1().Clusters(s.ns).Update(req.Cluster)
|
||||
// }
|
||||
|
||||
// Delete deletes a cluster by name
|
||||
func (s *Server) Delete(ctx context.Context, q *ClusterQuery) (*ClusterResponse, error) {
|
||||
err := s.appclientset.ArgoprojV1alpha1().Clusters(s.ns).Delete(q.Name, &metav1.DeleteOptions{})
|
||||
return &ClusterResponse{}, err
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
package core
|
||||
@@ -1,65 +0,0 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: server/core/core.proto
|
||||
|
||||
/*
|
||||
Package core is a generated protocol buffer package.
|
||||
|
||||
Core types
|
||||
|
||||
It is generated from these files:
|
||||
server/core/core.proto
|
||||
|
||||
It has these top-level messages:
|
||||
NameMessage
|
||||
*/
|
||||
package core
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import 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.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"`
|
||||
}
|
||||
|
||||
func (m *NameMessage) Reset() { *m = NameMessage{} }
|
||||
func (m *NameMessage) String() string { return proto.CompactTextString(m) }
|
||||
func (*NameMessage) ProtoMessage() {}
|
||||
func (*NameMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func (m *NameMessage) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*NameMessage)(nil), "core.NameMessage")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("server/core/core.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 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, 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,
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/argoproj/argo-cd/server/core";
|
||||
|
||||
// Core types
|
||||
package core;
|
||||
|
||||
// NameMessage is a name of a resource
|
||||
message NameMessage {
|
||||
string name = 1;
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
appclientset "github.com/argoproj/argo-cd/pkg/client/clientset/versioned"
|
||||
"github.com/argoproj/argo-cd/server/cluster"
|
||||
"github.com/argoproj/argo-cd/server/version"
|
||||
"github.com/cockroachdb/cockroach/pkg/util/protoutil"
|
||||
jsonutil "github.com/argoproj/argo-cd/util/json"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/soheilhy/cmux"
|
||||
@@ -62,14 +62,16 @@ func (a *ArgoCDServer) Run() {
|
||||
// gRPC Server
|
||||
grpcS := grpc.NewServer()
|
||||
version.RegisterVersionServiceServer(grpcS, &version.Server{})
|
||||
cluster.RegisterClusterServiceServer(grpcS, cluster.NewServer(a.appclientset))
|
||||
cluster.RegisterClusterServiceServer(grpcS, cluster.NewServer(a.kubeclientset, a.appclientset))
|
||||
|
||||
// HTTP 1.1+JSON Server
|
||||
// grpc-ecosystem/grpc-gateway is used to proxy HTTP requests to the corresponding gRPC call
|
||||
mux := http.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))
|
||||
// NOTE: if a marshaller option is not supplied, grpc-gateway will default to the jsonpb from
|
||||
// golang/protobuf. Which does not support types such as time.Time. gogo/protobuf does support
|
||||
// time.Time, but does not support custom UnmarshalJSON() and MarshalJSON() methods. Therefore
|
||||
// we use our own Marshaler
|
||||
gwMuxOpts := runtime.WithMarshalerOption(runtime.MIMEWildcard, new(jsonutil.JSONMarshaler))
|
||||
gwmux := runtime.NewServeMux(gwMuxOpts)
|
||||
mux.Handle("/", gwmux)
|
||||
dOpts := []grpc.DialOption{grpc.WithInsecure()}
|
||||
@@ -80,12 +82,10 @@ func (a *ArgoCDServer) Run() {
|
||||
Handler: mux,
|
||||
}
|
||||
|
||||
// Start the muxed listeners for our servers
|
||||
log.Infof("argocd %s serving on port %d", argocd.GetVersion(), port)
|
||||
|
||||
// Use the muxed listeners for your servers.
|
||||
go grpcS.Serve(grpcL)
|
||||
go httpS.Serve(httpL)
|
||||
|
||||
err = m.Serve()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
38
util/json/json.go
Normal file
38
util/json/json.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package json
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
|
||||
gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
)
|
||||
|
||||
// JSONMarshaler is a type which satisfies the grpc-gateway Marshaler interface
|
||||
type JSONMarshaler struct {
|
||||
json.Decoder
|
||||
}
|
||||
|
||||
// ContentType implements gwruntime.Marshaler.
|
||||
func (j *JSONMarshaler) ContentType() string {
|
||||
return "application/json"
|
||||
}
|
||||
|
||||
// Marshal implements gwruntime.Marshaler.
|
||||
func (j *JSONMarshaler) Marshal(v interface{}) ([]byte, error) {
|
||||
return json.Marshal(v)
|
||||
}
|
||||
|
||||
// NewDecoder implements gwruntime.Marshaler.
|
||||
func (j *JSONMarshaler) NewDecoder(r io.Reader) gwruntime.Decoder {
|
||||
return json.NewDecoder(r)
|
||||
}
|
||||
|
||||
// NewEncoder implements gwruntime.Marshaler.
|
||||
func (j *JSONMarshaler) NewEncoder(w io.Writer) gwruntime.Encoder {
|
||||
return json.NewEncoder(w)
|
||||
}
|
||||
|
||||
// Unmarshal implements gwruntime.Marshaler.
|
||||
func (j *JSONMarshaler) Unmarshal(data []byte, v interface{}) error {
|
||||
return json.Unmarshal(data, v)
|
||||
}
|
||||
Reference in New Issue
Block a user