Skip to content

Commit

Permalink
Changes to runtimes variables in support of retiring 'whisk/*' runtimes
Browse files Browse the repository at this point in the history
  • Loading branch information
jonpspri committed May 5, 2018
1 parent 70db77c commit 8a32e2e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 34 deletions.
24 changes: 13 additions & 11 deletions ansible/group_vars/all
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,19 @@ whisk:
version:
date: "{{ansible_date_time.iso8601}}"

##
# list of supported runtimes (see whisk.core.entity.ExecManifest for schema).
# briefly:
# defaultImagePrefix: the default image prefix when not given explicitly
# defaultImageTag: the default image tag
# runtimes: set of language runtime families grouped by language (e.g., nodejs, python)
# blackboxes: list of pre-populated docker action images as "name" with optional "prefix" and "tag"
# bypassPullForLocalImages: optional, if true, allow images with a prefix that matches {{ docker.image.prefix }}
# to skip docker pull in invoker even if the image is not part of the blackbox set
#
runtimesManifest: "{{ runtimes_manifest | default(lookup('file', openwhisk_home ~ '/ansible/files/runtimes.json') | from_json) }}"
runtimes:
manifest: "{{ runtimes_manifest | default(lookup('file', openwhisk_home ~ '/ansible/files/runtimes.json') | from_json) }}"
#
# TODO: These variables should be managed/defaulted by the invoker/controller common code (see application.conf)
# Intention is to use the java code to dump defaults and or no longer need ansible to pre-pull images.
#
# See PR #3412 and PR #3407 for details and discussion.
#
default_registry: "{{ runtimes_default_registry | default('docker.io') }}"
default_image_prefix: "{{ runtimes_default_image_prefix | default('openwhisk') }}"
default_image_tag: "{{ runtimes_default_image_tag | default('latest') }}"
bypass_pull_for_local_images: "{{ runtimes_bypass_pull_for_local_images | default(false) }}"
local_image_prefix: "{{ runtimes_local_image_prefix | default('whisk') }}"

limits:
invocationsPerMinute: "{{ limit_invocations_per_minute | default(60) }}"
Expand Down
10 changes: 5 additions & 5 deletions ansible/roles/controller/tasks/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@

"CONFIG_whisk_activation_payload_max": "{{ limit_activation_payload | default() }}"

"RUNTIMES_MANIFEST": "{{ runtimesManifest | to_json }}"
"CONFIG_whisk_runtimes_defaultImagePrefix": "{{ runtimes_default_image_prefix | default() }}"
"CONFIG_whisk_runtimes_defaultImageTag": "{{ runtimes_default_image_tag | default() }}"
"CONFIG_whisk_runtimes_bypassPullForLocalImages": "{{ runtimes_bypass_pull_for_local_images | default() }}"
"CONFIG_whisk_runtimes_localImagePrefix": "{{ runtimes_local_image_prefix | default() }}"
"RUNTIMES_MANIFEST": "{{ runtimes.manifest | to_json }}"
"CONFIG_whisk_runtimes_defaultImagePrefix": "{{ runtimes.default_image_prefix }}"
"CONFIG_whisk_runtimes_defaultImageTag": "{{ runtimes.default_image_tag }}"
"CONFIG_whisk_runtimes_bypassPullForLocalImages": "{{ runtimes.bypass_pull_for_local_images }}"
"CONFIG_whisk_runtimes_localImagePrefix": "{{ runtimes.local_image_prefix }}"

"CONTROLLER_LOCALBOOKKEEPING": "{{ controller.localBookkeeping }}"
"AKKA_CLUSTER_SEED_NODES": "{{seed_nodes_list | join(' ') }}"
Expand Down
34 changes: 17 additions & 17 deletions ansible/roles/invoker/tasks/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
retries: "{{ docker.pull.retries }}"
delay: "{{ docker.pull.delay }}"

- name: "pull runtime action images with tag {{docker.image.tag}}"
shell: "docker pull {{docker_registry}}{{docker.image.prefix}}/{{item}}:{{docker.image.tag}}"
with_items: "{{ runtimesManifest.runtimes.values() | sum(start=[]) | selectattr('deprecated', 'equalto',false) | map(attribute='image.name') | list | unique }}"
when: docker_registry != ""
retries: "{{ docker.pull.retries }}"
delay: "{{ docker.pull.delay }}"

- name: "pull blackboxes action images with tag {{docker.image.tag}}"
shell: "docker pull {{docker_registry}}{{docker.image.prefix}}/{{item.name}}:{{docker.image.tag}}"
with_items:
- "{{ runtimesManifest.blackboxes }}"
when: docker_registry != ""
- name: "pull runtime action and blackbox images"
vars:
image_registry: "{{ item.registry | default(runtimes.default_registry) }}"
image_prefix: "{{ image_registry }}/{{ item.prefix | default(runtimes.default_image_prefix) }}"
image_tag: "{{ item.tag | default(runtimes.default_image_tag) }}"
docker_image:
state: present
name: "{{ image_prefix }}/{{ item.name }}:{{ image_tag }}"
retries: "{{ docker.pull.retries }}"
delay: "{{ docker.pull.delay }}"
when: image_prefix != runtimes.local_image_prefix
with_items:
- "{{ runtimes.manifest.runtimes.values() | sum(start=[]) | selectattr('deprecated', 'equalto', false) | map(attribute='image') | list | unique }}"
- "{{ runtimes.manifest.blackboxes }}"

- name: "determine docker root dir on docker-machine"
uri: url="http://{{ ansible_host }}:{{ docker.port }}/info" return_content=yes
Expand Down Expand Up @@ -179,11 +179,11 @@
-e WHISK_API_HOST_PROTO='{{ whisk_api_host_proto | default('https') }}'
-e WHISK_API_HOST_PORT='{{ whisk_api_host_port | default('443') }}'
-e WHISK_API_HOST_NAME='{{ whisk_api_host_name | default(groups['edge'] | first) }}'
-e RUNTIMES_MANIFEST='{{ runtimesManifest | to_json }}'
-e CONFIG_whisk_runtimes_defaultImagePrefix='{{ runtimes_default_image_prefix | default() }}'
-e CONFIG_whisk_runtimes_defaultImageTag='{{ runtimes_default_image_tag | default() }}'
-e CONFIG_whisk_runtimes_bypassPullForLocalImages='{{ runtimes_bypass_pull_for_local_images | default() }}'
-e CONFIG_whisk_runtimes_localImagePrefix='{{ runtimes_local_image_prefix | default() }}'
-e RUNTIMES_MANIFEST='{{ runtimes.manifest | to_json }}'
-e CONFIG_whisk_runtimes_defaultImagePrefix='{{ runtimes.default_image_prefix }}'
-e CONFIG_whisk_runtimes_defaultImageTag='{{ runtimes.default_image_tag }}'
-e CONFIG_whisk_runtimes_bypassPullForLocalImages='{{ runtimes.bypass_pull_for_local_images }}'
-e CONFIG_whisk_runtimes_localImagePrefix='{{ runtimes.local_image_prefix }}'
-e DOCKER_REGISTRY='{{ docker_registry }}'
-e DOCKER_IMAGE_PREFIX='{{ docker.image.prefix }}'
-e DOCKER_IMAGE_TAG='{{ docker.image.tag }}'
Expand Down
2 changes: 1 addition & 1 deletion ansible/templates/whisk.properties.j2
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ whisk.api.host.name={{ whisk_api_host_name | default(groups['edge'] | first) }}
whisk.api.localhost.name={{ whisk_api_localhost_name | default(whisk_api_host_name) | default(whisk_api_localhost_name_default) }}
whisk.api.vanity.subdomain.parts=1

runtimes.manifest={{ runtimesManifest | to_json }}
runtimes.manifest={{ runtimes.manifest | to_json }}

limits.actions.invokes.perMinute={{ limits.invocationsPerMinute }}
limits.actions.invokes.concurrent={{ limits.concurrentInvocations }}
Expand Down

0 comments on commit 8a32e2e

Please sign in to comment.