Closed piotr20a closed 2 years ago
Why is the name of the httpbin
app set to httpbin---
.
The error states that the selector is invalid and the name of the app must start and end with a alphanumeric character, therefore httpbin---
is invalid.
Name: "httpbin", Namespace: "default"
for: "httpbin.yaml": error when patching "httpbin.yaml": Service "httpbin" is invalid: spec.selector: Invalid value: "httpbin---": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue', or 'myvalue', or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9.])?[A-Za-z0-9])?')
Do your httpbin kubernetes templates have the name set to httpbin---
, if so, you'll need to change them to httpbin
Correct, the issue is the "---" should be on the next line, could you make sure this is the script you're running:
#!/bin/bash
set -euo pipefail
DIRECTORY="$1"
yamls="$(ls -1 "${DIRECTORY}")"
for yaml in ${yamls}; do
cat "${DIRECTORY}/${yaml}"
echo $'\n---'
done
exit 0
That is indeed correct, did not realize that changes were pushed toward the main course branch about that fix. It works not, therefore the issue can be closed.
If anyone has trouble because they added extra files to the k8s folder, then here is a fix. This way the script only merges *.yaml files and skips other files, such as the markdown file I added for information purposes.
#!/bin/bash
set -euo pipefail
DIRECTORY="$1"
yamls="$(ls -1 "${DIRECTORY}")"
for yaml in ${yamls}; do
if [[ "${yaml}" == *.yaml ]]; then
cat "${DIRECTORY}/${yaml}"
echo $'\n---'
fi
done
exit 0
Expected Behavior
I am trying to run the pipeline config script in my CircleCi. The script runs fully, til the Kubernetes deployment part.
Output
The Kubernetes deployment script fails due to a namespace error in the merged files.
Context
The output of the error and part of the script that fails: