do not disable IsKubernetes(), IsDocker() checks with MINIO_CI_CD (#15852)

This commit is contained in:
Harshavardhana 2022-10-12 23:40:48 -07:00 committed by GitHub
parent 783dd875f7
commit 5532982857
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -124,40 +124,31 @@ func GetCurrentReleaseTime() (releaseTime time.Time, err error) {
// //
// "/.dockerenv": "file", // "/.dockerenv": "file",
func IsDocker() bool { func IsDocker() bool {
if !globalIsCICD { _, err := os.Stat("/.dockerenv")
_, err := os.Stat("/.dockerenv") if osIsNotExist(err) {
if osIsNotExist(err) { return false
return false
}
// Log error, as we will not propagate it to caller
logger.LogIf(GlobalContext, err)
return err == nil
} }
return false
// Log error, as we will not propagate it to caller
logger.LogIf(GlobalContext, err)
return err == nil
} }
// IsDCOS returns true if minio is running in DCOS. // IsDCOS returns true if minio is running in DCOS.
func IsDCOS() bool { func IsDCOS() bool {
if !globalIsCICD { // http://mesos.apache.org/documentation/latest/docker-containerizer/
// http://mesos.apache.org/documentation/latest/docker-containerizer/ // Mesos docker containerizer sets this value
// Mesos docker containerizer sets this value return env.Get("MESOS_CONTAINER_NAME", "") != ""
return env.Get("MESOS_CONTAINER_NAME", "") != ""
}
return false
} }
// IsKubernetes returns true if minio is running in kubernetes. // IsKubernetes returns true if minio is running in kubernetes.
func IsKubernetes() bool { func IsKubernetes() bool {
if !globalIsCICD { // Kubernetes env used to validate if we are
// Kubernetes env used to validate if we are // indeed running inside a kubernetes pod
// indeed running inside a kubernetes pod // is KUBERNETES_SERVICE_HOST
// is KUBERNETES_SERVICE_HOST // https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/kubelet_pods.go#L541
// https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/kubelet_pods.go#L541 return env.Get("KUBERNETES_SERVICE_HOST", "") != ""
return env.Get("KUBERNETES_SERVICE_HOST", "") != ""
}
return false
} }
// IsBOSH returns true if minio is deployed from a bosh package // IsBOSH returns true if minio is deployed from a bosh package