From 03b3bfa2f4f1ea11eed7f2f477b7b884794bcfc1 Mon Sep 17 00:00:00 2001 From: ssube Date: Sun, 23 Jun 2019 23:00:01 -0500 Subject: [PATCH] fix: apply schema changes to data --- rules/kubernetes.yml | 14 ++++---------- src/index.ts | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/rules/kubernetes.yml b/rules/kubernetes.yml index a3b162b..bab152d 100644 --- a/rules/kubernetes.yml +++ b/rules/kubernetes.yml @@ -23,11 +23,8 @@ rules: required: [cpu, memory] properties: cpu: &resources-cpu - oneOf: - - type: number - minimum: 1 - - type: string - pattern: "[1-9][0-9]*m" + type: string + default: 500m memory: &resources-memory oneOf: - type: number @@ -66,11 +63,8 @@ rules: type: object properties: cpu: - oneOf: - - type: number - minimum: 1 - - type: string - pattern: "[1-9][0-9]{2,}m" + type: string + default: 500m - name: kubernetes-deployment-replicas desc: deployments must specify a positive replica count diff --git a/src/index.ts b/src/index.ts index a29581b..0c16f80 100644 --- a/src/index.ts +++ b/src/index.ts @@ -131,7 +131,7 @@ export async function main(argv: Array): Promise { if (Array.isArray(itemDiff) && itemDiff.length > 0) { logger.info({ diff: itemDiff, item, rule }, 'rule passed with modifications'); - applyDiff(item, itemDiff); + applyDiff(item, itemCopy); } else { logger.info({ rule }, 'rule passed'); }