-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgitlab-runner.yaml
110 lines (108 loc) · 2.54 KB
/
gitlab-runner.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
apiVersion: v1
kind: ServiceAccount
metadata:
name: gitlab-service-account-sa
namespace: gitlab-ci
labels:
app: native-app
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: gitlab-service-account-cr
namespace: gitlab-ci
labels:
app: native-app
rules:
- apiGroups:
- ''
- apps
- autoscaling
- batch
resources:
- services
- pods
- pods/log
- pods/exec
- pods/attach
- namespaces
- daemonsets
- deployments
- replicasets
- statefulsets
- horizontalpodautoscalers
- cronjobs
- jobs
- secrets
verbs:
- create
- watch
- get
- list
- update
- patch
- delete
- deletecollection
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: gitlab-service-account-rbcr
namespace: gitlab-ci
roleRef:
kind: ClusterRole
name: gitlab-service-account-cr
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: gitlab-service-account-sa
namespace: gitlab-ci
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: runner-0
namespace: gitlab-ci
spec:
selector:
matchLabels:
name: runner-pod-0
template:
metadata:
namespace: gitlab-ci
labels:
name: runner-pod-0
spec:
serviceAccount: gitlab-service-account-sa
serviceAccountName: gitlab-service-account-sa
containers:
- name: pod
image: alpinelinux/gitlab-runner:latest
resources:
limits:
memory: "512Mi"
cpu: "500m"
requests:
memory: "256Mi"
cpu: "250m"
command:
- "/bin/sh"
- "-c"
- |
gitlab-runner register \
--kubernetes-privileged=true \
--non-interactive \
--run-untagged=false \
--executor kubernetes \
--kubernetes-pull-policy always \
--request-concurrency 10 \
--name 'My Runner' \
--kubernetes-image alpine:latest \
--kubernetes-image-pull-secrets registry-credentials \
--kubernetes-namespace gitlab-ci \
--kubernetes-service-account gitlab-service-account-sa \
--tag-list kubernetes \
--url "https://gitlab.com/" \
--registration-token "<your-registration-token-runner>"
cat /etc/gitlab-runner/config.toml
gitlab-runner run