UNCLASSIFIED - NO CUI
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bigbang
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Big Bang
bigbang
Commits
419a3115
Commit
419a3115
authored
3 years ago
by
Jason Krause
Committed by
Branden Cobb
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Update install_flux.sh to use kustomize that comes with kubectl.
parent
c70ab51f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!1658
Draft: Merge branch 'tempo_tracing_updates' into 'master'
,
!1344
Update install_flux.sh to use kustomize that comes with kubectl.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/install_flux.sh
+96
-79
96 additions, 79 deletions
scripts/install_flux.sh
with
96 additions
and
79 deletions
scripts/install_flux.sh
+
96
−
79
View file @
419a3115
...
...
@@ -6,20 +6,19 @@ trap 'echo ❌ exit at ${0}:${LINENO}, command was: ${BASH_COMMAND} 1>&2' ERR
#
# global defaults
#
FLUX_SCRIPT_DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
>
/dev/null
&&
pwd
)
"
FLUX_SCRIPT_DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
>
/dev/null
&&
pwd
)
"
FLUX_KUSTOMIZATION
=
"
${
FLUX_SCRIPT_DIR
}
/../base/flux"
REGISTRY_URL
=
registry1.dso.mil
FLUX_SECRET
=
private-registry
WAIT_TIMEOUT
=
300
#
# helper functions
#
# script help message
function
help
{
cat
<<
EOF
cat
<<
EOF
usage:
$(
basename
"
$0
"
)
<arguments>
-h|--help - print this help message and exit
-r|--registry-url - (optional, default: registry1.dso.mil) registry url to use for flux installation
...
...
@@ -32,8 +31,7 @@ EOF
# script check for existing pull secret
function
check_secrets
{
if
kubectl get secrets/
"
$FLUX_SECRET
"
-n
flux-system
>
/dev/null 2>&1
;
then
if
kubectl get secrets/
"
$FLUX_SECRET
"
-n
flux-system
>
/dev/null 2>&1
;
then
#the secret exists
FLUX_SECRET_EXISTS
=
0
else
...
...
@@ -47,77 +45,84 @@ function check_secrets {
#
PARAMS
=
""
while
((
"$#"
))
;
do
case
"
$1
"
in
# registry username required argument
-u
|
--registry-username
)
if
[
-n
"
$2
"
]
&&
[
"
${
2
:0:1
}
"
!=
"-"
]
;
then
REGISTRY_USERNAME
=
$2
shift
2
else
echo
"Error: Argument for
$1
is missing"
>
&2
help
;
exit
1
fi
;;
# registry password required argument
-p
|
--registry-password
)
if
[
-n
"
$2
"
]
&&
[
"
${
2
:0:1
}
"
!=
"-"
]
;
then
REGISTRY_PASSWORD
=
$2
shift
2
else
echo
"Error: Argument for
$1
is missing"
>
&2
help
;
exit
1
fi
;;
# registry email required argument
-e
|
--registry-email
)
if
[
-n
"
$2
"
]
&&
[
"
${
2
:0:1
}
"
!=
"-"
]
;
then
REGISTRY_EMAIL
=
$2
shift
2
else
echo
"Error: Argument for
$1
is missing"
>
&2
help
;
exit
1
fi
;;
# registry url optional argument
-r
|
--registry-url
)
if
[
-n
"
$2
"
]
&&
[
"
${
2
:0:1
}
"
!=
"-"
]
;
then
REGISTRY_URL
=
$2
shift
2
else
echo
"Error: Argument for
$1
is missing"
>
&2
help
;
exit
1
fi
;;
# wait timeout optional argument
-w
|
--wait-timeout
)
if
[
-n
"
$2
"
]
&&
[
"
${
2
:0:1
}
"
!=
"-"
]
;
then
WAIT_TIMEOUT
=
$2
shift
2
else
echo
"Error: Argument for
$1
is missing"
>
&2
help
;
exit
1
fi
;;
# help flag
-h
|
--help
)
help
;
exit
0
;;
# Check if private-registry secret exists
-s
|
--use-existing-secret
)
check_secrets
;
shift
;;
# unsupported flags
-
*
|
--
*
=
)
echo
"Error: Unsupported flag
$1
"
>
&2
help
;
exit
1
;;
# preserve positional arguments
*
)
PARAMS
=
"
$PARAMS
$1
"
shift
;;
while
((
"$#"
))
;
do
case
"
$1
"
in
# registry username required argument
-u
|
--registry-username
)
if
[
-n
"
$2
"
]
&&
[
"
${
2
:0:1
}
"
!=
"-"
]
;
then
REGISTRY_USERNAME
=
$2
shift
2
else
echo
"Error: Argument for
$1
is missing"
>
&2
help
exit
1
fi
;;
# registry password required argument
-p
|
--registry-password
)
if
[
-n
"
$2
"
]
&&
[
"
${
2
:0:1
}
"
!=
"-"
]
;
then
REGISTRY_PASSWORD
=
$2
shift
2
else
echo
"Error: Argument for
$1
is missing"
>
&2
help
exit
1
fi
;;
# registry email required argument
-e
|
--registry-email
)
if
[
-n
"
$2
"
]
&&
[
"
${
2
:0:1
}
"
!=
"-"
]
;
then
REGISTRY_EMAIL
=
$2
shift
2
else
echo
"Error: Argument for
$1
is missing"
>
&2
help
exit
1
fi
;;
# registry url optional argument
-r
|
--registry-url
)
if
[
-n
"
$2
"
]
&&
[
"
${
2
:0:1
}
"
!=
"-"
]
;
then
REGISTRY_URL
=
$2
shift
2
else
echo
"Error: Argument for
$1
is missing"
>
&2
help
exit
1
fi
;;
# wait timeout optional argument
-w
|
--wait-timeout
)
if
[
-n
"
$2
"
]
&&
[
"
${
2
:0:1
}
"
!=
"-"
]
;
then
WAIT_TIMEOUT
=
$2
shift
2
else
echo
"Error: Argument for
$1
is missing"
>
&2
help
exit
1
fi
;;
# help flag
-h
|
--help
)
help
exit
0
;;
# Check if private-registry secret exists
-s
|
--use-existing-secret
)
check_secrets
shift
;;
# unsupported flags
-
*
|
--
*
=
)
echo
"Error: Unsupported flag
$1
"
>
&2
help
exit
1
;;
# preserve positional arguments
*
)
PARAMS
=
"
$PARAMS
$1
"
shift
;;
esac
done
...
...
@@ -126,7 +131,8 @@ if [ -z "$FLUX_SECRET_EXISTS" ] || [ "$FLUX_SECRET_EXISTS" -eq 1 ]; then
# check required arguments
if
[
-z
"
$REGISTRY_USERNAME
"
]
||
[
-z
"
$REGISTRY_PASSWORD
"
]
;
then
help
;
exit
1
help
exit
1
fi
# debug print cli args
...
...
@@ -147,9 +153,20 @@ fi
#
# install flux
#
echo
"Installing flux from kustomization"
kustomize build
"
$FLUX_KUSTOMIZATION
"
|
sed
"s/registry1.dso.mil/
${
REGISTRY_URL
}
/g"
| kubectl apply
-f
-
KUBECTL_VERSION
=
$(
kubectl version
--client
--short
|
awk
-F
"v"
'{print $NF}'
)
KUBECTL_MIN_VERSION
=
"1.21.0"
if
[
"
$(
printf
'%s\n'
"
$KUBECTL_MIN_VERSION
"
"
$KUBECTL_VERSION
"
|
sort
-V
|
head
-n1
)
"
=
"
$KUBECTL_MIN_VERSION
"
]
;
then
kubectl kustomize
"
$FLUX_KUSTOMIZATION
"
|
sed
"s/registry1.dso.mil/
${
REGISTRY_URL
}
/g"
| kubectl apply
-f
-
else
if
[
command
-v
kustomize
]
>
/dev/null 2>&1
;
then
echo
"Kustomize not found"
exit
1
else
kustomize build
"
$FLUX_KUSTOMIZATION
"
|
sed
"s/registry1.dso.mil/
${
REGISTRY_URL
}
/g"
| kubectl apply
-f
-
fi
fi
#
# verify flux
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment