Skip to content

Commit 38f7310

Browse files
committed
chore: k8s adapter
1 parent 9c8265f commit 38f7310

File tree

7 files changed

+101
-25
lines changed

7 files changed

+101
-25
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ require (
2222
github.com/davecgh/go-spew v1.1.1
2323
github.com/deckarep/golang-set v1.8.0
2424
github.com/devtron-labs/authenticator v0.4.35-0.20240607135426-c86e868ecee1
25-
github.com/devtron-labs/common-lib v0.0.23-beta1
25+
github.com/devtron-labs/common-lib v0.0.24-beta2
2626
github.com/devtron-labs/go-bitbucket v0.9.60-beta
2727
github.com/devtron-labs/protos v0.0.3-0.20240527113333-08a3be5ec6c1
2828
github.com/evanphx/json-patch v5.7.0+incompatible

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzq
197197
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
198198
github.com/devtron-labs/authenticator v0.4.35-0.20240607135426-c86e868ecee1 h1:qdkpTAo2Kr0ZicZIVXfNwsGSshpc9OB9j9RzmKYdIwY=
199199
github.com/devtron-labs/authenticator v0.4.35-0.20240607135426-c86e868ecee1/go.mod h1:IkKPPEfgLCMR29he5yv2OCC6iM2R7K5/0AA3k8b9XNc=
200-
github.com/devtron-labs/common-lib v0.0.23-beta1 h1:ZpFw4CETqjNpTdUKbE9oOq99s9cdF++cbmXLoJevGcA=
201-
github.com/devtron-labs/common-lib v0.0.23-beta1/go.mod h1:UZGPt1ep9Tnd9Ak2sibGSiLr7p3ijO2/JLT+h+pqBuU=
200+
github.com/devtron-labs/common-lib v0.0.24-beta2 h1:DQFSgn3i9mZROff5TcYn3gZfRBdl7jftQRP02Pxy3wg=
201+
github.com/devtron-labs/common-lib v0.0.24-beta2/go.mod h1:UZGPt1ep9Tnd9Ak2sibGSiLr7p3ijO2/JLT+h+pqBuU=
202202
github.com/devtron-labs/go-bitbucket v0.9.60-beta h1:VEx1jvDgdtDPS6A1uUFoaEi0l1/oLhbr+90xOwr6sDU=
203203
github.com/devtron-labs/go-bitbucket v0.9.60-beta/go.mod h1:GnuiCesvh8xyHeMCb+twm8lBR/kQzJYSKL28ZfObp1Y=
204204
github.com/devtron-labs/protos v0.0.3-0.20240527113333-08a3be5ec6c1 h1:R6qVeFaayqstBSu4w+ipWQqJyMKDqBVV3a11qoA2IaM=

pkg/deployment/manifest/ManifestCreationService.go

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"encoding/json"
2222
"fmt"
2323
application3 "github.com/argoproj/argo-cd/v2/pkg/apiclient/application"
24-
util5 "github.com/devtron-labs/common-lib/utils/k8s"
24+
k8sUtil "github.com/devtron-labs/common-lib/utils/k8s"
2525
"github.com/devtron-labs/devtron/api/bean"
2626
application2 "github.com/devtron-labs/devtron/client/argocdServer/application"
2727
"github.com/devtron-labs/devtron/internal/sql/models"
@@ -52,7 +52,6 @@ import (
5252
"github.com/tidwall/gjson"
5353
"go.opentelemetry.io/otel"
5454
"go.uber.org/zap"
55-
"k8s.io/apimachinery/pkg/runtime/schema"
5655
"net/http"
5756
"strings"
5857
"time"
@@ -786,9 +785,21 @@ func (impl *ManifestCreationServiceImpl) getK8sHPAResourceManifest(ctx context.C
786785
defer span.End()
787786
resourceManifest := make(map[string]interface{})
788787
version := "v2beta2"
789-
k8sResource, err := impl.k8sCommonService.GetResource(newCtx, &k8s.ResourceRequestBean{ClusterId: clusterId,
790-
K8sRequest: &util5.K8sRequestBean{ResourceIdentifier: util5.ResourceIdentifier{Name: hpaResourceRequest.ResourceName,
791-
Namespace: namespace, GroupVersionKind: schema.GroupVersionKind{Group: hpaResourceRequest.Group, Kind: hpaResourceRequest.Kind, Version: version}}}})
788+
k8sReq := &k8s.ResourceRequestBean{
789+
ClusterId: clusterId,
790+
K8sRequest: k8sUtil.NewK8sRequestBean(
791+
k8sUtil.WithResourceIdentifier(
792+
k8sUtil.NewResourceIdentifier(
793+
k8sUtil.WithName(hpaResourceRequest.ResourceName),
794+
k8sUtil.WithNameSpace(namespace),
795+
k8sUtil.WithGroup(hpaResourceRequest.Group),
796+
k8sUtil.WithKind(hpaResourceRequest.Kind),
797+
k8sUtil.WithVersion(version),
798+
),
799+
),
800+
),
801+
}
802+
k8sResource, err := impl.k8sCommonService.GetResource(newCtx, k8sReq)
792803
if err != nil {
793804
if k8s.IsResourceNotFoundErr(err) {
794805
// this is a valid case for hibernated applications, so returning nil

vendor/github.com/devtron-labs/common-lib/async/async.go

Lines changed: 3 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/devtron-labs/common-lib/constants/constants.go

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/devtron-labs/common-lib/utils/k8s/adapter.go

Lines changed: 70 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ github.com/devtron-labs/authenticator/jwt
402402
github.com/devtron-labs/authenticator/middleware
403403
github.com/devtron-labs/authenticator/oidc
404404
github.com/devtron-labs/authenticator/password
405-
# github.com/devtron-labs/common-lib v0.0.23-beta1
405+
# github.com/devtron-labs/common-lib v0.0.24-beta2
406406
## explicit; go 1.21
407407
github.com/devtron-labs/common-lib/async
408408
github.com/devtron-labs/common-lib/blob-storage

0 commit comments

Comments
 (0)