Skip to content

Commit

Permalink
Update go.yml
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Sevilla <[email protected]>
  • Loading branch information
rsevilla87 committed Sep 19, 2020
1 parent 1e6c1ba commit fe730eb
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 10 deletions.
45 changes: 43 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,60 @@ name: Go
on:
push:
branches: [ master ]
paths-ignore:
- "**.md"
- "examples/**"
- "hack/**"
pull_request:
branches: [ master ]
paths-ignore:
- "**.md"
- "examples/**"
- "hack/**"

jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
golang-version: [1.14, 1.15]
image-versions:
- kindest/node:v1.19
- kindest/node:v1.18
- kindest/node:v1.17
steps:

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.13
go-version: ${{matrix.golang-version}}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build
run: make build

- name: Setup kinD
uses: engineerd/[email protected]
with:
config: test/kind.yml
omage: ${{matrix.image-versions}}
version: "v0.7.0"

- name: Execute kube-burner test
working-directory: test
run: ../bin/kube-burner init -c kube-burner.yml --uuid my-uuid

lint:
name: Run golangci-lint
runs-on: ubuntu-latest
Expand All @@ -48,5 +81,13 @@ jobs:
# the token is used for fetching patch of a pull request to show only new issues
#github-token: # default is ${{ github.token }}

build-container:
name: Build container image
runs-on: ubuntu-latest
steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- run: make images


6 changes: 3 additions & 3 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM registry.access.redhat.com/ubi8:latest as builder
FROM registry.fedoraproject.org/fedora-minimal:latest as builder

RUN dnf install -y golang make git
RUN microdnf install golang make git
COPY . /root/kube-burner
RUN make clean -C /root/kube-burner && make build -C /root/kube-burner

FROM registry.access.redhat.com/ubi8:latest
FROM registry.fedoraproject.org/fedora-minimal:latest

COPY --from=builder /root/kube-burner/bin/kube-burner /bin/kube-burner
LABEL maintainer="Raul Sevilla <[email protected]"
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ SOURCES := $(shell find . -type f -name "*.go")
BUILD_DATE = $(shell date '+%Y-%m-%d-%H:%M:%S')
KUBE_BURNER_PACKAGE = github.com/cloud-bulldozer/kube-burner

ifeq (, $(shell command -v docker))
ENGINE := podman
else
ENGINE := docker
endif

all: build

help:
Expand Down Expand Up @@ -40,3 +46,6 @@ vendor:

install:
cp $(BIN_DIR)/$(BIN_NAME) /usr/bin/$(BIN_NAME)

images:
$(ENGINE) build -f Containerfile . -t kube-burner:latest
7 changes: 2 additions & 5 deletions examples/cfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,9 @@ jobs:
objects:

- kind: Deployment
labelSelector: {job: kube-burner-job}
labelSelector: {kube-burner-job: kube-burner-job}
apiVersion: apps/v1

- kind: Secret
labelSelector: {job: kube-burner-job}
labelSelector: {kube-burner-job: kube-burner-job}

- kind: Secret
labelSelector: {job: kube-burner-job}
apiVersion: route.openshift.io/v1
4 changes: 4 additions & 0 deletions pkg/burner/burner.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
"sync"
"time"
Expand Down Expand Up @@ -103,6 +104,9 @@ func ReadConfig(QPS, burst int) {
if config.ConfigSpec.GlobalConfig.Kubeconfig != "" {
kubeconfig = config.ConfigSpec.GlobalConfig.Kubeconfig
}
if _, err := os.Stat(filepath.Join(os.Getenv("HOME"), ".kube", "config")); kubeconfig == "" && !os.IsNotExist(err) {
kubeconfig = filepath.Join(os.Getenv("HOME"), ".kube", "config")
}
if kubeconfig != "" {
log.Infof("Using kubeconfig: %s", kubeconfig)
RestConfig, err = clientcmd.BuildConfigFromFlags("", kubeconfig)
Expand Down
5 changes: 5 additions & 0 deletions test/kind.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
64 changes: 64 additions & 0 deletions test/kube-burner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---

global:
writeToFile: true
metricsDirectory: collected-metrics
measurements:
- name: podLatency
esIndex: kube-burner-podlatency

indexerConfig:
enabled: false

jobs:
- name: create-job
jobType: create
jobIterations: 2
qps: 5
burst: 15
namespacedIterations: true
cleanup: true
namespace: my-ns
podWait: false
waitWhenFinished: true
verifyObjects: true
errorOnVerify: true
objects:

- objectTemplate: objectTemplates/deployment.yml
replicas: 1
inputVars:
containerImage: gcr.io/google_containers/pause-amd64:3.0

- name: create-job-2
jobType: create
jobIterations: 2
qps: 5
burst: 15
namespacedIterations: true
cleanup: true
namespace: my-ns
podWait: true
waitWhenFinished: false
verifyObjects: true
errorOnVerify: true
jobIterationDelay: 1000
objects:

- objectTemplate: objectTemplates/deployment.yml
replicas: 1
inputVars:
containerImage: gcr.io/google_containers/pause-amd64:3.0


- name: delete-job
jobType: delete
waitForDeletion: true
qps: 10
burst: 20
jobPause: 1
objects:

- kind: Deployment
labelSelector: {kube-burner-job: create-job-2}
apiVersion: apps/v1
21 changes: 21 additions & 0 deletions test/objectTemplates/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: sleep-app-{{ .Iteration }}-{{ .Replica }}-{{.JobName }}
spec:
replicas: 1
selector:
matchLabels:
app: sleep-app-{{ .Iteration }}-{{ .Replica }}
template:
metadata:
labels:
app: sleep-app-{{ .Iteration }}-{{ .Replica }}
spec:
containers:
- args:
- sleep
- infinity
image: {{.containerImage}}
name: ci-app

0 comments on commit fe730eb

Please sign in to comment.