Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1104 from kinvolk/iaguis/fix-gangway
Browse files Browse the repository at this point in the history
gangway: add a serviceaccount
  • Loading branch information
invidian authored Oct 21, 2020
2 parents 5b9b2de + a4f0888 commit f767846
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
1 change: 1 addition & 0 deletions assets/charts/components/gangway/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ spec:
runAsNonRoot: true
runAsUser: 65534
runAsGroup: 65534
serviceAccountName: gangway
initContainers:
- name: download-theme
image: alpine/git:1.0.7
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: gangway
name: gangway
10 changes: 8 additions & 2 deletions pkg/assets/generated_assets.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions test/components/gangway/gangway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
package gangway

import (
"context"
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

testutil "github.com/kinvolk/lokomotive/test/components/util"
)

Expand All @@ -35,3 +38,24 @@ func TestGangwayDeployment(t *testing.T) {
testutil.WaitForDeployment(t, client, namespace, deployment, testutil.RetryInterval, testutil.Timeout)
})
}

func TestGangwayServiceAccount(t *testing.T) {
namespace := "gangway"
deployment := "gangway"
expectedServiceAccountName := "gangway"

client := testutil.CreateKubeClient(t)

testutil.WaitForDeployment(t, client, namespace, deployment, testutil.RetryInterval, testutil.Timeout)

deploy, err := client.AppsV1().Deployments(namespace).Get(context.TODO(), deployment, metav1.GetOptions{})
if err != nil {
t.Fatalf("Couldn't find gangway deployment")
}

if deploy.Spec.Template.Spec.ServiceAccountName != expectedServiceAccountName {
t.Fatalf("Expected serviceAccountName %q, got: %q",
deploy.Spec.Template.Spec.ServiceAccountName,
deploy.Spec.Template.Spec.ServiceAccountName)
}
}

0 comments on commit f767846

Please sign in to comment.