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

Report the lowest running version in the status of each resource #3489

Merged
merged 5 commits into from
Jul 22, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
37 changes: 32 additions & 5 deletions config/crds/all-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -423,15 +423,15 @@ spec:
description: ApmServerStatus defines the observed state of ApmServer
properties:
availableNodes:
description: AvailableNodes is the number of available instances.
format: int32
type: integer
elasticsearchAssociationStatus:
description: ElasticsearchAssociationStatus is the status of any auto-linking
to Elasticsearch clusters.
type: string
health:
description: ApmServerHealth expresses the status of the Apm Server
instances.
description: Health of the deployment.
type: string
kibanaAssociationStatus:
description: KibanaAssociationStatus is the status of any auto-linking
Expand All @@ -445,6 +445,11 @@ spec:
description: ExternalService is the name of the service the agents should
connect to.
type: string
version:
description: 'Version of the stack resource currently running. During
version upgrades, multiple versions may run in parallel: this value
specifies the lowest version currently running.'
type: string
type: object
version: v1
versions:
Expand Down Expand Up @@ -665,6 +670,11 @@ spec:
kibanaAssociationStatus:
description: AssociationStatus is the status of an association resource.
type: string
version:
description: 'Version of the stack resource currently running. During
version upgrades, multiple versions may run in parallel: this value
specifies the lowest version currently running.'
type: string
type: object
version: v1beta1
versions:
Expand Down Expand Up @@ -1718,6 +1728,7 @@ spec:
description: ElasticsearchStatus defines the observed state of Elasticsearch
properties:
availableNodes:
description: AvailableNodes is the number of available instances.
format: int32
type: integer
health:
Expand All @@ -1728,6 +1739,11 @@ spec:
description: ElasticsearchOrchestrationPhase is the phase Elasticsearch
is in from the controller point of view.
type: string
version:
description: 'Version of the stack resource currently running. During
version upgrades, multiple versions may run in parallel: this value
specifies the lowest version currently running.'
type: string
type: object
version: v1
versions:
Expand Down Expand Up @@ -2135,16 +2151,21 @@ spec:
clusters.
type: string
availableNodes:
description: AvailableNodes is the number of available instances.
format: int32
type: integer
health:
description: EnterpriseSearchHealth expresses the health of the Enterprise
Search instances.
description: Health of the deployment.
type: string
service:
description: ExternalService is the name of the service associated to
the Enterprise Search Pods.
type: string
version:
description: 'Version of the stack resource currently running. During
version upgrades, multiple versions may run in parallel: this value
specifies the lowest version currently running.'
type: string
type: object
version: v1beta1
versions:
Expand Down Expand Up @@ -2570,10 +2591,16 @@ spec:
description: AssociationStatus is the status of an association resource.
type: string
availableNodes:
description: AvailableNodes is the number of available instances.
format: int32
type: integer
health:
description: KibanaHealth expresses the status of the Kibana instances.
description: Health of the deployment.
type: string
version:
description: 'Version of the stack resource currently running. During
version upgrades, multiple versions may run in parallel: this value
specifies the lowest version currently running.'
type: string
type: object
version: v1
Expand Down
9 changes: 7 additions & 2 deletions config/crds/bases/apm.k8s.elastic.co_apmservers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6319,15 +6319,15 @@ spec:
description: ApmServerStatus defines the observed state of ApmServer
properties:
availableNodes:
description: AvailableNodes is the number of available instances.
format: int32
type: integer
elasticsearchAssociationStatus:
description: ElasticsearchAssociationStatus is the status of any auto-linking
to Elasticsearch clusters.
type: string
health:
description: ApmServerHealth expresses the status of the Apm Server
instances.
description: Health of the deployment.
type: string
kibanaAssociationStatus:
description: KibanaAssociationStatus is the status of any auto-linking
Expand All @@ -6341,6 +6341,11 @@ spec:
description: ExternalService is the name of the service the agents
should connect to.
type: string
version:
description: 'Version of the stack resource currently running. During
version upgrades, multiple versions may run in parallel: this value
specifies the lowest version currently running.'
type: string
type: object
type: object
served: true
Expand Down
5 changes: 5 additions & 0 deletions config/crds/bases/beat.k8s.elastic.co_beats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12227,6 +12227,11 @@ spec:
kibanaAssociationStatus:
description: AssociationStatus is the status of an association resource.
type: string
version:
description: 'Version of the stack resource currently running. During
version upgrades, multiple versions may run in parallel: this value
specifies the lowest version currently running.'
type: string
type: object
type: object
version: v1beta1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7365,6 +7365,7 @@ spec:
description: ElasticsearchStatus defines the observed state of Elasticsearch
properties:
availableNodes:
description: AvailableNodes is the number of available instances.
format: int32
type: integer
health:
Expand All @@ -7375,6 +7376,11 @@ spec:
description: ElasticsearchOrchestrationPhase is the phase Elasticsearch
is in from the controller point of view.
type: string
version:
description: 'Version of the stack resource currently running. During
version upgrades, multiple versions may run in parallel: this value
specifies the lowest version currently running.'
type: string
type: object
type: object
served: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6149,16 +6149,21 @@ spec:
clusters.
type: string
availableNodes:
description: AvailableNodes is the number of available instances.
format: int32
type: integer
health:
description: EnterpriseSearchHealth expresses the health of the Enterprise
Search instances.
description: Health of the deployment.
type: string
service:
description: ExternalService is the name of the service associated to
the Enterprise Search Pods.
type: string
version:
description: 'Version of the stack resource currently running. During
version upgrades, multiple versions may run in parallel: this value
specifies the lowest version currently running.'
type: string
type: object
type: object
version: v1beta1
Expand Down
8 changes: 7 additions & 1 deletion config/crds/bases/kibana.k8s.elastic.co_kibanas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6305,10 +6305,16 @@ spec:
description: AssociationStatus is the status of an association resource.
type: string
availableNodes:
description: AvailableNodes is the number of available instances.
format: int32
type: integer
health:
description: KibanaHealth expresses the status of the Kibana instances.
description: Health of the deployment.
type: string
version:
description: 'Version of the stack resource currently running. During
version upgrades, multiple versions may run in parallel: this value
specifies the lowest version currently running.'
type: string
type: object
type: object
Expand Down
2 changes: 2 additions & 0 deletions docs/reference/api-docs.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ ConfigSource references configuration settings.
|===




Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove?

Copy link
Contributor Author

@sebgl sebgl Jul 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know where it comes from, it is auto-generated this way 😕
I see other places in this file with a lot of empty lines.
@charith-elastic any idea?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They don't get rendered IIRC so I'm not sure it's worth spending too much time on

[id="{anchor_prefix}-github-com-elastic-cloud-on-k8s-pkg-apis-common-v1-httpconfig"]
=== HTTPConfig

Expand Down
37 changes: 32 additions & 5 deletions hack/manifest-gen/assets/charts/eck/crds/all-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -423,15 +423,15 @@ spec:
description: ApmServerStatus defines the observed state of ApmServer
properties:
availableNodes:
description: AvailableNodes is the number of available instances.
format: int32
type: integer
elasticsearchAssociationStatus:
description: ElasticsearchAssociationStatus is the status of any auto-linking
to Elasticsearch clusters.
type: string
health:
description: ApmServerHealth expresses the status of the Apm Server
instances.
description: Health of the deployment.
type: string
kibanaAssociationStatus:
description: KibanaAssociationStatus is the status of any auto-linking
Expand All @@ -445,6 +445,11 @@ spec:
description: ExternalService is the name of the service the agents should
connect to.
type: string
version:
description: 'Version of the stack resource currently running. During
version upgrades, multiple versions may run in parallel: this value
specifies the lowest version currently running.'
type: string
type: object
version: v1
versions:
Expand Down Expand Up @@ -665,6 +670,11 @@ spec:
kibanaAssociationStatus:
description: AssociationStatus is the status of an association resource.
type: string
version:
description: 'Version of the stack resource currently running. During
version upgrades, multiple versions may run in parallel: this value
specifies the lowest version currently running.'
type: string
type: object
version: v1beta1
versions:
Expand Down Expand Up @@ -1718,6 +1728,7 @@ spec:
description: ElasticsearchStatus defines the observed state of Elasticsearch
properties:
availableNodes:
description: AvailableNodes is the number of available instances.
format: int32
type: integer
health:
Expand All @@ -1728,6 +1739,11 @@ spec:
description: ElasticsearchOrchestrationPhase is the phase Elasticsearch
is in from the controller point of view.
type: string
version:
description: 'Version of the stack resource currently running. During
version upgrades, multiple versions may run in parallel: this value
specifies the lowest version currently running.'
type: string
type: object
version: v1
versions:
Expand Down Expand Up @@ -2135,16 +2151,21 @@ spec:
clusters.
type: string
availableNodes:
description: AvailableNodes is the number of available instances.
format: int32
type: integer
health:
description: EnterpriseSearchHealth expresses the health of the Enterprise
Search instances.
description: Health of the deployment.
type: string
service:
description: ExternalService is the name of the service associated to
the Enterprise Search Pods.
type: string
version:
description: 'Version of the stack resource currently running. During
version upgrades, multiple versions may run in parallel: this value
specifies the lowest version currently running.'
type: string
type: object
version: v1beta1
versions:
Expand Down Expand Up @@ -2570,10 +2591,16 @@ spec:
description: AssociationStatus is the status of an association resource.
type: string
availableNodes:
description: AvailableNodes is the number of available instances.
format: int32
type: integer
health:
description: KibanaHealth expresses the status of the Kibana instances.
description: Health of the deployment.
type: string
version:
description: 'Version of the stack resource currently running. During
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this has quotes around it while other descriptions don't?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think because it is spread over more than 1 line. I tested with a single line in the comment: quotes are removed.
So I think it's fine.

version upgrades, multiple versions may run in parallel: this value
specifies the lowest version currently running.'
type: string
type: object
version: v1
Expand Down
18 changes: 1 addition & 17 deletions pkg/apis/apm/v1/apmserver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,9 @@ type ApmServerSpec struct {
ServiceAccountName string `json:"serviceAccountName,omitempty"`
}

// ApmServerHealth expresses the status of the Apm Server instances.
type ApmServerHealth string

const (
// ApmServerRed means no instance is currently available.
ApmServerRed ApmServerHealth = "red"
// ApmServerGreen means at least one instance is available.
ApmServerGreen ApmServerHealth = "green"
)

// ApmServerStatus defines the observed state of ApmServer
type ApmServerStatus struct {
commonv1.ReconcilerStatus `json:",inline"`
Health ApmServerHealth `json:"health,omitempty"`
commonv1.DeploymentStatus `json:",inline"`
// ExternalService is the name of the service the agents should connect to.
ExternalService string `json:"service,omitempty"`
// SecretTokenSecretName is the name of the Secret that contains the secret token
Expand All @@ -76,11 +65,6 @@ type ApmServerStatus struct {
KibanaAssociationStatus commonv1.AssociationStatus `json:"kibanaAssociationStatus,omitempty"`
}

// IsDegraded returns true if the current status is worse than the previous.
func (as ApmServerStatus) IsDegraded(prev ApmServerStatus) bool {
return prev.Health == ApmServerGreen && as.Health != ApmServerGreen
}

// +kubebuilder:object:root=true

// ApmServer represents an APM Server resource in a Kubernetes cluster.
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/apm/v1/zz_generated.deepcopy.go

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

7 changes: 5 additions & 2 deletions pkg/apis/beat/v1beta1/beat_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,14 @@ type DeploymentSpec struct {

// BeatStatus defines the observed state of a Beat.
type BeatStatus struct {
// +kubebuilder:validation:Optional
commonv1.ReconcilerStatus `json:",inline"`
// Version of the stack resource currently running. During version upgrades, multiple versions may run
// in parallel: this value specifies the lowest version currently running.
Version string `json:"version,omitempty"`

// +kubebuilder:validation:Optional
ExpectedNodes int32 `json:"expectedNodes,omitempty"`
// +kubebuilder:validation:Optional
AvailableNodes int32 `json:"availableNodes,omitempty"`

// +kubebuilder:validation:Optional
Health BeatHealth `json:"health,omitempty"`
Expand Down
1 change: 0 additions & 1 deletion pkg/apis/beat/v1beta1/zz_generated.deepcopy.go

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

Loading