mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
chore: stop using the deprecated fields of the cluster structure (#25745)
Signed-off-by: Patroklos Papapetrou <ppapapetrou76@gmail.com>
This commit is contained in:
committed by
GitHub
parent
4aa2ba4715
commit
5959693845
@@ -369,8 +369,7 @@ func ValidateRepo(
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error getting cluster REST config: %w", err)
|
||||
}
|
||||
//nolint:staticcheck
|
||||
destCluster.ServerVersion, err = kubectl.GetServerVersion(config)
|
||||
destCluster.Info.ServerVersion, err = kubectl.GetServerVersion(config)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error getting k8s server version: %w", err)
|
||||
}
|
||||
@@ -500,8 +499,7 @@ func validateRepo(ctx context.Context,
|
||||
proj,
|
||||
sources,
|
||||
repoClient,
|
||||
//nolint:staticcheck
|
||||
cluster.ServerVersion,
|
||||
cluster.Info.ServerVersion,
|
||||
APIResourcesToStrings(apiGroups, true),
|
||||
permittedHelmCredentials,
|
||||
permittedOCICredentials,
|
||||
|
||||
@@ -26,9 +26,11 @@ import (
|
||||
|
||||
var (
|
||||
localCluster = appv1.Cluster{
|
||||
Name: "in-cluster",
|
||||
Server: appv1.KubernetesInternalAPIServerAddr,
|
||||
ConnectionState: appv1.ConnectionState{Status: appv1.ConnectionStatusSuccessful},
|
||||
Name: "in-cluster",
|
||||
Server: appv1.KubernetesInternalAPIServerAddr,
|
||||
Info: appv1.ClusterInfo{
|
||||
ConnectionState: appv1.ConnectionState{Status: appv1.ConnectionStatusSuccessful},
|
||||
},
|
||||
}
|
||||
initLocalCluster sync.Once
|
||||
)
|
||||
@@ -37,13 +39,10 @@ func (db *db) getLocalCluster() *appv1.Cluster {
|
||||
initLocalCluster.Do(func() {
|
||||
info, err := db.kubeclientset.Discovery().ServerVersion()
|
||||
if err == nil {
|
||||
//nolint:staticcheck
|
||||
localCluster.ServerVersion = fmt.Sprintf("%s.%s", info.Major, info.Minor)
|
||||
//nolint:staticcheck
|
||||
localCluster.ConnectionState = appv1.ConnectionState{Status: appv1.ConnectionStatusSuccessful}
|
||||
localCluster.Info.ServerVersion = fmt.Sprintf("%s.%s", info.Major, info.Minor)
|
||||
localCluster.Info.ConnectionState = appv1.ConnectionState{Status: appv1.ConnectionStatusSuccessful}
|
||||
} else {
|
||||
//nolint:staticcheck
|
||||
localCluster.ConnectionState = appv1.ConnectionState{
|
||||
localCluster.Info.ConnectionState = appv1.ConnectionState{
|
||||
Status: appv1.ConnectionStatusFailed,
|
||||
Message: err.Error(),
|
||||
}
|
||||
@@ -51,8 +50,7 @@ func (db *db) getLocalCluster() *appv1.Cluster {
|
||||
})
|
||||
cluster := localCluster.DeepCopy()
|
||||
now := metav1.Now()
|
||||
//nolint:staticcheck
|
||||
cluster.ConnectionState.ModifiedAt = &now
|
||||
cluster.Info.ConnectionState.ModifiedAt = &now
|
||||
return cluster
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user