Skip to content

Commit

Permalink
Add node-conditions to the MachineStatus (#483)
Browse files Browse the repository at this point in the history
* Add node-conditions to the MachineStatus

* Improve comments for node-conditions api
  • Loading branch information
hardikdr authored and k8s-ci-robot committed Aug 23, 2018
1 parent 3603557 commit 2d1ad4c
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 88 deletions.
8 changes: 8 additions & 0 deletions pkg/apis/cluster/v1alpha1/machine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ type MachineStatus struct {
// Addresses is a list of addresses assigned to the machine. Queried from cloud provider, if available.
// +optional
Addresses []corev1.NodeAddress `json:"addresses,omitempty"`

// List of conditions synced from the node conditions of the corresponding node-object.
// Machine-controller is responsible for keeping conditions up-to-date.
// MachineSet controller will be taking these conditions as a signal to decide if
// machine is healthy or needs to be replaced.
// Refer: https://kubernetes.io/docs/concepts/architecture/nodes/#condition
// +optional
Conditions []corev1.NodeCondition `json:"conditions,omitempty"`
}

type MachineVersionInfo struct {
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/cluster/v1alpha1/zz_generated.conversion.go

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

7 changes: 7 additions & 0 deletions pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go

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

175 changes: 88 additions & 87 deletions pkg/apis/cluster/zz_generated.api.register.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,66 +118,42 @@ func Resource(resource string) schema.GroupResource {
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type Cluster struct {
type MachineDeployment struct {
metav1.TypeMeta
metav1.ObjectMeta
Spec ClusterSpec
Status ClusterStatus
Spec MachineDeploymentSpec
Status MachineDeploymentStatus
}

// +genclient
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type MachineSet struct {
type Machine struct {
metav1.TypeMeta
metav1.ObjectMeta
Spec MachineSetSpec
Status MachineSetStatus
}

type ClusterStatus struct {
APIEndpoints []APIEndpoint
ErrorReason clustercommon.ClusterStatusError
ErrorMessage string
ProviderStatus *pkgruntime.RawExtension
}

type MachineSetStatus struct {
Replicas int32
FullyLabeledReplicas int32
ReadyReplicas int32
AvailableReplicas int32
ObservedGeneration int64
ErrorReason *clustercommon.MachineSetStatusError
ErrorMessage *string
}

type APIEndpoint struct {
Host string
Port int
}

type MachineSetSpec struct {
Replicas *int32
MinReadySeconds int32
Selector metav1.LabelSelector
Template MachineTemplateSpec
}

type ClusterSpec struct {
ClusterNetwork ClusterNetworkingConfig
ProviderConfig ProviderConfig
Spec MachineSpec
Status MachineStatus
}

type MachineTemplateSpec struct {
metav1.ObjectMeta
Spec MachineSpec
type MachineDeploymentStatus struct {
ObservedGeneration int64
Replicas int32
UpdatedReplicas int32
ReadyReplicas int32
AvailableReplicas int32
UnavailableReplicas int32
}

type ProviderConfig struct {
Value *pkgruntime.RawExtension
ValueFrom *ProviderConfigSource
type MachineStatus struct {
NodeRef *corev1.ObjectReference
LastUpdated metav1.Time
Versions *MachineVersionInfo
ErrorReason *clustercommon.MachineStatusError
ErrorMessage *string
ProviderStatus *pkgruntime.RawExtension
Addresses []corev1.NodeAddress
Conditions []corev1.NodeCondition
}

type MachineSpec struct {
Expand All @@ -188,42 +164,14 @@ type MachineSpec struct {
ConfigSource *corev1.NodeConfigSource
}

type ProviderConfigSource struct {
}

type MachineVersionInfo struct {
Kubelet string
ControlPlane string
}

type ClusterNetworkingConfig struct {
Services NetworkRanges
Pods NetworkRanges
ServiceDomain string
}

// +genclient
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type MachineDeployment struct {
metav1.TypeMeta
metav1.ObjectMeta
Spec MachineDeploymentSpec
Status MachineDeploymentStatus
}

type NetworkRanges struct {
CIDRBlocks []string
}

type MachineDeploymentStatus struct {
ObservedGeneration int64
Replicas int32
UpdatedReplicas int32
ReadyReplicas int32
AvailableReplicas int32
UnavailableReplicas int32
type ProviderConfig struct {
Value *pkgruntime.RawExtension
ValueFrom *ProviderConfigSource
}

type MachineDeploymentSpec struct {
Expand All @@ -237,11 +185,19 @@ type MachineDeploymentSpec struct {
ProgressDeadlineSeconds *int32
}

type ProviderConfigSource struct {
}

type MachineDeploymentStrategy struct {
Type clustercommon.MachineDeploymentStrategyType
RollingUpdate *MachineRollingUpdateDeployment
}

type MachineTemplateSpec struct {
metav1.ObjectMeta
Spec MachineSpec
}

type MachineRollingUpdateDeployment struct {
MaxUnavailable *utilintstr.IntOrString
MaxSurge *utilintstr.IntOrString
Expand All @@ -251,21 +207,66 @@ type MachineRollingUpdateDeployment struct {
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type Machine struct {
type Cluster struct {
metav1.TypeMeta
metav1.ObjectMeta
Spec MachineSpec
Status MachineStatus
Spec ClusterSpec
Status ClusterStatus
}

type MachineStatus struct {
NodeRef *corev1.ObjectReference
LastUpdated metav1.Time
Versions *MachineVersionInfo
ErrorReason *clustercommon.MachineStatusError
ErrorMessage *string
// +genclient
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type MachineSet struct {
metav1.TypeMeta
metav1.ObjectMeta
Spec MachineSetSpec
Status MachineSetStatus
}

type ClusterStatus struct {
APIEndpoints []APIEndpoint
ErrorReason clustercommon.ClusterStatusError
ErrorMessage string
ProviderStatus *pkgruntime.RawExtension
Addresses []corev1.NodeAddress
}

type MachineSetStatus struct {
Replicas int32
FullyLabeledReplicas int32
ReadyReplicas int32
AvailableReplicas int32
ObservedGeneration int64
ErrorReason *clustercommon.MachineSetStatusError
ErrorMessage *string
}

type APIEndpoint struct {
Host string
Port int
}

type MachineSetSpec struct {
Replicas *int32
MinReadySeconds int32
Selector metav1.LabelSelector
Template MachineTemplateSpec
}

type ClusterSpec struct {
ClusterNetwork ClusterNetworkingConfig
ProviderConfig ProviderConfig
}

type ClusterNetworkingConfig struct {
Services NetworkRanges
Pods NetworkRanges
ServiceDomain string
}

type NetworkRanges struct {
CIDRBlocks []string
}

//
Expand Down
7 changes: 7 additions & 0 deletions pkg/apis/cluster/zz_generated.deepcopy.go

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

15 changes: 14 additions & 1 deletion pkg/openapi/openapi_generated.go

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

0 comments on commit 2d1ad4c

Please sign in to comment.