Skip to content

Commit

Permalink
Add unavailableReplicas to Function CRD
Browse files Browse the repository at this point in the history
The unavailableReplicas helps show when a function cannot
fully progress due to some issue in the cluster.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed May 28, 2024
1 parent 7ffa78b commit 72ee772
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 15 deletions.
12 changes: 10 additions & 2 deletions artifacts/crds/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -455,16 +455,21 @@ spec:
type: string
- jsonPath: .status.conditions[?(@.type == "Ready")].status
name: Ready
priority: 1
type: string
- jsonPath: .status.conditions[?(@.type == "Healthy")].status
name: Healthy
type: string
- jsonPath: .status.replicas
name: Replicas
type: string
type: integer
- jsonPath: .status.availableReplicas
name: Available
type: string
type: integer
- jsonPath: .status.unavailableReplicas
name: Unavailable
priority: 1
type: integer
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -618,6 +623,9 @@ spec:
replicas:
format: int32
type: integer
unavailableReplicas:
format: int32
type: integer
type: object
required:
- spec
Expand Down
12 changes: 10 additions & 2 deletions artifacts/crds/openfaas.com_functions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,21 @@ spec:
type: string
- jsonPath: .status.conditions[?(@.type == "Ready")].status
name: Ready
priority: 1
type: string
- jsonPath: .status.conditions[?(@.type == "Healthy")].status
name: Healthy
type: string
- jsonPath: .status.replicas
name: Replicas
type: string
type: integer
- jsonPath: .status.availableReplicas
name: Available
type: string
type: integer
- jsonPath: .status.unavailableReplicas
name: Unavailable
priority: 1
type: integer
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -185,6 +190,9 @@ spec:
replicas:
format: int32
type: integer
unavailableReplicas:
format: int32
type: integer
type: object
required:
- spec
Expand Down
12 changes: 10 additions & 2 deletions chart/openfaas/artifacts/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -455,16 +455,21 @@ spec:
type: string
- jsonPath: .status.conditions[?(@.type == "Ready")].status
name: Ready
priority: 1
type: string
- jsonPath: .status.conditions[?(@.type == "Healthy")].status
name: Healthy
type: string
- jsonPath: .status.replicas
name: Replicas
type: string
type: integer
- jsonPath: .status.availableReplicas
name: Available
type: string
type: integer
- jsonPath: .status.unavailableReplicas
name: Unavailable
priority: 1
type: integer
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -618,6 +623,9 @@ spec:
replicas:
format: int32
type: integer
unavailableReplicas:
format: int32
type: integer
type: object
required:
- spec
Expand Down
12 changes: 10 additions & 2 deletions chart/openfaas/templates/openfaas.com_functions-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,21 @@ spec:
type: string
- jsonPath: .status.conditions[?(@.type == "Ready")].status
name: Ready
priority: 1
type: string
- jsonPath: .status.conditions[?(@.type == "Healthy")].status
name: Healthy
type: string
- jsonPath: .status.replicas
name: Replicas
type: string
type: integer
- jsonPath: .status.availableReplicas
name: Available
type: string
type: integer
- jsonPath: .status.unavailableReplicas
name: Unavailable
priority: 1
type: integer
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -187,6 +192,9 @@ spec:
replicas:
format: int32
type: integer
unavailableReplicas:
format: int32
type: integer
type: object
required:
- spec
Expand Down
12 changes: 8 additions & 4 deletions pkg/apis/openfaas/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import (
// +kubebuilder:subresource:status
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:printcolumn:name="Image",type=string,JSONPath=`.spec.image`
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type == "Ready")].status`
// +kubebuilder:printcolumn:name="Healthy",type=string,JSONPath=`.status.conditions[?(@.type == "Healthy")].status`
// +kubebuilder:printcolumn:name="Replicas",type=string,JSONPath=`.status.replicas`
// +kubebuilder:printcolumn:name="Available",type=string,JSONPath=`.status.availableReplicas`
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type == "Ready")].status`,priority=1,description="The function's desired state has been applied by the controller"
// +kubebuilder:printcolumn:name="Healthy",type=string,JSONPath=`.status.conditions[?(@.type == "Healthy")].status`,description="All replicas of the function's desired state are available to serve traffic"
// +kubebuilder:printcolumn:name="Replicas",type=integer,JSONPath=`.status.replicas`,description="The desired number of replicas"
// +kubebuilder:printcolumn:name="Available",type=integer,JSONPath=`.status.availableReplicas`
// +kubebuilder:printcolumn:name="Unavailable",type=integer,JSONPath=`.status.unavailableReplicas`,priority=1

// Function describes an OpenFaaS function
type Function struct {
Expand Down Expand Up @@ -78,6 +79,9 @@ type FunctionStatus struct {

// +optional
AvailableReplicas int32 `json:"availableReplicas,omitempty"`

// +optional
UnavailableReplicas int32 `json:"unavailableReplicas,omitempty"`
}

// +genclient
Expand Down
15 changes: 12 additions & 3 deletions pkg/client/applyconfiguration/openfaas/v1/functionstatus.go

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

0 comments on commit 72ee772

Please sign in to comment.