MCPcopy Create free account
hub / github.com/OpenAtomFoundation/SmartIDE / getK8sLabels

Function getK8sLabels

cli/cmd/start/core.go:31–56  ·  view source on GitHub ↗
(cmd *cobra.Command, workspaceInfo workspace.WorkspaceInfo)

Source from the content-addressed store, hash-verified

29var i18nInstance = i18n.GetInstance()
30
31func getK8sLabels(cmd *cobra.Command, workspaceInfo workspace.WorkspaceInfo) map[string]string {
32 labels := make(map[string]string)
33
34 labels["smartide.workspaceName"] = workspaceInfo.Name
35 labels["smartide.cliVersion"] = cli.GetCliVersionByShell() //
36 labels["smartide.trigger"] = string(workspaceInfo.CliRunningEnv)
37 labels["smartide.workspaceId"] = workspaceInfo.ID
38
39 if workspaceInfo.CliRunningEnv != workspace.CliRunningEnvEnum_Client {
40 userName, _ := cmd.Flags().GetString("serverusername")
41 serverHost, _ := cmd.Flags().GetString("serverhost")
42 serverToken, _ := cmd.Flags().GetString("servertoken")
43
44 labels["smartide.workspaceId"] = workspaceInfo.ServerWorkSpace.NO
45 labels["smartide.serverUser"] = userName
46 labels["smartide.serverHost"] = serverHost
47
48 auth := model.Auth{}
49 auth.Token = serverToken
50 auth.LoginUrl = serverHost
51 auth.UserName = userName
52 labels["smartide.serverVersion"], _ = server.GetVersionByApi(auth)
53 }
54
55 return labels
56}

Callers 3

ExecuteK8sStartCmdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected