func RunningInKubernetes() bool {
	_, set := os.LookupEnv(KubernetesServiceHostKey)
	return set
}
Detects if test service is running in a Kubernetes pod
package config
import (
	"fmt"
	"github.com/kelseyhightower/envconfig"
	"github.com/pkg/errors"
	"os"
)
const (
	envDevelopment = "development"
	RunAsLocal     = "local"  
	RunAsJob       = "job"    
)
var (
	KubernetesServiceHostKey = "KUBERNETES_SERVICE_HOST"
	TelepresenceRootKey      = "TELEPRESENCE_ROOT"
)
type Env struct {
	Env string `envconfig:"ENV" default:"development"`
	GCPProjectID string `envconfig:"GCP_PROJECT_ID"`
	PrintOutputToEventLog bool `envconfig:"PRINT_OUTPUT_TO_EVENT_LOG" default:"false"`
	RunAs string `envconfig:"RUN_AS"`
	DbUrl string `envconfig:"DB_URL"`
}
func (e *Env) validate() error {
	checks := []struct {
		bad    bool
		errMsg string
	}{
		{
			e.Env != envDevelopment,
			fmt.Sprintf("invalid env is specified: %q", e.Env),
		},
	}
	for _, check := range checks {
		if check.bad {
			return errors.Errorf(check.errMsg)
		}
	}
	return nil
}
func ReadFromEnv() (*Env, error) {
	var env Env
	if err := envconfig.Process("", &env); err != nil {
		return nil, errors.Wrap(err, "failed to process envconfig")
	}
	if err := env.validate(); err != nil {
		return nil, errors.Wrap(err, "validation failed")
	}
	return &env, nil
}