Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
5b92558
`.github/workflows/pull-request.yaml`: run on `self-hosted`
mbana Dec 20, 2022
b31ffa6
`.github/workflows/pull-request.yaml`: run on `self-hosted`
mbana Dec 20, 2022
4d7361b
`.github/workflows/pull-request.yaml`: run on `self-hosted`
mbana Dec 20, 2022
fb286e8
`.github/workflows/pull-request.yaml`: run on `self-hosted`
mbana Dec 20, 2022
6347c0c
`.github/workflows/pull-request.yaml`: run on `self-hosted`
mbana Dec 20, 2022
17c749f
`.github/workflows/pull-request.yaml`: run on `self-hosted`
mbana Dec 20, 2022
ac18e7a
`.github/workflows/pull-request.yaml`: run on `self-hosted`
mbana Dec 20, 2022
af482e8
`.github/workflows/pull-request.yaml`: run on `self-hosted`
mbana Dec 20, 2022
25bc56b
`.github/workflows/pull-request.yaml`: run on `self-hosted`
mbana Dec 20, 2022
1e12f5f
`.github/workflows/pull-request.yaml`: run on `self-hosted`
mbana Dec 20, 2022
d1b3794
`.github/workflows/pull-request.yaml`: run on `self-hosted`
mbana Dec 20, 2022
3f9130a
`.github/workflows/pull-request.yaml`: run on `self-hosted`
mbana Dec 20, 2022
a7aa59a
`.github/workflows/pull-request.yaml`: run on `self-hosted`
mbana Dec 20, 2022
0dd7e94
`.github/workflows/pull-request.yaml`: run on `self-hosted`
mbana Dec 20, 2022
f4a0b48
`.github/workflows/pull-request.yaml`: run on `self-hosted`
mbana Dec 20, 2022
e6f1df1
`.github/workflows/pull-request.yaml`: run on `self-hosted`
mbana Dec 20, 2022
84e8f76
`.github/workflows/pull-request.yaml`: run on `self-hosted`
mbana Dec 20, 2022
fac1edb
`.github/workflows/pull-request.yaml`: run on `self-hosted`
mbana Dec 20, 2022
a769f94
Merge branch 'main' into mbana-e2e-self-hosted-runner
Dec 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ permissions:
jobs:
golangci-lint:
name: golangci-lint
runs-on: ubuntu-22.04
runs-on: self-hosted
steps:
- name: setup-go
uses: actions/setup-go@v3
Expand All @@ -42,7 +42,7 @@ jobs:

test-kusk-cli:
name: Compile and Test Kusk CLI
runs-on: ubuntu-22.04
runs-on: self-hosted
steps:
- name: checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:

build-api-docker:
name: Build API and websocket docker images
runs-on: ubuntu-22.04
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:

tests:
name: tests
runs-on: ubuntu-22.04
runs-on: self-hosted
steps:
- name: setup-go
uses: actions/setup-go@v3
Expand All @@ -128,8 +128,8 @@ jobs:
uses: helm/kind-action@v1.5.0
with:
cluster_name: kgw
wait: 256s
verbosity: 1
wait: 1m
verbosity: 10

- name: kubectl-get-services-all-namespaces-pre-loadbalancer-configuration
run: |
Expand Down Expand Up @@ -163,7 +163,7 @@ jobs:
echo 'installing `kusk-gateway-manager` (control-plane) image into cluster'
make deploy
kubectl get svc --all-namespaces
kubectl rollout status --namespace kusk-system deployment/kusk-gateway-manager --watch --timeout=256s
kubectl rollout status --namespace kusk-system deployment/kusk-gateway-manager --watch --timeout=1m

- name: make-deploy-envoyfleet
run: |
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ vet: ## Run go vet against code.

.PHONY: test
test: manifests fmt vet install-deps ## Run tests.
KUBEBUILDER_ASSETS="$(shell setup-envtest use $(ENVTEST_K8S_VERSION) -p path)" go test $(shell go list ./... | grep -v smoketests | grep -v internal/controllers | grep -v api/v1alpha1) -coverprofile cover.out
KUBEBUILDER_ASSETS="$(shell setup-envtest use $(ENVTEST_K8S_VERSION) -p path)" go test -v -count=1 $(shell go list ./... | grep -v smoketests | grep -v internal/controllers | grep -v api/v1alpha1) -coverprofile cover.out

.PHONY: testing
testing: ## Run the integration tests from development/testing and then delete testing artifacts if succesfull.
Expand Down
2 changes: 1 addition & 1 deletion cmd/kusk/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ lint:

.PHONY: test
test:
go test -count=1 ./...
go test -v -count=1 ./...

.PHONY: install-deps
install-deps:
Expand Down
20 changes: 12 additions & 8 deletions cmd/kusk/internal/overlays/overlays.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"sigs.k8s.io/yaml"
)

const imageName = "kubeshop/overlay-cli"
const imageName = "docker.io/kubeshop/overlay-cli"

type Overlay struct {
Overlays string `json:"overlays,omitempty" yaml:"overlays,omitempty"`
Expand Down Expand Up @@ -61,22 +61,24 @@ func NewOverlay(path string) (o *Overlay, err error) {
func (o *Overlay) Apply() (string, error) {
var err error
var overlayed string

if !IsUrl(o.Extends) {
overlayed, err = applyOverlay(o.path, o.Extends)
if err != nil {
return "", err
return "", fmt.Errorf(`Overlay.Apply failed - !IsUrl(o.Extends), o.path=%v, overlayed=%v: %w`, o.path, overlayed, err)
}
} else {
overlayed, err = applyOverlay(o.path, "")
if err != nil {
return "", err
return "", fmt.Errorf(`Overlay.Apply failed - IsUrl(o.Extends), o.path=%v, overlayed=%v: %w`, o.path, overlayed, err)
}
}

if f, err := os.CreateTemp("", "overlay"); err != nil {
return "", err
return "", fmt.Errorf(`Overlay.Apply failed - os.CreateTemp("", "overlay"), overlayed=%v: %w`, overlayed, err)
} else {
if _, err := f.Write([]byte(overlayed)); err != nil {
return "", err
return "", fmt.Errorf(`Overlay.Apply failed - f.Write([]byte(overlayed)), overlayed=%v: %w`, overlayed, err)
}
return f.Name(), err
}
Expand Down Expand Up @@ -126,12 +128,12 @@ func applyOverlay(path string, extends string) (string, error) {
ctx := context.Background()
cli, err := client.NewClientWithOpts(client.FromEnv)
if err != nil {
return "", err
return "", fmt.Errorf("unable to create new docker client from environment: %w", err)
}
defer cli.Close()
reader, err := cli.ImagePull(ctx, imageName, types.ImagePullOptions{})
if err != nil {
return "", err
return "", fmt.Errorf("unable to pull image %v: %w", imageName, err)
}

defer reader.Close()
Expand All @@ -157,10 +159,12 @@ func applyOverlay(path string, extends string) (string, error) {
} else {
cmd = exec.Command("docker", "run", "--rm", volumes, imageName)
}

out, err := cmd.CombinedOutput()
if err != nil {
return "", err
return "", fmt.Errorf("cmd.CombinedOutput failed: cmd=%+#v, out=%v, %w", cmd, string(out), err)
}

return string(out), nil
}

Expand Down
24 changes: 12 additions & 12 deletions cmd/kusk/internal/overlays/overlays_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ package overlays

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestOverlayPass(t *testing.T) {
overlay, err := NewOverlay("overlay.yaml")
if err != nil {
t.Log(err)
t.Fail()
}
assert := assert.New(t)
overlay, err := NewOverlay("./overlay.yaml")
assert.NoError(err)

if _, err := overlay.Apply(); err != nil {
t.Log(err)
t.Fail()
}
appliedOverlay, err := overlay.Apply()
assert.NoError(err)
t.Logf("appliedOverlay=%v", appliedOverlay)
}

func TestOverlayNoPass(t *testing.T) {
if _, err := NewOverlay("overlayed.yaml"); err == nil {
t.Fail()
}
assert := assert.New(t)

_, err := NewOverlay("overlayed.yaml")
assert.Error(err)
}