Allow custom graceful termination and loadBalancerSourceRanges for the githubwebhook service (#2305)
Co-authored-by: Dimitar Hristov <dimitar.hristov@skyscanner.net>
This commit is contained in:
		
							parent
							
								
									678eafcd67
								
							
						
					
					
						commit
						7d0918b6d5
					
				|  | @ -39,7 +39,8 @@ RUN --mount=target=. \ | ||||||
|   go build -trimpath -ldflags="-s -w -X 'github.com/actions/actions-runner-controller/build.Version=${VERSION}'" -o /out/manager main.go && \ |   go build -trimpath -ldflags="-s -w -X 'github.com/actions/actions-runner-controller/build.Version=${VERSION}'" -o /out/manager main.go && \ | ||||||
|   go build -trimpath -ldflags="-s -w" -o /out/github-runnerscaleset-listener ./cmd/githubrunnerscalesetlistener && \ |   go build -trimpath -ldflags="-s -w" -o /out/github-runnerscaleset-listener ./cmd/githubrunnerscalesetlistener && \ | ||||||
|   go build -trimpath -ldflags="-s -w" -o /out/github-webhook-server ./cmd/githubwebhookserver && \ |   go build -trimpath -ldflags="-s -w" -o /out/github-webhook-server ./cmd/githubwebhookserver && \ | ||||||
|   go build -trimpath -ldflags="-s -w" -o /out/actions-metrics-server ./cmd/actionsmetricsserver |   go build -trimpath -ldflags="-s -w" -o /out/actions-metrics-server ./cmd/actionsmetricsserver && \ | ||||||
|  |   go build -trimpath -ldflags="-s -w" -o /out/sleep ./cmd/sleep | ||||||
| 
 | 
 | ||||||
| # Use distroless as minimal base image to package the manager binary | # Use distroless as minimal base image to package the manager binary | ||||||
| # Refer to https://github.com/GoogleContainerTools/distroless for more details | # Refer to https://github.com/GoogleContainerTools/distroless for more details | ||||||
|  | @ -51,6 +52,7 @@ COPY --from=builder /out/manager . | ||||||
| COPY --from=builder /out/github-webhook-server . | COPY --from=builder /out/github-webhook-server . | ||||||
| COPY --from=builder /out/actions-metrics-server . | COPY --from=builder /out/actions-metrics-server . | ||||||
| COPY --from=builder /out/github-runnerscaleset-listener . | COPY --from=builder /out/github-runnerscaleset-listener . | ||||||
|  | COPY --from=builder /out/sleep . | ||||||
| 
 | 
 | ||||||
| USER 65532:65532 | USER 65532:65532 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -56,6 +56,12 @@ spec: | ||||||
|         {{- end }} |         {{- end }} | ||||||
|         command: |         command: | ||||||
|         - "/github-webhook-server" |         - "/github-webhook-server" | ||||||
|  |         {{- if .Values.githubWebhookServer.lifecycle }} | ||||||
|  |         {{- with .Values.githubWebhookServer.lifecycle }} | ||||||
|  |         lifecycle: | ||||||
|  |           {{- toYaml . | nindent 10 }} | ||||||
|  |         {{- end }} | ||||||
|  |         {{- end }} | ||||||
|         env: |         env: | ||||||
|         - name: GITHUB_WEBHOOK_SECRET_TOKEN |         - name: GITHUB_WEBHOOK_SECRET_TOKEN | ||||||
|           valueFrom: |           valueFrom: | ||||||
|  | @ -148,7 +154,7 @@ spec: | ||||||
|         securityContext: |         securityContext: | ||||||
|           {{- toYaml .Values.securityContext | nindent 12 }} |           {{- toYaml .Values.securityContext | nindent 12 }} | ||||||
|       {{- end }} |       {{- end }} | ||||||
|       terminationGracePeriodSeconds: 10 |       terminationGracePeriodSeconds: {{ .Values.githubWebhookServer.terminationGracePeriodSeconds }} | ||||||
|       {{- with .Values.githubWebhookServer.nodeSelector }} |       {{- with .Values.githubWebhookServer.nodeSelector }} | ||||||
|       nodeSelector: |       nodeSelector: | ||||||
|         {{- toYaml . | nindent 8 }} |         {{- toYaml . | nindent 8 }} | ||||||
|  |  | ||||||
|  | @ -23,4 +23,10 @@ spec: | ||||||
|     {{- end }} |     {{- end }} | ||||||
|   selector: |   selector: | ||||||
|     {{- include "actions-runner-controller-github-webhook-server.selectorLabels" . | nindent 4 }} |     {{- include "actions-runner-controller-github-webhook-server.selectorLabels" . | nindent 4 }} | ||||||
|  |   {{- if .Values.githubWebhookServer.service.loadBalancerSourceRanges }} | ||||||
|  |   loadBalancerSourceRanges: | ||||||
|  |     {{- range $ip := .Values.githubWebhookServer.service.loadBalancerSourceRanges }} | ||||||
|  |     - {{ $ip -}} | ||||||
|  |     {{- end }} | ||||||
|  |   {{- end }} | ||||||
| {{- end }} | {{- end }} | ||||||
|  |  | ||||||
|  | @ -240,6 +240,7 @@ githubWebhookServer: | ||||||
|         protocol: TCP |         protocol: TCP | ||||||
|         name: http |         name: http | ||||||
|         #nodePort: someFixedPortForUseWithTerraformCdkCfnEtc |         #nodePort: someFixedPortForUseWithTerraformCdkCfnEtc | ||||||
|  |     loadBalancerSourceRanges: [] | ||||||
|   ingress: |   ingress: | ||||||
|     enabled: false |     enabled: false | ||||||
|     ingressClassName: "" |     ingressClassName: "" | ||||||
|  | @ -276,6 +277,8 @@ githubWebhookServer: | ||||||
|     # minAvailable: 1 |     # minAvailable: 1 | ||||||
|     # maxUnavailable: 3 |     # maxUnavailable: 3 | ||||||
|   # queueLimit: 100 |   # queueLimit: 100 | ||||||
|  |   terminationGracePeriodSeconds: 10 | ||||||
|  |   lifecycle: {} | ||||||
| 
 | 
 | ||||||
| actionsMetrics: | actionsMetrics: | ||||||
|   serviceAnnotations: {} |   serviceAnnotations: {} | ||||||
|  |  | ||||||
|  | @ -0,0 +1,33 @@ | ||||||
|  | /* | ||||||
|  | Copyright 2021 The actions-runner-controller authors. | ||||||
|  | Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
|  | you may not use this file except in compliance with the License. | ||||||
|  | You may obtain a copy of the License at | ||||||
|  |     http://www.apache.org/licenses/LICENSE-2.0
 | ||||||
|  | Unless required by applicable law or agreed to in writing, software | ||||||
|  | distributed under the License is distributed on an "AS IS" BASIS, | ||||||
|  | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||
|  | See the License for the specific language governing permissions and | ||||||
|  | limitations under the License. | ||||||
|  | */ | ||||||
|  | 
 | ||||||
|  | package main | ||||||
|  | 
 | ||||||
|  | import ( | ||||||
|  | 	"flag" | ||||||
|  | 	"fmt" | ||||||
|  | 	"time" | ||||||
|  | ) | ||||||
|  | 
 | ||||||
|  | var Seconds int | ||||||
|  | 
 | ||||||
|  | func main() { | ||||||
|  | 	fmt.Printf("sleeping for %d seconds\n", Seconds) | ||||||
|  | 	time.Sleep(time.Duration(Seconds) * time.Second) | ||||||
|  | 	fmt.Println("done sleeping") | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func init() { | ||||||
|  | 	flag.IntVar(&Seconds, "seconds", 60, "Number of seconds to sleep") | ||||||
|  | 	flag.Parse() | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue