Skip to content

Commit

Permalink
Merge pull request #3104 from benmoss/observed-generation
Browse files Browse the repository at this point in the history
✨ Add observed generation to all relevant objects
  • Loading branch information
k8s-ci-robot authored May 29, 2020
2 parents 87c0343 + 6f8a777 commit 256bfc0
Show file tree
Hide file tree
Showing 14 changed files with 51 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/v1alpha2/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func (src *Cluster) ConvertTo(dstRaw conversion.Hub) error {
dst.Status.FailureDomains = restored.Status.FailureDomains
dst.Spec.Paused = restored.Spec.Paused
dst.Status.Conditions = restored.Status.Conditions
dst.Status.ObservedGeneration = restored.Status.ObservedGeneration

return nil
}
Expand Down Expand Up @@ -116,6 +117,7 @@ func (src *Machine) ConvertTo(dstRaw conversion.Hub) error {
return err
}
restoreMachineSpec(&restored.Spec, &dst.Spec)
dst.Status.ObservedGeneration = restored.Status.ObservedGeneration

return nil
}
Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha2/zz_generated.conversion.go

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

4 changes: 4 additions & 0 deletions api/v1alpha3/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ type ClusterStatus struct {
// Conditions defines current service state of the cluster.
// +optional
Conditions Conditions `json:"conditions,omitempty"`

// ObservedGeneration is the latest generation observed by the controller.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

// ANCHOR_END: ClusterStatus
Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha3/machine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ type MachineStatus struct {
// InfrastructureReady is the state of the infrastructure provider.
// +optional
InfrastructureReady bool `json:"infrastructureReady"`

// ObservedGeneration is the latest generation observed by the controller.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

// ANCHOR_END: MachineStatus
Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha3/machinehealthcheck_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ type MachineHealthCheckStatus struct {
// total number of healthy machines counted by this machine health check
// +kubebuilder:validation:Minimum=0
CurrentHealthy int32 `json:"currentHealthy,omitempty"`

// ObservedGeneration is the latest generation observed by the controller.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

// ANCHOR_END: MachineHealthCheckStatus
Expand Down
1 change: 1 addition & 0 deletions bootstrap/kubeadm/api/v1alpha2/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func (src *KubeadmConfig) ConvertTo(dstRaw conversion.Hub) error {
}

dst.Status.DataSecretName = restored.Status.DataSecretName
dst.Status.ObservedGeneration = restored.Status.ObservedGeneration
dst.Spec.Verbosity = restored.Spec.Verbosity
dst.Spec.UseExperimentalRetryJoin = restored.Spec.UseExperimentalRetryJoin
dst.Spec.Files = restored.Spec.Files
Expand Down
1 change: 1 addition & 0 deletions bootstrap/kubeadm/api/v1alpha2/zz_generated.conversion.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 @@ -112,6 +112,10 @@ type KubeadmConfigStatus struct {
// FailureMessage will be set on non-retryable errors
// +optional
FailureMessage string `json:"failureMessage,omitempty"`

// ObservedGeneration is the latest generation observed by the controller.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,11 @@ spec:
failureReason:
description: FailureReason will be set on non-retryable errors
type: string
observedGeneration:
description: ObservedGeneration is the latest generation observed
by the controller.
format: int64
type: integer
ready:
description: Ready indicates the BootstrapData field is ready to be
consumed
Expand Down
5 changes: 5 additions & 0 deletions config/crd/bases/cluster.x-k8s.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,11 @@ spec:
description: InfrastructureReady is the state of the infrastructure
provider.
type: boolean
observedGeneration:
description: ObservedGeneration is the latest generation observed
by the controller.
format: int64
type: integer
phase:
description: Phase represents the current phase of cluster actuation.
E.g. Pending, Running, Terminating, Failed etc.
Expand Down
5 changes: 5 additions & 0 deletions config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ spec:
format: int32
minimum: 0
type: integer
observedGeneration:
description: ObservedGeneration is the latest generation observed
by the controller.
format: int64
type: integer
type: object
type: object
served: true
Expand Down
5 changes: 5 additions & 0 deletions config/crd/bases/cluster.x-k8s.io_machines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,11 @@ spec:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
observedGeneration:
description: ObservedGeneration is the latest generation observed
by the controller.
format: int64
type: integer
phase:
description: Phase represents the current phase of machine actuation.
E.g. Pending, Running, Terminating, Failed etc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ type KubeadmControlPlaneStatus struct {
// state, and will be set to a descriptive error message.
// +optional
FailureMessage *string `json:"failureMessage,omitempty"`

// ObservedGeneration is the latest generation observed by the controller.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,11 @@ spec:
description: Initialized denotes whether or not the control plane
has the uploaded kubeadm-config configmap.
type: boolean
observedGeneration:
description: ObservedGeneration is the latest generation observed
by the controller.
format: int64
type: integer
ready:
description: Ready denotes that the KubeadmControlPlane API Server
is ready to receive requests.
Expand Down

0 comments on commit 256bfc0

Please sign in to comment.