Describe the problem/challenge you have
This is a follow-up of PR #2373 (back up all API Group Versions). We now need to introduce the ability to restore the Target Cluster APIGroup Preferred Version (TCPV). Today's default restores the source cluster APIGroup Preferred Version (SCPV).
This is ultimately to address #2251.
Describe the solution you'd like
I added a diagram here:
https://docs.google.com/presentation/d/1hpq3kwc4uYR96z1Jzi6G1TZMqq9YcBoIw-JcHqkSnnE/edit#slide=id.p1
Lingo:
Target Cluster APIGroup Preferred Version (TCPV) - from discovery client.
Source Cluster APIGroup Preferred Version (SCPV) - looking up the "preferredversion" directory inside the backup tarball.
Target Cluster APIGroup Supported Versions (TCSV) - array from discovery client.
Source Cluster APIGroup Supported Versions (SCSV) - array built looking up the versions inside the backup tarball.
Basically, wrap this new logic under the same feature flag "EnableAPIGroupVersions". Without this flag, restore logic stays the same.
If the feature flag is passed, the target cluster discovery client will contain a list of target cluster preferred versions (TCPV) and an array of all supported versions (TCSV).
If TCPV in found on the backup then
restore item using the TCPV in path inside the backup tarball
else if SCPV belongs in TCSV array then
restore item using the SCPV in path inside the backup tarball
else if SCSV and TCSV arrays have any element in common then
restore item common element version in path inside the backup tarball
else log an error or a warning "not supported API Group between the clusters"
Anything else you would like to add:
[Miscellaneous information that will assist in solving the issue.]
Environment:
1.4.0+ future
Describe the problem/challenge you have
This is a follow-up of PR #2373 (back up all API Group Versions). We now need to introduce the ability to restore the Target Cluster APIGroup Preferred Version (TCPV). Today's default restores the source cluster APIGroup Preferred Version (SCPV).
This is ultimately to address #2251.
Describe the solution you'd like
I added a diagram here:
https://docs.google.com/presentation/d/1hpq3kwc4uYR96z1Jzi6G1TZMqq9YcBoIw-JcHqkSnnE/edit#slide=id.p1
Lingo:
Target Cluster APIGroup Preferred Version (TCPV) - from discovery client.
Source Cluster APIGroup Preferred Version (SCPV) - looking up the "preferredversion" directory inside the backup tarball.
Target Cluster APIGroup Supported Versions (TCSV) - array from discovery client.
Source Cluster APIGroup Supported Versions (SCSV) - array built looking up the versions inside the backup tarball.
Basically, wrap this new logic under the same feature flag "EnableAPIGroupVersions". Without this flag, restore logic stays the same.
If the feature flag is passed, the target cluster discovery client will contain a list of target cluster preferred versions (TCPV) and an array of all supported versions (TCSV).
If TCPV in found on the backup then
restore item using the TCPV in path inside the backup tarball
else if SCPV belongs in TCSV array then
restore item using the SCPV in path inside the backup tarball
else if SCSV and TCSV arrays have any element in common then
restore item common element version in path inside the backup tarball
else log an error or a warning "not supported API Group between the clusters"
Anything else you would like to add:
[Miscellaneous information that will assist in solving the issue.]
Environment:
1.4.0+ future