Sync partition fields from enterprise (#11021)

This commit is contained in:
Chris S. Kim 2021-09-13 17:53:52 -04:00 committed by GitHub
parent ba27e9bc67
commit 0a0319b209
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 127 additions and 166 deletions

View File

@ -30,6 +30,7 @@ const (
type ConfigEntry interface { type ConfigEntry interface {
GetKind() string GetKind() string
GetName() string GetName() string
GetPartition() string
GetNamespace() string GetNamespace() string
GetMeta() map[string]string GetMeta() map[string]string
GetCreateIndex() uint64 GetCreateIndex() uint64
@ -133,6 +134,10 @@ type UpstreamConfiguration struct {
type UpstreamConfig struct { type UpstreamConfig struct {
// Name is only accepted within a service-defaults config entry. // Name is only accepted within a service-defaults config entry.
Name string `json:",omitempty"` Name string `json:",omitempty"`
// Partition is only accepted within a service-defaults config entry.
Partition string `json:",omitempty"`
// Namespace is only accepted within a service-defaults config entry. // Namespace is only accepted within a service-defaults config entry.
Namespace string `json:",omitempty"` Namespace string `json:",omitempty"`
@ -205,6 +210,7 @@ type UpstreamLimits struct {
type ServiceConfigEntry struct { type ServiceConfigEntry struct {
Kind string Kind string
Name string Name string
Partition string `json:",omitempty"`
Namespace string `json:",omitempty"` Namespace string `json:",omitempty"`
Protocol string `json:",omitempty"` Protocol string `json:",omitempty"`
Mode ProxyMode `json:",omitempty"` Mode ProxyMode `json:",omitempty"`
@ -219,33 +225,18 @@ type ServiceConfigEntry struct {
ModifyIndex uint64 ModifyIndex uint64
} }
func (s *ServiceConfigEntry) GetKind() string { func (s *ServiceConfigEntry) GetKind() string { return s.Kind }
return s.Kind func (s *ServiceConfigEntry) GetName() string { return s.Name }
} func (s *ServiceConfigEntry) GetPartition() string { return s.Partition }
func (s *ServiceConfigEntry) GetNamespace() string { return s.Namespace }
func (s *ServiceConfigEntry) GetName() string { func (s *ServiceConfigEntry) GetMeta() map[string]string { return s.Meta }
return s.Name func (s *ServiceConfigEntry) GetCreateIndex() uint64 { return s.CreateIndex }
} func (s *ServiceConfigEntry) GetModifyIndex() uint64 { return s.ModifyIndex }
func (s *ServiceConfigEntry) GetNamespace() string {
return s.Namespace
}
func (s *ServiceConfigEntry) GetMeta() map[string]string {
return s.Meta
}
func (s *ServiceConfigEntry) GetCreateIndex() uint64 {
return s.CreateIndex
}
func (s *ServiceConfigEntry) GetModifyIndex() uint64 {
return s.ModifyIndex
}
type ProxyConfigEntry struct { type ProxyConfigEntry struct {
Kind string Kind string
Name string Name string
Partition string `json:",omitempty"`
Namespace string `json:",omitempty"` Namespace string `json:",omitempty"`
Mode ProxyMode `json:",omitempty"` Mode ProxyMode `json:",omitempty"`
TransparentProxy *TransparentProxyConfig `json:",omitempty" alias:"transparent_proxy"` TransparentProxy *TransparentProxyConfig `json:",omitempty" alias:"transparent_proxy"`
@ -257,29 +248,13 @@ type ProxyConfigEntry struct {
ModifyIndex uint64 ModifyIndex uint64
} }
func (p *ProxyConfigEntry) GetKind() string { func (p *ProxyConfigEntry) GetKind() string { return p.Kind }
return p.Kind func (p *ProxyConfigEntry) GetName() string { return p.Name }
} func (p *ProxyConfigEntry) GetPartition() string { return p.Partition }
func (p *ProxyConfigEntry) GetNamespace() string { return p.Namespace }
func (p *ProxyConfigEntry) GetName() string { func (p *ProxyConfigEntry) GetMeta() map[string]string { return p.Meta }
return p.Name func (p *ProxyConfigEntry) GetCreateIndex() uint64 { return p.CreateIndex }
} func (p *ProxyConfigEntry) GetModifyIndex() uint64 { return p.ModifyIndex }
func (p *ProxyConfigEntry) GetNamespace() string {
return p.Namespace
}
func (p *ProxyConfigEntry) GetMeta() map[string]string {
return p.Meta
}
func (p *ProxyConfigEntry) GetCreateIndex() uint64 {
return p.CreateIndex
}
func (p *ProxyConfigEntry) GetModifyIndex() uint64 {
return p.ModifyIndex
}
func makeConfigEntry(kind, name string) (ConfigEntry, error) { func makeConfigEntry(kind, name string) (ConfigEntry, error) {
switch kind { switch kind {

View File

@ -2,41 +2,44 @@ package api
import "encoding/json" import "encoding/json"
// MeshConfigEntry manages the global configuration for all service mesh
// proxies.
type MeshConfigEntry struct { type MeshConfigEntry struct {
Namespace string `json:",omitempty"` // Partition is the partition the MeshConfigEntry applies to.
// Partitioning is a Consul Enterprise feature.
Partition string `json:",omitempty"`
// Namespace is the namespace the MeshConfigEntry applies to.
// Namespacing is a Consul Enterprise feature.
Namespace string `json:",omitempty"`
// TransparentProxy applies configuration specific to proxies
// in transparent mode.
TransparentProxy TransparentProxyMeshConfig `alias:"transparent_proxy"` TransparentProxy TransparentProxyMeshConfig `alias:"transparent_proxy"`
Meta map[string]string `json:",omitempty"`
CreateIndex uint64 Meta map[string]string `json:",omitempty"`
ModifyIndex uint64
// CreateIndex is the Raft index this entry was created at. This is a
// read-only field.
CreateIndex uint64
// ModifyIndex is used for the Check-And-Set operations and can also be fed
// back into the WaitIndex of the QueryOptions in order to perform blocking
// queries.
ModifyIndex uint64
} }
type TransparentProxyMeshConfig struct { type TransparentProxyMeshConfig struct {
MeshDestinationsOnly bool `alias:"mesh_destinations_only"` MeshDestinationsOnly bool `alias:"mesh_destinations_only"`
} }
func (e *MeshConfigEntry) GetKind() string { func (e *MeshConfigEntry) GetKind() string { return MeshConfig }
return MeshConfig func (e *MeshConfigEntry) GetName() string { return MeshConfigMesh }
} func (e *MeshConfigEntry) GetPartition() string { return e.Partition }
func (e *MeshConfigEntry) GetNamespace() string { return e.Namespace }
func (e *MeshConfigEntry) GetName() string { func (e *MeshConfigEntry) GetMeta() map[string]string { return e.Meta }
return MeshConfigMesh func (e *MeshConfigEntry) GetCreateIndex() uint64 { return e.CreateIndex }
} func (e *MeshConfigEntry) GetModifyIndex() uint64 { return e.ModifyIndex }
func (e *MeshConfigEntry) GetNamespace() string {
return e.Namespace
}
func (e *MeshConfigEntry) GetMeta() map[string]string {
return e.Meta
}
func (e *MeshConfigEntry) GetCreateIndex() uint64 {
return e.CreateIndex
}
func (e *MeshConfigEntry) GetModifyIndex() uint64 {
return e.ModifyIndex
}
// MarshalJSON adds the Kind field so that the JSON can be decoded back into the // MarshalJSON adds the Kind field so that the JSON can be decoded back into the
// correct type. // correct type.

View File

@ -8,6 +8,7 @@ import (
type ServiceRouterConfigEntry struct { type ServiceRouterConfigEntry struct {
Kind string Kind string
Name string Name string
Partition string `json:",omitempty"`
Namespace string `json:",omitempty"` Namespace string `json:",omitempty"`
Routes []ServiceRoute `json:",omitempty"` Routes []ServiceRoute `json:",omitempty"`
@ -19,6 +20,7 @@ type ServiceRouterConfigEntry struct {
func (e *ServiceRouterConfigEntry) GetKind() string { return e.Kind } func (e *ServiceRouterConfigEntry) GetKind() string { return e.Kind }
func (e *ServiceRouterConfigEntry) GetName() string { return e.Name } func (e *ServiceRouterConfigEntry) GetName() string { return e.Name }
func (e *ServiceRouterConfigEntry) GetPartition() string { return e.Partition }
func (e *ServiceRouterConfigEntry) GetNamespace() string { return e.Namespace } func (e *ServiceRouterConfigEntry) GetNamespace() string { return e.Namespace }
func (e *ServiceRouterConfigEntry) GetMeta() map[string]string { return e.Meta } func (e *ServiceRouterConfigEntry) GetMeta() map[string]string { return e.Meta }
func (e *ServiceRouterConfigEntry) GetCreateIndex() uint64 { return e.CreateIndex } func (e *ServiceRouterConfigEntry) GetCreateIndex() uint64 { return e.CreateIndex }
@ -61,8 +63,9 @@ type ServiceRouteHTTPMatchQueryParam struct {
} }
type ServiceRouteDestination struct { type ServiceRouteDestination struct {
Service string `json:",omitempty"` Service string `json:",omitempty"`
ServiceSubset string `json:",omitempty" alias:"service_subset"` ServiceSubset string `json:",omitempty" alias:"service_subset"`
// Referencing other partitions is not supported.
Namespace string `json:",omitempty"` Namespace string `json:",omitempty"`
PrefixRewrite string `json:",omitempty" alias:"prefix_rewrite"` PrefixRewrite string `json:",omitempty" alias:"prefix_rewrite"`
RequestTimeout time.Duration `json:",omitempty" alias:"request_timeout"` RequestTimeout time.Duration `json:",omitempty" alias:"request_timeout"`
@ -112,6 +115,7 @@ func (e *ServiceRouteDestination) UnmarshalJSON(data []byte) error {
type ServiceSplitterConfigEntry struct { type ServiceSplitterConfigEntry struct {
Kind string Kind string
Name string Name string
Partition string `json:",omitempty"`
Namespace string `json:",omitempty"` Namespace string `json:",omitempty"`
Splits []ServiceSplit `json:",omitempty"` Splits []ServiceSplit `json:",omitempty"`
@ -123,15 +127,17 @@ type ServiceSplitterConfigEntry struct {
func (e *ServiceSplitterConfigEntry) GetKind() string { return e.Kind } func (e *ServiceSplitterConfigEntry) GetKind() string { return e.Kind }
func (e *ServiceSplitterConfigEntry) GetName() string { return e.Name } func (e *ServiceSplitterConfigEntry) GetName() string { return e.Name }
func (e *ServiceSplitterConfigEntry) GetPartition() string { return e.Partition }
func (e *ServiceSplitterConfigEntry) GetNamespace() string { return e.Namespace } func (e *ServiceSplitterConfigEntry) GetNamespace() string { return e.Namespace }
func (e *ServiceSplitterConfigEntry) GetMeta() map[string]string { return e.Meta } func (e *ServiceSplitterConfigEntry) GetMeta() map[string]string { return e.Meta }
func (e *ServiceSplitterConfigEntry) GetCreateIndex() uint64 { return e.CreateIndex } func (e *ServiceSplitterConfigEntry) GetCreateIndex() uint64 { return e.CreateIndex }
func (e *ServiceSplitterConfigEntry) GetModifyIndex() uint64 { return e.ModifyIndex } func (e *ServiceSplitterConfigEntry) GetModifyIndex() uint64 { return e.ModifyIndex }
type ServiceSplit struct { type ServiceSplit struct {
Weight float32 Weight float32
Service string `json:",omitempty"` Service string `json:",omitempty"`
ServiceSubset string `json:",omitempty" alias:"service_subset"` ServiceSubset string `json:",omitempty" alias:"service_subset"`
// Referencing other partitions is not supported.
Namespace string `json:",omitempty"` Namespace string `json:",omitempty"`
RequestHeaders *HTTPHeaderModifiers `json:",omitempty" alias:"request_headers"` RequestHeaders *HTTPHeaderModifiers `json:",omitempty" alias:"request_headers"`
ResponseHeaders *HTTPHeaderModifiers `json:",omitempty" alias:"response_headers"` ResponseHeaders *HTTPHeaderModifiers `json:",omitempty" alias:"response_headers"`
@ -140,6 +146,7 @@ type ServiceSplit struct {
type ServiceResolverConfigEntry struct { type ServiceResolverConfigEntry struct {
Kind string Kind string
Name string Name string
Partition string `json:",omitempty"`
Namespace string `json:",omitempty"` Namespace string `json:",omitempty"`
DefaultSubset string `json:",omitempty" alias:"default_subset"` DefaultSubset string `json:",omitempty" alias:"default_subset"`
@ -195,6 +202,7 @@ func (e *ServiceResolverConfigEntry) UnmarshalJSON(data []byte) error {
func (e *ServiceResolverConfigEntry) GetKind() string { return e.Kind } func (e *ServiceResolverConfigEntry) GetKind() string { return e.Kind }
func (e *ServiceResolverConfigEntry) GetName() string { return e.Name } func (e *ServiceResolverConfigEntry) GetName() string { return e.Name }
func (e *ServiceResolverConfigEntry) GetPartition() string { return e.Partition }
func (e *ServiceResolverConfigEntry) GetNamespace() string { return e.Namespace } func (e *ServiceResolverConfigEntry) GetNamespace() string { return e.Namespace }
func (e *ServiceResolverConfigEntry) GetMeta() map[string]string { return e.Meta } func (e *ServiceResolverConfigEntry) GetMeta() map[string]string { return e.Meta }
func (e *ServiceResolverConfigEntry) GetCreateIndex() uint64 { return e.CreateIndex } func (e *ServiceResolverConfigEntry) GetCreateIndex() uint64 { return e.CreateIndex }
@ -208,15 +216,17 @@ type ServiceResolverSubset struct {
type ServiceResolverRedirect struct { type ServiceResolverRedirect struct {
Service string `json:",omitempty"` Service string `json:",omitempty"`
ServiceSubset string `json:",omitempty" alias:"service_subset"` ServiceSubset string `json:",omitempty" alias:"service_subset"`
Namespace string `json:",omitempty"` // Referencing other partitions is not supported.
Datacenter string `json:",omitempty"` Namespace string `json:",omitempty"`
Datacenter string `json:",omitempty"`
} }
type ServiceResolverFailover struct { type ServiceResolverFailover struct {
Service string `json:",omitempty"` Service string `json:",omitempty"`
ServiceSubset string `json:",omitempty" alias:"service_subset"` ServiceSubset string `json:",omitempty" alias:"service_subset"`
Namespace string `json:",omitempty"` // Referencing other partitions is not supported.
Datacenters []string `json:",omitempty"` Namespace string `json:",omitempty"`
Datacenters []string `json:",omitempty"`
} }
// LoadBalancer determines the load balancing policy and configuration for services // LoadBalancer determines the load balancing policy and configuration for services

View File

@ -139,6 +139,7 @@ func TestAPI_ConfigEntry_DiscoveryChain(t *testing.T) {
entry: &ServiceResolverConfigEntry{ entry: &ServiceResolverConfigEntry{
Kind: ServiceResolver, Kind: ServiceResolver,
Name: "test-failover", Name: "test-failover",
Partition: defaultPartition,
Namespace: defaultNamespace, Namespace: defaultNamespace,
DefaultSubset: "v1", DefaultSubset: "v1",
Subsets: map[string]ServiceResolverSubset{ Subsets: map[string]ServiceResolverSubset{
@ -171,6 +172,7 @@ func TestAPI_ConfigEntry_DiscoveryChain(t *testing.T) {
entry: &ServiceResolverConfigEntry{ entry: &ServiceResolverConfigEntry{
Kind: ServiceResolver, Kind: ServiceResolver,
Name: "test-redirect", Name: "test-redirect",
Partition: defaultPartition,
Namespace: defaultNamespace, Namespace: defaultNamespace,
Redirect: &ServiceResolverRedirect{ Redirect: &ServiceResolverRedirect{
Service: "test-failover", Service: "test-failover",
@ -186,6 +188,7 @@ func TestAPI_ConfigEntry_DiscoveryChain(t *testing.T) {
entry: &ServiceSplitterConfigEntry{ entry: &ServiceSplitterConfigEntry{
Kind: ServiceSplitter, Kind: ServiceSplitter,
Name: "test-split", Name: "test-split",
Partition: defaultPartition,
Namespace: defaultNamespace, Namespace: defaultNamespace,
Splits: []ServiceSplit{ Splits: []ServiceSplit{
{ {
@ -220,6 +223,7 @@ func TestAPI_ConfigEntry_DiscoveryChain(t *testing.T) {
entry: &ServiceRouterConfigEntry{ entry: &ServiceRouterConfigEntry{
Kind: ServiceRouter, Kind: ServiceRouter,
Name: "test-route", Name: "test-route",
Partition: defaultPartition,
Namespace: defaultNamespace, Namespace: defaultNamespace,
Routes: []ServiceRoute{ Routes: []ServiceRoute{
{ {
@ -329,6 +333,7 @@ func TestAPI_ConfigEntry_ServiceResolver_LoadBalancer(t *testing.T) {
entry: &ServiceResolverConfigEntry{ entry: &ServiceResolverConfigEntry{
Kind: ServiceResolver, Kind: ServiceResolver,
Name: "test-least-req", Name: "test-least-req",
Partition: defaultPartition,
Namespace: defaultNamespace, Namespace: defaultNamespace,
LoadBalancer: &LoadBalancer{ LoadBalancer: &LoadBalancer{
Policy: "least_request", Policy: "least_request",
@ -343,6 +348,7 @@ func TestAPI_ConfigEntry_ServiceResolver_LoadBalancer(t *testing.T) {
Kind: ServiceResolver, Kind: ServiceResolver,
Name: "test-ring-hash", Name: "test-ring-hash",
Namespace: defaultNamespace, Namespace: defaultNamespace,
Partition: defaultPartition,
LoadBalancer: &LoadBalancer{ LoadBalancer: &LoadBalancer{
Policy: "ring_hash", Policy: "ring_hash",
RingHashConfig: &RingHashConfig{ RingHashConfig: &RingHashConfig{

View File

@ -10,7 +10,11 @@ type IngressGatewayConfigEntry struct {
// service. This should match the name provided in the service definition. // service. This should match the name provided in the service definition.
Name string Name string
// Namespace is the namespace the IngressGateway is associated with // Partition is the partition the IngressGateway is associated with.
// Partitioning is a Consul Enterprise feature.
Partition string `json:",omitempty"`
// Namespace is the namespace the IngressGateway is associated with.
// Namespacing is a Consul Enterprise feature. // Namespacing is a Consul Enterprise feature.
Namespace string `json:",omitempty"` Namespace string `json:",omitempty"`
@ -34,7 +38,7 @@ type IngressGatewayConfigEntry struct {
} }
type GatewayTLSConfig struct { type GatewayTLSConfig struct {
// Indicates that TLS should be enabled for this gateway service // Indicates that TLS should be enabled for this gateway service.
Enabled bool Enabled bool
} }
@ -67,7 +71,7 @@ type IngressService struct {
// protocol and means that the listener will forward traffic to all services. // protocol and means that the listener will forward traffic to all services.
// //
// A name can be specified on multiple listeners, and will be exposed on both // A name can be specified on multiple listeners, and will be exposed on both
// of the listeners // of the listeners.
Name string Name string
// Hosts is a list of hostnames which should be associated to this service on // Hosts is a list of hostnames which should be associated to this service on
@ -83,38 +87,24 @@ type IngressService struct {
// using a "tcp" listener. // using a "tcp" listener.
Hosts []string Hosts []string
// Allow HTTP header manipulation to be configured. // Referencing other partitions is not supported.
RequestHeaders *HTTPHeaderModifiers `json:",omitempty" alias:"request_headers"`
ResponseHeaders *HTTPHeaderModifiers `json:",omitempty" alias:"response_headers"`
// Namespace is the namespace where the service is located. // Namespace is the namespace where the service is located.
// Namespacing is a Consul Enterprise feature. // Namespacing is a Consul Enterprise feature.
Namespace string `json:",omitempty"` Namespace string `json:",omitempty"`
// Allow HTTP header manipulation to be configured.
RequestHeaders *HTTPHeaderModifiers `json:",omitempty" alias:"request_headers"`
ResponseHeaders *HTTPHeaderModifiers `json:",omitempty" alias:"response_headers"`
} }
func (i *IngressGatewayConfigEntry) GetKind() string { func (i *IngressGatewayConfigEntry) GetKind() string { return i.Kind }
return i.Kind func (i *IngressGatewayConfigEntry) GetName() string { return i.Name }
} func (i *IngressGatewayConfigEntry) GetPartition() string { return i.Partition }
func (i *IngressGatewayConfigEntry) GetNamespace() string { return i.Namespace }
func (i *IngressGatewayConfigEntry) GetName() string { func (i *IngressGatewayConfigEntry) GetMeta() map[string]string { return i.Meta }
return i.Name func (i *IngressGatewayConfigEntry) GetCreateIndex() uint64 { return i.CreateIndex }
} func (i *IngressGatewayConfigEntry) GetModifyIndex() uint64 { return i.ModifyIndex }
func (i *IngressGatewayConfigEntry) GetNamespace() string {
return i.Namespace
}
func (i *IngressGatewayConfigEntry) GetMeta() map[string]string {
return i.Meta
}
func (i *IngressGatewayConfigEntry) GetCreateIndex() uint64 {
return i.CreateIndex
}
func (i *IngressGatewayConfigEntry) GetModifyIndex() uint64 {
return i.ModifyIndex
}
// TerminatingGatewayConfigEntry manages the configuration for a terminating gateway // TerminatingGatewayConfigEntry manages the configuration for a terminating gateway
// with the given name. // with the given name.
@ -140,55 +130,45 @@ type TerminatingGatewayConfigEntry struct {
// queries. // queries.
ModifyIndex uint64 ModifyIndex uint64
// Namespace is the namespace the config entry is associated with // Partition is the partition the config entry is associated with.
// Partitioning is a Consul Enterprise feature.
Partition string `json:",omitempty"`
// Namespace is the namespace the config entry is associated with.
// Namespacing is a Consul Enterprise feature. // Namespacing is a Consul Enterprise feature.
Namespace string `json:",omitempty"` Namespace string `json:",omitempty"`
} }
// A LinkedService is a service represented by a terminating gateway // A LinkedService is a service represented by a terminating gateway
type LinkedService struct { type LinkedService struct {
// The namespace the service is registered in // Referencing other partitions is not supported.
// Namespace is where the service is registered.
Namespace string `json:",omitempty"` Namespace string `json:",omitempty"`
// Name is the name of the service, as defined in Consul's catalog // Name is the name of the service, as defined in Consul's catalog.
Name string `json:",omitempty"` Name string `json:",omitempty"`
// CAFile is the optional path to a CA certificate to use for TLS connections // CAFile is the optional path to a CA certificate to use for TLS connections
// from the gateway to the linked service // from the gateway to the linked service.
CAFile string `json:",omitempty" alias:"ca_file"` CAFile string `json:",omitempty" alias:"ca_file"`
// CertFile is the optional path to a client certificate to use for TLS connections // CertFile is the optional path to a client certificate to use for TLS connections
// from the gateway to the linked service // from the gateway to the linked service.
CertFile string `json:",omitempty" alias:"cert_file"` CertFile string `json:",omitempty" alias:"cert_file"`
// KeyFile is the optional path to a private key to use for TLS connections // KeyFile is the optional path to a private key to use for TLS connections
// from the gateway to the linked service // from the gateway to the linked service.
KeyFile string `json:",omitempty" alias:"key_file"` KeyFile string `json:",omitempty" alias:"key_file"`
// SNI is the optional name to specify during the TLS handshake with a linked service // SNI is the optional name to specify during the TLS handshake with a linked service.
SNI string `json:",omitempty"` SNI string `json:",omitempty"`
} }
func (g *TerminatingGatewayConfigEntry) GetKind() string { func (g *TerminatingGatewayConfigEntry) GetKind() string { return g.Kind }
return g.Kind func (g *TerminatingGatewayConfigEntry) GetName() string { return g.Name }
} func (g *TerminatingGatewayConfigEntry) GetPartition() string { return g.Partition }
func (g *TerminatingGatewayConfigEntry) GetNamespace() string { return g.Namespace }
func (g *TerminatingGatewayConfigEntry) GetName() string { func (g *TerminatingGatewayConfigEntry) GetMeta() map[string]string { return g.Meta }
return g.Name func (g *TerminatingGatewayConfigEntry) GetCreateIndex() uint64 { return g.CreateIndex }
} func (g *TerminatingGatewayConfigEntry) GetModifyIndex() uint64 { return g.ModifyIndex }
func (g *TerminatingGatewayConfigEntry) GetNamespace() string {
return g.Namespace
}
func (g *TerminatingGatewayConfigEntry) GetMeta() map[string]string {
return g.Meta
}
func (g *TerminatingGatewayConfigEntry) GetCreateIndex() uint64 {
return g.CreateIndex
}
func (g *TerminatingGatewayConfigEntry) GetModifyIndex() uint64 {
return g.ModifyIndex
}

View File

@ -5,6 +5,7 @@ import "time"
type ServiceIntentionsConfigEntry struct { type ServiceIntentionsConfigEntry struct {
Kind string Kind string
Name string Name string
Partition string `json:",omitempty"`
Namespace string `json:",omitempty"` Namespace string `json:",omitempty"`
Sources []*SourceIntention Sources []*SourceIntention
@ -17,6 +18,7 @@ type ServiceIntentionsConfigEntry struct {
type SourceIntention struct { type SourceIntention struct {
Name string Name string
Partition string `json:",omitempty"`
Namespace string `json:",omitempty"` Namespace string `json:",omitempty"`
Action IntentionAction `json:",omitempty"` Action IntentionAction `json:",omitempty"`
Permissions []*IntentionPermission `json:",omitempty"` Permissions []*IntentionPermission `json:",omitempty"`
@ -30,29 +32,13 @@ type SourceIntention struct {
LegacyUpdateTime *time.Time `json:",omitempty" alias:"legacy_update_time"` LegacyUpdateTime *time.Time `json:",omitempty" alias:"legacy_update_time"`
} }
func (e *ServiceIntentionsConfigEntry) GetKind() string { func (e *ServiceIntentionsConfigEntry) GetKind() string { return e.Kind }
return e.Kind func (e *ServiceIntentionsConfigEntry) GetName() string { return e.Name }
} func (e *ServiceIntentionsConfigEntry) GetPartition() string { return e.Partition }
func (e *ServiceIntentionsConfigEntry) GetNamespace() string { return e.Namespace }
func (e *ServiceIntentionsConfigEntry) GetName() string { func (e *ServiceIntentionsConfigEntry) GetMeta() map[string]string { return e.Meta }
return e.Name func (e *ServiceIntentionsConfigEntry) GetCreateIndex() uint64 { return e.CreateIndex }
} func (e *ServiceIntentionsConfigEntry) GetModifyIndex() uint64 { return e.ModifyIndex }
func (e *ServiceIntentionsConfigEntry) GetNamespace() string {
return e.Namespace
}
func (e *ServiceIntentionsConfigEntry) GetMeta() map[string]string {
return e.Meta
}
func (e *ServiceIntentionsConfigEntry) GetCreateIndex() uint64 {
return e.CreateIndex
}
func (e *ServiceIntentionsConfigEntry) GetModifyIndex() uint64 {
return e.ModifyIndex
}
type IntentionPermission struct { type IntentionPermission struct {
Action IntentionAction Action IntentionAction

View File

@ -204,6 +204,7 @@ func TestAPI_ConfigEntries(t *testing.T) {
"foo": "bar", "foo": "bar",
"gir": "zim", "gir": "zim",
}, },
Partition: defaultPartition,
Namespace: defaultNamespace, Namespace: defaultNamespace,
} }
ce := c.ConfigEntries() ce := c.ConfigEntries()