diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..0acc631c --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,17 @@ +{ + "image": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu", + "features": { + "ghcr.io/devcontainers/features/docker-in-docker:2": {}, + "ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {}, + "ghcr.io/devcontainers/features/aws-cli:1": {} + }, + "postCreateCommand": ".devcontainer/postCreateCommand.sh", + "workspaceFolder": "/home/vscode/conformitron", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/vscode/conformitron,type=bind", + "hostRequirements": { + "cpus": 4 + }, + "remoteEnv": { + "PATH": "${containerEnv:PATH}:/home/vscode/conformitron" + } +} \ No newline at end of file diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh new file mode 100755 index 00000000..0420d84c --- /dev/null +++ b/.devcontainer/postCreateCommand.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# Step 1 setup autocomplete for kubectl and alias k +mkdir $HOME/.kube +echo "source <(kubectl completion bash)" >> $HOME/.bashrc +echo "alias k=kubectl" >> $HOME/.bashrc +echo "complete -F __start_kubectl k" >> $HOME/.bashrc + +# Step 2 - Installs Flux on your local machine. +echo "----------------------------------------------------" +echo "Downloading 'Flux' ..." +curl -O "https://toolkit.Fluxcd.io/install.sh" --silent --location +echo "Installing 'Flux' ..." +chmod +x ./install.sh +./install.sh +rm -rf ./install.sh + +# Step 3 Setup Minikube +minikube start + +# Step 4 - Installs Flux Controller on your Kubernetes Cluster. +flux install \ + --namespace=flux-system \ + --network-policy=false \ + --components=source-controller,helm-controller,kustomize-controller,notification-controller \ No newline at end of file diff --git a/README.md b/README.md index f96b01f9..1d722358 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,8 @@ Refer the example [here](https://github.com/aws-samples/eks-anywhere-addons/blob ## Pre-requisite (Linux/MacOS) +Please use the dev container configuration in the `.devcontainer` folder with [devpod](devpod.sh) or any other dev container environment to create minikube cluster with all the required pre-requisites such as helm, kubectl and flux for local testing. You can skip over to the local testing section if you use dev container environment. + This solution requires Flux CLI locally and Flux Controller on your Kubernetes cluster. Flux requires access to a source repository via api and access to the kubernetes cluster you want to use for testing. Please follow the below steps for installing these pre-requisites. If you do not already have access to a running kubernetes cluster you can consider setting up an [EKS Anywhere local cluster](https://anywhere.eks.amazonaws.com/docs/getting-started/local-environment/) on docker provider or a local [k3s](https://k3s.io/) cluster or you may choose a hosted service such as [AWS EKS](https://aws.amazon.com/eks/).