Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify environment check #201

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions common_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,20 @@ check_cluster_version() {
log "Unable to connect to the cluster, please check if it's up and make sure the KUBECONFIG is set correctly"
exit 1
fi
kubectl get clusterversion || log "Not an OpenShift environment"
if [[ $(kubectl api-resources --api-group=apiserver.openshift.io --no-headers=true|wc -l) -gt 0 ]];
then
kubectl get clusterversion
else
log "Not an OpenShift environment"
fi
}

# sets kubernetes distribution in krkn config if platform is kubernetes included automatically
# on all the builds to keep krkn compatible with both the platform
# called in the checks method below

set_kubernetes_platform() {
if ! kubectl get clusterversion;
if [[ $(kubectl api-resources --api-group=apiserver.openshift.io --no-headers=true|wc -l) -eq 0 ]];
then
yq -i '.kraken.distribution="kubernetes"' /home/krkn/kraken/config/config.yaml.template
fi
Expand Down