Skip to content

Commit

Permalink
fix(strapi): nodeSelector (#113)
Browse files Browse the repository at this point in the history
* fix(strapi): nodeSelector

* plop

* fix: test perf

* fix(docker): remove devDeps
  • Loading branch information
Julien Bouquillon authored Apr 8, 2021
1 parent 14acc49 commit 33fd2b3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .k8s/__tests__/__snapshots__/dev.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ spec:
cpu: 500m
memory: 256Mi
requests:
cpu: 100m
cpu: 200m
memory: 128Mi
startupProbe:
failureThreshold: 12
Expand Down Expand Up @@ -468,6 +468,8 @@ spec:
- persistentVolumeClaim:
claimName: 1000jours-strapi-uploads
name: uploads
nodeSelector:
workload: les1000jours-strapi
---
apiVersion: v1
kind: ConfigMap
Expand Down
4 changes: 3 additions & 1 deletion .k8s/__tests__/__snapshots__/preprod.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ spec:
cpu: 500m
memory: 256Mi
requests:
cpu: 100m
cpu: 200m
memory: 128Mi
startupProbe:
failureThreshold: 12
Expand Down Expand Up @@ -430,6 +430,8 @@ spec:
- persistentVolumeClaim:
claimName: 1000jours-strapi-uploads
name: uploads
nodeSelector:
workload: les1000jours-strapi
---
apiVersion: v1
kind: ConfigMap
Expand Down
4 changes: 3 additions & 1 deletion .k8s/__tests__/__snapshots__/prod.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ spec:
cpu: 500m
memory: 256Mi
requests:
cpu: 100m
cpu: 200m
memory: 128Mi
startupProbe:
failureThreshold: 12
Expand Down Expand Up @@ -407,6 +407,8 @@ spec:
- persistentVolumeClaim:
claimName: 1000jours-strapi-uploads
name: uploads
nodeSelector:
workload: les1000jours-strapi
---
apiVersion: v1
kind: ConfigMap
Expand Down
11 changes: 7 additions & 4 deletions .k8s/components/strapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const strapiManifests = create("strapi", {
},
resources: {
requests: {
cpu: "100m",
cpu: "200m",
memory: "128Mi",
},
limits: {
Expand All @@ -85,7 +85,7 @@ const strapiManifests = create("strapi", {
//@ts-expect-error
const deployment = getManifestByKind(strapiManifests, Deployment) as Deployment;

const pvcName = "1000jours-strapi-uploads"
const pvcName = "1000jours-strapi-uploads";

if (deployment && deployment?.spec?.template.spec) {
deployment.spec.template.spec.volumes = [
Expand All @@ -96,12 +96,15 @@ if (deployment && deployment?.spec?.template.spec) {
name: "uploads",
},
];
deployment.spec.template.spec.nodeSelector = {
workload: "les1000jours-strapi",
};
}

const pvc = new PersistentVolumeClaim({
metadata: {
name: pvcName,
annotations: {}
annotations: {},
},
spec: {
accessModes: ["ReadWriteOnce"],
Expand All @@ -110,7 +113,7 @@ const pvc = new PersistentVolumeClaim({
storage: "1Gi",
},
},
volumeMode: "Filesystem"
volumeMode: "Filesystem",
},
});

Expand Down
2 changes: 2 additions & 0 deletions back/strapi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ ENV NODE_ENV production
RUN yarn build-ts
RUN yarn build

RUN yarn install --production

CMD ["yarn", "start"]

0 comments on commit 33fd2b3

Please sign in to comment.