From 3e0d97160821b7bbd000ebe29a9ed0cc871e472a Mon Sep 17 00:00:00 2001 From: "Vikas Choudhary (vikasc)" Date: Thu, 31 Jan 2019 01:18:49 +0530 Subject: [PATCH] Extend MachineStatus to add ProviderID (#565) --- pkg/apis/cluster/v1alpha1/machine_types.go | 13 +++++++++++++ pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/pkg/apis/cluster/v1alpha1/machine_types.go b/pkg/apis/cluster/v1alpha1/machine_types.go index 57453cfda1be..02df8c021e1b 100644 --- a/pkg/apis/cluster/v1alpha1/machine_types.go +++ b/pkg/apis/cluster/v1alpha1/machine_types.go @@ -78,6 +78,19 @@ type MachineSpec struct { // as-is. // +optional ConfigSource *corev1.NodeConfigSource `json:"configSource,omitempty"` + + // ProviderID is the identification ID of the machine provided by the provider. + // This field must match the provider ID as seen on the node object corresponding to this machine. + // This field is required by higher level consumers of cluster-api. Example use case is cluster autoscaler + // with cluster-api as provider. Clean-up login in the autoscaler compares machines v/s nodes to find out + // machines at provider which could not get registered as Kubernetes nodes. With cluster-api as a + // generic out-of-tree provider for autoscaler, this field is required by autoscaler to be + // able to have a provider view of the list of machines. Another list of nodes is queries from the k8s apiserver + // and then comparison is done to find out unregistered machines and are marked for delete. + // This field will be set by the actuators and consumed by higher level entities like autoscaler who will + // be interfacing with cluster-api as generic provider. + // +optional + ProviderID *string `json:"providerID,omitempty"` } /// [MachineSpec] diff --git a/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go index 9b0a0352080a..643a51be65c5 100644 --- a/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go @@ -638,6 +638,11 @@ func (in *MachineSpec) DeepCopyInto(out *MachineSpec) { *out = new(v1.NodeConfigSource) (*in).DeepCopyInto(*out) } + if in.ProviderID != nil { + in, out := &in.ProviderID, &out.ProviderID + *out = new(string) + **out = **in + } return }