apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  annotations:
    helm.sh/hook: test-success
    helm.sh/hook-delete-policy: hook-succeeded
  name: helm-test-vela-app
spec:
  components:
    - name: helm-test-express-server
      type: webservice
      properties:
        image: crccheck/hello-world
        port: 8000
      # traits:
      #   - type: ingress
      #     properties:
      #       domain: testsvc.example.com
      #       http:
      #         "/": 8000
# ---
# apiVersion: v1
# kind: Pod
# metadata:
#   name: "{{ .Release.Name }}-application-test"
#   annotations:
#     "helm.sh/hook": test
#     helm.sh/hook-delete-policy: hook-succeeded
# spec:
#   serviceAccountName: kubevela-vela-core
#   containers:
#     - name: {{ .Release.Name }}-application-test
#       image: alpine/k8s:1.18.2
#       imagePullPolicy: IfNotPresent
#       command:
#         - /bin/bash
#         - -ec
#         - |

#           set -e

#           echo "Waiting application is ready..."

#           echo "waiting for application being Ready"
#           kubectl -n vela-system wait --for=condition=Ready applications.core.oam.dev helm-test-vela-app --timeout=3m
#           echo "application is Ready"

#           # wait for deploy being created
#           echo "waiting for deployment being available"
#           kubectl -n vela-system wait --for=condition=available deployments helm-test-express-server --timeout 3m
#           echo "deployment being available"

#           # wait for ingress being created
#           while ! [ `kubectl -n vela-system get ing helm-test-express-server | grep -v NAME | wc -l` = 1 ]; do
#             echo "waiting for ingress being created"
#             sleep 1
#           done



#           echo "Application and its components are created"
#   restartPolicy: Never