Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
devcontainer-features
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eazydevelop-devcontainer-temp
devcontainer-features
Commits
4a9929f9
Unverified
Commit
4a9929f9
authored
Feb 07, 2023
by
Samruddhi Khandale
Committed by
GitHub
Feb 07, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kubectl-helm-minikube: Allow none (#442)
parent
36d7664e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
112 additions
and
68 deletions
+112
-68
devcontainer-feature.json
src/kubectl-helm-minikube/devcontainer-feature.json
+7
-4
install.sh
src/kubectl-helm-minikube/install.sh
+70
-64
install_only_kubectl.sh
test/kubectl-helm-minikube/install_only_kubectl.sh
+22
-0
scenarios.json
test/kubectl-helm-minikube/scenarios.json
+12
-0
test.sh
test/kubectl-helm-minikube/test.sh
+1
-0
No files found.
src/kubectl-helm-minikube/devcontainer-feature.json
View file @
4a9929f9
{
{
"id"
:
"kubectl-helm-minikube"
,
"id"
:
"kubectl-helm-minikube"
,
"version"
:
"1.1.
3
"
,
"version"
:
"1.1.
4
"
,
"name"
:
"Kubectl, Helm, and Minikube"
,
"name"
:
"Kubectl, Helm, and Minikube"
,
"documentationURL"
:
"https://github.com/devcontainers/features/tree/main/src/kubectl-helm-minikube"
,
"documentationURL"
:
"https://github.com/devcontainers/features/tree/main/src/kubectl-helm-minikube"
,
"description"
:
"Installs latest version of kubectl, Helm, and optionally minikube. Auto-detects latest versions and installs needed dependencies."
,
"description"
:
"Installs latest version of kubectl, Helm, and optionally minikube. Auto-detects latest versions and installs needed dependencies."
,
...
@@ -12,7 +12,8 @@
...
@@ -12,7 +12,8 @@
"none"
,
"none"
,
"1.23"
,
"1.23"
,
"1.22"
,
"1.22"
,
"1.21"
"1.21"
,
"none"
],
],
"default"
:
"latest"
,
"default"
:
"latest"
,
"description"
:
"Select or enter a Kubernetes version to install"
"description"
:
"Select or enter a Kubernetes version to install"
...
@@ -20,7 +21,8 @@
...
@@ -20,7 +21,8 @@
"helm"
:
{
"helm"
:
{
"type"
:
"string"
,
"type"
:
"string"
,
"proposals"
:
[
"proposals"
:
[
"latest"
"latest"
,
"none"
],
],
"default"
:
"latest"
,
"default"
:
"latest"
,
"description"
:
"Select or enter a Helm version to install"
"description"
:
"Select or enter a Helm version to install"
...
@@ -28,7 +30,8 @@
...
@@ -28,7 +30,8 @@
"minikube"
:
{
"minikube"
:
{
"type"
:
"string"
,
"type"
:
"string"
,
"proposals"
:
[
"proposals"
:
[
"latest"
"latest"
,
"none"
],
],
"default"
:
"latest"
,
"default"
:
"latest"
,
"description"
:
"Select or enter a Minikube version to install"
"description"
:
"Select or enter a Minikube version to install"
...
...
src/kubectl-helm-minikube/install.sh
View file @
4a9929f9
...
@@ -14,7 +14,7 @@ rm -rf /var/lib/apt/lists/*
...
@@ -14,7 +14,7 @@ rm -rf /var/lib/apt/lists/*
KUBECTL_VERSION
=
"
${
VERSION
:-
"latest"
}
"
KUBECTL_VERSION
=
"
${
VERSION
:-
"latest"
}
"
HELM_VERSION
=
"
${
HELM
:-
"latest"
}
"
HELM_VERSION
=
"
${
HELM
:-
"latest"
}
"
MINIKUBE_VERSION
=
"
${
MINIKUBE
:-
"
none
"
}
"
# latest is also valid
MINIKUBE_VERSION
=
"
${
MINIKUBE
:-
"
latest
"
}
"
# latest is also valid
KUBECTL_SHA256
=
"
${
KUBECTL_SHA256
:-
"automatic"
}
"
KUBECTL_SHA256
=
"
${
KUBECTL_SHA256
:-
"automatic"
}
"
HELM_SHA256
=
"
${
HELM_SHA256
:-
"automatic"
}
"
HELM_SHA256
=
"
${
HELM_SHA256
:-
"automatic"
}
"
...
@@ -121,60 +121,64 @@ case $architecture in
...
@@ -121,60 +121,64 @@ case $architecture in
*
)
echo
"(!) Architecture
$architecture
unsupported"
;
exit
1
;;
*
)
echo
"(!) Architecture
$architecture
unsupported"
;
exit
1
;;
esac
esac
# Install the kubectl, verify checksum
if
[
${
KUBECTL_VERSION
}
!=
"none"
]
;
then
echo
"Downloading kubectl..."
# Install the kubectl, verify checksum
if
[
"
${
KUBECTL_VERSION
}
"
=
"latest"
]
||
[
"
${
KUBECTL_VERSION
}
"
=
"lts"
]
||
[
"
${
KUBECTL_VERSION
}
"
=
"current"
]
||
[
"
${
KUBECTL_VERSION
}
"
=
"stable"
]
;
then
echo
"Downloading kubectl..."
if
[
"
${
KUBECTL_VERSION
}
"
=
"latest"
]
||
[
"
${
KUBECTL_VERSION
}
"
=
"lts"
]
||
[
"
${
KUBECTL_VERSION
}
"
=
"current"
]
||
[
"
${
KUBECTL_VERSION
}
"
=
"stable"
]
;
then
KUBECTL_VERSION
=
"
$(
curl
-sSL
https://dl.k8s.io/release/stable.txt
)
"
KUBECTL_VERSION
=
"
$(
curl
-sSL
https://dl.k8s.io/release/stable.txt
)
"
else
else
find_version_from_git_tags KUBECTL_VERSION https://github.com/kubernetes/kubernetes
find_version_from_git_tags KUBECTL_VERSION https://github.com/kubernetes/kubernetes
fi
fi
if
[
"
${
KUBECTL_VERSION
::1
}
"
!=
'v'
]
;
then
if
[
"
${
KUBECTL_VERSION
::1
}
"
!=
'v'
]
;
then
KUBECTL_VERSION
=
"v
${
KUBECTL_VERSION
}
"
KUBECTL_VERSION
=
"v
${
KUBECTL_VERSION
}
"
fi
fi
curl
-sSL
-o
/usr/local/bin/kubectl
"https://dl.k8s.io/release/
${
KUBECTL_VERSION
}
/bin/linux/
${
architecture
}
/kubectl"
curl
-sSL
-o
/usr/local/bin/kubectl
"https://dl.k8s.io/release/
${
KUBECTL_VERSION
}
/bin/linux/
${
architecture
}
/kubectl"
chmod
0755 /usr/local/bin/kubectl
chmod
0755 /usr/local/bin/kubectl
if
[
"
$KUBECTL_SHA256
"
=
"automatic"
]
;
then
if
[
"
$KUBECTL_SHA256
"
=
"automatic"
]
;
then
KUBECTL_SHA256
=
"
$(
curl
-sSL
"https://dl.k8s.io/
${
KUBECTL_VERSION
}
/bin/linux/
${
architecture
}
/kubectl.sha256"
)
"
KUBECTL_SHA256
=
"
$(
curl
-sSL
"https://dl.k8s.io/
${
KUBECTL_VERSION
}
/bin/linux/
${
architecture
}
/kubectl.sha256"
)
"
fi
fi
([
"
${
KUBECTL_SHA256
}
"
=
"dev-mode"
]
||
(
echo
"
${
KUBECTL_SHA256
}
*/usr/local/bin/kubectl"
|
sha256sum
-c
-
))
([
"
${
KUBECTL_SHA256
}
"
=
"dev-mode"
]
||
(
echo
"
${
KUBECTL_SHA256
}
*/usr/local/bin/kubectl"
|
sha256sum
-c
-
))
if
!
type
kubectl
>
/dev/null 2>&1
;
then
if
!
type
kubectl
>
/dev/null 2>&1
;
then
echo
'(!) kubectl installation failed!'
echo
'(!) kubectl installation failed!'
exit
1
exit
1
fi
fi
# kubectl bash completion
# kubectl bash completion
kubectl completion bash
>
/etc/bash_completion.d/kubectl
kubectl completion bash
>
/etc/bash_completion.d/kubectl
# kubectl zsh completion
# kubectl zsh completion
if
[
-e
"
${
USERHOME
}
}/.oh-my-zsh"
]
;
then
if
[
-e
"
${
USERHOME
}
}/.oh-my-zsh"
]
;
then
mkdir
-p
"
${
USERHOME
}
/.oh-my-zsh/completions"
mkdir
-p
"
${
USERHOME
}
/.oh-my-zsh/completions"
kubectl completion zsh
>
"
${
USERHOME
}
/.oh-my-zsh/completions/_kubectl"
kubectl completion zsh
>
"
${
USERHOME
}
/.oh-my-zsh/completions/_kubectl"
chown
-R
"
${
USERNAME
}
"
"
${
USERHOME
}
/.oh-my-zsh"
chown
-R
"
${
USERNAME
}
"
"
${
USERHOME
}
/.oh-my-zsh"
fi
fi
fi
# Install Helm, verify signature and checksum
if
[
${
HELM_VERSION
}
!=
"none"
]
;
then
echo
"Downloading Helm..."
# Install Helm, verify signature and checksum
find_version_from_git_tags HELM_VERSION
"https://github.com/helm/helm"
echo
"Downloading Helm..."
if
[
"
${
HELM_VERSION
::1
}
"
!=
'v'
]
;
then
find_version_from_git_tags HELM_VERSION
"https://github.com/helm/helm"
if
[
"
${
HELM_VERSION
::1
}
"
!=
'v'
]
;
then
HELM_VERSION
=
"v
${
HELM_VERSION
}
"
HELM_VERSION
=
"v
${
HELM_VERSION
}
"
fi
fi
mkdir
-p
/tmp/helm
mkdir
-p
/tmp/helm
helm_filename
=
"helm-
${
HELM_VERSION
}
-linux-
${
architecture
}
.tar.gz"
helm_filename
=
"helm-
${
HELM_VERSION
}
-linux-
${
architecture
}
.tar.gz"
tmp_helm_filename
=
"/tmp/helm/
${
helm_filename
}
"
tmp_helm_filename
=
"/tmp/helm/
${
helm_filename
}
"
curl
-sSL
"https://get.helm.sh/
${
helm_filename
}
"
-o
"
${
tmp_helm_filename
}
"
curl
-sSL
"https://get.helm.sh/
${
helm_filename
}
"
-o
"
${
tmp_helm_filename
}
"
curl
-sSL
"https://github.com/helm/helm/releases/download/
${
HELM_VERSION
}
/
${
helm_filename
}
.asc"
-o
"
${
tmp_helm_filename
}
.asc"
curl
-sSL
"https://github.com/helm/helm/releases/download/
${
HELM_VERSION
}
/
${
helm_filename
}
.asc"
-o
"
${
tmp_helm_filename
}
.asc"
export
GNUPGHOME
=
"/tmp/helm/gnupg"
export
GNUPGHOME
=
"/tmp/helm/gnupg"
mkdir
-p
"
${
GNUPGHOME
}
"
mkdir
-p
"
${
GNUPGHOME
}
"
chmod
700
${
GNUPGHOME
}
chmod
700
${
GNUPGHOME
}
curl
-sSL
"
${
HELM_GPG_KEYS_URI
}
"
-o
/tmp/helm/KEYS
curl
-sSL
"
${
HELM_GPG_KEYS_URI
}
"
-o
/tmp/helm/KEYS
echo
-e
"disable-ipv6
\n
${
GPG_KEY_SERVERS
}
"
>
${
GNUPGHOME
}
/dirmngr.conf
echo
-e
"disable-ipv6
\n
${
GPG_KEY_SERVERS
}
"
>
${
GNUPGHOME
}
/dirmngr.conf
gpg
-q
--import
"/tmp/helm/KEYS"
gpg
-q
--import
"/tmp/helm/KEYS"
if
!
gpg
--verify
"
${
tmp_helm_filename
}
.asc"
>
${
GNUPGHOME
}
/verify.log 2>&1
;
then
if
!
gpg
--verify
"
${
tmp_helm_filename
}
.asc"
>
${
GNUPGHOME
}
/verify.log 2>&1
;
then
echo
"Verification failed!"
echo
"Verification failed!"
cat
/tmp/helm/gnupg/verify.log
cat
/tmp/helm/gnupg/verify.log
exit
1
exit
1
fi
fi
if
[
"
${
HELM_SHA256
}
"
=
"automatic"
]
;
then
if
[
"
${
HELM_SHA256
}
"
=
"automatic"
]
;
then
curl
-sSL
"https://get.helm.sh/
${
helm_filename
}
.sha256"
-o
"
${
tmp_helm_filename
}
.sha256"
curl
-sSL
"https://get.helm.sh/
${
helm_filename
}
.sha256"
-o
"
${
tmp_helm_filename
}
.sha256"
curl
-sSL
"https://github.com/helm/helm/releases/download/
${
HELM_VERSION
}
/
${
helm_filename
}
.sha256.asc"
-o
"
${
tmp_helm_filename
}
.sha256.asc"
curl
-sSL
"https://github.com/helm/helm/releases/download/
${
HELM_VERSION
}
/
${
helm_filename
}
.sha256.asc"
-o
"
${
tmp_helm_filename
}
.sha256.asc"
if
!
gpg
--verify
"
${
tmp_helm_filename
}
.sha256.asc"
>
/tmp/helm/gnupg/verify.log 2>&1
;
then
if
!
gpg
--verify
"
${
tmp_helm_filename
}
.sha256.asc"
>
/tmp/helm/gnupg/verify.log 2>&1
;
then
...
@@ -183,15 +187,17 @@ if [ "${HELM_SHA256}" = "automatic" ]; then
...
@@ -183,15 +187,17 @@ if [ "${HELM_SHA256}" = "automatic" ]; then
exit
1
exit
1
fi
fi
HELM_SHA256
=
"
$(
cat
"
${
tmp_helm_filename
}
.sha256"
)
"
HELM_SHA256
=
"
$(
cat
"
${
tmp_helm_filename
}
.sha256"
)
"
fi
fi
([
"
${
HELM_SHA256
}
"
=
"dev-mode"
]
||
(
echo
"
${
HELM_SHA256
}
*
${
tmp_helm_filename
}
"
|
sha256sum
-c
-
))
tar
xf
"
${
tmp_helm_filename
}
"
-C
/tmp/helm
([
"
${
HELM_SHA256
}
"
=
"dev-mode"
]
||
(
echo
"
${
HELM_SHA256
}
*
${
tmp_helm_filename
}
"
|
sha256sum
-c
-
))
mv
-f
"/tmp/helm/linux-
${
architecture
}
/helm"
/usr/local/bin/
tar
xf
"
${
tmp_helm_filename
}
"
-C
/tmp/helm
chmod
0755 /usr/local/bin/helm
mv
-f
"/tmp/helm/linux-
${
architecture
}
/helm"
/usr/local/bin/
rm
-rf
/tmp/helm
chmod
0755 /usr/local/bin/helm
if
!
type
helm
>
/dev/null 2>&1
;
then
rm
-rf
/tmp/helm
if
!
type
helm
>
/dev/null 2>&1
;
then
echo
'(!) Helm installation failed!'
echo
'(!) Helm installation failed!'
exit
1
exit
1
fi
fi
fi
# Install Minikube, verify checksum
# Install Minikube, verify checksum
...
...
test/kubectl-helm-minikube/install_only_kubectl.sh
0 → 100644
View file @
4a9929f9
#!/bin/bash
set
-e
# Optional: Import test library
source
dev-container-features-test-lib
set
+e
kubectl
exit_code
=
$?
check
"kubectl-is-not-installed"
bash
-c
"echo
${
exit_code
}
| grep 127"
helm version
exit_code
=
$?
check
"helm-is-not-installed"
bash
-c
"echo
${
exit_code
}
| grep 127"
minikube version
exit_code
=
$?
check
"minikube is-not-installed"
bash
-c
"echo
${
exit_code
}
| grep 127"
set
-e
# Report result
reportResults
test/kubectl-helm-minikube/scenarios.json
0 → 100644
View file @
4a9929f9
{
"install_only_kubectl"
:
{
"image"
:
"mcr.microsoft.com/devcontainers/base:ubuntu"
,
"features"
:
{
"kubectl-helm-minikube"
:
{
"version"
:
"none"
,
"helm"
:
"none"
,
"minikube"
:
"none"
}
}
}
}
test/kubectl-helm-minikube/test.sh
View file @
4a9929f9
...
@@ -8,6 +8,7 @@ source dev-container-features-test-lib
...
@@ -8,6 +8,7 @@ source dev-container-features-test-lib
# Definition specific tests
# Definition specific tests
check
"kube"
kubectl
check
"kube"
kubectl
check
"helm"
helm version
check
"helm"
helm version
check
"minikune"
minikube version
# Report result
# Report result
reportResults
reportResults
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment