diff --git a/deploymentFiles/apiGatewayCanary.yaml b/deploymentFiles/apiGatewayCanary.yaml new file mode 100644 index 00000000..944a7df3 --- /dev/null +++ b/deploymentFiles/apiGatewayCanary.yaml @@ -0,0 +1,48 @@ +apiVersion: flagger.app/v1beta1 +kind: Canary +metadata: + name: api-gateway + namespace: default +spec: + provider: istio + targetRef: + apiVersion: apps/v1 + kind: Deployment + name: api-gateway + progressDeadlineSeconds: 60 + autoscalerRef: + apiVersion: autoscaling/v2beta1 + kind: HorizontalPodAutoscaler + name: api-gateway + service: + name: api-gateway + port: 3001 + targetPort: 3001 + # 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..a7b7abc0 --- /dev/null +++ b/deploymentFiles/deployment.yaml @@ -0,0 +1,37 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: api-gateway + labels: + app: api-gateway +spec: + minReadySeconds: 5 + revisionHistoryLimit: 5 + progressDeadlineSeconds: 60 + strategy: + rollingUpdate: + maxUnavailable: 1 + type: RollingUpdate + selector: + matchLabels: + app: api-gateway + template: + metadata: + labels: + app: api-gateway + spec: + containers: + - name: api-gateway + image: orenda15/api_gateway:8d707fba79a2ad396d8619a9463f358dda5acc82 + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: 3001 + 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..e37e4133 --- /dev/null +++ b/deploymentFiles/hpa.yaml @@ -0,0 +1,18 @@ +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: api-gateway +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: api-gateway + 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