Skip to content

Commit

Permalink
Remove janitor component (#312)
Browse files Browse the repository at this point in the history
* Remove janitor component

With the new version of parca, database files are structured differently and we can't apply
the janitor's naive logic for implementing retention for parca data anymore.
The component is dropped accordingly.

* Don't deploy profiling setup by default
  • Loading branch information
timebertt authored Aug 13, 2024
1 parent 012d1f4 commit ca8f70b
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 196 deletions.
1 change: 0 additions & 1 deletion .github/workflows/images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:
entrypoints=(
./cmd/sharder
./cmd/shard
./hack/cmd/janitor
./webhosting-operator/cmd/experiment
./webhosting-operator/cmd/webhosting-operator
)
Expand Down
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ TAG ?= latest
GHCR_REPO ?= ghcr.io/timebertt/kubernetes-controller-sharding
SHARDER_IMG ?= $(GHCR_REPO)/sharder:$(TAG)
SHARD_IMG ?= $(GHCR_REPO)/shard:$(TAG)
JANITOR_IMG ?= $(GHCR_REPO)/janitor:$(TAG)
WEBHOSTING_OPERATOR_IMG ?= $(GHCR_REPO)/webhosting-operator:$(TAG)
EXPERIMENT_IMG ?= $(GHCR_REPO)/experiment:$(TAG)

Expand Down Expand Up @@ -151,7 +150,7 @@ images: export KO_DOCKER_REPO = $(GHCR_REPO)
.PHONY: images
images: $(KO) ## Build and push container images using ko.
$(KO) build --push=$(PUSH) --sbom none --base-import-paths -t $(TAG) --platform linux/amd64,linux/arm64 \
./cmd/sharder ./cmd/shard ./hack/cmd/janitor ./webhosting-operator/cmd/webhosting-operator
./cmd/sharder ./cmd/shard ./webhosting-operator/cmd/webhosting-operator

##@ Deployment

Expand All @@ -178,7 +177,7 @@ up dev: export SKAFFOLD_TAIL ?= true

.PHONY: deploy
deploy: $(SKAFFOLD) $(KUBECTL) $(YQ) ## Build all images and deploy everything to K8s cluster specified in $KUBECONFIG.
$(SKAFFOLD) deploy -i $(SHARDER_IMG) -i $(SHARD_IMG) -i $(JANITOR_IMG) -i $(WEBHOSTING_OPERATOR_IMG) -i $(EXPERIMENT_IMG)
$(SKAFFOLD) deploy -i $(SHARDER_IMG) -i $(SHARD_IMG) -i $(WEBHOSTING_OPERATOR_IMG) -i $(EXPERIMENT_IMG)

.PHONY: up
up: $(SKAFFOLD) $(KUBECTL) $(YQ) ## Build all images, deploy everything to K8s cluster specified in $KUBECONFIG, start port-forward and tail logs.
Expand Down
20 changes: 18 additions & 2 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ NAME TYPE DATA AGE CLUSTERRING-50D858E0-EXAMPLE
secret/dummy-foo Opaque 0 3s shard-5fc87c9fb7-kfb2z
```

## Monitoring and Continuous Profiling
## Monitoring

When using the skaffold-based setup, you also get a full monitoring and continuous profiling setup for observing and analyzing the components' resource usage.
When using the skaffold-based setup, you also get a full monitoring setup for observing and analyzing the components' resource usage.

To access the monitoring dashboards and metrics in Grafana, simply forward its port and open http://localhost:3000/ in your browser:

Expand All @@ -142,10 +142,26 @@ The password for Grafana's `admin` user is written to `hack/config/monitoring/de

Be sure to check out the controller-runtime dashboard: http://localhost:3000/d/PuCBL3zVz/controller-runtime-controllers

## Continuous Profiling

To dig deeper into the components' resource usage, you can deploy the continuous profiling setup based on [Parca](https://parca.dev/):

```bash
make up SKAFFOLD_MODULE=profiling SKAFFOLD_PROFILE=profiling
```

To access the profiling data in Parca, simply forward its port and open http://localhost:7070/ in your browser:

```bash
kubectl -n parca port-forward svc/parca 7070 &
```

For accessing Parca through its `Ingress`, use the basic auth password for the `parca` user from `hack/config/profiling/parca_password.secret.txt`.

Note that the Parca deployment doesn't implement retention for profiling data.
I.e., the Parca data volume will grow infinitely as long as Parca is running.
To shut down Parca after analyzing the collected profiles and destroying the persistent volume use the following command:

```bash
make down SKAFFOLD_MODULE=profiling SKAFFOLD_PROFILE=profiling
```
98 changes: 0 additions & 98 deletions hack/cmd/janitor/main.go

This file was deleted.

51 changes: 0 additions & 51 deletions hack/config/profiling/janitor_cronjob.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions hack/config/profiling/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ resources:
# grant parca running in namespace "parca" permissions required for service discovery in namespace
# "sharding-system" and scrape the pprof endpoints of sharder
- rbac_sharder.yaml
- janitor_cronjob.yaml

images:
- name: janitor
newName: ghcr.io/timebertt/kubernetes-controller-sharding/janitor
newTag: latest

generatorOptions:
disableNameSuffixHash: true
Expand Down
59 changes: 24 additions & 35 deletions hack/config/skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -282,41 +282,30 @@ apiVersion: skaffold/v4beta10
kind: Config
metadata:
name: profiling
build:
artifacts:
- image: ghcr.io/timebertt/kubernetes-controller-sharding/janitor
ko:
dependencies:
paths:
- go.mod
- ./hack/cmd/janitor/**/*.go
main: ./hack/cmd/janitor
tagPolicy:
inputDigest: {}
local:
concurrency: 0
manifests:
kustomize:
paths:
- hack/config/profiling
hooks:
before:
- host:
command:
- hack/config/profiling/ensure-admin-password.sh
deploy:
kubectl:
flags:
apply:
- --server-side
- --force-conflicts
defaultNamespace: ""
portForward:
- resourceType: service
resourceName: parca
namespace: parca
port: http
localPort: 7071
profiles:
- name: profiling
manifests:
kustomize:
paths:
- hack/config/profiling
hooks:
before:
- host:
command:
- hack/config/profiling/ensure-admin-password.sh
deploy:
kubectl:
flags:
apply:
- --server-side
- --force-conflicts
defaultNamespace: ""
portForward:
- resourceType: service
resourceName: parca
namespace: parca
port: http
localPort: 7071
---
apiVersion: skaffold/v4beta10
kind: Config
Expand Down

0 comments on commit ca8f70b

Please sign in to comment.