()
| 92 | } |
| 93 | |
| 94 | func inClusterNamespace() (string, error) { |
| 95 | envNamespace := os.Getenv("KUBE_NAMESPACE") |
| 96 | if envNamespace != "" { |
| 97 | return envNamespace, nil |
| 98 | } |
| 99 | |
| 100 | namespace, err := os.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace") |
| 101 | if err != nil { |
| 102 | return "", err |
| 103 | } |
| 104 | |
| 105 | return string(namespace), nil |
| 106 | } |
| 107 | |
| 108 | func ConvertRestConfigToRawConfig(config *rest.Config, namespace string) (*clientcmdapi.Config, error) { |
| 109 | contextName := localContext |
no outgoing calls
no test coverage detected