MCPcopy Create free account
hub / github.com/CrunchyData/postgres-operator / GenerateInstance

Function GenerateInstance

internal/naming/names.go:269–276  ·  view source on GitHub ↗

GenerateInstance returns a random name for a member of cluster and set.

(
	cluster *v1beta1.PostgresCluster, set *v1beta1.PostgresInstanceSetSpec,
)

Source from the content-addressed store, hash-verified

267
268// GenerateInstance returns a random name for a member of cluster and set.
269func GenerateInstance(
270 cluster *v1beta1.PostgresCluster, set *v1beta1.PostgresInstanceSetSpec,
271) metav1.ObjectMeta {
272 return metav1.ObjectMeta{
273 Namespace: cluster.Namespace,
274 Name: cluster.Name + "-" + set.Name + "-" + rand.String(4),
275 }
276}
277
278// GenerateStartupInstance returns a stable name that's shaped like
279// GenerateInstance above. The stable name is based on a four character

Callers 3

scaleUpInstancesMethod · 0.92
TestGenerateInstanceFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by 2

TestGenerateInstanceFunction · 0.68