Skip to content

Commit

Permalink
Merge pull request #532 from carbonin/add_worker_resource_flag
Browse files Browse the repository at this point in the history
Add a flag to gate worker resource constraints
  • Loading branch information
bdunne authored Jul 6, 2020
2 parents 25504b5 + b9941df commit 2b8519e
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 0 deletions.
14 changes: 14 additions & 0 deletions images/manageiq-orchestrator/container-assets/entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ function create_initial_group() {
fi
}

function set_resource_setting() {
echo "== Updating resource constraint settings =="
script=$(cat <<- EOS
settings = {
'server/worker_monitor/enforce_resource_constraints' => ENV['WORKER_RESOURCES'] == 'true'
}
MiqRegion.my_region.add_settings_for_resource(settings)
EOS
)

bin/rails runner "$script"
}

check_svc_status ${MEMCACHED_SERVICE_HOST} ${MEMCACHED_SERVICE_PORT}
check_svc_status ${DATABASE_HOSTNAME} ${DATABASE_PORT}

Expand Down Expand Up @@ -98,5 +111,6 @@ esac

pushd ${APP_ROOT}
update_auth_settings
set_resource_setting
popd
exec ruby /var/www/miq/vmdb/lib/workers/bin/evm_server.rb
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 @@ -63,6 +63,10 @@ spec:
enableSSO:
description: 'Flag to enable SSO in the application (default: false)'
type: boolean
enforceWorkerResourceConstraints:
description: 'Flag to trigger worker resource constraint enforcement
(default: false)'
type: boolean
httpdAuthConfig:
description: Secret containing the httpd configuration files Mutually
exclusive with the OIDCClientSecret and OIDCProviderURL if using openid-connect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ spec:
enableSSO:
description: 'Flag to enable SSO in the application (default: false)'
type: boolean
enforceWorkerResourceConstraints:
description: 'Flag to trigger worker resource constraint enforcement
(default: false)'
type: boolean
httpdAuthConfig:
description: Secret containing the httpd configuration files Mutually
exclusive with the OIDCClientSecret and OIDCProviderURL if using openid-connect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ type ManageIQSpec struct {
// +optional
InitialAdminGroupName string `json:"initialAdminGroupName"`

// Flag to trigger worker resource constraint enforcement (default: false)
// +optional
EnforceWorkerResourceConstraints *bool `json:"enforceWorkerResourceConstraints"`

// Database volume size (default: 15Gi)
// +optional
DatabaseVolumeCapacity string `json:"databaseVolumeCapacity"`
Expand Down Expand Up @@ -294,6 +298,10 @@ func (m *ManageIQ) Initialize() {
spec.DatabaseRegion = "0"
}

if spec.EnforceWorkerResourceConstraints == nil {
spec.EnforceWorkerResourceConstraints = new(bool)
}

if spec.DatabaseVolumeCapacity == "" {
spec.DatabaseVolumeCapacity = "15Gi"
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions manageiq-operator/pkg/helpers/miq-components/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@ func OrchestratorDeployment(cr *miqv1alpha1.ManageIQ, scheme *runtime.Scheme) (*
Name: "ADMIN_GROUP",
Value: cr.Spec.InitialAdminGroupName,
},
corev1.EnvVar{
Name: "WORKER_RESOURCES",
Value: strconv.FormatBool(*cr.Spec.EnforceWorkerResourceConstraints),
},
},
}

Expand Down

0 comments on commit 2b8519e

Please sign in to comment.