benchmark is missing jq and kubectl
Summary
When running a benchmark with SGDBOps, it keeps complaining about the missing kubectl
and jq
tools.
Current Behaviour
Steps to reproduce
- create a cluster with pg 12, like below:
apiVersion: stackgres.io/v1
kind: SGCluster
metadata:
name: backup-test
namespace: default
spec:
instances: 2
pods:
persistentVolume:
size: 10Gi
storageClass: gp2
postgres:
version: "12.8"
- wait for the cluster be up and running
- create the sgdbops:
apiVersion: stackgres.io/v1
kind: SGDbOps
metadata:
name: database-fill
namespace: default
spec:
benchmark:
pgbench:
concurrentClients: 1
databaseSize: 8Gi
duration: P0DT0H1M0S
threads: 1
usePreparedStatements: false
type: pgbench
maxRetries: 0
op: benchmark
sgCluster: backup-test
When checking the logs, lots of messages like this appears:
++ kubectl get '' -n '' '' -o json
/usr/local/bin/shell-utils: line 142: kubectl: command not found
+ RESULT=
++ jq -R .
/usr/local/bin/shell-utils: line 143: jq: command not found
++ printf %s 'Database pgbench_6166fbe8 created'
When checking the job, I've found that is using the images below:
❯ kubectl get jobs.batch database-fill-benchmark-fea9f890aa0a46dd-0 -o json | gojq '.spec.template.spec.initContainers |map( { name: .name, image: .image })'
[
{
"image": "docker.io/ongres/kubectl:v1.19.14-build-6.6",
"name": "set-dbops-running"
}
]
❯ kubectl get jobs.batch database-fill-benchmark-fea9f890aa0a46dd-0 -o json | gojq '.spec.template.spec.containers |map( { name: .name, image: .image })'
[
{
"image": "docker.io/ongres/patroni:v2.1.1-pg12.8-build-6.6",
"name": "run-dbops"
},
{
"image": "docker.io/ongres/kubectl:v1.19.14-build-6.6",
"name": "set-dbops-result"
}
]
Expected Behaviour
No errors from kubectl
or jq
.
Possible Solution
Since both postgres-util
and patroni
doesn't have the binaries installed will be necessary to use another image.
Use the kubectl
image or mount/copy the binaries from it.
❯ docker run --rm -it docker.io/ongres/kubectl:v1.19.14-build-6.6 bash
bash-4.4$ jq --version
jq-1.5
bash-4.4$ kubectl version
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.14", GitCommit:"0fd2b5afdfe3134d6e1531365fdb37dd11f54d1c", GitTreeState:"clean", BuildDate:"2021-08-11T18:07:41Z", GoVersion:"go1.15.15", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
Environment
- StackGres version:
❯ kubectl get deployments -n stackgres stackgres-operator --template '{{ printf "%s\n" (index .spec.template.spec.containers 0).image }}'
stackgres/operator:1.0.0-RC1
- Kubernetes version:
❯ kubectl version
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.0", GitCommit:"c2b5237ccd9c0f1d600d3072634ca66cefdf272f", GitTreeState:"clean", BuildDate:"2021-08-04T17:56:19Z", GoVersion:"go1.16.6", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"20+", GitVersion:"v1.20.7-eks-d88609", GitCommit:"d886092805d5cc3a47ed5cf0c43de38ce442dfcb", GitTreeState:"clean", BuildDate:"2021-07-31T00:29:12Z", GoVersion:"go1.15.12", Compiler:"gc", Platform:"linux/amd64"}
WARNING: version difference between client (1.22) and server (1.20) exceeds the supported minor version skew of +/-1
- Cloud provider or hardware configuration: AWS with EKS
Relevant logs and/or screenshots
Acceptance criteria:
-
Fix the bug -
create the test
Edited by Jose OSS