github.com/rancher/types@v0.0.0-20220328215343-4370ff10ecd5/apis/management.cattle.io/v3/machine_types.go (about)

     1  package v3
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/rancher/norman/condition"
     7  	"github.com/rancher/norman/types"
     8  	v1 "k8s.io/api/core/v1"
     9  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    10  )
    11  
    12  type NodeTemplate struct {
    13  	types.Namespaced
    14  
    15  	metav1.TypeMeta `json:",inline"`
    16  	// Standard object’s metadata. More info:
    17  	// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
    18  	metav1.ObjectMeta `json:"metadata,omitempty"`
    19  	// Specification of the desired behavior of the the cluster. More info:
    20  	// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
    21  	Spec NodeTemplateSpec `json:"spec"`
    22  	// Most recent observed status of the cluster. More info:
    23  	// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
    24  	Status NodeTemplateStatus `json:"status"`
    25  }
    26  
    27  type NodeTemplateStatus struct {
    28  	Conditions []NodeTemplateCondition `json:"conditions"`
    29  }
    30  
    31  type NodeTemplateCondition struct {
    32  	// Type of cluster condition.
    33  	Type string `json:"type"`
    34  	// Status of the condition, one of True, False, Unknown.
    35  	Status v1.ConditionStatus `json:"status"`
    36  	// The last time this condition was updated.
    37  	LastUpdateTime string `json:"lastUpdateTime,omitempty"`
    38  	// Last time the condition transitioned from one status to another.
    39  	LastTransitionTime string `json:"lastTransitionTime,omitempty"`
    40  	// The reason for the condition's last transition.
    41  	Reason string `json:"reason,omitempty"`
    42  }
    43  
    44  type NodeTemplateSpec struct {
    45  	DisplayName         string     `json:"displayName"`
    46  	Description         string     `json:"description"`
    47  	Driver              string     `json:"driver" norman:"nocreate,noupdate"`
    48  	CloudCredentialName string     `json:"cloudCredentialName" norman:"type=reference[cloudCredential]"`
    49  	NodeTaints          []v1.Taint `json:"nodeTaints,omitempty"`
    50  	NodeCommonParams    `json:",inline"`
    51  }
    52  
    53  type Node struct {
    54  	types.Namespaced
    55  
    56  	metav1.TypeMeta `json:",inline"`
    57  	// Standard object’s metadata. More info:
    58  	// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
    59  	metav1.ObjectMeta `json:"metadata,omitempty"`
    60  	// Specification of the desired behavior of the the cluster. More info:
    61  	// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
    62  	Spec NodeSpec `json:"spec"`
    63  	// Most recent observed status of the cluster. More info:
    64  	// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
    65  	Status NodeStatus `json:"status"`
    66  }
    67  
    68  func (in *Node) ObjClusterName() string {
    69  	return in.Namespace
    70  }
    71  
    72  type MetadataUpdate struct {
    73  	Labels      MapDelta `json:"labels,omitempty"`
    74  	Annotations MapDelta `json:"annotations,omitempty"`
    75  }
    76  
    77  type MapDelta struct {
    78  	Add    map[string]string `json:"add,omitempty"`
    79  	Delete map[string]bool   `json:"delete,omitempty"`
    80  }
    81  
    82  type NodeStatus struct {
    83  	Conditions         []NodeCondition   `json:"conditions,omitempty"`
    84  	InternalNodeStatus v1.NodeStatus     `json:"internalNodeStatus,omitempty"`
    85  	NodeName           string            `json:"nodeName,omitempty"`
    86  	Requested          v1.ResourceList   `json:"requested,omitempty"`
    87  	Limits             v1.ResourceList   `json:"limits,omitempty"`
    88  	NodeTemplateSpec   *NodeTemplateSpec `json:"nodeTemplateSpec,omitempty"`
    89  	NodeConfig         *RKEConfigNode    `json:"rkeNode,omitempty"`
    90  	NodeAnnotations    map[string]string `json:"nodeAnnotations,omitempty"`
    91  	NodeLabels         map[string]string `json:"nodeLabels,omitempty"`
    92  	NodeTaints         []v1.Taint        `json:"nodeTaints,omitempty"`
    93  	DockerInfo         *DockerInfo       `json:"dockerInfo,omitempty"`
    94  	NodePlan           *NodePlan         `json:"nodePlan,omitempty"`
    95  	AppliedNodeVersion int               `json:"appliedNodeVersion,omitempty"`
    96  }
    97  
    98  type DockerInfo struct {
    99  	ID                 string
   100  	Driver             string
   101  	Debug              bool
   102  	LoggingDriver      string
   103  	CgroupDriver       string
   104  	KernelVersion      string
   105  	OperatingSystem    string
   106  	OSType             string
   107  	Architecture       string
   108  	IndexServerAddress string
   109  	InitBinary         string
   110  	DockerRootDir      string
   111  	SecurityOptions    []string
   112  	HTTPProxy          string
   113  	HTTPSProxy         string
   114  	NoProxy            string
   115  	Name               string
   116  	Labels             []string
   117  	ExperimentalBuild  bool
   118  	ServerVersion      string
   119  }
   120  
   121  var (
   122  	NodeConditionInitialized condition.Cond = "Initialized"
   123  	NodeConditionProvisioned condition.Cond = "Provisioned"
   124  	NodeConditionUpdated     condition.Cond = "Updated"
   125  	NodeConditionRegistered  condition.Cond = "Registered"
   126  	NodeConditionRemoved     condition.Cond = "Removed"
   127  	NodeConditionConfigSaved condition.Cond = "Saved"
   128  	NodeConditionReady       condition.Cond = "Ready"
   129  	NodeConditionDrained     condition.Cond = "Drained"
   130  	NodeConditionUpgraded    condition.Cond = "Upgraded"
   131  )
   132  
   133  type NodeCondition struct {
   134  	// Type of cluster condition.
   135  	Type condition.Cond `json:"type"`
   136  	// Status of the condition, one of True, False, Unknown.
   137  	Status v1.ConditionStatus `json:"status"`
   138  	// The last time this condition was updated.
   139  	LastUpdateTime string `json:"lastUpdateTime,omitempty"`
   140  	// Last time the condition transitioned from one status to another.
   141  	LastTransitionTime string `json:"lastTransitionTime,omitempty"`
   142  	// The reason for the condition's last transition.
   143  	Reason string `json:"reason,omitempty"`
   144  	// Human-readable message indicating details about last transition
   145  	Message string `json:"message,omitempty"`
   146  }
   147  
   148  var (
   149  	NodePoolConditionUpdated condition.Cond = "Updated"
   150  )
   151  
   152  type NodePool struct {
   153  	types.Namespaced
   154  
   155  	metav1.TypeMeta `json:",inline"`
   156  	// Standard object’s metadata. More info:
   157  	// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
   158  	metav1.ObjectMeta `json:"metadata,omitempty"`
   159  
   160  	Spec   NodePoolSpec   `json:"spec"`
   161  	Status NodePoolStatus `json:"status"`
   162  }
   163  
   164  func (n *NodePool) ObjClusterName() string {
   165  	return n.Spec.ObjClusterName()
   166  }
   167  
   168  type NodePoolSpec struct {
   169  	Etcd             bool   `json:"etcd"`
   170  	ControlPlane     bool   `json:"controlPlane"`
   171  	Worker           bool   `json:"worker"`
   172  	NodeTemplateName string `json:"nodeTemplateName,omitempty" norman:"type=reference[nodeTemplate],required,notnullable"`
   173  
   174  	HostnamePrefix  string            `json:"hostnamePrefix" norman:"required,notnullable"`
   175  	Quantity        int               `json:"quantity" norman:"required,default=1"`
   176  	NodeLabels      map[string]string `json:"nodeLabels"`
   177  	NodeAnnotations map[string]string `json:"nodeAnnotations"`
   178  	NodeTaints      []v1.Taint        `json:"nodeTaints,omitempty"`
   179  
   180  	DisplayName string `json:"displayName"`
   181  	ClusterName string `json:"clusterName,omitempty" norman:"type=reference[cluster],noupdate,required"`
   182  
   183  	DeleteNotReadyAfterSecs time.Duration `json:"deleteNotReadyAfterSecs" norman:"default=0,max=31540000,min=0"`
   184  }
   185  
   186  func (n *NodePoolSpec) ObjClusterName() string {
   187  	return n.ClusterName
   188  }
   189  
   190  type NodePoolStatus struct {
   191  	Conditions []Condition `json:"conditions"`
   192  }
   193  
   194  type CustomConfig struct {
   195  	// IP or FQDN that is fully resolvable and used for SSH communication
   196  	Address string `yaml:"address" json:"address,omitempty"`
   197  	// Optional - Internal address that will be used for components communication
   198  	InternalAddress string `yaml:"internal_address" json:"internalAddress,omitempty"`
   199  	// SSH user that will be used by RKE
   200  	User string `yaml:"user" json:"user,omitempty"`
   201  	// Optional - Docker socket on the node that will be used in tunneling
   202  	DockerSocket string `yaml:"docker_socket" json:"dockerSocket,omitempty"`
   203  	// SSH Private Key
   204  	SSHKey string `yaml:"ssh_key" json:"sshKey,omitempty" norman:"type=password"`
   205  	// SSH Certificate
   206  	SSHCert string            `yaml:"ssh_cert" json:"sshCert,omitempty"`
   207  	Label   map[string]string `yaml:"label" json:"label,omitempty"`
   208  	Taints  []string          `yaml:"taints" json:"taints,omitempty"`
   209  }
   210  
   211  type NodeSpec struct {
   212  	// Common fields.  They aren't in a shared struct because the annotations are different
   213  
   214  	Etcd             bool   `json:"etcd" norman:"noupdate"`
   215  	ControlPlane     bool   `json:"controlPlane" norman:"noupdate"`
   216  	Worker           bool   `json:"worker" norman:"noupdate"`
   217  	NodeTemplateName string `json:"nodeTemplateName,omitempty" norman:"type=reference[nodeTemplate],noupdate"`
   218  
   219  	NodePoolName             string          `json:"nodePoolName" norman:"type=reference[nodePool],nocreate,noupdate"`
   220  	CustomConfig             *CustomConfig   `json:"customConfig"`
   221  	Imported                 bool            `json:"imported"`
   222  	Description              string          `json:"description,omitempty"`
   223  	DisplayName              string          `json:"displayName"`
   224  	RequestedHostname        string          `json:"requestedHostname,omitempty" norman:"type=hostname,nullable,noupdate,required"`
   225  	InternalNodeSpec         v1.NodeSpec     `json:"internalNodeSpec"`
   226  	DesiredNodeTaints        []v1.Taint      `json:"desiredNodeTaints"`
   227  	UpdateTaintsFromAPI      *bool           `json:"updateTaintsFromAPI,omitempty"`
   228  	DesiredNodeUnschedulable string          `json:"desiredNodeUnschedulable,omitempty"`
   229  	NodeDrainInput           *NodeDrainInput `json:"nodeDrainInput,omitempty"`
   230  	MetadataUpdate           MetadataUpdate  `json:"metadataUpdate,omitempty"`
   231  }
   232  
   233  type NodePlan struct {
   234  	Plan    *RKEConfigNodePlan `json:"plan,omitempty"`
   235  	Version int                `json:"version,omitempty"`
   236  	// current default in rancher-agent is 2m (120s)
   237  	AgentCheckInterval int `json:"agentCheckInterval,omitempty" norman:"min=1,max=1800,default=120"`
   238  }
   239  
   240  type NodeCommonParams struct {
   241  	AuthCertificateAuthority string            `json:"authCertificateAuthority,omitempty"`
   242  	AuthKey                  string            `json:"authKey,omitempty"`
   243  	EngineInstallURL         string            `json:"engineInstallURL,omitempty"`
   244  	DockerVersion            string            `json:"dockerVersion,omitempty"`
   245  	EngineOpt                map[string]string `json:"engineOpt,omitempty"`
   246  	EngineInsecureRegistry   []string          `json:"engineInsecureRegistry,omitempty"`
   247  	EngineRegistryMirror     []string          `json:"engineRegistryMirror,omitempty"`
   248  	EngineLabel              map[string]string `json:"engineLabel,omitempty"`
   249  	EngineStorageDriver      string            `json:"engineStorageDriver,omitempty"`
   250  	EngineEnv                map[string]string `json:"engineEnv,omitempty"`
   251  	UseInternalIPAddress     *bool             `json:"useInternalIpAddress,omitempty" norman:"default=true,noupdate"`
   252  }
   253  
   254  type NodeDriver struct {
   255  	metav1.TypeMeta `json:",inline"`
   256  	// Standard object’s metadata. More info:
   257  	// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
   258  	metav1.ObjectMeta `json:"metadata,omitempty"`
   259  	// Specification of the desired behavior of the the cluster. More info:
   260  	// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
   261  	Spec NodeDriverSpec `json:"spec"`
   262  	// Most recent observed status of the cluster. More info:
   263  	// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
   264  	Status NodeDriverStatus `json:"status"`
   265  }
   266  
   267  type NodeDriverStatus struct {
   268  	Conditions                  []Condition `json:"conditions"`
   269  	AppliedURL                  string      `json:"appliedURL"`
   270  	AppliedChecksum             string      `json:"appliedChecksum"`
   271  	AppliedDockerMachineVersion string      `json:"appliedDockerMachineVersion"`
   272  }
   273  
   274  var (
   275  	NodeDriverConditionDownloaded condition.Cond = "Downloaded"
   276  	NodeDriverConditionInstalled  condition.Cond = "Installed"
   277  	NodeDriverConditionActive     condition.Cond = "Active"
   278  	NodeDriverConditionInactive   condition.Cond = "Inactive"
   279  )
   280  
   281  type Condition struct {
   282  	// Type of cluster condition.
   283  	Type string `json:"type"`
   284  	// Status of the condition, one of True, False, Unknown.
   285  	Status v1.ConditionStatus `json:"status"`
   286  	// The last time this condition was updated.
   287  	LastUpdateTime string `json:"lastUpdateTime,omitempty"`
   288  	// Last time the condition transitioned from one status to another.
   289  	LastTransitionTime string `json:"lastTransitionTime,omitempty"`
   290  	// The reason for the condition's last transition.
   291  	Reason string `json:"reason,omitempty"`
   292  	// Human-readable message indicating details about last transition
   293  	Message string `json:"message,omitempty"`
   294  }
   295  
   296  type NodeDriverSpec struct {
   297  	DisplayName      string   `json:"displayName"`
   298  	Description      string   `json:"description"`
   299  	URL              string   `json:"url" norman:"required"`
   300  	ExternalID       string   `json:"externalId"`
   301  	Builtin          bool     `json:"builtin"`
   302  	Active           bool     `json:"active"`
   303  	Checksum         string   `json:"checksum"`
   304  	UIURL            string   `json:"uiUrl"`
   305  	WhitelistDomains []string `json:"whitelistDomains,omitempty"`
   306  }
   307  
   308  type PublicEndpoint struct {
   309  	NodeName  string   `json:"nodeName,omitempty" norman:"type=reference[/v3/schemas/node],nocreate,noupdate"`
   310  	Addresses []string `json:"addresses,omitempty" norman:"nocreate,noupdate"`
   311  	Port      int32    `json:"port,omitempty" norman:"nocreate,noupdate"`
   312  	Protocol  string   `json:"protocol,omitempty" norman:"nocreate,noupdate"`
   313  	// for node port service endpoint
   314  	ServiceName string `json:"serviceName,omitempty" norman:"type=reference[service],nocreate,noupdate"`
   315  	// for host port endpoint
   316  	PodName string `json:"podName,omitempty" norman:"type=reference[pod],nocreate,noupdate"`
   317  	// for ingress endpoint. ServiceName, podName, ingressName are mutually exclusive
   318  	IngressName string `json:"ingressName,omitempty" norman:"type=reference[ingress],nocreate,noupdate"`
   319  	// Hostname/path are set for Ingress endpoints
   320  	Hostname string `json:"hostname,omitempty" norman:"nocreate,noupdate"`
   321  	Path     string `json:"path,omitempty" norman:"nocreate,noupdate"`
   322  	// True when endpoint is exposed on every node
   323  	AllNodes bool `json:"allNodes" norman:"nocreate,noupdate"`
   324  }
   325  
   326  type NodeDrainInput struct {
   327  	// Drain node even if there are pods not managed by a ReplicationController, Job, or DaemonSet
   328  	// Drain will not proceed without Force set to true if there are such pods
   329  	Force bool `yaml:"force" json:"force,omitempty"`
   330  	// If there are DaemonSet-managed pods, drain will not proceed without IgnoreDaemonSets set to true
   331  	// (even when set to true, kubectl won't delete pods - so setting default to true)
   332  	IgnoreDaemonSets *bool `yaml:"ignore_daemonsets" json:"ignoreDaemonSets,omitempty" norman:"default=true"`
   333  	// Continue even if there are pods using emptyDir
   334  	DeleteLocalData bool `yaml:"delete_local_data" json:"deleteLocalData,omitempty"`
   335  	//Period of time in seconds given to each pod to terminate gracefully.
   336  	// If negative, the default value specified in the pod will be used
   337  	GracePeriod int `yaml:"grace_period" json:"gracePeriod,omitempty" norman:"default=-1"`
   338  	// Time to wait (in seconds) before giving up for one try
   339  	Timeout int `yaml:"timeout" json:"timeout" norman:"min=1,max=10800,default=120"`
   340  }
   341  
   342  type CloudCredential struct {
   343  	types.Namespaced
   344  
   345  	metav1.TypeMeta `json:",inline"`
   346  
   347  	metav1.ObjectMeta `json:"metadata,omitempty"`
   348  
   349  	Spec CloudCredentialSpec `json:"spec"`
   350  }
   351  
   352  type CloudCredentialSpec struct {
   353  	DisplayName string `json:"displayName"`
   354  	Description string `json:"description,omitempty"`
   355  }