Skip to content

Commit

Permalink
[federation] Federation fixes and improvements
Browse files Browse the repository at this point in the history
MAISTRA-2423 update federation api to v1

Signed-off-by: rcernich <rcernich@redhat.com>

MAISTRA-2424 minor updates to federation api

Signed-off-by: rcernich <rcernich@redhat.com>

MAISTRA-2427 configure locality info on imported services

Signed-off-by: rcernich <rcernich@redhat.com>

Cherry-pick multi-root support (maistra#387)

* Update go-control-plane to v0.9.9

* Support multiple roots

Squashed commit, contains:
- MAISTRA-2325 Distribute trust bundles over SDS
- MAISTRA-2390 Push trust bundle updates through xDS (maistra#357)

MAISTRA-2425 move spec.security.certificateChain to ConfigMap reference; add ability to specify ports for service and discovery (maistra#392)

Signed-off-by: rcernich <rcernich@redhat.com>

MAISTRA-2426 move FederationStatus into MeshFederation (maistra#393)

Signed-off-by: rcernich <rcernich@redhat.com>

MAISTRA-2513 federation API refinements

Signed-off-by: rcernich <rcernich@redhat.com>

[federation] MAISTRA-2237 Encrypt service discovery traffic (maistra#411)

MAISTRA-2610 Prefix federation discovery endpoints with /v1/ (maistra#422)

MAISTRA-2297 Support updates of federation resources (maistra#417)

MAISTRA-2375: Do not create automatic routes for Federation Gateways

Remove a redundant call

`setHostname()` is already being called within `NameForService()`

see
https://github.com/maistra/istio/blob/21ee900cf8825711f70d88dc97afcf6862ed2626/pkg/servicemesh/federation/common/namemapping.go
lines 83, 120, 129

Remove techPreview.meshConfig from PoC example

It's set by default now.

MAISTRA-2611 Fix deletion of service exports to federated mesh (maistra#421)

Fix test

MAISTRA-2658 Ensure ImportedServiceSet.status.importedServices is never nil (maistra#437)

* MAISTRA-2658 Ensure ImportedServiceSet.status.importedServices is never nil

* Fix test

MAISTRA-2682 Fix watch mechanism in federation (maistra#439)

Previously, no events were read from the watch response, because the read started with an endless loop that waited for data to be available in the decoder's buffer. This never happened, because the buffer is only written to when you call decoder.Decode(); this function was never called because the code waited for the buffer to have data.

MAISTRA-2683 Properly close incoming watch connections when shutting down (maistra#440)

Log actual error returned by pollServices() (maistra#441)

Previously, instead of the actual error, only the following error message was logged: "expected condition not met".

MAISTRA-2439: Prevent federation from exporting services that are not visible to the federation gateway (maistra#432)

By taking into consideration the service annotation
`networking.istio.io/exportTo`.

This annotation restricts where this service is visible: https://istio.io/latest/docs/reference/config/annotations/

If a service is not reachable from the federation gateway namespace due
to this annotation, it should not be exported.

MAISTRA-2617: Do not watch all namespaces in Extensions controller (maistra#425)

When using MemberRoll, we should rely on it to provide the list
of namespaces to watch. If not using it, defaults to command line
arguments.

This fixes an istiod startup error as seen in the logs:
```
github.com/maistra/xns-informer/pkg/informers/informer.go:204: Failed to watch *v1.ServiceMeshExtension: failed to list *v1.ServiceMeshExtension: servicemeshextensions.maistra.io is forbidden: User "system:serviceaccount:i1:istiod-service-account-basic" cannot list resource "servicemeshextensions" in API group "maistra.io" at the cluster scope
```
  • Loading branch information
rcernich authored and jewertow committed Aug 22, 2022
1 parent 42015d1 commit 61ef90c
Show file tree
Hide file tree
Showing 91 changed files with 6,278 additions and 2,896 deletions.
7 changes: 3 additions & 4 deletions bin/update_maistra_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ popd
# rm -f manifests/charts/base/crds/maistra*
# cp "${dir}"/manifests/* manifests/charts/base/crds

cp "${dir}"/manifests/maistra.io_meshfederations.yaml manifests/charts/base/crds
cp "${dir}"/manifests/maistra.io_federationstatuses.yaml manifests/charts/base/crds
cp "${dir}"/manifests/maistra.io_serviceexports.yaml manifests/charts/base/crds
cp "${dir}"/manifests/maistra.io_serviceimports.yaml manifests/charts/base/crds
cp "${dir}"/manifests/federation.maistra.io_servicemeshpeers.yaml manifests/charts/base/crds
cp "${dir}"/manifests/federation.maistra.io_exportedservicesets.yaml manifests/charts/base/crds
cp "${dir}"/manifests/federation.maistra.io_importedservicesets.yaml manifests/charts/base/crds
cp "${dir}"/manifests/maistra.io_servicemeshextensions.yaml manifests/charts/base/crds

rm -rf "${dir}"
Expand Down
2 changes: 2 additions & 0 deletions common/config/.golangci-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ run:
skip-files:
- ".*\\.pb\\.go"
- ".*\\.gen\\.go"
# This file requires a custom import order for side effects (https://github.com/grpc/grpc-go/issues/4124)
- pilot/pkg/networking/grpcgen/grpcgen_test.go

linters:
disable-all: true
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ require (
github.com/cenkalti/backoff/v4 v4.1.3
github.com/census-instrumentation/opencensus-proto v0.3.0
github.com/cheggaaa/pb/v3 v3.0.8
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4
github.com/cncf/xds/go v0.0.0-20220520190051-1e77728a1eaa
github.com/containernetworking/cni v1.1.0
github.com/containernetworking/plugins v1.1.1
Expand Down Expand Up @@ -134,6 +133,7 @@ require (
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5 // indirect
github.com/cheekybits/genny v1.0.0 // indirect
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.11.4 // indirect
github.com/containerd/typeurl v1.0.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
Expand Down
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,7 @@ github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJ
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/maistra/xns-informer v0.0.0-20210707160032-977ec17e2e0e/go.mod h1:Bwe3VRiuXlSXu8MktDkmbrFcmSDysxuoOra542o0Ljk=
github.com/maistra/xns-informer v0.0.0-20210707160032-977ec17e2e0e/go.mod h1:Bwe3VRiuXlSXu8MktDkmbrFcmSDysxuoOra542o0Ljk=
github.com/maistra/xns-informer v0.0.0-20220607143500-5c99350964f8 h1:9TwMtVMpQVMwGqty8/glQTDVdx7CHJSD+jOeALMVLKo=
github.com/maistra/xns-informer v0.0.0-20220607143500-5c99350964f8/go.mod h1:/mVVoQxdn1oIZWxHue7zjkbvrXt/AEKDvNvY9g0w+5s=
github.com/maratori/testpackage v1.0.1/go.mod h1:ddKdw+XG0Phzhx8BFDTKgpWP4i7MpApTE5fXSKAqwDU=
Expand Down Expand Up @@ -2689,6 +2690,7 @@ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190213192042-740235f6c0d8/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190213192042-740235f6c0d8/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190221204921-83362c3779f5/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190307163923-6a08e3108db3/go.mod h1:25r3+/G6/xytQM8iWZKq3Hn0kr0rgFKPUNVEL/dr3z4=
Expand Down Expand Up @@ -2782,6 +2784,7 @@ golang.org/x/tools v0.0.0-20200831203904-5a2aa26beb65/go.mod h1:Cj7w3i3Rnn0Xh82u
golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=
golang.org/x/tools v0.0.0-20200916195026-c9a70fc28ce3/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
golang.org/x/tools v0.0.0-20200930213115-e57f6d466a48/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
golang.org/x/tools v0.0.0-20200930213115-e57f6d466a48/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
golang.org/x/tools v0.0.0-20201001104356-43ebab892c4c/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
golang.org/x/tools v0.0.0-20201002184944-ecd9fd270d5d/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
Expand Down Expand Up @@ -3147,13 +3150,16 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9
honnef.co/go/tools v0.0.1-2020.1.5/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.2.1/go.mod h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY=
istio.io/api v0.0.0-20210503211644-902e709f95c4/go.mod h1:88HN3o1fSD1jo+Z1WTLlJfMm9biopur6Ct9BFKjiB64=
istio.io/api v0.0.0-20210503211644-902e709f95c4/go.mod h1:88HN3o1fSD1jo+Z1WTLlJfMm9biopur6Ct9BFKjiB64=
istio.io/api v0.0.0-20220523183528-706b04d34c0f/go.mod h1:00myJeQGWma4Y5pboJ+MM4P2uqEWulKA1duC8kYN5Wo=
istio.io/api v0.0.0-20220525153140-e3c48c9ac324 h1:/mnoykmdJfAuauJ91A2bVorwd5tlMpbU4yDaBTEcaAo=
istio.io/api v0.0.0-20220525153140-e3c48c9ac324/go.mod h1:00myJeQGWma4Y5pboJ+MM4P2uqEWulKA1duC8kYN5Wo=
istio.io/client-go v0.0.0-20210503213042-e6eb157f0d81/go.mod h1:LAkylvGs/+IEUnUXfYqMS5y0lLx45ruBTds327AdmIQ=
istio.io/client-go v0.0.0-20210503213042-e6eb157f0d81/go.mod h1:LAkylvGs/+IEUnUXfYqMS5y0lLx45ruBTds327AdmIQ=
istio.io/client-go v1.12.0-alpha.5.0.20220523183928-68e393ac0b53 h1:ZECujXuUyYisLPaESgoL1sXo8RhyctnWjY0qo5qG/34=
istio.io/client-go v1.12.0-alpha.5.0.20220523183928-68e393ac0b53/go.mod h1:AGoZrDGR5SJZr8Oak+6DhjD7/iHJzTDcfygzLtDBD2k=
istio.io/gogo-genproto v0.0.0-20190930162913-45029607206a/go.mod h1:OzpAts7jljZceG4Vqi5/zXy/pOg1b209T3jb7Nv5wIs=
istio.io/gogo-genproto v0.0.0-20190930162913-45029607206a/go.mod h1:OzpAts7jljZceG4Vqi5/zXy/pOg1b209T3jb7Nv5wIs=
istio.io/pkg v0.0.0-20220519183359-907110f1545f h1:teL+HVIdyqT86LmudYqG7O4BqeTOAouTGEERr5z2vJw=
istio.io/pkg v0.0.0-20220519183359-907110f1545f/go.mod h1:kcBYN5TiyGFM2bs4b7K81j+YeDZ4JrINP+brV9ehZe0=
k8s.io/api v0.0.0-20180904230853-4e7be11eab3f/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA=
Expand Down Expand Up @@ -3341,6 +3347,8 @@ k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 h1:HNSDgDCrr/6Ly3WEGKZftiE7IY19Vz2GdbOCyI4qqhc=
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
maistra.io/api v0.0.0-20220301154558-8f6a12a9464b h1:BxzFHBRoPPFTqh//J9LE6wWJhT5eZU+7V3qZegFFH1g=
maistra.io/api v0.0.0-20220301154558-8f6a12a9464b h1:BxzFHBRoPPFTqh//J9LE6wWJhT5eZU+7V3qZegFFH1g=
maistra.io/api v0.0.0-20220301154558-8f6a12a9464b/go.mod h1:SZ10GvT+vvHarnUsyGCOo1XcOE+wGwTC+1l0VXZ0Gac=
maistra.io/api v0.0.0-20220301154558-8f6a12a9464b/go.mod h1:SZ10GvT+vvHarnUsyGCOo1XcOE+wGwTC+1l0VXZ0Gac=
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.4
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: serviceexports.maistra.io
name: exportedservicesets.federation.maistra.io
spec:
group: maistra.io
group: federation.maistra.io
names:
kind: ServiceExports
listKind: ServiceExportsList
plural: serviceexports
singular: serviceexports
kind: ExportedServiceSet
listKind: ExportedServiceSetList
plural: exportedservicesets
singular: exportedserviceset
preserveUnknownFields: false
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: ServiceExport is the Schema for configuring exported services. The
name of the ServiceExports resource must match the name of a MeshFederation
description: ExportedServiceSet is the Schema for configuring exported services. The
name of the ExportedServiceSet resource must match the name of a ServiceMeshPeer
resource defining the remote mesh to which the services will be exported.
properties:
apiVersion:
Expand All @@ -38,8 +39,8 @@ spec:
spec:
description: Spec defines rules for matching services to be exported.
properties:
exports:
description: Exports are the rules that determine which services are
exportRules:
description: ExportRules are the rules that determine which services are
exported from the mesh. The list is processed in order and the first
spec in the list that applies to a service is the one that will be
applied. This allows more specific selectors to be placed before
Expand Down Expand Up @@ -75,12 +76,9 @@ spec:
type: string
type: object
name:
properties:
name:
type: string
namespace:
type: string
type: object
type: string
namespace:
type: string
type: object
type: array
namespace:
Expand Down Expand Up @@ -147,12 +145,9 @@ spec:
type: string
type: object
name:
properties:
name:
type: string
namespace:
type: string
type: object
type: string
namespace:
type: string
type: object
type:
description: Type of rule. One of Name or Label.
Expand All @@ -163,11 +158,47 @@ spec:
type: array
type: object
status:
properties:
exportedServices:
description: Exports provides details about the services exported by this mesh.
items:
description: PeerServiceMapping represents the name mapping between an exported service and its local counterpart.
properties:
exportedName:
description: ExportedName represents the fully qualified domain name (FQDN) of an exported service. For an exporting mesh, this is the name that is exported to the remote mesh. For an importing mesh, this would be the name of the service exported by the remote mesh.
type: string
localService:
description: LocalService represents the service in the local (i.e. this) mesh. For an exporting mesh, this would be the service being exported. For an importing mesh, this would be the imported service.
properties:
hostname:
description: Hostname represents fully qualified domain name (FQDN) used to access the service.
type: string
name:
description: Name represents the simple name of the service, e.g. the metadata.name field of a kubernetes Service.
type: string
namespace:
description: Namespace represents the namespace within which the service resides.
type: string
required:
- hostname
- name
- namespace
type: object
required:
- exportedName
- localService
type: object
type: array
x-kubernetes-list-map-keys:
- exportedName
x-kubernetes-list-type: map
required:
- exportedServices
type: object
type: object
version: v1alpha1
version: v1
versions:
- name: v1alpha1
- name: v1
served: true
storage: true
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: importedservicesets.federation.maistra.io
spec:
group: federation.maistra.io
names:
kind: ImportedServiceSet
listKind: ImportedServiceSetList
plural: importedservicesets
singular: importedserviceset
preserveUnknownFields: false
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: ImportedServiceSet is the Schema for configuring imported services. The name of the ImportedServiceSet resource must match the name of a ServiceMeshPeer resource defining the remote mesh from which the services will be imported.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Spec defines rules for matching services to be imported.
properties:
domainSuffix:
description: 'DomainSuffix specifies the domain suffix to be applies to imported services. If no domain suffix is specified, imported services will be named as follows: <imported-name>.<imported-namespace>.svc.<mesh-name>-imports.local If a domain suffix is specified, imported services will be named as follows: <imported-name>.<imported-namespace>.<domain-suffix>'
type: string
importRules:
description: ImportRules are the rules that determine which services are imported to the mesh. The list is processed in order and the first spec in the list that applies to a service is the one that will be applied. This allows more specific selectors to be placed before more general selectors.
items:
properties:
domainSuffix:
description: DomainSuffix applies the specified suffix to services imported by this rule. The behavior is identical to that of ImportedServiceSetSpec.DomainSuffix.
type: string
importAsLocal:
description: ImportAsLocal imports the service as a local service in the mesh. For example, if an exported service, foo/bar is imported as some-ns/service, the service will be imported as service.some-ns.svc.cluster.local in the some-ns namespace. If a service of this name already exists in the mesh, the imported service's endpoints will be aggregated with any other workloads associated with the service. This setting overrides DomainSuffix.
type: boolean
nameSelector:
description: NameSelector provides a simple name matcher for importing services in the mesh.
properties:
alias:
properties:
name:
type: string
namespace:
type: string
type: object
name:
type: string
namespace:
type: string
type: object
type:
description: Type of rule. Only Name type is supported.
type: string
required:
- type
type: object
type: array
locality:
description: Locality within which imported services should be associated.
properties:
region:
description: Region within which imported services are located.
type: string
subzone:
description: Subzone within which imported services are located. If Subzone is specified, Zone must also be specified.
type: string
zone:
description: Zone within which imported services are located. If Zone is specified, Region must also be specified.
type: string
type: object
type: object
status:
properties:
importedServices:
description: Imports provides details about the services imported by this mesh.
items:
description: PeerServiceMapping represents the name mapping between an exported service and its local counterpart.
properties:
exportedName:
description: ExportedName represents the fully qualified domain name (FQDN) of an exported service. For an exporting mesh, this is the name that is exported to the remote mesh. For an importing mesh, this would be the name of the service exported by the remote mesh.
type: string
localService:
description: LocalService represents the service in the local (i.e. this) mesh. For an exporting mesh, this would be the service being exported. For an importing mesh, this would be the imported service.
properties:
hostname:
description: Hostname represents fully qualified domain name (FQDN) used to access the service.
type: string
name:
description: Name represents the simple name of the service, e.g. the metadata.name field of a kubernetes Service.
type: string
namespace:
description: Namespace represents the namespace within which the service resides.
type: string
required:
- hostname
- name
- namespace
type: object
required:
- exportedName
- localService
type: object
type: array
x-kubernetes-list-map-keys:
- exportedName
x-kubernetes-list-type: map
required:
- importedServices
type: object
type: object
version: v1
versions:
- name: v1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

0 comments on commit 61ef90c

Please sign in to comment.