Commit 892f65a Jacob Woffenden
authored
1 parent 48bdb68 commit 892f65a Copy full SHA for 892f65a
File tree 6 files changed +97
-2
lines changed
6 files changed +97
-2
lines changed Original file line number Diff line number Diff line change 1
- <!-- markdownlint-disable MD003 -->
1
+ <!-- markdownlint-disable MD003 MD024 -->
2
2
# Changelog
3
3
4
4
All notable changes to this project will be documented in this file.
@@ -8,6 +8,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
9
9
## [ Unreleased]
10
10
11
+ ## [ 0.0.2] - 2024-01-31
12
+
13
+ ### Added
14
+
15
+ - Dependency on ` ghcr.io/ministryofjustice/devcontainer-feature/kubernetes `
16
+
17
+ - Curated Kubernetes configuration file
18
+
19
+ - ZSH prompt extension
20
+
11
21
## [ 0.0.1] - 2024-01-30
12
22
13
23
### Added
Original file line number Diff line number Diff line change 1
1
{
2
2
"id" : " cloud-platform" ,
3
- "version" : " 0.0.1 " ,
3
+ "version" : " 0.0.2 " ,
4
4
"name" : " Cloud Platform" ,
5
5
"description" : " Installs the Cloud Platform CLI" ,
6
6
"options" : {
7
7
"cloudPlatformCliVersion" : {
8
8
"type" : " string" ,
9
9
"description" : " Version of the Cloud Platform CLI to install" ,
10
10
"default" : " latest"
11
+ },
12
+ "installCloudPlatformKubeconfig" : {
13
+ "type" : " boolean" ,
14
+ "description" : " Wether to install the Cloud Platform kubeconfig" ,
15
+ "default" : true
16
+ },
17
+ "installCloudPlatformPrompt" : {
18
+ "type" : " boolean" ,
19
+ "description" : " Wether to install the Cloud Platform prompt" ,
20
+ "default" : true
21
+ }
22
+ },
23
+ "dependsOn" : {
24
+ "ghcr.io/ministryofjustice/devcontainer-feature/kubernetes:0" : {
25
+ "kubernetesCliVersion" : " v1.26.13"
11
26
}
12
27
}
13
28
}
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ get_system_architecture
10
10
11
11
GITHUB_REPOSITORY=" ministryofjustice/cloud-platform-cli"
12
12
VERSION=${CLOUDPLATFORMCLIVERSION:- " latest" }
13
+ INSTALL_CLOUD_PLATFORM_KUBECONFIG=${INSTALLCLOUDPLATFORMKUBECONFIG:- " true" }
14
+ INSTALL_CLOUD_PLATFORM_PROMPT=${INSTALLCLOUDPLATFORMPROMPT:- " true" }
13
15
14
16
if [[ " ${VERSION} " == " latest" ]]; then
15
17
get_github_latest_tag " ${GITHUB_REPOSITORY} "
@@ -29,4 +31,12 @@ install --owner=vscode --group=vscode --mode=775 cloud-platform /usr/local/bin/c
29
31
30
32
install --owner=vscode --group=vscode --mode=775 completions/cloud-platform.zsh /usr/local/share/zsh/site-functions/_cloud-platform
31
33
34
+ if [[ " ${INSTALL_CLOUD_PLATFORM_KUBECONFIG} " == " true" ]]; then
35
+ install --owner=vscode --group=vscode --mode=775 " $( dirname " ${0} " ) " /src/home/vscode/.kube/config /home/vscode/.kube/config
36
+ fi
37
+
38
+ if [[ " ${INSTALL_CLOUD_PLATFORM_PROMPT} " == " true" ]]; then
39
+ install --owner=vscode --group=vscode --mode=775 " $( dirname " ${0} " ) " /src/home/vscode/.devcontainer/promptrc.d/cloud-platform.sh /home/vscode/.devcontainer/promptrc.d/cloud-platform.sh
40
+ fi
41
+
32
42
rm --recursive --force LICENSE README.md completions " cloud-platform-cli_${VERSION} _linux_${ARCHITECTURE} .tar.gz"
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ # shellcheck disable=SC2016
3
+
4
+ PROMPT+=' `\
5
+ kubectlCurrentContext=$(kubectl config current-context 2>/dev/null); \
6
+ kubectlCurrentNamespace=$(kubectl config view --minify --output "jsonpath={..namespace}"); \
7
+ kubectlClientId=$(kubectl config view --output json | jq -r ".users[0].user[\"auth-provider\"].config[\"client-id\"]"); \
8
+ kubectlServerVersion=$(kubectl version --output json 2>/dev/null | jq -r .serverVersion.gitVersion | sed "s/v//"); \
9
+ && if [[ "${kubectlCurrentContext}" == "cloud-platform-live" ]] && [[ "${kubectlClientId}" == "REPLACE_WITH_CLIENT_ID" ]]; then \
10
+ echo -n "[ cluster: %{$fg[yellow]%}${kubectlCurrentContext} (requires authentication)%{$reset_color%} ] "; \
11
+ elif [[ "${kubectlCurrentContext}" == "cloud-platform-live" ]] && [[ ! -z "${kubectlServerVersion}" ]]; then \
12
+ echo -n "[ cluster: %{$fg[green]%}${kubectlCurrentContext} (authenticated)%{$reset_color%} ] "; \
13
+ else
14
+ echo -n "[ cluster: %{$fg[red]%}${kubectlCurrentContext} (issue with authentication)%{$reset_color%} ] "; \
15
+ fi \
16
+ && if [[ "${kubectlCurrentContext}" == "cloud-platform-live" ]] && [[ ! -z "${kubectlCurrentNamespace}" ]] && [[ "${kubectlCurrentNamespace}" == *"-prod"* ]]; then \
17
+ echo -n "[ namespace: %{$fg[red]%}${kubectlCurrentNamespace}%{$reset_color%} ] "; \
18
+ elif [[ "${kubectlCurrentContext}" == "cloud-platform-live" ]] && [[ ! -z "${kubectlCurrentNamespace}" ]]; then \
19
+ echo -n "[ namespace: %{$fg[green]%}${kubectlCurrentNamespace}%{$reset_color%} ] "; \
20
+ fi \
21
+ `'
Original file line number Diff line number Diff line change
1
+ ---
2
+ apiVersion: v1
3
+ kind: Config
4
+ preferences:
5
+ colors: true
6
+
7
+ ####################################################################################################
8
+ #
9
+ # Changes to this file will be overwritten when rebuilding the dev container.
10
+ #
11
+ ####################################################################################################
12
+
13
+ current-context: cloud-platform-live
14
+
15
+ clusters:
16
+ - name: cloud-platform-live
17
+ cluster:
18
+ certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJeE1EWXlPREUyTXprMU5sb1hEVE14TURZeU5qRTJNemsxTmxvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQV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1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
19
+ server: https://DF366E49809688A3B16EEC29707D8C09.gr7.eu-west-2.eks.amazonaws.com
20
+
21
+ users:
22
+ - name: auth0
23
+ user:
24
+ auth-provider:
25
+ name: oidc
26
+ config:
27
+ client-id: "REPLACE_WITH_CLIENT_ID"
28
+ client-secret: "REPLACE_WITH_CLIENT_SECRET"
29
+ id-token: "REPLACE_WITH_ID_TOKEN"
30
+ idp-issuer-url: https://justice-cloud-platform.eu.auth0.com/
31
+ refresh-token: "REPLACE_WITH_REFRESH_TOKEN"
32
+
33
+ contexts:
34
+ - name: cloud-platform-live
35
+ context:
36
+ cluster: cloud-platform-live
37
+ user: auth0
Original file line number Diff line number Diff line change @@ -8,5 +8,7 @@ source dev-container-features-test-lib
8
8
9
9
check " cloud-platform version" cloud-platform version
10
10
check " cloud-platform completions existence" stat /usr/local/share/zsh/site-functions/_cloud-platform
11
+ check " cloud-platform kubeconfig existence" stat /home/vscode/.kube/config
12
+ check " cloud-platform prompt existence" stat /home/vscode/.devcontainer/promptrc.d/cloud-platform.sh
11
13
12
14
reportResults
You can’t perform that action at this time.
0 commit comments