Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
postgres-operator
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
zalando
postgres-operator
Commits
35803a8c
Commit
35803a8c
authored
6 years ago
by
Sergey Dudoladov
Browse files
Options
Downloads
Patches
Plain Diff
Add a command to replace operator image w/o minikube restart
parent
637067e8
Branches
Branches containing commit
Tags
v1.13.0
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
run_operator_locally.sh
+18
-8
18 additions, 8 deletions
run_operator_locally.sh
with
18 additions
and
8 deletions
run_operator_locally.sh
+
18
−
8
View file @
35803a8c
...
...
@@ -6,6 +6,7 @@
# Known limitations:
# 1) minikube provides a single node k8s cluster. That is, you will not be able test functions like pod
# migration between multiple nodes locally
# 2) this script configures the operator via configmap, not the operator CRD
# enable unofficial bash strict mode
...
...
@@ -43,7 +44,7 @@ function retry(){
}
function
display_help
(){
echo
"Usage:
$0
[ -r | --rebuild-operator ] [ -h | --help ] [ -
f
| --
force-minikube-restart
] [ -t | --deploy-pg-to-namespace-test ]"
echo
"Usage:
$0
[ -r | --rebuild-operator ] [ -h | --help ] [ -
n
| --
deploy-new-operator-image
] [ -t | --deploy-pg-to-namespace-test ]"
}
function
clean_up
(){
...
...
@@ -126,7 +127,7 @@ function deploy_self_built_image() {
# docker should not attempt to fetch it from the registry due to imagePullPolicy
sed
--expression
"s/
\(
image
\:
.*
\:\)
.*
$/
\1
$TAG
/; s/smoke-tested-//"
manifests/postgres-operator.yaml
>
"
$PATH_TO_LOCAL_OPERATOR_MANIFEST
"
retry
"kubectl
create
-f
\"
$PATH_TO_LOCAL_OPERATOR_MANIFEST
\"
"
"attempt to create
$PATH_TO_LOCAL_OPERATOR_MANIFEST
resource"
retry
"kubectl
apply
-f
\"
$PATH_TO_LOCAL_OPERATOR_MANIFEST
\"
"
"attempt to create
$PATH_TO_LOCAL_OPERATOR_MANIFEST
resource"
}
...
...
@@ -142,17 +143,18 @@ function start_operator(){
retry
"kubectl create -f manifests/
\"
$file
\"
"
"attempt to create
$file
resource"
done
cp
manifests/postgres-operator.yaml
$PATH_TO_LOCAL_OPERATOR_MANIFEST
if
[[
"
$should_build_custom_operator
"
=
true
]]
;
then
# set in main()
deploy_self_built_image
else
retry
"kubectl
create -f
manifests/postgres-operator.yaml"
"attempt to create /postgres-operator.yaml
resource"
retry
"kubectl create -f
${
PATH_TO_LOCAL_OPERATOR_MANIFEST
}
"
"attempt to create
${
PATH_TO_LOCAL_OPERATOR_MANIFEST
}
resource"
fi
local
-r
msg
=
"Wait for the postgresql custom resource definition to register..."
local
-r
cmd
=
"kubectl get crd | grep --quiet 'postgresqls.acid.zalan.do'"
retry
"
$cmd
"
"
$msg
"
}
...
...
@@ -188,6 +190,7 @@ function check_health(){
fi
}
function
submit_postgresql_manifest
(){
echo
"==== SUBMIT MINIMAL POSTGRES MANIFEST ==== "
...
...
@@ -206,6 +209,7 @@ function submit_postgresql_manifest(){
}
function
main
(){
if
!
[[
$(
basename
"
$PWD
"
)
==
"postgres-operator"
]]
;
then
...
...
@@ -217,7 +221,7 @@ function main(){
local
should_build_custom_operator
=
false
local
should_deploy_pg_to_namespace_test
=
false
local
should_re
start_minikub
e
=
false
local
should_re
place_operator_imag
e
=
false
while
true
do
...
...
@@ -227,12 +231,12 @@ function main(){
display_help
exit
0
;;
-r
|
--rebuild-operator
)
-r
|
--rebuild-operator
)
# with minikube restart
should_build_custom_operator
=
true
break
;;
-
f
|
--
force-
minikube
-
restart
)
# restarts
take minutes
so existing minikube is re-used by default
should_re
start_minikub
e
=
true
-
n
|
--
deploy-new-operator-image
)
# without
minikube
restart
that
take
s
minutes
should_re
place_operator_imag
e
=
true
break
;;
-t
|
--deploy-pg-to-namespace-test
)
# to test multi-namespace support locally
...
...
@@ -244,6 +248,11 @@ function main(){
esac
done
if
${
should_replace_operator_image
}
;
then
deploy_self_built_image
exit
0
fi
clean_up
start_minikube
start_operator
...
...
@@ -254,4 +263,5 @@ function main(){
exit
0
}
main
"
$@
"
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