2019-12-16 19:52:38 +03:00
|
|
|
# Deploy development RP
|
|
|
|
|
2019-12-28 21:52:43 +03:00
|
|
|
## Prerequisites
|
2019-12-16 19:52:38 +03:00
|
|
|
|
2021-03-22 17:48:48 +03:00
|
|
|
1. Your development environment is prepared according to the steps outlined in [Prepare Your Dev Environment](./prepare-your-dev-environment.md)
|
2020-03-31 09:23:32 +03:00
|
|
|
|
|
|
|
## Installing the extension
|
|
|
|
|
|
|
|
1. Build the development `az aro` extension:
|
|
|
|
|
|
|
|
`make az`
|
|
|
|
|
|
|
|
1. Verify that the ARO extension path is in your `az` configuration:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
grep -q 'dev_sources' ~/.azure/config || cat >>~/.azure/config <<EOF
|
|
|
|
[extension]
|
|
|
|
dev_sources = $PWD/python
|
|
|
|
EOF
|
|
|
|
```
|
|
|
|
|
|
|
|
1. Verify the ARO extension is registered:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
az -v
|
|
|
|
...
|
|
|
|
Extensions:
|
2020-04-14 21:17:44 +03:00
|
|
|
aro 0.4.0 (dev) /path/to/rp/python/az/aro
|
2020-03-31 09:23:32 +03:00
|
|
|
...
|
|
|
|
Development extension sources:
|
|
|
|
/path/to/rp/python
|
|
|
|
...
|
|
|
|
```
|
|
|
|
|
|
|
|
Note: you will be able to update your development `az aro` extension in the
|
|
|
|
future by simply running `git pull`.
|
|
|
|
|
|
|
|
|
|
|
|
## Prepare your environment
|
|
|
|
|
2020-02-27 16:35:25 +03:00
|
|
|
1. If you don't have access to a shared development environment and secrets,
|
|
|
|
follow [prepare a shared RP development
|
2020-01-09 14:07:38 +03:00
|
|
|
environment](prepare-a-shared-rp-development-environment.md).
|
2019-12-16 19:52:38 +03:00
|
|
|
|
2020-02-27 16:35:25 +03:00
|
|
|
1. Set SECRET_SA_ACCOUNT_NAME to the name of the storage account containing your
|
|
|
|
shared development environment secrets and save them in `secrets`:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
SECRET_SA_ACCOUNT_NAME=rharosecrets make secrets
|
|
|
|
```
|
2019-12-16 19:52:38 +03:00
|
|
|
|
2019-12-28 21:52:43 +03:00
|
|
|
1. Copy, edit (if necessary) and source your environment file. The required
|
|
|
|
environment variable configuration is documented immediately below:
|
2019-12-16 19:52:38 +03:00
|
|
|
|
2020-02-27 16:35:25 +03:00
|
|
|
```bash
|
2019-12-16 19:52:38 +03:00
|
|
|
cp env.example env
|
|
|
|
vi env
|
|
|
|
. ./env
|
|
|
|
```
|
|
|
|
|
2020-03-31 09:23:32 +03:00
|
|
|
* `LOCATION`: Location of the shared RP development environment (default:
|
2019-12-28 21:52:43 +03:00
|
|
|
`eastus`).
|
2020-03-31 09:23:32 +03:00
|
|
|
* `RP_MODE`: Set to `development` to use a development RP running at
|
|
|
|
https://localhost:8443/.
|
2019-12-16 19:52:38 +03:00
|
|
|
|
2019-12-28 21:52:43 +03:00
|
|
|
1. Create your own RP database:
|
2019-12-16 19:52:38 +03:00
|
|
|
|
2020-02-27 16:35:25 +03:00
|
|
|
```bash
|
2020-06-18 23:32:46 +03:00
|
|
|
az deployment group create \
|
2019-12-27 02:25:08 +03:00
|
|
|
-g "$RESOURCEGROUP" \
|
2019-12-28 21:52:43 +03:00
|
|
|
-n "databases-development-$USER" \
|
2019-12-27 02:25:08 +03:00
|
|
|
--template-file deploy/databases-development.json \
|
|
|
|
--parameters \
|
2020-11-18 01:10:02 +03:00
|
|
|
"databaseAccountName=$DATABASE_ACCOUNT_NAME" \
|
2019-12-28 21:52:43 +03:00
|
|
|
"databaseName=$DATABASE_NAME" \
|
|
|
|
>/dev/null
|
2019-12-16 19:52:38 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
|
2019-12-28 21:52:43 +03:00
|
|
|
## Run the RP and create a cluster
|
2019-12-16 19:52:38 +03:00
|
|
|
|
2019-12-28 21:52:43 +03:00
|
|
|
1. Source your environment file.
|
2019-12-16 19:52:38 +03:00
|
|
|
|
2020-02-27 16:35:25 +03:00
|
|
|
```bash
|
2019-12-28 21:52:43 +03:00
|
|
|
. ./env
|
2019-12-16 19:52:38 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
1. Run the RP
|
|
|
|
|
2020-02-27 16:35:25 +03:00
|
|
|
```bash
|
2019-12-22 20:47:29 +03:00
|
|
|
go run ./cmd/aro rp
|
2019-12-16 19:52:38 +03:00
|
|
|
```
|
|
|
|
|
2020-10-26 22:33:20 +03:00
|
|
|
1. To create a cluster, EITHER follow the instructions in [Create, access, and
|
|
|
|
manage an Azure Red Hat OpenShift 4.3 Cluster][1]. Note that as long as the
|
2020-03-31 09:23:32 +03:00
|
|
|
`RP_MODE` environment variable is set to `development`, the `az aro` client
|
|
|
|
will connect to your local RP.
|
|
|
|
|
2020-10-26 22:33:20 +03:00
|
|
|
OR use the create utility:
|
|
|
|
|
|
|
|
```bash
|
2020-11-06 20:52:12 +03:00
|
|
|
CLUSTER=cluster go run ./hack/cluster create
|
2020-10-26 22:33:20 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
Later the cluster can be deleted as follows:
|
|
|
|
|
|
|
|
```bash
|
2020-11-06 20:52:12 +03:00
|
|
|
CLUSTER=cluster go run ./hack/cluster delete
|
2020-10-26 22:33:20 +03:00
|
|
|
```
|
|
|
|
|
2020-05-15 17:02:47 +03:00
|
|
|
[1]: https://docs.microsoft.com/en-us/azure/openshift/tutorial-create-cluster
|
2019-12-16 19:52:38 +03:00
|
|
|
|
|
|
|
1. The following additional RP endpoints are available but not exposed via `az
|
|
|
|
aro`:
|
|
|
|
|
|
|
|
* Delete a subscription, cascading deletion to all its clusters:
|
|
|
|
|
2020-02-27 16:35:25 +03:00
|
|
|
```bash
|
2019-12-16 19:52:38 +03:00
|
|
|
curl -k -X PUT \
|
|
|
|
-H 'Content-Type: application/json' \
|
|
|
|
-d '{"state": "Deleted", "properties": {"tenantId": "'"$AZURE_TENANT_ID"'"}}' \
|
|
|
|
"https://localhost:8443/subscriptions/$AZURE_SUBSCRIPTION_ID?api-version=2.0"
|
|
|
|
```
|
|
|
|
|
|
|
|
* List operations:
|
|
|
|
|
2020-02-27 16:35:25 +03:00
|
|
|
```bash
|
2019-12-16 19:52:38 +03:00
|
|
|
curl -k \
|
2020-04-01 03:51:28 +03:00
|
|
|
"https://localhost:8443/providers/Microsoft.RedHatOpenShift/operations?api-version=2020-04-30"
|
2019-12-16 19:52:38 +03:00
|
|
|
```
|
|
|
|
|
2020-06-17 06:04:10 +03:00
|
|
|
* View RP logs in a friendly format:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
journalctl _COMM=aro -o json --since "15 min ago" -f | jq -r 'select (.COMPONENT != null and (.COMPONENT | contains("access"))|not) | .MESSAGE'
|
|
|
|
```
|
2021-06-29 22:34:53 +03:00
|
|
|
|
|
|
|
* Perform AdminUpdate on a dev cluster
|
|
|
|
|
|
|
|
```bash
|
|
|
|
export CLUSTER=cluster
|
|
|
|
curl -X PATCH -k "https://localhost:8443/subscriptions/$AZURE_SUBSCRIPTION_ID/resourceGroups/$RESOURCEGROUP/providers/Microsoft.RedHatOpenShift/openShiftClusters/$CLUSTER?api-version=admin" --header "Content-Type: application/json" -d "{}"
|
2019-12-16 19:56:29 +03:00
|
|
|
|
2019-12-16 19:52:38 +03:00
|
|
|
## Debugging
|
|
|
|
|
2019-12-20 21:43:52 +03:00
|
|
|
* SSH to the bootstrap node:
|
2020-11-06 20:52:12 +03:00
|
|
|
> __NOTE:__ If you have a password-based `sudo` command, you must first authenticate before running `sudo` in the background
|
2020-02-27 16:35:25 +03:00
|
|
|
```bash
|
2019-12-31 20:33:44 +03:00
|
|
|
sudo openvpn secrets/vpn-$LOCATION.ovpn &
|
2020-11-06 20:52:12 +03:00
|
|
|
CLUSTER=cluster hack/ssh-agent.sh bootstrap
|
2019-12-20 21:43:52 +03:00
|
|
|
```
|
|
|
|
|
2019-12-16 19:52:38 +03:00
|
|
|
* Get an admin kubeconfig:
|
|
|
|
|
2020-02-27 16:35:25 +03:00
|
|
|
```bash
|
2020-11-06 20:52:12 +03:00
|
|
|
CLUSTER=cluster make admin.kubeconfig
|
2019-12-16 19:52:38 +03:00
|
|
|
export KUBECONFIG=admin.kubeconfig
|
|
|
|
```
|
|
|
|
|
2019-12-20 21:43:52 +03:00
|
|
|
* "SSH" to a cluster node:
|
2019-12-16 19:52:38 +03:00
|
|
|
|
Ssh docs/examples , PR template update (#1446)
* Fix -> remove the dash, valid names are master0,master1,master2, but not master-0,master-1,master-2
* Add more information, show example with nodes, show multiple ways to ssh to a worker node
* Change VSTS to ADO because that is the tool we use now
* Add an additional example of connecting to a worker
* respected->respective, english is hard
2021-04-19 13:36:36 +03:00
|
|
|
* Get the admin kubeconfig and `export KUBECONFIG` as detailed above.
|
|
|
|
* Run the ssh-agent.sh script. This takes the argument is the name of the NIC attached to the VM you are trying to ssh to.
|
|
|
|
* Given the following nodes these commands would be used to connect to the respective node
|
|
|
|
|
|
|
|
```
|
|
|
|
$ oc get nodes
|
|
|
|
NAME STATUS ROLES AGE VERSION
|
|
|
|
aro-dev-abc123-master-0 Ready master 47h v1.19.0+2f3101c
|
|
|
|
aro-dev-abc123-master-1 Ready master 47h v1.19.0+2f3101c
|
|
|
|
aro-dev-abc123-master-2 Ready master 47h v1.19.0+2f3101c
|
|
|
|
aro-dev-abc123-worker-eastus1-2s5rb Ready worker 47h v1.19.0+2f3101c
|
|
|
|
aro-dev-abc123-worker-eastus2-php82 Ready worker 47h v1.19.0+2f3101c
|
|
|
|
aro-dev-abc123-worker-eastus3-cbqs2 Ready worker 47h v1.19.0+2f3101c
|
|
|
|
|
|
|
|
|
|
|
|
CLUSTER=cluster hack/ssh-agent.sh master0 # master node aro-dev-abc123-master-0
|
|
|
|
CLUSTER=cluster hack/ssh-agent.sh aro-dev-abc123-worker-eastus1-2s5rb # worker aro-dev-abc123-worker-eastus1-2s5rb
|
|
|
|
CLUSTER=cluster hack/ssh-agent.sh eastus1 # worker aro-dev-abc123-worker-eastus1-2s5rb
|
|
|
|
CLUSTER=cluster hack/ssh-agent.sh 2s5rb # worker aro-dev-abc123-worker-eastus1-2s5rb
|
|
|
|
CLUSTER=cluster hack/ssh-agent.sh bootstrap # the bootstrap node used to provision cluster
|
|
|
|
```
|
2020-03-31 09:23:32 +03:00
|
|
|
|
2020-01-08 19:39:44 +03:00
|
|
|
### Metrics
|
|
|
|
|
|
|
|
To run fake metrics socket:
|
2020-02-27 16:35:25 +03:00
|
|
|
```bash
|
2020-03-26 06:59:46 +03:00
|
|
|
go run ./hack/monitor
|
2020-01-08 19:39:44 +03:00
|
|
|
```
|