# Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: wso2apim
  namespace: wso2
spec:
  replicas: 1
  selector:
    matchLabels:
      deployment: wso2apim
  minReadySeconds: 30
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
  template:
    metadata:
      labels:
        deployment: wso2apim
    spec:
      containers:
        - name: wso2apim
          image: wso2/wso2am:3.0.0
          resources:
            limits:
              memory: "2Gi"
            requests:
              memory: "2Gi"
          livenessProbe:
            exec:
              command:
                - /bin/bash
                - -c
                - nc -z localhost 32001
            initialDelaySeconds: 180
            periodSeconds: 10
          readinessProbe:
            exec:
              command:
                - /bin/bash
                - -c
                - nc -z localhost 32001
            initialDelaySeconds: 180
            periodSeconds: 10
          imagePullPolicy: IfNotPresent
          ports:
            - #8280 with port off set 22558
              containerPort: 30838
              protocol: "TCP"
            - #8243 with port off set 22558
              containerPort: 30801
              protocol: "TCP"
            - #9763 with port off set 22558
              containerPort: 32321
              protocol: "TCP"
            - #9443 with port off set 22558
              containerPort: 32001
              protocol: "TCP"
            - #5672 with port off set 22558
              containerPort: 28230
              protocol: "TCP"
            - #9711 with port off set 22558
              containerPort: 32269
              protocol: "TCP"
            - #9611 with port off set 22558
              containerPort: 32169
              protocol: "TCP"
            - #7711 with port off set 22558
              containerPort: 30269
              protocol: "TCP"
            - #7611 with port off set 22558
              containerPort: 30169
              protocol: "TCP"
          volumeMounts:
            - name: apim-conf
              mountPath: /home/wso2carbon/wso2-config-volume/repository/conf
      hostAliases:
        - ip: "127.0.0.1"
          hostnames:
            - "wso2apim"
      volumes:
        - name: apim-conf
          configMap:
            name: apim-conf