Skip to content

Commit

Permalink
[WFLY-19334] Fix use of kubectl/oc in overridable-functions.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
kabir committed May 15, 2024
1 parent 7fa7295 commit 59600ac
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function runPostHelmInstallCommands() {
kubectl apply -f charts/management-openshift.yml
oc apply -f charts/management-openshift.yml
}


Expand All @@ -13,6 +13,6 @@ function getMvnVerifyExtraArguments()
function cleanPrerequisites()
{
echo "Removing microprofile-health-management service and route"
kubectl delete route microprofile-health-management
kubectl delete service microprofile-health-management
oc delete route microprofile-health-management
oc delete service microprofile-health-management
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
function runPostHelmInstallCommands() {
echo "Applying all OpenTelemetry Collector resources"
oc apply -f charts/opentelemetry-collector.yaml
oc apply -f opentelemetry-collector-openshift.yaml
}

function cleanPrerequisites() {
echo "Deleting all OpenTelemetry Collector resources"
oc delete -f charts/opentelemetry-collector.yaml
oc delete -f opentelemetry-collector-openshift.yaml
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function installPrerequisites()
while [ $now -lt $end ]; do
sleep 5

if [[ $(oc get pods --field-selector=status.phase==Running -l name=wildfly-operator | awk '{ if ($3 == "Running" && $2 == "1/1") { print } }') ]]; then
if [[ $(kubectl get pods --field-selector=status.phase==Running -l name=wildfly-operator | awk '{ if ($3 == "Running" && $2 == "1/1") { print } }') ]]; then
break
fi

Expand Down Expand Up @@ -88,7 +88,7 @@ function helmInstall() {
function runPostHelmInstallCommands() {

# Make sure that view permissions are granted to the default system account.
kubectl policy add-role-to-user view system:serviceaccount:$(oc project -q):default -n $(oc project -q)
# kubectl policy add-role-to-user view system:serviceaccount:$(oc project -q):default -n $(oc project -q)

kubectl create -f client/client-cr.yaml
# TODO: should we check when the deployment is completed?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
function runPostHelmInstallCommands() {
echo "Applying all OpenTelemetry Collector resources"
oc apply -f charts/opentelemetry-collector-kubernetes.yaml
kubectl apply -f charts/opentelemetry-collector-kubernetes.yaml
}

function cleanPrerequisites() {
echo "Deleting all OpenTelemetry Collector resources"
oc delete -f charts/opentelemetry-collector-kubernetes.yaml
kubectl delete -f charts/opentelemetry-collector-kubernetes.yaml
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function installPrerequisites()
application="${1}"

echo "Installing Strimzi operator"
oc apply -f charts/strimzi-on-kubernetes.yaml
kubectl apply -f charts/strimzi-on-kubernetes.yaml

seconds=120
now=$(date +%s)
Expand All @@ -53,7 +53,7 @@ function installPrerequisites()
# It takes a while for the kafka CRD to be ready
sleep 5
echo "Trying to create my-cluster"
oc apply -f - <<EOF
kubectl apply -f - <<EOF
apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
Expand Down Expand Up @@ -82,7 +82,7 @@ EOF
done

echo "Creating testing topic"
oc apply -f - <<EOF
kubectl apply -f - <<EOF
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaTopic
metadata:
Expand All @@ -106,10 +106,10 @@ EOF

# Check the entity operator exists. It will have a name like my-cluster-entity-operator-<pod suffix>
# We do this check first because it takes a while to appear
oc get pods -l app.kubernetes.io/instance='my-cluster',app.kubernetes.io/name='entity-operator' | grep "my-cluster-entity-operator" || continue
kubectl get pods -l app.kubernetes.io/instance='my-cluster',app.kubernetes.io/name='entity-operator' | grep "my-cluster-entity-operator" || continue

# Wait 10 seconds for all pods to come up, and renter the loop if not
oc wait pod -l app.kubernetes.io/instance='my-cluster' --for=condition=Ready --timeout=10s || continue
kubectl wait pod -l app.kubernetes.io/instance='my-cluster' --for=condition=Ready --timeout=10s || continue

# If we got here, everything is up, so we can proceed
break
Expand All @@ -126,9 +126,9 @@ function cleanPrerequisites()
{
# TODO There are a few topics created that need cleaning up

oc delete kafka my-cluster
oc delete subscription amq-streams-subscription
oc delete operatorgroup amq-streams-operator-group
oc delete deployment amq-streams-cluster-operator-v2.5.0-1
oc delete kafkatopic testing
kubectl delete kafka my-cluster
kubectl delete subscription amq-streams-subscription
kubectl delete operatorgroup amq-streams-operator-group
kubectl delete deployment amq-streams-cluster-operator-v2.5.0-1
kubectl delete kafkatopic testing
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
function runPostHelmInstallCommands() {
echo "Applying all OpenTelemetry Collector resources"
oc apply -f charts/opentelemetry-collector-kubernetes.yaml
kubectl apply -f charts/opentelemetry-collector-kubernetes.yaml
}

function cleanPrerequisites() {
echo "Deleting all OpenTelemetry Collector resources"
oc delete -f charts/opentelemetry-collector-kubernetes.yaml
kubectl delete -f charts/opentelemetry-collector-kubernetes.yaml
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ function getHelmSetVariablePrefix() {

function helmInstallFailed() {
echo "----> Getting status of all pods"
oc get pods
kubectl get pods
echo "----> Checking logs for postgres pod"
oc logs todo-backend-postgresql-0
kubectl logs todo-backend-postgresql-0
echo "----> Checking events"
oc get events
kubectl get events
}

0 comments on commit 59600ac

Please sign in to comment.