зеркало из https://github.com/Azure/ARO-RP.git
Merge pull request #1088 from ihcsim/log-deployment-mode
Logs RP deployment mode during startup
This commit is contained in:
Коммит
bcda601531
|
@ -24,3 +24,4 @@ gomock_reflect_*
|
|||
/coverage.*
|
||||
/report.xml
|
||||
/deploy/config.yaml
|
||||
**/*.swp
|
||||
|
|
|
@ -37,9 +37,7 @@ func operator(ctx context.Context, log *logrus.Entry) error {
|
|||
return fmt.Errorf("invalid role %s", role)
|
||||
}
|
||||
deploymentMode := deployment.NewMode()
|
||||
if deploymentMode == deployment.Development {
|
||||
log.Warn("running in development mode")
|
||||
}
|
||||
log.Infof("running in %s mode", deploymentMode)
|
||||
|
||||
ctrl.SetLogger(utillog.LogrWrapper(log))
|
||||
|
||||
|
|
|
@ -49,13 +49,7 @@ func (c *core) GetCertificateSecret(ctx context.Context, secretName string) (*rs
|
|||
|
||||
func NewCore(ctx context.Context, log *logrus.Entry) (Core, error) {
|
||||
deploymentMode := deployment.NewMode()
|
||||
|
||||
switch deploymentMode {
|
||||
case deployment.Development:
|
||||
log.Warn("running in development mode")
|
||||
case deployment.Integration:
|
||||
log.Warn("running in int mode")
|
||||
}
|
||||
log.Infof("running in %s mode", deploymentMode)
|
||||
|
||||
instancemetadata, err := instancemetadata.New(ctx, deploymentMode)
|
||||
if err != nil {
|
||||
|
|
|
@ -14,15 +14,30 @@ const (
|
|||
Production Mode = iota
|
||||
Integration
|
||||
Development
|
||||
|
||||
strDevelopment = "development"
|
||||
strIntegration = "int"
|
||||
strProduction = "production"
|
||||
)
|
||||
|
||||
func NewMode() Mode {
|
||||
switch strings.ToLower(os.Getenv("RP_MODE")) {
|
||||
case "development":
|
||||
case strDevelopment:
|
||||
return Development
|
||||
case "int":
|
||||
case strIntegration:
|
||||
return Integration
|
||||
default:
|
||||
return Production
|
||||
}
|
||||
}
|
||||
|
||||
func (m Mode) String() string {
|
||||
switch m {
|
||||
case Development:
|
||||
return strDevelopment
|
||||
case Integration:
|
||||
return strIntegration
|
||||
default:
|
||||
return strProduction
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче