kubectl-operator
kubectl-operator copied to clipboard
Installing operators at a particular version requires the full CSV name
Right now, the kubectl operator uses an error-prone shortcut to enable users to provide just a --version flag to the install subcommand rather than the full starting CSV.
It starts by using the package name to lookup the CSV name at the head of the channel (the package name can be different than the base name of the CSV, e.g. prometheus vs prometheusoperator). So we can lookup prometheus and resolve to prometheusoperator.0.37.0.
The next step assumes the CSV name at the head of the channel contains a semver version, and it replaces the semver version it finds, with the desired version provided on the command line.
Now we have a guess for the name of the CSV for an earlier version. We blindly put the resulting value into the starting CSV field of the subscription and hope for the best.
We end up making 2 major assumptions, which could both fail:
- That the CSV name has a particular format,
- That all CSVs in a channel have the exact same format.
Can this be improved?