feat(kustomize): add github-webhook-server overlay (#1198)
* feat(kustomize): add github-webhook-server overlay * chore(kustomize): add image to github-webhook-server overlay * feat(kustomize): drop sync-period
This commit is contained in:
		
							parent
							
								
									ecc8b4472a
								
							
						
					
					
						commit
						a95983fb98
					
				|  | @ -668,7 +668,7 @@ The primary benefit of autoscaling on Webhook compared to the pull driven scalin | |||
| 
 | ||||
| > You can learn the implementation details in [#282](https://github.com/actions-runner-controller/actions-runner-controller/pull/282) | ||||
| 
 | ||||
| To enable this feature, you firstly need to install the webhook server, currently, only our Helm chart has the ability install it: | ||||
| To enable this feature, you first need to install the GitHub webhook server. To install via our Helm chart, | ||||
| _[see the values documentation for all configuration options](https://github.com/actions-runner-controller/actions-runner-controller/blob/master/charts/actions-runner-controller/README.md)_ | ||||
| 
 | ||||
| ```console | ||||
|  |  | |||
|  | @ -0,0 +1,23 @@ | |||
| # This patch injects an HTTP proxy sidecar container that performs RBAC | ||||
| # authorization against the Kubernetes API using SubjectAccessReviews. | ||||
| apiVersion: apps/v1 | ||||
| kind: Deployment | ||||
| metadata: | ||||
|   name: github-webhook-server | ||||
| spec: | ||||
|   template: | ||||
|     spec: | ||||
|       containers: | ||||
|         - name: kube-rbac-proxy | ||||
|           image: quay.io/brancz/kube-rbac-proxy:v0.10.0 | ||||
|           args: | ||||
|             - '--secure-listen-address=0.0.0.0:8443' | ||||
|             - '--upstream=http://127.0.0.1:8080/' | ||||
|             - '--logtostderr=true' | ||||
|             - '--v=10' | ||||
|           ports: | ||||
|             - containerPort: 8443 | ||||
|               name: https | ||||
|         - name: github-webhook-server | ||||
|           args: | ||||
|             - '--metrics-addr=127.0.0.1:8080' | ||||
|  | @ -22,17 +22,20 @@ bases: | |||
| - ../certmanager | ||||
| # [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'. | ||||
| #- ../prometheus | ||||
| # [GH_WEBHOOK_SERVER] To enable the GitHub webhook server, uncomment all sections with 'GH_WEBHOOK_SERVER'. | ||||
| #- ../github-webhook-server | ||||
| 
 | ||||
| patchesStrategicMerge: | ||||
|   # Protect the /metrics endpoint by putting it behind auth. | ||||
|   # Only one of manager_auth_proxy_patch.yaml and | ||||
|   # manager_prometheus_metrics_patch.yaml should be enabled. | ||||
| # Protect the /metrics endpoint by putting it behind auth. | ||||
| # Only one of manager_auth_proxy_patch.yaml and | ||||
| # manager_prometheus_metrics_patch.yaml should be enabled. | ||||
| - manager_auth_proxy_patch.yaml | ||||
|   # If you want your controller-manager to expose the /metrics | ||||
|   # endpoint w/o any authn/z, uncomment the following line and | ||||
|   # comment manager_auth_proxy_patch.yaml. | ||||
|   # Only one of manager_auth_proxy_patch.yaml and | ||||
|   # manager_prometheus_metrics_patch.yaml should be enabled. | ||||
| 
 | ||||
| # If you want your controller-manager to expose the /metrics | ||||
| # endpoint w/o any authn/z, uncomment the following line and | ||||
| # comment manager_auth_proxy_patch.yaml. | ||||
| # Only one of manager_auth_proxy_patch.yaml and | ||||
| # manager_prometheus_metrics_patch.yaml should be enabled. | ||||
| #- manager_prometheus_metrics_patch.yaml | ||||
| 
 | ||||
| # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in crd/kustomization.yaml | ||||
|  | @ -43,6 +46,10 @@ patchesStrategicMerge: | |||
| # 'CERTMANAGER' needs to be enabled to use ca injection | ||||
| - webhookcainjection_patch.yaml | ||||
| 
 | ||||
| # [GH_WEBHOOK_SERVER] To enable the GitHub webhook server, uncomment all sections with 'GH_WEBHOOK_SERVER'. | ||||
| # Protect the GitHub webhook server metrics endpoint by putting it behind auth. | ||||
| # - gh-webhook-server-auth-proxy-patch.yaml | ||||
| 
 | ||||
| # the following config is for teaching kustomize how to do var substitution | ||||
| vars: | ||||
| # [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix. | ||||
|  |  | |||
|  | @ -23,4 +23,3 @@ spec: | |||
|         args: | ||||
|         - "--metrics-addr=127.0.0.1:8080" | ||||
|         - "--enable-leader-election" | ||||
|         - "--sync-period=10m" | ||||
|  |  | |||
|  | @ -0,0 +1,37 @@ | |||
| apiVersion: apps/v1 | ||||
| kind: Deployment | ||||
| metadata: | ||||
|   labels: | ||||
|     app.kubernetes.io/component: github-webhook-server | ||||
|     app.kubernetes.io/part-of: actions-runner-controller | ||||
|   name: github-webhook-server | ||||
| spec: | ||||
|   replicas: 1 | ||||
|   selector: | ||||
|     matchLabels: | ||||
|       app.kubernetes.io/component: github-webhook-server | ||||
|       app.kubernetes.io/part-of: actions-runner-controller | ||||
|   template: | ||||
|     metadata: | ||||
|       labels: | ||||
|         app.kubernetes.io/component: github-webhook-server | ||||
|         app.kubernetes.io/part-of: actions-runner-controller | ||||
|     spec: | ||||
|       containers: | ||||
|         - name: github-webhook-server | ||||
|           image: controller:latest | ||||
|           command: | ||||
|             - '/github-webhook-server' | ||||
|           env: | ||||
|             - name: GITHUB_WEBHOOK_SECRET_TOKEN | ||||
|               valueFrom: | ||||
|                 secretKeyRef: | ||||
|                   key: github_webhook_secret_token | ||||
|                   name: github-webhook-server | ||||
|                   optional: true | ||||
|           ports: | ||||
|             - containerPort: 8000 | ||||
|               name: http | ||||
|               protocol: TCP | ||||
|       serviceAccountName: github-webhook-server | ||||
|       terminationGracePeriodSeconds: 10 | ||||
|  | @ -0,0 +1,12 @@ | |||
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||||
| kind: Kustomization | ||||
| 
 | ||||
| images: | ||||
|   - name: controller | ||||
|     newName: summerwind/actions-runner-controller | ||||
|     newTag: latest | ||||
| 
 | ||||
| resources: | ||||
|   - deployment.yaml | ||||
|   - rbac.yaml | ||||
|   - service.yaml | ||||
|  | @ -0,0 +1,113 @@ | |||
| apiVersion: v1 | ||||
| kind: ServiceAccount | ||||
| metadata: | ||||
|   labels: | ||||
|     app.kubernetes.io/component: github-webhook-server | ||||
|     app.kubernetes.io/part-of: actions-runner-controller | ||||
|   name: github-webhook-server | ||||
| --- | ||||
| apiVersion: rbac.authorization.k8s.io/v1 | ||||
| kind: ClusterRole | ||||
| metadata: | ||||
|   labels: | ||||
|     app.kubernetes.io/component: github-webhook-server | ||||
|     app.kubernetes.io/part-of: actions-runner-controller | ||||
|   name: github-webhook-server | ||||
| rules: | ||||
|   - apiGroups: | ||||
|       - actions.summerwind.dev | ||||
|     resources: | ||||
|       - horizontalrunnerautoscalers | ||||
|     verbs: | ||||
|       - get | ||||
|       - list | ||||
|       - patch | ||||
|       - update | ||||
|       - watch | ||||
|   - apiGroups: | ||||
|       - actions.summerwind.dev | ||||
|     resources: | ||||
|       - horizontalrunnerautoscalers/finalizers | ||||
|     verbs: | ||||
|       - create | ||||
|       - delete | ||||
|       - get | ||||
|       - list | ||||
|       - patch | ||||
|       - update | ||||
|       - watch | ||||
|   - apiGroups: | ||||
|       - actions.summerwind.dev | ||||
|     resources: | ||||
|       - horizontalrunnerautoscalers/status | ||||
|     verbs: | ||||
|       - get | ||||
|       - patch | ||||
|       - update | ||||
|   - apiGroups: | ||||
|       - actions.summerwind.dev | ||||
|     resources: | ||||
|       - runnersets | ||||
|     verbs: | ||||
|       - get | ||||
|       - list | ||||
|       - watch | ||||
|   - apiGroups: | ||||
|       - actions.summerwind.dev | ||||
|     resources: | ||||
|       - runnerdeployments | ||||
|     verbs: | ||||
|       - create | ||||
|       - delete | ||||
|       - get | ||||
|       - list | ||||
|       - patch | ||||
|       - update | ||||
|       - watch | ||||
|   - apiGroups: | ||||
|       - actions.summerwind.dev | ||||
|     resources: | ||||
|       - runnerdeployments/finalizers | ||||
|     verbs: | ||||
|       - create | ||||
|       - delete | ||||
|       - get | ||||
|       - list | ||||
|       - patch | ||||
|       - update | ||||
|       - watch | ||||
|   - apiGroups: | ||||
|       - actions.summerwind.dev | ||||
|     resources: | ||||
|       - runnerdeployments/status | ||||
|     verbs: | ||||
|       - get | ||||
|       - patch | ||||
|       - update | ||||
|   - apiGroups: | ||||
|       - authentication.k8s.io | ||||
|     resources: | ||||
|       - tokenreviews | ||||
|     verbs: | ||||
|       - create | ||||
|   - apiGroups: | ||||
|       - authorization.k8s.io | ||||
|     resources: | ||||
|       - subjectaccessreviews | ||||
|     verbs: | ||||
|       - create | ||||
| --- | ||||
| apiVersion: rbac.authorization.k8s.io/v1 | ||||
| kind: ClusterRoleBinding | ||||
| metadata: | ||||
|   labels: | ||||
|     app.kubernetes.io/component: github-webhook-server | ||||
|     app.kubernetes.io/part-of: actions-runner-controller | ||||
|   name: github-webhook-server | ||||
| roleRef: | ||||
|   apiGroup: rbac.authorization.k8s.io | ||||
|   kind: ClusterRole | ||||
|   name: github-webhook-server | ||||
| subjects: | ||||
|   - kind: ServiceAccount | ||||
|     name: github-webhook-server | ||||
|  | @ -0,0 +1,16 @@ | |||
| apiVersion: v1 | ||||
| kind: Service | ||||
| metadata: | ||||
|   labels: | ||||
|     app.kubernetes.io/component: github-webhook-server | ||||
|     app.kubernetes.io/part-of: actions-runner-controller | ||||
|   name: github-webhook-server | ||||
| spec: | ||||
|   ports: | ||||
|     - port: 80 | ||||
|       targetPort: http | ||||
|       protocol: TCP | ||||
|       name: http | ||||
|   selector: | ||||
|     app.kubernetes.io/component: github-webhook-server | ||||
|     app.kubernetes.io/part-of: actions-runner-controller | ||||
		Loading…
	
		Reference in New Issue