Merge pull request #11 from howardlau1999/filerpeer
Support Filer Peers
This commit is contained in:
commit
740ac81a57
|
@ -16,6 +16,7 @@ func buildFilerStartupScript(m *seaweedv1.Seaweed) string {
|
||||||
commands := []string{"weed", "filer"}
|
commands := []string{"weed", "filer"}
|
||||||
commands = append(commands, fmt.Sprintf("-port=%d", seaweedv1.FilerHTTPPort))
|
commands = append(commands, fmt.Sprintf("-port=%d", seaweedv1.FilerHTTPPort))
|
||||||
commands = append(commands, fmt.Sprintf("-ip=$(POD_NAME).%s-filer-peer", m.Name))
|
commands = append(commands, fmt.Sprintf("-ip=$(POD_NAME).%s-filer-peer", m.Name))
|
||||||
|
commands = append(commands, fmt.Sprintf("-peers=%s", getFilerPeersString(m.Name, m.Spec.Volume.Replicas)))
|
||||||
commands = append(commands, fmt.Sprintf("-master=%s", getMasterPeersString(m.Name, m.Spec.Master.Replicas)))
|
commands = append(commands, fmt.Sprintf("-master=%s", getMasterPeersString(m.Name, m.Spec.Master.Replicas)))
|
||||||
commands = append(commands, "-s3")
|
commands = append(commands, "-s3")
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
masterPeerAddressPattern = "%s-master-%d.%s-master-peer:9333"
|
masterPeerAddressPattern = "%s-master-%d.%s-master-peer:9333"
|
||||||
|
filerPeerAddressPattern = "%s-filer-%d.%s-filer-peer:8888"
|
||||||
masterPeerAddressWithNamespacePattern = "%s-master-%d.%s-master-peer.%s:9333"
|
masterPeerAddressWithNamespacePattern = "%s-master-%d.%s-master-peer.%s:9333"
|
||||||
filerServiceAddressWithNamespacePattern = "%s-filer.%s:8888"
|
filerServiceAddressWithNamespacePattern = "%s-filer.%s:8888"
|
||||||
masterServiceAddressWithNamespacePattern = "%s-master.%s:9333"
|
masterServiceAddressWithNamespacePattern = "%s-master.%s:9333"
|
||||||
|
@ -51,6 +52,18 @@ func ReconcileResult(err error) (bool, ctrl.Result, error) {
|
||||||
return false, ctrl.Result{}, nil
|
return false, ctrl.Result{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getFilerAddresses(name string, replicas int32) []string {
|
||||||
|
peersAddresses := make([]string, 0, replicas)
|
||||||
|
for i := int32(0); i < replicas; i++ {
|
||||||
|
peersAddresses = append(peersAddresses, fmt.Sprintf(filerPeerAddressPattern, name, i, name))
|
||||||
|
}
|
||||||
|
return peersAddresses
|
||||||
|
}
|
||||||
|
|
||||||
|
func getFilerPeersString(name string, replicas int32) string {
|
||||||
|
return strings.Join(getFilerAddresses(name, replicas), ",")
|
||||||
|
}
|
||||||
|
|
||||||
func getMasterAddresses(name string, replicas int32) []string {
|
func getMasterAddresses(name string, replicas int32) []string {
|
||||||
peersAddresses := make([]string, 0, replicas)
|
peersAddresses := make([]string, 0, replicas)
|
||||||
for i := int32(0); i < replicas; i++ {
|
for i := int32(0); i < replicas; i++ {
|
||||||
|
@ -62,6 +75,7 @@ func getMasterAddresses(name string, replicas int32) []string {
|
||||||
func getMasterPeersString(name string, replicas int32) string {
|
func getMasterPeersString(name string, replicas int32) string {
|
||||||
return strings.Join(getMasterAddresses(name, replicas), ",")
|
return strings.Join(getMasterAddresses(name, replicas), ",")
|
||||||
}
|
}
|
||||||
|
|
||||||
func getMasterAddressesWithNamespace(name, namespace string, replicas int32) []string {
|
func getMasterAddressesWithNamespace(name, namespace string, replicas int32) []string {
|
||||||
peersAddresses := make([]string, 0, replicas)
|
peersAddresses := make([]string, 0, replicas)
|
||||||
for i := int32(0); i < replicas; i++ {
|
for i := int32(0); i < replicas; i++ {
|
||||||
|
|
Loading…
Reference in New Issue