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
11 changes: 11 additions & 0 deletions config/samples/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Namespace
metadata:
name: multigres-sample
---
apiVersion: multigres.com/v1alpha1
kind: Etcd
metadata:
namespace: multigres-sample
name: sample
spec: {}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ import (
corev1 "k8s.io/api/core/v1"
)

// buildEtcdEnv constructs all environment variables for etcd clustering in
// buildContainerEnv constructs all environment variables for etcd clustering in
// StatefulSets. This combines pod identity, etcd config, and cluster peer
// discovery details.
func buildEtcdEnv(etcdName, namespace string, replicas int32, serviceName string) []corev1.EnvVar {
func buildContainerEnv(
etcdName, namespace string,
replicas int32,
serviceName string,
) []corev1.EnvVar {
envVars := make([]corev1.EnvVar, 0)

// Add pod identity variables from downward API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func TestBuildEtcdClusterPeerList(t *testing.T) {
}
}

func TestBuildEtcdEnv(t *testing.T) {
func TestBuildContainerEnv(t *testing.T) {
tests := map[string]struct {
etcdName string
namespace string
Expand Down Expand Up @@ -319,9 +319,9 @@ func TestBuildEtcdEnv(t *testing.T) {

for name, tc := range tests {
t.Run(name, func(t *testing.T) {
got := buildEtcdEnv(tc.etcdName, tc.namespace, tc.replicas, tc.serviceName)
got := buildContainerEnv(tc.etcdName, tc.namespace, tc.replicas, tc.serviceName)
if diff := cmp.Diff(tc.want, got); diff != "" {
t.Errorf("BuildEtcdEnv() mismatch (-want +got):\n%s", diff)
t.Errorf("BuildContainerEnv() mismatch (-want +got):\n%s", diff)
}
})
}
Expand Down
Loading
Loading