@leverege/build-tools 2.89.2 → 2.90.0-quinn.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/leverege-build-tools-2.21.13.tgz +0 -0
- package/lib/server/build-tools.js +138 -0
- package/lib/server/firebaseDeploy.js +195 -0
- package/lib/server/firebaseServe.js +116 -0
- package/lib/server/getfbcfg.js +25 -0
- package/lib/server/getjson.js +70 -0
- package/lib/server/overwhelm.js +447 -0
- package/lib/server/push-my-chart.js +18 -0
- package/lib/server/refresh-npm-token.js +135 -0
- package/lib/server/tag-release.js +681 -0
- package/lib/server/unleash.js +50 -0
- package/lib/web/build-tools.js +138 -0
- package/lib/web/firebaseDeploy.js +195 -0
- package/lib/web/firebaseServe.js +116 -0
- package/lib/web/getfbcfg.js +25 -0
- package/lib/web/getjson.js +70 -0
- package/lib/web/overwhelm.js +447 -0
- package/lib/web/push-my-chart.js +18 -0
- package/lib/web/refresh-npm-token.js +135 -0
- package/lib/web/tag-release.js +681 -0
- package/lib/web/unleash.js +50 -0
- package/package.json +12 -10
- package/src/prepack.mjs +74 -0
- package/src/init-my-chart/Chart.yaml +0 -5
- package/src/init-my-chart/templates/NOTES.txt +0 -5
- package/src/init-my-chart/templates/_helpers.tpl +0 -135
- package/src/init-my-chart/templates/configmap.yaml +0 -10
- package/src/init-my-chart/templates/deployment.yaml +0 -125
- package/src/init-my-chart/templates/hpa.yaml +0 -26
- package/src/init-my-chart/templates/ingressroute.yaml +0 -18
- package/src/init-my-chart/templates/pdb.yaml +0 -22
- package/src/init-my-chart/templates/service.yaml +0 -15
- package/src/init-my-chart/templates/serviceaccount.yaml +0 -13
- package/src/init-my-chart/templates/servicemonitor.yaml +0 -23
- package/src/init-my-chart/values.yaml +0 -152
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _execa = _interopRequireDefault(require("execa"));
|
|
5
|
+
var _simpleGit = _interopRequireDefault(require("simple-git"));
|
|
6
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
7
|
+
const git = new _simpleGit.default();
|
|
8
|
+
const getCurrentBranchName = async () => {
|
|
9
|
+
const branchInfo = await git.branch();
|
|
10
|
+
|
|
11
|
+
// first check to see if there are no branches - new repo?
|
|
12
|
+
if (Object.keys(branchInfo.branches).length === 0) {
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
15
|
+
return Object.entries(branchInfo.branches).find(([name, info]) => info.current)[0];
|
|
16
|
+
};
|
|
17
|
+
const isProtected = async () => {
|
|
18
|
+
const theBranch = await getCurrentBranchName();
|
|
19
|
+
const protectedBranches = ['main', 'master', 'development'];
|
|
20
|
+
const additionalProtectedBranches = [...process.argv.slice(2)];
|
|
21
|
+
|
|
22
|
+
// Check if the current branch starts with any of the additional
|
|
23
|
+
// protected branch name
|
|
24
|
+
let matchesAdditionalBranch = false;
|
|
25
|
+
for (let i = 0; i < additionalProtectedBranches.length; i++) {
|
|
26
|
+
matchesAdditionalBranch = matchesAdditionalBranch || theBranch.startsWith(additionalProtectedBranches[i]);
|
|
27
|
+
}
|
|
28
|
+
return protectedBranches.includes(theBranch) || matchesAdditionalBranch;
|
|
29
|
+
};
|
|
30
|
+
const npmRunner = async script => {
|
|
31
|
+
try {
|
|
32
|
+
const results = await (0, _execa.default)('npm', ['run', script], {
|
|
33
|
+
stdio: 'inherit'
|
|
34
|
+
});
|
|
35
|
+
return results;
|
|
36
|
+
} catch (err) {
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
return undefined;
|
|
40
|
+
};
|
|
41
|
+
(async () => {
|
|
42
|
+
if (await isProtected()) {
|
|
43
|
+
const script = ['test', 'lint'];
|
|
44
|
+
for (let i = 0; i < script.length; i++) {
|
|
45
|
+
await npmRunner(script[i]); // eslint-disable-line no-await-in-loop
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
process.exit(0);
|
|
49
|
+
}
|
|
50
|
+
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.90.0-quinn.2",
|
|
4
4
|
"description": "A collection of build / support tools for Leverege developers",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -11,23 +11,25 @@
|
|
|
11
11
|
"clean": "rm -rf lib",
|
|
12
12
|
"lint": "find ./src -name \\*.\\*js | xargs npx eslint --report-unused-disable-directives",
|
|
13
13
|
"prepare": "[ $SKIP_PREPARE ] && exit 0 || ./src/hook-and-release.mjs",
|
|
14
|
-
"test": "echo \"no tests specified\" && exit 0"
|
|
14
|
+
"test": "echo \"no tests specified\" && exit 0",
|
|
15
|
+
"prepack": "npm exec prepack"
|
|
15
16
|
},
|
|
16
17
|
"bin": {
|
|
17
|
-
"build-tools": "src/build-tools.mjs",
|
|
18
18
|
"build-and-push": "src/build-and-push.sh",
|
|
19
19
|
"build-cnpg-image": "src/build-cnpg-image.mjs",
|
|
20
|
+
"build-tools": "src/build-tools.mjs",
|
|
20
21
|
"chart-to-museum": "src/chart-to-museum.mjs",
|
|
21
22
|
"chart-to-registry": "src/chart-to-registry.mjs",
|
|
23
|
+
"prepack": "src/prepack.mjs",
|
|
22
24
|
"circleate": "src/circleate.sh",
|
|
23
25
|
"clone-cnpg-from-snapshot": "src/clone-cnpg-from-snapshot.mjs",
|
|
24
26
|
"count-lines-of-code": "src/count-lines-of-code.mjs",
|
|
25
27
|
"decrypt-secrets": "src/decrypt-secrets.sh",
|
|
26
28
|
"dirty-git": "src/dirty-git.sh",
|
|
27
|
-
"dockreate": "src/dockreate.sh",
|
|
28
|
-
"docker-to-registry": "src/docker-to-registry.mjs",
|
|
29
29
|
"docker-to-registry-py": "src/docker-to-registry-py.mjs",
|
|
30
30
|
"docker-to-registry.sh": "src/docker-to-registry.sh",
|
|
31
|
+
"docker-to-registry": "src/docker-to-registry.mjs",
|
|
32
|
+
"dockreate": "src/dockreate.sh",
|
|
31
33
|
"encrypt-secrets": "src/encrypt-secrets.sh",
|
|
32
34
|
"firebaseDeploy": "src/firebaseDeploy.mjs",
|
|
33
35
|
"firebaseServe": "src/firebaseServe.mjs",
|
|
@@ -38,8 +40,8 @@
|
|
|
38
40
|
"helm-audit": "src/helm-audit.mjs",
|
|
39
41
|
"helmcycle": "src/helmup.sh",
|
|
40
42
|
"helmdn": "src/helmdn.sh",
|
|
41
|
-
"helmup": "src/helmup.sh",
|
|
42
43
|
"helminit": "src/helmup.sh",
|
|
44
|
+
"helmup": "src/helmup.sh",
|
|
43
45
|
"helmwhat": "src/helmup.sh",
|
|
44
46
|
"hook-and-release": "src/hook-and-release.mjs",
|
|
45
47
|
"init-my-chart": "src/init-my-chart.mjs",
|
|
@@ -76,18 +78,18 @@
|
|
|
76
78
|
"glob": "^11.0.3",
|
|
77
79
|
"handlebars": "^4.7.8",
|
|
78
80
|
"ignore": "^7.0.5",
|
|
79
|
-
"inquirer": "^12.
|
|
80
|
-
"js-yaml": "^4.1.
|
|
81
|
+
"inquirer": "^12.11.1",
|
|
82
|
+
"js-yaml": "^4.1.1",
|
|
81
83
|
"jsdoc": "^4.0.5",
|
|
82
84
|
"ms": "^2.1.3",
|
|
83
|
-
"npm-registry-fetch": "^19.
|
|
85
|
+
"npm-registry-fetch": "^19.1.0",
|
|
84
86
|
"ora": "^9.0.0",
|
|
85
87
|
"p-limit": "^7.2.0",
|
|
86
88
|
"package-up": "^5.0.0",
|
|
87
89
|
"readline-sync": "^1.4.10",
|
|
88
90
|
"semver": "^7.7.3",
|
|
89
91
|
"shell-quote": "^1.8.3",
|
|
90
|
-
"simple-git": "^3.
|
|
92
|
+
"simple-git": "^3.30.0",
|
|
91
93
|
"sloc": "^0.3.2",
|
|
92
94
|
"toml": "^3.0.0",
|
|
93
95
|
"zx": "^8.8.5"
|
package/src/prepack.mjs
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable no-console */
|
|
3
|
+
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
|
|
6
|
+
import { parse as semverParse } from 'semver'
|
|
7
|
+
import { $, fs, minimist, chalk } from 'zx'
|
|
8
|
+
|
|
9
|
+
process.env.FORCE_COLOR = '1'
|
|
10
|
+
|
|
11
|
+
console.log( process.env.npm_config_workspace, process.env.npm_config_workspaces )
|
|
12
|
+
|
|
13
|
+
const { compile, 'manual-tag' : manualTag } = minimist( process.argv.slice( 2 ), {
|
|
14
|
+
default : {
|
|
15
|
+
compile : true,
|
|
16
|
+
'manual-tag' : false
|
|
17
|
+
},
|
|
18
|
+
boolean : [ 'compile', 'manual-tag' ]
|
|
19
|
+
} )
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
await $`git diff --exit-code --quiet`
|
|
23
|
+
} catch ( err ) {
|
|
24
|
+
console.log( chalk.redBright( 'Your git index is not clean. Stage and/or commit all changes before attempting to publish a version to npm.' ) )
|
|
25
|
+
process.exit( err.exitCode )
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const isYarn = ( await fs.exists( path.join( process.cwd(), 'yarn.lock' ) ) ) || ( await fs.exists( path.join( process.cwd(), '.yarn' ) ) )
|
|
29
|
+
const packageJson = await fs.readJSON( path.join( process.cwd(), 'package.json' ) )
|
|
30
|
+
|
|
31
|
+
if ( compile && packageJson.scripts?.compile != null ) {
|
|
32
|
+
try {
|
|
33
|
+
await compileCmd( { isYarn } )
|
|
34
|
+
} catch ( error ) {
|
|
35
|
+
process.stderr.write( chalk.redBright( 'Compile command failed with error:\n' ) )
|
|
36
|
+
process.stderr.write( error.text() )
|
|
37
|
+
process.exit( error.exitCode )
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const name = packageJson.name.replace( /^@leverege\//, '' )
|
|
42
|
+
const version = packageJson.version
|
|
43
|
+
const semanticVersion = semverParse( version )
|
|
44
|
+
const isPrerelease = semanticVersion.prerelease.length > 0
|
|
45
|
+
|
|
46
|
+
if ( !isPrerelease ) {
|
|
47
|
+
const tagName = `${name}/v${semanticVersion.version}`
|
|
48
|
+
const cmd = [ 'git', 'tag', '-a', tagName ]
|
|
49
|
+
if ( !manualTag ) {
|
|
50
|
+
cmd.push( '-m', `"NPM version ${tagName}"` )
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
await $( {
|
|
55
|
+
quiet : true
|
|
56
|
+
} )`${cmd}`
|
|
57
|
+
} catch ( error ) {
|
|
58
|
+
process.stderr.write( chalk.redBright( 'Failed to create git tag with error:\n' ) )
|
|
59
|
+
process.stderr.write( error.text() )
|
|
60
|
+
process.exit( error.exitCode )
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function compileCmd( { isYarn } ) {
|
|
65
|
+
if ( isYarn ) {
|
|
66
|
+
return $( {
|
|
67
|
+
quiet : true
|
|
68
|
+
} )`yarn compile`
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return $( {
|
|
72
|
+
quiet : true
|
|
73
|
+
} )`npm run compile`
|
|
74
|
+
}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
{{/*
|
|
2
|
-
Expand the name of the chart.
|
|
3
|
-
*/}}
|
|
4
|
-
{{- define "leverege.name" -}}
|
|
5
|
-
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
|
6
|
-
{{- end }}
|
|
7
|
-
|
|
8
|
-
{{/*
|
|
9
|
-
Create a default fully qualified app name.
|
|
10
|
-
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
|
11
|
-
If release name contains chart name it will be used as a full name.
|
|
12
|
-
*/}}
|
|
13
|
-
{{- define "leverege.fullname" -}}
|
|
14
|
-
{{- if .Values.fullnameOverride }}
|
|
15
|
-
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
|
16
|
-
{{- else }}
|
|
17
|
-
{{- $name := default .Chart.Name .Values.nameOverride }}
|
|
18
|
-
{{- if contains $name .Release.Name }}
|
|
19
|
-
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
|
20
|
-
{{- else }}
|
|
21
|
-
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
|
22
|
-
{{- end }}
|
|
23
|
-
{{- end }}
|
|
24
|
-
{{- end }}
|
|
25
|
-
|
|
26
|
-
{{/*
|
|
27
|
-
Create chart name and version as used by the chart label.
|
|
28
|
-
*/}}
|
|
29
|
-
{{- define "leverege.chart" -}}
|
|
30
|
-
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
|
31
|
-
{{- end }}
|
|
32
|
-
|
|
33
|
-
{{/*
|
|
34
|
-
Common labels
|
|
35
|
-
*/}}
|
|
36
|
-
{{- define "leverege.labels" -}}
|
|
37
|
-
helm.sh/chart: {{ include "leverege.chart" . }}
|
|
38
|
-
{{ include "leverege.selectorLabels" . }}
|
|
39
|
-
{{- if .Chart.AppVersion }}
|
|
40
|
-
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
|
41
|
-
{{- end }}
|
|
42
|
-
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
43
|
-
{{- if .Values.partOf }}
|
|
44
|
-
app.kubernetes.io/part-of: {{ .Values.partOf }}
|
|
45
|
-
{{- end }}
|
|
46
|
-
{{- end }}
|
|
47
|
-
|
|
48
|
-
{{/*
|
|
49
|
-
Selector labels
|
|
50
|
-
*/}}
|
|
51
|
-
{{- define "leverege.selectorLabels" -}}
|
|
52
|
-
app.kubernetes.io/name: {{ include "leverege.name" . }}
|
|
53
|
-
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
54
|
-
{{- end }}
|
|
55
|
-
|
|
56
|
-
{{/*
|
|
57
|
-
Create the name of the service account to use
|
|
58
|
-
*/}}
|
|
59
|
-
{{- define "leverege.serviceAccountName" -}}
|
|
60
|
-
{{- if .Values.serviceAccount.create }}
|
|
61
|
-
{{- default (include "leverege.fullname" .) .Values.serviceAccount.name }}
|
|
62
|
-
{{- else }}
|
|
63
|
-
{{- default "default" .Values.serviceAccount.name }}
|
|
64
|
-
{{- end }}
|
|
65
|
-
{{- end }}
|
|
66
|
-
|
|
67
|
-
{{/*
|
|
68
|
-
Define reusable container ports configuration for deployments.
|
|
69
|
-
*/}}
|
|
70
|
-
{{- define "leverege.deploymentPorts" -}}
|
|
71
|
-
- name: http
|
|
72
|
-
containerPort: {{ .Values.config.HTTP_SERVER_PORT }}
|
|
73
|
-
protocol: TCP
|
|
74
|
-
- name: node-metrics
|
|
75
|
-
containerPort: {{ .Values.config.METRICS_PORT }}
|
|
76
|
-
protocol: TCP
|
|
77
|
-
{{- end }}
|
|
78
|
-
|
|
79
|
-
{{/*
|
|
80
|
-
Define reusable service ports configuration for services.
|
|
81
|
-
*/}}
|
|
82
|
-
{{- define "leverege.servicePorts" -}}
|
|
83
|
-
- name: http
|
|
84
|
-
port: {{ .Values.config.HTTP_SERVER_PORT }}
|
|
85
|
-
targetPort: http
|
|
86
|
-
protocol: TCP
|
|
87
|
-
- name: node-metrics
|
|
88
|
-
port: {{ .Values.config.METRICS_PORT }}
|
|
89
|
-
targetPort: node-metrics
|
|
90
|
-
protocol: TCP
|
|
91
|
-
{{- end }}
|
|
92
|
-
|
|
93
|
-
{{/*
|
|
94
|
-
Define reusable service monitors for the prometheus operator.
|
|
95
|
-
*/}}
|
|
96
|
-
{{- define "leverege.serviceMonitorEndpoints" -}}
|
|
97
|
-
- port: node-metrics
|
|
98
|
-
interval: {{ default "60s" .Values.serviceMonitor.interval }}
|
|
99
|
-
honorLabels: true # prom-operator config setting
|
|
100
|
-
relabelings:
|
|
101
|
-
- action: labelmap
|
|
102
|
-
regex: __meta_kubernetes_pod_label_(.+)
|
|
103
|
-
- action: labelmap
|
|
104
|
-
regex: __meta_kubernetes_service_label_(.+)
|
|
105
|
-
{{- end }}
|
|
106
|
-
|
|
107
|
-
{{/*
|
|
108
|
-
Reusable initContainers block, currently supports modelInit pattern.
|
|
109
|
-
*/}}
|
|
110
|
-
{{- define "leverege.initContainers" -}}
|
|
111
|
-
{{- if .Values.modelInit.enabled }}
|
|
112
|
-
- name: {{ .Values.modelInit.name | default "fetch-models" }}
|
|
113
|
-
image: {{ .Values.modelInit.image }}
|
|
114
|
-
securityContext:
|
|
115
|
-
runAsUser: {{ .Values.modelInit.runAsUser }}
|
|
116
|
-
runAsGroup: {{ .Values.modelInit.runAsGroup }}
|
|
117
|
-
command: ["/bin/bash", "-c"]
|
|
118
|
-
args:
|
|
119
|
-
{{- if .Values.modelInit.args }}
|
|
120
|
-
{{- toYaml .Values.modelInit.args | nindent 4 }}
|
|
121
|
-
{{- else }}
|
|
122
|
-
- >-
|
|
123
|
-
exec > /proc/1/fd/1 2>&1; set -ex;
|
|
124
|
-
{{- range $name, $uri := .Values.modelInit.sources }}
|
|
125
|
-
echo "Syncing {{$name}} from {{$uri}}...";
|
|
126
|
-
mkdir -p {{ $.Values.modelInit.targetDir }}/{{$name}};
|
|
127
|
-
gsutil -m rsync -r {{$uri}} {{ $.Values.modelInit.targetDir }}/{{$name}};
|
|
128
|
-
{{- end }}
|
|
129
|
-
{{- end }}
|
|
130
|
-
volumeMounts:
|
|
131
|
-
- name: model-volume
|
|
132
|
-
mountPath: {{ .Values.modelInit.targetDir }}
|
|
133
|
-
{{- end }}
|
|
134
|
-
{{- end }}
|
|
135
|
-
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
apiVersion: apps/v1
|
|
2
|
-
kind: Deployment
|
|
3
|
-
metadata:
|
|
4
|
-
name: {{ include "leverege.fullname" . }}
|
|
5
|
-
labels:
|
|
6
|
-
{{- include "leverege.labels" . | nindent 4 }}
|
|
7
|
-
app: {{ include "leverege.fullname" . }}
|
|
8
|
-
redis-client: {{ .Values.redis.enabled | quote }}
|
|
9
|
-
spec:
|
|
10
|
-
replicas: {{ default 1 .Values.staticscaling.replicas }}
|
|
11
|
-
selector:
|
|
12
|
-
matchLabels:
|
|
13
|
-
{{- include "leverege.selectorLabels" . | nindent 6 }}
|
|
14
|
-
template:
|
|
15
|
-
metadata:
|
|
16
|
-
labels:
|
|
17
|
-
{{- include "leverege.selectorLabels" . | nindent 8 }}
|
|
18
|
-
app: {{ include "leverege.fullname" . }}
|
|
19
|
-
redis-client: {{ .Values.redis.enabled | quote }}
|
|
20
|
-
annotations:
|
|
21
|
-
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
|
22
|
-
prometheus.io/port: '{{ default "5111" .Values.config.METRICS_PORT }}'
|
|
23
|
-
prometheus.io/scrape: "true"
|
|
24
|
-
configmap.reloader.stakater.com/reload: "default-configs"
|
|
25
|
-
{{- if .Values.service.preemptible }}
|
|
26
|
-
cluster-autoscaler.kubernetes.io/safe-to-evict: "true"
|
|
27
|
-
{{- end }}
|
|
28
|
-
spec:
|
|
29
|
-
serviceAccountName: {{ include "leverege.fullname" . }}
|
|
30
|
-
volumes:
|
|
31
|
-
- name: tmpfs
|
|
32
|
-
emptyDir: {}
|
|
33
|
-
{{- if .Values.workloadIdentity.disabled }}
|
|
34
|
-
- name: google-cloud-key
|
|
35
|
-
secret:
|
|
36
|
-
secretName: {{ .Chart.Name }}-sa-key
|
|
37
|
-
{{- end }}
|
|
38
|
-
affinity:
|
|
39
|
-
podAntiAffinity:
|
|
40
|
-
preferredDuringSchedulingIgnoredDuringExecution:
|
|
41
|
-
- weight: 100
|
|
42
|
-
podAffinityTerm:
|
|
43
|
-
labelSelector:
|
|
44
|
-
matchExpressions:
|
|
45
|
-
- key: app.kubernetes.io/name
|
|
46
|
-
operator: In
|
|
47
|
-
values:
|
|
48
|
-
- {{ include "leverege.fullname" . }}
|
|
49
|
-
topologyKey: "kubernetes.io/hostname"
|
|
50
|
-
{{- if .Values.service.preemptible }}
|
|
51
|
-
nodeAffinity:
|
|
52
|
-
requiredDuringSchedulingIgnoredDuringExecution:
|
|
53
|
-
nodeSelectorTerms:
|
|
54
|
-
- matchExpressions:
|
|
55
|
-
- key: target-env
|
|
56
|
-
operator: In
|
|
57
|
-
values:
|
|
58
|
-
- preemptible
|
|
59
|
-
tolerations:
|
|
60
|
-
- key: "preemptible"
|
|
61
|
-
operator: "Equal"
|
|
62
|
-
value: "true"
|
|
63
|
-
effect: "NoSchedule"
|
|
64
|
-
{{- end }}
|
|
65
|
-
{{- if .Values.modelInit.enabled }}
|
|
66
|
-
initContainers:
|
|
67
|
-
- name: {{ default "fetch-models" .Values.modelInit.name }}
|
|
68
|
-
image: {{ .Values.modelInit.image }}
|
|
69
|
-
securityContext:
|
|
70
|
-
runAsUser: {{ .Values.modelInit.runAsUser }}
|
|
71
|
-
runAsGroup: {{ .Values.modelInit.runAsGroup }}
|
|
72
|
-
command: ["/bin/sh","-c"]
|
|
73
|
-
args:
|
|
74
|
-
{{- if .Values.modelInit.args }}
|
|
75
|
-
{{- toYaml .Values.modelInit.args | nindent 6 }}
|
|
76
|
-
{{- else }}
|
|
77
|
-
- |
|
|
78
|
-
exec > /proc/1/fd/1 2>&1 # Send both stdout and stderr to container's stdout
|
|
79
|
-
set -ex
|
|
80
|
-
{{- range $name, $uri := .Values.modelInit.sources }}
|
|
81
|
-
echo "Syncing {{$name}} from {{$uri}}..."
|
|
82
|
-
mkdir -p {{ $.Values.modelInit.targetDir }}/{{$name}}
|
|
83
|
-
gsutil -m rsync -r {{$uri}} {{ $.Values.modelInit.targetDir }}/{{$name}}
|
|
84
|
-
{{- end }}
|
|
85
|
-
{{- end }}
|
|
86
|
-
volumeMounts:
|
|
87
|
-
- name: model-volume
|
|
88
|
-
mountPath: {{ .Values.modelInit.targetDir }}
|
|
89
|
-
{{- end }}
|
|
90
|
-
containers:
|
|
91
|
-
- name: {{ include "leverege.fullname" . }}
|
|
92
|
-
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
93
|
-
image: {{ .Values.image.registry }}/{{ .Chart.Name }}:{{ default .Chart.AppVersion .Values.image.tag }}
|
|
94
|
-
securityContext:
|
|
95
|
-
readOnlyRootFilesystem: {{ .Values.securityContext.readOnlyRootFs }}
|
|
96
|
-
runAsNonRoot: true
|
|
97
|
-
runAsUser: 1000
|
|
98
|
-
allowPrivilegeEscalation: false
|
|
99
|
-
{{ if .Values.probes.enabled }}
|
|
100
|
-
livenessProbe:
|
|
101
|
-
{{- toYaml .Values.probes.livenessProbe | nindent 10 }}
|
|
102
|
-
readinessProbe:
|
|
103
|
-
{{- toYaml .Values.probes.readinessProbe | nindent 10 }}
|
|
104
|
-
{{- end }}
|
|
105
|
-
resources:
|
|
106
|
-
{{- toYaml .Values.resources | nindent 10 }}
|
|
107
|
-
ports:
|
|
108
|
-
{{- include "leverege.deploymentPorts" . | nindent 8 }}
|
|
109
|
-
volumeMounts:
|
|
110
|
-
- name: tmpfs
|
|
111
|
-
mountPath: "/tmp"
|
|
112
|
-
{{- if .Values.workloadIdentity.disabled }}
|
|
113
|
-
- name: google-cloud-key
|
|
114
|
-
mountPath: /var/secrets/google
|
|
115
|
-
{{- end }}
|
|
116
|
-
envFrom:
|
|
117
|
-
- configMapRef:
|
|
118
|
-
name: default-configs
|
|
119
|
-
- configMapRef:
|
|
120
|
-
name: {{ include "leverege.fullname" . }}-configs
|
|
121
|
-
env:
|
|
122
|
-
{{- if .Values.workloadIdentity.disabled }}
|
|
123
|
-
- name: GOOGLE_APPLICATION_CREDENTIALS
|
|
124
|
-
value: /var/secrets/google/key.json
|
|
125
|
-
{{- end }}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{{- if .Values.autoscaling.enabled }}
|
|
2
|
-
{{ if lt .Capabilities.KubeVersion.Minor "23" }}
|
|
3
|
-
apiVersion: autoscaling/v2beta2
|
|
4
|
-
{{ else }}
|
|
5
|
-
apiVersion: autoscaling/v2
|
|
6
|
-
{{ end }}
|
|
7
|
-
kind: HorizontalPodAutoscaler
|
|
8
|
-
metadata:
|
|
9
|
-
name: {{ include "leverege.fullname" . }}
|
|
10
|
-
labels:
|
|
11
|
-
{{- include "leverege.labels" . | nindent 4 }}
|
|
12
|
-
spec:
|
|
13
|
-
scaleTargetRef:
|
|
14
|
-
apiVersion: apps/v1
|
|
15
|
-
kind: Deployment
|
|
16
|
-
name: {{ include "leverege.fullname" . }}
|
|
17
|
-
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
|
18
|
-
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
|
19
|
-
metrics: # https://cloud.google.com/kubernetes-engine/docs/how-to/horizontal-pod-autoscaling#multiple-metrics
|
|
20
|
-
- type: Resource
|
|
21
|
-
resource:
|
|
22
|
-
name: cpu
|
|
23
|
-
target:
|
|
24
|
-
type: Utilization
|
|
25
|
-
averageUtilization: {{ .Values.autoscaling.averageCPU }}
|
|
26
|
-
{{- end }}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{{- if .Values.ingressRoute.host }}
|
|
2
|
-
{{- $fullName := include "leverege.fullname" . -}}
|
|
3
|
-
{{- $svcPort := .Values.config.HTTP_SERVER_PORT -}}
|
|
4
|
-
apiVersion: traefik.io/v1alpha1
|
|
5
|
-
kind: IngressRoute
|
|
6
|
-
metadata:
|
|
7
|
-
name: {{ $fullName }}
|
|
8
|
-
namespace: default
|
|
9
|
-
spec:
|
|
10
|
-
entryPoints:
|
|
11
|
-
- websecure
|
|
12
|
-
routes:
|
|
13
|
-
- match: Host(`{{ .Values.ingressRoute.host }}`)
|
|
14
|
-
kind: Rule
|
|
15
|
-
services:
|
|
16
|
-
- name: {{ $fullName }}
|
|
17
|
-
port: {{ $svcPort }}
|
|
18
|
-
{{- end }}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{{- if .Values.pdb.create }}
|
|
2
|
-
{{ if lt .Capabilities.KubeVersion.Minor "21" }}
|
|
3
|
-
apiVersion: policy/v1beta1
|
|
4
|
-
{{ else }}
|
|
5
|
-
apiVersion: policy/v1
|
|
6
|
-
{{ end }}
|
|
7
|
-
kind: PodDisruptionBudget
|
|
8
|
-
metadata:
|
|
9
|
-
name: {{ include "leverege.fullname" . }}
|
|
10
|
-
labels:
|
|
11
|
-
{{- include "leverege.labels" . | nindent 4 }}
|
|
12
|
-
spec:
|
|
13
|
-
{{- if .Values.pdb.minAvailable }}
|
|
14
|
-
minAvailable: {{ .Values.pdb.minAvailable }}
|
|
15
|
-
{{- end }}
|
|
16
|
-
{{- if .Values.pdb.maxUnavailable }}
|
|
17
|
-
maxUnavailable: {{ .Values.pdb.maxUnavailable }}
|
|
18
|
-
{{- end }}
|
|
19
|
-
selector:
|
|
20
|
-
matchLabels:
|
|
21
|
-
{{ include "leverege.selectorLabels" . | nindent 6 }}
|
|
22
|
-
{{- end }}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
apiVersion: v1
|
|
2
|
-
kind: Service
|
|
3
|
-
metadata:
|
|
4
|
-
name: {{ include "leverege.fullname" . }}
|
|
5
|
-
labels:
|
|
6
|
-
{{- include "leverege.labels" . | nindent 4 }}
|
|
7
|
-
spec:
|
|
8
|
-
type: {{ .Values.service.type }}
|
|
9
|
-
{{- if .Values.loadbalancer.ip }}
|
|
10
|
-
loadBalancerIP: {{ .Values.loadbalancer.ip }}
|
|
11
|
-
{{- end }}
|
|
12
|
-
ports:
|
|
13
|
-
{{- include "leverege.servicePorts" . | nindent 6 }}
|
|
14
|
-
selector:
|
|
15
|
-
{{- include "leverege.selectorLabels" . | nindent 4 }}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{{- if .Values.serviceAccount.create -}}
|
|
2
|
-
apiVersion: v1
|
|
3
|
-
kind: ServiceAccount
|
|
4
|
-
metadata:
|
|
5
|
-
name: {{ include "leverege.serviceAccountName" . }}
|
|
6
|
-
labels:
|
|
7
|
-
{{- include "leverege.labels" . | nindent 4 }}
|
|
8
|
-
annotations:
|
|
9
|
-
iam.gke.io/gcp-service-account: {{ .Chart.Name }}@{{ .Values.service.project_id }}.iam.gserviceaccount.com
|
|
10
|
-
{{- with .Values.serviceAccount.annotations }}
|
|
11
|
-
{{- toYaml . | nindent 4 }}
|
|
12
|
-
{{- end }}
|
|
13
|
-
{{- end }}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# plugs us into the prometheus operator
|
|
2
|
-
{{- if .Values.serviceMonitor.enabled }}
|
|
3
|
-
apiVersion: monitoring.coreos.com/v1
|
|
4
|
-
kind: ServiceMonitor
|
|
5
|
-
metadata:
|
|
6
|
-
{{- if .Values.partOf }}
|
|
7
|
-
name: {{ .Values.partOf }}-{{ include "leverege.fullname" . }}
|
|
8
|
-
{{ else }}
|
|
9
|
-
name: {{ include "leverege.fullname" . }}
|
|
10
|
-
{{- end }}
|
|
11
|
-
labels:
|
|
12
|
-
{{- include "leverege.labels" . | nindent 4 }}
|
|
13
|
-
namespace: prometheus
|
|
14
|
-
spec:
|
|
15
|
-
selector:
|
|
16
|
-
matchLabels:
|
|
17
|
-
{{ include "leverege.selectorLabels" . | nindent 6 }}
|
|
18
|
-
namespaceSelector:
|
|
19
|
-
matchNames:
|
|
20
|
-
- {{ default "default" .Values.serviceMonitor.namespace }}
|
|
21
|
-
endpoints:
|
|
22
|
-
{{- include "leverege.serviceMonitorEndpoints" . | nindent 4 }}
|
|
23
|
-
{{- end }}
|