Skip to content

Commit

Permalink
fix: scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
codekow committed Oct 28, 2023
1 parent dde1a2c commit 9100a3b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 25 deletions.
29 changes: 4 additions & 25 deletions scripts/library/aws.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
#!/bin/bash

alias aws=aws_cli

aws_cli(){
#shellcheck disable=SC2068
aws_check_cli && aws ${@}
}

aws_check_cli(){
aws --version || return
which aws || \
pip install awscli -q || return
}

aws_check_cli

aws_get_all_ec2(){
aws ec2 describe-instances --filters Name=instance-state-name,Values=running --query 'Reservations[].Instances[].InstanceId' --output text | sed 's/\t/ /g'
aws ec2 describe-instances --filters Name=tag:Name,Values=bastion --query 'Reservations[].Instances[].InstanceId' --output text
Expand Down Expand Up @@ -60,20 +56,3 @@ aws_stop_instance(){
aws ec2 stop-instances --profile="${AWS_PROFILE}" --region="${AWS_REGION}" --instance-ids="${iid}"
fi
}

aws_setup_ack_system(){
NAMESPACE=ack-system

setup_namespace ${NAMESPACE}

oc apply -k "${GIT_ROOT}"/components/operators/${NAMESPACE}/aggregate/popular

for type in ec2 ecr iam s3 sagemaker
do
oc apply -k "${GIT_ROOT}"/components/operators/ack-${type}-controller/operator/overlays/alpha

< "${GIT_ROOT}"/components/operators/ack-${type}-controller/operator/overlays/alpha/user-secrets-secret.yaml \
sed "s@UPDATE_AWS_ACCESS_KEY_ID@${AWS_ACCESS_KEY_ID}@; s@UPDATE_AWS_SECRET_ACCESS_KEY@${AWS_SECRET_ACCESS_KEY}@" | \
oc -n ${NAMESPACE} apply -f -
done
}
17 changes: 17 additions & 0 deletions scripts/library/ocp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,23 @@ ocp_aws_get_key(){
echo "AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}"
}

ocp_aws_setup_ack_system(){
NAMESPACE=ack-system

setup_namespace ${NAMESPACE}

oc apply -k "${GIT_ROOT}"/components/operators/${NAMESPACE}/aggregate/popular

for type in ec2 ecr iam s3 sagemaker
do
oc apply -k "${GIT_ROOT}"/components/operators/ack-${type}-controller/operator/overlays/alpha

< "${GIT_ROOT}"/components/operators/ack-${type}-controller/operator/overlays/alpha/user-secrets-secret.yaml \
sed "s@UPDATE_AWS_ACCESS_KEY_ID@${AWS_ACCESS_KEY_ID}@; s@UPDATE_AWS_SECRET_ACCESS_KEY@${AWS_SECRET_ACCESS_KEY}@" | \
oc -n ${NAMESPACE} apply -f -
done
}

ocp_aws_cluster_autoscaling(){
oc apply -k "${GIT_ROOT}"/components/configs/autoscale/overlays/gpus

Expand Down

0 comments on commit 9100a3b

Please sign in to comment.