# README

CICD steps involved in the manual smoking tests:

1. Applying CRD manifests
1. Applying Provider type EKS to the cluster
1. Applying Provider EKS to the cluster

# Development

## Bring up pulumi stack locally
To bring up pulumi stack locally, you need to ensure:
1. Binaries docker, pulumi and kind are installed locally
2. Docker has already logged into AWS ECR.
3. Ensure you have "127.0.0.1	api-server.infra" in your `/etc/hosts` file
4. Setup AWS credentials
5. Config root config under `pulumi/eks-provider/root-cfg.yaml`.
6. Place eks cluster kubeconfig under `pulumi/eks-provider/eks.config`.

For the root config, you can take `examples/eks-provider/config.yaml` for reference.

If you haven't logged into ECR, you can do following:
```bash
aws-vault exec dev --no-session --region us-west-2 -- aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin 385595570414.dkr.ecr.us-west-2.amazonaws.com
```

To bring up the pulumi stack locally, you can do:
```bash
make kind-up
make pulumi-up
```

To cleanup the test environment, you can do:
```bash
make kind-down
```

To get the infra-api cluster kubeconfig, you can do:
```bash
kubectl -n infra get secret api-server-kubeconfig --template={{.data.config}} | base64 -D > infra.config
```

To setup AWS credentials, you can do:
```bash
pulumi config set --secret AWS_ACCESS_KEY_ID --stack xaccount-dev
pulumi config set --secret AWS_SECRET_ACCESS_KEY --stack xaccount-dev
```

## Update configurations
To avoid checkin credentials, the pulumi config file Pulumi.xaccount-dev.yaml is skipped.
If you need to update and checkin the pulumi configs, you can do this:
```bash
git update-index --no-skip-worktree Pulumi.xaccount-dev.yaml
```

After commit, you need to ignore the file:
```
git update-index --skip-worktree Pulumi.xaccount-dev.yaml
```
And then you can setup pulumi credentials.

