From 7029f6387d4a170bc1ed6ac3c91bf8a1bc0f5e03 Mon Sep 17 00:00:00 2001 From: milan Date: Fri, 1 May 2020 21:31:47 -0400 Subject: [PATCH] #198 #199 adding canary deployment and editing data retrieval service --- dataRetrieval/deployment.yaml | 41 -------------------- deploymentFiles/dataretrievalCanary.yaml | 48 ++++++++++++++++++++++++ deploymentFiles/deployment.yaml | 37 ++++++++++++++++++ deploymentFiles/hpa.yaml | 18 +++++++++ 4 files changed, 103 insertions(+), 41 deletions(-) delete mode 100644 dataRetrieval/deployment.yaml create mode 100644 deploymentFiles/dataretrievalCanary.yaml create mode 100644 deploymentFiles/deployment.yaml create mode 100644 deploymentFiles/hpa.yaml diff --git a/dataRetrieval/deployment.yaml b/dataRetrieval/deployment.yaml deleted file mode 100644 index 04aa4716..00000000 --- a/dataRetrieval/deployment.yaml +++ /dev/null @@ -1,41 +0,0 @@ ---- -kind: Service -apiVersion: v1 -metadata: - name: dataretrievalservice -spec: - selector: - app: data-retrieval - ports: - # - protocol: "TCP" - - name: http - # Port accessible inside cluster - port: 3006 - # Port to forward to inside the pod - # targetPort: 5012 - # # Port accessible outside cluster - # nodePort: 30006 - # type: LoadBalancer - # type: LoadBalancer - - ---- -apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 -kind: Deployment -metadata: - name: data-retrieval-deployment -spec: - selector: - matchLabels: - app: data-retrieval - replicas: 1 # tells deployment to run 2 pods matching the template - template: - metadata: - labels: - app: data-retrieval - spec: - containers: - - name: data-retrieval - image: orenda15/data_retrieval:d10ef75851ac0d59edfda56b34dc3482d5cb1fc2 - ports: - - containerPort: 3006 diff --git a/deploymentFiles/dataretrievalCanary.yaml b/deploymentFiles/dataretrievalCanary.yaml new file mode 100644 index 00000000..90bf90d2 --- /dev/null +++ b/deploymentFiles/dataretrievalCanary.yaml @@ -0,0 +1,48 @@ +apiVersion: flagger.app/v1beta1 +kind: Canary +metadata: + name: data-retrieval + namespace: default +spec: + provider: istio + targetRef: + apiVersion: apps/v1 + kind: Deployment + name: data-retrieval + progressDeadlineSeconds: 60 + autoscalerRef: + apiVersion: autoscaling/v2beta1 + kind: HorizontalPodAutoscaler + name: data-retrieval + service: + name: data-retrieval + port: 3006 + targetPort: 3006 + # portName: http + portDiscovery: true + timeout: 5s + # gateways: + # - orenda-gateway + # hosts: + # - '*' + skipAnalysis: false + analysis: + interval: 10s + threshold: 10 + maxWeight: 50 + stepWeight: 5 + # metrics: + # - name: request-success-rate + # thresholdRange: + # min: 99 + # interval: 1m + # - name: latency + # templateRef: + # name: latency + # namespace: istio-system + # thresholdRange: + # max: 500 + # interval: 1m + + + \ No newline at end of file diff --git a/deploymentFiles/deployment.yaml b/deploymentFiles/deployment.yaml new file mode 100644 index 00000000..e703adee --- /dev/null +++ b/deploymentFiles/deployment.yaml @@ -0,0 +1,37 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: data-retrieval + labels: + app: data-retrieval +spec: + minReadySeconds: 5 + revisionHistoryLimit: 5 + progressDeadlineSeconds: 60 + strategy: + rollingUpdate: + maxUnavailable: 1 + type: RollingUpdate + selector: + matchLabels: + app: data-retrieval + template: + metadata: + labels: + app: data-retrieval + spec: + containers: + - name: data-retrieval + image: orenda15/data_retrieval:9a30ef79fc57e4200423ea62e72093117afa716d + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: 3006 + protocol: TCP + resources: + limits: + cpu: 2000m + memory: 512Mi + requests: + cpu: 100m + memory: 64Mi \ No newline at end of file diff --git a/deploymentFiles/hpa.yaml b/deploymentFiles/hpa.yaml new file mode 100644 index 00000000..daa17d12 --- /dev/null +++ b/deploymentFiles/hpa.yaml @@ -0,0 +1,18 @@ +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: frontend +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: frontend + minReplicas: 2 + maxReplicas: 4 + metrics: + - type: Resource + resource: + name: cpu + # scale up if usage is above + # 99% of the requested CPU (100m) + targetAverageUtilization: 99 \ No newline at end of file