Skip to content
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
14 changes: 13 additions & 1 deletion apis/memcached/v1beta1/memcached_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,22 @@ func (instance *Memcached) GetMemcachedServerListString() string {
return strings.Join(instance.Status.ServerList, ",")
}

// GetMemcachedServerListQuotedString - return the memcached servers, each quoted, as comma separated list
// to be used in OpenStack config.
func (instance *Memcached) GetMemcachedServerListQuotedString() string {
return "'" + strings.Join(instance.Status.ServerList, "','") + "'"
}

// GetMemcachedServerListWithInetString - return the memcached servers as comma separated list
// to be used in OpenStack config.
func (instance *Memcached) GetMemcachedServerListWithInetString() string {
return strings.Join(instance.Status.ServerListWithInet, ",")
return strings.Join(instance.Status.ServerListWithInet, "','")
}

// GetMemcachedServerListWithInetQuotedString - return the memcached servers, each quoted, as comma separated list
// to be used in OpenStack config.
func (instance *Memcached) GetMemcachedServerListWithInetQuotedString() string {
return "'" + strings.Join(instance.Status.ServerListWithInet, "','") + "'"
}

// GetMemcachedTLSSupport - return the TLS support of the memcached instance
Expand Down
4 changes: 2 additions & 2 deletions apis/test/helpers/memcached.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ func (tc *TestHelper) SimulateMemcachedReady(name types.NamespacedName) {
serverList := []string{}
serverListWithInet := []string{}
for i := 0; i < int(*mc.Spec.Replicas); i++ {
serverList = append(serverList, fmt.Sprintf("%s-%d.%s:11211", mc.Name, i, mc.Name))
serverListWithInet = append(serverListWithInet, fmt.Sprintf("inet:[%s-%d.%s]:11211", mc.Name, i, mc.Name))
serverList = append(serverList, fmt.Sprintf("%s-%d.%s.%s.svc:11211", mc.Name, i, mc.Name, mc.Namespace))
serverListWithInet = append(serverListWithInet, fmt.Sprintf("inet:[%s-%d.%s.%s.svc]:11211", mc.Name, i, mc.Name, mc.Namespace))
}
mc.Status.ServerList = serverList
mc.Status.ServerListWithInet = serverListWithInet
Expand Down