-
Notifications
You must be signed in to change notification settings - Fork 38
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
rename FleetCluster to KubeConfigSecretRef #484
Conversation
Signed-off-by: Xieql <xieqianglong@huawei.com>
✅ Deploy Preview for kurator-dev canceled.
|
@@ -81,7 +81,7 @@ func (f *FleetManager) reconcileBackupPlugin(ctx context.Context, fleet *v1alpha | |||
// Iterating through each fleet cluster to generate and apply Velero helm configurations. | |||
for key, cluster := range fleetClusters { | |||
// generate Velero helm config for each fleet cluster | |||
b, err := plugin.RenderVelero(f.Manifests, fleetNN, fleetOwnerRef, plugin.FleetCluster{ | |||
b, err := plugin.RenderVelero(f.Manifests, fleetNN, fleetOwnerRef, plugin.RenderableFleetCluster{ |
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 we use the FleetCluster, if any field miss, we can add it
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 origin FleetCluster
's fileld value is comes from two struct fleetCluster
and ClusterKey
,
so maybe we can not directly add fileld in FleetCluster
, or we need merge those two struct into one struct, which may affect many other code
kurator/pkg/fleet-manager/fleet_cluster.go
Lines 34 to 43 in 2871c99
type fleetCluster struct { | |
Secret string | |
SecretKey string | |
client *kclient.Client | |
} | |
type ClusterKey struct { | |
Kind string | |
Name string | |
} |
this is the most used usage:
kurator/pkg/fleet-manager/fleet_plugin_distributedstorage.go
Lines 78 to 81 in 83fdec0
b, err := plugin.RenderClusterStorage(f.Manifests, fleetNN, fleetOwnerRef, plugin.RenderableFleetCluster{ | |
Name: key.Name, | |
SecretName: cluster.Secret, | |
SecretKey: cluster.SecretKey, |
FleetCluster.Name: ClusterKey.Name,
FleetCluster.SecretName: fleetCluster.Secret,
FleetCluster.SecretKey: fleetCluster.SecretKey,
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.
Looked into the code closely, and the FleetCluster represents the kubeconfig secret ref.
We only need the secret name and key which kubeconfg is stored. Even the cluster name is not needed.
So we can rename it to KubeConfigSecretRef
or SecretRef
or something
Signed-off-by: Xieql <xieqianglong@huawei.com>
ok |
/label tide/merge-method-squash |
@@ -55,7 +55,7 @@ func (plugin FleetPluginConfig) StorageNamespace() string { | |||
return plugin.Fleet.Namespace | |||
} | |||
|
|||
type FleetCluster struct { | |||
type KubeConfigSecretRef struct { | |||
Name 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.
nit: The Name can be removed
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.
Currently, it is used solely for rendering and requires the name
parameter.
If we remove name
, we will need to refactor many corresponding functions
However, I think that refactoring them would not be wise.
such as
kurator/pkg/fleet-manager/plugin/render.go
Lines 30 to 46 in 5de1517
type FleetPluginConfig struct { | |
Name string | |
Component string | |
Fleet types.NamespacedName | |
OwnerReference *metav1.OwnerReference | |
Cluster *KubeConfigSecretRef | |
Chart ChartConfig | |
Values map[string]interface{} | |
} | |
func (plugin FleetPluginConfig) ResourceName() string { | |
if plugin.Cluster != nil { | |
return plugin.Component + "-" + plugin.Cluster.Name | |
} | |
return plugin.Component | |
} |
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 did see that, it is unused
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.
you are right, it is unused
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hzxuzhonghu 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 |
ff9026f
to
5de1517
Compare
If the Therefore, it might be best to retain the field, as there seems to be no effective method to address this issue |
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.
/lgtm
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
current
FleetCluster
struct is just for renderand we have already defined
fleetCluster
herekurator/pkg/fleet-manager/fleet_cluster.go
Lines 34 to 38 in 2871c99
and we are going to make it public for #481
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: