-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add readreplica-rotate build scripts
- Loading branch information
Showing
9 changed files
with
416 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# | ||
# Copyright (C) 2019-2023 vdaas.org vald team <[email protected]> | ||
# | ||
# 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 | ||
# | ||
# https://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. | ||
# | ||
name: "Build docker image: readreplica-rotate" | ||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- "*.*.*" | ||
- "v*.*.*" | ||
- "*.*.*-*" | ||
- "v*.*.*-*" | ||
paths: | ||
- ".github/actions/docker-build/actions.yaml" | ||
- ".github/workflows/dockers-readreplica-rotate.yml" | ||
- "go.mod" | ||
- "go.sum" | ||
- "internal/**" | ||
- "!internal/**/*_test.go" | ||
- "!internal/db/**" | ||
- "!internal/k8s/**" | ||
- "apis/grpc/**" | ||
- "pkg/index/job/readreplica/rotate/**" | ||
- "cmd/index/job/readreplica/rotate/**" | ||
- "dockers/index/job/readreplica/rotate/Dockerfile" | ||
- "versions/GO_VERSION" | ||
pull_request: | ||
paths: | ||
- ".github/actions/docker-build/actions.yaml" | ||
- ".github/workflows/_docker-image.yaml" | ||
- ".github/workflows/dockers-readreplica-rotate.yml" | ||
- "go.mod" | ||
- "go.sum" | ||
- "internal/**" | ||
- "!internal/**/*_test.go" | ||
- "!internal/db/**" | ||
- "!internal/k8s/**" | ||
- "apis/grpc/**" | ||
- "pkg/index/job/readreplica/rotate/**" | ||
- "cmd/index/job/readreplica/rotate/**" | ||
- "dockers/index/job/readreplica/rotate/Dockerfile" | ||
- "versions/GO_VERSION" | ||
pull_request_target: | ||
paths: | ||
- ".github/actions/docker-build/actions.yaml" | ||
- ".github/workflows/_docker-image.yaml" | ||
- ".github/workflows/dockers-readreplica-rotate.yml" | ||
- "go.mod" | ||
- "go.sum" | ||
- "internal/**" | ||
- "!internal/**/*_test.go" | ||
- "!internal/db/**" | ||
- "!internal/k8s/**" | ||
- "apis/grpc/**" | ||
- "pkg/index/job/readreplica/rotate/**" | ||
- "cmd/index/job/readreplica/rotate/**" | ||
- "dockers/index/job/readreplica/rotate/Dockerfile" | ||
- "versions/GO_VERSION" | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/_docker-image.yaml | ||
with: | ||
target: readreplica-rotate | ||
secrets: inherit |
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
52 changes: 52 additions & 0 deletions
52
charts/vald/templates/index/job/readreplica/rotate/configmap.yaml
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,52 @@ | ||
# | ||
# Copyright (C) 2019-2023 vdaas.org vald team <[email protected]> | ||
# | ||
# 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 | ||
# | ||
# https://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. | ||
# | ||
{{- $rotator := .Values.manager.index.readreplica.rotator -}} | ||
{{- $gateway := .Values.gateway.lb -}} | ||
{{- $index := .Values.manager.index -}} | ||
{{- $agent := .Values.agent -}} | ||
{{- $discoverer := .Values.discoverer -}} | ||
{{- if $rotator.enabled }} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ $rotator.name }}-config | ||
labels: | ||
app.kubernetes.io/name: {{ include "vald.name" . }} | ||
helm.sh/chart: {{ include "vald.chart" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/version: {{ .Chart.Version }} | ||
app.kubernetes.io/component: {{ $rotator.name }} | ||
data: | ||
config.yaml: | | ||
--- | ||
version: {{ $rotator.version }} | ||
time_zone: {{ default .Values.defaults.time_zone $rotator.time_zone }} | ||
logging: | ||
{{- $logging := dict "Values" $rotator.logging "default" .Values.defaults.logging }} | ||
{{- include "vald.logging" $logging | nindent 6 }} | ||
server_config: | ||
{{- $servers := dict "Values" $rotator.server_config "default" .Values.defaults.server_config }} | ||
{{- include "vald.servers" $servers | nindent 6 }} | ||
observability: | ||
{{- $observability := dict "Values" $rotator.observability "default" .Values.defaults.observability }} | ||
{{- include "vald.observability" $observability | nindent 6 }} | ||
rotator: | ||
agent_namespace: {{ $rotator.agent_namespace | quote }} | ||
read_replica_label_key: "vald-readreplica-id" | ||
read_replica_id: "_MY_TARGET_REPLICA_ID_" | ||
volume_name: "vald-agent-ngt-readreplica-pvc" | ||
{{- end }} |
78 changes: 78 additions & 0 deletions
78
charts/vald/templates/index/job/readreplica/rotate/cronjob.yaml
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,78 @@ | ||
# | ||
# Copyright (C) 2019-2023 vdaas.org vald team <[email protected]> | ||
# | ||
# 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 | ||
# | ||
# https://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. | ||
# | ||
{{- $rotator := .Values.manager.index.readreplica.rotator -}} | ||
{{- if $rotator.enabled }} | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: {{ $rotator.name }} | ||
labels: | ||
app: {{ $rotator.name }} | ||
app.kubernetes.io/name: {{ include "vald.name" . }} | ||
helm.sh/chart: {{ include "vald.chart" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/version: {{ .Chart.Version }} | ||
spec: | ||
schedule: "0 0 31 2 *" # This never happens as February never has 31 days so we can prevent this cronjob from running automatically | ||
concurrencyPolicy: Forbid | ||
suspend: true # This cronjob should only be run manually by index manager | ||
startingDeadlineSeconds: 0 # To prevent being blocked in any case | ||
jobTemplate: | ||
spec: | ||
ttlSecondsAfterFinished: {{ $rotator.ttlSecondsAfterFinished }} | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ $rotator.name }} | ||
app.kubernetes.io/name: {{ include "vald.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/component: {{ $rotator.name }} | ||
annotations: | ||
{{- $pprof := default .Values.defaults.server_config.metrics.pprof $rotator.server_config.metrics.pprof -}} | ||
{{- if $pprof.enabled }} | ||
pyroscope.io/scrape: "true" | ||
pyroscope.io/application-name: {{ $rotator.name }} | ||
pyroscope.io/profile-cpu-enabled: "true" | ||
pyroscope.io/profile-mem-enabled: "true" | ||
pyroscope.io/port: {{ $pprof.port | quote }} | ||
{{- end }} | ||
spec: | ||
{{- if $rotator.initContainers }} | ||
initContainers: | ||
{{- $initContainers := dict "initContainers" $rotator.initContainers "Values" .Values "namespace" .Release.Namespace -}} | ||
{{- include "vald.initContainers" $initContainers | trim | nindent 12 }} | ||
{{- end }} | ||
containers: | ||
- name: {{ $rotator.name }} | ||
image: "{{ $rotator.image.repository }}:{{ default .Values.defaults.image.tag $rotator.image.tag }}" | ||
imagePullPolicy: {{ $rotator.image.pullPolicy }} | ||
volumeMounts: | ||
- name: {{ $rotator.name }}-config | ||
mountPath: /etc/server/ | ||
{{- $servers := dict "Values" $rotator.server_config "default" .Values.defaults.server_config -}} | ||
{{- include "vald.containerPorts" $servers | trim | nindent 14 }} | ||
{{- if $rotator.env }} | ||
env: | ||
{{- toYaml $rotator.env | nindent 16 }} | ||
{{- end }} | ||
restartPolicy: OnFailure | ||
volumes: | ||
- name: {{ $rotator.name }}-config | ||
configMap: | ||
defaultMode: 420 | ||
name: {{ $rotator.name }}-config | ||
{{- end }} |
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
Oops, something went wrong.