Skip to content

Commit

Permalink
jrickard-aws (#28)
Browse files Browse the repository at this point in the history
* Adding AWS utility scripts to simplify cluster management

Makefile has been updated with targets that will start & stop
hosted controlplane clusters as well as get the status of the hcp nodes.

* Updated targets to manage aws

* Didn't need aws-tools directory locally
  • Loading branch information
day0hero authored Sep 14, 2023
1 parent 10d3397 commit b6b7ec0
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ ENV ANSIBLE_REMOTE_TMP=/pattern-home/.ansible/tmp
ENV ANSIBLE_LOCAL_TMP=/pattern-home/.ansible/tmp
ENV ANSIBLE_LOCALHOST_WARNING=False

# Adding python scripts to start, stop and retrieve status of hostedcluster instnances
ADD https://raw.githubusercontent.com/validatedpatterns/utilities/main/aws-tools/start-instances.py \
https://raw.githubusercontent.com/validatedpatterns/utilities/main/aws-tools/stop-instances.py \
https://raw.githubusercontent.com/validatedpatterns/utilities/main/aws-tools/status-instances.py /usr/local/bin

COPY default-cmd.sh /usr/local/bin
WORKDIR /pattern
CMD ["/usr/local/bin/default-cmd.sh"]
33 changes: 33 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,36 @@ upload: ## Uploads the container to quay.io/hybridcloudpatterns/${CONTAINER}
.PHONY: clean
clean: ## Removes any previously built artifact
buildah manifest rm "${REGISTRY}/${CONTAINER}"

##### HostedCluster Management tasks
.PHONY: cluster-status
cluster-status: ## Checks the status of hostedcluster machines
@echo "Getting status of hosted-cluster nodes"
podman run --rm --net=host \
--security-opt label=disable \
-v ${HOME}:/pattern \
-v ${HOME}:${HOME} \
-v ${HOME}/.aws:/pattern-home/.aws \
"${REGISTRY}/${CONTAINER}" python3 /usr/local/bin/status-instances.py -f ${CLUSTER}


.PHONY: cluster-start
cluster-start: ## Starts the ostedcluster machines
@echo "Starting hosted-cluster nodes"
podman run --rm --net=host \
--security-opt label=disable \
-v ${HOME}:/pattern \
-v ${HOME}:${HOME} \
-v ${HOME}/.aws:/pattern-home/.aws \
"${REGISTRY}/${CONTAINER}" python3 /usr/local/bin/start-instances.py -f ${CLUSTER}

.PHONY: cluster-stop
cluster-stop: ## Checks the status of hostedcluster machines
@echo "Stopping hosted-cluster nodes"
podman run --rm --net=host \
--security-opt label=disable \
-v ${HOME}:/pattern \
-v ${HOME}:${HOME} \
-v ${HOME}/.aws:/pattern-home/.aws \
"${REGISTRY}/${CONTAINER}" python3 /usr/local/bin/stop-instances.py -f ${CLUSTER}

0 comments on commit b6b7ec0

Please sign in to comment.