Skip to content

Commit

Permalink
feat: add affinity and tolerations to zone topology
Browse files Browse the repository at this point in the history
  • Loading branch information
powerfooI committed Oct 24, 2023
1 parent 09ba7aa commit 6e5cf25
Show file tree
Hide file tree
Showing 8 changed files with 2,741 additions and 10 deletions.
16 changes: 9 additions & 7 deletions api/v1alpha1/observer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ type OBServerSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

ClusterName string `json:"clusterName"`
ClusterId int64 `json:"clusterId,omitempty"`
Zone string `json:"zone"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
OBServerTemplate *OBServerTemplate `json:"observerTemplate"`
MonitorTemplate *MonitorTemplate `json:"monitorTemplate,omitempty"`
BackupVolume *BackupVolumeSpec `json:"backupVolume,omitempty"`
ClusterName string `json:"clusterName"`
ClusterId int64 `json:"clusterId,omitempty"`
Zone string `json:"zone"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
OBServerTemplate *OBServerTemplate `json:"observerTemplate"`
MonitorTemplate *MonitorTemplate `json:"monitorTemplate,omitempty"`
BackupVolume *BackupVolumeSpec `json:"backupVolume,omitempty"`
}

// OBServerStatus defines the observed state of OBServer
Expand Down
10 changes: 7 additions & 3 deletions api/v1alpha1/obzone_topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ See the Mulan PSL v2 for more details.

package v1alpha1

import corev1 "k8s.io/api/core/v1"

type OBZoneTopology struct {
Zone string `json:"zone"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
Replica int `json:"replica"`
Zone string `json:"zone"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
Replica int `json:"replica"`
}
24 changes: 24 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

922 changes: 922 additions & 0 deletions config/crd/bases/oceanbase.oceanbase.com_obclusters.yaml

Large diffs are not rendered by default.

867 changes: 867 additions & 0 deletions config/crd/bases/oceanbase.oceanbase.com_observers.yaml

Large diffs are not rendered by default.

908 changes: 908 additions & 0 deletions config/crd/bases/oceanbase.oceanbase.com_obzones.yaml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions pkg/resource/observer_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ func (m *OBServerManager) createOBPodSpec(obcluster *v1alpha1.OBCluster) corev1.
Volumes: volumes,
Containers: containers,
NodeSelector: m.OBServer.Spec.NodeSelector,
Affinity: m.OBServer.Spec.Affinity,
Tolerations: m.OBServer.Spec.Tolerations,
}
return podSpec
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/resource/obzone_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ func (m *OBZoneManager) CreateOBServer() error {
ClusterId: m.OBZone.Spec.ClusterId,
Zone: m.OBZone.Spec.Topology.Zone,
NodeSelector: m.OBZone.Spec.Topology.NodeSelector,
Affinity: m.OBZone.Spec.Topology.Affinity,
Tolerations: m.OBZone.Spec.Topology.Tolerations,
OBServerTemplate: m.OBZone.Spec.OBServerTemplate,
MonitorTemplate: m.OBZone.Spec.MonitorTemplate,
BackupVolume: m.OBZone.Spec.BackupVolume,
Expand Down

0 comments on commit 6e5cf25

Please sign in to comment.