-
Notifications
You must be signed in to change notification settings - Fork 37
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
[OADP-459] Caches getters, move MigrationRegistry annotation from common to imagestream plugin #133
Conversation
Initial testing indicates this PR works $ cat /tmp/openshift.io/velero-plugin/<uid>/openshift-adp/velero-sample-1/oadp-registry-config/registry.txt
<registryhostname>sh-4.4$ |
Looking at the different things being done in the common backup/restore plugins, the main thing that all pods, deployments, etc. need that we could cache is probably the result of the |
Cache GetRegistryInfo, GetServerVersion, GetBackup, getBackupStorageLocationForBackup, internalRegistrySystemContext
… condition for restore migLabel
if err != nil { | ||
return nil, err | ||
} | ||
annotations[RestoreRegistryHostname] = registryHostname | ||
|
||
if input.Restore.Labels[MigrationApplicationLabelKey] != MigrationApplicationLabelValue { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to imagestream, left migLabel alone
@@ -36,3 +70,96 @@ func migrationRegistrySystemContext() (*types.SystemContext, error) { | |||
return ctx, nil | |||
} | |||
|
|||
// Takes Namesapce where the operator resides, name of the BackupStorageLocation and name of configMap as input and returns the Route of backup registry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved here so we know only imagestream depends on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
notes
using plugin built from this PR latest commit backup of parks-app with restify DC scaled to 700 pods
about 30 seconds or so. using instead quay.io/konveyor/openshift-velero-plugin:latest yields
almost 3 minutes. |
see log difference |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. Might be worth making that one trivial change I suggested, removing the switch statement. Won't change much in terms of performance, but it will make the code more readable.
This PR is being updated to use structs in memory instead of writing to disk. |
As of 2b131ef
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach makes sense overall, but lets cache these values in the already-existing plugin structs rather than creating global vars.
"k8s.io/client-go/rest" | ||
) | ||
var ( | ||
registryInfo *string | ||
serverVersion *serverVersionStruct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of saving these in global vars, why not add them to the BackupPlugin
and RestorePlugin
structs? Seems like that would be a much cleaner design.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason is, these can be reused for the next backup if my understanding is right. Having them in BackupPlugin and RestorePlugin may result in higher memory usage.
"k8s.io/client-go/rest" | ||
) | ||
|
||
var ( | ||
internalRegistrySystemContextVar *types.SystemContext | ||
oadpRegistryRoute *string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As with common, I'd rather see this added to the BackupPlugin and RestorePlugin structs than use a global var.
|
…mon to imagestream plugin (#133) * registry tmp proto * use get for restore * add error text to log * reset err when reading route * Make dir before writing file * Cache GetRegistryInfo, GetServerVersion, GetBackup, getBackupStorageLocationForBackup * export WriteByteToDirPath * Cache internalRegistrySystemContext * move MigrationRegistry, SkipImageCopy to imagestream plugin, refactor condition for restore migLabel * remove redundant svcAccount switch/case * reduce params for GetRegistryInfo, use var instead of writing to disk (cherry picked from commit c231cbe)
See https://github.com/openshift/oadp-operator/blob/master/docs/config/custom_plugin_images.md on how to use custom images for testing
snippet of DPA with image built from this PR
OADP-459
getOADPRegistryRoute, GetRegistryInfo, GetServerVersion, GetBackup, getBackupStorageLocationForBackup, internalRegistrySystemContext