Move imagepullsecrets sample to samples/core (#1767)

* Remove redundant import.

* Simplify sample_test.yaml by using withItem syntax.

* Simplify sample_test.yaml by using withItem syntax.

* Change dict to str in withItems.

* Add image pull secret sample.

* Move imagepullsecret sample from test dir to sample dir. Waiting on corresponding unit test infra refactoring.

* Update the location of imagepullsecrets so that it can serve as an example.

* Add minimal comments documenting usage.
This commit is contained in:
Jiaxiao Zheng 2019-08-08 17:35:26 -07:00 committed by Kubernetes Prow Robot
parent 1407d86497
commit 90b9ad7657
3 changed files with 8 additions and 4 deletions

View File

@ -11,7 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Toy example demonstrating how to specify imagepullsecrets to access protected
container registry.
"""
import kfp.dsl as dsl
from kubernetes import client as k8s_client
@ -47,4 +49,6 @@ def save_most_frequent_word(message: str):
counter = GetFrequentWordOp(
name='get-Frequent',
message=message)
dsl.get_pipeline_conf().set_image_pull_secrets([k8s_client.V1ObjectReference(name="secretA")])
# Call set_image_pull_secrets after get_pipeline_conf().
dsl.get_pipeline_conf()\
.set_image_pull_secrets([k8s_client.V1ObjectReference(name="secretA")])

View File

@ -339,9 +339,9 @@ class TestCompiler(unittest.TestCase):
"""Test retry functionality."""
self._test_py_compile_yaml('retry')
def test_py_image_pull_secret(self):
def test_py_image_pull_secrets(self):
"""Test pipeline imagepullsecret."""
self._test_py_compile_yaml('imagepullsecret')
self._test_sample_py_compile_yaml('imagepullsecrets')
def test_py_timeout(self):
"""Test pipeline timeout."""