mirror of
https://github.com/TECHNOFAB11/zfs-localpv.git
synced 2025-12-12 14:30:12 +01:00
feat(analytics): adding google analytics for ZFSPV
Whenever a volume is provisioned and de-provisioned we will send a google event with mainly following details : 1. pvName (will shown as app title in google analytics) 2. size of the volume 3. event type : volume-provision, volume-deprovision 4. storage type zfs-localpv 5. replicacount as 1 6. ClientId as default namespace uuid Apart from this, we send the event once in 24 hr, which will have some info like number of nodes, node type, kubernetes version etc. This metric is cotrolled by OPENEBS_IO_ENABLE_ANALYTICS env. We can set it to false if we don't want to send the metrics. Signed-off-by: Pawan <pawan@mayadata.io>
This commit is contained in:
parent
0fc86d843b
commit
d608dbacd8
28 changed files with 1731 additions and 18 deletions
|
|
@ -28,16 +28,6 @@ import (
|
|||
"k8s.io/client-go/tools/clientcmd"
|
||||
)
|
||||
|
||||
const (
|
||||
// K8sMasterIPEnvironmentKey is the environment variable key used to
|
||||
// determine the kubernetes master IP address
|
||||
K8sMasterIPEnvironmentKey string = "OPENEBS_IO_K8S_MASTER"
|
||||
|
||||
// KubeConfigEnvironmentKey is the environment variable key used to
|
||||
// determine the kubernetes config
|
||||
KubeConfigEnvironmentKey string = "OPENEBS_IO_KUBE_CONFIG"
|
||||
)
|
||||
|
||||
// getInClusterConfigFunc abstracts the logic to get
|
||||
// kubernetes incluster config
|
||||
//
|
||||
|
|
@ -213,8 +203,8 @@ func (c *Client) Config() (config *rest.Config, err error) {
|
|||
}
|
||||
|
||||
// ENV holds second priority
|
||||
if strings.TrimSpace(c.getKubeMasterIP(K8sMasterIPEnvironmentKey)) != "" ||
|
||||
strings.TrimSpace(c.getKubeConfigPath(KubeConfigEnvironmentKey)) != "" {
|
||||
if strings.TrimSpace(c.getKubeMasterIP(env.KubeMaster)) != "" ||
|
||||
strings.TrimSpace(c.getKubeConfigPath(env.KubeConfig)) != "" {
|
||||
return c.getConfigFromENV()
|
||||
}
|
||||
|
||||
|
|
@ -235,14 +225,14 @@ func (c *Client) GetConfigForPathOrDirect() (config *rest.Config, err error) {
|
|||
}
|
||||
|
||||
func (c *Client) getConfigFromENV() (config *rest.Config, err error) {
|
||||
k8sMaster := c.getKubeMasterIP(K8sMasterIPEnvironmentKey)
|
||||
kubeConfig := c.getKubeConfigPath(KubeConfigEnvironmentKey)
|
||||
k8sMaster := c.getKubeMasterIP(env.KubeMaster)
|
||||
kubeConfig := c.getKubeConfigPath(env.KubeConfig)
|
||||
if strings.TrimSpace(k8sMaster) == "" &&
|
||||
strings.TrimSpace(kubeConfig) == "" {
|
||||
return nil, errors.Errorf(
|
||||
"failed to get kubernetes config: missing ENV: atleast one should be set: {%s} or {%s}",
|
||||
K8sMasterIPEnvironmentKey,
|
||||
KubeConfigEnvironmentKey,
|
||||
env.KubeMaster,
|
||||
env.KubeConfig,
|
||||
)
|
||||
}
|
||||
return c.buildConfigFromFlags(k8sMaster, kubeConfig)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue