generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable e2e test #10
Merged
Merged
Enable e2e test #10
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,10 @@ on: | |
# Run workflow on fork repository will help contributors find and resolve issues before sending a PR. | ||
push: | ||
pull_request: | ||
defaults: | ||
run: | ||
working-directory: go/src/sigs.k8s.io/work-api | ||
|
||
jobs: | ||
golangci: | ||
name: lint | ||
|
@@ -18,28 +22,68 @@ jobs: | |
|
||
# show only new issues if it's a pull request. | ||
only-new-issues: false | ||
args: --timeout 3m0s | ||
verify: | ||
name: verify | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
path: go/src/sigs.k8s.io/work-api | ||
- name: install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.14.x | ||
go-version: 1.16.x | ||
- name: verify | ||
run: hack/verify-all.sh -v | ||
env: | ||
GOPATH: '/home/runner/work/work-api/work-api/go' | ||
test: | ||
name: unit test | ||
needs: verify | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
path: go/src/sigs.k8s.io/work-api | ||
- name: install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.14.x | ||
go-version: 1.16.x | ||
- name: make test | ||
run: make test | ||
env: | ||
GOPATH: '/home/runner/work/work-api/work-api/go' | ||
e2e: | ||
name: e2e | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
path: go/src/sigs.k8s.io/work-api | ||
- name: install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.16.x | ||
- name: images | ||
run: make docker-build | ||
env: | ||
GOPATH: '/home/runner/work/work-api/work-api/go' | ||
- name: setup kind | ||
uses: engineerd/[email protected] | ||
with: | ||
version: v0.11.1 | ||
- name: Load image on the nodes of the cluster | ||
run: | | ||
kind load docker-image --name=kind work-api-controller:latest | ||
- name: Run e2e test | ||
run: | | ||
make test-e2e | ||
env: | ||
KUBECONFIG: /home/runner/.kube/config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: work-controller | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
# We deploy a controller that could work with permission lower than cluster-admin, the tradeoff is | ||
# responsivity because list/watch cannot be maintained over too many namespaces. | ||
name: admin | ||
subjects: | ||
- kind: ServiceAccount | ||
name: work-controller-sa | ||
namespace: work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
kind: Deployment | ||
apiVersion: apps/v1 | ||
metadata: | ||
name: work-controller | ||
labels: | ||
app: work | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: work-controller | ||
template: | ||
metadata: | ||
labels: | ||
app: work-controller | ||
spec: | ||
serviceAccountName: work-controller-sa | ||
containers: | ||
- name: work-controller | ||
image: work-api-controller:latest | ||
imagePullPolicy: IfNotPresent | ||
args: | ||
- "--work-namespace=default" | ||
- "--hub-kubeconfig=/spoke/hub-kubeconfig/kubeconfig" | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
capabilities: | ||
drop: | ||
- ALL | ||
privileged: false | ||
volumeMounts: | ||
- name: hub-kubeconfig-secret | ||
mountPath: "/spoke/hub-kubeconfig" | ||
readOnly: true | ||
volumes: | ||
- name: hub-kubeconfig-secret | ||
secret: | ||
secretName: hub-kubeconfig-secret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
# Adds namespace to all resources. | ||
namespace: work | ||
|
||
resources: | ||
- ./component_namespace.yaml | ||
- ./service_account.yaml | ||
- ./clusterrole_binding.yaml | ||
- ./deployment.yaml | ||
|
||
images: | ||
- name: work-api-controller:latest | ||
newName: work-api-controller | ||
newTag: latest | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: work-controller-sa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
module sigs.k8s.io/work-api | ||
|
||
go 1.15 | ||
go 1.16 | ||
|
||
require ( | ||
github.com/go-logr/logr v0.3.0 | ||
github.com/onsi/ginkgo v1.14.1 | ||
github.com/onsi/gomega v1.10.2 | ||
k8s.io/api v0.20.4 | ||
k8s.io/apimachinery v0.20.4 | ||
k8s.io/client-go v0.20.4 | ||
sigs.k8s.io/controller-runtime v0.8.3 | ||
github.com/go-logr/logr v0.4.0 | ||
github.com/onsi/ginkgo v1.16.4 | ||
github.com/onsi/gomega v1.15.0 | ||
k8s.io/api v0.22.2 | ||
k8s.io/apimachinery v0.22.2 | ||
k8s.io/client-go v0.22.2 | ||
k8s.io/code-generator v0.22.2 | ||
sigs.k8s.io/controller-runtime v0.10.1 | ||
sigs.k8s.io/controller-tools v0.5.0 | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question, why do we require
GOPATH
? IMO, it can be run anywhere as we enabled Go module.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems *-gen requires GOPATH, otherwise it cannot found the correct path to generate code...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's weird. It works for me with Go module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the gopath is exported here https://github.com/karmada-io/karmada/blob/master/hack/update-codegen.sh#L13?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not quite sure :(
But that's not big deal. Let's move forward.