Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow upgrade from 11.x to 12.x #233

Merged
merged 2 commits into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/setup-e2e/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ runs:
- name: Download vertica RPM package
shell: bash
env:
VERTICA_CE_URL: "https://vertica-community-edition-for-testing.s3.amazonaws.com/XCz9cp7m/vertica-11.1.1-0.x86_64.RHEL6.rpm"
VERTICA_CE_URL: "https://vertica-community-edition-for-testing.s3.amazonaws.com/XCz9cp7m/vertica-12.0.0-0.x86_64.RHEL6.rpm"
run: |
curl $VERTICA_CE_URL -o docker-vertica/packages/vertica-x86_64.RHEL6.latest.rpm
2 changes: 1 addition & 1 deletion .github/workflows/e2e-azb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
[ ! -z "$E2E_PARALLELISM" ] && export E2E_PARALLELISM
export KUSTOMIZE_CFG=tests/kustomize-defaults-azb-ci.cfg
export MINIMAL_VERTICA_IMG=YES
scripts/run-k8s-int-tests.sh -e tests/external-images-azb-ci.txt
scripts/run-k8s-int-tests.sh -d -e tests/external-images-azb-ci.txt

- uses: actions/upload-artifact@v2
if: failure()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-hdfs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
[ ! -z "$E2E_PARALLELISM" ] && export E2E_PARALLELISM
export KUSTOMIZE_CFG=tests/kustomize-defaults-hdfs-ci.cfg
export MINIMAL_VERTICA_IMG=YES
scripts/run-k8s-int-tests.sh -e tests/external-images-hdfs-ci.txt
scripts/run-k8s-int-tests.sh -d -e tests/external-images-hdfs-ci.txt

- uses: actions/upload-artifact@v2
if: failure()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-operator-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
export MINIMAL_VERTICA_IMG=YES
export E2E_TEST_DIRS=tests/e2e-operator-upgrade-overlays
scripts/setup-operator-upgrade-testsuite.sh
scripts/run-k8s-int-tests.sh
scripts/run-k8s-int-tests.sh -d

- uses: actions/upload-artifact@v2
if: failure()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
E2E_PARALLELISM=${{ github.event.inputs.parallel }}
[ ! -z "$E2E_PARALLELISM" ] && export E2E_PARALLELISM
export MINIMAL_VERTICA_IMG=YES
scripts/run-k8s-int-tests.sh
scripts/run-k8s-int-tests.sh -d

- uses: actions/upload-artifact@v2
if: failure()
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-server-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
E2E_PARALLELISM=${{ github.event.inputs.parallel }}
[ ! -z "$E2E_PARALLELISM" ] && export E2E_PARALLELISM
export MINIMAL_VERTICA_IMG=YES
export BASE_VERTICA_IMG=vertica/vertica-k8s:11.1.0-0-minimal
export BASE_VERTICA_IMG=vertica/vertica-k8s:11.1.1-0-minimal
export E2E_TEST_DIRS=tests/e2e-server-upgrade
scripts/run-k8s-int-tests.sh
scripts/run-k8s-int-tests.sh -d -e tests/external-images-server-upgrade-ci.txt

- uses: actions/upload-artifact@v2
if: failure()
Expand Down
5 changes: 5 additions & 0 deletions changes/unreleased/Fixed-20220719-083301.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: Fixed
body: Allow Vertica upgrade from 11.x to 12.x.
time: 2022-07-19T08:33:01.813631821-03:00
custom:
Issue: "233"
9 changes: 9 additions & 0 deletions pkg/controllers/vdb/offlineupgrade_reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func (o *OfflineUpgradeReconciler) Reconcile(ctx context.Context, req *ctrl.Requ
// Start up vertica in each pod.
o.postRestartingClusterMsg,
o.addPodAnnotations,
o.runInstaller,
o.restartCluster,
// Apply labels so svc objects can route to the new pods that came up
o.addClientRoutingLabel,
Expand Down Expand Up @@ -258,6 +259,14 @@ func (o *OfflineUpgradeReconciler) addPodAnnotations(ctx context.Context) (ctrl.
return r.Reconcile(ctx, &ctrl.Request{})
}

// runInstaller will call the installer reconciler for the purpose of accepting
// the end user license agreement. This may have changed when we move to the
// new vertica version.
func (o *OfflineUpgradeReconciler) runInstaller(ctx context.Context) (ctrl.Result, error) {
r := MakeInstallReconciler(o.VRec, o.Log, o.Vdb, o.PRunner, o.PFacts)
return r.Reconcile(ctx, &ctrl.Request{})
}

// restartCluster will start up vertica. This is called after the statefulset's have
// been recreated. Once the cluster is back up, then the upgrade is considered complete.
func (o *OfflineUpgradeReconciler) restartCluster(ctx context.Context) (ctrl.Result, error) {
Expand Down
11 changes: 11 additions & 0 deletions pkg/controllers/vdb/onlineupgrade_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func (o *OnlineUpgradeReconciler) precomputeStatusMsgs(ctx context.Context) (ctr
"Recreating pods for primary subclusters",
"Checking if new version is compatible",
"Adding annotations to pods",
"Running installer",
"Waiting for secondary nodes to become read-only",
"Restarting vertica in primary subclusters",
}
Expand Down Expand Up @@ -342,6 +343,7 @@ func (o *OnlineUpgradeReconciler) restartPrimaries(ctx context.Context) (ctrl.Re
o.recreateSubclusterWithNewImage,
o.checkVersion,
o.addPodAnnotations,
o.runInstaller,
o.waitForReadOnly,
o.bringSubclusterOnline,
}
Expand Down Expand Up @@ -374,6 +376,7 @@ func (o *OnlineUpgradeReconciler) processSecondary(ctx context.Context, sts *app
o.recreateSubclusterWithNewImage,
o.postNextStatusMsgForSts,
o.addPodAnnotations,
o.runInstaller,
o.bringSubclusterOnline,
}
for _, fn := range funcs {
Expand Down Expand Up @@ -466,6 +469,14 @@ func (o *OnlineUpgradeReconciler) addPodAnnotations(ctx context.Context, sts *ap
return r.Reconcile(ctx, &ctrl.Request{})
}

// runInstaller will run the install reconciler. The main purpose is to accept
// the end user license agreement (eula). This may need to be accepted again if
// the eula changed in this new version of vertica.
func (o *OnlineUpgradeReconciler) runInstaller(ctx context.Context, sts *appsv1.StatefulSet) (ctrl.Result, error) {
r := MakeInstallReconciler(o.VRec, o.Log, o.Vdb, o.PRunner, o.PFacts)
return r.Reconcile(ctx, &ctrl.Request{})
}

// waitForReadOnly will only succeed if all of the up pods running the old image
// are in read-only state. This wait is necessary so that we don't try to do a
// 'AT -t restart_node' for the primary nodes when the cluster is in read-only.
Expand Down
15 changes: 13 additions & 2 deletions scripts/run-k8s-int-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,24 @@ BUILD_IMAGES=1
INT_TEST_OUTPUT_DIR=${REPO_DIR}/int-tests-output
CLUSTER_NAME=vertica
EXTRA_EXTERNAL_IMAGE_FILE=
DELETE_RPM=

# The make targets and the invoked shell scripts are directly run from the root directory.
function usage {
echo "$0 -l <log_dir> -n <cluster_name> -t <tag_name> -e <ext-image-file> [-hs]"
echo "$0 -l <log_dir> -n <cluster_name> -t <tag_name> -e <ext-image-file> [-hsd]"
echo
echo "Options:"
echo " -l <log_dir> Log directory. default: $INT_TEST_OUTPUT_DIR"
echo " -n <cluster_name> Name of the kind cluster. default: $CLUSTER_NAME"
echo " -t <tag_name> Tag. default: $TAG"
echo " -e <ext-image-file> File with list of additional images to pull prior to running e2e tests"
echo " -s Skip the building of the container images"
echo " -d Delete the RPM after the vertica image is built"
exit
}

OPTIND=1
while getopts l:n:t:hse: opt; do
while getopts l:n:t:hse:d opt; do
case ${opt} in
l)
INT_TEST_OUTPUT_DIR=${OPTARG}
Expand All @@ -60,6 +62,9 @@ while getopts l:n:t:hse: opt; do
exit 1
fi
;;
d)
DELETE_RPM=1
;;
h)
usage
;;
Expand Down Expand Up @@ -112,6 +117,12 @@ function build {

echo "Building all of the container images"
make docker-build vdb-gen

# To save space in CI, delete the RPM since we have create the image out of it
if [ -n "$DELETE_RPM" ]
then
rm $RPM_PATH
fi
}

# Build vertica images and push them to the kind environment
Expand Down
2 changes: 0 additions & 2 deletions tests/e2e-server-upgrade/README.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# (c) Copyright [2021-2022] Micro Focus or one of its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: kustomize build ../../manifests/communal-creds/overlay | kubectl apply -f - --namespace $NAMESPACE
- script: kustomize build ../../manifests/priv-container-creds/overlay | kubectl apply -f - --namespace $NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# (c) Copyright [2021-2022] Micro Focus or one of its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
kind: Pod
metadata:
labels:
control-plane: controller-manager
status:
phase: Running
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# (c) Copyright [2021-2022] Micro Focus or one of its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: sh -c "cd ../../.. && make deploy-operator NAMESPACE=$NAMESPACE"
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# (c) Copyright [2021-2022] Micro Focus or one of its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: vertica.com/v1beta1
kind: VerticaDB
metadata:
name: v-base-upgrade
status:
installCount: 3
addedToDBCount: 3
upNodeCount: 3
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# (c) Copyright [2021-2022] Micro Focus or one of its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: bash -c "kustomize build setup-vdb/overlay | kubectl -n $NAMESPACE apply -f - "
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# (c) Copyright [2021-2022] Micro Focus or one of its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: vertica.com/v1beta1
kind: VerticaDB
metadata:
name: v-base-upgrade
status:
conditions:
- type: AutoRestartVertica
status: "True"
- type: DBInitialized
status: "True"
- type: ImageChangeInProgress
status: "True"
- type: OfflineUpgradeInProgress
status: "True"
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# (c) Copyright [2021-2022] Micro Focus or one of its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: ../../../scripts/patch-image-in-vdb.sh -n $NAMESPACE v-base-upgrade
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# (c) Copyright [2021-2022] Micro Focus or one of its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: vertica.com/v1beta1
kind: VerticaDB
metadata:
name: v-base-upgrade
status:
installCount: 3
addedToDBCount: 3
upNodeCount: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Intentionally empty to give this step a name in kuttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# (c) Copyright [2021-2022] Micro Focus or one of its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: vertica.com/v1beta1
kind: VerticaDB
metadata:
name: v-base-upgrade
status:
conditions:
- type: AutoRestartVertica
status: "True"
- type: DBInitialized
status: "True"
- type: ImageChangeInProgress
status: "False"
- type: OfflineUpgradeInProgress
status: "False"
subclusterCount: 1
installCount: 3
upNodeCount: 3
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# (c) Copyright [2021-2022] Micro Focus or one of its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: kubectl wait --for=condition=OfflineUpgradeInProgress=False vdb/v-base-upgrade --timeout=600s
namespaced: true
Loading