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

K8SPG-391 openshift certification #556

Merged
merged 22 commits into from
Nov 3, 2023
Merged

Conversation

nmarukovich
Copy link
Contributor

@nmarukovich nmarukovich commented Oct 30, 2023

K8SPG-391 Powered by Pull Request Badge

CHANGE DESCRIPTION

Problem:
Short explanation of the problem.

Cause:
Short explanation of the root cause of the issue if applicable.

Solution:
Short explanation of the solution we are providing with this PR.

CHECKLIST

Jira

  • Is the Jira ticket created and referenced properly?
  • Does the Jira ticket have the proper statuses for documentation (Needs Doc) and QA (Needs QA)?
  • Does the Jira ticket link to the proper milestone (Fix Version field)?

Tests

  • Is an E2E test/test case added for the new feature/change?
  • Are unit tests added where appropriate?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are the manifests (crd/bundle) regenerated if needed?
  • Did we add proper logging messages for operator actions?
  • Did we ensure compatibility with the previous version or cluster upgrade process?
  • Does the change support oldest and newest supported PG version?
  • Does the change support oldest and newest supported Kubernetes version?

e2e-tests/functions Outdated Show resolved Hide resolved
e2e-tests/functions Outdated Show resolved Hide resolved
e2e-tests/functions Outdated Show resolved Hide resolved
e2e-tests/functions Outdated Show resolved Hide resolved
nmarukovich and others added 3 commits October 30, 2023 11:58
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…a/percona-postgresql-operator into K8SPG-391_openshift_certification
@nmarukovich nmarukovich marked this pull request as ready for review October 30, 2023 12:28
pooknull
pooknull previously approved these changes Oct 31, 2023
hors
hors previously approved these changes Oct 31, 2023
create_namespace() {
local namespace=$1
if [[ ${CLEAN_NAMESPACE} == 1 ]]; then
if [ -n "$OPENSHIFT" ]; then
Copy link
Contributor

@ptankov ptankov Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double square brackets [[ ]] are generally preferable over single square brackets [ ] in Bash. Would you consider, for example, using
if [[ $OPENSHIFT ]]; then
here?
Also, the quotes around "$OPENSHIFT" are superfluous.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O! Nice! I will fix it tomorrow.

@@ -5,14 +5,33 @@ ROOT_REPO=${ROOT_REPO:-$(realpath ../../..)}
source "${ROOT_REPO}/e2e-tests/vars.sh"
test_name=$(basename "$(pwd)")

if oc get projects; then
Copy link
Contributor

@ptankov ptankov Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you mean
if oc get projects > /dev/null 2>&1; then

create_namespace() {
local namespace=$1
if [[ ${CLEAN_NAMESPACE} == 1 ]]; then
if [ -n "$OPENSHIFT" ]; then
if [ -n "$OPERATOR_NS" -a $(oc get project "$OPERATOR_NS" -o json | jq -r '.metadata.name') ]; then
Copy link
Contributor

@ptankov ptankov Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • same as above for the double square brackets
  • also, are you sure this is the comparison you actually mean? Did you mean:
set -o pipefail
if [[ "$OPERATOR_NS"  ]] && oc get project "$OPERATOR_S" -o json > /dev/null 2>&1 | jq -r '.metadata.name' > /dev/null 2>&1; then

@@ -240,8 +259,23 @@ wait_for_delete() {
deploy_pmm_server() {
local platform=kubernetes
helm uninstall -n "${NAMESPACE}" pmm || :
helm install monitoring -n "${NAMESPACE}" --set imageTag=${IMAGE_PMM_SERVER#*:} --set service.type="LoadBalancer" \
--set imageRepo=${IMAGE_PMM_SERVER%:*} --set platform="${platform}" "https://percona-charts.storage.googleapis.com/pmm-server-${PMM_SERVER_VERSION}.tgz"
if [ ! -z "$OPENSHIFT" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above about [[

helm install monitoring --set imageTag=${IMAGE_PMM_SERVER#*:} --set imageRepo=${IMAGE_PMM_SERVER%:*} --set platform=$platform --set sa=pmm-server --set supresshttp2=false https://percona-charts.storage.googleapis.com/pmm-server-${PMM_SERVER_VERSION}.tgz -n "${NAMESPACE}"
else
helm install monitoring -n "${NAMESPACE}" --set imageTag=${IMAGE_PMM_SERVER#*:} --set service.type="LoadBalancer" \
--set imageRepo=${IMAGE_PMM_SERVER%:*} --set platform="${platform}" "https://percona-charts.storage.googleapis.com/pmm-server-${PMM_SERVER_VERSION}.tgz"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this case, what is the value of $platform?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kubernetes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the variable $platform initialized as "kubernetes"? I couldn't find that.

--set imageRepo=${IMAGE_PMM_SERVER%:*} --set platform="${platform}" "https://percona-charts.storage.googleapis.com/pmm-server-${PMM_SERVER_VERSION}.tgz"
if [ ! -z "$OPENSHIFT" ]; then
platform=openshift
oc create sa pmm-server -n "${NAMESPACE}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, with some very few exceptions, there is no need to use ${VARIABLE} in Bash. Just $VARIABLE is enough, avoids clutter and makes the code easier to read.

@nmarukovich nmarukovich dismissed stale reviews from hors and pooknull via 66d5c6c November 1, 2023 06:33
e2e-tests/functions Outdated Show resolved Hide resolved
e2e-tests/functions Outdated Show resolved Hide resolved
e2e-tests/functions Outdated Show resolved Hide resolved
e2e-tests/functions Outdated Show resolved Hide resolved
create_namespace() {
local namespace=$1
if [[ ${CLEAN_NAMESPACE} == 1 ]]; then
if [[ -n $OPENSHIFT ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-n is not needed here, just if [[ $OPENSHIFT ]]; then is perfectly fine

create_namespace() {
local namespace=$1
if [[ ${CLEAN_NAMESPACE} == 1 ]]; then
if [[ -n $OPENSHIFT ]]; then
if [[ -n $OPERATOR_NS && $(oc get project "$OPERATOR_NS" -o json | jq -r '.metadata.name') ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-n is not needed here just like above, also, I think the second part of the comparrison must be outside of the square brackets, like this:
if [[ "$OPERATOR_NS" ]] && oc get project "$OPERATOR_S" -o json > /dev/null 2>&1 | jq -r '.metadata.name' > /dev/null 2>&1; then
because the command oc get projec ... would return some string which will always be true

@@ -240,8 +259,23 @@ wait_for_delete() {
deploy_pmm_server() {
local platform=kubernetes
helm uninstall -n "${NAMESPACE}" pmm || :
helm install monitoring -n "${NAMESPACE}" --set imageTag=${IMAGE_PMM_SERVER#*:} --set service.type="LoadBalancer" \
--set imageRepo=${IMAGE_PMM_SERVER%:*} --set platform="${platform}" "https://percona-charts.storage.googleapis.com/pmm-server-${PMM_SERVER_VERSION}.tgz"
if [[ -n $OPENSHIFT ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for -n

e2e-tests/functions Outdated Show resolved Hide resolved
nmarukovich and others added 4 commits November 1, 2023 12:54
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
e2e-tests/functions Outdated Show resolved Hide resolved
e2e-tests/functions Outdated Show resolved Hide resolved
hors and others added 3 commits November 2, 2023 16:39
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
e2e-tests/functions Outdated Show resolved Hide resolved
@hors hors self-requested a review November 2, 2023 18:20
hors
hors previously approved these changes Nov 2, 2023
@egegunes
Copy link
Contributor

egegunes commented Nov 3, 2023

@@ -312,6 +345,9 @@ deploy_chaos_mesh() {

helm repo add chaos-mesh https://charts.chaos-mesh.org
helm install chaos-mesh chaos-mesh/chaos-mesh --namespace=${NAMESPACE} --set chaosDaemon.runtime=containerd --set chaosDaemon.socketPath=/run/containerd/containerd.sock --set dashboard.create=false --version 2.5.1
if [ ! -z "$OPENSHIFT" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use if [[ $OPENSHIFT ]]; like above or also if [ -n "$OPENSHIFT" ] instead of negation.

…a/percona-postgresql-operator into K8SPG-391_openshift_certification
@nmarukovich
Copy link
Contributor Author

@nmarukovich should we set openshift: true in cr.yaml? https://github.com/percona/percona-postgresql-operator/blob/main/deploy/cr.yaml#L22

I can't see any difference do we use this option or not. As I understood from the code we check it automatically
https://github.com/percona/percona-postgresql-operator/blob/main/cmd/postgres-operator/main.go#L218
Am I wrong?

@ptankov ptankov self-requested a review November 3, 2023 08:12
@JNKPercona
Copy link
Collaborator

Test name Status
demand-backup passed
init-deploy passed
monitoring passed
operator-self-healing passed
scaling passed
scheduled-backup passed
self-healing passed
start-from-backup passed
telemetry-transfer passed
users passed
We run 10 out of 10

commit: f9b0017
image: perconalab/percona-postgresql-operator:PR-556-f9b0017fa

@nmarukovich nmarukovich requested a review from tplavcic November 3, 2023 09:03
@hors hors merged commit dfad89f into main Nov 3, 2023
11 checks passed
@hors hors deleted the K8SPG-391_openshift_certification branch November 3, 2023 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants