test
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
package kubectl
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
"errors"
|
||||
|
||||
log "oc-deploy/log_wrapper"
|
||||
)
|
||||
@@ -20,14 +20,14 @@ type getOutput struct {
|
||||
}
|
||||
|
||||
type getStatusOutput struct {
|
||||
Replicas int `json:"replicas"`
|
||||
UnavailableReplicas int `json:"unavailableReplicas"`
|
||||
Replicas int `json:"replicas"`
|
||||
UnavailableReplicas int `json:"unavailableReplicas"`
|
||||
}
|
||||
|
||||
func (this KubectlCommand) Get(data KubectlObject) (map[string]any, error) {
|
||||
if data.Kind == "Deployment" {return this.getDeployment(data)}
|
||||
if data.Kind == "StatefulSet" {return this.getStatefulSet(data)}
|
||||
return make(map[string]any), fmt.Errorf("Kind %s inconnu", data.Kind)
|
||||
if data.Kind == "Deployment" {return this.getDeployment(data)}
|
||||
if data.Kind == "StatefulSet" {return this.getStatefulSet(data)}
|
||||
return make(map[string]any), fmt.Errorf("Kind %s inconnu", data.Kind)
|
||||
}
|
||||
|
||||
func (this KubectlCommand) Wait(data KubectlObject) (error) {
|
||||
@@ -35,22 +35,22 @@ func (this KubectlCommand) Wait(data KubectlObject) (error) {
|
||||
boucle := 10
|
||||
sleep := 10000 * time.Millisecond
|
||||
|
||||
for _ = range boucle {
|
||||
for _ = range boucle {
|
||||
|
||||
log.Log().Debug().Msg(fmt.Sprintf("Check Deployement %s", data.Name))
|
||||
log.Log().Debug().Msg(fmt.Sprintf("Check Deployement %s", data.Name))
|
||||
|
||||
m, err := this.Get(data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ko := m["UnavailableReplicas"].(int)
|
||||
if ko == 0 {
|
||||
return nil
|
||||
}
|
||||
m, err := this.Get(data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ko := m["UnavailableReplicas"].(int)
|
||||
if ko == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
log.Log().Info().Msg(fmt.Sprintf(" >> %s (Unavailable : %d)...", data.Name, ko))
|
||||
time.Sleep(sleep)
|
||||
log.Log().Info().Msg(fmt.Sprintf(" >> %s (Unavailable : %d)...", data.Name, ko))
|
||||
time.Sleep(sleep)
|
||||
|
||||
}
|
||||
return errors.New("Temps d'attente dépassé")
|
||||
}
|
||||
return errors.New("Temps d'attente dépassé")
|
||||
}
|
||||
Reference in New Issue
Block a user