diff --git a/.github/workflows/developer-environment-operator.yaml b/.github/workflows/developer-environment-operator.yaml new file mode 100644 index 0000000..e9f2f8d --- /dev/null +++ b/.github/workflows/developer-environment-operator.yaml @@ -0,0 +1,42 @@ +name: Build Developer Environment Operator +on: + push: + branches: + - main + paths: + - 'devenv-operator/**' + pull_request: + branches: + - main + paths: + - 'devenv-operator/**' + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: '1.22' + - name: Change directory to devenv-operator + run: cd devenv-operator + - run: pwd + - name: Build + run: make build + - name: Test + run: go test ./... -coverprofile cover.out + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push image + run: make docker-build docker-push + + + diff --git a/devenv-operator/Dockerfile b/devenv-operator/Dockerfile index c389c09..fabd5b3 100644 --- a/devenv-operator/Dockerfile +++ b/devenv-operator/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM golang:1.20 as builder +FROM golang:1.22 as builder ARG TARGETOS ARG TARGETARCH diff --git a/devenv-operator/Makefile b/devenv-operator/Makefile index b963407..2454c10 100644 --- a/devenv-operator/Makefile +++ b/devenv-operator/Makefile @@ -51,7 +51,7 @@ endif OPERATOR_SDK_VERSION ?= v1.33.0 # Image URL to use all building/pushing image targets -IMG ?= controller:latest +IMG ?= ghcr.io/adityajoshi12/devenv-operator:0.1 # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. ENVTEST_K8S_VERSION = 1.27.1 diff --git a/devenv-operator/start.sh b/devenv-operator/start.sh index 9348f9f..ec445b1 100644 --- a/devenv-operator/start.sh +++ b/devenv-operator/start.sh @@ -1,16 +1,13 @@ #!/usr/bin/env bash -#kind create cluster --config kind-config.yaml -#sleep 10 - -#kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml - -#kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.16.2/cert-manager.yaml -kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/refs/heads/main/deploy/static/provider/do/deploy.yaml -kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.16.2/cert-manager.yaml - -#kubectl patch deployment ingress-nginx-controller -n ingress-nginx --type=json -p='[{"op": "remove", "path": "/spec/template/spec/tolerations"}]' -#kubectl patch deployment ingress-nginx-controller -n ingress-nginx --type=json -p='[{"op": "remove", "path": "/spec/template/spec/nodeSelector"}]' -# -# -#echo "127.0.0.1 echoserver.local" | sudo tee -a /etc/hosts +# when running in KindCluster +if [ -z "$1" ]; then + kind create cluster --config kind-config.yaml + sleep 10 + kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml + kubectl patch deployment ingress-nginx-controller -n ingress-nginx --type=json -p='[{"op": "remove", "path": "/spec/template/spec/tolerations"}]' + kubectl patch deployment ingress-nginx-controller -n ingress-nginx --type=json -p='[{"op": "remove", "path": "/spec/template/spec/nodeSelector"}]' +else + kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/refs/heads/main/deploy/static/provider/do/deploy.yaml + kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.16.2/cert-manager.yaml +fi