From 42ca473bbe598d18a6b0ae0addc9feca26a39531 Mon Sep 17 00:00:00 2001 From: Swagnik Dutta Date: Mon, 17 Apr 2023 16:53:59 +0530 Subject: [PATCH] feat(package): adds provision to specify pull policy for docker image --- riocli/apply/manifests/package-nonros-device.yaml | 1 + riocli/apply/manifests/package-ros-device-no-rosbag.yaml | 1 + riocli/apply/manifests/package-ros-device-rosbag.yaml | 1 + riocli/apply/manifests/package.yaml | 3 +++ riocli/jsonschema/schemas/package-schema.yaml | 9 +++++++++ riocli/package/model.py | 3 +++ 6 files changed, 18 insertions(+) diff --git a/riocli/apply/manifests/package-nonros-device.yaml b/riocli/apply/manifests/package-nonros-device.yaml index 82e4ba34..80a45d2e 100644 --- a/riocli/apply/manifests/package-nonros-device.yaml +++ b/riocli/apply/manifests/package-nonros-device.yaml @@ -33,6 +33,7 @@ spec: memory: 128 # Unit: MB (Optional) docker: image: "busybox:latest" + imagePullPolicy: "Always" # Always, Never, IfNotPresent(default) pullSecret: depends: kind: secret diff --git a/riocli/apply/manifests/package-ros-device-no-rosbag.yaml b/riocli/apply/manifests/package-ros-device-no-rosbag.yaml index 59e12fb6..02e381a8 100644 --- a/riocli/apply/manifests/package-ros-device-no-rosbag.yaml +++ b/riocli/apply/manifests/package-ros-device-no-rosbag.yaml @@ -34,6 +34,7 @@ spec: memory: 128 # Unit: MB (Optional) docker: image: "busybox:latest" + imagePullPolicy: "Always" # Always, Never, IfNotPresent(default) pullSecret: depends: kind: secret diff --git a/riocli/apply/manifests/package-ros-device-rosbag.yaml b/riocli/apply/manifests/package-ros-device-rosbag.yaml index 7bb87062..2d68df3b 100644 --- a/riocli/apply/manifests/package-ros-device-rosbag.yaml +++ b/riocli/apply/manifests/package-ros-device-rosbag.yaml @@ -34,6 +34,7 @@ spec: memory: 128 # Unit: MB (Optional) docker: image: "busybox:latest" + imagePullPolicy: "Always" # Always, Never, IfNotPresent(default) pullSecret: depends: kind: secret diff --git a/riocli/apply/manifests/package.yaml b/riocli/apply/manifests/package.yaml index 6391b0a8..77a2665e 100644 --- a/riocli/apply/manifests/package.yaml +++ b/riocli/apply/manifests/package.yaml @@ -179,6 +179,7 @@ spec: memory: 128 # Unit: MB (Optional) docker: image: "busybox:latest" + imagePullPolicy: "Always" # Always, Never, IfNotPresent(default) pullSecret: depends: kind: secret @@ -389,6 +390,7 @@ spec: memory: 128 # Unit: MB (Optional) docker: image: "busybox:latest" + imagePullPolicy: "Always" # Always, Never, IfNotPresent(default) pullSecret: depends: kind: secret @@ -442,6 +444,7 @@ spec: memory: 128 # Unit: MB (Optional) docker: image: "busybox:latest" + imagePullPolicy: "Always" # Always, Never, IfNotPresent(default) pullSecret: depends: kind: secret diff --git a/riocli/jsonschema/schemas/package-schema.yaml b/riocli/jsonschema/schemas/package-schema.yaml index 17fa5fef..3a62753b 100644 --- a/riocli/jsonschema/schemas/package-schema.yaml +++ b/riocli/jsonschema/schemas/package-schema.yaml @@ -150,6 +150,8 @@ definitions: properties: image: "$ref": "#/definitions/imageName" + imagePullPolicy: + "$ref": "#/definitions/imagePullPolicy" pullSecret: "$ref": "#/definitions/secretDepends" required: @@ -660,6 +662,13 @@ definitions: imageName: type: string pattern: ^([a-zA-Z0-9])([\w.\-_]+((?::\d+|)(?=/[a-z0-9._-]+/[a-z0-9._-]+))|)(?:/|)([a-z0-9.\-_]+(?:/[a-z0-9.\-_]+|))(:([\w.\-_]{1,126})|)$ + imagePullPolicy: + type: string + enum: + - Always + - IfNotPresent + - Never + default: IfNotPresent buildDepends: properties: diff --git a/riocli/package/model.py b/riocli/package/model.py index c10b5884..de881fde 100644 --- a/riocli/package/model.py +++ b/riocli/package/model.py @@ -212,6 +212,9 @@ def _map_executable(self, exec): secret_guid, secret = self.rc.find_depends(exec.docker.pullSecret.depends) exec_object.secret = secret_guid + if exec.docker.get('imagePullPolicy'): + exec_object.imagePullPolicy = exec.docker.imagePullPolicy + if exec.type == 'build': exec_object.buildGUID = exec.build.depends.guid # TODO verify this is right for secret?