kcp-dev / kcp

Kubernetes-like control planes for form-factors and use-cases beyond Kubernetes and container workloads.
https://kcp.io
Apache License 2.0
2.38k stars 383 forks source link

āœØ Allow setting root directory to empty string to disable creation #3158

Closed embik closed 3 months ago

embik commented 3 months ago

Summary

--root-directory is an extremely handy flag when running kcp start locally, and the .kcp directory is filled with automatically generated certificates, kubeconfigs, etc.

When running kcp in Kubernetes (e.g. via the Helm chart), this is not needed because certificates are fed from the outside (generated by cert-manager) and kubeconfig generation is disabled. We set this in the Helm chart:

https://github.com/kcp-dev/helm-charts/blob/5e745b2cfbd7ad7cf926fd61b550d9c6c695265e/charts/kcp/templates/server-deployment.yaml#L135

This references an emptyDir volume we mount. The only reason we do that is because kcp fails to start if the root-directory doesn't exist and it cannot create it.

Thus, this PR eliminates the code path that was always trying to create the root directory. It should allow us to set --root-directory="" in the Helm chart and eliminate the emptyDir we've been using as a workaround to make the kcp binary happy.

Related issue(s)

Fixes #

Release Notes

Skip attempt to create root directory if `--root-directory=""` is set
sttts commented 3 months ago

/lgtm /approve

kcp-ci-bot commented 3 months ago

LGTM label has been added.

Git tree hash: 8c8a4b33ec8e9498cf9421dc09ad4bfdda5b5ad0

kcp-ci-bot commented 3 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sttts

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kcp-dev/kcp/blob/main/OWNERS)~~ [sttts] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment