You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/06/11 04:07:06 UTC

[GitHub] rabbah closed pull request #3412: Changes to runtimes variables in support of retiring 'whisk/*' runtimes

rabbah closed pull request #3412: Changes to runtimes variables in support of retiring 'whisk/*' runtimes
URL: https://github.com/apache/incubator-openwhisk/pull/3412
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/ansible/group_vars/all b/ansible/group_vars/all
index 977d6eddd9..0796746455 100644
--- a/ansible/group_vars/all
+++ b/ansible/group_vars/all
@@ -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) }}"
diff --git a/ansible/roles/controller/tasks/deploy.yml b/ansible/roles/controller/tasks/deploy.yml
index 9c5bfafc7a..52270f9a19 100644
--- a/ansible/roles/controller/tasks/deploy.yml
+++ b/ansible/roles/controller/tasks/deploy.yml
@@ -206,15 +206,12 @@
       "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() }}"
+      "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 | default() }}"
-      "CONFIG_whisk_runtimes_localImagePrefix":
-        "{{ runtimes_local_image_prefix | default() }}"
+        "{{ runtimes.bypass_pull_for_local_images }}"
+      "CONFIG_whisk_runtimes_localImagePrefix": "{{ runtimes.local_image_prefix }}"
 
       "METRICS_KAMON": "{{ metrics.kamon.enabled }}"
       "METRICS_KAMON_TAGS": "{{ metrics.kamon.tags }}"
@@ -286,4 +283,4 @@
   retries: 12
   delay: 5
 
-# VIM: let b:syntastic_yaml_yamllint_args="-c '".expand('%:p:h')."../../../yamllint.yml'"
+# VIM: let b:syntastic_yaml_yamllint_args="-c ".expand('%:p:h')."/../../../yamllint.yml"
diff --git a/ansible/roles/invoker/tasks/deploy.yml b/ansible/roles/invoker/tasks/deploy.yml
index f1f6bedde1..1a8a80448b 100644
--- a/ansible/roles/invoker/tasks/deploy.yml
+++ b/ansible/roles/invoker/tasks/deploy.yml
@@ -26,20 +26,23 @@
   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 != ""
+- 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 }}"
-
-- name: "pull blackboxes action images with tag {{docker.image.tag}}"
-  shell: "docker pull {{docker_registry}}{{docker.image.prefix}}/{{item.name}}:{{docker.image.tag}}"
+  when: image_prefix != runtimes.local_image_prefix
   with_items:
-    - "{{ runtimesManifest.blackboxes }}"
-  when: docker_registry != ""
-  retries: "{{ docker.pull.retries }}"
-  delay: "{{ docker.pull.delay }}"
+    - "{{ 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
@@ -192,11 +195,15 @@
       "WHISK_API_HOST_PROTO": "{{ whisk_api_host_proto | default('https') }}"
       "WHISK_API_HOST_PORT": "{{ whisk_api_host_port | default('443') }}"
       "WHISK_API_HOST_NAME": "{{ whisk_api_host_name | default(groups['edge'] | first) }}"
-      "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 }}"
       "DOCKER_REGISTRY": "{{ docker_registry }}"
       "DOCKER_IMAGE_PREFIX": "{{ docker.image.prefix }}"
       "DOCKER_IMAGE_TAG": "{{ docker.image.tag }}"
@@ -264,3 +271,5 @@
   until: result.status == 200
   retries: 12
   delay: 5
+
+# VIM: let b:syntastic_yaml_yamllint_args="-c ".expand('%:p:h')."/../../../yamllint.yml"
diff --git a/ansible/templates/whisk.properties.j2 b/ansible/templates/whisk.properties.j2
index bc7ff36db8..f24bfd574b 100644
--- a/ansible/templates/whisk.properties.j2
+++ b/ansible/templates/whisk.properties.j2
@@ -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 }}


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services