From 75a4cd4c797a733941d368298a28dcd299f7680a Mon Sep 17 00:00:00 2001 From: Michal Fojtik Date: Tue, 2 Jun 2015 15:14:07 +0200 Subject: [PATCH] Use bundle-secret for Secret creation --- architecture/core_objects/builds.adoc | 41 +++++++++------------------ 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/architecture/core_objects/builds.adoc b/architecture/core_objects/builds.adoc index 6e8b049f1628..bd513efed036 100644 --- a/architecture/core_objects/builds.adoc +++ b/architecture/core_objects/builds.adoc @@ -147,6 +147,8 @@ images. Supply the `.dockercfg` file with valid Docker Registry credentials in order to push the output image into a private Docker Registry or pull the builder image from the private Docker Registry that requires authentication. +For the OpenShift Docker Registry, you don't have to do this because the Secrets +are generated automatically for you by OpenShift. The *_.dockercfg_* JSON file exists in your home directory by default and has following format: @@ -171,39 +173,22 @@ You can define multiple Docker registry entries in this file. Alternatively, you can also add authentication entries to this file by running the `docker login` command. The file will be created if it does not exist. -Kubernetes provides the -https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/design/secrets.md[Secret] -resource, which is used to store your configuration and passwords. You must -first create the `*Secret*` before builds can use your *_.dockercfg_* file for -pushing the output image: +Kubernetes provides the https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/design/secrets.md[Secret] +resource, which is used to store your configuration and passwords. -==== ----- -$ osc create -f secret.json ----- -==== - -The `*data*` field for the `*Secret*` object must contain the `*dockercfg*` key -with the value set to the base64-encoded content of the *_.dockercfg_* file. For -example: +To create the `*Secret*` resource from your local `.dockercfg` file, you can run +following command: ==== - ---- -{ - "apiVersion": "v1beta3", - "kind": "Secret", - "metadata": { - "name": "dockerhub" - }, - "data": { - "dockercfg": "6yJodHRwc1ovL2zuZGV4LmRvY21lci5aby92MS8iOnsiYXV0aCI6ImJXWnZhblJwYXpwdVoybGxkR2d4TUE9PSIsImVtYWlsIj8ibWlAbWlmby5zayJ9fQ==" - } -} - +$ openshift ex bundle-secret dockerhub ~/.dockercfg | osc create -f - ---- ==== +This command generates JSON specification of the Secret resource named +'dockerhub'. Then this resource is passed to the standard input of `*osc create*` +command. + Once you have the `*Secret*` created, you can add a `PushSecret` field into the `Output` section of the `BuildConfig` and set it to the name of the `*Secret*` that you created, which in the above example is `*dockerhub*`: @@ -230,7 +215,7 @@ Pull the builder Docker image from a private Docker registry by specifying the ---- { "strategy": { - "stiStrategy": { + "sourceStrategy": { "from": { "kind": "DockerImage", "name": "docker.io/user/private_repository" @@ -239,7 +224,7 @@ Pull the builder Docker image from a private Docker registry by specifying the "name": "dockerhub" }, }, - "type": "STI" + "type": "Source" } } ----