Skip to content

Conversation

pooknull
Copy link
Collaborator

@pooknull pooknull commented Oct 22, 2024

https://perconadev.atlassian.net/browse/CLOUD-861

This PR introduces a new binary, operator-tool, which automates the generation of source files for operators.

See README.md for more details.


Still to be done (could be addressed in future PRs):

  • option to update of tests in api-tests directory
  • option to generate *.dep.json files
  • add unit-tests

@JNKPercona
Copy link

Test name Status
api-tests failed

@jvpasinatto
Copy link
Contributor

A few points:

  1. The tool is returning the full list of pmm images(or the diff when providing a file), but we only need the latest. If we gonna put more than one, we need to align with the team.
  2. Currently, we set the status to "recommended" for the latest of each one of major version(ex: for "postgresql" we have 5 recommended db versions), we need to align what should be the proper way, as the tool is setting only the latest major version as "recommended".
  3. I think we should have an error when an object is empty. For ex, if I specify --operator "pg-operator" --version "2.5.1" the operator object is empty because this image does not exist yet, but we have no feedback.
  4. The keys for the PXC images are missing the versions after dash. Ex: 5.7.44 but should be 5.7.44-31.65
  5. It would be nice to have an option to have a "patch release", so the tool does not try to get the latest images of the softwares, but only update the operator images, and needed software tags.

Comment on lines 28 to 34
$ ./bin/operator-tool --operator "psmdb-operator" --version "1.17.0" # outputs source file for psmdb-operator
...
$ ./bin/operator-tool --operator "pg-operator" --version "2.5.0" # outputs source file for pg-operator
...
$ ./bin/operator-tool --operator "ps-operator" --version "0.8.0" # outputs source file for ps-operator
...
$ ./bin/operator-tool --operator "pxc-operator" --version "1.15.1" # outputs source file for pxc-operator
Copy link
Contributor

Choose a reason for hiding this comment

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

since the flag is already --operator maybe we can just use --operator psmdb or --operator pxc, wdyt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@JNKPercona
Copy link

Test name Status
api-tests failed

@JNKPercona
Copy link

Test name Status
api-tests failed

@JNKPercona
Copy link

Test name Status
api-tests failed

@JNKPercona
Copy link

Test name Status
api-tests failed

@JNKPercona
Copy link

Test name Status
api-tests failed

@JNKPercona
Copy link

Test name Status
api-tests failed

@JNKPercona
Copy link

Test name Status
api-tests failed

@JNKPercona
Copy link

Test name Status
api-tests failed

}

func PSMDB(f *filler.VersionFiller, version string) (*vsAPI.VersionMatrix, error) {
mongoVersions, err := productsapi.GetProductVersions("percona-server-mongodb-", "percona-server-mongodb-7.0", "percona-server-mongodb-6.0", "percona-server-mongodb-5.0")
Copy link
Contributor

Choose a reason for hiding this comment

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

please include mongo 8.0

Copy link
Contributor

Choose a reason for hiding this comment

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

and remove mongo 5.0

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

return nil, err
}

xtrabackupVersions, err := productsapi.GetProductVersions("Percona-XtraBackup-", "Percona-XtraBackup-8.0", "Percona-XtraBackup-2.4")
Copy link
Contributor

Choose a reason for hiding this comment

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

please include pxc 8.4

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

)

func PG(f *filler.VersionFiller, version string) (*vsAPI.VersionMatrix, error) {
pgVersions, err := productsapi.GetProductVersions("", "postgresql-distribution-16", "postgresql-distribution-15", "postgresql-distribution-14", "postgresql-distribution-13", "postgresql-distribution-12")
Copy link
Contributor

Choose a reason for hiding this comment

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

please include pg 17

Copy link
Contributor

Choose a reason for hiding this comment

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

and remove pg 12

Copy link
Collaborator Author

Choose a reason for hiding this comment

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


import "strings"

func GetArchSuffixes() []string {
Copy link
Contributor

Choose a reason for hiding this comment

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

we actually only need -multi for now

Copy link
Collaborator Author

@pooknull pooknull Feb 27, 2025

Choose a reason for hiding this comment

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

This function shows all known arch suffixes for the image. It's used for truncating suffixes from images, not for including them.

This commit makes operator-tool to include only multi and amd64 images: 6ebf2b3

// Logic:
// - If an image supports both amd64 and arm64 architectures and has a "-multi" suffix in its tag,
// the function includes a version of the image tag without the "-multi" suffix in the map.
// - If no image with both amd64 and arm64 builds is found, separate images for amd64 and arm64
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't need separated images for arm64 and amd64, as we don't need arm64 images individually.
When a image does not have arm64, just provide the it's tag with only amd64 hash.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Specify an older source file. The operator-tool will exclude any versions that are older than those listed in this file
-include-arch-images
Include images with "-multi", "-arm64", "-aarch64" suffixes in the output file
-only-latest
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm using ./bin/operator-tool -operator psmdb --version 1.19.0 --only-latest --include-arch-images --file sources/operator.1.18.0.psmdb-operator.json

This makes backup, operator and pmm have 2 images, but ideally we want just the latest.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

When --file is used with --only-latest, operator-tool appends latest images to the provided file.

This commit makes operator-tool to output only the latest images if the --file is not specified.: fdc56d5

@pooknull pooknull changed the title WIP: Automate operator release CLOUD-861: Automate operator release Feb 27, 2025
@JNKPercona
Copy link

Test name Status
api-tests passed

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.

4 participants