@leverege/build-tools 1.12.5 → 1.12.6

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.
@@ -53,32 +53,6 @@ spec:
53
53
  SVC_YAML
54
54
  }
55
55
 
56
- createIngress(){
57
- cat<<INGRESS_YAML > ingress.yaml
58
- apiVersion: extensions/v1beta1
59
- kind: Ingress
60
- metadata:
61
- name: $chartname-ingress
62
- annotations:
63
- kubernetes.io/ingress.global-static-ip-name: $chartname-ingress
64
- spec:
65
- tls:
66
- - secretName: frontendtls
67
- rules:
68
- - host: {{ quote .Values.$chartname_go.INGRESS_HOST }}
69
- http:
70
- paths:
71
- - backend:
72
- serviceName: $chartname
73
- servicePort: {{ .Values.$chartname_go.SERVER_PORT }}
74
- - http:
75
- paths:
76
- - backend:
77
- serviceName: $chartname
78
- servicePort: {{ .Values.$chartname_go.SERVER_PORT }}
79
- INGRESS_YAML
80
- }
81
-
82
56
  # Make chart directory
83
57
  mkdir helm
84
58
  mkdir helm/templates
@@ -90,13 +64,17 @@ PACKAGE_VERSION=$(node -p "require('../package.json').version")
90
64
 
91
65
  cat<<CHARTYAML > Chart.yaml
92
66
  name: $chartname
93
- version: 1.0.0
94
- appVersion: $PACKAGE_VERSION
67
+ version: 1.0.0 # version of the Helm Chart
68
+ appVersion: $PACKAGE_VERSION # minimum version of your application that is compatible with this chart
95
69
 
96
70
  CHARTYAML
97
71
 
98
72
  # Bootstrap values.yaml
99
73
  cat<<VALUESYAML > values.yaml
74
+ ### These are default env variable values for your application
75
+ ### It is not actually used in production, but listed here for others as reference for what types of env variables are required.
76
+ ### Overwrite these values in values-local or respective values files in platform-k8s
77
+
100
78
  # List your env variables here
101
79
  $chartname_go:
102
80
  VERSION: vX.Y.Z
@@ -104,8 +82,6 @@ $chartname_go:
104
82
  IMAGE: gcr.io/leverege-docker-images/$chartname
105
83
 
106
84
  default:
107
- LOG_DIR: "/var/log/levlog"
108
- LOG_LEVEL: "info"
109
85
  MAX_CHILD_PROCESSES: "1"
110
86
 
111
87
  MODEL_FIREBASE_SERVICE_ACCOUNT: /var/config/keys/model-data
@@ -132,12 +108,7 @@ default:
132
108
  \"name\": \"${logName}\",
133
109
  \"level\": \"info\",
134
110
  \"streams\": [
135
- {
136
- \"type\": \"rotating-file\",
137
- \"period\": \"1d\",
138
- \"count\": 3,
139
- \"path\": \"/var/log/levlog/${logName}.log\"
140
- }, {
111
+ {
141
112
  \"type\": \"stackdriver\",
142
113
  \"logName\": \"${logName}\"
143
114
  }
@@ -172,13 +143,14 @@ cat<<DEPLOYMENT_YAML > deployment.yaml
172
143
  apiVersion: apps/v1beta1
173
144
  kind: Deployment
174
145
  metadata:
175
- name: $chartname
146
+ name: {{ .Chart.Name }}
176
147
  spec:
177
148
  template:
178
149
  metadata:
179
150
  labels:
180
- app: $chartname
181
- redis-client: 'true'
151
+ app: {{ .Chart.Name }}
152
+ chart/version: {{ .Chart.Version }}
153
+ chart/appVersion: {{ .Chart.AppVersion }}
182
154
  annotations:
183
155
  prometheus.io/port: '5111'
184
156
  prometheus.io/scrape: 'true'
@@ -187,7 +159,7 @@ spec:
187
159
  - name: model-firebase-key
188
160
  secret:
189
161
  secretName: model-data
190
- - name: logs
162
+ - name: tmpfs
191
163
  emptyDir: {}
192
164
  - name: pubsub-key
193
165
  secret:
@@ -208,7 +180,7 @@ spec:
208
180
  - key: app
209
181
  operator: In
210
182
  values:
211
- - api-server
183
+ - {{ .Chart.Name }}
212
184
  topologyKey: kubernetes.io/hostname
213
185
  nodeAffinity:
214
186
  preferredDuringSchedulingIgnoredDuringExecution:
@@ -219,15 +191,26 @@ spec:
219
191
  weight: 50
220
192
  {{- end }}
221
193
  containers:
222
- - name: $chartname
223
- image: gcr.io/leverege-docker-images/$chartname:{{ .Values.$chartname_go.VERSION }}
194
+ - name: {{ .Chart.Name }}
195
+ image: {{ .Values.$chartname_go.IMAGE }}:{{ .Values.$chartname_go.VERSION }}
224
196
  imagePullPolicy: Always
225
197
  securityContext:
198
+ readOnlyRootFilesystem: true
199
+ runAsNonRoot: true
226
200
  runAsUser: 1000
227
201
  allowPrivilegeEscalation: false
202
+ readinessProbe:
203
+ httpGet:
204
+ path: /
205
+ port: node-metrics
206
+ initialDelaySeconds: 10
228
207
  resources:
229
208
  requests:
230
- cpu: "10m"
209
+ cpu: "50m"
210
+ memory: "256Mi"
211
+ limits:
212
+ cpu: "100m"
213
+ memory: "512Mi"
231
214
  ports:
232
215
  {{- if .Values.$chartname_go.SERVER_PORT }}
233
216
  - name: api
@@ -238,8 +221,8 @@ spec:
238
221
  volumeMounts:
239
222
  - name: model-firebase-key
240
223
  mountPath: {{ quote .Values.default.MODEL_FIREBASE_SERVICE_ACCOUNT }}
241
- - name: logs
242
- mountPath: {{ quote .Values.default.LOG_DIR }}
224
+ - name: tmpfs
225
+ mountPath: "/tmp"
243
226
  - name: pubsub-key
244
227
  mountPath: {{ quote .Values.default.PUBSUB_SERVICE_ACCOUNT }}
245
228
  env:
@@ -251,10 +234,6 @@ spec:
251
234
  value: {{ required "Limit config required" .Values.default.LIMIT_CONFIG | quote }}
252
235
  - name: TRANSPORT_CONFIG
253
236
  value: {{ required "Transport config required" .Values.default.TRANSPORT_CONFIG | quote }}
254
- - name: LOG_DIR
255
- value: {{ quote .Values.default.LOG_DIR }}
256
- - name: LOG_LEVEL
257
- value: {{ quote .Values.default.LOG_LEVEL }}
258
237
  - name: LOG_CONFIG
259
238
  value: {{ required "Log config required" .Values.default.LOG_CONFIG | quote }}
260
239
  - name: MAX_CHILD_PROCESSES
@@ -270,11 +249,11 @@ echo # (optional) move to a new line
270
249
  if [[ $REPLY =~ ^[Yy]$ ]]
271
250
  then
272
251
  echo
273
- echo '**************************************'
274
- echo 'CREATING SERVICE AND INGRESS TEMPLATES'
275
- echo '**************************************'
252
+ echo '**********************************'
253
+ echo ' CREATING SERVICE TEMPLATES '
254
+ echo '**********************************'
276
255
  createService
277
- createIngress
256
+
278
257
  fi
279
258
 
280
259
  # Print out some hints
@@ -284,11 +263,12 @@ cat<<HINTS
284
263
 
285
264
  1. You will need to add in additional env variables to both templates/*.yaml and values.yaml
286
265
  2. You may not need all the default env variables so feel free to remove them as well
287
- 3. To use ingress, you need to reserve static ip as specified in ingress.yaml
266
+ 3. Adjust limit/request cpu and memory values as needed
267
+ 4. To use ingress, you need to reserve static ip then add to ingress templates in platform-k8s
288
268
 
289
269
  Further instructions here: https://github.com/kelseyhightower/ingress-with-static-ip
290
270
 
291
- 4. Finally, follow chart museum directions to add your chart or
271
+ 5. Finally, follow chart museum directions to add your chart ors
292
272
 
293
273
  helm push helm/ chartmuseum
294
274
 
@@ -120,6 +120,7 @@ function () {
120
120
  _ref = _context.sent;
121
121
  _ref2 = _slicedToArray(_ref, 1);
122
122
  result = _ref2[0];
123
+ // Writes the decrypted file to disk
123
124
  writeFile = promisify(fs.writeFile);
124
125
  _context.next = 22;
125
126
  return writeFile(path.resolve(__dirname, plaintextFileName), Buffer.from(result.plaintext, 'base64'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "1.12.5",
3
+ "version": "1.12.6",
4
4
  "description": "A package for development build tools.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/helmify CHANGED
@@ -53,32 +53,6 @@ spec:
53
53
  SVC_YAML
54
54
  }
55
55
 
56
- createIngress(){
57
- cat<<INGRESS_YAML > ingress.yaml
58
- apiVersion: extensions/v1beta1
59
- kind: Ingress
60
- metadata:
61
- name: $chartname-ingress
62
- annotations:
63
- kubernetes.io/ingress.global-static-ip-name: $chartname-ingress
64
- spec:
65
- tls:
66
- - secretName: frontendtls
67
- rules:
68
- - host: {{ quote .Values.$chartname_go.INGRESS_HOST }}
69
- http:
70
- paths:
71
- - backend:
72
- serviceName: $chartname
73
- servicePort: {{ .Values.$chartname_go.SERVER_PORT }}
74
- - http:
75
- paths:
76
- - backend:
77
- serviceName: $chartname
78
- servicePort: {{ .Values.$chartname_go.SERVER_PORT }}
79
- INGRESS_YAML
80
- }
81
-
82
56
  # Make chart directory
83
57
  mkdir helm
84
58
  mkdir helm/templates
@@ -90,13 +64,17 @@ PACKAGE_VERSION=$(node -p "require('../package.json').version")
90
64
 
91
65
  cat<<CHARTYAML > Chart.yaml
92
66
  name: $chartname
93
- version: 1.0.0
94
- appVersion: $PACKAGE_VERSION
67
+ version: 1.0.0 # version of the Helm Chart
68
+ appVersion: $PACKAGE_VERSION # minimum version of your application that is compatible with this chart
95
69
 
96
70
  CHARTYAML
97
71
 
98
72
  # Bootstrap values.yaml
99
73
  cat<<VALUESYAML > values.yaml
74
+ ### These are default env variable values for your application
75
+ ### It is not actually used in production, but listed here for others as reference for what types of env variables are required.
76
+ ### Overwrite these values in values-local or respective values files in platform-k8s
77
+
100
78
  # List your env variables here
101
79
  $chartname_go:
102
80
  VERSION: vX.Y.Z
@@ -104,8 +82,6 @@ $chartname_go:
104
82
  IMAGE: gcr.io/leverege-docker-images/$chartname
105
83
 
106
84
  default:
107
- LOG_DIR: "/var/log/levlog"
108
- LOG_LEVEL: "info"
109
85
  MAX_CHILD_PROCESSES: "1"
110
86
 
111
87
  MODEL_FIREBASE_SERVICE_ACCOUNT: /var/config/keys/model-data
@@ -132,12 +108,7 @@ default:
132
108
  \"name\": \"${logName}\",
133
109
  \"level\": \"info\",
134
110
  \"streams\": [
135
- {
136
- \"type\": \"rotating-file\",
137
- \"period\": \"1d\",
138
- \"count\": 3,
139
- \"path\": \"/var/log/levlog/${logName}.log\"
140
- }, {
111
+ {
141
112
  \"type\": \"stackdriver\",
142
113
  \"logName\": \"${logName}\"
143
114
  }
@@ -172,13 +143,14 @@ cat<<DEPLOYMENT_YAML > deployment.yaml
172
143
  apiVersion: apps/v1beta1
173
144
  kind: Deployment
174
145
  metadata:
175
- name: $chartname
146
+ name: {{ .Chart.Name }}
176
147
  spec:
177
148
  template:
178
149
  metadata:
179
150
  labels:
180
- app: $chartname
181
- redis-client: 'true'
151
+ app: {{ .Chart.Name }}
152
+ chart/version: {{ .Chart.Version }}
153
+ chart/appVersion: {{ .Chart.AppVersion }}
182
154
  annotations:
183
155
  prometheus.io/port: '5111'
184
156
  prometheus.io/scrape: 'true'
@@ -187,7 +159,7 @@ spec:
187
159
  - name: model-firebase-key
188
160
  secret:
189
161
  secretName: model-data
190
- - name: logs
162
+ - name: tmpfs
191
163
  emptyDir: {}
192
164
  - name: pubsub-key
193
165
  secret:
@@ -208,7 +180,7 @@ spec:
208
180
  - key: app
209
181
  operator: In
210
182
  values:
211
- - api-server
183
+ - {{ .Chart.Name }}
212
184
  topologyKey: kubernetes.io/hostname
213
185
  nodeAffinity:
214
186
  preferredDuringSchedulingIgnoredDuringExecution:
@@ -219,15 +191,26 @@ spec:
219
191
  weight: 50
220
192
  {{- end }}
221
193
  containers:
222
- - name: $chartname
223
- image: gcr.io/leverege-docker-images/$chartname:{{ .Values.$chartname_go.VERSION }}
194
+ - name: {{ .Chart.Name }}
195
+ image: {{ .Values.$chartname_go.IMAGE }}:{{ .Values.$chartname_go.VERSION }}
224
196
  imagePullPolicy: Always
225
197
  securityContext:
198
+ readOnlyRootFilesystem: true
199
+ runAsNonRoot: true
226
200
  runAsUser: 1000
227
201
  allowPrivilegeEscalation: false
202
+ readinessProbe:
203
+ httpGet:
204
+ path: /
205
+ port: node-metrics
206
+ initialDelaySeconds: 10
228
207
  resources:
229
208
  requests:
230
- cpu: "10m"
209
+ cpu: "50m"
210
+ memory: "256Mi"
211
+ limits:
212
+ cpu: "100m"
213
+ memory: "512Mi"
231
214
  ports:
232
215
  {{- if .Values.$chartname_go.SERVER_PORT }}
233
216
  - name: api
@@ -238,8 +221,8 @@ spec:
238
221
  volumeMounts:
239
222
  - name: model-firebase-key
240
223
  mountPath: {{ quote .Values.default.MODEL_FIREBASE_SERVICE_ACCOUNT }}
241
- - name: logs
242
- mountPath: {{ quote .Values.default.LOG_DIR }}
224
+ - name: tmpfs
225
+ mountPath: "/tmp"
243
226
  - name: pubsub-key
244
227
  mountPath: {{ quote .Values.default.PUBSUB_SERVICE_ACCOUNT }}
245
228
  env:
@@ -251,10 +234,6 @@ spec:
251
234
  value: {{ required "Limit config required" .Values.default.LIMIT_CONFIG | quote }}
252
235
  - name: TRANSPORT_CONFIG
253
236
  value: {{ required "Transport config required" .Values.default.TRANSPORT_CONFIG | quote }}
254
- - name: LOG_DIR
255
- value: {{ quote .Values.default.LOG_DIR }}
256
- - name: LOG_LEVEL
257
- value: {{ quote .Values.default.LOG_LEVEL }}
258
237
  - name: LOG_CONFIG
259
238
  value: {{ required "Log config required" .Values.default.LOG_CONFIG | quote }}
260
239
  - name: MAX_CHILD_PROCESSES
@@ -270,11 +249,11 @@ echo # (optional) move to a new line
270
249
  if [[ $REPLY =~ ^[Yy]$ ]]
271
250
  then
272
251
  echo
273
- echo '**************************************'
274
- echo 'CREATING SERVICE AND INGRESS TEMPLATES'
275
- echo '**************************************'
252
+ echo '**********************************'
253
+ echo ' CREATING SERVICE TEMPLATES '
254
+ echo '**********************************'
276
255
  createService
277
- createIngress
256
+
278
257
  fi
279
258
 
280
259
  # Print out some hints
@@ -284,11 +263,12 @@ cat<<HINTS
284
263
 
285
264
  1. You will need to add in additional env variables to both templates/*.yaml and values.yaml
286
265
  2. You may not need all the default env variables so feel free to remove them as well
287
- 3. To use ingress, you need to reserve static ip as specified in ingress.yaml
266
+ 3. Adjust limit/request cpu and memory values as needed
267
+ 4. To use ingress, you need to reserve static ip then add to ingress templates in platform-k8s
288
268
 
289
269
  Further instructions here: https://github.com/kelseyhightower/ingress-with-static-ip
290
270
 
291
- 4. Finally, follow chart museum directions to add your chart or
271
+ 5. Finally, follow chart museum directions to add your chart ors
292
272
 
293
273
  helm push helm/ chartmuseum
294
274