Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Commit

Permalink
chore: update golang version and helm version
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianKramm committed Feb 11, 2021
1 parent 451c669 commit 06e2fdc
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
test:
runs-on: ubuntu-18.04
steps:
- name: Set up Go 1.13
- name: Set up Go 1.15
uses: actions/setup-go@v1
with:
go-version: 1.13
go-version: 1.15
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Test
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Build the manager binary
FROM golang:1.13 as builder
FROM golang:1.15 as builder

WORKDIR /workspace

# Install Helm 3
RUN bash -c "curl -s https://get.helm.sh/helm-v3.3.1-linux-amd64.tar.gz > helm3.tar.gz" && tar -zxvf helm3.tar.gz linux-amd64/helm && chmod +x linux-amd64/helm && mv linux-amd64/helm /workspace/helm && rm helm3.tar.gz && rm -R linux-amd64
RUN bash -c "curl -s https://get.helm.sh/helm-v3.5.2-linux-amd64.tar.gz > helm3.tar.gz" && tar -zxvf helm3.tar.gz linux-amd64/helm && chmod +x linux-amd64/helm && mv linux-amd64/helm /workspace/helm && rm helm3.tar.gz && rm -R linux-amd64

# Copy the Go Modules manifests
COPY go.mod go.mod
Expand Down
9 changes: 9 additions & 0 deletions pkg/apiserver/registry/account/rest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
tenancyv1alpha1 "github.com/loft-sh/kiosk/pkg/apis/tenancy/v1alpha1"
rbacv1 "k8s.io/api/rbac/v1"
"sigs.k8s.io/controller-runtime/pkg/client"

testingutil "github.com/loft-sh/kiosk/pkg/util/testing"

Expand Down Expand Up @@ -215,9 +216,17 @@ func TestAccountUpdate(t *testing.T) {
userCtx := request.WithUser(ctx, &user.DefaultInfo{Name: "foo"})
accountStorage := NewAccountREST(fakeClient, fakeClient, scheme).(*accountREST)

// Get old account
oldAccount := &configv1alpha1.Account{}
err := fakeClient.Get(ctx, client.ObjectKey{Name: "test"}, oldAccount)
if err != nil {
t.Fatal(err)
}

newObj, updated, err := accountStorage.Update(userCtx, "test", &fakeUpdater{out: &tenancy.Account{
ObjectMeta: metav1.ObjectMeta{
Name: "test",
ResourceVersion: oldAccount.ResourceVersion,
Labels: map[string]string{
"Updated": "true",
},
Expand Down
13 changes: 7 additions & 6 deletions pkg/apiserver/registry/space/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,13 @@ func (r *spaceStorage) Create(ctx context.Context, obj runtime.Object, createVal

return nil, err
}

// wait until we get access
err = r.waitForAccess(ctx, a.GetUser(), namespace)
if err != nil {
// if this happens it is kind of weird, but its not a reason to return an error and abort the request
klog.Infof("error waiting for access to namespace %s for user %s: %v", namespace.Name, a.GetUser().GetName(), err)
}
} else {
err := r.client.Create(ctx, namespace, &client.CreateOptions{
Raw: options,
Expand All @@ -297,12 +304,6 @@ func (r *spaceStorage) Create(ctx context.Context, obj runtime.Object, createVal
}
}

err = r.waitForAccess(ctx, a.GetUser(), namespace)
if err != nil {
// if this happens it is kind of weird, but its not a reason to return an error and abort the request
klog.Infof("error waiting for access to namespace %s for user %s: %v", namespace.Name, a.GetUser().GetName(), err)
}

return ConvertNamespace(namespace), nil
}

Expand Down
14 changes: 11 additions & 3 deletions pkg/apiserver/registry/space/rest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package space
import (
tenancyv1alpha1 "github.com/loft-sh/kiosk/pkg/apis/tenancy/v1alpha1"
rbacv1 "k8s.io/api/rbac/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
"testing"

"github.com/loft-sh/kiosk/pkg/apis/tenancy"
Expand Down Expand Up @@ -243,11 +244,17 @@ func TestCreateSpace(t *testing.T) {
t.Fatal("Expected error but got nil")
}

// Get old account
oldAccount := &configv1alpha1.Account{}
err = fakeClient.Get(ctx, client.ObjectKey{Name: "test"}, oldAccount)
if err != nil {
t.Fatal(err)
}

// Set index value
test := "test"
newAccount := &configv1alpha1.Account{
ObjectMeta: metav1.ObjectMeta{
Name: "test",
},
ObjectMeta: oldAccount.ObjectMeta,
Spec: configv1alpha1.AccountSpec{
Subjects: []rbacv1.Subject{
{
Expand All @@ -258,6 +265,7 @@ func TestCreateSpace(t *testing.T) {
},
Space: configv1alpha1.AccountSpace{
Limit: &spaceLimit,
ClusterRole: &test,
SpaceTemplate: configv1alpha1.AccountSpaceTemplate{
ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{
Expand Down

0 comments on commit 06e2fdc

Please sign in to comment.