Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update comments and remove unnecessary conversions and checks #21

Merged
merged 1 commit into from
Apr 12, 2023

Conversation

hezhizhen
Copy link
Contributor

Some cleanup

@caoxianfei1

@caoxianfei1
Copy link
Collaborator

@hezhizhen ok, i will review it.

ClusterPhasePending ConditionType = "Pending"
// ClusterReady
// ClusterPhaseReady : The cluster has been created successfully.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you would remove the colon will be more standardized

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll polish these comments later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

ClusterPhaseUnknown ConditionType = "Unknown"
)

const (
// ConditionTypeEtcdReady
// ConditionTypeEtcdReady ...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some description here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

type S3ConfigSpec struct {
AK string `json:"ak,omitempty"`
SK string `json:"sk,omitempty"`
NosAddress string `json:"nosAddress,omitempty"`
SnapShotBucketName string `json:"bucketName,omitempty"`
}

// StorageScopeSpec
// StorageScopeSpec ...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, maybe you can add more description for EtcdSpec, MdsSpec, SnapShotCloneSpec, S3ConfigSpec.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

main.go Show resolved Hide resolved
@@ -17,8 +17,8 @@ import (
)

const (
PrepareJobName = "prepare-chunkfile"
DEFAULT_CHUNKFILE_SIZE = 16 * 1024 * 1024 // 16MB
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For numbers, uppercase should be better, but you can modify the initials of 'PrepareJobName' and other variables in another package , because other packages do not use this value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not Go's convention, but it's okay to make it a convention for this repository.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PrepareJobName is used in controllers, so I can't change it to be unexported.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted. PTAL

@@ -358,7 +358,7 @@ func (c *Cluster) makeCSDaemonContainer(csConfig *chunkserverConfig) v1.Containe
return container
}

// getChunkServerPodLabels
// getChunkServerPodLabels ...
Copy link
Collaborator

@caoxianfei1 caoxianfei1 Apr 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some more description?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

@@ -185,7 +185,7 @@ func CSConfigConfigMapVolumeAndMount(csConfig *chunkserverConfig) ([]v1.Volume,
return vols, mounts
}

// createTopoAndToolVolumeAndMount
// createTopoAndToolVolumeAndMount ...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some more description?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

@@ -193,9 +193,8 @@ func getValue(name string, dc ConfigInterface) string {
return ""
}

// ReplaceConfigVars
// ReplaceConfigVars ...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some more description?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

if _, ok := r.ClusterController.clusterMap[curveCluster.Namespace]; ok {
delete(r.ClusterController.clusterMap, curveCluster.Namespace)
}
delete(r.ClusterController.clusterMap, curveCluster.Namespace)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, but it's more more intuitive using if.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deletion is idempotent, so it deletes curveCluster.Namespace from the map if the key exists, and does nothing if not.

With if, you are emphasizing it; but it's not necessary actually because it's guaranteed by Go's compiler.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but it may be more obvious to developers and me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but it may be more obvious to developers and me.

Okay, I'll revert it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. PTAL

@@ -26,7 +26,7 @@ func DaemonVolumes(configMapDataKey string, configMapMountPathDir string, dataPa
return vols
}

// DaemonVolumeMounts returns the pod container volume mounth used by Curve daemon
// DaemonVolumeMounts returns the pod container volume mounts used by Curve daemon
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

volumeMounts my be better?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. PTAL


return nil
return errors.Wrapf(err, "failed to update object %q status", nsName.String())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not elegant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted. PTAL

@hezhizhen hezhizhen force-pushed the chore branch 5 times, most recently from 26ee49f to 25ec5bc Compare April 12, 2023 08:22
@caoxianfei1 caoxianfei1 merged commit 19066ac into opencurve:master Apr 12, 2023
@caoxianfei1
Copy link
Collaborator

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants