Skip to content

Commit

Permalink
feat(meshservice): proxies stats and state (#10970)
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Dyszkiewicz <jakub.dyszkiewicz@gmail.com>
  • Loading branch information
jakubdyszkiewicz committed Jul 25, 2024
1 parent f48c8d2 commit 11aa52a
Show file tree
Hide file tree
Showing 29 changed files with 488 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5714,6 +5714,14 @@ spec:
type: string
type: object
type: object
state:
description: |-
State of MeshService. Available if there is at least one healthy endpoint. Otherwise, Unavailable.
It's used for cross zone communication to check if we should send traffic to it, when MeshService is aggregated into MeshMultiZoneService.
enum:
- Available
- Unavailable
type: string
type: object
status:
description: Status is the current status of the Kuma MeshService resource.
Expand All @@ -5734,6 +5742,21 @@ spec:
type: string
type: object
type: array
dataplaneProxies:
description: Data plane proxies statistics selected by this MeshService.
properties:
connected:
description: Number of data plane proxies connected to the zone
control plane
type: integer
healthy:
description: Number of data plane proxies with all healthy inbounds
selected by this MeshService.
type: integer
total:
description: Total number of data plane proxies.
type: integer
type: object
hostnameGenerators:
items:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5714,6 +5714,14 @@ spec:
type: string
type: object
type: object
state:
description: |-
State of MeshService. Available if there is at least one healthy endpoint. Otherwise, Unavailable.
It's used for cross zone communication to check if we should send traffic to it, when MeshService is aggregated into MeshMultiZoneService.
enum:
- Available
- Unavailable
type: string
type: object
status:
description: Status is the current status of the Kuma MeshService resource.
Expand All @@ -5734,6 +5742,21 @@ spec:
type: string
type: object
type: array
dataplaneProxies:
description: Data plane proxies statistics selected by this MeshService.
properties:
connected:
description: Number of data plane proxies connected to the zone
control plane
type: integer
healthy:
description: Number of data plane proxies with all healthy inbounds
selected by this MeshService.
type: integer
total:
description: Total number of data plane proxies.
type: integer
type: object
hostnameGenerators:
items:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5734,6 +5734,14 @@ spec:
type: string
type: object
type: object
state:
description: |-
State of MeshService. Available if there is at least one healthy endpoint. Otherwise, Unavailable.
It's used for cross zone communication to check if we should send traffic to it, when MeshService is aggregated into MeshMultiZoneService.
enum:
- Available
- Unavailable
type: string
type: object
status:
description: Status is the current status of the Kuma MeshService resource.
Expand All @@ -5754,6 +5762,21 @@ spec:
type: string
type: object
type: array
dataplaneProxies:
description: Data plane proxies statistics selected by this MeshService.
properties:
connected:
description: Number of data plane proxies connected to the zone
control plane
type: integer
healthy:
description: Number of data plane proxies with all healthy inbounds
selected by this MeshService.
type: integer
total:
description: Total number of data plane proxies.
type: integer
type: object
hostnameGenerators:
items:
properties:
Expand Down
23 changes: 23 additions & 0 deletions app/kumactl/cmd/install/testdata/install-crds.all.golden.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7268,6 +7268,14 @@ spec:
type: string
type: object
type: object
state:
description: |-
State of MeshService. Available if there is at least one healthy endpoint. Otherwise, Unavailable.
It's used for cross zone communication to check if we should send traffic to it, when MeshService is aggregated into MeshMultiZoneService.
enum:
- Available
- Unavailable
type: string
type: object
status:
description: Status is the current status of the Kuma MeshService resource.
Expand All @@ -7288,6 +7296,21 @@ spec:
type: string
type: object
type: array
dataplaneProxies:
description: Data plane proxies statistics selected by this MeshService.
properties:
connected:
description: Number of data plane proxies connected to the zone
control plane
type: integer
healthy:
description: Number of data plane proxies with all healthy inbounds
selected by this MeshService.
type: integer
total:
description: Total number of data plane proxies.
type: integer
type: object
hostnameGenerators:
items:
properties:
Expand Down
23 changes: 23 additions & 0 deletions deployments/charts/kuma/crds/kuma.io_meshservices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ spec:
type: string
type: object
type: object
state:
description: |-
State of MeshService. Available if there is at least one healthy endpoint. Otherwise, Unavailable.
It's used for cross zone communication to check if we should send traffic to it, when MeshService is aggregated into MeshMultiZoneService.
enum:
- Available
- Unavailable
type: string
type: object
status:
description: Status is the current status of the Kuma MeshService resource.
Expand All @@ -111,6 +119,21 @@ spec:
type: string
type: object
type: array
dataplaneProxies:
description: Data plane proxies statistics selected by this MeshService.
properties:
connected:
description: Number of data plane proxies connected to the zone
control plane
type: integer
healthy:
description: Number of data plane proxies with all healthy inbounds
selected by this MeshService.
type: integer
total:
description: Total number of data plane proxies.
type: integer
type: object
hostnameGenerators:
items:
properties:
Expand Down
29 changes: 29 additions & 0 deletions docs/generated/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11370,6 +11370,18 @@ components:
type: string
type: object
type: object
state:
description: >-
State of MeshService. Available if there is at least one healthy
endpoint. Otherwise, Unavailable.
It's used for cross zone communication to check if we should
send traffic to it, when MeshService is aggregated into
MeshMultiZoneService.
enum:
- Available
- Unavailable
type: string
type: object
status:
description: Status is the current status of the Kuma MeshService resource.
Expand All @@ -11390,6 +11402,23 @@ components:
type: string
type: object
type: array
dataplaneProxies:
description: Data plane proxies statistics selected by this MeshService.
properties:
connected:
description: >-
Number of data plane proxies connected to the zone control
plane
type: integer
healthy:
description: >-
Number of data plane proxies with all healthy inbounds
selected by this MeshService.
type: integer
total:
description: Total number of data plane proxies.
type: integer
type: object
hostnameGenerators:
items:
properties:
Expand Down
23 changes: 23 additions & 0 deletions docs/generated/raw/crds/kuma.io_meshservices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ spec:
type: string
type: object
type: object
state:
description: |-
State of MeshService. Available if there is at least one healthy endpoint. Otherwise, Unavailable.
It's used for cross zone communication to check if we should send traffic to it, when MeshService is aggregated into MeshMultiZoneService.
enum:
- Available
- Unavailable
type: string
type: object
status:
description: Status is the current status of the Kuma MeshService resource.
Expand All @@ -111,6 +119,21 @@ spec:
type: string
type: object
type: array
dataplaneProxies:
description: Data plane proxies statistics selected by this MeshService.
properties:
connected:
description: Number of data plane proxies connected to the zone
control plane
type: integer
healthy:
description: Number of data plane proxies with all healthy inbounds
selected by this MeshService.
type: integer
total:
description: Total number of data plane proxies.
type: integer
type: object
hostnameGenerators:
items:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"ip": "10.0.0.1"
}
],
"tls": {}
"tls": {},
"dataplaneProxies": {}
}
},
{
Expand Down Expand Up @@ -56,7 +57,8 @@
"ip": "10.0.0.2"
}
],
"tls": {}
"tls": {},
"dataplaneProxies": {}
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"kuma.io/zone": "default"
},
"spec": {
"state": "Unavailable",
"selector": {
"dataplaneTags": {
"app": "redis"
Expand All @@ -27,6 +28,7 @@
"ip": "10.0.0.1"
}
],
"tls": {}
"tls": {},
"dataplaneProxies": {}
}
}
7 changes: 7 additions & 0 deletions pkg/core/resources/apis/meshservice/api/v1alpha1/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,10 @@ func (t *MeshServiceResource) SNIName(systemNamespace string) string {
}
return t.GetMeta().GetName()
}

func (t *MeshServiceResource) Default() error {
if t.Spec.State == "" {
t.Spec.State = StateUnavailable
}
return nil
}
22 changes: 22 additions & 0 deletions pkg/core/resources/apis/meshservice/api/v1alpha1/meshservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ const maxNameLength = 63
// +kuma:policy:has_status=true
// +kuma:policy:kds_flags=model.ZoneToGlobalFlag | model.GlobalToAllButOriginalZoneFlag
type MeshService struct {
// State of MeshService. Available if there is at least one healthy endpoint. Otherwise, Unavailable.
// It's used for cross zone communication to check if we should send traffic to it, when MeshService is aggregated into MeshMultiZoneService.
State State `json:"state,omitempty"`
Selector Selector `json:"selector,omitempty"`
// +patchMergeKey=port
// +patchStrategy=merge
Expand All @@ -48,6 +51,14 @@ type VIP struct {
IP string `json:"ip,omitempty"`
}

// +kubebuilder:validation:Enum=Available;Unavailable
type State string

const (
StateAvailable State = "Available"
StateUnavailable State = "Unavailable"
)

// +kubebuilder:validation:Enum=Ready;NotReady
type TLSStatus string

Expand All @@ -65,6 +76,8 @@ type MeshServiceStatus struct {
VIPs []VIP `json:"vips,omitempty"`
TLS TLS `json:"tls,omitempty"`
HostnameGenerators []hostnamegenerator_api.HostnameGeneratorStatus `json:"hostnameGenerators,omitempty"`
// Data plane proxies statistics selected by this MeshService.
DataplaneProxies DataplaneProxies `json:"dataplaneProxies,omitempty"`
}

// +kubebuilder:validation:Enum=ServiceTag
Expand All @@ -78,3 +91,12 @@ type MeshServiceIdentity struct {
Type MeshServiceIdentityType `json:"type"`
Value string `json:"value"`
}

type DataplaneProxies struct {
// Number of data plane proxies connected to the zone control plane
Connected int `json:"connected,omitempty"`
// Number of data plane proxies with all healthy inbounds selected by this MeshService.
Healthy int `json:"healthy,omitempty"`
// Total number of data plane proxies.
Total int `json:"total,omitempty"`
}
21 changes: 21 additions & 0 deletions pkg/core/resources/apis/meshservice/api/v1alpha1/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ properties:
type: string
type: object
type: object
state:
description: |-
State of MeshService. Available if there is at least one healthy endpoint. Otherwise, Unavailable.
It's used for cross zone communication to check if we should send traffic to it, when MeshService is aggregated into MeshMultiZoneService.
enum:
- Available
- Unavailable
type: string
type: object
status:
description: Status is the current status of the Kuma MeshService resource.
Expand All @@ -92,6 +100,19 @@ properties:
type: string
type: object
type: array
dataplaneProxies:
description: Data plane proxies statistics selected by this MeshService.
properties:
connected:
description: Number of data plane proxies connected to the zone control plane
type: integer
healthy:
description: Number of data plane proxies with all healthy inbounds selected by this MeshService.
type: integer
total:
description: Total number of data plane proxies.
type: integer
type: object
hostnameGenerators:
items:
properties:
Expand Down
Loading

0 comments on commit 11aa52a

Please sign in to comment.