Skip to content

Commit

Permalink
Merge pull request #3 from njtran/kindAction
Browse files Browse the repository at this point in the history
shellbash
  • Loading branch information
njtran authored May 3, 2024
2 parents 0e406e5 + 7953596 commit b4c7050
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 26 deletions.
31 changes: 12 additions & 19 deletions .github/workflows/test-kind.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:
workflow_dispatch:
jobs:
presubmit:
test-kind:
permissions:
issues: write
runs-on: ubuntu-latest
Expand All @@ -20,39 +20,27 @@ jobs:
- name: Kind Cluster
uses: helm/[email protected]
- name: check kind cluster
shell: bash
run: |
kubectl config current-context
kubectl get nodes
- name: Enable the actionlint matcher
shell: bash
run: echo "::add-matcher::.github/actionlint-matcher.json"
- run: K8S_VERSION=${{ matrix.k8sVersion }} make presubmit
- name: Send coverage
# should only send converage once https://docs.coveralls.io/parallel-builds
if: matrix.k8sVersion == '1.29.x'
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: goveralls -coverprofile=coverage.out -service=github
- name: install pyroscope dependency
shell: bash
run: |
curl -fL https://github.com/grafana/pyroscope/releases/download/v1.1.5/profilecli_1.1.5_linux_amd64.tar.gz | tar xvz
chmod +x profilecli
sudo mv profilecli /usr/local/bin
- name: test
run: |
kubectl cluster-info
kubectl get storageclass standard
ls
echo $github_workspace
echo "checking karpenter folder"
mv ./Makefile_substitute ./karpenter/Makefile
ls ./karpenter/
cd ./karpenter/
- name: install kwok and controller
shell: bash
run: |
make toolchain
make install-kwok
KWOK_REPO=kind.local make apply
KWOK_REPO=kind.local KIND_CLUSTER_NAME=chart-testing make apply-with-kind
- name: install prometheus and grafana
shell: bash
run: |
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add grafana https://grafana.github.io/helm-charts
Expand All @@ -66,6 +54,7 @@ jobs:
echo "Installed prometheus"
kubectl --namespace prometheus get pods -l "release=prometheus"
- name: enable profiling
shell: bash
run: |
kubectl annotate -n kube-system pods profiles.grafana.com/memory.scrape="true" -l app.kubernetes.io/name="karpenter"
kubectl annotate -n kube-system pods profiles.grafana.com/memory.port="8000" -l app.kubernetes.io/name="karpenter"
Expand All @@ -77,6 +66,7 @@ jobs:
kubectl annotate -n kube-system pods profiles.grafana.com/goroutine.port="8000" -l app.kubernetes.io/name="karpenter"
# Testing out pyroscope for profiling
- name: apply pyroscope
shell: bash
run: |
helm -n kube-system install pyroscope grafana/pyroscope
#Setup Metrics Endpoint
Expand All @@ -99,6 +89,7 @@ jobs:
path: /metrics
EOF
- name: apply nodepool
shell: bash
run: |
# Setup node pool
cat <<EOF | envsubst | kubectl apply -f -
Expand Down Expand Up @@ -128,11 +119,13 @@ jobs:
expireAfter: 720h # 30 * 24h = 720h
EOF
- name: ping cluster
shell: bash
run: |
kubectl get pods -n kube-system | grep karpenter
kubectl get nodepools
kubectl get pods -A
- name: cleanup
shell: bash
run: |
kubectl delete nodepools --all
make delete
Expand Down
8 changes: 1 addition & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ uninstall-kwok: ## Uninstall kwok provider
UNINSTALL_KWOK=true ./hack/install-kwok.sh

build-with-kind:
$(eval CONTROLLER_IMG=$(shell $(WITH_GOFLAGS) KO_DOCKER_REPO="$(KWOK_REPO)" ko build -B sigs.k8s.io/karpenter/kwok))
$(eval CONTROLLER_IMG=$(shell $(WITH_GOFLAGS) KO_DOCKER_REPO="$(KWOK_REPO)" ko build sigs.k8s.io/karpenter/kwok))
$(eval IMG_REPOSITORY=$(shell echo $(CONTROLLER_IMG) | cut -d "@" -f 1 | cut -d ":" -f 1))
$(eval IMG_TAG=latest)

Expand Down Expand Up @@ -96,12 +96,6 @@ verify: ## Verify code. Includes codegen, docgen, dependencies, linting, formatt
go vet ./...
cd kwok/charts && helm-docs
golangci-lint run
@git diff --quiet ||\
{ echo "New file modification detected in the Git working tree. Please check in before commit."; git --no-pager diff --name-only | uniq | awk '{print " - " $$0}'; \
if [ "${CI}" = true ]; then\
exit 1;\
fi;}
actionlint -oneline

download: ## Recursively "go mod download" on all directories where go.mod exists
$(foreach dir,$(MOD_DIRS),cd $(dir) && go mod download $(newline))
Expand Down
1 change: 1 addition & 0 deletions hack/toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ tools() {
go install github.com/google/go-licenses@latest
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go install github.com/mikefarah/yq/v4@latest
go install github.com/google/ko@latest
go install github.com/norwoodj/helm-docs/cmd/helm-docs@latest
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
go install sigs.k8s.io/controller-tools/cmd/controller-gen@latest
Expand Down

0 comments on commit b4c7050

Please sign in to comment.