chore(*): add comments to fix golint
diff --git a/pkg/share/share.go b/pkg/share/share.go
index fa8ff3e..9db45b0 100644
--- a/pkg/share/share.go
+++ b/pkg/share/share.go
@@ -17,8 +17,14 @@
package share
-// Broker cluster number
+// GroupNum: the number of broker group
var GroupNum = 0
+
+// NameServersStr: the name server list
var NameServersStr = ""
+
+// IsNameServersStrUpdated: whether the name server list is updated
var IsNameServersStrUpdated = false
+
+// BrokerClusterName: the broker cluster name
var BrokerClusterName = ""
diff --git a/pkg/tool/k8s.go b/pkg/tool/k8s.go
index 311d0e5..b95256a 100644
--- a/pkg/tool/k8s.go
+++ b/pkg/tool/k8s.go
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+// Package tool provides tools for operator communicating with K8S cluster
package tool
import (
@@ -33,12 +34,14 @@
"k8s.io/client-go/tools/remotecommand"
)
+// K8sClient is a struct which contains the kubernetes.Interface and *rest.Config.
type K8sClient struct {
// kubernetes.Interface should be used instead of kubernets.Inteface for unit test (mocking)
ClientSet kubernetes.Interface
Config *rest.Config
}
+// NewK8sClient is to generate a K8s client for interacting with the K8S cluster.
func NewK8sClient() (*K8sClient, error) {
var kubeconfig string
if kubeConfigPath := os.Getenv("KUBECONFIG"); kubeConfigPath != "" {
@@ -72,6 +75,8 @@
return client, nil
}
+// Exec enables operator to execute command in the pod's container in the K8S cluster.
+// It returns the standard output and the standard error output.
func (client *K8sClient) Exec(namespace, podName, containerName string, command []string, stdin io.Reader) (*bytes.Buffer, *bytes.Buffer, error) {
clientset, config := client.ClientSet, client.Config
diff --git a/version/version.go b/version/version.go
index e3e130b..38e9e9d 100644
--- a/version/version.go
+++ b/version/version.go
@@ -1,5 +1,6 @@
package version
+// Version is the current version of the operator project
var (
Version = "0.0.1"
)