Skip to content

Commit

Permalink
Merge pull request ManageIQ#459 from carbonin/operator_delay_parameter
Browse files Browse the repository at this point in the history
Parameterize the orchestrator liveness probe initial delay in the operator
  • Loading branch information
Fryguy authored Apr 20, 2020
2 parents a9b47f6 + 9779af7 commit 26e3a8c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
4 changes: 4 additions & 0 deletions manageiq-operator/deploy/crds/manageiq.org_manageiqs_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ spec:
description: 'Image tag used for the orchestrator and worker deployments
(default: latest)'
type: string
orchestratorInitialDelay:
description: 'Number of seconds to wait before starting the orchestrator
liveness check (default: 480)'
type: string
orchestratorMemoryLimit:
description: 'Orchestrator deployment memory limit (default: no limit)'
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ spec:
description: 'Image tag used for the orchestrator and worker deployments
(default: latest)'
type: string
orchestratorInitialDelay:
description: 'Number of seconds to wait before starting the orchestrator
liveness check (default: 480)'
type: string
orchestratorMemoryLimit:
description: 'Orchestrator deployment memory limit (default: no limit)'
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ type ManageIQSpec struct {
// Image tag used for the orchestrator and worker deployments (default: latest)
// +optional
OrchestratorImageTag string `json:"orchestratorImageTag"`
// Number of seconds to wait before starting the orchestrator liveness check (default: 480)
// +optional
OrchestratorInitialDelay string `json:"orchestratorInitialDelay"`

// Orchestrator deployment CPU request (default: no request)
// +optional
Expand Down Expand Up @@ -226,6 +229,10 @@ func (m *ManageIQ) Initialize() {
spec.OrchestratorImageTag = "latest"
}

if spec.OrchestratorInitialDelay == "" {
spec.OrchestratorInitialDelay = "480"
}

if spec.PostgresqlImageName == "" {
spec.PostgresqlImageName = "docker.io/manageiq/postgresql"
}
Expand Down
10 changes: 8 additions & 2 deletions manageiq-operator/pkg/helpers/miq-components/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ import (
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"strconv"

"github.com/google/uuid"
)

func NewOrchestratorDeployment(cr *miqv1alpha1.ManageIQ) (*appsv1.Deployment, error) {
delaySecs, err := strconv.Atoi(cr.Spec.OrchestratorInitialDelay)
if err != nil {
return nil, err
}

container := corev1.Container{
Name: "orchestrator",
Image: cr.Spec.OrchestratorImageNamespace + "/" + cr.Spec.OrchestratorImageName + ":" + cr.Spec.OrchestratorImageTag,
Expand All @@ -19,7 +25,7 @@ func NewOrchestratorDeployment(cr *miqv1alpha1.ManageIQ) (*appsv1.Deployment, er
Command: []string{"pidof", "MIQ Server"},
},
},
InitialDelaySeconds: 480,
InitialDelaySeconds: int32(delaySecs),
TimeoutSeconds: 3,
},
Env: []corev1.EnvVar{
Expand Down Expand Up @@ -126,7 +132,7 @@ func NewOrchestratorDeployment(cr *miqv1alpha1.ManageIQ) (*appsv1.Deployment, er
},
}

err := addResourceReqs(cr.Spec.OrchestratorMemoryLimit, cr.Spec.OrchestratorMemoryRequest, cr.Spec.OrchestratorCpuRequest, &container)
err = addResourceReqs(cr.Spec.OrchestratorMemoryLimit, cr.Spec.OrchestratorMemoryRequest, cr.Spec.OrchestratorCpuRequest, &container)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 26e3a8c

Please sign in to comment.