Skip to content

Commit

Permalink
Address review comments by @ishan16696
Browse files Browse the repository at this point in the history
  • Loading branch information
anveshreddy18 committed Oct 25, 2024
1 parent 59c80b9 commit 7b3e5fb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 141 deletions.
131 changes: 0 additions & 131 deletions docs/operations/recovery-from-permanent-quorum-loss-in-etcd-cluster.md

This file was deleted.

2 changes: 1 addition & 1 deletion internal/component/configmap/configmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ func matchClientTLSRelatedConfiguration(g *WithT, etcd *druidv1alpha1.Etcd, actu
}

func getAdvertiseURLsInterface(etcd *druidv1alpha1.Etcd, commType, scheme string) map[string]interface{} {
advertiseUrlsMap := getAdvertiseUrlsMap(etcd, commType, scheme, druidv1alpha1.GetPeerServiceName(etcd.ObjectMeta))
advertiseUrlsMap := getAdvertiseURLs(etcd, commType, scheme, druidv1alpha1.GetPeerServiceName(etcd.ObjectMeta))
advertiseUrlsInterface := make(map[string]interface{}, len(advertiseUrlsMap))
for podName, urlList := range advertiseUrlsMap {
urlsListInterface := make([]interface{}, len(urlList))
Expand Down
16 changes: 7 additions & 9 deletions internal/component/configmap/etcdconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ func createEtcdConfig(etcd *druidv1alpha1.Etcd) *etcdConfig {
AutoCompactionRetention: ptr.Deref(etcd.Spec.Common.AutoCompactionRetention, defaultAutoCompactionRetention),
ListenPeerUrls: fmt.Sprintf("%s://0.0.0.0:%d", peerScheme, ptr.Deref(etcd.Spec.Etcd.ServerPort, common.DefaultPortEtcdPeer)),
ListenClientUrls: fmt.Sprintf("%s://0.0.0.0:%d", clientScheme, ptr.Deref(etcd.Spec.Etcd.ClientPort, common.DefaultPortEtcdClient)),
AdvertisePeerUrls: getAdvertiseUrlsMap(etcd, commTypePeer, peerScheme, peerSvcName),
AdvertiseClientUrls: getAdvertiseUrlsMap(etcd, commTypeClient, clientScheme, peerSvcName),
AdvertisePeerUrls: getAdvertiseURLs(etcd, commTypePeer, peerScheme, peerSvcName),
AdvertiseClientUrls: getAdvertiseURLs(etcd, commTypeClient, clientScheme, peerSvcName),
}
if peerSecurityConfig != nil {
cfg.PeerSecurity = *peerSecurityConfig
Expand All @@ -93,19 +93,17 @@ func createEtcdConfig(etcd *druidv1alpha1.Etcd) *etcdConfig {
}

func getSnapshotCount(etcd *druidv1alpha1.Etcd) int64 {
snapshotCount := defaultSnapshotCount
if etcd.Spec.Etcd.SnapshotCount != nil {
snapshotCount = *etcd.Spec.Etcd.SnapshotCount
return *etcd.Spec.Etcd.SnapshotCount
}
return snapshotCount
return defaultSnapshotCount
}

func getDBQuotaBytes(etcd *druidv1alpha1.Etcd) int64 {
dbQuotaBytes := defaultDBQuotaBytes
if etcd.Spec.Etcd.Quota != nil {
dbQuotaBytes = etcd.Spec.Etcd.Quota.Value()
return etcd.Spec.Etcd.Quota.Value()
}
return dbQuotaBytes
return defaultDBQuotaBytes
}

func getSchemeAndSecurityConfig(tlsConfig *druidv1alpha1.TLSConfig, caPath, serverTLSPath string) (string, *securityConfig) {
Expand Down Expand Up @@ -133,7 +131,7 @@ func prepareInitialCluster(etcd *druidv1alpha1.Etcd, peerScheme string) string {
return strings.Trim(builder.String(), ",")
}

func getAdvertiseUrlsMap(etcd *druidv1alpha1.Etcd, commType, scheme, peerSvcName string) advertiseURLs {
func getAdvertiseURLs(etcd *druidv1alpha1.Etcd, commType, scheme, peerSvcName string) advertiseURLs {
var port int32
switch commType {
case commTypePeer:
Expand Down

0 comments on commit 7b3e5fb

Please sign in to comment.