Skip to content

Implement controller for FederatedService #169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2a8fa10
Revert "feat(cmd): hides ctrl-runtime implementation behind the flag …
jewertow Jan 25, 2025
164be34
MeshFederation controller WIP
jewertow Jan 25, 2025
7daf461
Add support for PeerAuthentication to MeshFederation controller
jewertow Jan 26, 2025
47b8291
Manage federation ingress gateway in MeshFederation controller
jewertow Jan 26, 2025
a58782f
Remove custom reconciler and factory for federation ingress gateway
jewertow Jan 26, 2025
c6ba3eb
Refactor MeshFederation controller
jewertow Jan 26, 2025
8d338e6
Manage EnvoyFilters in MeshFederation controller
jewertow Jan 26, 2025
082fe3c
Remove custom reconciler for EnvoyFilter
jewertow Jan 26, 2025
3c93e63
Remove EnvoyFilters factory
jewertow Jan 26, 2025
e71df6d
Add missing role for watching EnvoyFilters
jewertow Jan 26, 2025
f2a2e02
Move managing Routes to MeshFederation controller
jewertow Jan 26, 2025
bd8bc5a
Use MeshFederation CR in e2e tests to configure local federation
jewertow Jan 26, 2025
c6b2146
Move DNS reconciler to MeshFederation ctrl
jewertow Jan 26, 2025
3cdcdf5
Fix helm chart and examples to make it work on OpenShift
jewertow Jan 26, 2025
8f72b5c
Remove unused values from kind examples
jewertow Jan 26, 2025
ca2ec9e
Remove custom image from examples
jewertow Jan 26, 2025
aa12bfb
Remove unnecessary fields from MeshFederation
jewertow Jan 26, 2025
399684d
Add proper fields to FederatedService CRD
jewertow Jan 26, 2025
3cd2265
Implement creating FederatedService on FDS response
jewertow Jan 27, 2025
058e21c
Move logic responsible for ServiceEntry and WorkloadEntry to Federate…
jewertow Jan 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ e2e: kind-clusters ## Runs end-to-end tests against KinD clusters
$(foreach suite, $(TEST_SUITES), \
PATH=$(LOCALBIN):$$PATH \
TAG=$$local_tag \
go test -tags=integ -run TestTraffic $(PROJECT_DIR)/test/e2e/scenarios/$(suite) \
go test -tags=integ -timeout 30m -run TestTraffic $(PROJECT_DIR)/test/e2e/scenarios/$(suite) \
--istio.test.hub=docker.io/istio\
--istio.test.tag=$(ISTIO_VERSION)\
--istio.test.kube.config=$(PROJECT_DIR)/test/east.kubeconfig,$(PROJECT_DIR)/test/west.kubeconfig,$(PROJECT_DIR)/test/central.kubeconfig\
Expand Down
21 changes: 14 additions & 7 deletions api/v1alpha1/federatedservice_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,23 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// FederatedServiceSpec defines the desired state of FederatedService.
type FederatedServiceSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
// Host is a FQDN of the federated service.
Host string `json:"host,omitempty"`

// Ports of the federated service.
Ports []Port `json:"ports,omitempty"`

// Labels associated with endpoints of the federated service.
Labels map[string]string `json:"labels,omitempty"`
}

// Foo is an example field of FederatedService. Edit federatedservice_types.go to remove/update
Foo string `json:"foo,omitempty"`
type Port struct {
Name string `json:"name,omitempty"`
Number int32 `json:"number,omitempty"`
Protocol string `json:"protocol,omitempty"`
TargetPort int32 `json:"targetPort,omitempty"`
}

// FederatedServiceStatus defines the observed state of FederatedService.
Expand Down
13 changes: 1 addition & 12 deletions api/v1alpha1/meshfederation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,9 @@ type MeshFederationList struct {

// MeshFederationSpec defines the desired state of MeshFederation.
type MeshFederationSpec struct {
// Network name used by Istio for load balancing
// +kubebuilder:validation:Required
Network string `json:"network"`

// +kubebuilder:default:=cluster.local
TrustDomain string `json:"trustDomain"`

// Namespace used to create mesh-wide resources
// +kubebuilder:default:=istio-system
ControlPlaneNamespace string `json:"controlPlaneNamespace"`

// TODO: CRD proposal states "If no ingress is specified, it means the controller supports only single network topology". However, some config, such as gateway/port config, seems to be required.
// Config specifying ingress type and ingress gateway config
// +kubebuilder:validation:Required
// +kubebuilder:validation:Optional
IngressConfig IngressConfig `json:"ingress"`

// Selects the K8s Services to export to all remote meshes.
Expand Down
29 changes: 28 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,30 @@ spec:
spec:
description: FederatedServiceSpec defines the desired state of FederatedService.
properties:
foo:
description: Foo is an example field of FederatedService. Edit federatedservice_types.go
to remove/update
host:
description: Host is a FQDN of the federated service.
type: string
labels:
additionalProperties:
type: string
description: Labels associated with endpoints of the federated service.
type: object
ports:
description: Ports of the federated service.
items:
properties:
name:
type: string
number:
format: int32
type: integer
protocol:
type: string
targetPort:
format: int32
type: integer
type: object
type: array
type: object
status:
description: FederatedServiceStatus defines the observed state of FederatedService.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ spec:
spec:
description: MeshFederationSpec defines the desired state of MeshFederation.
properties:
controlPlaneNamespace:
default: istio-system
description: Namespace used to create mesh-wide resources
type: string
export:
description: |-
Selects the K8s Services to export to all remote meshes.
Expand Down Expand Up @@ -154,17 +150,6 @@ spec:
- gateway
- type
type: object
network:
description: Network name used by Istio for load balancing
type: string
trustDomain:
default: cluster.local
type: string
required:
- controlPlaneNamespace
- ingress
- network
- trustDomain
type: object
status:
description: MeshFederationStatus defines the observed state of MeshFederation.
Expand Down
15 changes: 8 additions & 7 deletions chart/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,27 @@ rules:
verbs: ["get", "watch", "list"]
- apiGroups: ["networking.istio.io"]
resources: ["gateways", "serviceentries", "workloadentries"]
verbs: ["get", "list", "create", "update", "patch", "delete"]
verbs: ["get", "list", "create", "update", "patch", "delete", "watch"]
- apiGroups: ["security.istio.io"]
resources: ["peerauthentications"]
verbs: ["get", "list", "create", "update", "patch", "delete"]
verbs: ["get", "list", "create", "update", "patch", "delete", "watch"]
{{- if (include "remotes.hasOpenshiftRouterPeer" .) }}
- apiGroups: ["networking.istio.io"]
resources: ["destinationrules"]
verbs: ["get", "list", "create", "update", "patch", "delete"]
{{- end }}
{{- if eq .Values.federation.meshPeers.local.ingressType "openshift-router" }}
- apiGroups: ["networking.istio.io"]
resources: ["envoyfilters"]
verbs: ["get", "list", "create", "update", "patch", "delete"]
verbs: ["get", "list", "create", "update", "patch", "delete", "watch"]
- apiGroups: ["route.openshift.io"]
resources: ["routes", "routes/custom-host"]
verbs: ["get", "list", "create", "update", "patch", "delete"]
{{- end }}
verbs: ["get", "list", "create", "update", "patch", "delete", "watch"]
- apiGroups: ["federation.openshift-service-mesh.io"]
resources: ["meshfederations", "federatedservices"]
verbs: ["create", "delete", "get", "list", "patch", "update", "watch"]
- apiGroups: ["federation.openshift-service-mesh.io"]
resources: ["meshfederations/status", "federatedservices/status"]
verbs: ["get"]
verbs: ["get", "update", "patch"]
- apiGroups: ["federation.openshift-service-mesh.io"]
resources: ["meshfederations/finalizers"]
verbs: ["get", "update", "patch"]
Loading
Loading