Skip to content
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

feat(MeshService): handle headless Services #10308

Merged
merged 11 commits into from
Jun 4, 2024
5 changes: 5 additions & 0 deletions deployments/charts/kuma/crds/kuma.io_meshservices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ spec:
x-kubernetes-list-type: map
selector:
properties:
dataplaneRef:
properties:
name:
type: string
type: object
dataplaneTags:
additionalProperties:
type: string
Expand Down
8 changes: 8 additions & 0 deletions deployments/charts/kuma/templates/cp-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ rules:
verbs:
- list
- watch
- apiGroups:
- "discovery.k8s.io"
resources:
- endpointslices
verbs:
- get
- list
- watch
- apiGroups:
- "apps"
resources:
Expand Down
5 changes: 5 additions & 0 deletions docs/generated/raw/crds/kuma.io_meshservices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ spec:
x-kubernetes-list-type: map
selector:
properties:
dataplaneRef:
properties:
name:
type: string
type: object
dataplaneTags:
additionalProperties:
type: string
Expand Down
13 changes: 13 additions & 0 deletions pkg/core/resources/apis/meshservice/api/v1alpha1/meshservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ type DataplaneTags map[string]string

type Selector struct {
DataplaneTags DataplaneTags `json:"dataplaneTags,omitempty"`
DataplaneRef *DataplaneRef `json:"dataplaneRef,omitempty"`
}

type DataplaneRef struct {
Name string `json:"name,omitempty"`
}

func (r *DataplaneRef) Matches() bool {
michaelbeaumont marked this conversation as resolved.
Show resolved Hide resolved
if r == nil {
return false
}

return false
}

type Port struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ properties:
x-kubernetes-list-type: map
selector:
properties:
dataplaneRef:
properties:
name:
type: string
type: object
dataplaneTags:
additionalProperties:
type: string
Expand Down

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 @@ -65,6 +65,11 @@ spec:
x-kubernetes-list-type: map
selector:
properties:
dataplaneRef:
properties:
name:
type: string
type: object
dataplaneTags:
additionalProperties:
type: string
Expand Down
3 changes: 3 additions & 0 deletions pkg/plugins/policies/core/xds/meshroute/listeners.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ func CollectServices(
for _, outbound := range proxy.Dataplane.Spec.GetNetworking().GetOutbounds() {
oface := proxy.Dataplane.Spec.Networking.ToOutboundInterface(outbound)
if outbound.BackendRef != nil {
if outbound.GetAddress() == proxy.Dataplane.Spec.GetNetworking().GetAddress() {
continue
}
ms, ok := meshCtx.MeshServiceByName[outbound.BackendRef.Name]
if !ok {
// we want to ignore service which is not found. Logging might be excessive here.
Expand Down
Loading
Loading