Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
feat: add execute command pod and update values (#38)
Browse files Browse the repository at this point in the history
- add `devstats-execute.yaml` to execute one-time command in the cluster.
- reduce grafanaNReplicas
- increase limitsCronsMemory
  • Loading branch information
Mini256 authored May 18, 2021
1 parent f6b4b22 commit 120a8eb
Show file tree
Hide file tree
Showing 8 changed files with 264 additions and 12 deletions.
116 changes: 116 additions & 0 deletions deployments/helms/dev/templates/devstats-execute.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{{- $executeTargetProject := .Values.executeTargetProject -}}
{{ if $executeTargetProject }}
{{- $root := . -}}
---
apiVersion: v1
kind: Pod
metadata:
name: '{{ $root.Values.executePodName }}-{{ $executeTargetProject }}'
labels:
name: devstats
type: 'execute'
proj: {{ $executeTargetProject }}
spec:
containers:
- command:
- {{ $root.Values.executeCommand }}
{{ if $root.Values.executeCommandArgs }}
args:
{{- with $root.Values.executeCommandArgs -}}
{{ toYaml . | nindent 6 }}
{{ end }}
{{ end }}
{{ if $root.Values.useExecuteResourcesLimits }}
resources:
requests:
memory: '{{ $root.Values.requestsExecuteMemory }}'
cpu: '{{ $root.Values.requestsExecuteCPU }}'
limits:
memory: '{{ $root.Values.limitsExecuteMemory }}'
cpu: '{{ $root.Values.limitsExecuteCPU }}'
{{ end }}
env:
- name: ONLY
value: {{ $executeTargetProject }}
- name: GHA2DB_PROPAGATE_ONLY_VAR
value: "1"
- name: GHA2DB_CHECK_PROVISION_FLAG
value: "1"
- name: GHA2DB_CHECK_RUNNING_FLAG
value: "1"
- name: GHA2DB_SET_RUNNING_FLAG
value: "1"
- name: GHA2DB_NCPUS
value: '{{ $root.Values.executeGha2dbCPUs }}'
- name: GHA2DB_DEBUG
value: "1"
- name: GHA2DB_CMDDEBUG
value: '{{ $root.Values.executeCmdDebug }}'
- name: GHA2DB_GITHUB_DEBUG
value: '{{ $root.Values.executeGithubDebug }}'
- name: GHA2DB_QOUT
value: '{{ $root.Values.queryOut }}'
- name: GHA2DB_REPOS_DIR
value: '{{ $root.Values.reposDir }}'
- name: GHA2DB_COMPANY_ACQ_YAML
value: '{{ $root.Values.companyAcq }}'
- name: GHA2DB_AFFILIATIONS_JSON
value: '{{ $root.Values.affiliations }}'
- name: GHA2DB_COMPUTE_ALL
value: '{{ $root.Values.executeForceComputeAll }}'
# Metrics config
- name: GHA2DB_RESETTSDB
value: '{{ $root.Values.executeResetTSDB }}'
- name: GHA2DB_SKIP_METRICS
value: '{{ $root.Values.executeSkipMetrics }}'
- name: GHA2DB_ONLY_METRICS
value: '{{ $root.Values.executeOnlyMetrics }}'
# Tags config
- name: GHA2DB_SKIP_TAGS
value: '{{ $root.Values.executeSkipTags }}'
# Vars config
- name: GHA2DB_ONLY_VARS
value: '{{ $root.Values.executeOnlyVars }}'
- name: GHA2DB_EXCLUDE_VARS
value: '{{ $root.Values.excludeVars }}'
- name: GHA2DB_FORCE_PERIODS
value: '{{ $root.Values.periods }}'
- name: GHA2DB_PROJECTS_YAML
value: {{ $root.Values.projectsFile }}
- name: GHA2DB_GITHUB_OAUTH
valueFrom:
secretKeyRef:
name: {{ $root.Values.oauthSecret }}
key: GHA2DB_GITHUB_OAUTH.secret
- name: PG_HOST
valueFrom:
secretKeyRef:
name: {{ $root.Values.pgSecret }}
key: PG_HOST.secret
- name: PG_PORT
valueFrom:
secretKeyRef:
name: {{ $root.Values.pgSecret }}
key: PG_PORT.secret
- name: PG_PASS
valueFrom:
secretKeyRef:
name: {{ $root.Values.pgSecret }}
key: PG_PASS.secret
image: {{ $root.Values.executeImage }}
imagePullPolicy: {{ $root.Values.imagePullPolicy }}
name: '{{ $root.Values.executePodName }}-{{ $executeTargetProject }}'
volumeMounts:
- name: '{{ $root.Values.volumeMountName }}-{{ $executeTargetProject }}'
mountPath: '{{ $root.Values.volumeMountPath }}'
volumes:
- name: '{{ $root.Values.volumeName }}-{{ $executeTargetProject }}'
persistentVolumeClaim:
claimName: '{{ $root.Values.pvName }}-{{ $executeTargetProject }}'
restartPolicy: {{ $root.Values.executeRestartPolicy }}
nodeSelector:
{{- with $root.Values.appNodeSelector -}}
{{ toYaml . | nindent 4 }}
{{ end }}
{{ end }}

2 changes: 1 addition & 1 deletion deployments/helms/dev/templates/devstats-hourly-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ spec:
- name: GHA2DB_SET_RUNNING_FLAG
value: "1"
- name: GHA2DB_NCPUS
value: '{{ $root.Values.nCPUs }}'
value: '{{ $root.Values.nSyncCPUs }}'
- name: GHA2DB_DEBUG
value: '{{ $root.Values.debug }}'
- name: GHA2DB_CMDDEBUG
Expand Down
2 changes: 1 addition & 1 deletion deployments/helms/dev/templates/devstats-provisions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ spec:
- name: GHA2DB_PROPAGATE_ONLY_VAR
value: "1"
- name: GHA2DB_NCPUS
value: '{{ $root.Values.nCPUs }}'
value: '{{ $root.Values.nSyncCPUs }}'
- name: GHA2DB_DEBUG
value: '{{ $root.Values.debug }}'
- name: GHA2DB_CMDDEBUG
Expand Down
25 changes: 22 additions & 3 deletions deployments/helms/dev/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ bootstrapNoCreate: ''
bootstrapPodName: devstats-provision-bootstrap
bootstrapRestartPolicy: Never
bootstrapUDrop: ''
concurrencyPolicy: Forbid
requestsBootstrapCPU: '200m'
requestsBootstrapMemory: '256Mi'
limitsBootstrapCPU: '2000m'
Expand Down Expand Up @@ -82,6 +81,7 @@ syncCommand: devstats
syncImage: 'miniantdev/devstats-minimal-dev:0.2.0'
syncPodName: devstats
syncRestartPolicy: Never
concurrencyPolicy: Forbid
indexCronsFrom: 0
indexCronsTo: 100
limitsCronsCPU: '6000m'
Expand All @@ -90,6 +90,25 @@ requestsCronsCPU: '1000m'
requestsCronsMemory: '2Gi'
useCronsResourcesLimits: 1

# Execute Pod configurations.
executeImage: 'miniantdev/devstats-minimal-dev:0.2.1.beta.1'
executePodName: 'devstats-execute'
executeTargetProject: 'tikv'
executeCommand: 'sleep'
executeCommandArgs:
- "3000"
# example:
# executeCommand: devstats
# executeResetTSDB: '1'
# executeOnlyMetrics: 'first_non_author_activity_company_group'
executeSkipMetrics: ''
executeRestartPolicy: Never
limitsExecuteCPU: '6000m'
limitsExecuteMemory: '32Gi'
requestsExecuteCPU: '1000m'
requestsExecuteMemory: '1Gi'
useExecuteResourcesLimits: 1

# Ingresses indexes.
indexIngressesFrom: 0
indexIngressesTo: 100
Expand All @@ -114,7 +133,7 @@ projects:
icon: 'pingcap'
org: 'PingCAP'
repo: 'pingcap/tidb'
cron: '20 * * * *'
cron: '05 * * * *'
disk: 50Gi
i: 0
- proj: tikv
Expand All @@ -130,6 +149,6 @@ projects:
icon: 'chaosmesh'
org: 'ChaosMesh'
repo: 'chaos-mesh/chaos-mesh'
cron: '40 * * * *'
cron: '50 * * * *'
disk: 50Gi
i: 2
116 changes: 116 additions & 0 deletions deployments/helms/prod/templates/devstats-execute.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{{- $executeTargetProject := .Values.executeTargetProject -}}
{{ if $executeTargetProject }}
{{- $root := . -}}
---
apiVersion: v1
kind: Pod
metadata:
name: '{{ $root.Values.executePodName }}-{{ $executeTargetProject }}'
labels:
name: devstats
type: 'execute'
proj: {{ $executeTargetProject }}
spec:
containers:
- command:
- {{ $root.Values.executeCommand }}
{{ if $root.Values.executeCommandArgs }}
args:
{{- with $root.Values.executeCommandArgs -}}
{{ toYaml . | nindent 6 }}
{{ end }}
{{ end }}
{{ if $root.Values.useExecuteResourcesLimits }}
resources:
requests:
memory: '{{ $root.Values.requestsExecuteMemory }}'
cpu: '{{ $root.Values.requestsExecuteCPU }}'
limits:
memory: '{{ $root.Values.limitsExecuteMemory }}'
cpu: '{{ $root.Values.limitsExecuteCPU }}'
{{ end }}
env:
- name: ONLY
value: {{ $executeTargetProject }}
- name: GHA2DB_PROPAGATE_ONLY_VAR
value: "1"
- name: GHA2DB_CHECK_PROVISION_FLAG
value: "1"
- name: GHA2DB_CHECK_RUNNING_FLAG
value: "1"
- name: GHA2DB_SET_RUNNING_FLAG
value: "1"
- name: GHA2DB_NCPUS
value: '{{ $root.Values.executeGha2dbCPUs }}'
- name: GHA2DB_DEBUG
value: "1"
- name: GHA2DB_CMDDEBUG
value: '{{ $root.Values.executeCmdDebug }}'
- name: GHA2DB_GITHUB_DEBUG
value: '{{ $root.Values.executeGithubDebug }}'
- name: GHA2DB_QOUT
value: '{{ $root.Values.queryOut }}'
- name: GHA2DB_REPOS_DIR
value: '{{ $root.Values.reposDir }}'
- name: GHA2DB_COMPANY_ACQ_YAML
value: '{{ $root.Values.companyAcq }}'
- name: GHA2DB_AFFILIATIONS_JSON
value: '{{ $root.Values.affiliations }}'
- name: GHA2DB_COMPUTE_ALL
value: '{{ $root.Values.executeForceComputeAll }}'
# Metrics config
- name: GHA2DB_RESETTSDB
value: '{{ $root.Values.executeResetTSDB }}'
- name: GHA2DB_SKIP_METRICS
value: '{{ $root.Values.executeSkipMetrics }}'
- name: GHA2DB_ONLY_METRICS
value: '{{ $root.Values.executeOnlyMetrics }}'
# Tags config
- name: GHA2DB_SKIP_TAGS
value: '{{ $root.Values.executeSkipTags }}'
# Vars config
- name: GHA2DB_ONLY_VARS
value: '{{ $root.Values.executeOnlyVars }}'
- name: GHA2DB_EXCLUDE_VARS
value: '{{ $root.Values.excludeVars }}'
- name: GHA2DB_FORCE_PERIODS
value: '{{ $root.Values.periods }}'
- name: GHA2DB_PROJECTS_YAML
value: {{ $root.Values.projectsFile }}
- name: GHA2DB_GITHUB_OAUTH
valueFrom:
secretKeyRef:
name: {{ $root.Values.oauthSecret }}
key: GHA2DB_GITHUB_OAUTH.secret
- name: PG_HOST
valueFrom:
secretKeyRef:
name: {{ $root.Values.pgSecret }}
key: PG_HOST.secret
- name: PG_PORT
valueFrom:
secretKeyRef:
name: {{ $root.Values.pgSecret }}
key: PG_PORT.secret
- name: PG_PASS
valueFrom:
secretKeyRef:
name: {{ $root.Values.pgSecret }}
key: PG_PASS.secret
image: {{ $root.Values.executeImage }}
imagePullPolicy: {{ $root.Values.imagePullPolicy }}
name: '{{ $root.Values.executePodName }}-{{ $executeTargetProject }}'
volumeMounts:
- name: '{{ $root.Values.volumeMountName }}-{{ $executeTargetProject }}'
mountPath: '{{ $root.Values.volumeMountPath }}'
volumes:
- name: '{{ $root.Values.volumeName }}-{{ $executeTargetProject }}'
persistentVolumeClaim:
claimName: '{{ $root.Values.pvName }}-{{ $executeTargetProject }}'
restartPolicy: {{ $root.Values.executeRestartPolicy }}
nodeSelector:
{{- with $root.Values.appNodeSelector -}}
{{ toYaml . | nindent 4 }}
{{ end }}
{{ end }}

2 changes: 1 addition & 1 deletion deployments/helms/prod/templates/devstats-hourly-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ spec:
- name: GHA2DB_SET_RUNNING_FLAG
value: "1"
- name: GHA2DB_NCPUS
value: '{{ $root.Values.nCPUs }}'
value: '{{ $root.Values.nSyncCPUs }}'
- name: GHA2DB_DEBUG
value: '{{ $root.Values.debug }}'
- name: GHA2DB_CMDDEBUG
Expand Down
2 changes: 1 addition & 1 deletion deployments/helms/prod/templates/devstats-provisions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ spec:
- name: GHA2DB_PROPAGATE_ONLY_VAR
value: "1"
- name: GHA2DB_NCPUS
value: '{{ $root.Values.nCPUs }}'
value: '{{ $root.Values.nSyncCPUs }}'
- name: GHA2DB_DEBUG
value: '{{ $root.Values.debug }}'
- name: GHA2DB_CMDDEBUG
Expand Down
11 changes: 6 additions & 5 deletions deployments/helms/prod/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ skipTemp: 1
volumeMountName: data
volumeMountPath: '/root'
volumeName: data
nSyncCPUs: 6

# Company configurations.
affiliations: 'github_users.json'
Expand All @@ -22,7 +23,6 @@ bootstrapNoCreate: ''
bootstrapPodName: devstats-provision-bootstrap
bootstrapRestartPolicy: Never
bootstrapUDrop: ''
concurrencyPolicy: Forbid
requestsBootstrapCPU: '200m'
requestsBootstrapMemory: '256Mi'
limitsBootstrapCPU: '2000m'
Expand All @@ -35,7 +35,7 @@ grafanaCommand: 'grafana_start.sh'
grafanaImage: 'miniantdev/devstats-grafana-prod:0.2.0'
grafanaMaxSurge: 1
grafanaMaxUnavailable: 1
grafanaNReplicas: 2
grafanaNReplicas: 1
grafanaPodName: devstats-grafana
grafanaPort: 3000
grafanaRestartPolicy: Always
Expand Down Expand Up @@ -82,10 +82,11 @@ syncCommand: devstats
syncImage: 'miniantdev/devstats-minimal-prod:0.2.0'
syncPodName: devstats
syncRestartPolicy: Never
concurrencyPolicy: Forbid
indexCronsFrom: 0
indexCronsTo: 100
limitsCronsCPU: '6000m'
limitsCronsMemory: '16Gi'
limitsCronsMemory: '32Gi'
requestsCronsCPU: '1000m'
requestsCronsMemory: '2Gi'
useCronsResourcesLimits: 1
Expand Down Expand Up @@ -114,7 +115,7 @@ projects:
icon: 'pingcap'
org: 'PingCAP'
repo: 'pingcap/tidb'
cron: '20 * * * *'
cron: '05 * * * *'
disk: 50Gi
i: 0
- proj: tikv
Expand All @@ -130,6 +131,6 @@ projects:
icon: 'chaosmesh'
org: 'ChaosMesh'
repo: 'chaos-mesh/chaos-mesh'
cron: '40 * * * *'
cron: '50 * * * *'
disk: 50Gi
i: 2

0 comments on commit 120a8eb

Please sign in to comment.