Skip to content

Commit

Permalink
allows to specify the folder name where the run will put all the logs…
Browse files Browse the repository at this point in the history
… and ouput files
  • Loading branch information
Tullio Sebastiani committed Jan 12, 2023
1 parent 475a09e commit 8f14452
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ Please **be careful** on deleting the working directory content because without

#### Single node cluster teardown
```
<podman|docker> run -v <HOST_WORKDIR_PATH>:/workdir\
<podman|docker> run -v <HOST_WORKDIR_ABSOLUTE_PATH>:/workdir\
-e WORKING_MODE=T\
-e TEARDOWN_RUN_ID=<TEARDOWN_RUN_ID>\
-e AWS_ACCESS_KEY_ID=<AWS_ACCESS_KEY_ID>\
-e AWS_SECRET_ACCESS_KEY=<AWS_SECRET_ACCESS>\
-e AWS_DEFAULT_REGION=us-west-2\
-ti quay.io/crcont/crc-cloud
quay.io/crcont/crc-cloud
```
(check [here](#workdir) for **TEARDOWN_RUN_ID** infos and **WORKDIR** setup instructions )

Expand All @@ -95,12 +95,13 @@ Environment variables will be passed to the container from the command line invo
| AWS_DEFAULT_REGION | AWS region where the cluster will be deployed ( currently us-west-2 is the only supported)



**Cluster teardown**

| VARIABLE | DESCRIPTION |
| --- | ---|
| WORKING_MODE | T (teardown) |
| TEARDOWN_ID | the name (unix timestamp format) of the folder created inside the working directory, containing all the metadata needed to teardown the cluster |
| TEARDOWN_ID | the name of the folder created inside the working directory, containing all the metadata needed to teardown the cluster (if specified in creation will match with CREATE_RUN_ID)|
| AWS_ACCESS_KEY_ID | AWS access key (infos [here](#prereq)) |
| AWS_SECRET_ACCESS_KEY | AWS secret access key (infos [here](#prereq)) |
| AWS_DEFAULT_REGION | AWS region where the cluster has been deployed ( currently us-west-2 is the only supported) |
Expand All @@ -110,6 +111,7 @@ Environment variables will be passed to the container from the command line invo

| VARIABLE | DESCRIPTION |
|---|---|
| CREATE_RUN_ID | Overrides the folder where the **CRC-Cloud** will put the output files, if not set will use the current timestamp, useful for CI/CD pipelines or everywhere there is the need to know this value upfront |
| PASS_DEVELOPER | overrides the default password (developer) for developer account |
| PASS_KUBEADMIN | overrides the default password (kubeadmin) for kubeadmin account |
| PASS_REDHAT | overrides the default password (redhat) for redhat account |
Expand Down
22 changes: 12 additions & 10 deletions crc-cloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ prepare_workdir() {
rm -rf $WORKDIR_PATH/latest
#link only if not running in container (teardown will need mandatory run id)
[[ ! $CONTAINER ]] && ln -s $(readlink -f $WORKDIR) $(readlink -f $WORKDIR_PATH)/latest
pr_info "preparing working directory"
pr_info "preparing working directory: $WORKDIR"
}


Expand Down Expand Up @@ -209,7 +209,7 @@ teardown() {
}

set_workdir_dependent_variables() {
WORKDIR="$WORKDIR_PATH/$RUN_TIMESTAMP"
WORKDIR="$WORKDIR_PATH/$CREATE_RUN_ID"
LOG_FILE="$WORKDIR/local.log"
TEARDOWN_LOGFILE="$WORKDIR_PATH/teardown_$RUN_TIMESTAMP.log"
RANDOM_SUFFIX_FILE="$WORKDIR/suffix"
Expand Down Expand Up @@ -274,14 +274,6 @@ FIGLET=`which figlet 2>/dev/null`
[[ $CONTAINER && ( $? != 0 ) ]] && stop_if_failed 1 "[DEPENDENCY MISSING]: figlet (container mode only), please install it and try again"


##DEFAULT VALUES THAT CAN BE OVERRIDDEN BY ENV (podman/docker)
[ -z $PASS_DEVELOPER ] && PASS_DEVELOPER="developer"
[ -z $KUBEADMIN ] && PASS_KUBEADMIN="kubeadmin"
[ -z $PASS_REDHAT ] && PASS_REDHAT="redhat"
[ -z $INSTANCE_TYPE ] && INSTANCE_TYPE="c6in.2xlarge"
[ -z $WORKDIR_PATH ] && WORKDIR_PATH="workdir"
[ -z $WORKING_MODE ] && WORKING_MODE=""
[ -z $TEARDOWN_RUN_ID ] && TEARDOWN_RUN_ID="latest"

##CONST
SSH_PORT="22"
Expand All @@ -295,6 +287,16 @@ TEARDOWN_MAX_RETRIES=500
CLUSTER_INFOS_TEMPLATE="$TEMPLATES/$CLUSTER_INFOS_FILE"
AMI_ID="ami-0569ce8a44f2351be"

##DEFAULT VALUES THAT CAN BE OVERRIDDEN BY ENV (podman/docker)
[ -z $PASS_DEVELOPER ] && PASS_DEVELOPER="developer"
[ -z $KUBEADMIN ] && PASS_KUBEADMIN="kubeadmin"
[ -z $PASS_REDHAT ] && PASS_REDHAT="redhat"
[ -z $INSTANCE_TYPE ] && INSTANCE_TYPE="c6in.2xlarge"
[ -z $WORKDIR_PATH ] && WORKDIR_PATH="workdir"
[ -z $WORKING_MODE ] && WORKING_MODE=""
[ -z $TEARDOWN_RUN_ID ] && TEARDOWN_RUN_ID="latest"
[ -z $CREATE_RUN_ID ] && CREATE_RUN_ID=$RUN_TIMESTAMP

##ARGS
#collects args from commandline only if not in container otherwise variables are fed by -e VAR=VALUE
if [ $CONTAINER ]
Expand Down

0 comments on commit 8f14452

Please sign in to comment.