Skip to content

Commit

Permalink
krew-index adjustments & add manual installation script
Browse files Browse the repository at this point in the history
  • Loading branch information
hadar-co committed Feb 6, 2022
1 parent 3a0d84e commit bb2fd5b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 11 deletions.
12 changes: 7 additions & 5 deletions .krew.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ metadata:
spec:
version: v0.0.3
homepage: https://github.com/datreeio/kubectl-datree
shortDescription: Scan the resources within your cluster for misconfigurations
shortDescription: Scan your cluster resources for misconfigurations
description: |
Datree is a static code analysis tool for k8s manifest files. This plugin extends the tool's capabilities
to allow scanning resources within your cluster for misconfigurations.
Datree is a static code analysis tool for kubernetes manifest files.
This plugin allows scanning resources within your cluster for misconfigurations.
caveats: |
Before using this plugin, the Datree CLI needs to be installed.
See https://hub.datree.io/ for quick and easy installation.
platforms:
- selector:
matchExpressions:
Expand All @@ -19,11 +20,12 @@ spec:
values:
- darwin
- linux
uri: https://github.com/datreeio/kubectl-datree/releases/download/v0.0.3/kubectl-datree.zip
uri: https://github.com/datreeio/kubectl-datree/releases/latest/download/kubectl-datree.zip
sha256: "ffabb0dae0662ea8259f3f5e32ab18dae2caa16adbe66fd98ddb07ebbb216ba0"
files:
- from: "kubectl-datree"
to: "."
- from: LICENSE
to: "."
bin: kubectl-datree

13 changes: 7 additions & 6 deletions kubectl-datree
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/bash

# Check if Datree is installed
if ! command -v datree &> /dev/null; then
printf "Datree is not installed on your machine, please run 'curl https://get.datree.io | /bin/bash' to install\n"
printf "For more information, visit https://hub.datree.io/\n"
exit 1
fi

show_help(){
printf "Datree's kubectl plugin extends the tool's capabilities to allow scanning k8s yaml files within the cluster for misconfigurations.\n"
printf "For more information and examples, see the official documentation: https://hub.datree.io\n"
Expand All @@ -20,12 +27,6 @@ then
exit 1
fi

# Install datree if it isn't installed
if ! command -v datree &> /dev/null; then
echo "Datree is not installed on your machine, proceeding to install..."
curl https://get.datree.io | /bin/bash
fi

DATREE_OPTIONS=()
EOO=0
TEST_BY_NAMESPACE=1
Expand Down
23 changes: 23 additions & 0 deletions manual_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Install datree if it isn't installed
if ! command -v datree &> /dev/null; then
echo "Datree is not installed on your machine, proceeding to install..."
curl https://get.datree.io | /bin/bash
fi

curl -L -O https://github.com/datreeio/kubectl-datree/releases/latest/download/kubectl-datree.zip 2> /dev/null

PACKAGE_NAME="kubectl-datree.zip"
PLUGIN_EXEC_NAME="kubectl-datree"

mkdir bin
unzip $PACKAGE_NAME -d bin > /dev/null

sudo cp bin/$PLUGIN_EXEC_NAME /usr/local/bin/$PLUGIN_EXEC_NAME

rm -rf bin && rm -rf $PACKAGE_NAME

if [ -f /usr/local/bin/$PLUGIN_EXEC_NAME ]; then
echo "Plugin installed successfully"
else
echo "Error occurred, please open a ticket in the github repository for assistance: https://github.com/datreeio/kubectl-datree"
fi

0 comments on commit bb2fd5b

Please sign in to comment.