5.6 KiB
Deploy development RP
Prerequisites
-
Install Go 1.13 or later, if you haven't already.
-
Install Python 3.6+, if you haven't already. You will also need setuptools installed, if you don't have it installed already.
-
Install
virtualenv
, a tool for managing Python virtual environments. The package is calledpython-virtualenv
on both Fedora and Debian-based systems. -
Fedora users: install the
gpgme-devel
,libassuan-devel
, andopenssl
packages.Debian users: install the
libgpgme-dev
package.OSX users: please follow Prepare your development environment using OSX.
-
Install the az client, if you haven't already. You will need
az
version 2.0.72 or greater, as this version includes theaz network vnet subnet update --disable-private-link-service-network-policies
flag. -
Install OpenVPN, if you haven't already.
Getting started
-
Log in to Azure:
az login
-
Git clone this repository to your local machine:
go get -u github.com/Azure/ARO-RP/... cd ${GOPATH:-$HOME/go}/src/github.com/Azure/ARO-RP
Installing the extension
-
Build the development
az aro
extension:make az
-
Verify that the ARO extension path is in your
az
configuration:grep -q 'dev_sources' ~/.azure/config || cat >>~/.azure/config <<EOF [extension] dev_sources = $PWD/python EOF
-
Verify the ARO extension is registered:
az -v ... Extensions: aro 0.4.0 (dev) /path/to/rp/python/az/aro ... Development extension sources: /path/to/rp/python ...
Note: you will be able to update your development
az aro
extension in the future by simply runninggit pull
.
Prepare your environment
-
If you don't have access to a shared development environment and secrets, follow prepare a shared RP development environment.
-
Set SECRET_SA_ACCOUNT_NAME to the name of the storage account containing your shared development environment secrets and save them in
secrets
:SECRET_SA_ACCOUNT_NAME=rharosecrets make secrets
-
Copy, edit (if necessary) and source your environment file. The required environment variable configuration is documented immediately below:
cp env.example env vi env . ./env
LOCATION
: Location of the shared RP development environment (default:eastus
).RP_MODE
: Set todevelopment
to use a development RP running at https://localhost:8443/.
-
Create your own RP database:
az deployment group create \ -g "$RESOURCEGROUP" \ -n "databases-development-$USER" \ --template-file deploy/databases-development.json \ --parameters \ "databaseAccountName=$COSMOSDB_ACCOUNT" \ "databaseName=$DATABASE_NAME" \ >/dev/null
Run the RP and create a cluster
-
Source your environment file.
. ./env
-
Run the RP
go run ./cmd/aro rp
-
Before creating a cluster, it is necessary to fake up the step of registering the development resource provider to the subscription:
curl -k -X PUT \ -H 'Content-Type: application/json' \ -d '{"state": "Registered", "properties": {"tenantId": "'"$AZURE_TENANT_ID"'"}}' \ "https://localhost:8443/subscriptions/$AZURE_SUBSCRIPTION_ID?api-version=2.0"
-
To create a cluster, EITHER follow the instructions in Create, access, and manage an Azure Red Hat OpenShift 4.3 Cluster. Note that as long as the
RP_MODE
environment variable is set todevelopment
, theaz aro
client will connect to your local RP.OR use the create utility:
CLUSTER=cluster go run ./hack/cluster create
Later the cluster can be deleted as follows:
CLUSTER=cluster go run ./hack/cluster delete
-
The following additional RP endpoints are available but not exposed via
az aro
:-
Delete a subscription, cascading deletion to all its clusters:
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:
curl -k \ "https://localhost:8443/providers/Microsoft.RedHatOpenShift/operations?api-version=2020-04-30"
-
View RP logs in a friendly format:
journalctl _COMM=aro -o json --since "15 min ago" -f | jq -r 'select (.COMPONENT != null and (.COMPONENT | contains("access"))|not) | .MESSAGE'
-
Debugging
- SSH to the bootstrap node:
NOTE: If you have a password-based
sudo
command, you must first authenticate before runningsudo
in the background
sudo openvpn secrets/vpn-$LOCATION.ovpn &
CLUSTER=cluster hack/ssh-agent.sh bootstrap
-
Get an admin kubeconfig:
CLUSTER=cluster make admin.kubeconfig export KUBECONFIG=admin.kubeconfig
-
"SSH" to a cluster node:
- First, get the admin kubeconfig and
export KUBECONFIG
as detailed above.
CLUSTER=cluster hack/ssh-agent.sh [master-{0,1,2}]
- First, get the admin kubeconfig and
Metrics
To run fake metrics socket:
go run ./hack/monitor