-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f8b5d4
commit e21500d
Showing
31 changed files
with
994 additions
and
542 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
### Go template | ||
# If you prefer the allow list template instead of the deny list, see community template: | ||
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore | ||
# | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
# Go workspace file | ||
go.work | ||
|
||
chart | ||
.github | ||
.gitignore | ||
scripts | ||
img | ||
Dockerfile | ||
DockerfileDebug | ||
README.md | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: ci | ||
|
||
on: | ||
pull_request: | ||
|
||
|
||
jobs: | ||
e2e: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21' | ||
- name: Create k8s Kind Cluster | ||
uses: helm/kind-action@v1.7.0 | ||
with: | ||
install_only: true | ||
- uses: azure/setup-helm@v3 | ||
- name: Run e2e | ||
run: | | ||
make deploy_e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
FROM golang:1.19.2 as builder | ||
FROM golang:1.21 as builder | ||
|
||
WORKDIR /code | ||
|
||
COPY . . | ||
|
||
RUN go mod download | ||
RUN go build -gcflags="all=-N -l" -o /app main.go | ||
|
||
RUN go install github.com/go-delve/delve/cmd/dlv@latest | ||
RUN go build -gcflags="all=-N -l" -o /app main.go | ||
|
||
FROM debian:buster | ||
ENV GOTRACEBACK=single | ||
FROM nicolaka/netshoot:latest | ||
ENV GOTRACEBACK=crash | ||
WORKDIR / | ||
COPY --from=builder /app . | ||
COPY --from=builder /go/bin/dlv . | ||
|
||
ENTRYPOINT ["/dlv", "exec", "--listen=:56268", "--headless=true", "--api-version=2", "--accept-multiclient", "/app"] | ||
ENV LOG_LEVEL=debug | ||
EXPOSE 9999 | ||
|
||
ENTRYPOINT ["/dlv", "exec", "--listen=:9999", "--headless=true", "--api-version=2", "--accept-multiclient", "/app"] | ||
#ENTRYPOINT ["/dlv", "exec", "--listen=:9999", "--headless=true", "--api-version=2", "--accept-multiclient", "/app"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM ubuntu:22.04 | ||
RUN apt-get update -y && apt-get install watch | ||
|
||
COPY tests/scripts/growing_epheremal_storage.sh growing_epheremal_storage.sh | ||
|
||
SHELL ["/usr/bin/bash", "-c"] | ||
ENTRYPOINT ["./growing_epheremal_storage.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM ubuntu:22.04 | ||
RUN apt-get update -y && apt-get install watch | ||
|
||
COPY tests/scripts/shrinking_epheremal_storage.sh shrinking_epheremal_storage.sh | ||
|
||
SHELL ["/usr/bin/bash", "-c"] | ||
ENTRYPOINT ["./shrinking_epheremal_storage.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# K8s Ephemeral Storage Metrics. | ||
|
||
|
||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) | ||
[![Actions Status](https://github.com/jmcgrath207/k8s-ephemeral-storage-metrics/workflows/ci/badge.svg)](https://github.com/jmcgrath207/k8s-ephemeral-storage-metrics/actions) | ||
|
||
The goal of this project is to export ephemeral storage metric usage per pod to Prometheus that is address in this | ||
issue [Here](https://github.com/kubernetes/kubernetes/issues/69507) | ||
|
||
Currently, this image is not being hosted and so you have to build it yourself at the moment. | ||
|
||
|
||
![main image](img/screenshot.png) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
.EXPORT_ALL_VARIABLES: | ||
|
||
GITROOT ?= $(shell pwd) | ||
DEPLOYMENT_NAME = ephemeral-metrics | ||
K8S_VERSION ?= 1.26.0 | ||
|
||
## Location to install dependencies to | ||
LOCALBIN ?= $(shell pwd)/bin | ||
$(LOCALBIN): | ||
mkdir -p $(LOCALBIN) | ||
|
||
|
||
ginkgo: | ||
test -s $(LOCALBIN)/ginkgo || GOBIN=$(LOCALBIN) go install github.com/onsi/ginkgo/v2/ginkgo@v2.9.7 | ||
|
||
.PHONY: fmt | ||
fmt: ## Run go fmt against code. | ||
go fmt ./... | ||
|
||
.PHONY: vet | ||
vet: ## Run go vet against code. | ||
go vet ./... | ||
|
||
helm-docs: | ||
test -s $(LOCALBIN)/helm-docs || GOBIN=$(LOCALBIN) go install github.com/norwoodj/helm-docs/cmd/helm-docs@latest | ||
$(LOCALBIN)/helm-docs --template-files "${GITROOT}/chart/README.md.gotmpl" | ||
cat "${GITROOT}/Header.md" "${GITROOT}/chart/README.md" > "${GITROOT}/README.md" | ||
|
||
create_kind: | ||
./scripts/create_kind.sh | ||
|
||
init: fmt vet | ||
|
||
deploy_debug: init | ||
ENV='debug' ./scripts/deploy.sh | ||
|
||
deploy_e2e_debug: init | ||
ENV='e2e-debug' ./scripts/deploy.sh | ||
|
||
deploy_local: init | ||
./scripts/deploy.sh | ||
|
||
deploy_e2e: init ginkgo | ||
ENV='e2e' ./scripts/deploy.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ | |
.idea/ | ||
*.tmproj | ||
.vscode/ | ||
README.md.gotmpl |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
## Helm Install | ||
|
||
```bash | ||
helm repo add par https://jmcgrath207.github.io/par/chart | ||
helm install par par/Par | ||
``` | ||
|
||
## Values | ||
|
||
| Key | Type | Default | Description | | ||
|-----|------|---------|-------------| | ||
| deploy_type | string | `"DaemonSet"` | | | ||
| image.imagePullPolicy | string | `"ifNotPresent"` | | | ||
| image.repository | string | `"registry.lab.com/k8s-ephemeral-storage-metrics"` | | | ||
| image.tag | string | `""` | | | ||
| interval | string | `"15s"` | | | ||
| log_level | string | `"info"` | | | ||
| prometheus.release | string | `"kube-prometheus"` | | | ||
|
||
## Contribute | ||
|
||
### Run locally | ||
```bash | ||
make deploy_local | ||
``` | ||
|
||
### Run locally with Delve Debug | ||
```bash | ||
make deploy_debug | ||
``` | ||
Then connect to `localhost:30002` with [delve](https://github.com/go-delve/delve) or your IDE. | ||
|
||
### Run e2e Test | ||
```bash | ||
make deploy_e2e | ||
``` | ||
|
||
### Debug e2e | ||
```bash | ||
make deploy_e2e_debug | ||
``` | ||
Then run a debug against [deployment_test.go](tests/e2e/deployment_test.go) | ||
|
||
## License | ||
|
||
This project is licensed under the [MIT License](https://opensource.org/licenses/MIT). See the `LICENSE` file for more details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
## Helm Install | ||
|
||
{{ template "chart.valuesSection" . }} | ||
|
||
## Contribute | ||
|
||
### Run locally | ||
```bash | ||
make deploy_local | ||
``` | ||
|
||
### Run locally with Delve Debug | ||
```bash | ||
make deploy_debug | ||
``` | ||
Then connect to `localhost:30002` with [delve](https://github.com/go-delve/delve) or your IDE. | ||
|
||
### Run e2e Test | ||
```bash | ||
make deploy_e2e | ||
``` | ||
|
||
### Debug e2e | ||
```bash | ||
make deploy_e2e_debug | ||
``` | ||
Then run a debug against [deployment_test.go](tests/e2e/deployment_test.go) | ||
|
||
## License | ||
|
||
This project is licensed under the [MIT License](https://opensource.org/licenses/MIT). See the `LICENSE` file for more details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.