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

K8SPXC-1342 community bundle generation. #1843

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

nmarukovich
Copy link
Contributor

@nmarukovich nmarukovich commented Oct 13, 2024

K8SPXC-1342 Powered by Pull Request Badge

CHANGE DESCRIPTION

Problem:
Short explanation of the problem.
community bundle generation.
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?
  • Are OpenShift compare files changed for E2E tests (compare/*-oc.yml)?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are all needed new/changed options added to the Helm Chart?
  • 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 PXC version?
  • Does the change support oldest and newest supported Kubernetes version?

@pull-request-size pull-request-size bot added the size/XXL 1000+ lines label Oct 13, 2024
@hors hors requested a review from jvpasinatto October 14, 2024 15:07
nmarukovich and others added 4 commits October 16, 2024 11:42
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@nmarukovich nmarukovich marked this pull request as ready for review October 16, 2024 15:34
@nmarukovich nmarukovich marked this pull request as draft October 16, 2024 15:41
nmarukovich and others added 2 commits October 17, 2024 13:23
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@nmarukovich nmarukovich marked this pull request as ready for review October 17, 2024 10:29
nmarukovich and others added 3 commits October 17, 2024 14:56
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@egegunes egegunes added this to the v1.16.0 milestone Nov 18, 2024
@egegunes
Copy link
Contributor

@jvpasinatto could you please review?

@nmarukovich could you please fix conflicts?

@hors hors modified the milestones: v1.16.0, v1.17.0 Dec 20, 2024
# https://github.com/redhat-openshift-ecosystem/certification-releases/blob/main/4.9/ga/troubleshooting.md#get-supported-versions
file_name='percona-xtradb-cluster-operator'

if [ ${MODE} == "cluster" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

[shellcheck (suggestion)] reported by reviewdog 🐶

Suggested change
if [ ${MODE} == "cluster" ]; then
if [ "${MODE}" == "cluster" ]; then

mode="Cluster"
rulesLevel="ClusterPermissions"

elif [ ${MODE} == "namespace" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

[shellcheck (suggestion)] reported by reviewdog 🐶

Suggested change
elif [ ${MODE} == "namespace" ]; then
elif [ "${MODE}" == "namespace" ]; then

.annotations["com.redhat.openshift.versions"] = env(openshift_supported_versions)' \
bundle.annotations.yaml >"${bundle_directory}/metadata/annotations.yaml"

if [ ${DISTRIBUTION} == 'community' ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

[shellcheck (suggestion)] reported by reviewdog 🐶

Suggested change
if [ ${DISTRIBUTION} == 'community' ]; then
if [ "${DISTRIBUTION}" == 'community' ]; then

"${bundle_directory}/metadata/annotations.yaml"

# certified-operators
elif [ ${DISTRIBUTION} == 'redhat' ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

[shellcheck (suggestion)] reported by reviewdog 🐶

Suggested change
elif [ ${DISTRIBUTION} == 'redhat' ]; then
elif [ "${DISTRIBUTION}" == 'redhat' ]; then

"${bundle_directory}/metadata/annotations.yaml"

# redhat-marketplace
elif [ ${DISTRIBUTION} == 'marketplace' ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

[shellcheck (suggestion)] reported by reviewdog 🐶

Suggested change
elif [ ${DISTRIBUTION} == 'marketplace' ]; then
elif [ "${DISTRIBUTION}" == 'marketplace' ]; then

.spec.install.spec.deployments = [( env(deployment) | .[] |{ "name": .metadata.name, "spec": .spec} )] |
.spec.minKubeVersion = env(minKubeVer)' bundle.csv.yaml >"${bundle_directory}/manifests/${file_name}.clusterserviceversion.yaml"

if [ ${DISTRIBUTION} == "community" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

[shellcheck (suggestion)] reported by reviewdog 🐶

Suggested change
if [ ${DISTRIBUTION} == "community" ]; then
if [ "${DISTRIBUTION}" == "community" ]; then

if [ ${DISTRIBUTION} == "community" ]; then
update_yaml_images "bundles/$DISTRIBUTION/manifests/${file_name}.clusterserviceversion.yaml"

elif [ ${DISTRIBUTION} == "redhat" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

[shellcheck (suggestion)] reported by reviewdog 🐶

Suggested change
elif [ ${DISTRIBUTION} == "redhat" ]; then
elif [ "${DISTRIBUTION}" == "redhat" ]; then

.metadata.name = strenv(name_certified)' \
"${bundle_directory}/manifests/${file_name}.clusterserviceversion.yaml"

elif [ ${DISTRIBUTION} == "marketplace" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

[shellcheck (suggestion)] reported by reviewdog 🐶

Suggested change
elif [ ${DISTRIBUTION} == "marketplace" ]; then
elif [ "${DISTRIBUTION}" == "marketplace" ]; then

fi

update_yaml_images() {
local yaml_file="$1"
Copy link
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
local yaml_file="$1"
local yaml_file="$1"

Comment on lines +42 to +45
if [ ! -f "$yaml_file" ]; then
echo "Error: File '$yaml_file' does not exist."
return 1
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
if [ ! -f "$yaml_file" ]; then
echo "Error: File '$yaml_file' does not exist."
return 1
fi
if [ ! -f "$yaml_file" ]; then
echo "Error: File '$yaml_file' does not exist."
return 1
fi

return 1
fi

local temp_file=$(mktemp)
Copy link
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
local temp_file=$(mktemp)
local temp_file=$(mktemp)

Comment on lines +49 to +50
sed -E 's/(("image":|containerImage:|image:)[ ]*"?)([^"]+)("?)/\1docker.io\/\3\4/g' "$yaml_file" > "$temp_file"
mv "$temp_file" "$yaml_file"
Copy link
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
sed -E 's/(("image":|containerImage:|image:)[ ]*"?)([^"]+)("?)/\1docker.io\/\3\4/g' "$yaml_file" > "$temp_file"
mv "$temp_file" "$yaml_file"
sed -E 's/(("image":|containerImage:|image:)[ ]*"?)([^"]+)("?)/\1docker.io\/\3\4/g' "$yaml_file" >"$temp_file"
mv "$temp_file" "$yaml_file"

sed -E 's/(("image":|containerImage:|image:)[ ]*"?)([^"]+)("?)/\1docker.io\/\3\4/g' "$yaml_file" > "$temp_file"
mv "$temp_file" "$yaml_file"

echo "File '$yaml_file' updated successfully."
Copy link
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
echo "File '$yaml_file' updated successfully."
echo "File '$yaml_file' updated successfully."


ANNOTATIONS="${labels}" envsubst <bundle.Dockerfile >"${bundle_directory}/Dockerfile"

awk '{gsub(/^[ \t]+/, " "); print}' "${bundle_directory}/Dockerfile" > "${bundle_directory}/Dockerfile.new" && mv "${bundle_directory}/Dockerfile.new" "${bundle_directory}/Dockerfile"
Copy link
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
awk '{gsub(/^[ \t]+/, " "); print}' "${bundle_directory}/Dockerfile" > "${bundle_directory}/Dockerfile.new" && mv "${bundle_directory}/Dockerfile.new" "${bundle_directory}/Dockerfile"
awk '{gsub(/^[ \t]+/, " "); print}' "${bundle_directory}/Dockerfile" >"${bundle_directory}/Dockerfile.new" && mv "${bundle_directory}/Dockerfile.new" "${bundle_directory}/Dockerfile"

.spec.minKubeVersion = env(minKubeVer)' bundle.csv.yaml >"${bundle_directory}/manifests/${file_name}.clusterserviceversion.yaml"

if [ ${DISTRIBUTION} == "community" ]; then
update_yaml_images "bundles/$DISTRIBUTION/manifests/${file_name}.clusterserviceversion.yaml"
Copy link
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
update_yaml_images "bundles/$DISTRIBUTION/manifests/${file_name}.clusterserviceversion.yaml"
update_yaml_images "bundles/$DISTRIBUTION/manifests/${file_name}.clusterserviceversion.yaml"

# delete blank lines.
sed -i '' '/^$/d' "${bundle_directory}/manifests/${file_name}.clusterserviceversion.yaml"

if >/dev/null command -v tree; then tree -C "${bundle_directory}"; fi
Copy link
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
if >/dev/null command -v tree; then tree -C "${bundle_directory}"; fi
if >/dev/null command -v tree; then tree -C "${bundle_directory}"; fi

@JNKPercona
Copy link
Collaborator

Test name Status
affinity-8-0 passed
auto-tuning-8-0 passed
cross-site-8-0 passed
custom-users-8-0 passed
demand-backup-cloud-8-0 passed
demand-backup-encrypted-with-tls-8-0 passed
demand-backup-8-0 passed
haproxy-5-7 passed
haproxy-8-0 passed
init-deploy-5-7 passed
init-deploy-8-0 passed
limits-8-0 passed
monitoring-2-0-8-0 passed
one-pod-5-7 passed
one-pod-8-0 passed
pitr-8-0 failure
pitr-gap-errors-8-0 passed
proxy-protocol-8-0 passed
proxysql-sidecar-res-limits-8-0 passed
pvc-resize-5-7 passed
pvc-resize-8-0 passed
recreate-8-0 passed
restore-to-encrypted-cluster-8-0 passed
scaling-proxysql-8-0 passed
scaling-8-0 passed
scheduled-backup-5-7 passed
scheduled-backup-8-0 passed
security-context-8-0 passed
smart-update1-8-0 passed
smart-update2-8-0 passed
storage-8-0 passed
tls-issue-cert-manager-ref-8-0 passed
tls-issue-cert-manager-8-0 passed
tls-issue-self-8-0 passed
upgrade-consistency-8-0 passed
upgrade-haproxy-5-7 passed
upgrade-haproxy-8-0 passed
upgrade-proxysql-5-7 passed
upgrade-proxysql-8-0 passed
users-5-7 passed
users-8-0 passed
validation-hook-8-0 passed
We run 42 out of 42

commit: a8f6c52
image: perconalab/percona-xtradb-cluster-operator:PR-1843-a8f6c523

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XXL 1000+ lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants