Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support metad and graphd local pv failover #488

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion apis/apps/v1alpha1/nebulacluster_graphd.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,13 @@ func (c *graphdComponent) IsSuspended() bool {
}

func (c *graphdComponent) IsAutoFailovering() bool {
//TODO implement me
if len(c.nc.Status.Graphd.FailureHosts) == 0 {
return false
}
for _, failureHost := range c.nc.Status.Graphd.FailureHosts {
if !failureHost.ConfirmationTime.IsZero() {
return true
}
}
return false
}
9 changes: 8 additions & 1 deletion apis/apps/v1alpha1/nebulacluster_metad.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,13 @@ func (c *metadComponent) IsSuspended() bool {
}

func (c *metadComponent) IsAutoFailovering() bool {
//TODO implement me
if len(c.nc.Status.Metad.FailureHosts) == 0 {
return false
}
for _, failureHost := range c.nc.Status.Metad.FailureHosts {
if !failureHost.ConfirmationTime.IsZero() {
return true
}
}
return false
}
31 changes: 16 additions & 15 deletions apis/apps/v1alpha1/nebulacluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,22 +135,22 @@ type NebulaClusterStatus struct {

// ComponentStatus is the status and version of a nebula component.
type ComponentStatus struct {
Version string `json:"version,omitempty"`
Phase ComponentPhase `json:"phase,omitempty"`
Workload *WorkloadStatus `json:"workload,omitempty"`
Volume *VolumeStatus `json:"volume,omitempty"`
Version string `json:"version,omitempty"`
Phase ComponentPhase `json:"phase,omitempty"`
Workload *WorkloadStatus `json:"workload,omitempty"`
FailureHosts map[string]FailureHost `json:"failureHosts,omitempty"`
Volume *VolumeStatus `json:"volume,omitempty"`
}

// StoragedStatus describes the status and version of nebula storaged.
type StoragedStatus struct {
ComponentStatus `json:",inline"`
HostsAdded bool `json:"hostsAdded,omitempty"`
RemovedSpaces []int32 `json:"removedSpaces,omitempty"`
BalancedSpaces []int32 `json:"balancedSpaces,omitempty"`
LastBalanceJob *BalanceJob `json:"lastBalanceJob,omitempty"`
BalancedAfterFailover *bool `json:"balancedAfterFailover,omitempty"`
FailureHosts map[string]StoragedFailureHost `json:"failureHosts,omitempty"`
Volume *VolumeStatus `json:"volume,omitempty"`
ComponentStatus `json:",inline"`
HostsAdded bool `json:"hostsAdded,omitempty"`
RemovedSpaces []int32 `json:"removedSpaces,omitempty"`
BalancedSpaces []int32 `json:"balancedSpaces,omitempty"`
LastBalanceJob *BalanceJob `json:"lastBalanceJob,omitempty"`
FailureHosts map[string]FailureHost `json:"failureHosts,omitempty"`
Volume *VolumeStatus `json:"volume,omitempty"`
}

// BalanceJob describes the admin job for balance data.
Expand Down Expand Up @@ -180,11 +180,12 @@ type ProvisionedVolume struct {

type EmptyStruct struct{}

// StoragedFailureHost is the storaged failure host information.
type StoragedFailureHost struct {
// FailureHost is the failure host information.
type FailureHost struct {
Host string `json:"host,omitempty"`
PVCSet map[types.UID]EmptyStruct `json:"pvcSet,omitempty"`
HostDeleted bool `json:"hostDeleted,omitempty"`
HostDeleted *bool `json:"hostDeleted,omitempty"`
DataBalanced *bool `json:"dataBalanced,omitempty"`
PodRestarted bool `json:"podRestarted,omitempty"`
PodRebuilt bool `json:"podRebuilt,omitempty"`
NodeDown bool `json:"nodeDown,omitempty"`
Expand Down
74 changes: 43 additions & 31 deletions apis/apps/v1alpha1/zz_generated.deepcopy.go

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

64 changes: 62 additions & 2 deletions charts/nebula-operator/crds/nebulaclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11783,6 +11783,36 @@ spec:
type: array
graphd:
properties:
failureHosts:
additionalProperties:
properties:
confirmationTime:
format: date-time
type: string
creationTime:
format: date-time
type: string
dataBalanced:
type: boolean
deletionTime:
format: date-time
type: string
host:
type: string
hostDeleted:
type: boolean
nodeDown:
type: boolean
podRebuilt:
type: boolean
podRestarted:
type: boolean
pvcSet:
additionalProperties:
type: object
type: object
type: object
type: object
phase:
type: string
version:
Expand Down Expand Up @@ -11844,6 +11874,36 @@ spec:
type: object
metad:
properties:
failureHosts:
additionalProperties:
properties:
confirmationTime:
format: date-time
type: string
creationTime:
format: date-time
type: string
dataBalanced:
type: boolean
deletionTime:
format: date-time
type: string
host:
type: string
hostDeleted:
type: boolean
nodeDown:
type: boolean
podRebuilt:
type: boolean
podRestarted:
type: boolean
pvcSet:
additionalProperties:
type: object
type: object
type: object
type: object
phase:
type: string
version:
Expand Down Expand Up @@ -11908,8 +11968,6 @@ spec:
type: integer
storaged:
properties:
balancedAfterFailover:
type: boolean
balancedSpaces:
items:
format: int32
Expand All @@ -11924,6 +11982,8 @@ spec:
creationTime:
format: date-time
type: string
dataBalanced:
type: boolean
deletionTime:
format: date-time
type: string
Expand Down
64 changes: 62 additions & 2 deletions config/crd/bases/apps.nebula-graph.io_nebulaclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11783,6 +11783,36 @@ spec:
type: array
graphd:
properties:
failureHosts:
additionalProperties:
properties:
confirmationTime:
format: date-time
type: string
creationTime:
format: date-time
type: string
dataBalanced:
type: boolean
deletionTime:
format: date-time
type: string
host:
type: string
hostDeleted:
type: boolean
nodeDown:
type: boolean
podRebuilt:
type: boolean
podRestarted:
type: boolean
pvcSet:
additionalProperties:
type: object
type: object
type: object
type: object
phase:
type: string
version:
Expand Down Expand Up @@ -11844,6 +11874,36 @@ spec:
type: object
metad:
properties:
failureHosts:
additionalProperties:
properties:
confirmationTime:
format: date-time
type: string
creationTime:
format: date-time
type: string
dataBalanced:
type: boolean
deletionTime:
format: date-time
type: string
host:
type: string
hostDeleted:
type: boolean
nodeDown:
type: boolean
podRebuilt:
type: boolean
podRestarted:
type: boolean
pvcSet:
additionalProperties:
type: object
type: object
type: object
type: object
phase:
type: string
version:
Expand Down Expand Up @@ -11908,8 +11968,6 @@ spec:
type: integer
storaged:
properties:
balancedAfterFailover:
type: boolean
balancedSpaces:
items:
format: int32
Expand All @@ -11924,6 +11982,8 @@ spec:
creationTime:
format: date-time
type: string
dataBalanced:
type: boolean
deletionTime:
format: date-time
type: string
Expand Down
Loading