Skip to content

Commit

Permalink
Merge branch 'main' into haproxy-version
Browse files Browse the repository at this point in the history
  • Loading branch information
rsevilla87 authored Sep 22, 2023
2 parents f14ae58 + 1186865 commit c7e4a62
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 15 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release ingress-netperf container image

on:
push:
paths:
- "containers/**" # Trigger only when Dockerfile changes in a pull request

env:
CONTAINER_REGISTRY: ${{ 'quay.io' }}
GO_VER: 1.19

jobs:
build-and-publish-container-images:
name: Build and Publish Multi Architecture Container Images
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: Setup QEMU & Install Dependecies
run: |
sudo apt-get update -y
sudo apt-get install qemu-user-static fuse-overlayfs -y
sudo apt-get install podman -y
if: runner.os == 'Linux'

- name: Clone Repository
uses: actions/checkout@v3

- name: Setup Golang
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VER }}

- name: Verify Go Version
run: go version

- name: Login to the ${{ env.CONTAINER_REGISTRY }} Container Registry
run: podman login quay.io -u ${QUAY_USER} -p ${QUAY_TOKEN}
env:
QUAY_USER: ${{ secrets.QUAY_USER }}
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}

- name: Build and Push Multi archiecture Image
id: push
run: |
make gha-build
make gha-push
env:
GO_VER: ${{ env.GO_VER }}
20 changes: 18 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
CONTAINER_BUILD ?= podman build --force-rm
CONTAINER_NS ?= quay.io/cloud-bulldozer
GIT_COMMIT = $(shell git rev-parse HEAD)

BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
Expand All @@ -18,16 +20,30 @@ CGO = 0

.PHONY: build lint clean

all: lint build
all: lint build container-build

build: $(BIN_PATH)

$(BIN_PATH): $(SOURCES)
GOARCH=$(shell go env GOARCH) CGO_ENABLED=$(CGO) go build -v -ldflags "-X $(INGRESS_PERF_VERSION).GitCommit=$(GIT_COMMIT) -X $(INGRESS_PERF_VERSION).Version=$(VERSION) -X $(INGRESS_PERF_VERSION).BuildDate=$(BUILD_DATE)" -o $(BIN_PATH) cmd/ingress-perf.go

container-build: build
@echo "Building the container image"
$(CONTAINER_BUILD) -f containers/Containerfile \
-t $(CONTAINER_NS)/$(BIN_NAME) ./containers

gha-build: build
@echo "Building Multi-architecture container Images"
$(CONTAINER_BUILD) -f containers/Containerfile \
--platform=linux/amd64,linux/arm64,linux/ppc64le,linux/s390x \
-t $(CONTAINER_NS)/$(BIN_NAME) ./containers --manifest=$(CONTAINER_NS)/$(BIN_NAME):latest

gha-push: gha-build
@echo "Pushing Container Images"
$(CONTAINER_BUILD) manifest push

clean:
rm -Rf $(BIN_DIR)

lint:
golangci-lint run

2 changes: 1 addition & 1 deletion cmd/ingress-perf.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func run() *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
var indexer *indexers.Indexer
var err error
log.Infof("Running ingress performance %s", uuid)
log.Infof("Running ingress-perf (%s@%s) with uuid %s", version.Version, version.GitCommit, uuid)
if err := config.Load(cfg); err != nil {
return err
}
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ func Start(uuid, baseUUID, baseIndex string, tolerancy int, indexer *indexers.In
var comparator comparison.Comparator
var clusterMetadata tools.ClusterMetadata
passed := true
log.Info("Starting ingress-perf")
if os.Getenv("KUBECONFIG") != "" {
kubeconfig = os.Getenv("KUBECONFIG")
} else if _, err := os.Stat(filepath.Join(os.Getenv("HOME"), ".kube", "config")); kubeconfig == "" && !os.IsNotExist(err) {
Expand Down
28 changes: 17 additions & 11 deletions pkg/runner/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
rbac "k8s.io/api/rbac/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
Expand Down Expand Up @@ -58,13 +57,6 @@ var workerAffinity = &corev1.Affinity{
},
}

var clientServerRequests = corev1.ResourceRequirements{
Requests: corev1.ResourceList{
"cpu": resource.MustParse("100m"),
"memory": resource.MustParse("250Mi"),
},
}

var server = appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: serverName,
Expand All @@ -82,6 +74,14 @@ var server = appsv1.Deployment{
Labels: map[string]string{"app": serverName},
},
Spec: corev1.PodSpec{
TopologySpreadConstraints: []corev1.TopologySpreadConstraint{{
MaxSkew: 1,
TopologyKey: "kubernetes.io/hostname",
WhenUnsatisfiable: corev1.DoNotSchedule,
LabelSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{"app": serverName},
},
}},
Affinity: workerAffinity,
TerminationGracePeriodSeconds: pointer.Int64(0), // It helps to kill the pod inmediatly on GC
Containers: []corev1.Container{
Expand All @@ -95,8 +95,7 @@ var server = appsv1.Deployment{
RunAsNonRoot: pointer.Bool(true),
SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeRuntimeDefault},
},
Resources: clientServerRequests,
Ports: []corev1.ContainerPort{{Name: "http", Protocol: corev1.ProtocolTCP, ContainerPort: 8080}},
Ports: []corev1.ContainerPort{{Name: "http", Protocol: corev1.ProtocolTCP, ContainerPort: 8080}},
},
},
},
Expand Down Expand Up @@ -135,6 +134,14 @@ var client = appsv1.Deployment{
Labels: map[string]string{"app": clientName},
},
Spec: corev1.PodSpec{
TopologySpreadConstraints: []corev1.TopologySpreadConstraint{{
MaxSkew: 1,
TopologyKey: "kubernetes.io/hostname",
WhenUnsatisfiable: corev1.DoNotSchedule,
LabelSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{"app": clientName},
},
}},
Affinity: workerAffinity,
TerminationGracePeriodSeconds: pointer.Int64(0),
HostNetwork: true, // Enable hostNetwork in client pods
Expand All @@ -150,7 +157,6 @@ var client = appsv1.Deployment{
RunAsNonRoot: pointer.Bool(true),
SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeRuntimeDefault},
},
Resources: clientServerRequests,
},
},
},
Expand Down

0 comments on commit c7e4a62

Please sign in to comment.