Skip to content

Commit 93827cc

Browse files
committed
removing dead code
1 parent c45df3c commit 93827cc

File tree

1 file changed

+0
-46
lines changed

1 file changed

+0
-46
lines changed

pkg/deployment/manifest/ManifestCreationService.go

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"encoding/json"
2323
"errors"
2424
"fmt"
25-
application3 "github.com/argoproj/argo-cd/v2/pkg/apiclient/application"
2625
k8sUtil "github.com/devtron-labs/common-lib/utils/k8s"
2726
"github.com/devtron-labs/devtron/api/bean"
2827
"github.com/devtron-labs/devtron/client/argocdServer"
@@ -881,51 +880,6 @@ func (impl *ManifestCreationServiceImpl) getK8sHPAResourceManifest(ctx context.C
881880
return k8sResource.ManifestResponse.Manifest.Object, err
882881
}
883882

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-
929883
// updateHashToMergedValues
930884
// - Generates hash from the given configOrSecretData
931885
// - And updates the hash in bean.JsonPath (JSON path) for the merged values

0 commit comments

Comments
 (0)