Skip to content

Commit

Permalink
lets populate a namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
jspaleta committed Nov 20, 2020
1 parent 4b057ca commit b5064bd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
9 changes: 8 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
preflight_check=0
WORKFLOW_LABEL_SELECTOR="sensu.io/workflow == sensu_flow"
MANAGED_RESOURCES="checks,handlers,filters,mutators,assets,secrets/v1.Secret,roles,role-bindings"
NAMESPACES_DIR="namespaces"

echo "Working Directory: $PWD"
if [ -f ./.env ] ; then
Expand All @@ -14,6 +15,7 @@ fi

[ -z "$WORKFLOW_LABEL_SELECTOR" ] && [ -z "$INPUT_WORKFLOW_LABEL_SELECTOR" ] && echo "WORKFLOW_LABEL_SELECTOR environment variable empty" && preflight_check=1
[ -z "$MANAGED_RESOURCES" ] && [ -z "$INPUT_MANAGED_RESOURCES" ] && echo "MANAGED_RESOURCES environment variable empty" && preflight_check=1
[ -z "$NAMESPACES_DIR" ] && [ -z "$INPUT_NAMESPACES_DIR" ] && echo "NAMESPACES_DIE environment variable empty" && preflight_check=1

if test $preflight_check -ne 0 ; then
echo "Missing environment variables"
Expand Down Expand Up @@ -64,6 +66,11 @@ if [ -z "$INPUT_MANAGED_RESOURCES" ] ; then
else
label_selector=$INPUT_MANAGED_RESOURCES
fi
if [ -z "$INPUT_NAMESPACES_DIR" ] ; then
managed__resources=$NAMESPACES_DIR
else
label_selector=$INPUT_NAMESPACES_DIR
fi

if [ -z "$ca_file" ] ; then
touch /tmp/sensu_ca.pem
Expand Down Expand Up @@ -113,7 +120,7 @@ then
sensuctl create -f namespaces.yaml
fi

cd namespaces || die "Failed to cd to namespaces directory!"
cd $NAMESPACES_DIR || die "Failed to cd to namespaces directory!"

for namespace in $(ls -1)
do
Expand Down
5 changes: 5 additions & 0 deletions namespaces.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
type: Namespace
api_version: core/v2
spec:
name: test-namespace
Empty file added namespaces/.gitkeep
Empty file.

0 comments on commit b5064bd

Please sign in to comment.