Skip to content

Commit

Permalink
fix(createDeployment): handle request/limits
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Bouquillon committed Jul 27, 2020
1 parent 0c49448 commit 25f7ae5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
Expand Up @@ -79,11 +79,11 @@ spec:
timeoutSeconds: 1
resources:
limits:
cpu: 500m
cpu: 50m
memory: 128Mi
requests:
cpu: 5m
memory: 16Mi
cpu: 1m
memory: 64Mi
startupProbe:
failureThreshold: 12
httpGet:
Expand Down
Expand Up @@ -79,11 +79,11 @@ spec:
timeoutSeconds: 1
resources:
limits:
cpu: 500m
cpu: 50m
memory: 128Mi
requests:
cpu: 5m
memory: 16Mi
cpu: 1m
memory: 64Mi
startupProbe:
failureThreshold: 12
httpGet:
Expand Down
Expand Up @@ -61,11 +61,11 @@ spec:
timeoutSeconds: 1
resources:
limits:
cpu: 500m
cpu: 50m
memory: 128Mi
requests:
cpu: 5m
memory: 16Mi
cpu: 1m
memory: 64Mi
startupProbe:
failureThreshold: 12
httpGet:
Expand Down
13 changes: 9 additions & 4 deletions src/utils/createDeployment.ts
@@ -1,5 +1,5 @@
import { IIoK8sApiCoreV1Probe } from "kubernetes-models/_definitions/IoK8sApiCoreV1Probe";
import { IoK8sApiCoreV1ResourceRequirements } from "kubernetes-models/_definitions/IoK8sApiCoreV1ResourceRequirements";
import { IIoK8sApimachineryPkgApiResourceQuantity } from "kubernetes-models/_definitions/IoK8sApimachineryPkgApiResourceQuantity";
//import { IIoK8sApimachineryPkgApisMetaV1ObjectMeta } from "kubernetes-models/_definitions/IoK8sApimachineryPkgApisMetaV1ObjectMeta";
import { Deployment } from "kubernetes-models/apps/v1/Deployment";

Expand All @@ -9,7 +9,12 @@ interface DeploymentParams {
//metadata: IIoK8sApimachineryPkgApisMetaV1ObjectMeta;
image: string;
// { name: string | undefined; tag: string | undefined };
resources: IoK8sApiCoreV1ResourceRequirements | null;
limits?: {
[key: string]: IIoK8sApimachineryPkgApiResourceQuantity;
};
requests?: {
[key: string]: IIoK8sApimachineryPkgApiResourceQuantity;
};
livenessProbe: IIoK8sApiCoreV1Probe | null;
readinessProbe: IIoK8sApiCoreV1Probe | null;
}
Expand Down Expand Up @@ -85,12 +90,12 @@ export default (params: DeploymentParams): Deployment => {
limits: {
cpu: "500m",
memory: "128Mi",
// ...(params.limits ?? {}),
...(params.limits ?? {}),
},
requests: {
cpu: "5m",
memory: "16Mi",
// ...(params.requests ?? {}),
...(params.requests ?? {}),
},
},
startupProbe: {
Expand Down

0 comments on commit 25f7ae5

Please sign in to comment.