apiVersion: testsys.system/v1
kind: Test
metadata:
  name: ${CLUSTER_NAME}-test
  namespace: testsys
spec:
  agent:
    name: k8s-workload-agent
    image: ${K8S_WORKLOAD_AGENT_IMAGE_URI}
    keepRunning: true
    configuration:
      kubeconfigBase64: \${${CLUSTER_NAME}.encodedKubeconfig}
      assumeRole: ${ASSUME_ROLE}
      tests:
      - name: ${WORKLOAD_TEST_NAME}
        image: ${WORKLOAD_TEST_IMAGE_URI}
        gpu: ${GPU}
    secrets:
      awsCredentials: aws-creds
  dependsOn: []
  resources: [${CLUSTER_NAME}-instances, ${CLUSTER_NAME}]
---
apiVersion: testsys.system/v1
kind: Resource
metadata:
  name: ${CLUSTER_NAME}
  namespace: testsys
spec:
  agent:
    name: eks-provider
    image: ${EKS_RESOURCE_AGENT_IMAGE_URI}
    keepRunning: true
    configuration:
      creationPolicy: ifNotExists
      clusterName: ${CLUSTER_NAME}
      region: ${AWS_REGION}
      assumeRole: ${ASSUME_ROLE}
      version: ${K8S_VERSION}
    secrets:
      awsCredentials: aws-creds
  dependsOn: []
  destructionPolicy: onDeletion
---
apiVersion: testsys.system/v1
kind: Resource
metadata:
  name: ${CLUSTER_NAME}-instances
  namespace: testsys
spec:
  agent:
    name: ec2-provider
    image: ${EC2_RESOURCE_AGENT_IMAGE_URI}
    keepRunning: true
    configuration:
      clusterName: \${${CLUSTER_NAME}.clusterName}
      clusterType: eks
      instanceCount: 2
      instanceProfileArn: \${${CLUSTER_NAME}.iamInstanceProfileArn}
      nodeAmi: ${BOTTLEROCKET_AMI_ID}
      region: ${AWS_REGION}
      subnetIds: \${${CLUSTER_NAME}.publicSubnetIds}
      instanceTypes: ${INSTANCE_TYPES}
      assumeRole: ${ASSUME_ROLE}
      endpoint: \${${CLUSTER_NAME}.endpoint}
      certificate: \${${CLUSTER_NAME}.certificate}
      clusterDnsIp: \${${CLUSTER_NAME}.clusterDnsIp}
      securityGroups: \${${CLUSTER_NAME}.securityGroups}
    secrets:
      awsCredentials: aws-creds
  dependsOn: [${CLUSTER_NAME}]
  destructionPolicy: onDeletion