From a875317c204331399e3bb5ea14570c08eb6c59c2 Mon Sep 17 00:00:00 2001 From: Dax McDonald Date: Fri, 28 Jun 2019 18:02:49 -0700 Subject: [PATCH] Add DeleteNotReadyAfterSecs to nodepool spec This enables deleting nodes after they have been unreachable for a configurable amount of time --- apis/management.cattle.io/v3/machine_types.go | 4 + .../management/v3/zz_generated_node_pool.go | 96 ++++++++++--------- .../v3/zz_generated_node_pool_spec.go | 44 +++++---- 3 files changed, 76 insertions(+), 68 deletions(-) diff --git a/apis/management.cattle.io/v3/machine_types.go b/apis/management.cattle.io/v3/machine_types.go index 7f9fcdc3..fae20a17 100644 --- a/apis/management.cattle.io/v3/machine_types.go +++ b/apis/management.cattle.io/v3/machine_types.go @@ -1,6 +1,8 @@ package v3 import ( + "time" + "github.com/rancher/norman/condition" "github.com/rancher/norman/types" v1 "k8s.io/api/core/v1" @@ -152,6 +154,8 @@ type NodePoolSpec struct { DisplayName string `json:"displayName"` ClusterName string `json:"clusterName,omitempty" norman:"type=reference[cluster],noupdate,required"` + + DeleteNotReadyAfterSecs time.Duration `json:"deleteNotReadyAfterSecs" norman:"default=0"` } type NodePoolStatus struct { diff --git a/client/management/v3/zz_generated_node_pool.go b/client/management/v3/zz_generated_node_pool.go index 4857cb83..75858c56 100644 --- a/client/management/v3/zz_generated_node_pool.go +++ b/client/management/v3/zz_generated_node_pool.go @@ -5,57 +5,59 @@ import ( ) const ( - NodePoolType = "nodePool" - NodePoolFieldAnnotations = "annotations" - NodePoolFieldClusterID = "clusterId" - NodePoolFieldControlPlane = "controlPlane" - NodePoolFieldCreated = "created" - NodePoolFieldCreatorID = "creatorId" - NodePoolFieldDisplayName = "displayName" - NodePoolFieldEtcd = "etcd" - NodePoolFieldHostnamePrefix = "hostnamePrefix" - NodePoolFieldLabels = "labels" - NodePoolFieldName = "name" - NodePoolFieldNamespaceId = "namespaceId" - NodePoolFieldNodeAnnotations = "nodeAnnotations" - NodePoolFieldNodeLabels = "nodeLabels" - NodePoolFieldNodeTemplateID = "nodeTemplateId" - NodePoolFieldOwnerReferences = "ownerReferences" - NodePoolFieldQuantity = "quantity" - NodePoolFieldRemoved = "removed" - NodePoolFieldState = "state" - NodePoolFieldStatus = "status" - NodePoolFieldTransitioning = "transitioning" - NodePoolFieldTransitioningMessage = "transitioningMessage" - NodePoolFieldUUID = "uuid" - NodePoolFieldWorker = "worker" + NodePoolType = "nodePool" + NodePoolFieldAnnotations = "annotations" + NodePoolFieldClusterID = "clusterId" + NodePoolFieldControlPlane = "controlPlane" + NodePoolFieldCreated = "created" + NodePoolFieldCreatorID = "creatorId" + NodePoolFieldDeleteNotReadyAfterSecs = "deleteNotReadyAfterSecs" + NodePoolFieldDisplayName = "displayName" + NodePoolFieldEtcd = "etcd" + NodePoolFieldHostnamePrefix = "hostnamePrefix" + NodePoolFieldLabels = "labels" + NodePoolFieldName = "name" + NodePoolFieldNamespaceId = "namespaceId" + NodePoolFieldNodeAnnotations = "nodeAnnotations" + NodePoolFieldNodeLabels = "nodeLabels" + NodePoolFieldNodeTemplateID = "nodeTemplateId" + NodePoolFieldOwnerReferences = "ownerReferences" + NodePoolFieldQuantity = "quantity" + NodePoolFieldRemoved = "removed" + NodePoolFieldState = "state" + NodePoolFieldStatus = "status" + NodePoolFieldTransitioning = "transitioning" + NodePoolFieldTransitioningMessage = "transitioningMessage" + NodePoolFieldUUID = "uuid" + NodePoolFieldWorker = "worker" ) type NodePool struct { types.Resource - Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"` - ClusterID string `json:"clusterId,omitempty" yaml:"clusterId,omitempty"` - ControlPlane bool `json:"controlPlane,omitempty" yaml:"controlPlane,omitempty"` - Created string `json:"created,omitempty" yaml:"created,omitempty"` - CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"` - DisplayName string `json:"displayName,omitempty" yaml:"displayName,omitempty"` - Etcd bool `json:"etcd,omitempty" yaml:"etcd,omitempty"` - HostnamePrefix string `json:"hostnamePrefix,omitempty" yaml:"hostnamePrefix,omitempty"` - Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` - Name string `json:"name,omitempty" yaml:"name,omitempty"` - NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"` - NodeAnnotations map[string]string `json:"nodeAnnotations,omitempty" yaml:"nodeAnnotations,omitempty"` - NodeLabels map[string]string `json:"nodeLabels,omitempty" yaml:"nodeLabels,omitempty"` - NodeTemplateID string `json:"nodeTemplateId,omitempty" yaml:"nodeTemplateId,omitempty"` - OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"` - Quantity int64 `json:"quantity,omitempty" yaml:"quantity,omitempty"` - Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` - State string `json:"state,omitempty" yaml:"state,omitempty"` - Status *NodePoolStatus `json:"status,omitempty" yaml:"status,omitempty"` - Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` - TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioningMessage,omitempty"` - UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` - Worker bool `json:"worker,omitempty" yaml:"worker,omitempty"` + Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"` + ClusterID string `json:"clusterId,omitempty" yaml:"clusterId,omitempty"` + ControlPlane bool `json:"controlPlane,omitempty" yaml:"controlPlane,omitempty"` + Created string `json:"created,omitempty" yaml:"created,omitempty"` + CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"` + DeleteNotReadyAfterSecs int64 `json:"deleteNotReadyAfterSecs,omitempty" yaml:"deleteNotReadyAfterSecs,omitempty"` + DisplayName string `json:"displayName,omitempty" yaml:"displayName,omitempty"` + Etcd bool `json:"etcd,omitempty" yaml:"etcd,omitempty"` + HostnamePrefix string `json:"hostnamePrefix,omitempty" yaml:"hostnamePrefix,omitempty"` + Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"` + NodeAnnotations map[string]string `json:"nodeAnnotations,omitempty" yaml:"nodeAnnotations,omitempty"` + NodeLabels map[string]string `json:"nodeLabels,omitempty" yaml:"nodeLabels,omitempty"` + NodeTemplateID string `json:"nodeTemplateId,omitempty" yaml:"nodeTemplateId,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"` + Quantity int64 `json:"quantity,omitempty" yaml:"quantity,omitempty"` + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + State string `json:"state,omitempty" yaml:"state,omitempty"` + Status *NodePoolStatus `json:"status,omitempty" yaml:"status,omitempty"` + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioningMessage,omitempty"` + UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + Worker bool `json:"worker,omitempty" yaml:"worker,omitempty"` } type NodePoolCollection struct { diff --git a/client/management/v3/zz_generated_node_pool_spec.go b/client/management/v3/zz_generated_node_pool_spec.go index feb36c58..496bd902 100644 --- a/client/management/v3/zz_generated_node_pool_spec.go +++ b/client/management/v3/zz_generated_node_pool_spec.go @@ -1,28 +1,30 @@ package client const ( - NodePoolSpecType = "nodePoolSpec" - NodePoolSpecFieldClusterID = "clusterId" - NodePoolSpecFieldControlPlane = "controlPlane" - NodePoolSpecFieldDisplayName = "displayName" - NodePoolSpecFieldEtcd = "etcd" - NodePoolSpecFieldHostnamePrefix = "hostnamePrefix" - NodePoolSpecFieldNodeAnnotations = "nodeAnnotations" - NodePoolSpecFieldNodeLabels = "nodeLabels" - NodePoolSpecFieldNodeTemplateID = "nodeTemplateId" - NodePoolSpecFieldQuantity = "quantity" - NodePoolSpecFieldWorker = "worker" + NodePoolSpecType = "nodePoolSpec" + NodePoolSpecFieldClusterID = "clusterId" + NodePoolSpecFieldControlPlane = "controlPlane" + NodePoolSpecFieldDeleteNotReadyAfterSecs = "deleteNotReadyAfterSecs" + NodePoolSpecFieldDisplayName = "displayName" + NodePoolSpecFieldEtcd = "etcd" + NodePoolSpecFieldHostnamePrefix = "hostnamePrefix" + NodePoolSpecFieldNodeAnnotations = "nodeAnnotations" + NodePoolSpecFieldNodeLabels = "nodeLabels" + NodePoolSpecFieldNodeTemplateID = "nodeTemplateId" + NodePoolSpecFieldQuantity = "quantity" + NodePoolSpecFieldWorker = "worker" ) type NodePoolSpec struct { - ClusterID string `json:"clusterId,omitempty" yaml:"clusterId,omitempty"` - ControlPlane bool `json:"controlPlane,omitempty" yaml:"controlPlane,omitempty"` - DisplayName string `json:"displayName,omitempty" yaml:"displayName,omitempty"` - Etcd bool `json:"etcd,omitempty" yaml:"etcd,omitempty"` - HostnamePrefix string `json:"hostnamePrefix,omitempty" yaml:"hostnamePrefix,omitempty"` - NodeAnnotations map[string]string `json:"nodeAnnotations,omitempty" yaml:"nodeAnnotations,omitempty"` - NodeLabels map[string]string `json:"nodeLabels,omitempty" yaml:"nodeLabels,omitempty"` - NodeTemplateID string `json:"nodeTemplateId,omitempty" yaml:"nodeTemplateId,omitempty"` - Quantity int64 `json:"quantity,omitempty" yaml:"quantity,omitempty"` - Worker bool `json:"worker,omitempty" yaml:"worker,omitempty"` + ClusterID string `json:"clusterId,omitempty" yaml:"clusterId,omitempty"` + ControlPlane bool `json:"controlPlane,omitempty" yaml:"controlPlane,omitempty"` + DeleteNotReadyAfterSecs int64 `json:"deleteNotReadyAfterSecs,omitempty" yaml:"deleteNotReadyAfterSecs,omitempty"` + DisplayName string `json:"displayName,omitempty" yaml:"displayName,omitempty"` + Etcd bool `json:"etcd,omitempty" yaml:"etcd,omitempty"` + HostnamePrefix string `json:"hostnamePrefix,omitempty" yaml:"hostnamePrefix,omitempty"` + NodeAnnotations map[string]string `json:"nodeAnnotations,omitempty" yaml:"nodeAnnotations,omitempty"` + NodeLabels map[string]string `json:"nodeLabels,omitempty" yaml:"nodeLabels,omitempty"` + NodeTemplateID string `json:"nodeTemplateId,omitempty" yaml:"nodeTemplateId,omitempty"` + Quantity int64 `json:"quantity,omitempty" yaml:"quantity,omitempty"` + Worker bool `json:"worker,omitempty" yaml:"worker,omitempty"` }