Skip to content

Commit

Permalink
remove cluster.local and fix error message, set constants
Browse files Browse the repository at this point in the history
  • Loading branch information
sircthulhu committed Mar 15, 2024
1 parent ec31897 commit ff13910
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion api/v1alpha1/etcdcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type EtcdClusterSpec struct {
Storage Storage `json:"storage,omitempty"`
}

var (
const (
EtcdConditionInitialized = "Initialized"
EtcdConditionReady = "Ready"
)
Expand Down
8 changes: 4 additions & 4 deletions internal/controller/etcdcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (r *EtcdClusterReconciler) ensureClusterService(ctx context.Context, cluste
return fmt.Errorf("cannot set controller reference: %w", err)
}
if err = r.Create(ctx, svc); err != nil {
return fmt.Errorf("cannot create cluster state configmap: %w", err)
return fmt.Errorf("cannot create cluster service: %w", err)
}
return nil
}
Expand Down Expand Up @@ -233,7 +233,7 @@ func (r *EtcdClusterReconciler) ensureClusterStatefulSet(
if i > 0 {
initialCluster += ","
}
initialCluster += fmt.Sprintf("%s-%d=https://%s-%d.%s.%s.svc.cluster.local:2380",
initialCluster += fmt.Sprintf("%s-%d=https://%s-%d.%s.%s.svc:2380",
cluster.Name, i,
cluster.Name, i, cluster.Name, cluster.Namespace,
)
Expand Down Expand Up @@ -275,13 +275,13 @@ func (r *EtcdClusterReconciler) ensureClusterStatefulSet(
"--listen-peer-urls=https://0.0.0.0:2380",
// for first version disable TLS for client access
"--listen-client-urls=http://0.0.0.0:2379",
"--initial-advertise-peer-urls=https://$(POD_NAME)." + cluster.Name + ".$(POD_NAMESPACE).svc.cluster.local:2380",
"--initial-advertise-peer-urls=https://$(POD_NAME)." + cluster.Name + ".$(POD_NAMESPACE).svc:2380",
"--data-dir=/var/run/etcd/default.etcd",
"--initial-cluster=" + initialCluster,
fmt.Sprintf("--initial-cluster-token=%s-%s", cluster.Name, cluster.Namespace),
"--auto-tls",
"--peer-auto-tls",
"--advertise-client-urls=http://$(POD_NAME)." + cluster.Name + ".$(POD_NAMESPACE).svc.cluster.local:2379",
"--advertise-client-urls=http://$(POD_NAME)." + cluster.Name + ".$(POD_NAMESPACE).svc:2379",
},
Ports: []corev1.ContainerPort{
{Name: "peer", ContainerPort: 2380},
Expand Down

0 comments on commit ff13910

Please sign in to comment.