diff --git a/playbooks/openshift-apps/openscanhub.yml b/playbooks/openshift-apps/openscanhub.yml index 6e3aec7970..51f61ec3df 100644 --- a/playbooks/openshift-apps/openscanhub.yml +++ b/playbooks/openshift-apps/openscanhub.yml @@ -97,6 +97,11 @@ template: etc-resallocserver-server-configmap.yml objectname: etc-resallocserver-server-configmap when: env == "staging" + - role: openshift/object + app: openscanhub + template: etc-resallocserver-pools-configmap.yml + objectname: etc-resallocserver-pools-configmap + when: env == "staging" - role: openshift/object app: openscanhub file: deployment-resalloc-server.yml diff --git a/roles/openshift-apps/openscanhub/files/deployment-resalloc-server.yml b/roles/openshift-apps/openscanhub/files/deployment-resalloc-server.yml index d14ef526df..8c4150fb37 100644 --- a/roles/openshift-apps/openscanhub/files/deployment-resalloc-server.yml +++ b/roles/openshift-apps/openscanhub/files/deployment-resalloc-server.yml @@ -56,6 +56,9 @@ spec: - mountPath: /etc/resallocserver/server.yaml name: etc-resallocserver-server-configmap subPath: server.yaml + - mountPath: /etc/resallocserver/pools.yaml + name: etc-resallocserver-pools-configmap + subPath: pools.yaml dnsPolicy: ClusterFirst restartPolicy: Always schedulerName: default-scheduler @@ -65,3 +68,6 @@ spec: - name: etc-resallocserver-server-configmap configMap: name: etc-resallocserver-server-config + - name: etc-resallocserver-pools-configmap + configMap: + name: etc-resallocserver-pools-config diff --git a/roles/openshift-apps/openscanhub/templates/etc-resallocserver-pools-configmap.yml b/roles/openshift-apps/openscanhub/templates/etc-resallocserver-pools-configmap.yml new file mode 100644 index 0000000000..d92e1d3e87 --- /dev/null +++ b/roles/openshift-apps/openscanhub/templates/etc-resallocserver-pools-configmap.yml @@ -0,0 +1,15 @@ +{% macro load_file(filename) %}{% include filename %}{%- endmacro -%} +--- +apiVersion: v1 +kind: List +metadata: {} +items: +- apiVersion: v1 + kind: ConfigMap + metadata: + name: etc-resallocserver-pools-config + labels: + app: openscanhub + data: + pools.yaml: |- + {{ load_file('etc-resallocserver-pools.yaml') | indent(6) }} diff --git a/roles/openshift-apps/openscanhub/templates/etc-resallocserver-pools.yaml b/roles/openshift-apps/openscanhub/templates/etc-resallocserver-pools.yaml new file mode 100644 index 0000000000..7b69bacd3c --- /dev/null +++ b/roles/openshift-apps/openscanhub/templates/etc-resallocserver-pools.yaml @@ -0,0 +1,60 @@ +# This is the prefix for the name of the virtual machines. +{% if env == 'staging' %} +staging_openscanhub_aws_spot_x86_64: +{% else %} +openscanhub_aws_spot_x86_64: +{% endif %} + +# This should be the same value for `MAX_SINGLE_USE_WORKERS` in `settings_local.py`. +{% if env == 'staging' %} + max: 4 +{% else %} + max: 32 +{% endif %} + +{% if env == 'staging' %} + max_starting: 4 +{% else %} + max_starting: 32 +{% endif %} + + max_prealloc: 0 + # spot price should be cca 0.01 + cmd_new: "/etc/resallocserver/vm-provisioning/resalloc-start-aws-spot-x86_64" + cmd_delete: resalloc-aws-delete --aws-profile default + cmd_livecheck: "/etc/resallocserver/vm-provisioning/resalloc-check-vm-ip" + livecheck_period: 30 + cmd_list: resalloc-aws-list --aws-profile default + cmd_release: "/etc/resallocserver/vm-provisioning/resalloc-vm-release" + + reuse_opportunity_time: 0 + reuse_max_count: 0 + reuse_max_time: 0 + + # TODO: Choose which tags we shall select? + # tags: + # - aws + # - aws_spot + # - name: openscanhub_worker + # priority: -5 + # - arch_noarch + # - arch_x86_64 + # - arch_x86_64_native + # - arch_i386 + # - arch_i386_native + # - arch_i586 + # - arch_i586_native + # - arch_i686 + # - arch_i686_native + # - arch_armhfp + # - arch_armhfp_emulated + # - arch_s390x + # - arch_s390x_emulated + # - arch_s390 + # - arch_s390_emulated + # - arch_ppc64le + # - arch_ppc64le_emulated + # - arch_ppc64 + # - arch_ppc64_emulated + # - arch_ppc + # - arch_ppc_emulated