Skip to content

Commit a9bd6d3

Browse files
author
Jeff McCormick
committed
clean up startup scripts
1 parent 36c4294 commit a9bd6d3

File tree

6 files changed

+38
-17
lines changed

6 files changed

+38
-17
lines changed

examples/operator/cleanup.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/bash -x
22
# Copyright 2016 Crunchy Data Solutions, Inc.
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -12,9 +12,13 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
$CMD delete configmap operator-conf
15+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1616

17-
$CMD --namespace=$CO_NAMESPACE delete deployment postgres-operator
17+
source $DIR/setup.sh
18+
19+
$CO_CMD delete configmap operator-conf
20+
21+
$CO_CMD --namespace=$CO_NAMESPACE delete deployment postgres-operator
1822

1923
sleep 10
2024

examples/operator/create-pv.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515

1616
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1717

18+
source $DIR/setup.sh
19+
1820
echo "create the test PV and PVC using the HostPath dir"
1921
for i in {1..60}
2022
do
2123
echo "creating PV crunchy-pv$i"
2224
export COUNTER=$i
23-
kubectl --namespace=$CO_NAMESPACE delete pv crunchy-pv$i
24-
envsubst < $DIR/crunchy-pv.json | kubectl --namespace=$CO_NAMESPACE create -f -
25+
$CO_CMD --namespace=$CO_NAMESPACE delete pv crunchy-pv$i
26+
envsubst < $DIR/crunchy-pv.json | $CO_CMD --namespace=$CO_NAMESPACE create -f -
2527
done

examples/operator/delete-pv.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515

1616
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1717

18+
source $DIR/setup.sh
19+
1820
for i in {1..15}
1921
do
2022
echo "deleting PV crunchy-pv$i"
21-
kubectl delete pv crunchy-pv$i
23+
$CO_CMD delete pv crunchy-pv$i
2224
done

examples/operator/run.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,7 @@
1515

1616
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1717

18-
19-
if [ -z "$CO_NAMESPACE" ]; then
20-
echo "CO_NAMESPACE not set, using default"
21-
export CO_NAMESPACE=default
22-
fi
23-
if [ -z "$CO_CMD" ]; then
24-
echo "CO_CMD not set, using kubectl"
25-
export CO_CMD=kubectl
26-
fi
18+
source $DIR/setup.sh
2719

2820
$DIR/cleanup.sh
2921

examples/operator/setup.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2016 Crunchy Data Solutions, Inc.
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
if [ -z "$CO_NAMESPACE" ]; then
15+
echo "CO_NAMESPACE not set, using default"
16+
export CO_NAMESPACE=default
17+
fi
18+
if [ -z "$CO_CMD" ]; then
19+
echo "CO_CMD not set, using kubectl"
20+
export CO_CMD=kubectl
21+
fi
22+
23+

operator/cluster/cluster_strategy_1.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,6 @@ func (r ClusterStrategy1) PrepareClone(clientset *kubernetes.Clientset, tprclien
339339

340340
log.Info("creating clone deployment using Strategy 1 in namespace " + namespace)
341341

342-
//TODO copy the secrets here instead of using existing secrets
343-
344342
//create the clone replica deployment and set replicas to 1
345343
replicaDeploymentFields := DeploymentTemplateFields{
346344
Name: cloneName,

0 commit comments

Comments
 (0)