# 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: v1
kind: Pod
metadata:
  labels:
    component: oap
  name: data-generator
  namespace: default
spec:
  containers:
  - env:
    - name: JAVA_OPTS
      value: -Xmx2g -Xms2g
    - name: SW_STORAGE
      value: banyandb
    - name: SW_STORAGE_BANYANDB_TARGETS
      value: banyandb-grpc:17912
    image: ghcr.io/apache/skywalking/data-generator:9b17ff1efeab7a20c870839f59eb0e6af485cd3f
    imagePullPolicy: IfNotPresent
    livenessProbe:
      failureThreshold: 3
      initialDelaySeconds: 5
      periodSeconds: 10
      successThreshold: 1
      tcpSocket:
        port: 12800
      timeoutSeconds: 1
    name: oap
    ports:
    - containerPort: 11800
      name: grpc
      protocol: TCP
    - containerPort: 12800
      name: rest
      protocol: TCP
      hostPort: 12800
    readinessProbe:
      failureThreshold: 3
      initialDelaySeconds: 5
      periodSeconds: 10
      successThreshold: 1
      tcpSocket:
        port: 12800
      timeoutSeconds: 1
    resources: {}
    startupProbe:
      failureThreshold: 9
      periodSeconds: 10
      successThreshold: 1
      tcpSocket:
        port: 12800
      timeoutSeconds: 1
  dnsPolicy: ClusterFirst
  enableServiceLinks: true
  initContainers:
  - command:
    - sh
    - -c
    - for i in $(seq 1 60); do curl banyandb-http:17913/api/healthz && exit 0 || sleep 5; done; exit 1
    image: curlimages/curl
    imagePullPolicy: IfNotPresent
    name: wait-for-banyandb
    resources: {}
