diff --git a/Dockerfile b/Dockerfile index d8972fa..dd7f3d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,7 +33,7 @@ VOLUME /opt/app-root/src/.ssh WORKDIR /opt/app-root/src ENTRYPOINT ["/opt/app-root/bin/agnosticd-runner"] -CMD ["create"] +CMD ["help"] diff --git a/agnosticd-runner b/agnosticd-runner index bde715b..7e9eebd 100755 --- a/agnosticd-runner +++ b/agnosticd-runner @@ -1,6 +1,6 @@ #!/bin/bash -DOC="https://github.com/openshift-evangelists/oc-cluster-wrapper/blob/master/README.adoc" +DOC="https://github.com/openshift-evangelists/agnosticd-runner/blob/master/readme.md" SCRIPT_NAME=$(basename "$0") # Handle source locations that might be a symlink (ref: http://bit.ly/2kcvSCS) @@ -83,19 +83,10 @@ function create { } function create.help { - echo "Starts/Creates a cluster with the given profile name (or default)" - echo "in case no profile is specified" + echo "Starts/Creates a cluster with the given configuration" echo "" echo "Usage:" - echo " $SCRIPT_NAME create [] []" - echo "" - echo "Available Environement variables:" - echo "" - echo "OC_CLUSTER_PUBLIC_HOSTNAME (defaults to 127.0.0.1)" - echo "" - echo "Available Arguments:" - echo "" - echo "-e, --env=[]: Specify a key-value pair for an environment variable to set on OpenShift container" + echo " $SCRIPT_NAME create" echo "" echo "See the documentation at $DOC" } @@ -187,16 +178,7 @@ function destroy { } function destroy.help { - echo "Destroys the specified cluster, or the current active cluster" - echo "if none is specified. Use -c/--confirm to skip confirmation prompt" - echo "" - echo "All the information store for the profile will be removed" - echo "- This information is stored in $OPENSHIFT_PROFILES_DIR/" - echo "- Also the profile will be cleared from the .kubeconfig file" - echo "- All the images created by this cluster will be removed" - echo "" - echo "Usage:" - echo " $SCRIPT_NAME destroy [-c || --confirm] []" + echo "Destroys the specified cluster" echo "" echo "See the documentation at $DOC" } @@ -224,10 +206,9 @@ function help { echo "" echo "Available Commands:" echo "" - echo " oc-cluster create [profile] [OPTIONS]" - echo " oc-cluster destroy [profile]" - echo " oc-cluster list" - echo "" + echo " $SCRIPT_NAME create" + echo " $SCRIPT_NAME destroy" +# echo " $SCRIPT_NAME list" echo "" echo "See the documentation at $DOC" } @@ -252,9 +233,9 @@ then shift # past argument destroy "$@" ;; - list) - list - ;; +# list) +# list +# ;; -h|--help) help ;; diff --git a/readme.md b/readme.md index bc1090a..faf416b 100644 --- a/readme.md +++ b/readme.md @@ -1,16 +1,98 @@ -# Agnosticd runner +# Agnosticd runner -## Pre-requisites -Add the `.pem` file with the key to `ssh` subdir. +This repository builds a helper script and image to make it easy to create OCP-4 clusters using [agnosticd](https://github.com/redhat-cop/agnosticd). + +The image is built and available on Quay.io + +```bash +quay.io/osevg/agnosticd-runner +``` + +## Run the image + +It's as easy as: + +```bash +docker run -it --rm \ + -v $(pwd)/config:/opt/app-root/data \ + -v $(pwd)/ssh:/opt/app-root/src/.ssh \ + quay.io/osevg/agnosticd-runner create +``` + +__NOTE__: You'll need to mount as volumes to the container the configuration and ssh keys. + +And to run the image you'll need 3 things: + +- An AWS account properly set-up +- The configuration to be applied +- A EC2 ssh key-pair to be used + +Following is a guide on how to get the 3 things done: + +### Set up an AWS account and get the credentials + +Create an AWS account and use that (root account), or create a user in AWS and give it enough +permissions to provision using agnosticD. See [agnosticd docs](https://github.com/redhat-cop/agnosticd/blob/development/docs/Preparing_your_workstation.adoc#aws-permissions-and-policies). + +You also need a Route53 Hosted Zone and an EC2 ssh key-pair as documented [here](https://github.com/redhat-cop/agnosticd/blob/development/docs/Preparing_your_workstation.adoc#aws-existing-resources) + +The EC2 ssh key will need to be mounted into the container in the `/opt/app-root/src/.ssh` folder, as documented above. The name of the key is specified as a configuration parameter `key_name`. + +### Create a tweak the desired configuration to be applied + +To create the configuration you can run the `agnosticd-runner` script or image and use the following subcommands: + +```bash +agnosticd-runner create-env +``` + +This will create a file named `my_environment-variables.yml` that you should edit/tweak to your own needs. + +__NOTE__: At the end of this configuration file you'll need to provide your OCP token from try.openshift.com + +__NOTE__: The EC2 ssh key needs to be in the region you'll use. Follow the [doc](https://github.com/redhat-cop/agnosticd/blob/development/docs/Preparing_your_workstation.adoc#aws-existing-resources) on how to add the key on all the regions you want. + +And to create the AWS credentials sample secret: + +```bash +agnosticd-runner create-secret +``` + +This will not create a file, but will show you the format the file should need. You need to get this information from the AWS console. + + +## Building the container Build the container: ```bash -docker build -t "agnosticd-runner" . +docker build -t "quay.io/osevg/agnosticd-runner" . +``` + +Test the container: + +```bash +docker run -it --rm \ + -v $(pwd)/config:/opt/app-root/data \ + -v $(pwd)/ssh:/opt/app-root/src/.ssh \ + --entrypoint bash \ + quay.io/osevg/agnosticd-runner +``` + +To create a cluster: + +```bash +agnostic-runner create +``` + +To destroy the cluster: + +```bash +agnostic-runner destroy ``` -Run the container: +For all the options you can just do: ```bash -docker run -it --rm -v $(pwd)/config:/opt/app-root/data -v $(pwd)/ssh:/opt/app-root/src/.ssh --entrypoint bash agnosticd-runner +agnostic-runner help ```