#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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: StatefulSet
metadata:
  name: kylin-receiver
  namespace: kylin-prod
spec:
  serviceName: receiver-svc
  replicas: 2
  selector:
    matchLabels:
      app: kylin
      role: receiver
  template:
    metadata:
      labels:
        app: kylin
        role: receiver
    spec:
      securityContext:
        fsGroup: 996
      containers:
      - name: kylin
        image: kylin-client:{VERSION}
        imagePullPolicy: IfNotPresent
        command:
        - sh
        - -c
        args:
        - $TOOL_HOME/bootstrap.sh streaming
        ports:
        - containerPort: 9090
        volumeMounts:
        - name: kylin-receiver-config
          mountPath: /home/apache_kylin/kylin/conf
        - name: receiver-volume
          mountPath: /home/apache_kylin/kylin/stream_index
        resources:
          requests:
            memory: 24Gi
            cpu: 12
          limits:
            memory: 24Gi
            cpu: 12
      volumes:
        - configMap:
            name: hadoop-config
          name: hadoop-config
        - configMap:
            name: hive-config
          name: hive-config
        - configMap:
            name: hbase-config
          name: hbase-config
        - configMap:
            name: kylin-receiver-config
          name: kylin-receiver-config
  volumeClaimTemplates:
  - metadata:
      name: receiver-volume
    spec:
      accessModes: 
        - ReadWriteOnce
      resources:
        requests:
          storage: 20Gi
      storageClassName: local-dynamic