diff --git a/credentials/tls/certprovider/meshca/internal/meshca_experimental/config.pb.go b/credentials/tls/certprovider/meshca/internal/meshca_experimental/config.pb.go new file mode 100644 index 00000000000..936dfb6ed4b --- /dev/null +++ b/credentials/tls/certprovider/meshca/internal/meshca_experimental/config.pb.go @@ -0,0 +1,198 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: grpc/tls/provider/meshca/experimental/config.proto + +// NOTE: This proto will very likely move to a different namespace and a +// different git repo in the future. + +package meshca_experimental + +import ( + fmt "fmt" + v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" + proto "github.com/golang/protobuf/proto" + duration "github.com/golang/protobuf/ptypes/duration" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// Type of key to be embedded in CSRs sent to the MeshCA. +type GoogleMeshCaConfig_KeyType int32 + +const ( + GoogleMeshCaConfig_KEY_TYPE_UNKNOWN GoogleMeshCaConfig_KeyType = 0 + GoogleMeshCaConfig_KEY_TYPE_RSA GoogleMeshCaConfig_KeyType = 1 +) + +var GoogleMeshCaConfig_KeyType_name = map[int32]string{ + 0: "KEY_TYPE_UNKNOWN", + 1: "KEY_TYPE_RSA", +} + +var GoogleMeshCaConfig_KeyType_value = map[string]int32{ + "KEY_TYPE_UNKNOWN": 0, + "KEY_TYPE_RSA": 1, +} + +func (x GoogleMeshCaConfig_KeyType) String() string { + return proto.EnumName(GoogleMeshCaConfig_KeyType_name, int32(x)) +} + +func (GoogleMeshCaConfig_KeyType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_2f29f6dba7c86653, []int{0, 0} +} + +// GoogleMeshCaConfig contains all configuration parameters required by the +// MeshCA CertificateProvider plugin implementation. +type GoogleMeshCaConfig struct { + // GoogleMeshCA server endpoint to get CSRs signed via the *CreateCertificate* + // unary call. This must have :ref:`api_type + // ` :ref:`GRPC + // `. + // STS based call credentials need to be supplied in :ref:`call_credentials + // `. + // + // If :ref:`timeout envoy_api_field_config.core.v3.GrpcService.timeout` is + // left unspecified, a default value of 10s will be used. + Server *v3.ApiConfigSource `protobuf:"bytes,1,opt,name=server,proto3" json:"server,omitempty"` + // Certificate lifetime to request in CSRs sent to the MeshCA. + // + // A default value of 24h will be used if left unspecified. + CertificateLifetime *duration.Duration `protobuf:"bytes,2,opt,name=certificate_lifetime,json=certificateLifetime,proto3" json:"certificate_lifetime,omitempty"` + // How long before certificate expiration should the certificate be renewed. + // + // A default value of 12h will be used if left unspecified. + RenewalGracePeriod *duration.Duration `protobuf:"bytes,3,opt,name=renewal_grace_period,json=renewalGracePeriod,proto3" json:"renewal_grace_period,omitempty"` + // Type of key. + // + // RSA keys will be used if left unspecified. + KeyType GoogleMeshCaConfig_KeyType `protobuf:"varint,4,opt,name=key_type,json=keyType,proto3,enum=grpc.tls.provider.meshca.experimental.GoogleMeshCaConfig_KeyType" json:"key_type,omitempty"` + // Size of the key in bits. + // + // 2048 bit keys will be used if left unspecified. + KeySize uint32 `protobuf:"varint,5,opt,name=key_size,json=keySize,proto3" json:"key_size,omitempty"` + // GCE location (region/zone) where the workload is located. + // + // GCE/GKE Metadata Server will be contacted if left unspecified. + Location string `protobuf:"bytes,6,opt,name=location,proto3" json:"location,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GoogleMeshCaConfig) Reset() { *m = GoogleMeshCaConfig{} } +func (m *GoogleMeshCaConfig) String() string { return proto.CompactTextString(m) } +func (*GoogleMeshCaConfig) ProtoMessage() {} +func (*GoogleMeshCaConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_2f29f6dba7c86653, []int{0} +} + +func (m *GoogleMeshCaConfig) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GoogleMeshCaConfig.Unmarshal(m, b) +} +func (m *GoogleMeshCaConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GoogleMeshCaConfig.Marshal(b, m, deterministic) +} +func (m *GoogleMeshCaConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_GoogleMeshCaConfig.Merge(m, src) +} +func (m *GoogleMeshCaConfig) XXX_Size() int { + return xxx_messageInfo_GoogleMeshCaConfig.Size(m) +} +func (m *GoogleMeshCaConfig) XXX_DiscardUnknown() { + xxx_messageInfo_GoogleMeshCaConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_GoogleMeshCaConfig proto.InternalMessageInfo + +func (m *GoogleMeshCaConfig) GetServer() *v3.ApiConfigSource { + if m != nil { + return m.Server + } + return nil +} + +func (m *GoogleMeshCaConfig) GetCertificateLifetime() *duration.Duration { + if m != nil { + return m.CertificateLifetime + } + return nil +} + +func (m *GoogleMeshCaConfig) GetRenewalGracePeriod() *duration.Duration { + if m != nil { + return m.RenewalGracePeriod + } + return nil +} + +func (m *GoogleMeshCaConfig) GetKeyType() GoogleMeshCaConfig_KeyType { + if m != nil { + return m.KeyType + } + return GoogleMeshCaConfig_KEY_TYPE_UNKNOWN +} + +func (m *GoogleMeshCaConfig) GetKeySize() uint32 { + if m != nil { + return m.KeySize + } + return 0 +} + +func (m *GoogleMeshCaConfig) GetLocation() string { + if m != nil { + return m.Location + } + return "" +} + +func init() { + proto.RegisterEnum("grpc.tls.provider.meshca.experimental.GoogleMeshCaConfig_KeyType", GoogleMeshCaConfig_KeyType_name, GoogleMeshCaConfig_KeyType_value) + proto.RegisterType((*GoogleMeshCaConfig)(nil), "grpc.tls.provider.meshca.experimental.GoogleMeshCaConfig") +} + +func init() { + proto.RegisterFile("grpc/tls/provider/meshca/experimental/config.proto", fileDescriptor_2f29f6dba7c86653) +} + +var fileDescriptor_2f29f6dba7c86653 = []byte{ + // 439 bytes of a gzipped FileDescriptorProto + 0x1f,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 0xed, 0x47, + 0x27, 0xbf, 0x22, 0x92, 0x28, 0xbb, 0x5b, 0xf4, 0x93, 0xb7, 0xdd, 0xd4, 0x8b, 0xa6, 0xa7, 0x45, + 0xf4, 0xed, 0x2a, 0xf4, 0x96, 0x5b, 0x2d, 0x4c, 0xce, 0x2c, 0xe6, 0xdc, 0x6f, 0xac, 0x44, 0x58, + 0x81, 0x71, 0x4a, 0xe8, 0xd2, 0x6f, 0x6f, 0xf3, 0x24, 0x7f, 0x6f, 0xb0, 0x32, 0x0e, 0xd0, 0x08, + 0x1d, 0xe6, 0xac, 0xeb, 0x76, 0xd3, 0xf3, 0x2f, 0x31, 0xf9, 0x13, 0x00, 0x00, 0xff, 0xff, 0x72, + 0x44, 0x68, 0xc5, 0x01, 0x03, 0x00, 0x00, +} diff --git a/regenerate.sh b/regenerate.sh index 987bc20251d..e743241d53c 100755 --- a/regenerate.sh +++ b/regenerate.sh @@ -39,6 +39,19 @@ mkdir -p ${WORKDIR}/googleapis/google/rpc echo "curl https://raw.githubusercontent.com/googleapis/googleapis/master/google/rpc/code.proto" curl --silent https://raw.githubusercontent.com/googleapis/googleapis/master/google/rpc/code.proto > ${WORKDIR}/googleapis/google/rpc/code.proto +# Pull in the following repos to build the MeshCA config proto. +ENVOY_API_REPOS=( + "https://github.com/envoyproxy/data-plane-api" + "https://github.com/cncf/udpa" + "https://github.com/envoyproxy/protoc-gen-validate" +) +for repo in ${ENVOY_API_REPOS[@]}; do + dirname=$(basename ${repo}) + mkdir -p ${WORKDIR}/${dirname} + echo "git clone ${repo}" + git clone --quiet ${repo} ${WORKDIR}/${dirname} +done + mkdir -p ${WORKDIR}/out SOURCES=( @@ -52,15 +65,23 @@ SOURCES=( ${WORKDIR}/grpc-proto/grpc/lb/v1/load_balancer.proto ${WORKDIR}/grpc-proto/grpc/lookup/v1/rls.proto ${WORKDIR}/grpc-proto/grpc/service_config/service_config.proto + ${WORKDIR}/grpc-proto/grpc/tls/provider/meshca/experimental/config.proto $(git ls-files --exclude-standard --cached --others "*.proto") ) -OPTS=Mgrpc/service_config/service_config.proto=/internal/proto/grpc_service_config +# These options of the form 'Mfoo.proto=bar' instruct the codegen to use an +# import path of 'bar' in the generated code when 'foo.proto' is imported in +# one of the sources. +OPTS=Mgrpc/service_config/service_config.proto=/internal/proto/grpc_service_config,\ +Menvoy/config/core/v3/config_source.proto=github.com/envoyproxy/go-control-plane/envoy/config/core/v3 for src in ${SOURCES[@]}; do echo "protoc ${src}" protoc --go_out=${OPTS}:${WORKDIR}/out --go-grpc_out=${OPTS},requireUnimplementedServers=false:${WORKDIR}/out \ -I"." \ -I${WORKDIR}/grpc-proto \ -I${WORKDIR}/googleapis \ + -I${WORKDIR}/data-plane-api \ + -I${WORKDIR}/udpa \ + -I${WORKDIR}/protoc-gen-validate \ ${src} done diff --git a/vet.sh b/vet.sh index 29e2e371e54..c52c1bdbf4c 100755 --- a/vet.sh +++ b/vet.sh @@ -90,7 +90,7 @@ git grep -l 'grpclog.I\|grpclog.W\|grpclog.E\|grpclog.F\|grpclog.V' -- "*.go" | not git grep "\(import \|^\s*\)\"github.com/golang/protobuf/ptypes/" -- "*.go" # - Ensure all xds proto imports are renamed to *pb or *grpc. -git grep '"github.com/envoyproxy/go-control-plane/envoy' -- '*.go' | not grep -v 'pb "\|grpc "' +git grep '"github.com/envoyproxy/go-control-plane/envoy' -- '*.go' ':(exclude)*.pb.go' | not grep -v 'pb "\|grpc "' # - gofmt, goimports, golint (with exceptions for generated code), go vet. gofmt -s -d -l . 2>&1 | fail_on_output