mirror of
https://github.com/pgsty/minio.git
synced 2026-07-20 04:30:26 +03:00
Fix k8s replica set deployment (#8629)
In replica sets, hosts resolve to localhost IP automatically until the deployment fully comes up. To avoid this issue we need to wait for such resolution.
This commit is contained in:
+25
-16
@@ -130,31 +130,40 @@ func GetCurrentReleaseTime() (releaseTime time.Time, err error) {
|
||||
// "/.dockerenv": "file",
|
||||
//
|
||||
func IsDocker() bool {
|
||||
_, err := os.Stat("/.dockerenv")
|
||||
if os.IsNotExist(err) {
|
||||
return false
|
||||
if env.Get("SIMPLE_CI", "") == "" {
|
||||
_, err := os.Stat("/.dockerenv")
|
||||
if os.IsNotExist(err) {
|
||||
return false
|
||||
}
|
||||
|
||||
// Log error, as we will not propagate it to caller
|
||||
logger.LogIf(context.Background(), err)
|
||||
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// Log error, as we will not propagate it to caller
|
||||
logger.LogIf(context.Background(), err)
|
||||
|
||||
return err == nil
|
||||
return false
|
||||
}
|
||||
|
||||
// IsDCOS returns true if minio is running in DCOS.
|
||||
func IsDCOS() bool {
|
||||
// http://mesos.apache.org/documentation/latest/docker-containerizer/
|
||||
// Mesos docker containerizer sets this value
|
||||
return env.Get("MESOS_CONTAINER_NAME", "") != ""
|
||||
if env.Get("SIMPLE_CI", "") == "" {
|
||||
// http://mesos.apache.org/documentation/latest/docker-containerizer/
|
||||
// Mesos docker containerizer sets this value
|
||||
return env.Get("MESOS_CONTAINER_NAME", "") != ""
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// IsKubernetes returns true if minio is running in kubernetes.
|
||||
func IsKubernetes() bool {
|
||||
// Kubernetes env used to validate if we are
|
||||
// indeed running inside a kubernetes pod
|
||||
// is KUBERNETES_SERVICE_HOST but in future
|
||||
// we might need to enhance this.
|
||||
return env.Get("KUBERNETES_SERVICE_HOST", "") != ""
|
||||
if env.Get("SIMPLE_CI", "") == "" {
|
||||
// Kubernetes env used to validate if we are
|
||||
// indeed running inside a kubernetes pod
|
||||
// is KUBERNETES_SERVICE_HOST but in future
|
||||
// we might need to enhance this.
|
||||
return env.Get("KUBERNETES_SERVICE_HOST", "") != ""
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// IsBOSH returns true if minio is deployed from a bosh package
|
||||
|
||||
Reference in New Issue
Block a user