Skip to content

Commit 7e953e3

Browse files
committed
make openshift start --write-config take a dir
1 parent 67486ff commit 7e953e3

35 files changed

+481
-606
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.config/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 OPENSHIFTCONFIG=/data/src/github.com/openshift/origin/openshift.local.certificates/admin/.kubeconfig
35+
[vagrant@openshiftdev origin]$ export OPENSHIFTCONFIG=/data/src/github.com/openshift/origin/openshift.local.config/master/admin.kubeconfig
3636
[vagrant@openshiftdev origin]$ sudo chmod a+r "$OPENSHIFTCONFIG"
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: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,12 @@ KUBELET_PORT=${KUBELET_PORT:-10250}
5050
TEMP_DIR=${USE_TEMP:-$(mktemp -d /tmp/openshift-cmd.XXXX)}
5151
ETCD_DATA_DIR="${TEMP_DIR}/etcd"
5252
VOLUME_DIR="${TEMP_DIR}/volumes"
53-
CERT_DIR="${TEMP_DIR}/certs"
53+
FAKE_HOME_DIR="${TEMP_DIR}/openshift.local.home"
54+
SERVER_CONFIG_DIR="${TEMP_DIR}/openshift.local.config"
55+
MASTER_CONFIG_DIR="${SERVER_CONFIG_DIR}/master"
56+
NODE_CONFIG_DIR="${SERVER_CONFIG_DIR}/node-${KUBELET_HOST}"
5457
CONFIG_DIR="${TEMP_DIR}/configs"
55-
mkdir -p "${ETCD_DATA_DIR}" "${VOLUME_DIR}" "${CERT_DIR}" "${CONFIG_DIR}"
58+
mkdir -p "${ETCD_DATA_DIR}" "${VOLUME_DIR}" "${FAKE_HOME_DIR}" "${MASTER_CONFIG_DIR}" "${NODE_CONFIG_DIR}" "${CONFIG_DIR}"
5659

5760
# handle profiling defaults
5861
profile="${OPENSHIFT_PROFILE-}"
@@ -77,7 +80,7 @@ echo openshift: $out
7780
export OPENSHIFT_PROFILE="${WEB_PROFILE-}"
7881

7982
# 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.
80-
echo "[INFO] Create certificates for the OpenShift server to ${CERT_DIR}"
83+
echo "[INFO] Create certificates for the OpenShift server to ${MASTER_CONFIG_DIR}"
8184
# find the same IP that openshift start will bind to. This allows access from pods that have to talk back to master
8285
ALL_IP_ADDRESSES=`ifconfig | grep "inet " | awk '{print $2}'`
8386
SERVER_HOSTNAME_LIST="${PUBLIC_MASTER_HOST},localhost"
@@ -88,42 +91,51 @@ done <<< "${ALL_IP_ADDRESSES}"
8891

8992
openshift admin create-master-certs \
9093
--overwrite=false \
91-
--cert-dir="${CERT_DIR}" \
94+
--cert-dir="${MASTER_CONFIG_DIR}" \
9295
--hostnames="${SERVER_HOSTNAME_LIST}" \
9396
--master="${MASTER_ADDR}" \
9497
--public-master="${API_SCHEME}://${PUBLIC_MASTER_HOST}"
9598

9699
openshift admin create-node-config \
97100
--listen="${KUBELET_SCHEME}://0.0.0.0:${KUBELET_PORT}" \
98-
--node-dir="${CERT_DIR}/node-${KUBELET_HOST}" \
101+
--node-dir="${NODE_CONFIG_DIR}" \
99102
--node="${KUBELET_HOST}" \
100103
--hostnames="${KUBELET_HOST}" \
101104
--master="${MASTER_ADDR}" \
102-
--node-client-certificate-authority="${CERT_DIR}/ca/cert.crt" \
103-
--certificate-authority="${CERT_DIR}/ca/cert.crt" \
104-
--signer-cert="${CERT_DIR}/ca/cert.crt" \
105-
--signer-key="${CERT_DIR}/ca/key.key" \
106-
--signer-serial="${CERT_DIR}/ca/serial.txt"
107-
108-
# Start openshift
109-
OPENSHIFT_ON_PANIC=crash openshift start \
105+
--node-client-certificate-authority="${MASTER_CONFIG_DIR}/ca.crt" \
106+
--certificate-authority="${MASTER_CONFIG_DIR}/ca.crt" \
107+
--signer-cert="${MASTER_CONFIG_DIR}/ca.crt" \
108+
--signer-key="${MASTER_CONFIG_DIR}/ca.key" \
109+
--signer-serial="${MASTER_CONFIG_DIR}/ca.serial.txt"
110+
111+
osadm create-bootstrap-policy-file --filename="${MASTER_CONFIG_DIR}/policy.json"
112+
113+
# create openshift config
114+
openshift start \
115+
--write-config=${SERVER_CONFIG_DIR} \
116+
--create-certs=false \
110117
--master="${API_SCHEME}://${API_HOST}:${API_PORT}" \
111118
--listen="${API_SCHEME}://${API_HOST}:${API_PORT}" \
112119
--hostname="${KUBELET_HOST}" \
113120
--volume-dir="${VOLUME_DIR}" \
114-
--cert-dir="${CERT_DIR}" \
115-
--etcd-dir="${ETCD_DATA_DIR}" \
116-
--create-certs=false 1>&2 &
121+
--etcd-dir="${ETCD_DATA_DIR}"
122+
123+
124+
# Start openshift
125+
OPENSHIFT_ON_PANIC=crash openshift start \
126+
--master-config=${MASTER_CONFIG_DIR}/master-config.yaml \
127+
--node-config=${NODE_CONFIG_DIR}/node-config.yaml \
128+
1>&2 &
117129
OS_PID=$!
118130

119131
if [[ "${API_SCHEME}" == "https" ]]; then
120-
export CURL_CA_BUNDLE="${CERT_DIR}/ca/cert.crt"
121-
export CURL_CERT="${CERT_DIR}/admin/cert.crt"
122-
export CURL_KEY="${CERT_DIR}/admin/key.key"
132+
export CURL_CA_BUNDLE="${MASTER_CONFIG_DIR}/ca.crt"
133+
export CURL_CERT="${MASTER_CONFIG_DIR}/admin.crt"
134+
export CURL_KEY="${MASTER_CONFIG_DIR}/admin.key"
123135
fi
124136

125137
# set the home directory so we don't pick up the users .config
126-
export HOME="${CERT_DIR}/admin"
138+
export HOME="${FAKE_HOME_DIR}"
127139

128140
wait_for_url "${KUBELET_SCHEME}://${KUBELET_HOST}:${KUBELET_PORT}/healthz" "kubelet: " 0.25 80
129141
wait_for_url "${API_SCHEME}://${API_HOST}:${API_PORT}/healthz" "apiserver: " 0.25 80
@@ -146,21 +158,18 @@ export KUBERNETES_MASTER="${API_SCHEME}://${API_HOST}:${API_PORT}"
146158
if [[ "${API_SCHEME}" == "https" ]]; then
147159
# test bad certificate
148160
[ "$(osc get services 2>&1 | grep 'certificate signed by unknown authority')" ]
149-
150-
# ignore anything in the running user's $HOME dir
151-
export HOME="${CERT_DIR}/admin"
152161
fi
153162

154163
# test config files from the --config flag
155-
osc get services --config="${CERT_DIR}/admin/.kubeconfig"
164+
osc get services --config="${MASTER_CONFIG_DIR}/admin.kubeconfig"
156165

157166
# test config files from env vars
158-
OPENSHIFTCONFIG="${CERT_DIR}/admin/.kubeconfig" osc get services
167+
OPENSHIFTCONFIG="${MASTER_CONFIG_DIR}/admin.kubeconfig" osc get services
159168

160169
# test config files in the current directory
161170
TEMP_PWD=`pwd`
162171
pushd ${CONFIG_DIR} >/dev/null
163-
cp ${CERT_DIR}/admin/.kubeconfig .openshiftconfig
172+
cp ${MASTER_CONFIG_DIR}/admin.kubeconfig .openshiftconfig
164173
${TEMP_PWD}/${GO_OUT}/osc get services
165174
popd
166175

hack/test-end-to-end.sh

Lines changed: 51 additions & 38 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
@@ -191,48 +195,57 @@ do
191195
done <<< "${ALL_IP_ADDRESSES}"
192196

193197
openshift admin create-master-certs \
194-
--overwrite=false \
195-
--cert-dir="${CERT_DIR}" \
196-
--hostnames="${SERVER_HOSTNAME_LIST}" \
197-
--master="${MASTER_ADDR}" \
198-
--public-master="${API_SCHEME}://${PUBLIC_MASTER_HOST}"
198+
--overwrite=false \
199+
--cert-dir="${MASTER_CONFIG_DIR}" \
200+
--hostnames="${SERVER_HOSTNAME_LIST}" \
201+
--master="${MASTER_ADDR}" \
202+
--public-master="${API_SCHEME}://${PUBLIC_MASTER_HOST}"
199203

200204
openshift admin create-node-config \
201-
--listen="${KUBELET_SCHEME}://0.0.0.0:${KUBELET_PORT}" \
202-
--node-dir="${CERT_DIR}/node-${KUBELET_HOST}" \
203-
--node="${KUBELET_HOST}" \
204-
--hostnames="${KUBELET_HOST}" \
205-
--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"
205+
--listen="${KUBELET_SCHEME}://0.0.0.0:${KUBELET_PORT}" \
206+
--node-dir="${NODE_CONFIG_DIR}" \
207+
--node="${KUBELET_HOST}" \
208+
--hostnames="${KUBELET_HOST}" \
209+
--master="${MASTER_ADDR}" \
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+
osadm create-bootstrap-policy-file --filename="${MASTER_CONFIG_DIR}/policy.json"
217+
218+
# create openshift config
219+
openshift start \
220+
--write-config=${SERVER_CONFIG_DIR} \
221+
--create-certs=false \
222+
--listen="${API_SCHEME}://0.0.0.0:${API_PORT}" \
223+
--master="${MASTER_ADDR}" \
224+
--public-master="${API_SCHEME}://${PUBLIC_MASTER_HOST}" \
225+
--hostname="${KUBELET_HOST}" \
226+
--volume-dir="${VOLUME_DIR}" \
227+
--etcd-dir="${ETCD_DATA_DIR}" \
228+
--images="${USE_IMAGES}"
229+
211230

212231
echo "[INFO] Starting OpenShift server"
213232
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" &
233+
--master-config=${MASTER_CONFIG_DIR}/master-config.yaml \
234+
--node-config=${NODE_CONFIG_DIR}/node-config.yaml \
235+
--loglevel=4 \
236+
&> "${LOG_DIR}/openshift.log" &
225237
OS_PID=$!
238+
239+
export HOME="${FAKE_HOME_DIR}"
226240

227241
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"
242+
export CURL_CA_BUNDLE="${MASTER_CONFIG_DIR}/ca.crt"
243+
export CURL_CERT="${MASTER_CONFIG_DIR}/admin.crt"
244+
export CURL_KEY="${MASTER_CONFIG_DIR}/admin.key"
245+
246+
# Make osc use ${MASTER_CONFIG_DIR}/admin.kubeconfig, and ignore anything in the running user's $HOME dir
247+
export OPENSHIFTCONFIG="${MASTER_CONFIG_DIR}/admin.kubeconfig"
248+
sudo chmod -R a+rwX "${OPENSHIFTCONFIG}"
236249
echo "[INFO] To debug: export OPENSHIFTCONFIG=$OPENSHIFTCONFIG"
237250
fi
238251

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

254267
# install the router
255268
echo "[INFO] Installing the router"
256-
openshift admin router --create --credentials="${CERT_DIR}/openshift-router/.kubeconfig" --images="${USE_IMAGES}"
269+
openshift admin router --create --credentials="${MASTER_CONFIG_DIR}/openshift-router.kubeconfig" --images="${USE_IMAGES}"
257270

258271
# install the registry. The --mount-host option is provided to reuse local storage.
259272
echo "[INFO] Installing the registry"
260273
# 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'
274+
openshift admin registry --create --credentials="${MASTER_CONFIG_DIR}/openshift-registry.kubeconfig" --mount-host="/tmp/openshift.local.registry" --images='openshift/origin-${component}:latest'
262275

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

0 commit comments

Comments
 (0)