-
Notifications
You must be signed in to change notification settings - Fork 71
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
fix: clean up code around velero server flags CLI command #1343
fix: clean up code around velero server flags CLI command #1343
Conversation
Signed-off-by: Mateus Oliveira <[email protected]>
Skipping CI for Draft Pull Request. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mateusoliveira43 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
// --default-snapshot-move-data Move data by default for all snapshots supporting data movement. | ||
// VeleroConfig.DefaultSnapshotMoveData | ||
|
||
// TODO --default-volume-snapshot-locations mapStringString List of unique volume providers and default volume snapshot location (provider1:location-01,provider2:location-02,...) |
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.
Are any of this TODO fields important and should be added?
// AutoCorrect is a collection of auto-correction functions for the DPA CR | ||
// These auto corrects are in-memory only and do not persist to the CR | ||
// There should not be another place where these auto-corrects are done | ||
func (dpa *DataProtectionApplication) AutoCorrect() { | ||
// TODO error instead of changing user object? |
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.
@shawn-hurley I think you once said we should not change values. Should we change this to be in validator or it is ok?
// last label overrides previous ones | ||
install.WithLabels(veleroDeployment.Labels), | ||
// use WithSecret false even if we have secret because we use a different VolumeMounts and EnvVars | ||
// see: https://github.com/vmware-tanzu/velero/blob/ed5809b7fc22f3661eeef10bdcb63f0d74472b76/pkg/install/deployment.go#L223-L261 | ||
// our secrets are appended to containers/volumeMounts in credentials.AppendPluginSpecificSpecs function | ||
install.WithSecret(false), | ||
install.WithServiceAccountName(common.Velero), | ||
// TODO remove | ||
install.WithFeatures(dpa.Spec.Configuration.Velero.FeatureFlags), | ||
install.WithUploaderType(uploaderType), |
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 flag is never passed to velero container, because we override it afterwards. Should it be added?
@@ -313,12 +306,14 @@ func (r *DPAReconciler) customizeVeleroDeployment(dpa *oadpv1alpha1.DataProtecti | |||
} | |||
|
|||
var veleroContainer *corev1.Container | |||
// TODO did not understand 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.
what this part does?
} | ||
args = append(args, fmt.Sprintf("--log-level=%s", logrusLevel.String())) | ||
// TODO should not error out? |
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.
if user puts wrong string in restic or node agent timeout, code uses default and does not tell nothing to user
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.
why do we have duplication of fields around velero server flags? some in VeleroConfig, some in VeleroConfig.Args
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.
} | ||
// Labels | ||
const ( | ||
OadpOperatorLabel = "openshift.io/oadp" |
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.
Can you move this outside package common? I think this would make importing github/oadp/pkg/common add a lot of indirect imports for QE if they are using this label.
Could be pkg/common/labels
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.
api package via _types.go was nice cause imports there is minimal
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.
I think it has more imports than this file, but creating something like Common/consts.go
(and Common/functions.go
) would make this file have no imports
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.
imports are based on package level too.. so it has to be a different subdir to eliminate deps
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.
common/consts/labels.go
// Conditions | ||
const ( | ||
conditionReconciled = "Reconciled" | ||
reconciledReasonComplete = "Complete" | ||
reconciledReasonError = "Error" | ||
reconcileCompleteMessage = "Reconcile complete" | ||
) |
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.
I would also move this back to types so it's easier to import without affecting importer's go.mod
// TODO --kubeconfig | ||
// TODO --kubecontext |
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.
No we won't allow kubeconfig or kubecontext. Not a todo. Comment previously was to note what was omitted.
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.
comment was it was set elsewhere, where is it set?
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.
There's no need to set these as velero will responds to current cluster and current context is the velero namespace. There's no point specifying these
@mateusoliveira43 I like the thought, but this will have to wait for 1.4. |
/hold |
for our reference: https://wiki.openstack.org/wiki/GitCommitMessages |
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
/lifecycle frozen |
@mateusoliveira43: The In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/remove-lifecycle stale |
@mateusoliveira43: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
/remove-lifecycle stale |
Description
This PR should be fix duplication, missing fields and wrong descriptions around velero server flags code.
What was done
I was checking for wrong descriptions in our CRDs and then came across the velero server flags code. I tried to remove duplication and add TODOs around missing fields. As discussed, that code should be automated: each time velero is updated in
go.mod
velero help server
are present in DPA (maybe skip some, but add why in code as comments)How to test
Check if the removal of duplication around velero server flags code did not change the behavior of the args passed to velero container.
TODO
This PR SHOULD NOT be merged. It does to many things. Break up in smaller ones.