Skip to content

Commit

Permalink
Use kind in github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
wpjunior committed Dec 11, 2020
1 parent f540ebb commit 23297c6
Show file tree
Hide file tree
Showing 16 changed files with 229 additions and 207 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,32 @@ jobs:
go-version: 1.13.x
- run: make test

integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: engineerd/[email protected]
with:
version: "v0.9.0"
image: 'kindest/node:v1.17.11'
- uses: actions/setup-go@v1
with:
go-version: 1.13.x
- uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-goleak-${{ hashFiles('**/go.sum') }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-goleak-${{ hashFiles('**/go.sum') }}-
${{ runner.os }}-goleak-
- name: Run integration tests
env:
GOPATH: /tmp/go
run: |
./scripts/localkube-integration.sh
rpaas-api-docker-image:
name: "Publish rpaas-api image on dockerhub"
needs:
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,7 @@ KUSTOMIZE=$(GOBIN)/kustomize
else
KUSTOMIZE=$(shell which kustomize)
endif

build/plugin/rpaasv2:
@mkdir -p build/_output/bin/
go build -o build/_output/bin/rpaasv2 ./cmd/plugin/rpaasv2
32 changes: 32 additions & 0 deletions config/api/api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
labels:
name: rpaas-api
spec:
selector:
matchLabels:
name: rpaas-api
replicas: 1
template:
metadata:
labels:
name: rpaas-api
spec:
containers:
- command:
- rpaas-api
image: tsuru/rpaas-api:latest
name: rpaas-api
ports:
- name: api
containerPort: 9999
resources:
limits:
cpu: 100m
memory: 30Mi
requests:
cpu: 100m
memory: 20Mi
terminationGracePeriodSeconds: 10
3 changes: 3 additions & 0 deletions config/api/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resources:
- api.yaml
- service.yaml
14 changes: 14 additions & 0 deletions config/api/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: api
labels:
name: rpaas-api
spec:
ports:
- name: api
port: 9999
targetPort: 9999
selector:
name: rpaas-api
type: LoadBalancer
1 change: 1 addition & 0 deletions config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This kustomization.yaml is not intended to be run by itself,
# since it depends on service name and namespace that are out of this kustomize package.
# It should be run by config/default
namePrefix: operator-
resources:
- bases/extensions.tsuru.io_rpaasinstances.yaml
- bases/extensions.tsuru.io_rpaasplans.yaml
Expand Down
3 changes: 2 additions & 1 deletion config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace: rpaas-operator-system
# "wordpress" becomes "alices-wordpress".
# Note that it should also match with the prefix (text before '-') of the namespace
# field above.
namePrefix: rpaas-operator-
namePrefix: rpaas-

# Labels to add to all resources and selectors.
#commonLabels:
Expand All @@ -16,6 +16,7 @@ bases:
- ../crd
- ../rbac
- ../manager
- ../api
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
# crd/kustomization.yaml
#- ../webhook
Expand Down
1 change: 1 addition & 0 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
resources:
- manager.yaml
namePrefix: operator-
11 changes: 2 additions & 9 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
control-plane: controller-manager
name: system
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -24,10 +17,10 @@ spec:
spec:
containers:
- command:
- /manager
- rpaas-operator
args:
- --enable-leader-election
image: controller:latest
image: tsuru/rpaas-operator:latest
name: manager
resources:
limits:
Expand Down
1 change: 1 addition & 0 deletions config/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
namePrefix: operator-
resources:
- role.yaml
- role_binding.yaml
Expand Down
78 changes: 68 additions & 10 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,83 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: rpaas-operator
name: manager-role
rules:
- apiGroups:
- extensions.tsuru.io
- ""
resources:
- rpaasinstances
- pods
- services
- endpoints
- persistentvolumeclaims
- events
- configmaps
- secrets
verbs:
- '*'
- apiGroups:
- ""
resources:
- namespaces
verbs:
- get
- create
- delete
- apiGroups:
- apps
resources:
- deployments
- daemonsets
- replicasets
- statefulsets
verbs:
- '*'
- apiGroups:
- monitoring.coreos.com
resources:
- servicemonitors
verbs:
- get
- list
- patch
- update
- watch
- create
- apiGroups:
- extensions.tsuru.io
resources:
- rpaasinstances
- rpaasinstances/status
- rpaasinstances/scale
- rpaasplans
- rpaasflavors
- rpaasportallocations
verbs:
- '*'
- apiGroups:
- nginx.tsuru.io
resources:
- '*'
verbs:
- '*'
- apiGroups:
- autoscaling
resources:
- horizontalpodautoscalers
verbs:
- '*'
- apiGroups:
- batch
resources:
- jobs
- cronjobs
verbs:
- '*'
# NOTE: Pod exec is required by RPaaS API due to PR #83.
- apiGroups: [""]
resources:
- pods/exec
verbs:
- create
- apiGroups:
- metrics.k8s.io
resources:
- pods
verbs:
- list
- get
- patch
- update
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ require (
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.7.1
github.com/stretchr/testify v1.6.1
github.com/tsuru/nginx-operator v0.6.0
github.com/tsuru/nginx-operator v0.6.3
github.com/uber/jaeger-client-go v2.25.0+incompatible
github.com/uber/jaeger-lib v2.4.0+incompatible // indirect
github.com/urfave/cli/v2 v2.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -765,8 +765,8 @@ github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa h1:RC4maTWLK
github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa/go.mod h1:dSUh0FtTP8VhvkL1S+gUR1OKd9ZnSaozuI6r3m6wOig=
github.com/tsuru/config v0.0.0-20200717192526-2a9a0efe5f28 h1:ZUM5bc/TSos0Vvts+klLmPBGWPp/n/WfF3lhrmn8u5g=
github.com/tsuru/config v0.0.0-20200717192526-2a9a0efe5f28/go.mod h1:mj6t8JKWU51GScTT50XRmDj65T5XhTyNvO5FUNV5zS4=
github.com/tsuru/nginx-operator v0.6.0 h1:ksHY3CXmlJHfPjbXXS9EM2th/ABmX4KE/p/a0IHK22o=
github.com/tsuru/nginx-operator v0.6.0/go.mod h1:hOn1KtyfcYltDBeKKtzNhcfTiZa17VmBM9fmAE2n1Ek=
github.com/tsuru/nginx-operator v0.6.3 h1:S1Jo4C7649emvP975SihPa03Uyc/dLzQwM4nAlxkbH4=
github.com/tsuru/nginx-operator v0.6.3/go.mod h1:hOn1KtyfcYltDBeKKtzNhcfTiZa17VmBM9fmAE2n1Ek=
github.com/uber/jaeger-client-go v2.25.0+incompatible h1:IxcNZ7WRY1Y3G4poYlx24szfsn/3LvK9QHCq9oQw8+U=
github.com/uber/jaeger-client-go v2.25.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
github.com/uber/jaeger-lib v2.4.0+incompatible h1:fY7QsGQWiCt8pajv4r7JEvmATdCVaWxXbjwyYwsNaLQ=
Expand Down
Loading

0 comments on commit 23297c6

Please sign in to comment.