Closed jamestexas closed 2 months ago
I did some further investigation and found that the issue is due to the DNS-1035 label standards, which are a requirement for naming in Kubernetes and consequently enforced by Helm. When attempting to install the Helm chart with a name containing dots, I encountered the following error:
┌[08:57:41]─────>
│ github.com/jamestexas/ollama-helm
└> helm install ollama-0.47.0 ollama-0.47.0.tgz --namespace ollama --create-namespace
W0729 09:57:44.914889 16262 warnings.go:70] metadata.name: this is used in Pod names and hostnames, which can result in surprising behavior; a DNS label is recommended: [must not contain dots]
Error: INSTALLATION FAILED: 1 error occurred:
* Service "ollama-0.47.0" is invalid: metadata.name: Invalid value: "ollama-0.47.0": a DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character (e.g. 'my-name', or 'abc-123', regex used for validation is '[a-z]([-a-z0-9]*[a-z0-9])?')
Is your feature request related to a problem? Please describe.
There is an inconsistency between what Zarf allows in Helm chart
releaseName
and what the Kubernetes API server accepts when creating resources. Specifically, Zarf allows release names that include periods (e.g.,ollama-0.47.0
), which conform to RFC 1123 Label Names. However, these names cause errors when Kubernetes attempts to create certain resources, despite being theoretically valid according to the naming conventions.Describe the expected behavior
zarf lint
,zarf package create
, andzarf package deploy
Steps to reproduce
zarf.yaml
file with the following content:zarf lint
Lint Output
```shell ┌[17:00:03]─────> │ github.com/jamestexas/ollama-demo └> zarf dev lint . NOTE Saving log file to /var/folders/qh/9h3zdnss3sq ```zarf package create . --confirm
Create Output
zarf package deploy
Package Deploy Output
```shell Deploys Ollama API service ? Deploy the ollama-helm component? Yes ✔ Waiting for cluster connection ✔ Gathering additional cluster information (if available) 📦 OLLAMA-HELM COMPONENT ✔ Loading the Zarf State from the Kubernetes cluster ⠙ warning: Upgrade "ollama-0.47.0" failed: failed to create resource: Service "ollama-0.47.0" is invalid: metadata.name: Invalid value: "ollama-0.47.0": a DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character (e.g. 'my-name', or 'abc-123', regex used for validation is '[a-z]([-a-z0-9]*[a-z0-9])?') WARNING Attempt (1/3) failed with: failed to create resource: Service "ollama-0.47.0" is invalid: metadata.name: Invalid value: "ollama-0.47.0": a DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character (e.g. 'my-name', or 'abc-123', regex used for validation is '[a-z]([-a-z0-9]*[a-z0-9])?') WARNING Retrying in 5s ⠹ warning: Upgrade "ollama-0.47.0" failed: failed to create resource: Service "ollama-0.47.0" is invalid: metadata.name: Invalid value: "ollama-0.47.0": a DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end ⠸ warning: Upgrade "ollama-0.47.0" failed: failed to create resource: Service "ollama-0.47.0" is invalid: metadata.name: Invalid value: "ollama-0.47.0": a DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end ⠼ warning: Upgrade "ollama-0.47.0" failed: failed to create resource: Service "ollama-0.47.0" is invalid: metadata.name: Invalid value: "ollama-0.47.0": a DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end ⠴ warning: Upgrade "ollama-0.47.0" failed: failed to create resource: Service "ollama-0.47.0" is invalid: metadata.name: Invalid value: "ollama-0.47.0": a DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character (e.g. 'my-name', or 'abc-123', regex used for validation is '[a-z]([-a-z0-9]*[a-z0-9])?') (1s)^C ```Actual behavior
Zarf successfully lints the configuration and creates the package without any warnings. However, during deployment, Kubernetes fails to create certain resources (like Services) due to the period in the release name, despite this name conforming to RFC 1123 Label Names.
Expected behavior
Zarf should either:
Additional context
This issue highlights a discrepancy between the Kubernetes naming conventions documentation and the actual behavior of the Kubernetes API server for certain resources. While the release name "ollama-0.47.0" conforms to RFC 1123 Label Names, it causes issues with resources that may have more stringent naming requirements.
Addressing this inconsistency in Zarf would greatly improve the user experience by preventing unexpected deployment failures and aligning Zarf's behavior more closely with the actual constraints of Kubernetes resource creation.
Environment
v0.36.1
Describe alternatives you've considered
User-side workaround: Users could manually adjust their release names to avoid periods and other potentially problematic characters. However, this puts the burden on the user and doesn't address the underlying inconsistency.
Helm chart modification: Zarf could potentially modify the Helm charts to use a sanitized release name internally, while still allowing users to specify their preferred release name. This would require careful handling to ensure that all references to the release name within the chart are updated consistently.
Stricter validation: Zarf could implement stricter validation rules that align with the most restrictive Kubernetes resource naming requirements. While this would prevent deployment failures, it might be overly restrictive for some use cases.
Additional context