@newskit-render/mock 0.35.0

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.
@@ -0,0 +1,25 @@
1
+ {{- if .Values.networkpolicy.enabled -}}
2
+ {{- $fullName := include "mock.fullname" . -}}
3
+ apiVersion: networking.k8s.io/v1
4
+ kind: NetworkPolicy
5
+ metadata:
6
+ name: {{ $fullName }}-allowed-traffic
7
+ namespace: {{ .Values.namespace }}
8
+ annotations: {{ include "mock.labels" . | nindent 4 }}
9
+ spec:
10
+ podSelector:
11
+ matchExpressions :
12
+ - key: app.kubernetes.io/name
13
+ operator: In
14
+ values:
15
+ - {{ include "mock.name" . }}
16
+ ingress:
17
+ - ports:
18
+ - port: {{ .Values.service.port }}
19
+ protocol: TCP
20
+ egress:
21
+ - {}
22
+ policyTypes:
23
+ - Ingress
24
+ - Egress
25
+ {{- end }}
@@ -0,0 +1,14 @@
1
+ apiVersion: v1
2
+ kind: Service
3
+ metadata:
4
+ name: {{ include "mock.fullname" . }}
5
+ namespace: {{ .Values.namespace }}
6
+ labels: {{ include "mock.labels" . | nindent 4 }}
7
+ spec:
8
+ type: {{ .Values.service.type }}
9
+ ports:
10
+ - port: {{ .Values.service.port }}
11
+ targetPort: {{ .Values.service.port }}
12
+ protocol: TCP
13
+ name: http
14
+ selector: {{ include "mock.selectors" . | nindent 4 }}
@@ -0,0 +1,23 @@
1
+ # Default values for NewsKit Render.
2
+ # This is a YAML-formatted file.
3
+ # Declare variables to be passed into your templates.
4
+ namespace: newskit-render-dev
5
+
6
+ replicaCount: 1
7
+ revisionHistoryLimit: 3
8
+
9
+ resources:
10
+ limits:
11
+ cpu: 1
12
+ memory: 512Mi
13
+ requests:
14
+ cpu: 200m
15
+ memory: 256Mi
16
+
17
+ environment: dev
18
+
19
+ horizontalAutoScale:
20
+ min: 1
21
+ max: 2
22
+ resource: cpu
23
+ utilization: 60
@@ -0,0 +1,26 @@
1
+ # Default values for NewsKit Render.
2
+ # This is a YAML-formatted file.
3
+ # Declare variables to be passed into your templates.
4
+ namespace: newskit-render-local
5
+
6
+ replicaCount: 1
7
+ revisionHistoryLimit: 3
8
+
9
+ imagePullSecrets:
10
+ - name: regcred
11
+
12
+ resources:
13
+ limits:
14
+ cpu: 1
15
+ memory: 512Mi
16
+ requests:
17
+ cpu: 200m
18
+ memory: 256Mi
19
+
20
+ environment: local
21
+
22
+ horizontalAutoScale:
23
+ min: 1
24
+ max: 2
25
+ resource: cpu
26
+ utilization: 60
@@ -0,0 +1,23 @@
1
+ # Default values for NewsKit Render.
2
+ # This is a YAML-formatted file.
3
+ # Declare variables to be passed into your templates.
4
+ namespace: newskit-render-pr
5
+
6
+ replicaCount: 1
7
+ revisionHistoryLimit: 3
8
+
9
+ resources:
10
+ limits:
11
+ cpu: 1
12
+ memory: 512Mi
13
+ requests:
14
+ cpu: 200m
15
+ memory: 256Mi
16
+
17
+ environment: pr
18
+
19
+ horizontalAutoScale:
20
+ min: 1
21
+ max: 2
22
+ resource: cpu
23
+ utilization: 60
@@ -0,0 +1,23 @@
1
+ # Default values for NewsKit Render.
2
+ # This is a YAML-formatted file.
3
+ # Declare variables to be passed into your templates.
4
+ namespace: newskit-render-prod
5
+
6
+ replicaCount: 2
7
+ revisionHistoryLimit: 5
8
+
9
+ resources:
10
+ limits:
11
+ cpu: 1
12
+ memory: 512Mi
13
+ requests:
14
+ cpu: 200m
15
+ memory: 256Mi
16
+
17
+ environment: prod
18
+
19
+ horizontalAutoScale:
20
+ min: 2
21
+ max: 4
22
+ resource: cpu
23
+ utilization: 60
@@ -0,0 +1,23 @@
1
+ # Default values for NewsKit Render.
2
+ # This is a YAML-formatted file.
3
+ # Declare variables to be passed into your templates.
4
+ namespace: newskit-render-staging
5
+
6
+ replicaCount: 2
7
+ revisionHistoryLimit: 5
8
+
9
+ resources:
10
+ limits:
11
+ cpu: 1
12
+ memory: 512Mi
13
+ requests:
14
+ cpu: 200m
15
+ memory: 256Mi
16
+
17
+ environment: staging
18
+
19
+ horizontalAutoScale:
20
+ min: 2
21
+ max: 4
22
+ resource: cpu
23
+ utilization: 60
@@ -0,0 +1,37 @@
1
+ image:
2
+ repository: 940731442544.dkr.ecr.eu-west-1.amazonaws.com/ncu-newskit-render-mock
3
+ tag: ""
4
+ pullPolicy: Always
5
+
6
+ imagePullSecrets: []
7
+ nameOverride: ""
8
+ fullnameOverride: ""
9
+
10
+ service:
11
+ type: NodePort
12
+ port: 3000
13
+
14
+ tags:
15
+ serviceCatalogueId: 482
16
+ serviceName: newskit-render
17
+
18
+ networkpolicy:
19
+ enabled: true
20
+ annotations: {}
21
+
22
+ # Health check endpoint
23
+ readinessProbe:
24
+ httpGet:
25
+ path: /
26
+ port: 3000
27
+ initialDelaySeconds: 5
28
+ periodSeconds: 1
29
+
30
+ livenessProbe:
31
+ httpGet:
32
+ path: /
33
+ port: 3000
34
+ initialDelaySeconds: 5
35
+ timeoutSeconds: 2
36
+ periodSeconds: 3
37
+ failureThreshold: 5
@@ -0,0 +1,5 @@
1
+ {
2
+ "host": "0.0.0.0",
3
+ "routes": "routes.json",
4
+ "middlewares": "./singular.js"
5
+ }
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@newskit-render/mock",
3
+ "version": "0.35.0",
4
+ "description": "Simple rest api with mock data",
5
+ "author": "",
6
+ "license": "UNLICENSED",
7
+ "engines": {
8
+ "node": ">=16.13"
9
+ },
10
+ "scripts": {
11
+ "start": "json-server --watch src/index.js --port 4000",
12
+ "clean": "rm -rf node_modules & rm -f package-lock.json & rm -f yarn.lock"
13
+ },
14
+ "dependencies": {
15
+ "json-server": "0.16.3"
16
+ },
17
+ "publishConfig": {
18
+ "access": "public"
19
+ }
20
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "gitConfigPath": "../../.git/config",
3
+ "releaseDetails": {
4
+ "emailAddress": "newskit-render@news.co.uk",
5
+ "title": "NewsKit Render - Mock Service",
6
+ "platform": "Web",
7
+ "osType": "AWS",
8
+ "partner": "Internal (NewsUK Teams)",
9
+ "priority": "P2 - Very Important release required (3-4 days)",
10
+ "businessJustification": "This release is to deliver performance improvements, feature enhancements and bug fixes for NewsKit Render",
11
+ "testingMethod": "Both",
12
+ "testingToolsUsed": "Jest",
13
+ "releaseDurationMinutes": 15,
14
+ "appIds": ["NUK482"],
15
+ "environment": "Production"
16
+ },
17
+ "localChangelogPath": "./CHANGELOG.md"
18
+ }
package/routes.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "/pages/:slug": "/page?data.attributes.slug=:slug&singular=1"
3
+ }
package/singular.js ADDED
@@ -0,0 +1,19 @@
1
+ module.exports = (req, res, next) => {
2
+ const _send = res.send;
3
+ res.send = function (body) {
4
+ if (require("url").parse(req.originalUrl, true).query["singular"]) {
5
+ try {
6
+ const json = JSON.parse(body);
7
+ if (Array.isArray(json)) {
8
+ if (json.length === 1) {
9
+ return _send.call(this, JSON.stringify(json[0]));
10
+ } else if (json.length === 0) {
11
+ return _send.call(this, "{}", 404);
12
+ }
13
+ }
14
+ } catch (e) {}
15
+ }
16
+ return _send.call(this, body);
17
+ };
18
+ next();
19
+ };