@leverege/build-tools 2.8.12 → 2.8.13
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/lib/server/repo-init/config.tgz +0 -0
- package/package.json +5 -1
- package/src/anchor +41 -0
- package/src/dockreate +1 -1
- package/lib/server/service-man/Config.js +0 -45
- package/lib/server/service-man/ServiceMan.js +0 -42
- package/lib/server/service-man/index.js +0 -6
- package/lib/server/service-man/utils/Shell.js +0 -102
- package/lib/server/service-man/utils/VersionCheck.js +0 -82
- package/lib/server/service-man/utils/index.js +0 -67
- package/lib/web/service-man/Config.js +0 -45
- package/lib/web/service-man/ServiceMan.js +0 -42
- package/lib/web/service-man/index.js +0 -6
- package/lib/web/service-man/utils/Shell.js +0 -102
- package/lib/web/service-man/utils/VersionCheck.js +0 -82
- package/lib/web/service-man/utils/index.js +0 -67
- package/src/helm-starters/baseline/Chart.yaml +0 -4
- package/src/helm-starters/baseline/templates/NOTES.txt +0 -52
- package/src/helm-starters/baseline/templates/configmap.yaml +0 -6
- package/src/helm-starters/baseline/templates/deployment.yaml +0 -97
- package/src/helm-starters/baseline/templates/hpa.yaml +0 -12
- package/src/helm-starters/baseline/templates/ingress.yaml +0 -17
- package/src/helm-starters/baseline/templates/pdb.yaml +0 -9
- package/src/helm-starters/baseline/templates/service.yaml +0 -16
- package/src/helm-starters/baseline/templates/serviceaccount.yaml +0 -10
- package/src/helm-starters/baseline/values.yaml +0 -57
- package/src/helm-starters/deprecated/Chart.yaml +0 -4
- package/src/helm-starters/deprecated/templates/NOTES.txt +0 -52
- package/src/helm-starters/deprecated/templates/configmap.yaml +0 -11
- package/src/helm-starters/deprecated/templates/deployment.yaml +0 -103
- package/src/helm-starters/deprecated/templates/hpa.yaml +0 -12
- package/src/helm-starters/deprecated/templates/ingress.yaml +0 -17
- package/src/helm-starters/deprecated/templates/pdb.yaml +0 -9
- package/src/helm-starters/deprecated/templates/service.yaml +0 -13
- package/src/helm-starters/deprecated/templates/serviceaccount.yaml +0 -10
- package/src/helm-starters/deprecated/values.yaml +0 -44
- package/src/sa-tools/imp-sa +0 -26
- package/src/sa-tools/roles/baseline/leveregeBigQueryReader.json +0 -10
- package/src/sa-tools/roles/baseline/leveregeBigQueryWriter.json +0 -10
- package/src/sa-tools/roles/baseline/leveregeCloudFunctionsAdmin.json +0 -12
- package/src/sa-tools/roles/baseline/leveregeFirebaseUpdates.json +0 -8
- package/src/sa-tools/roles/baseline/leveregeLogsViewer.json +0 -8
- package/src/sa-tools/roles/baseline/leveregePubSub.json +0 -13
- package/src/sa-tools/roles/baseline/leveregeSecretsViewer.json +0 -8
- package/src/sa-tools/roles/baseline/leveregeStorageObjectAccess.json +0 -10
- package/src/sa-tools/roles/baseline/leveregeSvcAcctActor.json +0 -8
- package/src/sa-tools/roles/baseline/leveregeSvcAcctTokenCreator.json +0 -8
- package/src/sa-tools/roles/leverege-dev-john/20220113-121423/leveregeBigQueryReader.json +0 -10
- package/src/sa-tools/roles/leverege-dev-john/20220113-121423/leveregeBigQueryWriter.json +0 -10
- package/src/sa-tools/roles/leverege-dev-john/20220113-121423/leveregeCloudFunctionsAdmin.json +0 -12
- package/src/sa-tools/roles/leverege-dev-john/20220113-121423/leveregeFirebaseUpdates.json +0 -8
- package/src/sa-tools/roles/leverege-dev-john/20220113-121423/leveregeLogsViewer.json +0 -8
- package/src/sa-tools/roles/leverege-dev-john/20220113-121423/leveregePubSub.json +0 -13
- package/src/sa-tools/roles/leverege-dev-john/20220113-121423/leveregeSecretsViewer.json +0 -8
- package/src/sa-tools/roles/leverege-dev-john/20220113-121423/leveregeStorageObjectAccess.json +0 -10
- package/src/sa-tools/roles/leverege-dev-john/20220113-121423/leveregeSvcAcctActor.json +0 -8
- package/src/sa-tools/roles/leverege-dev-john/20220113-121423/leveregeSvcAcctTokenCreator.json +0 -8
- package/src/sa-tools/roles/prd-indoor-zoning/20220113-121935/leveregeBigQueryReader.json +0 -10
- package/src/sa-tools/roles/prd-indoor-zoning/20220113-121935/leveregeBigQueryWriter.json +0 -10
- package/src/sa-tools/roles/prd-indoor-zoning/20220113-121935/leveregeCloudFunctionsAdmin.json +0 -12
- package/src/sa-tools/roles/prd-indoor-zoning/20220113-121935/leveregeFirebaseUpdates.json +0 -8
- package/src/sa-tools/roles/prd-indoor-zoning/20220113-121935/leveregeLogsViewer.json +0 -8
- package/src/sa-tools/roles/prd-indoor-zoning/20220113-121935/leveregePubSub.json +0 -13
- package/src/sa-tools/roles/prd-indoor-zoning/20220113-121935/leveregeSecretsViewer.json +0 -8
- package/src/sa-tools/roles/prd-indoor-zoning/20220113-121935/leveregeStorageObjectAccess.json +0 -10
- package/src/sa-tools/roles/prd-indoor-zoning/20220113-121935/leveregeSvcAcctActor.json +0 -8
- package/src/sa-tools/roles/prd-indoor-zoning/20220113-121935/leveregeSvcAcctTokenCreator.json +0 -8
- package/src/sa-tools/roles-grab +0 -30
- package/src/sa-tools/roles-push +0 -19
- package/src/sa-tools/sh-make-sa +0 -58
- package/src/service-man/Config.js +0 -40
- package/src/service-man/ServiceMan.js +0 -32
- package/src/service-man/index.js +0 -5
- package/src/service-man/utils/Shell.js +0 -95
- package/src/service-man/utils/VersionCheck.js +0 -77
- package/src/service-man/utils/index.js +0 -54
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const inquirer = require('inquirer');
|
|
4
|
-
|
|
5
|
-
const Shell = require('./Shell');
|
|
6
|
-
|
|
7
|
-
const VersionCheck = require('./VersionCheck');
|
|
8
|
-
/**
|
|
9
|
-
* Clears the screen and optionally homes the cursor.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const clear = (home = true) => {
|
|
14
|
-
// console.log( ( home ? '\x1B[0f' : '' ) + '\x1B[2J' )
|
|
15
|
-
console.log(`${home ? '\x1B[0f' : ''}\x1B[2J`);
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* A simple object dumping convenience.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const condir = (log, thing) => {
|
|
23
|
-
console.dir({
|
|
24
|
-
log,
|
|
25
|
-
thing
|
|
26
|
-
}, {
|
|
27
|
-
depth: 8,
|
|
28
|
-
colors: true
|
|
29
|
-
}); // eslint-disable-line
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* General "yes" to proceed function.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const proceed = async (query = 'Do you wish to proceed?') => {
|
|
37
|
-
await inquirer.prompt([{
|
|
38
|
-
type: 'confirm',
|
|
39
|
-
name: 'proceed',
|
|
40
|
-
message: query,
|
|
41
|
-
default: true
|
|
42
|
-
}]).then(answer => {
|
|
43
|
-
if (!answer.proceed) {
|
|
44
|
-
process.exit(0);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* A simple mS sleeper.
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const sleep = (ms = 0) => {
|
|
54
|
-
return new Promise(resolve => {
|
|
55
|
-
setTimeout(resolve, ms);
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
module.exports = {
|
|
60
|
-
clear,
|
|
61
|
-
condir,
|
|
62
|
-
proceed,
|
|
63
|
-
sleep,
|
|
64
|
-
pause: sleep,
|
|
65
|
-
Shell,
|
|
66
|
-
VersionCheck
|
|
67
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
-------------------------------------------------------------------------------
|
|
2
|
-
|
|
3
|
-
Service: {{ .Chart.Name }}
|
|
4
|
-
|
|
5
|
-
This service relies on the presence of a Service Account (SA) to define its
|
|
6
|
-
permissions on the clusters that it is deployed to. Verify or create an SA
|
|
7
|
-
with the following name and IAM roles:
|
|
8
|
-
|
|
9
|
-
SA name => {{ .Chart.Name }}
|
|
10
|
-
IAM roles => pubsub.editor
|
|
11
|
-
secretmanager.secretAccessor
|
|
12
|
-
|
|
13
|
-
{{- if .Values.workloadIdentity.disabled }}
|
|
14
|
-
|
|
15
|
-
Workload Identity is disabled for this service, most likely because this is
|
|
16
|
-
running on a legacy cluster which does not support it. In order for this
|
|
17
|
-
service to function properly a set of JSON keys will need to be generated and
|
|
18
|
-
then stored as a secret using this syntax:
|
|
19
|
-
|
|
20
|
-
cat <keyfileName> | kubectl create secret generic {{ .Chart.Name }}-sa-key \
|
|
21
|
-
--from-file=key.json=/dev/stdin
|
|
22
|
-
|
|
23
|
-
{{- else }}
|
|
24
|
-
|
|
25
|
-
Workload identity is enabled for this service, therefore the SA must have the
|
|
26
|
-
proper IAM policy bound to it. This can be verified by running:
|
|
27
|
-
|
|
28
|
-
$ gcloud iam service-accounts get-iam-policy \
|
|
29
|
-
--project {{ .Values.service.project_id }} \
|
|
30
|
-
{{ .Chart.Name }}@{{ .Values.service.project_id }}.iam.gserviceaccount.com
|
|
31
|
-
|
|
32
|
-
which should return something resembling:
|
|
33
|
-
|
|
34
|
-
bindings:
|
|
35
|
-
- members:
|
|
36
|
-
- serviceAccount:{{ .Values.service.project_id }}.svc.id.goog[default/<service name>]
|
|
37
|
-
role: roles/iam.workloadIdentityUser
|
|
38
|
-
etag: <uuencoded tag>
|
|
39
|
-
version: 1
|
|
40
|
-
|
|
41
|
-
If the role of roles/iam.workloadIdentityUser does not appear on the SA then
|
|
42
|
-
run the following command to add it:
|
|
43
|
-
|
|
44
|
-
$ gcloud iam service-accounts add-iam-policy-binding \
|
|
45
|
-
--project {{ .Values.service.project_id }} \
|
|
46
|
-
--role roles/iam.workloadIdentityUser \
|
|
47
|
-
--member "serviceAccount:{{ .Values.service.project_id }}.svc.id.goog[default/{{ .Chart.Name }}]" \
|
|
48
|
-
{{ .Chart.Name }}@{{ .Values.service.project_id }}.iam.gserviceaccount.com
|
|
49
|
-
|
|
50
|
-
{{- end }}
|
|
51
|
-
|
|
52
|
-
-------------------------------------------------------------------------------
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
apiVersion: apps/v1
|
|
2
|
-
kind: Deployment
|
|
3
|
-
metadata:
|
|
4
|
-
name: {{ .Chart.Name }}
|
|
5
|
-
labels:
|
|
6
|
-
app: {{ .Chart.Name }}
|
|
7
|
-
chart/version: {{ .Values.image.tag }}
|
|
8
|
-
redis-client: {{ .Values.redis.enabled | quote }}
|
|
9
|
-
spec:
|
|
10
|
-
selector:
|
|
11
|
-
matchLabels:
|
|
12
|
-
app: {{ .Chart.Name }}
|
|
13
|
-
template:
|
|
14
|
-
metadata:
|
|
15
|
-
labels:
|
|
16
|
-
app: {{ .Chart.Name }}
|
|
17
|
-
chart/version: {{ .Chart.Version }}
|
|
18
|
-
chart/appVersion: {{ .Values.image.tag }}
|
|
19
|
-
redis-client: {{ .Values.redis.enabled | quote }}
|
|
20
|
-
annotations:
|
|
21
|
-
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
|
22
|
-
prometheus.io/port: "5111"
|
|
23
|
-
prometheus.io/scrape: "true"
|
|
24
|
-
configmap.reloader.stakater.com/reload: "default-configs"
|
|
25
|
-
spec:
|
|
26
|
-
serviceAccountName: {{ .Chart.Name }}
|
|
27
|
-
volumes:
|
|
28
|
-
- name: tmpfs
|
|
29
|
-
emptyDir: {}
|
|
30
|
-
{{- if .Values.workloadIdentity.disabled }}
|
|
31
|
-
- name: google-cloud-key
|
|
32
|
-
secret:
|
|
33
|
-
secretName: {{ .Chart.Name }}-sa-key
|
|
34
|
-
{{- end }}
|
|
35
|
-
{{- if .Values.service.preemptible }}
|
|
36
|
-
tolerations:
|
|
37
|
-
- key: "preemptible"
|
|
38
|
-
operator: "Equal"
|
|
39
|
-
value: "true"
|
|
40
|
-
effect: "NoSchedule"
|
|
41
|
-
affinity:
|
|
42
|
-
nodeAffinity:
|
|
43
|
-
preferredDuringSchedulingIgnoredDuringExecution:
|
|
44
|
-
- preference:
|
|
45
|
-
matchExpressions:
|
|
46
|
-
- key: cloud.google.com/gke-preemptible
|
|
47
|
-
operator: Exists
|
|
48
|
-
weight: 100
|
|
49
|
-
{{- end }}
|
|
50
|
-
containers:
|
|
51
|
-
- name: {{ .Chart.Name }}
|
|
52
|
-
imagePullPolicy: IfNotPresent
|
|
53
|
-
image: {{ .Values.image.registry }}/{{ .Chart.Name }}:{{ .Values.image.tag }}
|
|
54
|
-
securityContext:
|
|
55
|
-
readOnlyRootFilesystem: {{ .Values.securityContext.readOnlyRootFs }}
|
|
56
|
-
runAsNonRoot: true
|
|
57
|
-
runAsUser: 1000
|
|
58
|
-
allowPrivilegeEscalation: false
|
|
59
|
-
{{ if .Values.probes.enabled }}
|
|
60
|
-
readinessProbe:
|
|
61
|
-
httpGet:
|
|
62
|
-
path: /healthz
|
|
63
|
-
port: api
|
|
64
|
-
initialDelaySeconds: 30
|
|
65
|
-
livenessProbe:
|
|
66
|
-
httpGet:
|
|
67
|
-
path: /livenessProbe
|
|
68
|
-
port: api
|
|
69
|
-
initialDelaySeconds: 30
|
|
70
|
-
periodSeconds: 60
|
|
71
|
-
{{ end }}
|
|
72
|
-
resources:
|
|
73
|
-
limits:
|
|
74
|
-
cpu: "100m"
|
|
75
|
-
memory: "256Mi"
|
|
76
|
-
# requests:
|
|
77
|
-
# cpu: "100m"
|
|
78
|
-
# memory: "128Mi"
|
|
79
|
-
ports:
|
|
80
|
-
- name: api
|
|
81
|
-
containerPort: {{ .Values.service.port }}
|
|
82
|
-
protocol: TCP
|
|
83
|
-
- name: node-metrics
|
|
84
|
-
containerPort: 5111
|
|
85
|
-
volumeMounts:
|
|
86
|
-
- name: tmpfs
|
|
87
|
-
mountPath: "/tmp"
|
|
88
|
-
envFrom:
|
|
89
|
-
- configMapRef:
|
|
90
|
-
name: default-configs
|
|
91
|
-
- configMapRef:
|
|
92
|
-
name: {{ .Chart.Name }}-configs
|
|
93
|
-
env:
|
|
94
|
-
{{- if .Values.workloadIdentity.disabled }}
|
|
95
|
-
- name: GOOGLE_APPLICATION_CREDENTIALS
|
|
96
|
-
value: /var/secrets/google/key.json
|
|
97
|
-
{{- end }}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
apiVersion: autoscaling/v1
|
|
2
|
-
kind: HorizontalPodAutoscaler
|
|
3
|
-
metadata:
|
|
4
|
-
name: {{ .Chart.Name }}
|
|
5
|
-
spec:
|
|
6
|
-
scaleTargetRef:
|
|
7
|
-
apiVersion: apps/v1
|
|
8
|
-
kind: Deployment
|
|
9
|
-
name: {{ .Chart.Name }}
|
|
10
|
-
minReplicas: {{ .Values.horizontalScaler.minReplicas }}
|
|
11
|
-
maxReplicas: {{ .Values.horizontalScaler.maxReplicas }}
|
|
12
|
-
targetCPUUtilizationPercentage: {{ .Values.horizontalScaler.maxCPU }}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
apiVersion: networking.k8s.io/v1
|
|
2
|
-
kind: Ingress
|
|
3
|
-
metadata:
|
|
4
|
-
name: {{ .Chart.Name }}
|
|
5
|
-
labels:
|
|
6
|
-
app: {{ .Chart.Name }}
|
|
7
|
-
annotations:
|
|
8
|
-
# kubernetes.io/ingress.allow-http: "false"
|
|
9
|
-
kubernetes.io/ingress.global-static-ip-name: {{ .Chart.Name }}
|
|
10
|
-
spec:
|
|
11
|
-
tls:
|
|
12
|
-
- secretName: {{ .Values.ingress.secretName }}
|
|
13
|
-
defaultBackend:
|
|
14
|
-
service:
|
|
15
|
-
name: {{ .Chart.Name }}
|
|
16
|
-
port:
|
|
17
|
-
number: {{ .Values.service.port }}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
apiVersion: v1
|
|
2
|
-
kind: Service
|
|
3
|
-
metadata:
|
|
4
|
-
name: {{ .Chart.Name }}
|
|
5
|
-
spec:
|
|
6
|
-
type: NodePort
|
|
7
|
-
{{- if .Values.loadbalancer.ip }}
|
|
8
|
-
loadBalancerIP: {{ .Values.loadbalancer.ip }}
|
|
9
|
-
{{- end }}
|
|
10
|
-
selector:
|
|
11
|
-
app: {{ .Chart.Name }}
|
|
12
|
-
ports:
|
|
13
|
-
- name: {{ .Chart.Name }}
|
|
14
|
-
protocol: TCP
|
|
15
|
-
port: {{ .Values.service.port }}
|
|
16
|
-
targetPort: {{ .Values.service.port }}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
apiVersion: v1
|
|
2
|
-
kind: ServiceAccount
|
|
3
|
-
metadata:
|
|
4
|
-
annotations:
|
|
5
|
-
iam.gke.io/gcp-service-account: {{ .Chart.Name }}@{{ .Values.service.project_id }}.iam.gserviceaccount.com
|
|
6
|
-
name: {{ .Chart.Name }}
|
|
7
|
-
labels:
|
|
8
|
-
app: {{ .Chart.Name }}
|
|
9
|
-
chart/version: {{ .Chart.Version }}
|
|
10
|
-
chart/appVersion: {{ .Values.image.tag }}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
image:
|
|
2
|
-
tag: v0.1.0
|
|
3
|
-
registry: gcr.io/leverege-docker-images
|
|
4
|
-
|
|
5
|
-
# define all config values as quoted strings
|
|
6
|
-
config:
|
|
7
|
-
# server configs
|
|
8
|
-
LOG_CONFIG: '{"type":"pino","level":"warn"}'
|
|
9
|
-
|
|
10
|
-
# imagine configs
|
|
11
|
-
logExpressRequests: "false"
|
|
12
|
-
ALIAS_KEY: "needs-to-be-set"
|
|
13
|
-
BLUEPRINT_ID: "needs-to-be-set"
|
|
14
|
-
IMAGINE_URL: "http://api-server:8181"
|
|
15
|
-
INGESTION_TOPIC: "needs-to-be-set"
|
|
16
|
-
NETWORK_ID: "needs-to-be-set"
|
|
17
|
-
SYSTEM_ID: "needs-to-be-set"
|
|
18
|
-
|
|
19
|
-
# overwhelm will auto inject project_id, host and ingress into service
|
|
20
|
-
service:
|
|
21
|
-
port: 8383
|
|
22
|
-
preemptible: true
|
|
23
|
-
|
|
24
|
-
# can be used to set load balancer to registered static IP
|
|
25
|
-
loadbalancer:
|
|
26
|
-
ip: nil
|
|
27
|
-
|
|
28
|
-
# liveness and readiness probe to prove k8s health
|
|
29
|
-
probes:
|
|
30
|
-
enabled: true
|
|
31
|
-
|
|
32
|
-
# this tells calico that redis access is needed
|
|
33
|
-
redis:
|
|
34
|
-
enabled: false
|
|
35
|
-
|
|
36
|
-
# setting to false will allow pod disk to mount read/write
|
|
37
|
-
# setting this to false should only be done for debugging
|
|
38
|
-
securityContext:
|
|
39
|
-
readOnlyRootFs: true
|
|
40
|
-
|
|
41
|
-
horizontalScaler:
|
|
42
|
-
minReplicas: 2
|
|
43
|
-
maxReplicas: 3
|
|
44
|
-
maxCPU: 75
|
|
45
|
-
|
|
46
|
-
affinity: {}
|
|
47
|
-
|
|
48
|
-
# typically handled by traefik, but not always
|
|
49
|
-
ingress: {}
|
|
50
|
-
|
|
51
|
-
nodeSelector: {}
|
|
52
|
-
|
|
53
|
-
podAnnotations: {}
|
|
54
|
-
|
|
55
|
-
tolerations: []
|
|
56
|
-
|
|
57
|
-
workloadIdentity: {}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
-------------------------------------------------------------------------------
|
|
2
|
-
|
|
3
|
-
Service: {{ .Chart.Name }}
|
|
4
|
-
|
|
5
|
-
This service relies on the presence of a Service Account (SA) to define its
|
|
6
|
-
permissions on the clusters that it is deployed to. Verify or create an SA
|
|
7
|
-
with the following name and IAM roles:
|
|
8
|
-
|
|
9
|
-
SA name => {{ .Chart.Name }}
|
|
10
|
-
IAM roles => pubsub.editor
|
|
11
|
-
secretmanager.secretAccessor
|
|
12
|
-
|
|
13
|
-
{{- if .Values.workloadIdentity.disabled }}
|
|
14
|
-
|
|
15
|
-
Workload Identity is disabled for this service, most likely because this is
|
|
16
|
-
running on a legacy cluster which does not support it. In order for this
|
|
17
|
-
service to function properly a set of JSON keys will need to be generated and
|
|
18
|
-
then stored as a secret using this syntax:
|
|
19
|
-
|
|
20
|
-
cat <keyfileName> | kubectl create secret generic {{ .Chart.Name }}-sa-key \
|
|
21
|
-
--from-file=key.json=/dev/stdin
|
|
22
|
-
|
|
23
|
-
{{- else }}
|
|
24
|
-
|
|
25
|
-
Workload identity is enabled for this service, therefore the SA must have the
|
|
26
|
-
proper IAM policy bound to it. This can be verified by running:
|
|
27
|
-
|
|
28
|
-
$ gcloud iam service-accounts get-iam-policy \
|
|
29
|
-
--project {{ .Values.config.PROJECT_ID }} \
|
|
30
|
-
{{ .Chart.Name }}@{{ .Values.config.PROJECT_ID }}.iam.gserviceaccount.com
|
|
31
|
-
|
|
32
|
-
which should return something resembling:
|
|
33
|
-
|
|
34
|
-
bindings:
|
|
35
|
-
- members:
|
|
36
|
-
- serviceAccount:{{ .Values.config.PROJECT_ID }}.svc.id.goog[default/<service name>]
|
|
37
|
-
role: roles/iam.workloadIdentityUser
|
|
38
|
-
etag: <uuencoded tag>
|
|
39
|
-
version: 1
|
|
40
|
-
|
|
41
|
-
If the role of roles/iam.workloadIdentityUser does not appear on the SA then
|
|
42
|
-
run the following command to add it:
|
|
43
|
-
|
|
44
|
-
$ gcloud iam service-accounts add-iam-policy-binding \
|
|
45
|
-
--project {{ .Values.config.PROJECT_ID }} \
|
|
46
|
-
--role roles/iam.workloadIdentityUser \
|
|
47
|
-
--member "serviceAccount:{{ .Values.config.PROJECT_ID }}.svc.id.goog[default/{{ .Chart.Name }}]" \
|
|
48
|
-
{{ .Chart.Name }}@{{ .Values.config.PROJECT_ID }}.iam.gserviceaccount.com
|
|
49
|
-
|
|
50
|
-
{{- end }}
|
|
51
|
-
|
|
52
|
-
-------------------------------------------------------------------------------
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
apiVersion: v1
|
|
2
|
-
kind: ConfigMap
|
|
3
|
-
metadata:
|
|
4
|
-
name: {{ .Chart.Name }}-configs
|
|
5
|
-
labels:
|
|
6
|
-
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
|
7
|
-
app: "{{ .Chart.Name }}"
|
|
8
|
-
heritage: "{{ .Release.Service }}"
|
|
9
|
-
release: "{{ .Release.Name }}"
|
|
10
|
-
data:
|
|
11
|
-
{{- toYaml .Values.config | nindent 2 }}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
apiVersion: apps/v1
|
|
2
|
-
kind: Deployment
|
|
3
|
-
metadata:
|
|
4
|
-
name: {{ .Chart.Name }}
|
|
5
|
-
labels:
|
|
6
|
-
redis-client: "true"
|
|
7
|
-
app: {{ .Chart.Name }}
|
|
8
|
-
chart/version: {{ .Chart.Version }}
|
|
9
|
-
chart/appVersion: {{ .Values.image.VERSION }}
|
|
10
|
-
spec:
|
|
11
|
-
selector:
|
|
12
|
-
matchLabels:
|
|
13
|
-
app: {{ .Chart.Name }}
|
|
14
|
-
template:
|
|
15
|
-
metadata:
|
|
16
|
-
labels:
|
|
17
|
-
app: {{ .Chart.Name }}
|
|
18
|
-
chart/version: {{ .Chart.Version }}
|
|
19
|
-
chart/appVersion: {{ .Values.image.VERSION }}
|
|
20
|
-
redis-client: "true"
|
|
21
|
-
annotations:
|
|
22
|
-
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
|
23
|
-
prometheus.io/port: "5111"
|
|
24
|
-
prometheus.io/scrape: "true"
|
|
25
|
-
configmap.reloader.stakater.com/reload: "default-configs"
|
|
26
|
-
iam.roles: |
|
|
27
|
-
"pubsub.editor"
|
|
28
|
-
"secretManager.secretAccessor"
|
|
29
|
-
spec:
|
|
30
|
-
serviceAccountName: {{ .Chart.Name }}
|
|
31
|
-
volumes:
|
|
32
|
-
- name: tmpfs
|
|
33
|
-
emptyDir: {}
|
|
34
|
-
{{- if .Values.workloadIdentity.disabled }}
|
|
35
|
-
- name: google-cloud-key
|
|
36
|
-
secret:
|
|
37
|
-
secretName: {{ .Chart.Name }}-sa-key
|
|
38
|
-
{{- end }}
|
|
39
|
-
{{- if .Values.preemptible.enabled }}
|
|
40
|
-
tolerations:
|
|
41
|
-
- key: "preemptible"
|
|
42
|
-
operator: "Equal"
|
|
43
|
-
value: "true"
|
|
44
|
-
effect: "NoSchedule"
|
|
45
|
-
affinity:
|
|
46
|
-
nodeAffinity:
|
|
47
|
-
preferredDuringSchedulingIgnoredDuringExecution:
|
|
48
|
-
- preference:
|
|
49
|
-
matchExpressions:
|
|
50
|
-
- key: cloud.google.com/gke-preemptible
|
|
51
|
-
operator: Exists
|
|
52
|
-
weight: 100
|
|
53
|
-
{{- end }}
|
|
54
|
-
containers:
|
|
55
|
-
- name: {{ .Chart.Name }}
|
|
56
|
-
imagePullPolicy: IfNotPresent
|
|
57
|
-
image: gcr.io/leverege-docker-images/{{ .Chart.Name }}:{{ .Values.image.VERSION }}
|
|
58
|
-
securityContext:
|
|
59
|
-
readOnlyRootFilesystem: {{ .Values.securityContext.readOnlyRootFs }}
|
|
60
|
-
runAsNonRoot: true
|
|
61
|
-
runAsUser: 1000
|
|
62
|
-
allowPrivilegeEscalation: false
|
|
63
|
-
{{- if .Values.probes }}{{ if .Values.probes.enabled }}
|
|
64
|
-
readinessProbe:
|
|
65
|
-
httpGet:
|
|
66
|
-
path: /healthz
|
|
67
|
-
port: api
|
|
68
|
-
initialDelaySeconds: 10
|
|
69
|
-
livenessProbe:
|
|
70
|
-
httpGet:
|
|
71
|
-
path: /livenessProbe
|
|
72
|
-
port: api
|
|
73
|
-
initialDelaySeconds: 15
|
|
74
|
-
periodSeconds: 60
|
|
75
|
-
{{- end }}{{ end }}
|
|
76
|
-
resources:
|
|
77
|
-
limits:
|
|
78
|
-
cpu: "100m"
|
|
79
|
-
memory: "256Mi"
|
|
80
|
-
# requests:
|
|
81
|
-
# cpu: "100m"
|
|
82
|
-
# memory: "128Mi"
|
|
83
|
-
ports:
|
|
84
|
-
{{- if .Values.config.port }}
|
|
85
|
-
- name: api
|
|
86
|
-
containerPort: {{ .Values.config.port }}
|
|
87
|
-
protocol: TCP
|
|
88
|
-
{{- end }}
|
|
89
|
-
- name: node-metrics
|
|
90
|
-
containerPort: 5111
|
|
91
|
-
volumeMounts:
|
|
92
|
-
- name: tmpfs
|
|
93
|
-
mountPath: "/tmp"
|
|
94
|
-
envFrom:
|
|
95
|
-
- configMapRef:
|
|
96
|
-
name: default-configs
|
|
97
|
-
- configMapRef:
|
|
98
|
-
name: {{ .Chart.Name }}-configs
|
|
99
|
-
env:
|
|
100
|
-
{{- if .Values.workloadIdentity.disabled }}
|
|
101
|
-
- name: GOOGLE_APPLICATION_CREDENTIALS
|
|
102
|
-
value: /var/secrets/google/key.json
|
|
103
|
-
{{- end }}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
apiVersion: autoscaling/v1
|
|
2
|
-
kind: HorizontalPodAutoscaler
|
|
3
|
-
metadata:
|
|
4
|
-
name: {{ .Chart.Name }}
|
|
5
|
-
spec:
|
|
6
|
-
scaleTargetRef:
|
|
7
|
-
apiVersion: apps/v1
|
|
8
|
-
kind: Deployment
|
|
9
|
-
name: {{ .Chart.Name }}
|
|
10
|
-
minReplicas: {{ .Values.horizontalScaler.minReplicas }}
|
|
11
|
-
maxReplicas: {{ .Values.horizontalScaler.maxReplicas }}
|
|
12
|
-
targetCPUUtilizationPercentage: {{ .Values.horizontalScaler.maxCPU }}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
apiVersion: networking.k8s.io/v1
|
|
2
|
-
kind: Ingress
|
|
3
|
-
metadata:
|
|
4
|
-
name: {{ .Chart.Name }}
|
|
5
|
-
labels:
|
|
6
|
-
app: {{ .Chart.Name }}
|
|
7
|
-
annotations:
|
|
8
|
-
# kubernetes.io/ingress.allow-http: "false"
|
|
9
|
-
kubernetes.io/ingress.global-static-ip-name: {{ .Chart.Name }}
|
|
10
|
-
spec:
|
|
11
|
-
tls:
|
|
12
|
-
- secretName: {{ .Values.ingress.secretName }}
|
|
13
|
-
defaultBackend:
|
|
14
|
-
service:
|
|
15
|
-
name: {{ .Chart.Name }}
|
|
16
|
-
port:
|
|
17
|
-
number: {{ .Values.config.port }}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
apiVersion: v1
|
|
2
|
-
kind: Service
|
|
3
|
-
metadata:
|
|
4
|
-
name: {{ .Chart.Name }}
|
|
5
|
-
spec:
|
|
6
|
-
type: NodePort
|
|
7
|
-
selector:
|
|
8
|
-
app: {{ .Chart.Name }}
|
|
9
|
-
ports:
|
|
10
|
-
- name: {{ .Chart.Name }}
|
|
11
|
-
protocol: TCP
|
|
12
|
-
port: {{ .Values.config.port }}
|
|
13
|
-
targetPort: {{ .Values.config.port }}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
apiVersion: v1
|
|
2
|
-
kind: ServiceAccount
|
|
3
|
-
metadata:
|
|
4
|
-
annotations:
|
|
5
|
-
iam.gke.io/gcp-service-account: {{ .Chart.Name }}@{{ .Values.config.PROJECT_ID }}.iam.gserviceaccount.com
|
|
6
|
-
name: {{ .Chart.Name }}
|
|
7
|
-
labels:
|
|
8
|
-
app: {{ .Chart.Name }}
|
|
9
|
-
chart/version: {{ .Chart.Version }}
|
|
10
|
-
chart/appVersion: {{ .Values.image.VERSION }}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
image:
|
|
2
|
-
VERSION: v0.4.4
|
|
3
|
-
|
|
4
|
-
config:
|
|
5
|
-
LOG_CONFIG: '{"type":"pino","level":"warn"}'
|
|
6
|
-
BLUEPRINT_ID: needs-to-be-set
|
|
7
|
-
NETWORK_ID: needs-to-be-set
|
|
8
|
-
SYSTEM_ID: needs-to-be-set
|
|
9
|
-
IMAGINE_URL: needs-to-be-set
|
|
10
|
-
ALIAS_KEY: needs-to-be-set
|
|
11
|
-
INGESTION_TOPIC: needs-to-be-set
|
|
12
|
-
port: 8383
|
|
13
|
-
logExpressRequests: false
|
|
14
|
-
|
|
15
|
-
ingress:
|
|
16
|
-
domain: leverege.net
|
|
17
|
-
secretName: leverege-net-ssl-2034
|
|
18
|
-
|
|
19
|
-
preemptible:
|
|
20
|
-
enabled: true
|
|
21
|
-
|
|
22
|
-
probes:
|
|
23
|
-
enabled: true
|
|
24
|
-
|
|
25
|
-
redisClient:
|
|
26
|
-
label: true
|
|
27
|
-
|
|
28
|
-
securityContext:
|
|
29
|
-
readOnlyRootFs: true
|
|
30
|
-
|
|
31
|
-
horizontalScaler:
|
|
32
|
-
minReplicas: 1
|
|
33
|
-
maxReplicas: 3
|
|
34
|
-
maxCPU: 75
|
|
35
|
-
|
|
36
|
-
affinity: {}
|
|
37
|
-
|
|
38
|
-
nodeSelector: {}
|
|
39
|
-
|
|
40
|
-
podAnnotations: {}
|
|
41
|
-
|
|
42
|
-
tolerations: []
|
|
43
|
-
|
|
44
|
-
workloadIdentity: {}
|
package/src/sa-tools/imp-sa
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
IMPERSONATE='gcloud config set auth/impersonate_service_account'
|
|
4
|
-
impersonate() {
|
|
5
|
-
sa=$1
|
|
6
|
-
echo "Impersonating $sa"
|
|
7
|
-
$IMPERSONATE $sa
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
case $1 in
|
|
11
|
-
terraform)
|
|
12
|
-
impersonate terraformer@leverege-dev-john.iam.gserviceaccount.com
|
|
13
|
-
;;
|
|
14
|
-
gke)
|
|
15
|
-
impersonate k8s@project.iam.gserviceaccount.com
|
|
16
|
-
;;
|
|
17
|
-
admin)
|
|
18
|
-
impersonate admin@other-project.iam.gserviceaccount.com
|
|
19
|
-
;;
|
|
20
|
-
clear)
|
|
21
|
-
gcloud config unset auth/impersonate_service_account
|
|
22
|
-
;;
|
|
23
|
-
*)
|
|
24
|
-
echo "Usage: Updates impersonated service account"
|
|
25
|
-
echo " imp-sa [gke|admin|clear]"
|
|
26
|
-
esac
|