Skip to content

Commit 5f69286

Browse files
author
Jacob Woffenden
authored
update kubernetes
fix cloud-platform Signed-off-by: GitHub <noreply@github.com>
1 parent c42b586 commit 5f69286

File tree

4 files changed

+31
-15
lines changed

4 files changed

+31
-15
lines changed

features/src/cloud-platform/src/home/vscode/.devcontainer/promptrc.d/cloud-platform.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
PROMPT+='`\
1010
CURRENT_CONTEXT=$(kubectl config current-context 2>/dev/null); \
11-
CURRENT_NAMESPACE=$(kubectl config view --minify --output "jsonpath={..namespace}"); \
11+
CURRENT_NAMESPACE=$(kubectl config view --minify --output "jsonpath={..namespace}" 2>/dev/null); \
1212
CURRENT_CLIENT_ID=$(kubectl config view --output json | jq -r ".users[0].user[\"auth-provider\"].config[\"client-id\"]"); \
1313
SERVER_VERSION=$(kubectl version --output json 2>/dev/null | jq -r .serverVersion.gitVersion); \
1414
if [[ "${CURRENT_CONTEXT}" == "cloud-platform-live" ]] && [[ "${CURRENT_CLIENT_ID}" == "REPLACE_WITH_CLIENT_ID" ]]; then \

features/src/kubernetes/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
## [Unreleased]
1111

12+
## [1.0.2] - 2024-10-28
13+
14+
- Updated environment colour map
15+
1216
## [1.0.1] - 2024-05-23
1317

1418
### Changed

features/src/kubernetes/devcontainer-feature.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "kubernetes",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"name": "Kubernetes",
55
"description": "Installs the Kubernetes CLI, Helm CLI and Helm Chart Testing CLI",
66
"options": {

features/src/kubernetes/src/home/vscode/.devcontainer/promptrc.d/kubernetes-cli.sh

+25-13
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,29 @@
22
# shellcheck disable=SC2016
33

44
PROMPT+='`\
5-
export KUBE_CURRENT_CONTEXT=$(kubectl config current-context 2>/dev/null); \
6-
export KUBE_CURRENT_NAMESPACE=$(kubectl config view --minify --output "jsonpath={..namespace}" 2>/dev/null); \
7-
if [[ "${KUBE_CURRENT_CONTEXT}" == *"development"* ]]; then \
8-
echo -n "[ context: %{$fg[green]%}${KUBE_CURRENT_CONTEXT}%{$reset_color%} ] "; \
9-
elif [[ "${KUBE_CURRENT_CONTEXT}" == *"production"* ]]; then \
10-
echo -n "[ context: %{$fg[red]%}${KUBE_CURRENT_CONTEXT}%{$reset_color%} ] "; \
11-
elif [[ ! -z "${KUBE_CURRENT_CONTEXT}" ]]; then \
12-
echo -n "[ context: %{$fg[yellow]%}${KUBE_CURRENT_CONTEXT}%{$reset_color%} ] "; \
13-
fi \
14-
&& \
15-
if [[ ! -z "${KUBE_CURRENT_NAMESPACE}" ]]; then \
16-
echo -n "[ namespace: %{$fg[white]%}${KUBE_CURRENT_NAMESPACE}%{$reset_color%} ] "; \
17-
fi \
5+
CURRENT_CONTEXT=$(kubectl config current-context 2>/dev/null); \
6+
CURRENT_NAMESPACE=$(kubectl config view --minify --output "jsonpath={..namespace}" 2>/dev/null); \
7+
case ${CURRENT_CONTEXT} in \
8+
*"development"*|*"sandbox"*) \
9+
colour=green \
10+
;; \
11+
*"test"*) \
12+
colour=blue \
13+
;; \
14+
*"preproduction"*) \
15+
colour=yellow \
16+
;; \
17+
*"production"*) \
18+
colour=red \
19+
;; \
20+
*) \
21+
colour=white \
22+
;; \
23+
esac; \
24+
if [[ ! -z ${CURRENT_CONTEXT} ]]; then \
25+
echo -n "[ context: %{$fg[$colour]%}${CURRENT_CONTEXT}%{$reset_color%} ] "; \
26+
fi; \
27+
if [[ ! -z ${CURRENT_NAMESPACE} ]]; then \
28+
echo -n "[ namespace: ${CURRENT_NAMESPACE} ] "; \
29+
fi
1830
`'

0 commit comments

Comments
 (0)