Skip to content

Commit cb7ca10

Browse files
committed
Update README for OpenShift 4.0 and CI changes
1 parent ea38644 commit cb7ca10

File tree

3 files changed

+109
-80
lines changed

3 files changed

+109
-80
lines changed

CONTRIBUTING.md

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
# How to Contribute
22

3-
This document outlines some of the conventions on
4-
development workflow, commit message formatting, contact points and other
5-
resources to make it easier to get your contribution accepted.
6-
7-
# Email and Chat
8-
9-
The project currently uses the general Tectonic Team email list and Slack channel:
10-
11-
- Slack: #team-tectonic
3+
This document outlines some of the conventions on development workflow.
124

135
## Getting Started
146

@@ -35,25 +27,52 @@ questions: what changed and why. The subject line should feature the what and
3527
the body of the commit should describe the why.
3628

3729
```
38-
scripts: add the test-cluster command
30+
Add the test-cluster command
3931
40-
this uses tmux to setup a test cluster that you can easily kill and
32+
This uses tmux to setup a test cluster that you can easily kill and
4133
start for debugging.
34+
```
35+
36+
Commits that fix a Bugzilla bug should add the bug number like `Bug 12345: ` to
37+
the first line of the commit and to the pull request title. To help others
38+
quickly go to the bug, also add a link to the bug in the body of the commit
39+
message. This allows automated tooling to generate links to bugs in release
40+
notes and will eventually allow us to automatically transition bugs to `ON_QA`
41+
when the fix is available in a nightly build. Here's an example commit message
42+
for a change that fixes a Bugzilla bug:
43+
44+
```
45+
Bug 1679272: Validate console can talk to OAuth token URL
46+
47+
Make sure we can successfully talk to the OAuth token URL after
48+
discovering metadata before marking the console pod as ready.
4249
43-
Fixes #38
50+
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1679272
51+
```
52+
53+
Pull requests that close GitHub issues should add text to the pull request
54+
description in the format `Closes #123`. GitHub will automatically link each
55+
issue to its pull request and close the issue when the pull request merges.
56+
57+
While we don't have automated tooling for JIRA issues, you should still include
58+
a link to the issue in the commit description to make it easy to get to the issue.
59+
60+
### Pull Requests Against Other Branches
61+
62+
Pull requests opened against branches other than master should start the pull
63+
request title with the branch name in brackets like `[release-3.11]` to make it
64+
obvious. Include the bug as well when appropriate. For instance,
65+
66+
```
67+
[release-3.11] Bug 1643948: Fix crashlooping pods query
4468
```
4569

46-
The format can be described more formally as follows:
70+
If you use the `/cherrypick` command, the bot will automatically append the
71+
branch to the pull request title. For instance, adding a comment to a PR like
4772

4873
```
49-
<subsystem>: <what changed>
50-
<BLANK LINE>
51-
<why this change was made>
52-
<BLANK LINE>
53-
<footer>
74+
/cherrypick release-3.11
5475
```
5576

56-
The first line is the subject and should be no longer than 70 characters, the
57-
second line is always blank, and other lines should be wrapped at 80 characters.
58-
This allows the message to be easier to read on GitHub as well as in various
59-
git tools.
77+
will create a new pull request against the release-3.11 branch when the current
78+
pull request merges as long as there are no merge conflicts.

README.md

Lines changed: 64 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ OpenShift Console
33

44
Codename: "Bridge"
55

6-
[![Build Status](https://jenkins-tectonic.prod.coreos.systems/buildStatus/icon?job=console-build)](https://jenkins-tectonic.prod.coreos.systems/job/console-build/)
7-
86
[quay.io/openshift/origin-console](https://quay.io/repository/openshift/origin-console?tab=tags)
97

108
The console is a more friendly `kubectl` in the form of a single page webapp. It also integrates with other services like monitoring, chargeback, and OLM. Some things that go on behind the scenes include:
@@ -35,55 +33,66 @@ Backend binaries are output to `/bin`.
3533

3634
### Configure the application
3735

38-
#### OpenShift
36+
The following instructions assume you have an existing cluster you can connect
37+
to. OpenShift 4.0 clusters can be installed using the
38+
[OpenShift Installer](https://github.com/openshift/installer).
39+
You can also use [CodeReady Containers](https://github.com/code-ready/osp4)
40+
for local installs. More information about installing OpenShift can be found at
41+
<https://try.openshift.com/>.
42+
43+
44+
#### OpenShift (no authentication)
3945

40-
Registering an OpenShift OAuth client requires administrative privileges for the entire cluster, not just a local project. Run the following command to log in as cluster admin:
46+
For local development, you can disable OAuth and run bridge with an OpenShift
47+
user's access token. If you've installed OpenShift 4.0, run the following
48+
commands to login as the kubeadmin user and start a local console for
49+
development. Make sure to replace `/path/to/install-dir` with the directory you
50+
used to install OpenShift.
4151

4252
```
43-
oc login -u system:admin
53+
oc login -u kubeadmin -p $(cat /path/to/install-dir/auth/kubeadmin-password)
54+
source ./contrib/oc-environment.sh
55+
./bin/bridge
4456
```
4557

46-
To run bridge locally connected to an OpenShift cluster, create an `OAuthClient` resource with a generated secret and read that secret:
58+
The console will be running at [localhost:9000](http://localhost:9000).
59+
60+
If you don't have `kubeadmin` access, you can use any user's API token,
61+
although you will be limited to that user's access and might not be able to run
62+
the full integration test suite.
63+
64+
#### OpenShift (with authentication)
65+
66+
If you need to work on the backend code for authentication or you need to test
67+
different users, you can set up authentication in your development environment.
68+
Registering an OpenShift OAuth client requires administrative privileges for
69+
the entire cluster, not just a local project. You must be logged in as a
70+
cluster admin such as `system:admin` or `kubeadmin`.
71+
72+
To run bridge locally connected to an OpenShift cluster, create an
73+
`OAuthClient` resource with a generated secret and read that secret:
4774

4875
```
4976
oc process -f examples/console-oauth-client.yaml | oc apply -f -
5077
oc get oauthclient console-oauth-client -o jsonpath='{.secret}' > examples/console-client-secret
5178
```
5279

53-
If the CA bundle of the OpenShift API server is unavailable, fetch the CA certificates from a service account secret. Otherwise copy the CA bundle to `examples/ca.crt`:
80+
If the CA bundle of the OpenShift API server is unavailable, fetch the CA
81+
certificates from a service account secret. Otherwise copy the CA bundle to
82+
`examples/ca.crt`:
5483

5584
```
5685
oc get secrets -n default --field-selector type=kubernetes.io/service-account-token -o json | \
5786
jq '.items[0].data."ca.crt"' -r | python -m base64 -d > examples/ca.crt
5887
# Note: use "openssl base64" because the "base64" tool is different between mac and linux
5988
```
6089

61-
Set the `OPENSHIFT_API` environment variable to tell the script the API endpoint:
62-
63-
```
64-
export OPENSHIFT_API="https://127.0.0.1:8443"
65-
```
66-
6790
Finally run the console and visit [localhost:9000](http://localhost:9000):
6891

6992
```
7093
./examples/run-bridge.sh
7194
```
7295

73-
#### OpenShift (without OAuth)
74-
75-
For local development, you can also disable OAuth and run bridge with an
76-
OpenShift user's access token. Run the following commands to create an admin
77-
user and start bridge for a cluster up environment:
78-
79-
```
80-
oc login -u system:admin
81-
oc adm policy add-cluster-role-to-user cluster-admin admin
82-
oc login -u admin
83-
source ./contrib/oc-environment.sh
84-
./bin/bridge
85-
```
86-
8796
#### Native Kubernetes
8897

8998
If you have a working `kubectl` on your path, you can run the application with:
@@ -110,32 +119,10 @@ kubectl describe secrets/<secret-id-obtained-previously>
110119

111120
Use this token value to set the `BRIDGE_K8S_BEARER_TOKEN` environment variable when running Bridge.
112121

113-
## Images
122+
## Operator
114123

115-
The `builder-run.sh` script will run any command from a docker container to ensure a consistent build environment.
116-
For example to build with docker run:
117-
```
118-
./builder-run.sh ./build.sh
119-
```
120-
121-
The docker image used by builder-run is itself built and pushed by the
122-
script `push-builder`, which uses the file `Dockerfile-builder` to
123-
define an image. To update the builder-run build environment, first make
124-
your changes to `Dockerfile-builder`, then run `push-builder`, and
125-
then update the BUILDER_VERSION variable in `builder-run` to point to
126-
your new image. Our practice is to manually tag images builder images in the form
127-
`Builder-v$SEMVER` once we're happy with the state of the push.
128-
129-
### Compile, Build, & Push Image
130-
131-
(Almost no reason to ever do this manually, Jenkins handles this automation)
132-
133-
Build an image, tag it with the current git sha, and pushes it to the `quay.io/coreos/tectonic-console` repo.
134-
135-
Must set env vars `DOCKER_USER` and `DOCKER_PASSWORD` or have a valid `.dockercfg` file.
136-
```
137-
./build-docker-push.sh
138-
```
124+
In OpenShift 4.x, the console is installed and managed by the
125+
[console operator](https://github.com/openshift/console-operator/).
139126

140127
## Hacking
141128

@@ -206,12 +193,34 @@ Run integration tests on an OpenShift cluster:
206193
yarn run test-gui-openshift
207194
```
208195
This will include the normal k8s CRUD tests and CRUD tests for OpenShift
209-
resources. It doesn't include ALM tests since it assumes ALM is not
210-
set up on an OpenShift cluster.
196+
resources.
197+
198+
#### How the Integration Tests Run in CI
199+
200+
The end-to-end tests run against pull requests using [ci-operator](https://github.com/openshift/ci-operator/).
201+
The tests are defined in [this manifest](https://github.com/openshift/release/blob/master/ci-operator/jobs/openshift/console/openshift-console-master-presubmits.yaml)
202+
in the [openshift/release](https://github.com/openshift/release) repo and were generated with [ci-operator-prowgen](https://github.com/openshift/ci-operator-prowgen).
203+
204+
CI runs the [test-prow-e2e.sh](test-prow-e2e.sh) script, which uses the `e2e` suite defined in [protractor.conf.ts](frontend/integration-tests/protractor.conf.ts).
205+
206+
You can simulate an e2e run against an existing 4.0 cluster with the following commands (replace `/path/to/install-dir` with your OpenShift 4.0 install directory):
207+
208+
```
209+
$ export BRIDGE_AUTH_USERNAME=kubeadmin
210+
$ export BRIDGE_BASE_ADDRESS="https://$(oc get route console -n openshift-console -o jsonpath='{.spec.host}')"
211+
$ export BRIDGE_AUTH_PASSWORD=$(cat "/path/to/install-dir/auth/kubeadmin-password")
212+
$ ./test-gui.sh e2e
213+
```
214+
215+
If you don't want to run the entire e2e tests, you can use a different suite from [protractor.conf.ts](frontend/integration-tests/protractor.conf.ts). For instance,
216+
217+
```
218+
$ ./test-gui.sh olm
219+
```
211220

212221
#### Hacking Integration Tests
213222

214-
Remove the `--headless` flag to Chrome (chromeOptions) in `frontend/integration-tests/protractor.conf.ts` to see what the tests are actually doing.
223+
Remove the `--headless` flag to Chrome (chromeOptions) in [protractor.conf.ts](frontend/integration-tests/protractor.conf.ts) to see what the tests are actually doing.
215224

216225
### Dependency Management
217226

@@ -245,7 +254,6 @@ Update existing frontend dependencies:
245254
yarn upgrade <package@version>
246255
```
247256

248-
249257
#### Supported Browsers
250258

251259
We support the latest versions of the following browsers:

examples/run-bridge.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
#!/bin/bash -e
1+
#!/usr/bin/env bash
2+
3+
set -exuo pipefail
24

35
./bin/bridge \
46
--base-address=http://localhost:9000 \
57
--ca-file=examples/ca.crt \
68
--k8s-auth=openshift \
79
--k8s-mode=off-cluster \
8-
--k8s-mode-off-cluster-endpoint=$OPENSHIFT_API \
10+
--k8s-mode-off-cluster-endpoint=$(oc whoami --show-server) \
911
--k8s-mode-off-cluster-skip-verify-tls=true \
1012
--listen=http://127.0.0.1:9000 \
1113
--public-dir=./frontend/public/dist \

0 commit comments

Comments
 (0)