generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
675 additions
and
109 deletions.
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.