Skip to content

Commit 2ccd6fa

Browse files
committed
make openshift start --write-config take a dir
1 parent fac1104 commit 2ccd6fa

32 files changed

+407
-561
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Once the container is started, you can jump into a console inside the container
6161

6262
If you just want to experiment with the API without worrying about security privileges, you can disable authorization checks by running this from the host system. This command grants full access to anyone.
6363

64-
$ docker exec -it openshift-origin bash -c "openshift admin policy add-role-to-group cluster-admin system:authenticated system:unauthenticated --config=/var/lib/openshift/openshift.local.certificates/admin/.kubeconfig"
64+
$ docker exec -it openshift-origin bash -c "openshift admin policy add-role-to-group cluster-admin system:authenticated system:unauthenticated --config=/var/lib/openshift/openshift.local.master/admin.kubeconfig"
6565

6666

6767
### Start Developing
@@ -83,7 +83,7 @@ Once setup with a Go development environment and Docker, you can:
8383
3. In another terminal window, switch to the directory and start an app:
8484

8585
$ cd $GOPATH/src/github.com/openshift/origin
86-
$ export OPENSHIFTCONFIG=`pwd`/openshift.local.certificates/admin/.kubeconfig
86+
$ export OPENSHIFTCONFIG=`pwd`/openshift.local.config/master/admin.kubeconfig
8787
$ _output/local/go/bin/osc create -f examples/hello-openshift/hello-pod.json
8888

8989
In your browser, go to [http://localhost:6061](http://localhost:6061) and you should see 'Welcome to OpenShift'.

docs/routing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ Once it is pulled it will start and be visible in the `docker ps` list of contai
3232
[vagrant@openshiftdev origin]$ sudo /data/src/github.com/openshift/origin/_output/local/bin/linux/amd64/openshift start &
3333

3434
If running in https mode, ensure osc can authenticate to the master
35-
[vagrant@openshiftdev origin]$ export KUBECONFIG=/data/src/github.com/openshift/origin/openshift.local.certificates/admin/.kubeconfig
35+
[vagrant@openshiftdev origin]$ export KUBECONFIG=/data/src/github.com/openshift/origin/openshift.local.config/master/admin.kubeconfig
3636
[vagrant@openshiftdev origin]$ sudo chmod a+r "$KUBECONFIG"
37-
[vagrant@openshiftdev origin]$ sudo chmod a+r openshift.local.certificates/openshift-router/.kubeconfig
38-
[vagrant@openshiftdev origin]$ openshift ex router --create --credentials="openshift.local.certificates/openshift-router/.kubeconfig"
37+
[vagrant@openshiftdev origin]$ sudo chmod a+r openshift.local.config/master/openshift-router.kubeconfig
38+
[vagrant@openshiftdev origin]$ openshift ex router --create --credentials="openshift.local.config/master/openshift-router.kubeconfig"
3939
[vagrant@openshiftdev origin]$ osc get pods
4040

4141
#### Clustered vagrant environment

examples/jenkins/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Steps
3535

3636
1. Go back to your browser, refresh and select the rubyJob build job.
3737
2. Choose `Configure`.
38-
3. Locate the KUBECONFIG_CREDENTIALS parameter, and replace the default value with the contents of the `openshift.local.certificates/openshift-client/.kubeconfig` file.
38+
3. Locate the KUBECONFIG_CREDENTIALS parameter, and replace the default value with the contents of the `openshift.local.config/master/.openshift-client-kubeconfig` file.
3939
4. Click `Save`.
4040

4141
6. Run the Jenkins build

examples/sample-app/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ This section covers how to perform all the steps of building, deploying, and upd
129129
installation, users would generate their own keys and not have access
130130
to the system keys.)
131131

132-
$ export OPENSHIFTCONFIG=`pwd`/openshift.local.certificates/admin/.kubeconfig
133-
$ export CURL_CA_BUNDLE=`pwd`/openshift.local.certificates/ca/cert.crt
132+
$ export OPENSHIFTCONFIG=`pwd`/openshift.local.config/master/admin.kubeconfig
133+
$ export CURL_CA_BUNDLE=`pwd`/openshift.local.config/master/ca.crt
134134
$ sudo chmod a+rwX "$OPENSHIFTCONFIG"
135135

136136

@@ -152,8 +152,8 @@ This section covers how to perform all the steps of building, deploying, and upd
152152

153153
6. Deploy a private docker registry within OpenShift with the certs necessary for access to master:
154154

155-
$ sudo chmod +r ./openshift.local.certificates/openshift-registry/.kubeconfig
156-
$ openshift ex registry --create --credentials=./openshift.local.certificates/openshift-registry/.kubeconfig
155+
$ sudo chmod +r ./openshift.local.config/master/openshift-registry.kubeconfig
156+
$ openshift ex registry --create --credentials=./openshift.local.config/master/openshift-registry.kubeconfig
157157
docker-registry # the service
158158
docker-registry # the deployment config
159159

@@ -378,8 +378,8 @@ the ip address shown below with the correct one for your environment.
378378
# take some time. Your pod will stay in Pending state while the pull is completed
379379
$ docker pull openshift/origin-haproxy-router
380380

381-
$ sudo chmod +r `pwd`/openshift.local.certificates/openshift-router/.kubeconfig
382-
$ openshift ex router --create --credentials="`pwd`/openshift.local.certificates/openshift-router/.kubeconfig"
381+
$ sudo chmod +r `pwd`/openshift.local.config/master/openshift-router.kubeconfig
382+
$ openshift ex router --create --credentials="`pwd`/openshift.local.config/master/openshift-router.kubeconfig"
383383
router # the service
384384
router # the deployment config
385385

examples/sample-app/container-setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ bits that are used in the sample app.
6060

6161
## Configure client security
6262

63-
$ export CURL_CA_BUNDLE=`pwd`/openshift.local.certificates/ca/cert.crt
63+
$ export CURL_CA_BUNDLE=`pwd`/openshift.local.config/master/ca.crt
6464

6565
For more information on this step, see [Application Build, Deploy, and Update
6666
Flow](https://github.com/openshift/origin/blob/master/examples/sample-app/README.md#application-build-deploy-and-update-flow),

hack/export-certs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This command attempts to export the correct arguments for a curl client.
44
# Exports CURL_ARGS which should be used with curl:
55
#
6-
# $ source hack/export-certs.sh ./openshift.local.certificates/admin
6+
# $ source hack/export-certs.sh ./openshift.local.config/master/admin
77
# $ curl $CURL_ARGS <a protected URL>
88

99
set -o errexit

hack/test-cmd.sh

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,12 @@ KUBELET_PORT=${KUBELET_PORT:-10250}
5151
TEMP_DIR=${USE_TEMP:-$(mktemp -d /tmp/openshift-cmd.XXXX)}
5252
ETCD_DATA_DIR="${TEMP_DIR}/etcd"
5353
VOLUME_DIR="${TEMP_DIR}/volumes"
54-
CERT_DIR="${TEMP_DIR}/certs"
54+
FAKE_HOME_DIR="${TEMP_DIR}/openshift.local.home"
55+
SERVER_CONFIG_DIR="${TEMP_DIR}/openshift.local.config"
56+
MASTER_CONFIG_DIR="${SERVER_CONFIG_DIR}/master"
57+
NODE_CONFIG_DIR="${SERVER_CONFIG_DIR}/node-${KUBELET_HOST}"
5558
CONFIG_DIR="${TEMP_DIR}/configs"
56-
mkdir -p "${ETCD_DATA_DIR}" "${VOLUME_DIR}" "${CERT_DIR}" "${CONFIG_DIR}"
59+
mkdir -p "${ETCD_DATA_DIR}" "${VOLUME_DIR}" "${FAKE_HOME_DIR}" "${MASTER_CONFIG_DIR}" "${NODE_CONFIG_DIR}" "${CONFIG_DIR}"
5760

5861
# handle profiling defaults
5962
profile="${OPENSHIFT_PROFILE-}"
@@ -78,7 +81,7 @@ echo openshift: $out
7881
export OPENSHIFT_PROFILE="${WEB_PROFILE-}"
7982

8083
# Specify the scheme and port for the listen address, but let the IP auto-discover. Set --public-master to localhost, for a stable link to the console.
81-
echo "[INFO] Create certificates for the OpenShift server to ${CERT_DIR}"
84+
echo "[INFO] Create certificates for the OpenShift server to ${MASTER_CONFIG_DIR}"
8285
# find the same IP that openshift start will bind to. This allows access from pods that have to talk back to master
8386
ALL_IP_ADDRESSES=`ifconfig | grep "inet " | awk '{print $2}'`
8487
SERVER_HOSTNAME_LIST="${PUBLIC_MASTER_HOST},localhost"
@@ -89,42 +92,48 @@ done <<< "${ALL_IP_ADDRESSES}"
8992

9093
openshift admin create-master-certs \
9194
--overwrite=false \
92-
--cert-dir="${CERT_DIR}" \
95+
--cert-dir="${MASTER_CONFIG_DIR}" \
9396
--hostnames="${SERVER_HOSTNAME_LIST}" \
9497
--master="${MASTER_ADDR}" \
9598
--public-master="${API_SCHEME}://${PUBLIC_MASTER_HOST}"
9699

97100
openshift admin create-node-config \
98101
--listen="${KUBELET_SCHEME}://0.0.0.0:${KUBELET_PORT}" \
99-
--node-dir="${CERT_DIR}/node-${KUBELET_HOST}" \
102+
--node-dir="${NODE_CONFIG_DIR}/node-${KUBELET_HOST}" \
100103
--node="${KUBELET_HOST}" \
101104
--hostnames="${KUBELET_HOST}" \
102105
--master="${MASTER_ADDR}" \
103-
--node-client-certificate-authority="${CERT_DIR}/ca/cert.crt" \
104-
--certificate-authority="${CERT_DIR}/ca/cert.crt" \
105-
--signer-cert="${CERT_DIR}/ca/cert.crt" \
106-
--signer-key="${CERT_DIR}/ca/key.key" \
107-
--signer-serial="${CERT_DIR}/ca/serial.txt"
108-
109-
# Start openshift
110-
OPENSHIFT_ON_PANIC=crash openshift start \
106+
--node-client-certificate-authority="${MASTER_CONFIG_DIR}/ca.crt" \
107+
--certificate-authority="${MASTER_CONFIG_DIR}/ca.crt" \
108+
--signer-cert="${MASTER_CONFIG_DIR}/ca.crt" \
109+
--signer-key="${MASTER_CONFIG_DIR}/ca.key" \
110+
--signer-serial="${MASTER_CONFIG_DIR}/ca.serial.txt"
111+
112+
# create openshift config
113+
openshift start \
114+
--write-config=${SERVER_CONFIG_DIR} \
111115
--master="${API_SCHEME}://${API_HOST}:${API_PORT}" \
112116
--listen="${API_SCHEME}://${API_HOST}:${API_PORT}" \
113117
--hostname="${KUBELET_HOST}" \
114118
--volume-dir="${VOLUME_DIR}" \
115-
--cert-dir="${CERT_DIR}" \
116-
--etcd-dir="${ETCD_DATA_DIR}" \
117-
--create-certs=false 1>&2 &
119+
--etcd-dir="${ETCD_DATA_DIR}"
120+
121+
122+
# Start openshift
123+
OPENSHIFT_ON_PANIC=crash openshift start \
124+
--master-config=${MASTER_CONFIG_DIR}/master.yaml \
125+
--node-config=${NODE_CONFIG_DIR}/node-${KUBELET_HOST}/node-config.yaml \
126+
1>&2 &
118127
OS_PID=$!
119128

120129
if [[ "${API_SCHEME}" == "https" ]]; then
121-
export CURL_CA_BUNDLE="${CERT_DIR}/ca/cert.crt"
122-
export CURL_CERT="${CERT_DIR}/admin/cert.crt"
123-
export CURL_KEY="${CERT_DIR}/admin/key.key"
130+
export CURL_CA_BUNDLE="${MASTER_CONFIG_DIR}/ca.crt"
131+
export CURL_CERT="${MASTER_CONFIG_DIR}/admin.crt"
132+
export CURL_KEY="${MASTER_CONFIG_DIR}/admin.key"
124133
fi
125134

126135
# set the home directory so we don't pick up the users .config
127-
export HOME="${CERT_DIR}/admin"
136+
export HOME="${FAKE_HOME_DIR}"
128137

129138
wait_for_url "${KUBELET_SCHEME}://${KUBELET_HOST}:${KUBELET_PORT}/healthz" "kubelet: " 0.25 80
130139
wait_for_url "${API_SCHEME}://${API_HOST}:${API_PORT}/healthz" "apiserver: " 0.25 80
@@ -147,22 +156,19 @@ export KUBERNETES_MASTER="${API_SCHEME}://${API_HOST}:${API_PORT}"
147156
if [[ "${API_SCHEME}" == "https" ]]; then
148157
# test bad certificate
149158
[ "$(osc get services 2>&1 | grep 'certificate signed by unknown authority')" ]
150-
151-
# ignore anything in the running user's $HOME dir
152-
export HOME="${CERT_DIR}/admin"
153159
fi
154160

155161
# test config files from the --config flag
156-
osc get services --config="${CERT_DIR}/admin/.kubeconfig"
162+
osc get services --config="${MASTER_CONFIG_DIR}/admin.kubeconfig"
157163

158164
# test config files from env vars
159-
OPENSHIFTCONFIG="${CERT_DIR}/admin/.kubeconfig" osc get services
160-
KUBECONFIG="${CERT_DIR}/admin/.kubeconfig" osc get services
165+
OPENSHIFTCONFIG="${MASTER_CONFIG_DIR}/admin.kubeconfig" osc get services
166+
KUBECONFIG="${MASTER_CONFIG_DIR}/admin.kubeconfig" osc get services
161167

162168
# test config files in the current directory
163169
TEMP_PWD=`pwd`
164170
pushd ${CONFIG_DIR} >/dev/null
165-
cp ${CERT_DIR}/admin/.kubeconfig .openshiftconfig
171+
cp ${MASTER_CONFIG_DIR}/admin.kubeconfig .openshiftconfig
166172
${TEMP_PWD}/${GO_OUT}/osc get services
167173
mv .openshiftconfig .kubeconfig
168174
${TEMP_PWD}/${GO_OUT}/osc get services

hack/test-end-to-end.sh

Lines changed: 40 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ if [[ -z "${BASETMPDIR-}" ]]; then
4545
fi
4646
ETCD_DATA_DIR="${BASETMPDIR}/etcd"
4747
VOLUME_DIR="${BASETMPDIR}/volumes"
48-
CERT_DIR="${BASETMPDIR}/certs"
48+
FAKE_HOME_DIR="${BASETMPDIR}/openshift.local.home"
4949
LOG_DIR="${LOG_DIR:-${BASETMPDIR}/logs}"
5050
ARTIFACT_DIR="${ARTIFACT_DIR:-${BASETMPDIR}/artifacts}"
5151
mkdir -p $LOG_DIR
@@ -61,6 +61,10 @@ KUBELET_SCHEME="${KUBELET_SCHEME:-https}"
6161
KUBELET_HOST="${KUBELET_HOST:-127.0.0.1}"
6262
KUBELET_PORT="${KUBELET_PORT:-10250}"
6363

64+
SERVER_CONFIG_DIR="${BASETMPDIR}/openshift.local.config"
65+
MASTER_CONFIG_DIR="${SERVER_CONFIG_DIR}/master"
66+
NODE_CONFIG_DIR="${SERVER_CONFIG_DIR}/node-${KUBELET_HOST}"
67+
6468
# use the docker bridge ip address until there is a good way to get the auto-selected address from master
6569
# this address is considered stable
6670
# used as a resolve IP to test routing
@@ -177,7 +181,7 @@ echo "[INFO] `openshift version`"
177181
echo "[INFO] Server logs will be at: ${LOG_DIR}/openshift.log"
178182
echo "[INFO] Test artifacts will be in: ${ARTIFACT_DIR}"
179183
echo "[INFO] Volumes dir is: ${VOLUME_DIR}"
180-
echo "[INFO] Certs dir is: ${CERT_DIR}"
184+
echo "[INFO] Config dir is: ${SERVER_CONFIG_DIR}"
181185
echo "[INFO] Using images: ${USE_IMAGES}"
182186

183187
# Start All-in-one server and wait for health
@@ -192,47 +196,53 @@ done <<< "${ALL_IP_ADDRESSES}"
192196

193197
openshift admin create-master-certs \
194198
--overwrite=false \
195-
--cert-dir="${CERT_DIR}" \
199+
--cert-dir="${MASTER_CONFIG_DIR}" \
196200
--hostnames="${SERVER_HOSTNAME_LIST}" \
197201
--master="${MASTER_ADDR}" \
198202
--public-master="${API_SCHEME}://${PUBLIC_MASTER_HOST}"
199203

200204
openshift admin create-node-config \
201205
--listen="${KUBELET_SCHEME}://0.0.0.0:${KUBELET_PORT}" \
202-
--node-dir="${CERT_DIR}/node-${KUBELET_HOST}" \
206+
--node-dir="${NODE_CONFIG_DIR}" \
203207
--node="${KUBELET_HOST}" \
204208
--hostnames="${KUBELET_HOST}" \
205209
--master="${MASTER_ADDR}" \
206-
--node-client-certificate-authority="${CERT_DIR}/ca/cert.crt" \
207-
--certificate-authority="${CERT_DIR}/ca/cert.crt" \
208-
--signer-cert="${CERT_DIR}/ca/cert.crt" \
209-
--signer-key="${CERT_DIR}/ca/key.key" \
210-
--signer-serial="${CERT_DIR}/ca/serial.txt"
210+
--node-client-certificate-authority="${MASTER_CONFIG_DIR}/ca.crt" \
211+
--certificate-authority="${MASTER_CONFIG_DIR}/ca.crt" \
212+
--signer-cert="${MASTER_CONFIG_DIR}/ca.crt" \
213+
--signer-key="${MASTER_CONFIG_DIR}/ca.key" \
214+
--signer-serial="${MASTER_CONFIG_DIR}/ca.serial.txt"
215+
216+
# create openshift config
217+
openshift start \
218+
--write-config=${SERVER_CONFIG_DIR} \
219+
--listen="${API_SCHEME}://0.0.0.0:${API_PORT}" \
220+
--master="${MASTER_ADDR}" \
221+
--public-master="${API_SCHEME}://${PUBLIC_MASTER_HOST}" \
222+
--hostname="${KUBELET_HOST}" \
223+
--volume-dir="${VOLUME_DIR}" \
224+
--etcd-dir="${ETCD_DATA_DIR}" \
225+
--images="${USE_IMAGES}"
226+
211227

212228
echo "[INFO] Starting OpenShift server"
213229
sudo env "PATH=${PATH}" OPENSHIFT_PROFILE=web OPENSHIFT_ON_PANIC=crash openshift start \
214-
--listen="${API_SCHEME}://0.0.0.0:${API_PORT}" \
215-
--master="${MASTER_ADDR}" \
216-
--public-master="${API_SCHEME}://${PUBLIC_MASTER_HOST}" \
217-
--hostname="${KUBELET_HOST}" \
218-
--volume-dir="${VOLUME_DIR}" \
219-
--etcd-dir="${ETCD_DATA_DIR}" \
220-
--cert-dir="${CERT_DIR}" \
221-
--loglevel=4 \
222-
--images="${USE_IMAGES}" \
223-
--create-certs=false \
224-
&> "${LOG_DIR}/openshift.log" &
230+
--master-config=${MASTER_CONFIG_DIR}/master.yaml \
231+
--node-config=${NODE_CONFIG_DIR}/node-config.yaml \
232+
--loglevel=4 \
233+
&> "${LOG_DIR}/openshift.log" &
225234
OS_PID=$!
235+
236+
export HOME="${FAKE_HOME_DIR}"
226237

227238
if [[ "${API_SCHEME}" == "https" ]]; then
228-
export CURL_CA_BUNDLE="${CERT_DIR}/ca/cert.crt"
229-
export CURL_CERT="${CERT_DIR}/admin/cert.crt"
230-
export CURL_KEY="${CERT_DIR}/admin/key.key"
231-
232-
# Make osc use ${CERT_DIR}/admin/.kubeconfig, and ignore anything in the running user's $HOME dir
233-
export HOME="${CERT_DIR}/admin"
234-
sudo chmod -R a+rwX "${HOME}"
235-
export OPENSHIFTCONFIG="${CERT_DIR}/admin/.kubeconfig"
239+
export CURL_CA_BUNDLE="${MASTER_CONFIG_DIR}/ca.crt"
240+
export CURL_CERT="${MASTER_CONFIG_DIR}/admin.crt"
241+
export CURL_KEY="${MASTER_CONFIG_DIR}/admin.key"
242+
243+
# Make osc use ${MASTER_CONFIG_DIR}/admin.kubeconfig, and ignore anything in the running user's $HOME dir
244+
export OPENSHIFTCONFIG="${MASTER_CONFIG_DIR}/admin.kubeconfig"
245+
sudo chmod -R a+rwX "${OPENSHIFTCONFIG}"
236246
echo "[INFO] To debug: export OPENSHIFTCONFIG=$OPENSHIFTCONFIG"
237247
fi
238248

@@ -253,12 +263,12 @@ echo "Log in as 'e2e-user' to see the 'test' project."
253263

254264
# install the router
255265
echo "[INFO] Installing the router"
256-
openshift admin router --create --credentials="${CERT_DIR}/openshift-router/.kubeconfig" --images="${USE_IMAGES}"
266+
openshift admin router --create --credentials="${MASTER_CONFIG_DIR}/openshift-router.kubeconfig" --images="${USE_IMAGES}"
257267

258268
# install the registry. The --mount-host option is provided to reuse local storage.
259269
echo "[INFO] Installing the registry"
260270
# TODO: add --images="${USE_IMAGES}" when the Docker registry is built alongside OpenShift
261-
openshift admin registry --create --credentials="${CERT_DIR}/openshift-registry/.kubeconfig" --mount-host="/tmp/openshift.local.registry" --images='openshift/origin-${component}:latest'
271+
openshift admin registry --create --credentials="${MASTER_CONFIG_DIR}/openshift-registry.kubeconfig" --mount-host="/tmp/openshift.local.registry" --images='openshift/origin-${component}:latest'
262272

263273
echo "[INFO] Pre-pulling and pushing ruby-20-centos7"
264274
docker pull openshift/ruby-20-centos7:latest

0 commit comments

Comments
 (0)