Skip to content

Commit

Permalink
Merge pull request #254 from aws-samples/feature/devContainers
Browse files Browse the repository at this point in the history
Feature to introduce Dev Containers to Conformitron
  • Loading branch information
shapirov103 authored May 2, 2024
2 parents 72c213b + e0cf924 commit e01753d
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
25 changes: 25 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).
Expand Down

0 comments on commit e01753d

Please sign in to comment.