Skip to content

Commit

Permalink
try getting podid
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <[email protected]>
  • Loading branch information
vsoch committed Dec 22, 2022
1 parent 602f382 commit 83584b6
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 31 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
strategy:
fail-fast: false
matrix:
test: [["ghcr.io/flux-framework/flux-restful-api:latest", "hello-world/00-hello-world.yaml", 60]]
test: [["ghcr.io/flux-framework/flux-restful-api:latest", "hello-world", 60]]

steps:
- name: Clone the code
Expand Down Expand Up @@ -83,23 +83,24 @@ jobs:
- name: Run Hello World Test
env:
applyfile: ${{ matrix.test[1] }}
name: ${{ matrix.test[1] }}
jobtime: ${{ matrix.test[2] }}
run: |
make run &
pid=$!
echo "PID for running cluster is ${pid}"
kubectl apply -f examples/tests/${applyfile}
kubectl apply -f examples/tests/${name}/minicluster-${name}.yaml
sleep 10
make list
pods=$(kubectl get -n flux-operator pod --output=jsonpath={.items..metadata.name});
pod="${pods%% *}"
kubectl port-forward -n flux-operator ${pod} 5000:5000 &
portpid=$!
/bin/bash examples/tests/${name}/test.sh
#pods=$(kubectl get -n flux-operator pod --output=jsonpath={.items..metadata.name});
#pod="${pods%% *}"
#kubectl port-forward -n flux-operator ${pod} 5000:5000 &
#portpid=$!
echo $pid $portpid
sleep ${jobtime}
kill ${pid} || echo "Already dead"
kill ${portpid} || echo "Already dead"
#kill ${portpid} || echo "Already dead"
# - name: Test service URLs
# run: |
Expand Down
7 changes: 0 additions & 7 deletions examples/tests/hello-world/00-hello-world-assert.yaml

This file was deleted.

22 changes: 6 additions & 16 deletions examples/tests/hello-world/00-hello-world.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
apiVersion: flux-framework.org/v1alpha1
kind: MiniCluster
metadata:
name: flux-sample
namespace: flux-operator
spec:
# Set to true to use volume mounts instead of volume claims
localDeploy: true

# Number of pods to create for MiniCluster
size: 4

# This is a list because a pod can support multiple containers
containers:
- image: ghcr.io/flux-framework/flux-restful-api:latest
command: echo hello world
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: /bin/bash ./test.sh
namespaced: true
timeout: 60
16 changes: 16 additions & 0 deletions examples/tests/hello-world/minicluster-hello-world.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: flux-framework.org/v1alpha1
kind: MiniCluster
metadata:
name: flux-sample
namespace: flux-operator
spec:
# Set to true to use volume mounts instead of volume claims
localDeploy: true

# Number of pods to create for MiniCluster
size: 4

# This is a list because a pod can support multiple containers
containers:
- image: ghcr.io/flux-framework/flux-restful-api:latest
command: echo hello world
11 changes: 11 additions & 0 deletions examples/tests/hello-world/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

kubectl get -n flux-operator pods
kubectl get -n flux-operator jobs
pods=$(kubectl get -n ${NAMESPACE} pod --output=jsonpath={.items..metadata.name});
echo "Pods: ${pods}"
pod="${pods%% *}"
echo "Namespace: ${NAMESPACE}"
echo "Pod: ${pod}"

kubectl logs -n ${NAMESPACE} ${pod}

0 comments on commit 83584b6

Please sign in to comment.