@@ -22,7 +22,6 @@ import (
22
22
"encoding/json"
23
23
"errors"
24
24
"fmt"
25
- application3 "github.com/argoproj/argo-cd/v2/pkg/apiclient/application"
26
25
k8sUtil "github.com/devtron-labs/common-lib/utils/k8s"
27
26
"github.com/devtron-labs/devtron/api/bean"
28
27
"github.com/devtron-labs/devtron/client/argocdServer"
@@ -881,51 +880,6 @@ func (impl *ManifestCreationServiceImpl) getK8sHPAResourceManifest(ctx context.C
881
880
return k8sResource .ManifestResponse .Manifest .Object , err
882
881
}
883
882
884
- func (impl * ManifestCreationServiceImpl ) getArgoCdHPAResourceManifest (ctx context.Context , appName , namespace string , hpaResourceRequest * globalUtil.HpaResourceRequest ) (map [string ]interface {}, error ) {
885
- newCtx , span := otel .Tracer ("orchestrator" ).Start (ctx , "ManifestCreationServiceImpl.getArgoCdHPAResourceManifest" )
886
- defer span .End ()
887
- resourceManifest := make (map [string ]interface {})
888
- query := & application3.ApplicationResourceRequest {
889
- Name : & appName ,
890
- Version : & hpaResourceRequest .Version ,
891
- Group : & hpaResourceRequest .Group ,
892
- Kind : & hpaResourceRequest .Kind ,
893
- ResourceName : & hpaResourceRequest .ResourceName ,
894
- Namespace : & namespace ,
895
- }
896
-
897
- recv , argoErr := impl .acdClientWrapper .GetApplicationResource (newCtx , query )
898
- if argoErr != nil {
899
- grpcCode , errMsg := util .GetClientDetailedError (argoErr )
900
- if grpcCode .IsInvalidArgumentCode () || grpcCode .IsNotFoundCode () {
901
- // this is a valid case for hibernated applications, so returning nil
902
- // for hibernated applications, we don't have any hpa resource manifest
903
- return resourceManifest , nil
904
- } else if grpcCode .IsUnavailableCode () {
905
- impl .logger .Errorw ("ArgoCd server unavailable" , "resourceName" , hpaResourceRequest .ResourceName , "err" , errMsg )
906
- return resourceManifest , fmt .Errorf ("ArgoCd server error: %s" , errMsg )
907
- } else if grpcCode .IsDeadlineExceededCode () {
908
- impl .logger .Errorw ("ArgoCd resource request timeout" , "resourceName" , hpaResourceRequest .ResourceName , "err" , errMsg )
909
- return resourceManifest , util .DefaultApiError ().
910
- WithHttpStatusCode (http .StatusRequestTimeout ).
911
- WithInternalMessage (errMsg ).
912
- WithUserDetailMessage ("ArgoCd server is not responding, please try again later" )
913
- }
914
- impl .logger .Errorw ("ArgoCd Get Resource API Failed" , "resourceName" , hpaResourceRequest .ResourceName , "err" , errMsg )
915
- return resourceManifest , fmt .Errorf ("ArgoCd client error: %s" , errMsg )
916
- }
917
- if recv != nil && len (* recv .Manifest ) > 0 {
918
- err := json .Unmarshal ([]byte (* recv .Manifest ), & resourceManifest )
919
- if err != nil {
920
- impl .logger .Errorw ("failed to unmarshal hpa resource manifest" , "manifest" , recv .Manifest , "err" , err )
921
- return resourceManifest , err
922
- }
923
- } else {
924
- impl .logger .Debugw ("invalid resource manifest received from ArgoCd" , "response" , recv )
925
- }
926
- return resourceManifest , nil
927
- }
928
-
929
883
// updateHashToMergedValues
930
884
// - Generates hash from the given configOrSecretData
931
885
// - And updates the hash in bean.JsonPath (JSON path) for the merged values
@@ -1033,17 +987,12 @@ func (impl *ManifestCreationServiceImpl) autoscalingCheckBeforeTrigger(ctx conte
1033
987
impl .logger .Debugw ("autoscalingCheckBeforeTrigger" , "pipelineId" , pipelineId , "hpaResourceRequest" , hpaResourceRequest )
1034
988
if hpaResourceRequest .IsEnable {
1035
989
var resourceManifest map [string ]interface {}
1036
- if envDeploymentConfig .IsArgoCdClientSupported () {
1037
- resourceManifest , err = impl .getArgoCdHPAResourceManifest (newCtx , appName , namespace , hpaResourceRequest )
1038
- if err != nil {
1039
- return merged , err
1040
- }
1041
- } else {
1042
- resourceManifest , err = impl .getK8sHPAResourceManifest (newCtx , clusterId , namespace , hpaResourceRequest )
1043
- if err != nil {
1044
- return merged , err
1045
- }
990
+
991
+ resourceManifest , err = impl .getK8sHPAResourceManifest (newCtx , clusterId , namespace , hpaResourceRequest )
992
+ if err != nil {
993
+ return merged , err
1046
994
}
995
+
1047
996
if len (resourceManifest ) > 0 {
1048
997
statusMap := resourceManifest ["status" ].(map [string ]interface {})
1049
998
currentReplicaVal := statusMap ["currentReplicas" ]
0 commit comments