From d011dd73f4084d5936f38195d17f0eee2f2f375d Mon Sep 17 00:00:00 2001 From: nxtcoder17 Date: Tue, 7 May 2024 19:59:13 +0530 Subject: [PATCH 1/3] feat(infra): supports byok-clusters, byok devices, and cluster managed services --- .tools/nvim/__http__/infra/names.graphql.yml | 12 +- apps/gateway/supergraph.yml | 12 +- apps/infra/Taskfile.yml | 2 +- apps/infra/internal/app/app.go | 2 +- apps/infra/internal/app/gqlgen.yml | 1 + .../app/graph/byokcluster.resolvers.go | 21 +- .../internal/app/graph/generated/generated.go | 1781 ++++++++++++++--- .../internal/app/graph/model/models_gen.go | 16 +- apps/infra/internal/app/graph/schema.graphqls | 19 +- .../internal/app/graph/schema.resolvers.go | 81 +- .../struct-to-graphql/byokcluster.graphqls | 20 +- .../clustermanagedservice.graphqls | 1 + .../struct-to-graphql/common-types.graphqls | 5 +- .../internal/app/process-resource-updates.go | 19 + apps/infra/internal/domain/api.go | 16 +- apps/infra/internal/domain/byoc-clusters.go | 61 - apps/infra/internal/domain/byok-clusters.go | 239 +++ .../domain/cluster-managed-service.go | 84 +- apps/infra/internal/domain/clusters.go | 57 +- .../domain/global-vpn-cluster-connection.go | 57 +- .../internal/domain/global-vpn-devices.go | 27 +- apps/infra/internal/domain/names.go | 20 +- .../templates/cluster-kube-proxy.yml.tpl | 118 ++ .../{byok_cluster.go => byok-cluster.go} | 34 +- .../entities/cluster-managed-service.go | 2 +- .../field-constants/generated_constants.go | 69 +- .../internal/app/graph/generated/generated.go | 166 +- .../internal/app/graph/model/models_gen.go | 12 +- .../struct-to-graphql/common-types.graphqls | 8 +- apps/observability/internal/app/app.go | 42 +- 30 files changed, 2299 insertions(+), 705 deletions(-) delete mode 100644 apps/infra/internal/domain/byoc-clusters.go create mode 100644 apps/infra/internal/domain/byok-clusters.go rename apps/infra/internal/entities/{byok_cluster.go => byok-cluster.go} (59%) diff --git a/.tools/nvim/__http__/infra/names.graphql.yml b/.tools/nvim/__http__/infra/names.graphql.yml index 8b9cd3205..c4e767a09 100644 --- a/.tools/nvim/__http__/infra/names.graphql.yml +++ b/.tools/nvim/__http__/infra/names.graphql.yml @@ -6,21 +6,21 @@ global: providerSecretName: provider-sample --- label: Check Name Availability -query: |+ - query Infra_checkNameAvailability($resType: ResType!, $name: String!) { - infra_checkNameAvailability(resType: $resType, name: $name) { +query: |+ #graphql + query Infra_checkNameAvailability($resType: ResType!, $clusterName: String!, $name: String!) { + infra_checkNameAvailability(resType: $resType,clusterName: $clusterName, name: $name) { result suggestedNames } } variables: - resType: vpn_device - # name: sample + resType: cluster_managed_service + clusterName: "{{.clusterName}}" name: sample --- label: Check Name Availability, with ClusterName -query: |+ +query: |+ #graphql query Infra_checkNameAvailability($resType: ResType!, $clusterName: String, $name: String!) { infra_checkNameAvailability(resType: $resType, clusterName: $clusterName, name: $name) { result diff --git a/apps/gateway/supergraph.yml b/apps/gateway/supergraph.yml index 64e25a87e..dc0469425 100644 --- a/apps/gateway/supergraph.yml +++ b/apps/gateway/supergraph.yml @@ -1,26 +1,26 @@ federation_version: =2.3.2 subgraphs: auth-api: - routing_url: http://auth-api/query + routing_url: http://auth-api:3000/query schema: file: ./schemas/auth-api.schema account-api: - routing_url: http://accounts-api/query + routing_url: http://accounts-api:3000/query schema: file: ./schemas/accounts-api.schema container-registry-api: - routing_url: http://container-registry-api/query + routing_url: http://container-registry-api:3000/query schema: file: ./schemas/container-registry-api.schema console-api: - routing_url: http://console-api/query + routing_url: http://console-api:3000/query schema: file: ./schemas/console-api.schema infra-api: - routing_url: http://infra-api/query + routing_url: http://infra-api:3000/query schema: file: ./schemas/infra-api.schema iot-console-api: - routing_url: http://iot-console-api/query + routing_url: http://iot-console-api:3000/query schema: file: ./schemas/iot-console-api.schema diff --git a/apps/infra/Taskfile.yml b/apps/infra/Taskfile.yml index 40cecdeda..936e0c248 100644 --- a/apps/infra/Taskfile.yml +++ b/apps/infra/Taskfile.yml @@ -37,7 +37,7 @@ tasks: > ./internal/app/_struct-to-graphql/main.go - |+ pushd ./internal/app/_struct-to-graphql - go run main.go --dev --out-dir ../graph/struct-to-graphql --with-pagination Cluster,Node,NodePool,GlobalVPN,GlobalVPNDevice,CloudProviderSecret,DomainEntry,PersistentVolumeClaim,ClusterManagedService,HelmRelease,Namespace,VolumeAttachment,PersistentVolume + go run main.go --dev --out-dir ../graph/struct-to-graphql --with-pagination Cluster,BYOKCluster,Node,NodePool,GlobalVPN,GlobalVPNDevice,CloudProviderSecret,DomainEntry,PersistentVolumeClaim,ClusterManagedService,HelmRelease,Namespace,VolumeAttachment,PersistentVolume popd - rm -rf ./internal/app/_struct-to-graphql diff --git a/apps/infra/internal/app/app.go b/apps/infra/internal/app/app.go index 4fdcc19cc..4109dda01 100644 --- a/apps/infra/internal/app/app.go +++ b/apps/infra/internal/app/app.go @@ -54,7 +54,7 @@ var Module = fx.Module( repos.NewFxMongoRepo[*entities.ClaimClusterSvcCIDR]("claim_cluster_svc_cidr", "claim-clus-cidr", entities.ClaimClusterSvcCIDRIndices), // repos.NewFxMongoRepo[*entities.BYOKCluster]("byok_clusters", "byok", entities.BYOKClusterIndices), - repos.NewFxMongoRepo[*entities.BYOKCluster]("clusters", "byok", entities.BYOKClusterIndices), + repos.NewFxMongoRepo[*entities.BYOKCluster]("byok_cluster", "byok", entities.BYOKClusterIndices), repos.NewFxMongoRepo[*entities.ClusterManagedService]("cmsvcs", "cmsvc", entities.ClusterManagedServiceIndices), repos.NewFxMongoRepo[*entities.DomainEntry]("domain_entries", "de", entities.DomainEntryIndices), repos.NewFxMongoRepo[*entities.NodePool]("node_pools", "npool", entities.NodePoolIndices), diff --git a/apps/infra/internal/app/gqlgen.yml b/apps/infra/internal/app/gqlgen.yml index e27232e6c..7216f812b 100644 --- a/apps/infra/internal/app/gqlgen.yml +++ b/apps/infra/internal/app/gqlgen.yml @@ -131,6 +131,7 @@ models: Node: &node-model model: github.com/kloudlite/api/apps/infra/internal/entities.Node + ResType: model: github.com/kloudlite/api/apps/infra/internal/domain.ResType diff --git a/apps/infra/internal/app/graph/byokcluster.resolvers.go b/apps/infra/internal/app/graph/byokcluster.resolvers.go index 271a96389..eeaaaffe9 100644 --- a/apps/infra/internal/app/graph/byokcluster.resolvers.go +++ b/apps/infra/internal/app/graph/byokcluster.resolvers.go @@ -17,14 +17,6 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1" ) -// ClusterSpec is the resolver for the ClusterSpec field. -func (r *bYOKClusterResolver) ClusterSpec(ctx context.Context, obj *entities.BYOKCluster) (*model.GithubComKloudliteOperatorApisClustersV1ClusterSpec, error) { - return &model.GithubComKloudliteOperatorApisClustersV1ClusterSpec{ - AvailabilityMode: "dev", - CloudProvider: "aws", - }, nil -} - // CreationTime is the resolver for the creationTime field. func (r *bYOKClusterResolver) CreationTime(ctx context.Context, obj *entities.BYOKCluster) (string, error) { if obj == nil { @@ -65,3 +57,16 @@ func (r *Resolver) BYOKClusterIn() generated.BYOKClusterInResolver { return &bYO type bYOKClusterResolver struct{ *Resolver } type bYOKClusterInResolver struct{ *Resolver } + +// !!! WARNING !!! +// The code below was going to be deleted when updating resolvers. It has been copied here so you have +// one last chance to move it out of harms way if you want. There are two reasons this happens: +// - When renaming or deleting a resolver the old code will be put in here. You can safely delete +// it when you're done. +// - You have helper methods in this file. Move them out to keep these resolver files clean. +func (r *bYOKClusterResolver) ClusterSpec(ctx context.Context, obj *entities.BYOKCluster) (*model.GithubComKloudliteOperatorApisClustersV1ClusterSpec, error) { + return &model.GithubComKloudliteOperatorApisClustersV1ClusterSpec{ + AvailabilityMode: "dev", + CloudProvider: "aws", + }, nil +} diff --git a/apps/infra/internal/app/graph/generated/generated.go b/apps/infra/internal/app/graph/generated/generated.go index 79c86b342..9b8e17f49 100644 --- a/apps/infra/internal/app/graph/generated/generated.go +++ b/apps/infra/internal/app/graph/generated/generated.go @@ -90,18 +90,33 @@ type DirectiveRoot struct { type ComplexityRoot struct { BYOKCluster struct { - AccountName func(childComplexity int) int - ClusterSpec func(childComplexity int) int - CreatedBy func(childComplexity int) int - CreationTime func(childComplexity int) int - DisplayName func(childComplexity int) int - ID func(childComplexity int) int - LastUpdatedBy func(childComplexity int) int - MarkedForDeletion func(childComplexity int) int - ObjectMeta func(childComplexity int) int - RecordVersion func(childComplexity int) int - SyncStatus func(childComplexity int) int - UpdateTime func(childComplexity int) int + AccountName func(childComplexity int) int + ClusterPublicEndpoint func(childComplexity int) int + ClusterSvcCIDR func(childComplexity int) int + ClusterToken func(childComplexity int) int + CreatedBy func(childComplexity int) int + CreationTime func(childComplexity int) int + DisplayName func(childComplexity int) int + GlobalVPN func(childComplexity int) int + ID func(childComplexity int) int + LastUpdatedBy func(childComplexity int) int + MarkedForDeletion func(childComplexity int) int + MessageQueueTopicName func(childComplexity int) int + ObjectMeta func(childComplexity int) int + RecordVersion func(childComplexity int) int + SyncStatus func(childComplexity int) int + UpdateTime func(childComplexity int) int + } + + BYOKClusterEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } + + BYOKClusterPaginatedRecords struct { + Edges func(childComplexity int) int + PageInfo func(childComplexity int) int + TotalCount func(childComplexity int) int } CheckAwsAccessOutput struct { @@ -564,6 +579,7 @@ type ComplexityRoot struct { Github__com___kloudlite___operator___pkg___operator__CheckMeta struct { Debug func(childComplexity int) int Description func(childComplexity int) int + Hide func(childComplexity int) int Name func(childComplexity int) int Title func(childComplexity int) int } @@ -1115,15 +1131,16 @@ type ComplexityRoot struct { Mutation struct { InfraCreateBYOKCluster func(childComplexity int, cluster entities.BYOKCluster) int InfraCreateCluster func(childComplexity int, cluster entities.Cluster) int - InfraCreateClusterManagedService func(childComplexity int, clusterName string, service entities.ClusterManagedService) int + InfraCreateClusterManagedService func(childComplexity int, service entities.ClusterManagedService) int InfraCreateDomainEntry func(childComplexity int, domainEntry entities.DomainEntry) int InfraCreateGlobalVPNDevice func(childComplexity int, gvpnDevice entities.GlobalVPNDevice) int InfraCreateGlobalVpn func(childComplexity int, gvpn entities.GlobalVPN) int InfraCreateHelmRelease func(childComplexity int, clusterName string, release entities.HelmRelease) int InfraCreateNodePool func(childComplexity int, clusterName string, pool entities.NodePool) int InfraCreateProviderSecret func(childComplexity int, secret entities.CloudProviderSecret) int + InfraDeleteBYOKCluster func(childComplexity int, name string) int InfraDeleteCluster func(childComplexity int, name string) int - InfraDeleteClusterManagedService func(childComplexity int, clusterName string, serviceName string) int + InfraDeleteClusterManagedService func(childComplexity int, name string) int InfraDeleteDomainEntry func(childComplexity int, domainName string) int InfraDeleteGlobalVPNDevice func(childComplexity int, gvpn string, deviceName string) int InfraDeleteGlobalVpn func(childComplexity int, name string) int @@ -1131,8 +1148,9 @@ type ComplexityRoot struct { InfraDeleteNodePool func(childComplexity int, clusterName string, poolName string) int InfraDeleteProviderSecret func(childComplexity int, secretName string) int InfraDeletePv func(childComplexity int, clusterName string, pvName string) int + InfraUpdateBYOKCluster func(childComplexity int, clusterName string, displayName string) int InfraUpdateCluster func(childComplexity int, cluster entities.Cluster) int - InfraUpdateClusterManagedService func(childComplexity int, clusterName string, service entities.ClusterManagedService) int + InfraUpdateClusterManagedService func(childComplexity int, service entities.ClusterManagedService) int InfraUpdateDomainEntry func(childComplexity int, domainEntry entities.DomainEntry) int InfraUpdateGlobalVPNDevice func(childComplexity int, gvpnDevice entities.GlobalVPNDevice) int InfraUpdateGlobalVpn func(childComplexity int, gvpn entities.GlobalVPN) int @@ -1299,8 +1317,9 @@ type ComplexityRoot struct { Query struct { InfraCheckAwsAccess func(childComplexity int, cloudproviderName string) int InfraCheckNameAvailability func(childComplexity int, resType domain.ResType, clusterName *string, name string) int + InfraGetBYOKCluster func(childComplexity int, name string) int InfraGetCluster func(childComplexity int, name string) int - InfraGetClusterManagedService func(childComplexity int, clusterName string, name string) int + InfraGetClusterManagedService func(childComplexity int, name string) int InfraGetDomainEntry func(childComplexity int, domainName string) int InfraGetGlobalVPNDevice func(childComplexity int, gvpn string, deviceName string) int InfraGetGlobalVpn func(childComplexity int, name string) int @@ -1312,7 +1331,8 @@ type ComplexityRoot struct { InfraGetPv func(childComplexity int, clusterName string, name string) int InfraGetPvc func(childComplexity int, clusterName string, name string) int InfraGetVolumeAttachment func(childComplexity int, clusterName string, name string) int - InfraListClusterManagedServices func(childComplexity int, clusterName string, search *model.SearchClusterManagedService, pagination *repos.CursorPagination) int + InfraListBYOKClusters func(childComplexity int, search *model.SearchCluster, pagination *repos.CursorPagination) int + InfraListClusterManagedServices func(childComplexity int, search *model.SearchClusterManagedService, pagination *repos.CursorPagination) int InfraListClusters func(childComplexity int, search *model.SearchCluster, pagination *repos.CursorPagination) int InfraListDomainEntries func(childComplexity int, search *model.SearchDomainEntry, pagination *repos.CursorPagination) int InfraListGlobalVPNDevices func(childComplexity int, gvpn string, search *model.SearchGlobalVPNDevices, pagination *repos.CursorPagination) int @@ -1364,8 +1384,6 @@ type ComplexityRoot struct { } type BYOKClusterResolver interface { - ClusterSpec(ctx context.Context, obj *entities.BYOKCluster) (*model.GithubComKloudliteOperatorApisClustersV1ClusterSpec, error) - CreationTime(ctx context.Context, obj *entities.BYOKCluster) (string, error) ID(ctx context.Context, obj *entities.BYOKCluster) (repos.ID, error) @@ -1477,6 +1495,8 @@ type MutationResolver interface { InfraUpdateGlobalVPNDevice(ctx context.Context, gvpnDevice entities.GlobalVPNDevice) (*entities.GlobalVPNDevice, error) InfraDeleteGlobalVPNDevice(ctx context.Context, gvpn string, deviceName string) (bool, error) InfraCreateBYOKCluster(ctx context.Context, cluster entities.BYOKCluster) (*entities.BYOKCluster, error) + InfraUpdateBYOKCluster(ctx context.Context, clusterName string, displayName string) (*entities.BYOKCluster, error) + InfraDeleteBYOKCluster(ctx context.Context, name string) (bool, error) InfraUpgradeHelmKloudliteAgent(ctx context.Context, clusterName string) (bool, error) InfraCreateProviderSecret(ctx context.Context, secret entities.CloudProviderSecret) (*entities.CloudProviderSecret, error) InfraUpdateProviderSecret(ctx context.Context, secret entities.CloudProviderSecret) (*entities.CloudProviderSecret, error) @@ -1487,9 +1507,9 @@ type MutationResolver interface { InfraCreateNodePool(ctx context.Context, clusterName string, pool entities.NodePool) (*entities.NodePool, error) InfraUpdateNodePool(ctx context.Context, clusterName string, pool entities.NodePool) (*entities.NodePool, error) InfraDeleteNodePool(ctx context.Context, clusterName string, poolName string) (bool, error) - InfraCreateClusterManagedService(ctx context.Context, clusterName string, service entities.ClusterManagedService) (*entities.ClusterManagedService, error) - InfraUpdateClusterManagedService(ctx context.Context, clusterName string, service entities.ClusterManagedService) (*entities.ClusterManagedService, error) - InfraDeleteClusterManagedService(ctx context.Context, clusterName string, serviceName string) (bool, error) + InfraCreateClusterManagedService(ctx context.Context, service entities.ClusterManagedService) (*entities.ClusterManagedService, error) + InfraUpdateClusterManagedService(ctx context.Context, service entities.ClusterManagedService) (*entities.ClusterManagedService, error) + InfraDeleteClusterManagedService(ctx context.Context, name string) (bool, error) InfraCreateHelmRelease(ctx context.Context, clusterName string, release entities.HelmRelease) (*entities.HelmRelease, error) InfraUpdateHelmRelease(ctx context.Context, clusterName string, release entities.HelmRelease) (*entities.HelmRelease, error) InfraDeleteHelmRelease(ctx context.Context, clusterName string, releaseName string) (bool, error) @@ -1546,6 +1566,8 @@ type QueryResolver interface { InfraCheckNameAvailability(ctx context.Context, resType domain.ResType, clusterName *string, name string) (*domain.CheckNameAvailabilityOutput, error) InfraListClusters(ctx context.Context, search *model.SearchCluster, pagination *repos.CursorPagination) (*model.ClusterPaginatedRecords, error) InfraGetCluster(ctx context.Context, name string) (*entities.Cluster, error) + InfraListBYOKClusters(ctx context.Context, search *model.SearchCluster, pagination *repos.CursorPagination) (*model.BYOKClusterPaginatedRecords, error) + InfraGetBYOKCluster(ctx context.Context, name string) (*entities.BYOKCluster, error) InfraListGlobalVPNs(ctx context.Context, search *model.SearchGlobalVPNs, pagination *repos.CursorPagination) (*model.GlobalVPNPaginatedRecords, error) InfraGetGlobalVpn(ctx context.Context, name string) (*entities.GlobalVPN, error) InfraListGlobalVPNDevices(ctx context.Context, gvpn string, search *model.SearchGlobalVPNDevices, pagination *repos.CursorPagination) (*model.GlobalVPNDevicePaginatedRecords, error) @@ -1557,8 +1579,8 @@ type QueryResolver interface { InfraListDomainEntries(ctx context.Context, search *model.SearchDomainEntry, pagination *repos.CursorPagination) (*model.DomainEntryPaginatedRecords, error) InfraGetDomainEntry(ctx context.Context, domainName string) (*entities.DomainEntry, error) InfraCheckAwsAccess(ctx context.Context, cloudproviderName string) (*model.CheckAwsAccessOutput, error) - InfraListClusterManagedServices(ctx context.Context, clusterName string, search *model.SearchClusterManagedService, pagination *repos.CursorPagination) (*model.ClusterManagedServicePaginatedRecords, error) - InfraGetClusterManagedService(ctx context.Context, clusterName string, name string) (*entities.ClusterManagedService, error) + InfraListClusterManagedServices(ctx context.Context, search *model.SearchClusterManagedService, pagination *repos.CursorPagination) (*model.ClusterManagedServicePaginatedRecords, error) + InfraGetClusterManagedService(ctx context.Context, name string) (*entities.ClusterManagedService, error) InfraListHelmReleases(ctx context.Context, clusterName string, search *model.SearchHelmRelease, pagination *repos.CursorPagination) (*model.HelmReleasePaginatedRecords, error) InfraGetHelmRelease(ctx context.Context, clusterName string, name string) (*entities.HelmRelease, error) InfraListManagedServiceTemplates(ctx context.Context) ([]*entities.MsvcTemplate, error) @@ -1661,12 +1683,26 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.BYOKCluster.AccountName(childComplexity), true - case "BYOKCluster.ClusterSpec": - if e.complexity.BYOKCluster.ClusterSpec == nil { + case "BYOKCluster.clusterPublicEndpoint": + if e.complexity.BYOKCluster.ClusterPublicEndpoint == nil { break } - return e.complexity.BYOKCluster.ClusterSpec(childComplexity), true + return e.complexity.BYOKCluster.ClusterPublicEndpoint(childComplexity), true + + case "BYOKCluster.clusterSvcCIDR": + if e.complexity.BYOKCluster.ClusterSvcCIDR == nil { + break + } + + return e.complexity.BYOKCluster.ClusterSvcCIDR(childComplexity), true + + case "BYOKCluster.clusterToken": + if e.complexity.BYOKCluster.ClusterToken == nil { + break + } + + return e.complexity.BYOKCluster.ClusterToken(childComplexity), true case "BYOKCluster.createdBy": if e.complexity.BYOKCluster.CreatedBy == nil { @@ -1689,6 +1725,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.BYOKCluster.DisplayName(childComplexity), true + case "BYOKCluster.globalVPN": + if e.complexity.BYOKCluster.GlobalVPN == nil { + break + } + + return e.complexity.BYOKCluster.GlobalVPN(childComplexity), true + case "BYOKCluster.id": if e.complexity.BYOKCluster.ID == nil { break @@ -1710,6 +1753,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.BYOKCluster.MarkedForDeletion(childComplexity), true + case "BYOKCluster.messageQueueTopicName": + if e.complexity.BYOKCluster.MessageQueueTopicName == nil { + break + } + + return e.complexity.BYOKCluster.MessageQueueTopicName(childComplexity), true + case "BYOKCluster.metadata": if e.complexity.BYOKCluster.ObjectMeta == nil { break @@ -1738,6 +1788,41 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.BYOKCluster.UpdateTime(childComplexity), true + case "BYOKClusterEdge.cursor": + if e.complexity.BYOKClusterEdge.Cursor == nil { + break + } + + return e.complexity.BYOKClusterEdge.Cursor(childComplexity), true + + case "BYOKClusterEdge.node": + if e.complexity.BYOKClusterEdge.Node == nil { + break + } + + return e.complexity.BYOKClusterEdge.Node(childComplexity), true + + case "BYOKClusterPaginatedRecords.edges": + if e.complexity.BYOKClusterPaginatedRecords.Edges == nil { + break + } + + return e.complexity.BYOKClusterPaginatedRecords.Edges(childComplexity), true + + case "BYOKClusterPaginatedRecords.pageInfo": + if e.complexity.BYOKClusterPaginatedRecords.PageInfo == nil { + break + } + + return e.complexity.BYOKClusterPaginatedRecords.PageInfo(childComplexity), true + + case "BYOKClusterPaginatedRecords.totalCount": + if e.complexity.BYOKClusterPaginatedRecords.TotalCount == nil { + break + } + + return e.complexity.BYOKClusterPaginatedRecords.TotalCount(childComplexity), true + case "CheckAwsAccessOutput.installationUrl": if e.complexity.CheckAwsAccessOutput.InstallationURL == nil { break @@ -3754,6 +3839,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Github__com___kloudlite___operator___pkg___operator__CheckMeta.Description(childComplexity), true + case "Github__com___kloudlite___operator___pkg___operator__CheckMeta.hide": + if e.complexity.Github__com___kloudlite___operator___pkg___operator__CheckMeta.Hide == nil { + break + } + + return e.complexity.Github__com___kloudlite___operator___pkg___operator__CheckMeta.Hide(childComplexity), true + case "Github__com___kloudlite___operator___pkg___operator__CheckMeta.name": if e.complexity.Github__com___kloudlite___operator___pkg___operator__CheckMeta.Name == nil { break @@ -6119,7 +6211,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Mutation.InfraCreateClusterManagedService(childComplexity, args["clusterName"].(string), args["service"].(entities.ClusterManagedService)), true + return e.complexity.Mutation.InfraCreateClusterManagedService(childComplexity, args["service"].(entities.ClusterManagedService)), true case "Mutation.infra_createDomainEntry": if e.complexity.Mutation.InfraCreateDomainEntry == nil { @@ -6193,6 +6285,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Mutation.InfraCreateProviderSecret(childComplexity, args["secret"].(entities.CloudProviderSecret)), true + case "Mutation.infra_deleteBYOKCluster": + if e.complexity.Mutation.InfraDeleteBYOKCluster == nil { + break + } + + args, err := ec.field_Mutation_infra_deleteBYOKCluster_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.InfraDeleteBYOKCluster(childComplexity, args["name"].(string)), true + case "Mutation.infra_deleteCluster": if e.complexity.Mutation.InfraDeleteCluster == nil { break @@ -6215,7 +6319,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Mutation.InfraDeleteClusterManagedService(childComplexity, args["clusterName"].(string), args["serviceName"].(string)), true + return e.complexity.Mutation.InfraDeleteClusterManagedService(childComplexity, args["name"].(string)), true case "Mutation.infra_deleteDomainEntry": if e.complexity.Mutation.InfraDeleteDomainEntry == nil { @@ -6301,6 +6405,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Mutation.InfraDeletePv(childComplexity, args["clusterName"].(string), args["pvName"].(string)), true + case "Mutation.infra_updateBYOKCluster": + if e.complexity.Mutation.InfraUpdateBYOKCluster == nil { + break + } + + args, err := ec.field_Mutation_infra_updateBYOKCluster_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.InfraUpdateBYOKCluster(childComplexity, args["clusterName"].(string), args["displayName"].(string)), true + case "Mutation.infra_updateCluster": if e.complexity.Mutation.InfraUpdateCluster == nil { break @@ -6323,7 +6439,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Mutation.InfraUpdateClusterManagedService(childComplexity, args["clusterName"].(string), args["service"].(entities.ClusterManagedService)), true + return e.complexity.Mutation.InfraUpdateClusterManagedService(childComplexity, args["service"].(entities.ClusterManagedService)), true case "Mutation.infra_updateDomainEntry": if e.complexity.Mutation.InfraUpdateDomainEntry == nil { @@ -7175,6 +7291,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.InfraCheckNameAvailability(childComplexity, args["resType"].(domain.ResType), args["clusterName"].(*string), args["name"].(string)), true + case "Query.infra_getBYOKCluster": + if e.complexity.Query.InfraGetBYOKCluster == nil { + break + } + + args, err := ec.field_Query_infra_getBYOKCluster_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.InfraGetBYOKCluster(childComplexity, args["name"].(string)), true + case "Query.infra_getCluster": if e.complexity.Query.InfraGetCluster == nil { break @@ -7197,7 +7325,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Query.InfraGetClusterManagedService(childComplexity, args["clusterName"].(string), args["name"].(string)), true + return e.complexity.Query.InfraGetClusterManagedService(childComplexity, args["name"].(string)), true case "Query.infra_getDomainEntry": if e.complexity.Query.InfraGetDomainEntry == nil { @@ -7331,6 +7459,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.InfraGetVolumeAttachment(childComplexity, args["clusterName"].(string), args["name"].(string)), true + case "Query.infra_listBYOKClusters": + if e.complexity.Query.InfraListBYOKClusters == nil { + break + } + + args, err := ec.field_Query_infra_listBYOKClusters_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.InfraListBYOKClusters(childComplexity, args["search"].(*model.SearchCluster), args["pagination"].(*repos.CursorPagination)), true + case "Query.infra_listClusterManagedServices": if e.complexity.Query.InfraListClusterManagedServices == nil { break @@ -7341,7 +7481,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Query.InfraListClusterManagedServices(childComplexity, args["clusterName"].(string), args["search"].(*model.SearchClusterManagedService), args["pagination"].(*repos.CursorPagination)), true + return e.complexity.Query.InfraListClusterManagedServices(childComplexity, args["search"].(*model.SearchClusterManagedService), args["pagination"].(*repos.CursorPagination)), true case "Query.infra_listClusters": if e.complexity.Query.InfraListClusters == nil { @@ -7863,6 +8003,9 @@ directive @hasAccount on FIELD_DEFINITION enum ResType { cluster + cluster_managed_service + byok_cluster + global_vpn_device # cloudprovider providersecret # edge @@ -7943,6 +8086,10 @@ type Query { infra_listClusters(search: SearchCluster, pagination: CursorPaginationIn): ClusterPaginatedRecords @isLoggedInAndVerified @hasAccount infra_getCluster(name: String!): Cluster @isLoggedInAndVerified @hasAccount + # byok + infra_listBYOKClusters(search: SearchCluster, pagination: CursorPaginationIn): BYOKClusterPaginatedRecords @isLoggedInAndVerified @hasAccount + infra_getBYOKCluster(name: String!): BYOKCluster @isLoggedInAndVerified @hasAccount + # global VPN infra_listGlobalVPNs(search: SearchGlobalVPNs, pagination: CursorPaginationIn): GlobalVPNPaginatedRecords @isLoggedInAndVerified @hasAccount infra_getGlobalVPN(name: String!): GlobalVPN @isLoggedInAndVerified @hasAccount @@ -7965,8 +8112,8 @@ type Query { infra_checkAwsAccess(cloudproviderName: String!): CheckAwsAccessOutput! @isLoggedInAndVerified @hasAccount - infra_listClusterManagedServices(clusterName: String!, search: SearchClusterManagedService, pagination: CursorPaginationIn): ClusterManagedServicePaginatedRecords @isLoggedInAndVerified @hasAccount - infra_getClusterManagedService(clusterName: String!, name: String!): ClusterManagedService @isLoggedInAndVerified @hasAccount + infra_listClusterManagedServices(search: SearchClusterManagedService, pagination: CursorPaginationIn): ClusterManagedServicePaginatedRecords @isLoggedInAndVerified @hasAccount + infra_getClusterManagedService(name: String!): ClusterManagedService @isLoggedInAndVerified @hasAccount infra_listHelmReleases(clusterName: String!, search: SearchHelmRelease, pagination: CursorPaginationIn): HelmReleasePaginatedRecords @isLoggedInAndVerified @hasAccount infra_getHelmRelease(clusterName: String!, name: String!): HelmRelease @isLoggedInAndVerified @hasAccount @@ -8004,6 +8151,8 @@ type Mutation { infra_deleteGlobalVPNDevice(gvpn: String!, deviceName: String!): Boolean! @isLoggedInAndVerified @hasAccount infra_createBYOKCluster(cluster: BYOKClusterIn!): BYOKCluster @isLoggedInAndVerified @hasAccount + infra_updateBYOKCluster(clusterName: String!, displayName: String!): BYOKCluster @isLoggedInAndVerified @hasAccount + infra_deleteBYOKCluster(name: String!): Boolean! @isLoggedInAndVerified @hasAccount infra_upgradeHelmKloudliteAgent(clusterName: String!): Boolean! @isLoggedInAndVerified @hasAccount @@ -8019,9 +8168,9 @@ type Mutation { infra_updateNodePool(clusterName: String!, pool: NodePoolIn!): NodePool @isLoggedInAndVerified @hasAccount infra_deleteNodePool(clusterName: String!, poolName: String!): Boolean! @isLoggedInAndVerified @hasAccount - infra_createClusterManagedService(clusterName: String!, service: ClusterManagedServiceIn!): ClusterManagedService @isLoggedInAndVerified @hasAccount - infra_updateClusterManagedService(clusterName: String!, service: ClusterManagedServiceIn!): ClusterManagedService @isLoggedInAndVerified @hasAccount - infra_deleteClusterManagedService(clusterName: String!, serviceName: String!): Boolean! @isLoggedInAndVerified @hasAccount + infra_createClusterManagedService(service: ClusterManagedServiceIn!): ClusterManagedService @isLoggedInAndVerified @hasAccount + infra_updateClusterManagedService(service: ClusterManagedServiceIn!): ClusterManagedService @isLoggedInAndVerified @hasAccount + infra_deleteClusterManagedService(name: String!): Boolean! @isLoggedInAndVerified @hasAccount infra_createHelmRelease(clusterName: String!, release: HelmReleaseIn!): HelmRelease @isLoggedInAndVerified @hasAccount infra_updateHelmRelease(clusterName: String!, release: HelmReleaseIn!): HelmRelease @isLoggedInAndVerified @hasAccount @@ -8045,21 +8194,39 @@ extend type GlobalVPNDevice { `, BuiltIn: false}, {Name: "../struct-to-graphql/byokcluster.graphqls", Input: `type BYOKCluster @shareable { accountName: String! - ClusterSpec: Github__com___kloudlite___operator___apis___clusters___v1__ClusterSpec + clusterPublicEndpoint: String! + clusterSvcCIDR: String! + clusterToken: String! createdBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! creationTime: Date! displayName: String! + globalVPN: String! id: ID! lastUpdatedBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! markedForDeletion: Boolean + messageQueueTopicName: String! metadata: Metadata! @goField(name: "objectMeta") recordVersion: Int! syncStatus: Github__com___kloudlite___api___pkg___types__SyncStatus! updateTime: Date! } +type BYOKClusterEdge @shareable { + cursor: String! + node: BYOKCluster! +} + +type BYOKClusterPaginatedRecords @shareable { + edges: [BYOKClusterEdge!]! + pageInfo: PageInfo! + totalCount: Int! +} + input BYOKClusterIn { + clusterPublicEndpoint: String! + clusterToken: String! displayName: String! + messageQueueTopicName: String! metadata: MetadataIn! } @@ -8172,6 +8339,7 @@ type ClusterManagedServicePaginatedRecords @shareable { input ClusterManagedServiceIn { apiVersion: String + clusterName: String! displayName: String! kind: String metadata: MetadataIn @@ -8485,7 +8653,7 @@ type Github__com___kloudlite___operator___apis___crds___v1__ManagedServiceSpec @ type Github__com___kloudlite___operator___apis___crds___v1__ServiceTemplate @shareable { apiVersion: String! kind: String! - spec: Map! + spec: Map } type Github__com___kloudlite___operator___pkg___operator__Check @shareable { @@ -8502,6 +8670,7 @@ type Github__com___kloudlite___operator___pkg___operator__Check @shareable { type Github__com___kloudlite___operator___pkg___operator__CheckMeta @shareable { debug: Boolean description: String + hide: Boolean name: String! title: String! } @@ -9096,7 +9265,7 @@ input Github__com___kloudlite___operator___apis___crds___v1__ManagedServiceSpecI input Github__com___kloudlite___operator___apis___crds___v1__ServiceTemplateIn { apiVersion: String! kind: String! - spec: Map! + spec: Map } input K8s__io___api___core___v1__AWSElasticBlockStoreVolumeSourceIn { @@ -10156,24 +10325,15 @@ func (ec *executionContext) field_Mutation_infra_createBYOKCluster_args(ctx cont func (ec *executionContext) field_Mutation_infra_createClusterManagedService_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["clusterName"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clusterName")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["clusterName"] = arg0 - var arg1 entities.ClusterManagedService + var arg0 entities.ClusterManagedService if tmp, ok := rawArgs["service"]; ok { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("service")) - arg1, err = ec.unmarshalNClusterManagedServiceIn2githubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋentitiesᚐClusterManagedService(ctx, tmp) + arg0, err = ec.unmarshalNClusterManagedServiceIn2githubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋentitiesᚐClusterManagedService(ctx, tmp) if err != nil { return nil, err } } - args["service"] = arg1 + args["service"] = arg0 return args, nil } @@ -10300,27 +10460,33 @@ func (ec *executionContext) field_Mutation_infra_createProviderSecret_args(ctx c return args, nil } -func (ec *executionContext) field_Mutation_infra_deleteClusterManagedService_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_infra_deleteBYOKCluster_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["clusterName"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clusterName")) + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } } - args["clusterName"] = arg0 - var arg1 string - if tmp, ok := rawArgs["serviceName"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("serviceName")) - arg1, err = ec.unmarshalNString2string(ctx, tmp) + args["name"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_infra_deleteClusterManagedService_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } } - args["serviceName"] = arg1 + args["name"] = arg0 return args, nil } @@ -10480,7 +10646,7 @@ func (ec *executionContext) field_Mutation_infra_deleteProviderSecret_args(ctx c return args, nil } -func (ec *executionContext) field_Mutation_infra_updateClusterManagedService_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_infra_updateBYOKCluster_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string @@ -10492,15 +10658,30 @@ func (ec *executionContext) field_Mutation_infra_updateClusterManagedService_arg } } args["clusterName"] = arg0 - var arg1 entities.ClusterManagedService + var arg1 string + if tmp, ok := rawArgs["displayName"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayName")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["displayName"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_infra_updateClusterManagedService_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 entities.ClusterManagedService if tmp, ok := rawArgs["service"]; ok { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("service")) - arg1, err = ec.unmarshalNClusterManagedServiceIn2githubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋentitiesᚐClusterManagedService(ctx, tmp) + arg0, err = ec.unmarshalNClusterManagedServiceIn2githubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋentitiesᚐClusterManagedService(ctx, tmp) if err != nil { return nil, err } } - args["service"] = arg1 + args["service"] = arg0 return args, nil } @@ -10705,27 +10886,33 @@ func (ec *executionContext) field_Query_infra_checkNameAvailability_args(ctx con return args, nil } -func (ec *executionContext) field_Query_infra_getClusterManagedService_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_infra_getBYOKCluster_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["clusterName"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clusterName")) + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } } - args["clusterName"] = arg0 - var arg1 string + args["name"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_infra_getClusterManagedService_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string if tmp, ok := rawArgs["name"]; ok { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - arg1, err = ec.unmarshalNString2string(ctx, tmp) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } } - args["name"] = arg1 + args["name"] = arg0 return args, nil } @@ -10981,36 +11168,51 @@ func (ec *executionContext) field_Query_infra_getVolumeAttachment_args(ctx conte return args, nil } -func (ec *executionContext) field_Query_infra_listClusterManagedServices_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_infra_listBYOKClusters_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["clusterName"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clusterName")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) + var arg0 *model.SearchCluster + if tmp, ok := rawArgs["search"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("search")) + arg0, err = ec.unmarshalOSearchCluster2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋappᚋgraphᚋmodelᚐSearchCluster(ctx, tmp) if err != nil { return nil, err } } - args["clusterName"] = arg0 - var arg1 *model.SearchClusterManagedService + args["search"] = arg0 + var arg1 *repos.CursorPagination + if tmp, ok := rawArgs["pagination"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pagination")) + arg1, err = ec.unmarshalOCursorPaginationIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐCursorPagination(ctx, tmp) + if err != nil { + return nil, err + } + } + args["pagination"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Query_infra_listClusterManagedServices_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *model.SearchClusterManagedService if tmp, ok := rawArgs["search"]; ok { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("search")) - arg1, err = ec.unmarshalOSearchClusterManagedService2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋappᚋgraphᚋmodelᚐSearchClusterManagedService(ctx, tmp) + arg0, err = ec.unmarshalOSearchClusterManagedService2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋappᚋgraphᚋmodelᚐSearchClusterManagedService(ctx, tmp) if err != nil { return nil, err } } - args["search"] = arg1 - var arg2 *repos.CursorPagination + args["search"] = arg0 + var arg1 *repos.CursorPagination if tmp, ok := rawArgs["pagination"]; ok { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pagination")) - arg2, err = ec.unmarshalOCursorPaginationIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐCursorPagination(ctx, tmp) + arg1, err = ec.unmarshalOCursorPaginationIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐCursorPagination(ctx, tmp) if err != nil { return nil, err } } - args["pagination"] = arg2 + args["pagination"] = arg1 return args, nil } @@ -11423,8 +11625,8 @@ func (ec *executionContext) fieldContext_BYOKCluster_accountName(ctx context.Con return fc, nil } -func (ec *executionContext) _BYOKCluster_ClusterSpec(ctx context.Context, field graphql.CollectedField, obj *entities.BYOKCluster) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_BYOKCluster_ClusterSpec(ctx, field) +func (ec *executionContext) _BYOKCluster_clusterPublicEndpoint(ctx context.Context, field graphql.CollectedField, obj *entities.BYOKCluster) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BYOKCluster_clusterPublicEndpoint(ctx, field) if err != nil { return graphql.Null } @@ -11437,62 +11639,119 @@ func (ec *executionContext) _BYOKCluster_ClusterSpec(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.BYOKCluster().ClusterSpec(rctx, obj) + return obj.ClusterPublicEndpoint, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*model.GithubComKloudliteOperatorApisClustersV1ClusterSpec) + res := resTmp.(string) fc.Result = res - return ec.marshalOGithub__com___kloudlite___operator___apis___clusters___v1__ClusterSpec2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteOperatorApisClustersV1ClusterSpec(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_BYOKCluster_ClusterSpec(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BYOKCluster_clusterPublicEndpoint(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "BYOKCluster", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "accountId": - return ec.fieldContext_Github__com___kloudlite___operator___apis___clusters___v1__ClusterSpec_accountId(ctx, field) - case "accountName": - return ec.fieldContext_Github__com___kloudlite___operator___apis___clusters___v1__ClusterSpec_accountName(ctx, field) - case "availabilityMode": - return ec.fieldContext_Github__com___kloudlite___operator___apis___clusters___v1__ClusterSpec_availabilityMode(ctx, field) - case "aws": - return ec.fieldContext_Github__com___kloudlite___operator___apis___clusters___v1__ClusterSpec_aws(ctx, field) - case "backupToS3Enabled": - return ec.fieldContext_Github__com___kloudlite___operator___apis___clusters___v1__ClusterSpec_backupToS3Enabled(ctx, field) - case "cloudflareEnabled": - return ec.fieldContext_Github__com___kloudlite___operator___apis___clusters___v1__ClusterSpec_cloudflareEnabled(ctx, field) - case "cloudProvider": - return ec.fieldContext_Github__com___kloudlite___operator___apis___clusters___v1__ClusterSpec_cloudProvider(ctx, field) - case "clusterInternalDnsHost": - return ec.fieldContext_Github__com___kloudlite___operator___apis___clusters___v1__ClusterSpec_clusterInternalDnsHost(ctx, field) - case "clusterServiceCIDR": - return ec.fieldContext_Github__com___kloudlite___operator___apis___clusters___v1__ClusterSpec_clusterServiceCIDR(ctx, field) - case "clusterTokenRef": - return ec.fieldContext_Github__com___kloudlite___operator___apis___clusters___v1__ClusterSpec_clusterTokenRef(ctx, field) - case "gcp": - return ec.fieldContext_Github__com___kloudlite___operator___apis___clusters___v1__ClusterSpec_gcp(ctx, field) - case "kloudliteRelease": - return ec.fieldContext_Github__com___kloudlite___operator___apis___clusters___v1__ClusterSpec_kloudliteRelease(ctx, field) - case "messageQueueTopicName": - return ec.fieldContext_Github__com___kloudlite___operator___apis___clusters___v1__ClusterSpec_messageQueueTopicName(ctx, field) - case "output": - return ec.fieldContext_Github__com___kloudlite___operator___apis___clusters___v1__ClusterSpec_output(ctx, field) - case "publicDNSHost": - return ec.fieldContext_Github__com___kloudlite___operator___apis___clusters___v1__ClusterSpec_publicDNSHost(ctx, field) - case "taintMasterNodes": - return ec.fieldContext_Github__com___kloudlite___operator___apis___clusters___v1__ClusterSpec_taintMasterNodes(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___operator___apis___clusters___v1__ClusterSpec", field.Name) + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _BYOKCluster_clusterSvcCIDR(ctx context.Context, field graphql.CollectedField, obj *entities.BYOKCluster) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BYOKCluster_clusterSvcCIDR(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ClusterSvcCIDR, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BYOKCluster_clusterSvcCIDR(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BYOKCluster", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _BYOKCluster_clusterToken(ctx context.Context, field graphql.CollectedField, obj *entities.BYOKCluster) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BYOKCluster_clusterToken(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ClusterToken, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BYOKCluster_clusterToken(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BYOKCluster", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil @@ -11638,6 +11897,50 @@ func (ec *executionContext) fieldContext_BYOKCluster_displayName(ctx context.Con return fc, nil } +func (ec *executionContext) _BYOKCluster_globalVPN(ctx context.Context, field graphql.CollectedField, obj *entities.BYOKCluster) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BYOKCluster_globalVPN(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.GlobalVPN, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BYOKCluster_globalVPN(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BYOKCluster", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _BYOKCluster_id(ctx context.Context, field graphql.CollectedField, obj *entities.BYOKCluster) (ret graphql.Marshaler) { fc, err := ec.fieldContext_BYOKCluster_id(ctx, field) if err != nil { @@ -11775,6 +12078,50 @@ func (ec *executionContext) fieldContext_BYOKCluster_markedForDeletion(ctx conte return fc, nil } +func (ec *executionContext) _BYOKCluster_messageQueueTopicName(ctx context.Context, field graphql.CollectedField, obj *entities.BYOKCluster) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BYOKCluster_messageQueueTopicName(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MessageQueueTopicName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BYOKCluster_messageQueueTopicName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BYOKCluster", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _BYOKCluster_metadata(ctx context.Context, field graphql.CollectedField, obj *entities.BYOKCluster) (ret graphql.Marshaler) { fc, err := ec.fieldContext_BYOKCluster_metadata(ctx, field) if err != nil { @@ -11981,6 +12328,276 @@ func (ec *executionContext) fieldContext_BYOKCluster_updateTime(ctx context.Cont return fc, nil } +func (ec *executionContext) _BYOKClusterEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *model.BYOKClusterEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BYOKClusterEdge_cursor(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Cursor, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BYOKClusterEdge_cursor(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BYOKClusterEdge", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _BYOKClusterEdge_node(ctx context.Context, field graphql.CollectedField, obj *model.BYOKClusterEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BYOKClusterEdge_node(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Node, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*entities.BYOKCluster) + fc.Result = res + return ec.marshalNBYOKCluster2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋentitiesᚐBYOKCluster(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BYOKClusterEdge_node(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BYOKClusterEdge", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "accountName": + return ec.fieldContext_BYOKCluster_accountName(ctx, field) + case "clusterPublicEndpoint": + return ec.fieldContext_BYOKCluster_clusterPublicEndpoint(ctx, field) + case "clusterSvcCIDR": + return ec.fieldContext_BYOKCluster_clusterSvcCIDR(ctx, field) + case "clusterToken": + return ec.fieldContext_BYOKCluster_clusterToken(ctx, field) + case "createdBy": + return ec.fieldContext_BYOKCluster_createdBy(ctx, field) + case "creationTime": + return ec.fieldContext_BYOKCluster_creationTime(ctx, field) + case "displayName": + return ec.fieldContext_BYOKCluster_displayName(ctx, field) + case "globalVPN": + return ec.fieldContext_BYOKCluster_globalVPN(ctx, field) + case "id": + return ec.fieldContext_BYOKCluster_id(ctx, field) + case "lastUpdatedBy": + return ec.fieldContext_BYOKCluster_lastUpdatedBy(ctx, field) + case "markedForDeletion": + return ec.fieldContext_BYOKCluster_markedForDeletion(ctx, field) + case "messageQueueTopicName": + return ec.fieldContext_BYOKCluster_messageQueueTopicName(ctx, field) + case "metadata": + return ec.fieldContext_BYOKCluster_metadata(ctx, field) + case "recordVersion": + return ec.fieldContext_BYOKCluster_recordVersion(ctx, field) + case "syncStatus": + return ec.fieldContext_BYOKCluster_syncStatus(ctx, field) + case "updateTime": + return ec.fieldContext_BYOKCluster_updateTime(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type BYOKCluster", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _BYOKClusterPaginatedRecords_edges(ctx context.Context, field graphql.CollectedField, obj *model.BYOKClusterPaginatedRecords) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BYOKClusterPaginatedRecords_edges(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Edges, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.BYOKClusterEdge) + fc.Result = res + return ec.marshalNBYOKClusterEdge2ᚕᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋappᚋgraphᚋmodelᚐBYOKClusterEdgeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BYOKClusterPaginatedRecords_edges(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BYOKClusterPaginatedRecords", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "cursor": + return ec.fieldContext_BYOKClusterEdge_cursor(ctx, field) + case "node": + return ec.fieldContext_BYOKClusterEdge_node(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type BYOKClusterEdge", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _BYOKClusterPaginatedRecords_pageInfo(ctx context.Context, field graphql.CollectedField, obj *model.BYOKClusterPaginatedRecords) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BYOKClusterPaginatedRecords_pageInfo(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PageInfo, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.PageInfo) + fc.Result = res + return ec.marshalNPageInfo2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋappᚋgraphᚋmodelᚐPageInfo(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BYOKClusterPaginatedRecords_pageInfo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BYOKClusterPaginatedRecords", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _BYOKClusterPaginatedRecords_totalCount(ctx context.Context, field graphql.CollectedField, obj *model.BYOKClusterPaginatedRecords) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BYOKClusterPaginatedRecords_totalCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.TotalCount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BYOKClusterPaginatedRecords_totalCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BYOKClusterPaginatedRecords", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _CheckAwsAccessOutput_result(ctx context.Context, field graphql.CollectedField, obj *model.CheckAwsAccessOutput) (ret graphql.Marshaler) { fc, err := ec.fieldContext_CheckAwsAccessOutput_result(ctx, field) if err != nil { @@ -23923,6 +24540,8 @@ func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___ap return ec.fieldContext_Github__com___kloudlite___operator___pkg___operator__CheckMeta_debug(ctx, field) case "description": return ec.fieldContext_Github__com___kloudlite___operator___pkg___operator__CheckMeta_description(ctx, field) + case "hide": + return ec.fieldContext_Github__com___kloudlite___operator___pkg___operator__CheckMeta_hide(ctx, field) case "name": return ec.fieldContext_Github__com___kloudlite___operator___pkg___operator__CheckMeta_name(ctx, field) case "title": @@ -24724,14 +25343,11 @@ func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___ return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } res := resTmp.(map[string]interface{}) fc.Result = res - return ec.marshalNMap2map(ctx, field.Selections, res) + return ec.marshalOMap2map(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___crds___v1__ServiceTemplate_spec(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -25160,6 +25776,47 @@ func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___pk return fc, nil } +func (ec *executionContext) _Github__com___kloudlite___operator___pkg___operator__CheckMeta_hide(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorPkgOperatorCheckMeta) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___operator___pkg___operator__CheckMeta_hide(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Hide, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*bool) + fc.Result = res + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___pkg___operator__CheckMeta_hide(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___operator___pkg___operator__CheckMeta", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _Github__com___kloudlite___operator___pkg___operator__CheckMeta_name(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorPkgOperatorCheckMeta) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Github__com___kloudlite___operator___pkg___operator__CheckMeta_name(ctx, field) if err != nil { @@ -25464,6 +26121,8 @@ func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___pk return ec.fieldContext_Github__com___kloudlite___operator___pkg___operator__CheckMeta_debug(ctx, field) case "description": return ec.fieldContext_Github__com___kloudlite___operator___pkg___operator__CheckMeta_description(ctx, field) + case "hide": + return ec.fieldContext_Github__com___kloudlite___operator___pkg___operator__CheckMeta_hide(ctx, field) case "name": return ec.fieldContext_Github__com___kloudlite___operator___pkg___operator__CheckMeta_name(ctx, field) case "title": @@ -41146,20 +41805,28 @@ func (ec *executionContext) fieldContext_Mutation_infra_createBYOKCluster(ctx co switch field.Name { case "accountName": return ec.fieldContext_BYOKCluster_accountName(ctx, field) - case "ClusterSpec": - return ec.fieldContext_BYOKCluster_ClusterSpec(ctx, field) + case "clusterPublicEndpoint": + return ec.fieldContext_BYOKCluster_clusterPublicEndpoint(ctx, field) + case "clusterSvcCIDR": + return ec.fieldContext_BYOKCluster_clusterSvcCIDR(ctx, field) + case "clusterToken": + return ec.fieldContext_BYOKCluster_clusterToken(ctx, field) case "createdBy": return ec.fieldContext_BYOKCluster_createdBy(ctx, field) case "creationTime": return ec.fieldContext_BYOKCluster_creationTime(ctx, field) case "displayName": return ec.fieldContext_BYOKCluster_displayName(ctx, field) + case "globalVPN": + return ec.fieldContext_BYOKCluster_globalVPN(ctx, field) case "id": return ec.fieldContext_BYOKCluster_id(ctx, field) case "lastUpdatedBy": return ec.fieldContext_BYOKCluster_lastUpdatedBy(ctx, field) case "markedForDeletion": return ec.fieldContext_BYOKCluster_markedForDeletion(ctx, field) + case "messageQueueTopicName": + return ec.fieldContext_BYOKCluster_messageQueueTopicName(ctx, field) case "metadata": return ec.fieldContext_BYOKCluster_metadata(ctx, field) case "recordVersion": @@ -41186,6 +41853,199 @@ func (ec *executionContext) fieldContext_Mutation_infra_createBYOKCluster(ctx co return fc, nil } +func (ec *executionContext) _Mutation_infra_updateBYOKCluster(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_infra_updateBYOKCluster(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().InfraUpdateBYOKCluster(rctx, fc.Args["clusterName"].(string), fc.Args["displayName"].(string)) + } + directive1 := func(ctx context.Context) (interface{}, error) { + if ec.directives.IsLoggedInAndVerified == nil { + return nil, errors.New("directive isLoggedInAndVerified is not implemented") + } + return ec.directives.IsLoggedInAndVerified(ctx, nil, directive0) + } + directive2 := func(ctx context.Context) (interface{}, error) { + if ec.directives.HasAccount == nil { + return nil, errors.New("directive hasAccount is not implemented") + } + return ec.directives.HasAccount(ctx, nil, directive1) + } + + tmp, err := directive2(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*entities.BYOKCluster); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/kloudlite/api/apps/infra/internal/entities.BYOKCluster`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*entities.BYOKCluster) + fc.Result = res + return ec.marshalOBYOKCluster2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋentitiesᚐBYOKCluster(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_infra_updateBYOKCluster(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "accountName": + return ec.fieldContext_BYOKCluster_accountName(ctx, field) + case "clusterPublicEndpoint": + return ec.fieldContext_BYOKCluster_clusterPublicEndpoint(ctx, field) + case "clusterSvcCIDR": + return ec.fieldContext_BYOKCluster_clusterSvcCIDR(ctx, field) + case "clusterToken": + return ec.fieldContext_BYOKCluster_clusterToken(ctx, field) + case "createdBy": + return ec.fieldContext_BYOKCluster_createdBy(ctx, field) + case "creationTime": + return ec.fieldContext_BYOKCluster_creationTime(ctx, field) + case "displayName": + return ec.fieldContext_BYOKCluster_displayName(ctx, field) + case "globalVPN": + return ec.fieldContext_BYOKCluster_globalVPN(ctx, field) + case "id": + return ec.fieldContext_BYOKCluster_id(ctx, field) + case "lastUpdatedBy": + return ec.fieldContext_BYOKCluster_lastUpdatedBy(ctx, field) + case "markedForDeletion": + return ec.fieldContext_BYOKCluster_markedForDeletion(ctx, field) + case "messageQueueTopicName": + return ec.fieldContext_BYOKCluster_messageQueueTopicName(ctx, field) + case "metadata": + return ec.fieldContext_BYOKCluster_metadata(ctx, field) + case "recordVersion": + return ec.fieldContext_BYOKCluster_recordVersion(ctx, field) + case "syncStatus": + return ec.fieldContext_BYOKCluster_syncStatus(ctx, field) + case "updateTime": + return ec.fieldContext_BYOKCluster_updateTime(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type BYOKCluster", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_infra_updateBYOKCluster_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_infra_deleteBYOKCluster(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_infra_deleteBYOKCluster(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().InfraDeleteBYOKCluster(rctx, fc.Args["name"].(string)) + } + directive1 := func(ctx context.Context) (interface{}, error) { + if ec.directives.IsLoggedInAndVerified == nil { + return nil, errors.New("directive isLoggedInAndVerified is not implemented") + } + return ec.directives.IsLoggedInAndVerified(ctx, nil, directive0) + } + directive2 := func(ctx context.Context) (interface{}, error) { + if ec.directives.HasAccount == nil { + return nil, errors.New("directive hasAccount is not implemented") + } + return ec.directives.HasAccount(ctx, nil, directive1) + } + + tmp, err := directive2(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(bool); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be bool`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_infra_deleteBYOKCluster(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_infra_deleteBYOKCluster_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _Mutation_infra_upgradeHelmKloudliteAgent(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Mutation_infra_upgradeHelmKloudliteAgent(ctx, field) if err != nil { @@ -42165,7 +43025,7 @@ func (ec *executionContext) _Mutation_infra_createClusterManagedService(ctx cont resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().InfraCreateClusterManagedService(rctx, fc.Args["clusterName"].(string), fc.Args["service"].(entities.ClusterManagedService)) + return ec.resolvers.Mutation().InfraCreateClusterManagedService(rctx, fc.Args["service"].(entities.ClusterManagedService)) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsLoggedInAndVerified == nil { @@ -42277,7 +43137,7 @@ func (ec *executionContext) _Mutation_infra_updateClusterManagedService(ctx cont resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().InfraUpdateClusterManagedService(rctx, fc.Args["clusterName"].(string), fc.Args["service"].(entities.ClusterManagedService)) + return ec.resolvers.Mutation().InfraUpdateClusterManagedService(rctx, fc.Args["service"].(entities.ClusterManagedService)) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsLoggedInAndVerified == nil { @@ -42389,7 +43249,7 @@ func (ec *executionContext) _Mutation_infra_deleteClusterManagedService(ctx cont resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().InfraDeleteClusterManagedService(rctx, fc.Args["clusterName"].(string), fc.Args["serviceName"].(string)) + return ec.resolvers.Mutation().InfraDeleteClusterManagedService(rctx, fc.Args["name"].(string)) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsLoggedInAndVerified == nil { @@ -48320,6 +49180,204 @@ func (ec *executionContext) fieldContext_Query_infra_getCluster(ctx context.Cont return fc, nil } +func (ec *executionContext) _Query_infra_listBYOKClusters(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_infra_listBYOKClusters(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().InfraListBYOKClusters(rctx, fc.Args["search"].(*model.SearchCluster), fc.Args["pagination"].(*repos.CursorPagination)) + } + directive1 := func(ctx context.Context) (interface{}, error) { + if ec.directives.IsLoggedInAndVerified == nil { + return nil, errors.New("directive isLoggedInAndVerified is not implemented") + } + return ec.directives.IsLoggedInAndVerified(ctx, nil, directive0) + } + directive2 := func(ctx context.Context) (interface{}, error) { + if ec.directives.HasAccount == nil { + return nil, errors.New("directive hasAccount is not implemented") + } + return ec.directives.HasAccount(ctx, nil, directive1) + } + + tmp, err := directive2(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*model.BYOKClusterPaginatedRecords); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/kloudlite/api/apps/infra/internal/app/graph/model.BYOKClusterPaginatedRecords`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.BYOKClusterPaginatedRecords) + fc.Result = res + return ec.marshalOBYOKClusterPaginatedRecords2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋappᚋgraphᚋmodelᚐBYOKClusterPaginatedRecords(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_infra_listBYOKClusters(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_BYOKClusterPaginatedRecords_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_BYOKClusterPaginatedRecords_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_BYOKClusterPaginatedRecords_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type BYOKClusterPaginatedRecords", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_infra_listBYOKClusters_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_infra_getBYOKCluster(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_infra_getBYOKCluster(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().InfraGetBYOKCluster(rctx, fc.Args["name"].(string)) + } + directive1 := func(ctx context.Context) (interface{}, error) { + if ec.directives.IsLoggedInAndVerified == nil { + return nil, errors.New("directive isLoggedInAndVerified is not implemented") + } + return ec.directives.IsLoggedInAndVerified(ctx, nil, directive0) + } + directive2 := func(ctx context.Context) (interface{}, error) { + if ec.directives.HasAccount == nil { + return nil, errors.New("directive hasAccount is not implemented") + } + return ec.directives.HasAccount(ctx, nil, directive1) + } + + tmp, err := directive2(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*entities.BYOKCluster); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/kloudlite/api/apps/infra/internal/entities.BYOKCluster`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*entities.BYOKCluster) + fc.Result = res + return ec.marshalOBYOKCluster2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋentitiesᚐBYOKCluster(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_infra_getBYOKCluster(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "accountName": + return ec.fieldContext_BYOKCluster_accountName(ctx, field) + case "clusterPublicEndpoint": + return ec.fieldContext_BYOKCluster_clusterPublicEndpoint(ctx, field) + case "clusterSvcCIDR": + return ec.fieldContext_BYOKCluster_clusterSvcCIDR(ctx, field) + case "clusterToken": + return ec.fieldContext_BYOKCluster_clusterToken(ctx, field) + case "createdBy": + return ec.fieldContext_BYOKCluster_createdBy(ctx, field) + case "creationTime": + return ec.fieldContext_BYOKCluster_creationTime(ctx, field) + case "displayName": + return ec.fieldContext_BYOKCluster_displayName(ctx, field) + case "globalVPN": + return ec.fieldContext_BYOKCluster_globalVPN(ctx, field) + case "id": + return ec.fieldContext_BYOKCluster_id(ctx, field) + case "lastUpdatedBy": + return ec.fieldContext_BYOKCluster_lastUpdatedBy(ctx, field) + case "markedForDeletion": + return ec.fieldContext_BYOKCluster_markedForDeletion(ctx, field) + case "messageQueueTopicName": + return ec.fieldContext_BYOKCluster_messageQueueTopicName(ctx, field) + case "metadata": + return ec.fieldContext_BYOKCluster_metadata(ctx, field) + case "recordVersion": + return ec.fieldContext_BYOKCluster_recordVersion(ctx, field) + case "syncStatus": + return ec.fieldContext_BYOKCluster_syncStatus(ctx, field) + case "updateTime": + return ec.fieldContext_BYOKCluster_updateTime(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type BYOKCluster", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_infra_getBYOKCluster_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _Query_infra_listGlobalVPNs(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_infra_listGlobalVPNs(ctx, field) if err != nil { @@ -49396,7 +50454,7 @@ func (ec *executionContext) _Query_infra_listClusterManagedServices(ctx context. resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().InfraListClusterManagedServices(rctx, fc.Args["clusterName"].(string), fc.Args["search"].(*model.SearchClusterManagedService), fc.Args["pagination"].(*repos.CursorPagination)) + return ec.resolvers.Query().InfraListClusterManagedServices(rctx, fc.Args["search"].(*model.SearchClusterManagedService), fc.Args["pagination"].(*repos.CursorPagination)) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsLoggedInAndVerified == nil { @@ -49482,7 +50540,7 @@ func (ec *executionContext) _Query_infra_getClusterManagedService(ctx context.Co resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().InfraGetClusterManagedService(rctx, fc.Args["clusterName"].(string), fc.Args["name"].(string)) + return ec.resolvers.Query().InfraGetClusterManagedService(rctx, fc.Args["name"].(string)) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsLoggedInAndVerified == nil { @@ -53713,13 +54771,31 @@ func (ec *executionContext) unmarshalInputBYOKClusterIn(ctx context.Context, obj asMap[k] = v } - fieldsInOrder := [...]string{"displayName", "metadata"} + fieldsInOrder := [...]string{"clusterPublicEndpoint", "clusterToken", "displayName", "messageQueueTopicName", "metadata"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { + case "clusterPublicEndpoint": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clusterPublicEndpoint")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.ClusterPublicEndpoint = data + case "clusterToken": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clusterToken")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.ClusterToken = data case "displayName": var err error @@ -53729,6 +54805,15 @@ func (ec *executionContext) unmarshalInputBYOKClusterIn(ctx context.Context, obj return it, err } it.DisplayName = data + case "messageQueueTopicName": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("messageQueueTopicName")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.MessageQueueTopicName = data case "metadata": var err error @@ -53904,7 +54989,7 @@ func (ec *executionContext) unmarshalInputClusterManagedServiceIn(ctx context.Co asMap[k] = v } - fieldsInOrder := [...]string{"apiVersion", "displayName", "kind", "metadata", "spec"} + fieldsInOrder := [...]string{"apiVersion", "clusterName", "displayName", "kind", "metadata", "spec"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -53920,6 +55005,15 @@ func (ec *executionContext) unmarshalInputClusterManagedServiceIn(ctx context.Co return it, err } it.APIVersion = data + case "clusterName": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clusterName")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.ClusterName = data case "displayName": var err error @@ -55213,7 +56307,7 @@ func (ec *executionContext) unmarshalInputGithub__com___kloudlite___operator___a var err error ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("spec")) - data, err := ec.unmarshalNMap2map(ctx, v) + data, err := ec.unmarshalOMap2map(ctx, v) if err != nil { return it, err } @@ -59623,7 +60717,73 @@ func (ec *executionContext) _BYOKCluster(ctx context.Context, sel ast.SelectionS if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "ClusterSpec": + case "clusterPublicEndpoint": + out.Values[i] = ec._BYOKCluster_clusterPublicEndpoint(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "clusterSvcCIDR": + out.Values[i] = ec._BYOKCluster_clusterSvcCIDR(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "clusterToken": + out.Values[i] = ec._BYOKCluster_clusterToken(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "createdBy": + out.Values[i] = ec._BYOKCluster_createdBy(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "creationTime": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._BYOKCluster_creationTime(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "displayName": + out.Values[i] = ec._BYOKCluster_displayName(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "globalVPN": + out.Values[i] = ec._BYOKCluster_globalVPN(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "id": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -59632,7 +60792,10 @@ func (ec *executionContext) _BYOKCluster(ctx context.Context, sel ast.SelectionS ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._BYOKCluster_ClusterSpec(ctx, field, obj) + res = ec._BYOKCluster_id(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } return res } @@ -59656,12 +60819,34 @@ func (ec *executionContext) _BYOKCluster(ctx context.Context, sel ast.SelectionS } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "createdBy": - out.Values[i] = ec._BYOKCluster_createdBy(ctx, field, obj) + case "lastUpdatedBy": + out.Values[i] = ec._BYOKCluster_lastUpdatedBy(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "creationTime": + case "markedForDeletion": + out.Values[i] = ec._BYOKCluster_markedForDeletion(ctx, field, obj) + case "messageQueueTopicName": + out.Values[i] = ec._BYOKCluster_messageQueueTopicName(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "metadata": + out.Values[i] = ec._BYOKCluster_metadata(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "recordVersion": + out.Values[i] = ec._BYOKCluster_recordVersion(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "syncStatus": + out.Values[i] = ec._BYOKCluster_syncStatus(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "updateTime": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -59670,7 +60855,7 @@ func (ec *executionContext) _BYOKCluster(ctx context.Context, sel ast.SelectionS ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._BYOKCluster_creationTime(ctx, field, obj) + res = ec._BYOKCluster_updateTime(ctx, field, obj) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -59697,105 +60882,99 @@ func (ec *executionContext) _BYOKCluster(ctx context.Context, sel ast.SelectionS } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "displayName": - out.Values[i] = ec._BYOKCluster_displayName(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "id": - field := field + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._BYOKCluster_id(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res - } + atomic.AddInt32(&ec.deferred, int32(len(deferred))) - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue - } + return out +} - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "lastUpdatedBy": - out.Values[i] = ec._BYOKCluster_lastUpdatedBy(ctx, field, obj) +var bYOKClusterEdgeImplementors = []string{"BYOKClusterEdge"} + +func (ec *executionContext) _BYOKClusterEdge(ctx context.Context, sel ast.SelectionSet, obj *model.BYOKClusterEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, bYOKClusterEdgeImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("BYOKClusterEdge") + case "cursor": + out.Values[i] = ec._BYOKClusterEdge_cursor(ctx, field, obj) if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) + out.Invalids++ } - case "markedForDeletion": - out.Values[i] = ec._BYOKCluster_markedForDeletion(ctx, field, obj) - case "metadata": - out.Values[i] = ec._BYOKCluster_metadata(ctx, field, obj) + case "node": + out.Values[i] = ec._BYOKClusterEdge_node(ctx, field, obj) if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) + out.Invalids++ } - case "recordVersion": - out.Values[i] = ec._BYOKCluster_recordVersion(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var bYOKClusterPaginatedRecordsImplementors = []string{"BYOKClusterPaginatedRecords"} + +func (ec *executionContext) _BYOKClusterPaginatedRecords(ctx context.Context, sel ast.SelectionSet, obj *model.BYOKClusterPaginatedRecords) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, bYOKClusterPaginatedRecordsImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("BYOKClusterPaginatedRecords") + case "edges": + out.Values[i] = ec._BYOKClusterPaginatedRecords_edges(ctx, field, obj) if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) + out.Invalids++ } - case "syncStatus": - out.Values[i] = ec._BYOKCluster_syncStatus(ctx, field, obj) + case "pageInfo": + out.Values[i] = ec._BYOKClusterPaginatedRecords_pageInfo(ctx, field, obj) if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "updateTime": - field := field - - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._BYOKCluster_updateTime(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res + out.Invalids++ } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue + case "totalCount": + out.Values[i] = ec._BYOKClusterPaginatedRecords_totalCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -63537,9 +64716,6 @@ func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___ } case "spec": out.Values[i] = ec._Github__com___kloudlite___operator___apis___crds___v1__ServiceTemplate_spec(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -63693,6 +64869,8 @@ func (ec *executionContext) _Github__com___kloudlite___operator___pkg___operator out.Values[i] = ec._Github__com___kloudlite___operator___pkg___operator__CheckMeta_debug(ctx, field, obj) case "description": out.Values[i] = ec._Github__com___kloudlite___operator___pkg___operator__CheckMeta_description(ctx, field, obj) + case "hide": + out.Values[i] = ec._Github__com___kloudlite___operator___pkg___operator__CheckMeta_hide(ctx, field, obj) case "name": out.Values[i] = ec._Github__com___kloudlite___operator___pkg___operator__CheckMeta_name(ctx, field, obj) if out.Values[i] == graphql.Null { @@ -67850,6 +69028,17 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_infra_createBYOKCluster(ctx, field) }) + case "infra_updateBYOKCluster": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_infra_updateBYOKCluster(ctx, field) + }) + case "infra_deleteBYOKCluster": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_infra_deleteBYOKCluster(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } case "infra_upgradeHelmKloudliteAgent": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_infra_upgradeHelmKloudliteAgent(ctx, field) @@ -69731,6 +70920,44 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "infra_listBYOKClusters": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_infra_listBYOKClusters(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "infra_getBYOKCluster": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_infra_getBYOKCluster(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "infra_listGlobalVPNs": field := field @@ -70993,6 +72220,70 @@ func (ec *executionContext) marshalNAny2interface(ctx context.Context, sel ast.S return res } +func (ec *executionContext) marshalNBYOKCluster2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋentitiesᚐBYOKCluster(ctx context.Context, sel ast.SelectionSet, v *entities.BYOKCluster) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._BYOKCluster(ctx, sel, v) +} + +func (ec *executionContext) marshalNBYOKClusterEdge2ᚕᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋappᚋgraphᚋmodelᚐBYOKClusterEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.BYOKClusterEdge) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNBYOKClusterEdge2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋappᚋgraphᚋmodelᚐBYOKClusterEdge(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNBYOKClusterEdge2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋappᚋgraphᚋmodelᚐBYOKClusterEdge(ctx context.Context, sel ast.SelectionSet, v *model.BYOKClusterEdge) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._BYOKClusterEdge(ctx, sel, v) +} + func (ec *executionContext) unmarshalNBYOKClusterIn2githubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋentitiesᚐBYOKCluster(ctx context.Context, v interface{}) (entities.BYOKCluster, error) { res, err := ec.unmarshalInputBYOKClusterIn(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -73324,7 +74615,7 @@ func (ec *executionContext) marshalNfederation__Scope2ᚕᚕstringᚄ(ctx contex return ret } -func (ec *executionContext) unmarshalOAny2interface(ctx context.Context, v interface{}) (any, error) { +func (ec *executionContext) unmarshalOAny2interface(ctx context.Context, v interface{}) (interface{}, error) { if v == nil { return nil, nil } @@ -73332,7 +74623,7 @@ func (ec *executionContext) unmarshalOAny2interface(ctx context.Context, v inter return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalOAny2interface(ctx context.Context, sel ast.SelectionSet, v any) graphql.Marshaler { +func (ec *executionContext) marshalOAny2interface(ctx context.Context, sel ast.SelectionSet, v interface{}) graphql.Marshaler { if v == nil { return graphql.Null } @@ -73385,6 +74676,13 @@ func (ec *executionContext) marshalOBYOKCluster2ᚖgithubᚗcomᚋkloudliteᚋap return ec._BYOKCluster(ctx, sel, v) } +func (ec *executionContext) marshalOBYOKClusterPaginatedRecords2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋappᚋgraphᚋmodelᚐBYOKClusterPaginatedRecords(ctx context.Context, sel ast.SelectionSet, v *model.BYOKClusterPaginatedRecords) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._BYOKClusterPaginatedRecords(ctx, sel, v) +} + func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { res, err := graphql.UnmarshalBoolean(v) return res, graphql.ErrorOnPath(ctx, err) @@ -73711,13 +75009,6 @@ func (ec *executionContext) marshalOGithub__com___kloudlite___operator___apis___ return ec._Github__com___kloudlite___operator___apis___clusters___v1__ClusterOutput(ctx, sel, v) } -func (ec *executionContext) marshalOGithub__com___kloudlite___operator___apis___clusters___v1__ClusterSpec2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteOperatorApisClustersV1ClusterSpec(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteOperatorApisClustersV1ClusterSpec) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._Github__com___kloudlite___operator___apis___clusters___v1__ClusterSpec(ctx, sel, v) -} - func (ec *executionContext) marshalOGithub__com___kloudlite___operator___apis___clusters___v1__GCPClusterConfig2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋinfraᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteOperatorApisClustersV1GCPClusterConfig(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteOperatorApisClustersV1GCPClusterConfig) graphql.Marshaler { if v == nil { return graphql.Null diff --git a/apps/infra/internal/app/graph/model/models_gen.go b/apps/infra/internal/app/graph/model/models_gen.go index b06212e68..9a54171d5 100644 --- a/apps/infra/internal/app/graph/model/models_gen.go +++ b/apps/infra/internal/app/graph/model/models_gen.go @@ -13,6 +13,17 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1" ) +type BYOKClusterEdge struct { + Cursor string `json:"cursor"` + Node *entities.BYOKCluster `json:"node"` +} + +type BYOKClusterPaginatedRecords struct { + Edges []*BYOKClusterEdge `json:"edges"` + PageInfo *PageInfo `json:"pageInfo"` + TotalCount int `json:"totalCount"` +} + type CheckAwsAccessOutput struct { Result bool `json:"result"` InstallationURL *string `json:"installationUrl,omitempty"` @@ -484,18 +495,19 @@ type GithubComKloudliteOperatorApisCrdsV1ManagedServiceSpecIn struct { type GithubComKloudliteOperatorApisCrdsV1ServiceTemplate struct { APIVersion string `json:"apiVersion"` Kind string `json:"kind"` - Spec map[string]interface{} `json:"spec"` + Spec map[string]interface{} `json:"spec,omitempty"` } type GithubComKloudliteOperatorApisCrdsV1ServiceTemplateIn struct { APIVersion string `json:"apiVersion"` Kind string `json:"kind"` - Spec map[string]interface{} `json:"spec"` + Spec map[string]interface{} `json:"spec,omitempty"` } type GithubComKloudliteOperatorPkgOperatorCheckMeta struct { Debug *bool `json:"debug,omitempty"` Description *string `json:"description,omitempty"` + Hide *bool `json:"hide,omitempty"` Name string `json:"name"` Title string `json:"title"` } diff --git a/apps/infra/internal/app/graph/schema.graphqls b/apps/infra/internal/app/graph/schema.graphqls index af9ad30be..8713c9796 100644 --- a/apps/infra/internal/app/graph/schema.graphqls +++ b/apps/infra/internal/app/graph/schema.graphqls @@ -4,6 +4,9 @@ directive @hasAccount on FIELD_DEFINITION enum ResType { cluster + cluster_managed_service + byok_cluster + global_vpn_device # cloudprovider providersecret # edge @@ -84,6 +87,10 @@ type Query { infra_listClusters(search: SearchCluster, pagination: CursorPaginationIn): ClusterPaginatedRecords @isLoggedInAndVerified @hasAccount infra_getCluster(name: String!): Cluster @isLoggedInAndVerified @hasAccount + # byok + infra_listBYOKClusters(search: SearchCluster, pagination: CursorPaginationIn): BYOKClusterPaginatedRecords @isLoggedInAndVerified @hasAccount + infra_getBYOKCluster(name: String!): BYOKCluster @isLoggedInAndVerified @hasAccount + # global VPN infra_listGlobalVPNs(search: SearchGlobalVPNs, pagination: CursorPaginationIn): GlobalVPNPaginatedRecords @isLoggedInAndVerified @hasAccount infra_getGlobalVPN(name: String!): GlobalVPN @isLoggedInAndVerified @hasAccount @@ -106,8 +113,8 @@ type Query { infra_checkAwsAccess(cloudproviderName: String!): CheckAwsAccessOutput! @isLoggedInAndVerified @hasAccount - infra_listClusterManagedServices(clusterName: String!, search: SearchClusterManagedService, pagination: CursorPaginationIn): ClusterManagedServicePaginatedRecords @isLoggedInAndVerified @hasAccount - infra_getClusterManagedService(clusterName: String!, name: String!): ClusterManagedService @isLoggedInAndVerified @hasAccount + infra_listClusterManagedServices(search: SearchClusterManagedService, pagination: CursorPaginationIn): ClusterManagedServicePaginatedRecords @isLoggedInAndVerified @hasAccount + infra_getClusterManagedService(name: String!): ClusterManagedService @isLoggedInAndVerified @hasAccount infra_listHelmReleases(clusterName: String!, search: SearchHelmRelease, pagination: CursorPaginationIn): HelmReleasePaginatedRecords @isLoggedInAndVerified @hasAccount infra_getHelmRelease(clusterName: String!, name: String!): HelmRelease @isLoggedInAndVerified @hasAccount @@ -145,6 +152,8 @@ type Mutation { infra_deleteGlobalVPNDevice(gvpn: String!, deviceName: String!): Boolean! @isLoggedInAndVerified @hasAccount infra_createBYOKCluster(cluster: BYOKClusterIn!): BYOKCluster @isLoggedInAndVerified @hasAccount + infra_updateBYOKCluster(clusterName: String!, displayName: String!): BYOKCluster @isLoggedInAndVerified @hasAccount + infra_deleteBYOKCluster(name: String!): Boolean! @isLoggedInAndVerified @hasAccount infra_upgradeHelmKloudliteAgent(clusterName: String!): Boolean! @isLoggedInAndVerified @hasAccount @@ -160,9 +169,9 @@ type Mutation { infra_updateNodePool(clusterName: String!, pool: NodePoolIn!): NodePool @isLoggedInAndVerified @hasAccount infra_deleteNodePool(clusterName: String!, poolName: String!): Boolean! @isLoggedInAndVerified @hasAccount - infra_createClusterManagedService(clusterName: String!, service: ClusterManagedServiceIn!): ClusterManagedService @isLoggedInAndVerified @hasAccount - infra_updateClusterManagedService(clusterName: String!, service: ClusterManagedServiceIn!): ClusterManagedService @isLoggedInAndVerified @hasAccount - infra_deleteClusterManagedService(clusterName: String!, serviceName: String!): Boolean! @isLoggedInAndVerified @hasAccount + infra_createClusterManagedService(service: ClusterManagedServiceIn!): ClusterManagedService @isLoggedInAndVerified @hasAccount + infra_updateClusterManagedService(service: ClusterManagedServiceIn!): ClusterManagedService @isLoggedInAndVerified @hasAccount + infra_deleteClusterManagedService(name: String!): Boolean! @isLoggedInAndVerified @hasAccount infra_createHelmRelease(clusterName: String!, release: HelmReleaseIn!): HelmRelease @isLoggedInAndVerified @hasAccount infra_updateHelmRelease(clusterName: String!, release: HelmReleaseIn!): HelmRelease @isLoggedInAndVerified @hasAccount diff --git a/apps/infra/internal/app/graph/schema.resolvers.go b/apps/infra/internal/app/graph/schema.resolvers.go index 0740fc6a8..d9ce2e3dc 100644 --- a/apps/infra/internal/app/graph/schema.resolvers.go +++ b/apps/infra/internal/app/graph/schema.resolvers.go @@ -44,7 +44,7 @@ func (r *globalVPNDeviceResolver) WireguardConfig(ctx context.Context, obj *enti if err != nil { return nil, errors.NewE(err) } - wgconfig, err := r.Domain.GetGlobalVPNDeviceWgConfig(ictx, gvpnDevice.GlobalVPNName, gvpnDevice.Name) + wgconfig, err := r.Domain.GetGlobalVPNDeviceWgConfig(ictx, obj.GlobalVPNName, obj.Name) if err != nil { return nil, err } @@ -157,6 +157,28 @@ func (r *mutationResolver) InfraCreateBYOKCluster(ctx context.Context, cluster e return r.Domain.CreateBYOKCluster(ictx, cluster) } +// InfraUpdatebYOKCluster is the resolver for the infra_updatebYOKCluster field. +func (r *mutationResolver) InfraUpdateBYOKCluster(ctx context.Context, clusterName string, displayName string) (*entities.BYOKCluster, error) { + ictx, err := toInfraContext(ctx) + if err != nil { + return nil, errors.NewE(err) + } + return r.Domain.UpdateBYOKCluster(ictx, clusterName, displayName) +} + +// InfraDeleteBYOKCluster is the resolver for the infra_deleteBYOKCluster field. +func (r *mutationResolver) InfraDeleteBYOKCluster(ctx context.Context, name string) (bool, error) { + ictx, err := toInfraContext(ctx) + if err != nil { + return false, errors.NewE(err) + } + if err := r.Domain.DeleteBYOKCluster(ictx, name); err != nil { + return false, err + } + + return true, nil +} + // InfraUpgradeHelmKloudliteAgent is the resolver for the infra_upgradeHelmKloudliteAgent field. func (r *mutationResolver) InfraUpgradeHelmKloudliteAgent(ctx context.Context, clusterName string) (bool, error) { ictx, err := toInfraContext(ctx) @@ -267,31 +289,31 @@ func (r *mutationResolver) InfraDeleteNodePool(ctx context.Context, clusterName } // InfraCreateClusterManagedService is the resolver for the infra_createClusterManagedService field. -func (r *mutationResolver) InfraCreateClusterManagedService(ctx context.Context, clusterName string, service entities.ClusterManagedService) (*entities.ClusterManagedService, error) { +func (r *mutationResolver) InfraCreateClusterManagedService(ctx context.Context, service entities.ClusterManagedService) (*entities.ClusterManagedService, error) { ictx, err := toInfraContext(ctx) if err != nil { return nil, errors.NewE(err) } - return r.Domain.CreateClusterManagedService(ictx, clusterName, service) + return r.Domain.CreateClusterManagedService(ictx, service) } // InfraUpdateClusterManagedService is the resolver for the infra_updateClusterManagedService field. -func (r *mutationResolver) InfraUpdateClusterManagedService(ctx context.Context, clusterName string, service entities.ClusterManagedService) (*entities.ClusterManagedService, error) { +func (r *mutationResolver) InfraUpdateClusterManagedService(ctx context.Context, service entities.ClusterManagedService) (*entities.ClusterManagedService, error) { ictx, err := toInfraContext(ctx) if err != nil { return nil, errors.NewE(err) } - return r.Domain.UpdateClusterManagedService(ictx, clusterName, service) + return r.Domain.UpdateClusterManagedService(ictx, service) } // InfraDeleteClusterManagedService is the resolver for the infra_deleteClusterManagedService field. -func (r *mutationResolver) InfraDeleteClusterManagedService(ctx context.Context, clusterName string, serviceName string) (bool, error) { +func (r *mutationResolver) InfraDeleteClusterManagedService(ctx context.Context, name string) (bool, error) { ictx, err := toInfraContext(ctx) if err != nil { return false, errors.NewE(err) } - if err := r.Domain.DeleteClusterManagedService(ictx, clusterName, serviceName); err != nil { + if err := r.Domain.DeleteClusterManagedService(ictx, name); err != nil { return false, errors.NewE(err) } return true, nil @@ -418,6 +440,43 @@ func (r *queryResolver) InfraGetCluster(ctx context.Context, name string) (*enti return r.Domain.GetCluster(ictx, name) } +// InfraListBYOKClusters is the resolver for the infra_listBYOKClusters field. +func (r *queryResolver) InfraListBYOKClusters(ctx context.Context, search *model.SearchCluster, pagination *repos.CursorPagination) (*model.BYOKClusterPaginatedRecords, error) { + ictx, err := toInfraContext(ctx) + if err != nil { + return nil, errors.NewE(err) + } + + if pagination == nil { + pagination = &repos.DefaultCursorPagination + } + + filter := map[string]repos.MatchFilter{} + + if search != nil { + if search.Text != nil { + filter[fields.MetadataName] = *search.Text + } + } + + globalVPNs, err := r.Domain.ListBYOKCluster(ictx, filter, *pagination) + if err != nil { + return nil, errors.NewE(err) + } + + return fn.JsonConvertP[model.BYOKClusterPaginatedRecords](globalVPNs) +} + +// InfraGetBYOKCluster is the resolver for the infra_getBYOKCluster field. +func (r *queryResolver) InfraGetBYOKCluster(ctx context.Context, name string) (*entities.BYOKCluster, error) { + ictx, err := toInfraContext(ctx) + if err != nil { + return nil, errors.NewE(err) + } + + return r.Domain.GetBYOKCluster(ictx, name) +} + // InfraListGlobalVPNs is the resolver for the infra_listGlobalVPNs field. func (r *queryResolver) InfraListGlobalVPNs(ctx context.Context, search *model.SearchGlobalVPNs, pagination *repos.CursorPagination) (*model.GlobalVPNPaginatedRecords, error) { ictx, err := toInfraContext(ctx) @@ -683,7 +742,7 @@ func (r *queryResolver) InfraCheckAwsAccess(ctx context.Context, cloudproviderNa } // InfraListClusterManagedServices is the resolver for the infra_listClusterManagedServices field. -func (r *queryResolver) InfraListClusterManagedServices(ctx context.Context, clusterName string, search *model.SearchClusterManagedService, pagination *repos.CursorPagination) (*model.ClusterManagedServicePaginatedRecords, error) { +func (r *queryResolver) InfraListClusterManagedServices(ctx context.Context, search *model.SearchClusterManagedService, pagination *repos.CursorPagination) (*model.ClusterManagedServicePaginatedRecords, error) { ictx, err := toInfraContext(ctx) if err != nil { return nil, errors.NewE(err) @@ -705,7 +764,7 @@ func (r *queryResolver) InfraListClusterManagedServices(ctx context.Context, clu } } - pClusters, err := r.Domain.ListClusterManagedServices(ictx, clusterName, filter, *pagination) + pClusters, err := r.Domain.ListClusterManagedServices(ictx, filter, *pagination) if err != nil { return nil, errors.NewE(err) } @@ -733,13 +792,13 @@ func (r *queryResolver) InfraListClusterManagedServices(ctx context.Context, clu } // InfraGetClusterManagedService is the resolver for the infra_getClusterManagedService field. -func (r *queryResolver) InfraGetClusterManagedService(ctx context.Context, clusterName string, name string) (*entities.ClusterManagedService, error) { +func (r *queryResolver) InfraGetClusterManagedService(ctx context.Context, name string) (*entities.ClusterManagedService, error) { ictx, err := toInfraContext(ctx) if err != nil { return nil, errors.NewE(err) } - return r.Domain.GetClusterManagedService(ictx, clusterName, name) + return r.Domain.GetClusterManagedService(ictx, name) } // InfraListHelmReleases is the resolver for the infra_listHelmReleases field. diff --git a/apps/infra/internal/app/graph/struct-to-graphql/byokcluster.graphqls b/apps/infra/internal/app/graph/struct-to-graphql/byokcluster.graphqls index 60ec3511d..31160230b 100644 --- a/apps/infra/internal/app/graph/struct-to-graphql/byokcluster.graphqls +++ b/apps/infra/internal/app/graph/struct-to-graphql/byokcluster.graphqls @@ -1,20 +1,38 @@ type BYOKCluster @shareable { accountName: String! - ClusterSpec: Github__com___kloudlite___operator___apis___clusters___v1__ClusterSpec + clusterPublicEndpoint: String! + clusterSvcCIDR: String! + clusterToken: String! createdBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! creationTime: Date! displayName: String! + globalVPN: String! id: ID! lastUpdatedBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! markedForDeletion: Boolean + messageQueueTopicName: String! metadata: Metadata! @goField(name: "objectMeta") recordVersion: Int! syncStatus: Github__com___kloudlite___api___pkg___types__SyncStatus! updateTime: Date! } +type BYOKClusterEdge @shareable { + cursor: String! + node: BYOKCluster! +} + +type BYOKClusterPaginatedRecords @shareable { + edges: [BYOKClusterEdge!]! + pageInfo: PageInfo! + totalCount: Int! +} + input BYOKClusterIn { + clusterPublicEndpoint: String! + clusterToken: String! displayName: String! + messageQueueTopicName: String! metadata: MetadataIn! } diff --git a/apps/infra/internal/app/graph/struct-to-graphql/clustermanagedservice.graphqls b/apps/infra/internal/app/graph/struct-to-graphql/clustermanagedservice.graphqls index 080877e5f..101eb3f9a 100644 --- a/apps/infra/internal/app/graph/struct-to-graphql/clustermanagedservice.graphqls +++ b/apps/infra/internal/app/graph/struct-to-graphql/clustermanagedservice.graphqls @@ -30,6 +30,7 @@ type ClusterManagedServicePaginatedRecords @shareable { input ClusterManagedServiceIn { apiVersion: String + clusterName: String! displayName: String! kind: String metadata: MetadataIn diff --git a/apps/infra/internal/app/graph/struct-to-graphql/common-types.graphqls b/apps/infra/internal/app/graph/struct-to-graphql/common-types.graphqls index bae2e87a2..19cc5b35d 100644 --- a/apps/infra/internal/app/graph/struct-to-graphql/common-types.graphqls +++ b/apps/infra/internal/app/graph/struct-to-graphql/common-types.graphqls @@ -304,7 +304,7 @@ type Github__com___kloudlite___operator___apis___crds___v1__ManagedServiceSpec @ type Github__com___kloudlite___operator___apis___crds___v1__ServiceTemplate @shareable { apiVersion: String! kind: String! - spec: Map! + spec: Map } type Github__com___kloudlite___operator___pkg___operator__Check @shareable { @@ -321,6 +321,7 @@ type Github__com___kloudlite___operator___pkg___operator__Check @shareable { type Github__com___kloudlite___operator___pkg___operator__CheckMeta @shareable { debug: Boolean description: String + hide: Boolean name: String! title: String! } @@ -915,7 +916,7 @@ input Github__com___kloudlite___operator___apis___crds___v1__ManagedServiceSpecI input Github__com___kloudlite___operator___apis___crds___v1__ServiceTemplateIn { apiVersion: String! kind: String! - spec: Map! + spec: Map } input K8s__io___api___core___v1__AWSElasticBlockStoreVolumeSourceIn { diff --git a/apps/infra/internal/app/process-resource-updates.go b/apps/infra/internal/app/process-resource-updates.go index 5516c0272..0a4f05308 100644 --- a/apps/infra/internal/app/process-resource-updates.go +++ b/apps/infra/internal/app/process-resource-updates.go @@ -45,6 +45,7 @@ var ( namespaceGVK = fn.GVK("v1", "Namespace") clusterMsvcGVK = fn.GVK("crds.kloudlite.io/v1", "ClusterManagedService") ingressGVK = fn.GVK("networking.k8s.io/v1", "Ingress") + secretGVK = fn.GVK("v1", "Secret") ) func processResourceUpdates(consumer ReceiveResourceUpdatesConsumer, d domain.Domain, logger logging.Logger) { @@ -242,6 +243,24 @@ func processResourceUpdates(consumer ReceiveResourceUpdatesConsumer, d domain.Do } return d.OnIngressUpdateMessage(dctx, su.ClusterName, ingress, resStatus, domain.UpdateAndDeleteOpts{MessageTimestamp: msg.Timestamp}) } + + case secretGVK.String(): + { + var secret corev1.Secret + if err := fn.JsonConversion(su.Object, &secret); err != nil { + return errors.NewE(err) + } + + if secret.Name != "byok-kubeconfig" { + return nil + } + + if resStatus == types.ResourceStatusDeleted { + // FIXME: not implemented for now + return nil + } + return d.UpsertBYOKClusterKubeconfig(dctx, su.ClusterName, secret.Data["kubeconfig"]) + } default: { mLogger.Infof("infra status updates consumer does not acknowledge the gvk %s", gvk(&obj)) diff --git a/apps/infra/internal/domain/api.go b/apps/infra/internal/domain/api.go index 56a5a0666..24614d983 100644 --- a/apps/infra/internal/domain/api.go +++ b/apps/infra/internal/domain/api.go @@ -41,6 +41,7 @@ const ( ResourceTypeClusterManagedService ResourceType = "cluster_managed_service" ResourceTypeCluster ResourceType = "cluster" ResourceTypeClusterGroup ResourceType = "cluster_group" + ResourceTypeBYOKCluster ResourceType = "byok_cluster" ResourceTypeDomainEntries ResourceType = "domain_entries" ResourceTypeHelmRelease ResourceType = "helm_release" ResourceTypeNodePool ResourceType = "nodepool" @@ -73,6 +74,11 @@ type Domain interface { DeleteCluster(ctx InfraContext, name string) error CreateBYOKCluster(ctx InfraContext, cluster entities.BYOKCluster) (*entities.BYOKCluster, error) + UpdateBYOKCluster(ctx InfraContext, clusterName string, displayName string) (*entities.BYOKCluster, error) + ListBYOKCluster(ctx InfraContext, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.BYOKCluster], error) + GetBYOKCluster(ctx InfraContext, name string) (*entities.BYOKCluster, error) + DeleteBYOKCluster(ctx InfraContext, name string) error + UpsertBYOKClusterKubeconfig(ctx InfraContext, clusterName string, kubeconfig []byte) error UpgradeHelmKloudliteAgent(ctx InfraContext, clusterName string) error @@ -123,11 +129,11 @@ type Domain interface { OnNodeUpdateMessage(ctx InfraContext, clusterName string, node entities.Node) error OnNodeDeleteMessage(ctx InfraContext, clusterName string, node entities.Node) error - ListClusterManagedServices(ctx InfraContext, clusterName string, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.ClusterManagedService], error) - GetClusterManagedService(ctx InfraContext, clusterName string, serviceName string) (*entities.ClusterManagedService, error) - CreateClusterManagedService(ctx InfraContext, clusterName string, service entities.ClusterManagedService) (*entities.ClusterManagedService, error) - UpdateClusterManagedService(ctx InfraContext, clusterName string, service entities.ClusterManagedService) (*entities.ClusterManagedService, error) - DeleteClusterManagedService(ctx InfraContext, clusterName string, name string) error + ListClusterManagedServices(ctx InfraContext, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.ClusterManagedService], error) + GetClusterManagedService(ctx InfraContext, serviceName string) (*entities.ClusterManagedService, error) + CreateClusterManagedService(ctx InfraContext, cmsvc entities.ClusterManagedService) (*entities.ClusterManagedService, error) + UpdateClusterManagedService(ctx InfraContext, cmsvc entities.ClusterManagedService) (*entities.ClusterManagedService, error) + DeleteClusterManagedService(ctx InfraContext, name string) error OnClusterManagedServiceApplyError(ctx InfraContext, clusterName, name, errMsg string, opts UpdateAndDeleteOpts) error OnClusterManagedServiceDeleteMessage(ctx InfraContext, clusterName string, service entities.ClusterManagedService) error diff --git a/apps/infra/internal/domain/byoc-clusters.go b/apps/infra/internal/domain/byoc-clusters.go deleted file mode 100644 index a9a4433f6..000000000 --- a/apps/infra/internal/domain/byoc-clusters.go +++ /dev/null @@ -1,61 +0,0 @@ -package domain - -import ( - iamT "github.com/kloudlite/api/apps/iam/types" - "github.com/kloudlite/api/apps/infra/internal/entities" - "github.com/kloudlite/api/common" - "github.com/kloudlite/api/common/fields" - "github.com/kloudlite/api/pkg/errors" - "github.com/kloudlite/api/pkg/repos" - t "github.com/kloudlite/api/pkg/types" -) - -func (d *domain) CreateBYOKCluster(ctx InfraContext, cluster entities.BYOKCluster) (*entities.BYOKCluster, error) { - if err := d.canPerformActionInAccount(ctx, iamT.CreateCluster); err != nil { - return nil, errors.NewE(err) - } - - accNs, err := d.getAccNamespace(ctx) - if err != nil { - return nil, errors.NewE(err) - } - - cluster.Namespace = accNs - - existing, err := d.clusterRepo.FindOne(ctx, repos.Filter{ - fields.MetadataName: cluster.Name, - fields.MetadataNamespace: cluster.Namespace, - fields.AccountName: ctx.AccountName, - }) - if err != nil { - return nil, errors.NewE(err) - } - - if existing != nil { - return nil, ErrClusterAlreadyExists{ClusterName: cluster.Name, AccountName: ctx.AccountName} - } - - cluster.AccountName = ctx.AccountName - - cluster.IncrementRecordVersion() - cluster.CreatedBy = common.CreatedOrUpdatedBy{ - UserId: ctx.UserId, - UserName: ctx.UserName, - UserEmail: ctx.UserEmail, - } - cluster.LastUpdatedBy = cluster.CreatedBy - - cluster.SyncStatus = t.GenSyncStatus(t.SyncActionApply, 0) - - nCluster, err := d.byokClusterRepo.Create(ctx, &cluster) - if err != nil { - if d.clusterRepo.ErrAlreadyExists(err) { - return nil, errors.Newf("cluster with name %q already exists in namespace %q", cluster.Name, cluster.Namespace) - } - return nil, errors.NewE(err) - } - - d.resourceEventPublisher.PublishInfraEvent(ctx, ResourceTypeCluster, nCluster.Name, PublishAdd) - - return nCluster, nil -} diff --git a/apps/infra/internal/domain/byok-clusters.go b/apps/infra/internal/domain/byok-clusters.go new file mode 100644 index 000000000..79ca5dbe9 --- /dev/null +++ b/apps/infra/internal/domain/byok-clusters.go @@ -0,0 +1,239 @@ +package domain + +import ( + "encoding/base64" + + iamT "github.com/kloudlite/api/apps/iam/types" + "github.com/kloudlite/api/apps/infra/internal/entities" + fc "github.com/kloudlite/api/apps/infra/internal/entities/field-constants" + "github.com/kloudlite/api/common" + "github.com/kloudlite/api/common/fields" + "github.com/kloudlite/api/pkg/errors" + fn "github.com/kloudlite/api/pkg/functions" + "github.com/kloudlite/api/pkg/repos" + t "github.com/kloudlite/api/pkg/types" +) + +func (d *domain) clusterAlreadyExists(ctx InfraContext, name string) (*bool, error) { + exists, err := d.clusterRepo.FindOne(ctx, repos.Filter{ + fc.AccountName: ctx.AccountName, + fc.MetadataName: name, + }) + if err != nil { + return nil, err + } + if exists != nil { + return fn.New(true), nil + } + + existsBYOK, err := d.byokClusterRepo.FindOne(ctx, repos.Filter{ + fc.AccountName: ctx.AccountName, + fc.MetadataName: name, + }) + if err != nil { + return nil, err + } + + if existsBYOK != nil { + return fn.New(true), nil + } + + return fn.New(false), nil +} + +func (d *domain) CreateBYOKCluster(ctx InfraContext, cluster entities.BYOKCluster) (*entities.BYOKCluster, error) { + if err := d.canPerformActionInAccount(ctx, iamT.CreateCluster); err != nil { + return nil, errors.NewE(err) + } + + exists, err := d.clusterAlreadyExists(ctx, cluster.Name) + if err != nil { + return nil, errors.NewE(err) + } + + if exists != nil && *exists { + return nil, errors.Newf("cluster/byok cluster with name (%s) already exists", cluster.Name) + } + + accNs, err := d.getAccNamespace(ctx) + if err != nil { + return nil, errors.NewE(err) + } + + cluster.Namespace = accNs + + if cluster.GlobalVPN == "" { + cluster.GlobalVPN = DefaultGlobalVPNName + } + + ctoken, err := d.generateClusterToken(ctx, cluster.Name) + if err != nil { + return nil, errors.NewE(err) + } + + cluster.ClusterToken = ctoken + + cluster.MessageQueueTopicName = common.GetTenantClusterMessagingTopic(ctx.AccountName, cluster.Name) + + gvpn, err := d.ensureGlobalVPN(ctx, cluster.GlobalVPN) + if err != nil { + return nil, errors.NewE(err) + } + + clusterSvcCIDR, err := d.claimNextClusterSvcCIDR(ctx, cluster.Name, gvpn.Name) + if err != nil { + return nil, err + } + + if _, err := d.ensureGlobalVPNConnection(ctx, cluster.Name, clusterSvcCIDR, cluster.GlobalVPN, cluster.ClusterPublicEndpoint); err != nil { + return nil, errors.NewE(err) + } + + cluster.ClusterSvcCIDR = clusterSvcCIDR + + existing, err := d.clusterRepo.FindOne(ctx, repos.Filter{ + fields.MetadataName: cluster.Name, + fields.MetadataNamespace: cluster.Namespace, + fields.AccountName: ctx.AccountName, + }) + if err != nil { + return nil, errors.NewE(err) + } + + if existing != nil { + return nil, ErrClusterAlreadyExists{ClusterName: cluster.Name, AccountName: ctx.AccountName} + } + + cluster.AccountName = ctx.AccountName + + cluster.IncrementRecordVersion() + cluster.CreatedBy = common.CreatedOrUpdatedBy{ + UserId: ctx.UserId, + UserName: ctx.UserName, + UserEmail: ctx.UserEmail, + } + cluster.LastUpdatedBy = cluster.CreatedBy + + cluster.SyncStatus = t.GenSyncStatus(t.SyncActionApply, 0) + + nCluster, err := d.byokClusterRepo.Create(ctx, &cluster) + if err != nil { + if d.clusterRepo.ErrAlreadyExists(err) { + return nil, errors.NewEf(err, "cluster with name %q already exists in namespace %q", cluster.Name, cluster.Namespace) + } + return nil, errors.NewE(err) + } + + d.resourceEventPublisher.PublishInfraEvent(ctx, ResourceTypeCluster, nCluster.Name, PublishAdd) + + return nCluster, nil +} + +func (d *domain) UpdateBYOKCluster(ctx InfraContext, clusterName string, displayName string) (*entities.BYOKCluster, error) { + if err := d.canPerformActionInAccount(ctx, iamT.UpdateCluster); err != nil { + return nil, errors.NewE(err) + } + + updated, err := d.byokClusterRepo.PatchOne(ctx, entities.UniqueBYOKClusterFilter(ctx.AccountName, clusterName), repos.Document{ + fc.DisplayName: displayName, + }) + if err != nil { + return nil, err + } + + return updated, nil +} + +func (d *domain) ListBYOKCluster(ctx InfraContext, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.BYOKCluster], error) { + if err := d.canPerformActionInAccount(ctx, iamT.ListClusters); err != nil { + return nil, errors.NewE(err) + } + + pRecords, err := d.byokClusterRepo.FindPaginated(ctx, d.byokClusterRepo.MergeMatchFilters(entities.ListBYOKClusterFilter(ctx.AccountName), search), pagination) + if err != nil { + return nil, errors.NewE(err) + } + + return pRecords, nil +} + +func (d *domain) GetBYOKCluster(ctx InfraContext, name string) (*entities.BYOKCluster, error) { + if err := d.canPerformActionInAccount(ctx, iamT.GetCluster); err != nil { + return nil, errors.NewE(err) + } + + c, err := d.findBYOKCluster(ctx, name) + if err != nil { + return nil, errors.NewE(err) + } + + return c, nil +} + +func (d *domain) DeleteBYOKCluster(ctx InfraContext, name string) error { + if err := d.canPerformActionInAccount(ctx, iamT.DeleteCluster); err != nil { + return errors.NewE(err) + } + + cluster, err := d.findBYOKCluster(ctx, name) + if err != nil { + return errors.NewE(err) + } + + if err := d.byokClusterRepo.DeleteOne(ctx, entities.UniqueBYOKClusterFilter(ctx.AccountName, name)); err != nil { + return errors.NewE(err) + } + + if cluster.GlobalVPN != "" { + if err := d.deleteGlobalVPNConnection(ctx, cluster.Name, cluster.GlobalVPN); err != nil { + return errors.NewE(err) + } + if err := d.claimClusterSvcCIDRRepo.DeleteOne(ctx, repos.Filter{ + fc.ClaimClusterSvcCIDRClaimedByCluster: cluster.Name, + fc.AccountName: ctx.AccountName, + fc.ClaimClusterSvcCIDRGlobalVPNName: cluster.GlobalVPN, + }); err != nil { + return errors.NewE(err) + } + + if _, err := d.freeClusterSvcCIDRRepo.Create(ctx, &entities.FreeClusterSvcCIDR{ + AccountName: ctx.AccountName, + GlobalVPNName: cluster.GlobalVPN, + ClusterSvcCIDR: cluster.ClusterSvcCIDR, + }); err != nil { + return errors.NewE(err) + } + } + + return nil +} + +func (d *domain) findBYOKCluster(ctx InfraContext, clusterName string) (*entities.BYOKCluster, error) { + cluster, err := d.byokClusterRepo.FindOne(ctx, entities.UniqueBYOKClusterFilter(ctx.AccountName, clusterName)) + if err != nil { + return nil, errors.NewE(err) + } + + if cluster == nil { + return nil, ErrClusterNotFound + } + return cluster, nil +} + +func (d *domain) UpsertBYOKClusterKubeconfig(ctx InfraContext, clusterName string, kubeconfig []byte) error { + byokCluster, err := d.findBYOKCluster(ctx, clusterName) + if err != nil { + return err + } + + if _, err := d.byokClusterRepo.PatchById(ctx, byokCluster.Id, repos.Document{ + fc.BYOKClusterKubeconfig: t.EncodedString{ + Value: base64.StdEncoding.EncodeToString(kubeconfig), + Encoding: "base64", + }, + }); err != nil { + return err + } + + return nil +} diff --git a/apps/infra/internal/domain/cluster-managed-service.go b/apps/infra/internal/domain/cluster-managed-service.go index 555ee5fac..05c017f2d 100644 --- a/apps/infra/internal/domain/cluster-managed-service.go +++ b/apps/infra/internal/domain/cluster-managed-service.go @@ -12,17 +12,16 @@ import ( "github.com/kloudlite/operator/operators/resource-watcher/types" ) -func (d *domain) ListClusterManagedServices(ctx InfraContext, clusterName string, mf map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.ClusterManagedService], error) { +func (d *domain) ListClusterManagedServices(ctx InfraContext, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.ClusterManagedService], error) { if err := d.canPerformActionInAccount(ctx, iamT.ListClusterManagedServices); err != nil { return nil, errors.NewE(err) } f := repos.Filter{ - fields.ClusterName: clusterName, fields.AccountName: ctx.AccountName, } - pr, err := d.clusterManagedServiceRepo.FindPaginated(ctx, d.secretRepo.MergeMatchFilters(f, mf), pagination) + pr, err := d.clusterManagedServiceRepo.FindPaginated(ctx, d.secretRepo.MergeMatchFilters(f, search), pagination) if err != nil { return nil, errors.NewE(err) } @@ -30,28 +29,27 @@ func (d *domain) ListClusterManagedServices(ctx InfraContext, clusterName string return pr, nil } -func (d *domain) findClusterManagedService(ctx InfraContext, clusterName string, svcName string) (*entities.ClusterManagedService, error) { +func (d *domain) findClusterManagedService(ctx InfraContext, name string) (*entities.ClusterManagedService, error) { cmsvc, err := d.clusterManagedServiceRepo.FindOne(ctx, repos.Filter{ - fields.ClusterName: clusterName, fields.AccountName: ctx.AccountName, - fields.MetadataName: svcName, + fields.MetadataName: name, }) if err != nil { return nil, errors.NewE(err) } if cmsvc == nil { - return nil, errors.Newf("cmsvc with name %q not found", clusterName) + return nil, errors.Newf("cmsvc with name %q not found", name) } return cmsvc, nil } -func (d *domain) GetClusterManagedService(ctx InfraContext, clusterName string, serviceName string) (*entities.ClusterManagedService, error) { +func (d *domain) GetClusterManagedService(ctx InfraContext, serviceName string) (*entities.ClusterManagedService, error) { if err := d.canPerformActionInAccount(ctx, iamT.GetClusterManagedService); err != nil { return nil, errors.NewE(err) } - c, err := d.findClusterManagedService(ctx, clusterName, serviceName) + c, err := d.findClusterManagedService(ctx, serviceName) if err != nil { return nil, errors.NewE(err) } @@ -64,91 +62,81 @@ func (d *domain) applyClusterManagedService(ctx InfraContext, cmsvc *entities.Cl return d.resDispatcher.ApplyToTargetCluster(ctx, cmsvc.ClusterName, &cmsvc.ClusterManagedService, cmsvc.RecordVersion) } -func (d *domain) CreateClusterManagedService(ctx InfraContext, clusterName string, service entities.ClusterManagedService) (*entities.ClusterManagedService, error) { +func (d *domain) CreateClusterManagedService(ctx InfraContext, cmsvc entities.ClusterManagedService) (*entities.ClusterManagedService, error) { if err := d.canPerformActionInAccount(ctx, iamT.CreateClusterManagedService); err != nil { return nil, errors.NewE(err) } - service.IncrementRecordVersion() + cmsvc.IncrementRecordVersion() - service.CreatedBy = common.CreatedOrUpdatedBy{ + cmsvc.CreatedBy = common.CreatedOrUpdatedBy{ UserId: ctx.UserId, UserName: ctx.UserName, UserEmail: ctx.UserEmail, } - service.LastUpdatedBy = service.CreatedBy + cmsvc.LastUpdatedBy = cmsvc.CreatedBy existing, err := d.clusterManagedServiceRepo.FindOne(ctx, repos.Filter{ - fields.ClusterName: clusterName, fields.AccountName: ctx.AccountName, - fields.MetadataName: service.Name, + fields.MetadataName: cmsvc.Name, }) if err != nil { return nil, errors.NewE(err) } if existing != nil { - return nil, errors.Newf("cluster managed service with name %q already exists", clusterName) + return nil, errors.Newf("cluster managed service with name %q already exists", cmsvc.ClusterName) } - service.AccountName = ctx.AccountName - service.ClusterName = clusterName - service.SyncStatus = t.GenSyncStatus(t.SyncActionApply, service.RecordVersion) + cmsvc.AccountName = ctx.AccountName + cmsvc.SyncStatus = t.GenSyncStatus(t.SyncActionApply, cmsvc.RecordVersion) - service.EnsureGVK() + cmsvc.EnsureGVK() - if err := d.k8sClient.ValidateObject(ctx, &service.ClusterManagedService); err != nil { + if err := d.k8sClient.ValidateObject(ctx, &cmsvc.ClusterManagedService); err != nil { return nil, errors.NewE(err) } - ncms, err := d.clusterManagedServiceRepo.Create(ctx, &service) + ncms, err := d.clusterManagedServiceRepo.Create(ctx, &cmsvc) if err != nil { return nil, errors.NewE(err) } - if err := d.applyClusterManagedService(ctx, &service); err != nil { + if err := d.applyClusterManagedService(ctx, &cmsvc); err != nil { return nil, errors.NewE(err) } - d.resourceEventPublisher.PublishResourceEvent(ctx, clusterName, ResourceTypeClusterManagedService, ncms.Name, PublishAdd) + d.resourceEventPublisher.PublishResourceEvent(ctx, cmsvc.ClusterName, ResourceTypeClusterManagedService, ncms.Name, PublishAdd) return ncms, nil } -func (d *domain) UpdateClusterManagedService(ctx InfraContext, clusterName string, serviceIn entities.ClusterManagedService) (*entities.ClusterManagedService, error) { +func (d *domain) UpdateClusterManagedService(ctx InfraContext, cmsvc entities.ClusterManagedService) (*entities.ClusterManagedService, error) { if err := d.canPerformActionInAccount(ctx, iamT.UpdateClusterManagedService); err != nil { return nil, errors.NewE(err) } - serviceIn.EnsureGVK() - if err := d.k8sClient.ValidateObject(ctx, &serviceIn.ClusterManagedService); err != nil { + cmsvc.EnsureGVK() + if err := d.k8sClient.ValidateObject(ctx, &cmsvc.ClusterManagedService); err != nil { return nil, errors.NewE(err) } patchForUpdate := common.PatchForUpdate( ctx, - &serviceIn, + &cmsvc, common.PatchOpts{ XPatch: repos.Document{ - fc.ClusterManagedServiceSpecMsvcSpec: serviceIn.Spec, + fc.ClusterManagedServiceSpecMsvcSpec: cmsvc.Spec, }, }) - ucmsvc, err := d.clusterManagedServiceRepo.Patch( - ctx, - repos.Filter{ - fields.ClusterName: clusterName, - fields.AccountName: ctx.AccountName, - fields.MetadataName: serviceIn.Name, - }, - patchForUpdate, - ) + ucmsvc, err := d.clusterManagedServiceRepo.Patch(ctx, repos.Filter{fields.AccountName: ctx.AccountName, fields.MetadataName: cmsvc.Name}, patchForUpdate) if err != nil { return nil, errors.NewE(err) } - d.resourceEventPublisher.PublishResourceEvent(ctx, clusterName, ResourceTypeClusterManagedService, ucmsvc.Name, PublishUpdate) + d.resourceEventPublisher.PublishResourceEvent(ctx, ucmsvc.ClusterName, ResourceTypeClusterManagedService, ucmsvc.Name, PublishUpdate) if err := d.applyClusterManagedService(ctx, ucmsvc); err != nil { return nil, errors.NewE(err) @@ -157,27 +145,19 @@ func (d *domain) UpdateClusterManagedService(ctx InfraContext, clusterName strin return ucmsvc, nil } -func (d *domain) DeleteClusterManagedService(ctx InfraContext, clusterName string, name string) error { +func (d *domain) DeleteClusterManagedService(ctx InfraContext, name string) error { if err := d.canPerformActionInAccount(ctx, iamT.DeleteClusterManagedService); err != nil { return errors.NewE(err) } - ucmsvc, err := d.clusterManagedServiceRepo.Patch( - ctx, - repos.Filter{ - fields.ClusterName: clusterName, - fields.AccountName: ctx.AccountName, - fields.MetadataName: name, - }, - common.PatchForMarkDeletion(), - ) + ucmsvc, err := d.clusterManagedServiceRepo.Patch(ctx, repos.Filter{fields.AccountName: ctx.AccountName, fields.MetadataName: name}, common.PatchForMarkDeletion()) if err != nil { return errors.NewE(err) } - d.resourceEventPublisher.PublishResourceEvent(ctx, clusterName, ResourceTypeClusterManagedService, ucmsvc.Name, PublishUpdate) + d.resourceEventPublisher.PublishResourceEvent(ctx, ucmsvc.ClusterName, ResourceTypeClusterManagedService, ucmsvc.Name, PublishUpdate) - return d.resDispatcher.DeleteFromTargetCluster(ctx, clusterName, &ucmsvc.ClusterManagedService) + return d.resDispatcher.DeleteFromTargetCluster(ctx, ucmsvc.ClusterName, &ucmsvc.ClusterManagedService) } func (d *domain) OnClusterManagedServiceApplyError(ctx InfraContext, clusterName, name, errMsg string, opts UpdateAndDeleteOpts) error { @@ -220,7 +200,7 @@ func (d *domain) OnClusterManagedServiceDeleteMessage(ctx InfraContext, clusterN } func (d *domain) OnClusterManagedServiceUpdateMessage(ctx InfraContext, clusterName string, service entities.ClusterManagedService, status types.ResourceStatus, opts UpdateAndDeleteOpts) error { - xService, err := d.findClusterManagedService(ctx, clusterName, service.Name) + xService, err := d.findClusterManagedService(ctx, service.Name) if err != nil { return errors.NewE(err) } diff --git a/apps/infra/internal/domain/clusters.go b/apps/infra/internal/domain/clusters.go index 08982c53e..95f6f4c0d 100644 --- a/apps/infra/internal/domain/clusters.go +++ b/apps/infra/internal/domain/clusters.go @@ -47,6 +47,18 @@ const ( DefaultGlobalVPNName = "default" ) +func (d *domain) generateClusterToken(ctx InfraContext, clusterName string) (string, error) { + tout, err := d.messageOfficeInternalClient.GenerateClusterToken(ctx, &message_office_internal.GenerateClusterTokenIn{ + AccountName: ctx.AccountName, + ClusterName: clusterName, + }) + if err != nil { + return "", errors.NewE(err) + } + + return tout.ClusterToken, nil +} + func (d *domain) createTokenSecret(ctx InfraContext, clusterName string, clusterNamespace string) (*corev1.Secret, error) { secret := &corev1.Secret{ TypeMeta: metav1.TypeMeta{ @@ -59,16 +71,13 @@ func (d *domain) createTokenSecret(ctx InfraContext, clusterName string, cluster }, } - tout, err := d.messageOfficeInternalClient.GenerateClusterToken(ctx, &message_office_internal.GenerateClusterTokenIn{ - AccountName: ctx.AccountName, - ClusterName: clusterName, - }) + clusterToken, err := d.generateClusterToken(ctx, clusterName) if err != nil { return nil, errors.NewE(err) } secret.Data = map[string][]byte{ - keyClusterToken: []byte(tout.ClusterToken), + keyClusterToken: []byte(clusterToken), } return secret, nil @@ -113,6 +122,15 @@ func (d *domain) CreateCluster(ctx InfraContext, cluster entities.Cluster) (*ent return nil, errors.NewE(err) } + exists, err := d.clusterAlreadyExists(ctx, cluster.Name) + if err != nil { + return nil, errors.NewE(err) + } + + if exists != nil && *exists { + return nil, errors.Newf("cluster/byok cluster with name (%s) already exists", cluster.Name) + } + accNs, err := d.getAccNamespace(ctx) if err != nil { return nil, errors.NewE(err) @@ -325,7 +343,7 @@ func (d *domain) CreateCluster(ctx InfraContext, cluster entities.Cluster) (*ent return nil, err } - if _, err := d.ensureGlobalVPNConnection(ctx, cluster.Name, clusterSvcCIDR, *cluster.GlobalVPN); err != nil { + if _, err := d.ensureGlobalVPNConnection(ctx, cluster.Name, clusterSvcCIDR, *cluster.GlobalVPN, cluster.Spec.PublicDNSHost); err != nil { return nil, errors.NewE(err) } @@ -588,6 +606,26 @@ func (d *domain) DeleteCluster(ctx InfraContext, name string) error { if err := d.deleteK8sResource(ctx, &ucluster.Cluster); err != nil { return errors.NewE(err) } + + if ucluster.GlobalVPN != nil { + + if err := d.claimClusterSvcCIDRRepo.DeleteOne(ctx, repos.Filter{ + fc.ClaimClusterSvcCIDRClaimedByCluster: ucluster.Name, + fc.AccountName: ctx.AccountName, + fc.ClaimClusterSvcCIDRGlobalVPNName: ucluster.GlobalVPN, + }); err != nil { + return errors.NewE(err) + } + + if _, err := d.freeClusterSvcCIDRRepo.Create(ctx, &entities.FreeClusterSvcCIDR{ + AccountName: ctx.AccountName, + GlobalVPNName: *ucluster.GlobalVPN, + ClusterSvcCIDR: ucluster.Spec.ClusterServiceCIDR, + }); err != nil { + return errors.NewE(err) + } + } + return nil } @@ -665,3 +703,10 @@ func (d *domain) findCluster(ctx InfraContext, clusterName string) (*entities.Cl } return cluster, nil } + +// func (d *domain) ensureClusterKubeProxy(ctx InfraContext, clusterName string) error { +// accNs, err := d.getAccNamespace(ctx) +// if err != nil { +// return err +// } +// } diff --git a/apps/infra/internal/domain/global-vpn-cluster-connection.go b/apps/infra/internal/domain/global-vpn-cluster-connection.go index 1ac327c56..b4089a958 100644 --- a/apps/infra/internal/domain/global-vpn-cluster-connection.go +++ b/apps/infra/internal/domain/global-vpn-cluster-connection.go @@ -195,7 +195,27 @@ func (d *domain) createGlobalVPNConnection(ctx InfraContext, gvpnConn entities.G return gv, nil } -func (d *domain) ensureGlobalVPNConnection(ctx InfraContext, clusterName string, clusterSvcCIDR string, groupName string) (*entities.GlobalVPNConnection, error) { +func (d *domain) deleteGlobalVPNConnection(ctx InfraContext, clusterName string, gvpnName string) error { + gvpnConn, err := d.gvpnConnRepo.FindOne(ctx, repos.Filter{ + fields.AccountName: ctx.AccountName, + fields.ClusterName: clusterName, + fields.MetadataName: gvpnName, + }) + if err != nil { + return errors.NewE(err) + } + if gvpnConn == nil { + return errors.Newf("no global vpn connection with name (%s) not found, for cluster (%s)", gvpnName, clusterName) + } + + if err := d.deleteGlobalVPNDevice(ctx, gvpnName, fmt.Sprintf("%s-cluster-gateway", gvpnConn.ClusterName)); err != nil { + return errors.NewE(err) + } + + return nil +} + +func (d *domain) ensureGlobalVPNConnection(ctx InfraContext, clusterName string, clusterSvcCIDR string, groupName string, clusterPublicEndpoint string) (*entities.GlobalVPNConnection, error) { gvpn, err := d.gvpnConnRepo.FindOne(ctx, repos.Filter{ fields.AccountName: ctx.AccountName, fields.ClusterName: clusterName, @@ -233,7 +253,7 @@ func (d *domain) ensureGlobalVPNConnection(ctx InfraContext, clusterName string, ResourceMetadata: common.ResourceMetadata{DisplayName: groupName, CreatedBy: common.CreatedOrUpdatedByKloudlite, LastUpdatedBy: common.CreatedOrUpdatedByKloudlite}, AccountName: ctx.AccountName, ClusterName: clusterName, - ClusterPublicEndpoint: fmt.Sprintf("%s.%s.tenants.%s", clusterName, ctx.AccountName, d.env.PublicDNSHostSuffix), + ClusterPublicEndpoint: clusterPublicEndpoint, ClusterSvcCIDR: clusterSvcCIDR, ParsedWgParams: nil, }) @@ -273,11 +293,11 @@ func (d *domain) findGlobalVPNConnection(ctx InfraContext, clusterName string, g return cc, nil } -func (d *domain) OnGlobalVPNConnectionDeleteMessage(ctx InfraContext, clusterName string, gvpn entities.GlobalVPNConnection) error { +func (d *domain) OnGlobalVPNConnectionDeleteMessage(ctx InfraContext, clusterName string, gvpnConn entities.GlobalVPNConnection) error { currRecord, err := d.gvpnConnRepo.FindOne(ctx, repos.Filter{ fields.AccountName: ctx.AccountName, fields.ClusterName: clusterName, - fields.MetadataName: gvpn.Name, + fields.MetadataName: gvpnConn.Name, }) if err != nil { return err @@ -286,35 +306,16 @@ func (d *domain) OnGlobalVPNConnectionDeleteMessage(ctx InfraContext, clusterNam if err := d.gvpnConnRepo.DeleteOne(ctx, repos.Filter{ fields.AccountName: ctx.AccountName, fields.ClusterName: clusterName, - fields.MetadataName: gvpn.Name, + fields.MetadataName: gvpnConn.Name, }); err != nil { return errors.NewE(err) } - claimedDeviceIP, err := d.claimDeviceIPRepo.FindOne(ctx, repos.Filter{ - fields.AccountName: ctx.AccountName, - fc.ClaimDeviceIPGlobalVPNName: gvpn.GlobalVPNName, - fc.ClaimDeviceIPClaimedBy: "cluster-gateway", - }) - if err != nil { + if err := d.deleteGlobalVPNDevice(ctx, currRecord.GlobalVPNName, fmt.Sprintf("%s-cluster-gateway", currRecord.ClusterName)); err != nil { return errors.NewE(err) } - if claimedDeviceIP != nil { - if _, err := d.freeDeviceIpRepo.Create(ctx, &entities.FreeDeviceIP{ - AccountName: ctx.AccountName, - GlobalVPNName: gvpn.Name, - IPAddr: claimedDeviceIP.IPAddr, - }); err != nil { - return errors.NewE(err) - } - } - - if err := d.addToFreeDeviceIPPool(ctx, gvpn.Name, currRecord.GatewayIPAddr); err != nil { - return errors.NewE(err) - } - - d.resourceEventPublisher.PublishResourceEvent(ctx, clusterName, ResourceTypeClusterConnection, gvpn.Name, PublishDelete) + d.resourceEventPublisher.PublishResourceEvent(ctx, clusterName, ResourceTypeClusterConnection, gvpnConn.Name, PublishDelete) return err } @@ -324,10 +325,6 @@ func (d *domain) OnGlobalVPNConnectionUpdateMessage(ctx InfraContext, clusterNam return errors.NewE(err) } - if xconn == nil { - return errors.Newf("no global vpn found") - } - if _, err := d.matchRecordVersion(gvpn.Annotations, xconn.RecordVersion); err != nil { return d.resyncToTargetCluster(ctx, xconn.SyncStatus.Action, clusterName, &xconn.GlobalVPN, xconn.RecordVersion) } diff --git a/apps/infra/internal/domain/global-vpn-devices.go b/apps/infra/internal/domain/global-vpn-devices.go index 074b9636c..c7a97740c 100644 --- a/apps/infra/internal/domain/global-vpn-devices.go +++ b/apps/infra/internal/domain/global-vpn-devices.go @@ -74,29 +74,16 @@ func (d *domain) claimNextFreeDeviceIP(ctx InfraContext, deviceName string, gvpn } } -func (d *domain) addToFreeDeviceIPPool(ctx InfraContext, gvpnName string, ip string) error { - _, err := d.freeDeviceIpRepo.Create(ctx, &entities.FreeDeviceIP{ - AccountName: ctx.AccountName, - GlobalVPNName: gvpnName, - IPAddr: ip, - }) - return err -} - func (d *domain) UpdateGlobalVPNDevice(ctx InfraContext, device entities.GlobalVPNDevice) (*entities.GlobalVPNDevice, error) { panic("implement me") } -func (d *domain) DeleteGlobalVPNDevice(ctx InfraContext, gvpn string, deviceName string) error { +func (d *domain) deleteGlobalVPNDevice(ctx InfraContext, gvpn string, deviceName string) error { device, err := d.findGlobalVPNDevice(ctx, gvpn, deviceName) if err != nil { return err } - if err := d.addToFreeDeviceIPPool(ctx, gvpn, device.IPAddr); err != nil { - return err - } - if err := d.claimDeviceIPRepo.DeleteOne(ctx, repos.Filter{ fc.AccountName: ctx.AccountName, fc.GlobalVPNDeviceGlobalVPNName: gvpn, @@ -105,6 +92,14 @@ func (d *domain) DeleteGlobalVPNDevice(ctx InfraContext, gvpn string, deviceName return err } + if _, err := d.freeDeviceIpRepo.Create(ctx, &entities.FreeDeviceIP{ + AccountName: ctx.AccountName, + GlobalVPNName: gvpn, + IPAddr: device.IPAddr, + }); err != nil { + return err + } + if err := d.gvpnDevicesRepo.DeleteById(ctx, device.Id); err != nil { return err } @@ -116,6 +111,10 @@ func (d *domain) DeleteGlobalVPNDevice(ctx InfraContext, gvpn string, deviceName return nil } +func (d *domain) DeleteGlobalVPNDevice(ctx InfraContext, gvpn string, deviceName string) error { + return d.deleteGlobalVPNConnection(ctx, gvpn, deviceName) +} + func (d *domain) ListGlobalVPNDevice(ctx InfraContext, gvpn string, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.GlobalVPNDevice], error) { filter := d.gvpnDevicesRepo.MergeMatchFilters(repos.Filter{ fc.AccountName: ctx.AccountName, diff --git a/apps/infra/internal/domain/names.go b/apps/infra/internal/domain/names.go index d50f222a2..8c635ac96 100644 --- a/apps/infra/internal/domain/names.go +++ b/apps/infra/internal/domain/names.go @@ -2,6 +2,7 @@ package domain import ( "context" + "github.com/kloudlite/api/common/fields" "github.com/kloudlite/api/pkg/errors" fn "github.com/kloudlite/api/pkg/functions" @@ -16,6 +17,8 @@ type ResType string const ( ResTypeCluster ResType = "cluster" + ResTypeBYOKCluster ResType = "byok_cluster" + ResTypeGlobalVPNDevice ResType = "global_vpn_device" ResTypeClusterManagedService ResType = "cluster_managed_service" ResTypeProviderSecret ResType = "providersecret" ResTypeNodePool ResType = "nodepool" @@ -44,7 +47,6 @@ func checkResourceName[T repos.Entity](ctx context.Context, filters repos.Filter } func (d *domain) CheckNameAvailability(ctx InfraContext, typeArg ResType, clusterName *string, name string) (*CheckNameAvailabilityOutput, error) { - if !fn.IsValidK8sResourceName(name) { return &CheckNameAvailabilityOutput{Result: false, SuggestedNames: fn.GenValidK8sResourceNames(name, 3)}, nil } @@ -57,6 +59,13 @@ func (d *domain) CheckNameAvailability(ctx InfraContext, typeArg ResType, cluste fields.MetadataName: name, }, d.clusterRepo) } + case ResTypeBYOKCluster: + { + return checkResourceName(ctx, repos.Filter{ + fields.AccountName: ctx.AccountName, + fields.MetadataName: name, + }, d.byokClusterRepo) + } case ResTypeProviderSecret: { return checkResourceName(ctx, repos.Filter{ @@ -64,6 +73,13 @@ func (d *domain) CheckNameAvailability(ctx InfraContext, typeArg ResType, cluste fields.MetadataName: name, }, d.secretRepo) } + case ResTypeGlobalVPNDevice: + { + return checkResourceName(ctx, repos.Filter{ + fields.AccountName: ctx.AccountName, + fields.MetadataName: name, + }, d.gvpnDevicesRepo) + } case ResTypeNodePool: { if clusterName == nil || *clusterName == "" { @@ -89,7 +105,7 @@ func (d *domain) CheckNameAvailability(ctx InfraContext, typeArg ResType, cluste case ResTypeClusterManagedService: { if clusterName == nil || *clusterName == "" { - return nil, errors.Newf("clusterName is required for checking name availability for %s", ResTypeNodePool) + return nil, errors.Newf("clusterName is required for checking name availability for %s", ResTypeClusterManagedService) } return checkResourceName(ctx, repos.Filter{ fields.AccountName: ctx.AccountName, diff --git a/apps/infra/internal/domain/templates/cluster-kube-proxy.yml.tpl b/apps/infra/internal/domain/templates/cluster-kube-proxy.yml.tpl index e69de29bb..2af9492f8 100644 --- a/apps/infra/internal/domain/templates/cluster-kube-proxy.yml.tpl +++ b/apps/infra/internal/domain/templates/cluster-kube-proxy.yml.tpl @@ -0,0 +1,118 @@ +{{- /*gotype: github.com/kloudlite/api/apps/infra/internal/domain/templates.ClusterKubeProxyVars*/ -}} +{{ with . }} +--- +apiVersion: v1 +kind: Namespace +metadata: + name: {{.Namespace | squote}} +--- +apiVersion: v1 +kind: Secret +metadata: + name: kloudlite-gvpn-device-config + namespace: {{.Namespace | squote}} +data: + wg0.conf: {{.KloudliteDeviceWgConfig | b64enc }} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: kube-access-globalvpn + namespace: {{.Namespace | squote}} +spec: + replicas: 1 + selector: + matchLabels: + app: app + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 25% + type: RollingUpdate + template: + metadata: + labels: + app: app + spec: + initContainers: + - name: init + image: busybox:1.32.0 + command: + - sh + - -c + - sysctl -w net.ipv4.ip_forward=1 && sysctl -w net.ipv4.conf.all.forwarding=1 + securityContext: + privileged: true + capabilities: + add: + - NET_ADMIN + - SYS_MODULE + containers: + - image: linuxserver/wireguard + imagePullPolicy: Always + name: wg + resources: + limits: + cpu: 80m + memory: 100Mi + requests: + cpu: 50m + memory: 75Mi + securityContext: + capabilities: + add: + - NET_ADMIN + privileged: true + volumeMounts: + - mountPath: /config/wg_confs/wg0.conf + name: kloudlite-gvpn-device-config + subPath: wg0.conf + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + - image: ghcr.io/kloudlite/hub/socat:latest + command: + - sh + - -c + - |+ + (socat -dd tcp4-listen:8080,fork,reuseaddr tcp4:kubectl-proxy.{{.Namespace}}.svc.example-test.local:8080 2>&1 | grep -iE --line-buffered 'listening|exiting') & + pid=$! + + trap "kill -9 $pid" EXIT SIGINT SIGTERM + wait $pid + imagePullPolicy: Always + name: app + resources: + limits: + cpu: 100m + memory: 100Mi + requests: + cpu: 100m + memory: 100Mi + + dnsPolicy: ClusterFirst + + volumes: + - name: wg-config + secret: + defaultMode: 420 + items: + - key: wg0.conf + path: wg0.conf + secretName: wg-config + +--- +apiVersion: v1 +kind: Service +metadata: + name: kube-access + namespace: test-kube-access-globalvpn +spec: + selector: + app: app + ports: + - name: p-8080 + port: 8080 + targetPort: 8080 + protocol: TCP +--- +{{ end }} diff --git a/apps/infra/internal/entities/byok_cluster.go b/apps/infra/internal/entities/byok-cluster.go similarity index 59% rename from apps/infra/internal/entities/byok_cluster.go rename to apps/infra/internal/entities/byok-cluster.go index 7991964d2..27f253b17 100644 --- a/apps/infra/internal/entities/byok_cluster.go +++ b/apps/infra/internal/entities/byok-cluster.go @@ -5,7 +5,6 @@ import ( "github.com/kloudlite/api/common" "github.com/kloudlite/api/pkg/repos" t "github.com/kloudlite/api/pkg/types" - clustersv1 "github.com/kloudlite/operator/apis/clusters/v1" "github.com/kloudlite/operator/pkg/operator" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -13,14 +12,22 @@ import ( type BYOKCluster struct { repos.BaseEntity `json:",inline" graphql:"noinput"` - *clustersv1.ClusterSpec `json:",inline" graphql:"noinput"` - metav1.ObjectMeta `json:"metadata"` + GlobalVPN string `json:"globalVPN" graphql:"noinput"` + ClusterSvcCIDR string `json:"clusterSvcCIDR" graphql:"noinput"` + ClusterPublicEndpoint string `json:"clusterPublicEndpoint"` + ClusterToken string `json:"clusterToken"` + + MessageQueueTopicName string `json:"messageQueueTopicName"` + common.ResourceMetadata `json:",inline"` SyncStatus t.SyncStatus `json:"syncStatus" graphql:"noinput"` AccountName string `json:"accountName" graphql:"noinput"` + + // to be set post sync + Kubeconfig t.EncodedString `json:"kubeconfig" graphql:"ignore"` } func (c *BYOKCluster) GetDisplayName() string { @@ -30,12 +37,7 @@ func (c *BYOKCluster) GetDisplayName() string { func (c *BYOKCluster) GetStatus() operator.Status { return operator.Status{ IsReady: true, - // Resources: []operator.ResourceRef{}, - // Message: &raw_json.RawJson{}, - // CheckList: []operator.CheckMeta{}, - Checks: map[string]operator.Check{}, - // LastReadyGeneration: 0, - // LastReconcileTime: &metav1.Time{}, + Checks: map[string]operator.Check{}, } } @@ -49,9 +51,21 @@ var BYOKClusterIndices = []repos.IndexField{ { Field: []repos.IndexKey{ {Key: fc.MetadataName, Value: repos.IndexAsc}, - {Key: fc.MetadataNamespace, Value: repos.IndexAsc}, {Key: fc.AccountName, Value: repos.IndexAsc}, }, Unique: true, }, } + +func UniqueBYOKClusterFilter(accountName string, clusterName string) repos.Filter { + return repos.Filter{ + fc.AccountName: accountName, + fc.MetadataName: clusterName, + } +} + +func ListBYOKClusterFilter(accountName string) repos.Filter { + return repos.Filter{ + fc.AccountName: accountName, + } +} diff --git a/apps/infra/internal/entities/cluster-managed-service.go b/apps/infra/internal/entities/cluster-managed-service.go index 5e9b96de9..51c6de37d 100644 --- a/apps/infra/internal/entities/cluster-managed-service.go +++ b/apps/infra/internal/entities/cluster-managed-service.go @@ -14,7 +14,7 @@ type ClusterManagedService struct { crdsv1.ClusterManagedService `json:",inline"` AccountName string `json:"accountName" graphql:"noinput"` - ClusterName string `json:"clusterName" graphql:"noinput"` + ClusterName string `json:"clusterName"` SyncedOutputSecretRef *corev1.Secret `json:"syncedOutputSecretRef" graphql:"ignore"` diff --git a/apps/infra/internal/entities/field-constants/generated_constants.go b/apps/infra/internal/entities/field-constants/generated_constants.go index c6c3b6075..008342ef7 100644 --- a/apps/infra/internal/entities/field-constants/generated_constants.go +++ b/apps/infra/internal/entities/field-constants/generated_constants.go @@ -36,65 +36,14 @@ const ( // constant vars generated for struct BYOKCluster const ( - BYOKClusterAccountId = "accountId" - BYOKClusterAvailabilityMode = "availabilityMode" - BYOKClusterAws = "aws" - BYOKClusterAwsCredentials = "aws.credentials" - BYOKClusterAwsCredentialsAuthMechanism = "aws.credentials.authMechanism" - BYOKClusterAwsCredentialsSecretRef = "aws.credentials.secretRef" - BYOKClusterAwsCredentialsSecretRefName = "aws.credentials.secretRef.name" - BYOKClusterAwsCredentialsSecretRefNamespace = "aws.credentials.secretRef.namespace" - BYOKClusterAwsK3sMasters = "aws.k3sMasters" - BYOKClusterAwsK3sMastersIamInstanceProfileRole = "aws.k3sMasters.iamInstanceProfileRole" - BYOKClusterAwsK3sMastersInstanceType = "aws.k3sMasters.instanceType" - BYOKClusterAwsK3sMastersNodes = "aws.k3sMasters.nodes" - BYOKClusterAwsK3sMastersNvidiaGpuEnabled = "aws.k3sMasters.nvidiaGpuEnabled" - BYOKClusterAwsK3sMastersRootVolumeSize = "aws.k3sMasters.rootVolumeSize" - BYOKClusterAwsK3sMastersRootVolumeType = "aws.k3sMasters.rootVolumeType" - BYOKClusterAwsNodePools = "aws.nodePools" - BYOKClusterAwsRegion = "aws.region" - BYOKClusterAwsSpotNodePools = "aws.spotNodePools" - BYOKClusterAwsVpc = "aws.vpc" - BYOKClusterAwsVpcId = "aws.vpc.id" - BYOKClusterAwsVpcPublicSubnets = "aws.vpc.publicSubnets" - BYOKClusterBackupToS3Enabled = "backupToS3Enabled" - BYOKClusterCloudProvider = "cloudProvider" - BYOKClusterCloudflareEnabled = "cloudflareEnabled" - BYOKClusterClusterInternalDnsHost = "clusterInternalDnsHost" - BYOKClusterClusterServiceCIDR = "clusterServiceCIDR" - BYOKClusterClusterTokenRef = "clusterTokenRef" - BYOKClusterClusterTokenRefKey = "clusterTokenRef.key" - BYOKClusterClusterTokenRefName = "clusterTokenRef.name" - BYOKClusterClusterTokenRefNamespace = "clusterTokenRef.namespace" - BYOKClusterGcp = "gcp" - BYOKClusterGcpCredentialsRef = "gcp.credentialsRef" - BYOKClusterGcpCredentialsRefName = "gcp.credentialsRef.name" - BYOKClusterGcpCredentialsRefNamespace = "gcp.credentialsRef.namespace" - BYOKClusterGcpGcpProjectID = "gcp.gcpProjectID" - BYOKClusterGcpMasterNodes = "gcp.masterNodes" - BYOKClusterGcpMasterNodesNodes = "gcp.masterNodes.nodes" - BYOKClusterGcpMasterNodesRootVolumeSize = "gcp.masterNodes.rootVolumeSize" - BYOKClusterGcpMasterNodesRootVolumeType = "gcp.masterNodes.rootVolumeType" - BYOKClusterGcpRegion = "gcp.region" - BYOKClusterGcpServiceAccount = "gcp.serviceAccount" - BYOKClusterGcpServiceAccountEmail = "gcp.serviceAccount.email" - BYOKClusterGcpServiceAccountEnabled = "gcp.serviceAccount.enabled" - BYOKClusterGcpServiceAccountScopes = "gcp.serviceAccount.scopes" - BYOKClusterGcpVpc = "gcp.vpc" - BYOKClusterGcpVpcName = "gcp.vpc.name" - BYOKClusterKloudliteRelease = "kloudliteRelease" - BYOKClusterMessageQueueTopicName = "messageQueueTopicName" - BYOKClusterOutput = "output" - BYOKClusterOutputJobName = "output.jobName" - BYOKClusterOutputJobNamespace = "output.jobNamespace" - BYOKClusterOutputKeyAWSVPCId = "output.keyAWSVPCId" - BYOKClusterOutputKeyAWSVPCPublicSubnets = "output.keyAWSVPCPublicSubnets" - BYOKClusterOutputKeyK3sAgentJoinToken = "output.keyK3sAgentJoinToken" - BYOKClusterOutputKeyK3sServerJoinToken = "output.keyK3sServerJoinToken" - BYOKClusterOutputKeyKubeconfig = "output.keyKubeconfig" - BYOKClusterOutputSecretName = "output.secretName" - BYOKClusterPublicDNSHost = "publicDNSHost" - BYOKClusterTaintMasterNodes = "taintMasterNodes" + BYOKClusterClusterPublicEndpoint = "clusterPublicEndpoint" + BYOKClusterClusterSvcCIDR = "clusterSvcCIDR" + BYOKClusterClusterToken = "clusterToken" + BYOKClusterGlobalVPN = "globalVPN" + BYOKClusterKubeconfig = "kubeconfig" + BYOKClusterKubeconfigEncoding = "kubeconfig.encoding" + BYOKClusterKubeconfigValue = "kubeconfig.value" + BYOKClusterMessageQueueTopicName = "messageQueueTopicName" ) // constant vars generated for struct ClaimClusterSvcCIDR @@ -210,7 +159,9 @@ const ( ClusterManagedServiceSpecMsvcSpecServiceTemplateApiVersion = "spec.msvcSpec.serviceTemplate.apiVersion" ClusterManagedServiceSpecMsvcSpecServiceTemplateKind = "spec.msvcSpec.serviceTemplate.kind" ClusterManagedServiceSpecMsvcSpecServiceTemplateSpec = "spec.msvcSpec.serviceTemplate.spec" + ClusterManagedServiceSpecMsvcSpecSharedSecret = "spec.msvcSpec.sharedSecret" ClusterManagedServiceSpecMsvcSpecTolerations = "spec.msvcSpec.tolerations" + ClusterManagedServiceSpecSharedSecret = "spec.sharedSecret" ClusterManagedServiceSpecTargetNamespace = "spec.targetNamespace" ClusterManagedServiceSyncedOutputSecretRef = "syncedOutputSecretRef" ClusterManagedServiceSyncedOutputSecretRefApiVersion = "syncedOutputSecretRef.apiVersion" diff --git a/apps/iot-console/internal/app/graph/generated/generated.go b/apps/iot-console/internal/app/graph/generated/generated.go index 79a915ed1..f2bc69f5b 100644 --- a/apps/iot-console/internal/app/graph/generated/generated.go +++ b/apps/iot-console/internal/app/graph/generated/generated.go @@ -121,10 +121,8 @@ type ComplexityRoot struct { } Github__com___kloudlite___operator___apis___crds___v1__AppSvc struct { - Name func(childComplexity int) int - Port func(childComplexity int) int - TargetPort func(childComplexity int) int - Type func(childComplexity int) int + Port func(childComplexity int) int + Protocol func(childComplexity int) int } Github__com___kloudlite___operator___apis___crds___v1__ContainerEnv struct { @@ -856,13 +854,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSpec.TopologySpreadConstraints(childComplexity), true - case "Github__com___kloudlite___operator___apis___crds___v1__AppSvc.name": - if e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSvc.Name == nil { - break - } - - return e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSvc.Name(childComplexity), true - case "Github__com___kloudlite___operator___apis___crds___v1__AppSvc.port": if e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSvc.Port == nil { break @@ -870,19 +861,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSvc.Port(childComplexity), true - case "Github__com___kloudlite___operator___apis___crds___v1__AppSvc.targetPort": - if e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSvc.TargetPort == nil { - break - } - - return e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSvc.TargetPort(childComplexity), true - - case "Github__com___kloudlite___operator___apis___crds___v1__AppSvc.type": - if e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSvc.Type == nil { + case "Github__com___kloudlite___operator___apis___crds___v1__AppSvc.protocol": + if e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSvc.Protocol == nil { break } - return e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSvc.Type(childComplexity), true + return e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSvc.Protocol(childComplexity), true case "Github__com___kloudlite___operator___apis___crds___v1__ContainerEnv.key": if e.complexity.Github__com___kloudlite___operator___apis___crds___v1__ContainerEnv.Key == nil { @@ -2892,10 +2876,8 @@ type Github__com___kloudlite___operator___apis___crds___v1__AppSpec @shareable { } type Github__com___kloudlite___operator___apis___crds___v1__AppSvc @shareable { - name: String port: Int! - targetPort: Int - type: String + protocol: String } type Github__com___kloudlite___operator___apis___crds___v1__ContainerEnv @shareable { @@ -3095,10 +3077,8 @@ input Github__com___kloudlite___operator___apis___crds___v1__AppSpecIn { } input Github__com___kloudlite___operator___apis___crds___v1__AppSvcIn { - name: String port: Int! - targetPort: Int - type: String + protocol: String } input Github__com___kloudlite___operator___apis___crds___v1__ContainerEnvIn { @@ -5903,14 +5883,10 @@ func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___ap IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "name": - return ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_name(ctx, field) case "port": return ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_port(ctx, field) - case "targetPort": - return ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_targetPort(ctx, field) - case "type": - return ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_type(ctx, field) + case "protocol": + return ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_protocol(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___operator___apis___crds___v1__AppSvc", field.Name) }, @@ -6030,47 +6006,6 @@ func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___ap return fc, nil } -func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___v1__AppSvc_name(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCrdsV1AppSvc) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_name(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Github__com___kloudlite___operator___apis___crds___v1__AppSvc", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___v1__AppSvc_port(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCrdsV1AppSvc) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_port(ctx, field) if err != nil { @@ -6115,8 +6050,8 @@ func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___ap return fc, nil } -func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___v1__AppSvc_targetPort(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCrdsV1AppSvc) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_targetPort(ctx, field) +func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___v1__AppSvc_protocol(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCrdsV1AppSvc) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_protocol(ctx, field) if err != nil { return graphql.Null } @@ -6129,48 +6064,7 @@ func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___ }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.TargetPort, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*int) - fc.Result = res - return ec.marshalOInt2ᚖint(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_targetPort(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Github__com___kloudlite___operator___apis___crds___v1__AppSvc", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___v1__AppSvc_type(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCrdsV1AppSvc) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_type(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Type, nil + return obj.Protocol, nil }) if err != nil { ec.Error(ctx, err) @@ -6184,7 +6078,7 @@ func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___ return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_protocol(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Github__com___kloudlite___operator___apis___crds___v1__AppSvc", Field: field, @@ -20359,22 +20253,13 @@ func (ec *executionContext) unmarshalInputGithub__com___kloudlite___operator___a asMap[k] = v } - fieldsInOrder := [...]string{"name", "port", "targetPort", "type"} + fieldsInOrder := [...]string{"port", "protocol"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "name": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.Name = data case "port": var err error @@ -20384,24 +20269,15 @@ func (ec *executionContext) unmarshalInputGithub__com___kloudlite___operator___a return it, err } it.Port = data - case "targetPort": + case "protocol": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetPort")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) - if err != nil { - return it, err - } - it.TargetPort = data - case "type": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("type")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("protocol")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Type = data + it.Protocol = data } } @@ -22256,17 +22132,13 @@ func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___ switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("Github__com___kloudlite___operator___apis___crds___v1__AppSvc") - case "name": - out.Values[i] = ec._Github__com___kloudlite___operator___apis___crds___v1__AppSvc_name(ctx, field, obj) case "port": out.Values[i] = ec._Github__com___kloudlite___operator___apis___crds___v1__AppSvc_port(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "targetPort": - out.Values[i] = ec._Github__com___kloudlite___operator___apis___crds___v1__AppSvc_targetPort(ctx, field, obj) - case "type": - out.Values[i] = ec._Github__com___kloudlite___operator___apis___crds___v1__AppSvc_type(ctx, field, obj) + case "protocol": + out.Values[i] = ec._Github__com___kloudlite___operator___apis___crds___v1__AppSvc_protocol(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } diff --git a/apps/iot-console/internal/app/graph/model/models_gen.go b/apps/iot-console/internal/app/graph/model/models_gen.go index 1d07ff94d..78badfc14 100644 --- a/apps/iot-console/internal/app/graph/model/models_gen.go +++ b/apps/iot-console/internal/app/graph/model/models_gen.go @@ -93,17 +93,13 @@ type GithubComKloudliteOperatorApisCrdsV1AppSpecIn struct { } type GithubComKloudliteOperatorApisCrdsV1AppSvc struct { - Name *string `json:"name,omitempty"` - Port int `json:"port"` - TargetPort *int `json:"targetPort,omitempty"` - Type *string `json:"type,omitempty"` + Port int `json:"port"` + Protocol *string `json:"protocol,omitempty"` } type GithubComKloudliteOperatorApisCrdsV1AppSvcIn struct { - Name *string `json:"name,omitempty"` - Port int `json:"port"` - TargetPort *int `json:"targetPort,omitempty"` - Type *string `json:"type,omitempty"` + Port int `json:"port"` + Protocol *string `json:"protocol,omitempty"` } type GithubComKloudliteOperatorApisCrdsV1ContainerEnv struct { diff --git a/apps/iot-console/internal/app/graph/struct-to-graphql/common-types.graphqls b/apps/iot-console/internal/app/graph/struct-to-graphql/common-types.graphqls index 626545a41..83993b8fb 100644 --- a/apps/iot-console/internal/app/graph/struct-to-graphql/common-types.graphqls +++ b/apps/iot-console/internal/app/graph/struct-to-graphql/common-types.graphqls @@ -45,10 +45,8 @@ type Github__com___kloudlite___operator___apis___crds___v1__AppSpec @shareable { } type Github__com___kloudlite___operator___apis___crds___v1__AppSvc @shareable { - name: String port: Int! - targetPort: Int - type: String + protocol: String } type Github__com___kloudlite___operator___apis___crds___v1__ContainerEnv @shareable { @@ -248,10 +246,8 @@ input Github__com___kloudlite___operator___apis___crds___v1__AppSpecIn { } input Github__com___kloudlite___operator___apis___crds___v1__AppSvcIn { - name: String port: Int! - targetPort: Int - type: String + protocol: String } input Github__com___kloudlite___operator___apis___crds___v1__ContainerEnvIn { diff --git a/apps/observability/internal/app/app.go b/apps/observability/internal/app/app.go index 103b50788..93d2e8f17 100644 --- a/apps/observability/internal/app/app.go +++ b/apps/observability/internal/app/app.go @@ -148,24 +148,34 @@ var Module = fx.Module( trackingId := r.URL.Query().Get("tracking_id") if !strings.HasPrefix(trackingId, "clus-") { - out, err := infraCli.GetClusterKubeconfig(r.Context(), &infra.GetClusterIn{ - UserId: string(sess.UserId), - UserName: sess.UserName, - UserEmail: sess.UserEmail, - AccountName: accountName, - ClusterName: clusterName, - }) - if err != nil { - http.Error(w, err.Error(), 500) - return - } - - cfg, err := k8s.RestConfigFromKubeConfig(out.Kubeconfig) - if err != nil { - http.Error(w, err.Error(), 500) - return + cfg := &rest.Config{ + Host: fmt.Sprintf("kubectl-proxy.%s.svc.cluster.local", accountName), + WrapTransport: func(rt http.RoundTripper) http.RoundTripper { + return httpServer.NewRoundTripperWithHeaders(rt, map[string][]string{ + "kloudlite-cluster": []string{clusterName}, + }) + }, } + //out, err := infraCli.GetClusterKubeconfig(r.Context(), &infra.GetClusterIn{ + // UserId: string(sess.UserId), + // UserName: sess.UserName, + // UserEmail: sess.UserEmail, + // AccountName: accountName, + // ClusterName: clusterName, + //}) + //if err != nil { + // http.Error(w, err.Error(), 500) + // return + //} + // + //cfg, err := k8s.RestConfigFromKubeConfig(out.Kubeconfig) + //if err != nil { + // http.Error(w, err.Error(), 500) + // return + //} + + var err error kcli, err = k8s.NewClient(cfg, nil) if err != nil { http.Error(w, err.Error(), 500) From 3d533d4369f50f02cd0536827286675ab2764044 Mon Sep 17 00:00:00 2001 From: nxtcoder17 Date: Tue, 7 May 2024 20:03:57 +0530 Subject: [PATCH 2/3] feat(iam): adds image-pull-secret resource and actions --- apps/iam/internal/app/action-role-binding.go | 7 +++++++ apps/iam/types/types.go | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/apps/iam/internal/app/action-role-binding.go b/apps/iam/internal/app/action-role-binding.go index 19902b302..f3ddf13f2 100644 --- a/apps/iam/internal/app/action-role-binding.go +++ b/apps/iam/internal/app/action-role-binding.go @@ -74,6 +74,13 @@ var roleBindings RoleBindingMap = RoleBindingMap{ t.ListCloudProviderSecrets: []t.Role{t.RoleAccountOwner, t.RoleAccountAdmin, t.RoleAccountMember}, t.GetCloudProviderSecret: []t.Role{t.RoleAccountOwner, t.RoleAccountAdmin, t.RoleAccountMember}, + // image pull secrets + t.CreateImagePullSecret: []t.Role{t.RoleAccountOwner, t.RoleAccountAdmin, t.RoleAccountMember}, + t.UpdateImagePullSecret: []t.Role{t.RoleAccountOwner, t.RoleAccountAdmin, t.RoleAccountMember}, + t.DeleteImagePullSecret: []t.Role{t.RoleAccountOwner, t.RoleAccountAdmin, t.RoleAccountMember}, + t.ListImagePullSecrets: []t.Role{t.RoleAccountOwner, t.RoleAccountAdmin, t.RoleAccountMember}, + t.GetImagePullSecret: []t.Role{t.RoleAccountOwner, t.RoleAccountAdmin, t.RoleAccountMember}, + // for projects t.CreateProject: []t.Role{t.RoleAccountOwner, t.RoleAccountAdmin, t.RoleAccountMember}, t.ListProjects: []t.Role{t.RoleAccountOwner, t.RoleAccountAdmin, t.RoleAccountMember, t.RoleProjectAdmin, t.RoleProjectMember}, diff --git a/apps/iam/types/types.go b/apps/iam/types/types.go index e40ed934f..66e818f21 100644 --- a/apps/iam/types/types.go +++ b/apps/iam/types/types.go @@ -161,6 +161,13 @@ const ( UpdateBuildIntegration Action = "update-build-integration" CreateBuildIntegration Action = "create-build-integration" DeleteBuildIntegration Action = "delete-build-integration" + + // image pull secrets + ListImagePullSecrets Action = "list-image-pull-secrets" + GetImagePullSecret Action = "get-image-pull-secret" + UpdateImagePullSecret Action = "update-image-pull-secret" + CreateImagePullSecret Action = "create-image-pull-secret" + DeleteImagePullSecret Action = "delete-image-pull-secret" ) func NewResourceRef(accountName string, resourceType ResourceType, resourceName string) string { From ba4f3a43ab2dc4d448fb64cb473c1761e7d2812b Mon Sep 17 00:00:00 2001 From: nxtcoder17 Date: Tue, 7 May 2024 20:04:29 +0530 Subject: [PATCH 3/3] feat(console): image pull secrets is now out of environment scope --- .../internal/app/graph/generated/generated.go | 1349 ++++++++--------- .../internal/app/graph/model/models_gen.go | 45 +- .../internal/app/graph/schema.graphqls | 236 +-- .../internal/app/graph/schema.resolvers.go | 20 +- .../struct-to-graphql/common-types.graphqls | 41 +- .../imagepullsecret.graphqls | 3 +- .../internal/app/process-resource-updates.go | 15 +- apps/console/internal/domain/api.go | 16 +- apps/console/internal/domain/domain.go | 19 - apps/console/internal/domain/environment.go | 6 + .../internal/domain/image-pull-secret.go | 230 +-- .../field-constants/generated_constants.go | 3 + .../internal/entities/image-pull-secret.go | 21 +- 13 files changed, 960 insertions(+), 1044 deletions(-) diff --git a/apps/console/internal/app/graph/generated/generated.go b/apps/console/internal/app/graph/generated/generated.go index 1d5fc0b66..33afb84aa 100644 --- a/apps/console/internal/app/graph/generated/generated.go +++ b/apps/console/internal/app/graph/generated/generated.go @@ -263,6 +263,14 @@ type ComplexityRoot struct { SyncScheduledAt func(childComplexity int) int } + Github__com___kloudlite___operator___apis___common____types__MsvcRef struct { + APIVersion func(childComplexity int) int + ClusterName func(childComplexity int) int + Kind func(childComplexity int) int + Name func(childComplexity int) int + Namespace func(childComplexity int) int + } + Github__com___kloudlite___operator___apis___crds___v1__AppContainer struct { Args func(childComplexity int) int Command func(childComplexity int) int @@ -299,10 +307,8 @@ type ComplexityRoot struct { } Github__com___kloudlite___operator___apis___crds___v1__AppSvc struct { - Name func(childComplexity int) int - Port func(childComplexity int) int - TargetPort func(childComplexity int) int - Type func(childComplexity int) int + Port func(childComplexity int) int + Protocol func(childComplexity int) int } Github__com___kloudlite___operator___apis___crds___v1__BasicAuth struct { @@ -397,13 +403,6 @@ type ComplexityRoot struct { Spec func(childComplexity int) int } - Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef struct { - APIVersion func(childComplexity int) int - Kind func(childComplexity int) int - Name func(childComplexity int) int - Namespace func(childComplexity int) int - } - Github__com___kloudlite___operator___apis___crds___v1__Probe struct { FailureThreshold func(childComplexity int) int HTTPGet func(childComplexity int) int @@ -513,7 +512,7 @@ type ComplexityRoot struct { CreationTime func(childComplexity int) int DisplayName func(childComplexity int) int DockerConfigJson func(childComplexity int) int - EnvironmentName func(childComplexity int) int + Environments func(childComplexity int) int Format func(childComplexity int) int Id func(childComplexity int) int LastUpdatedBy func(childComplexity int) int @@ -643,7 +642,7 @@ type ComplexityRoot struct { CoreCreateApp func(childComplexity int, envName string, app entities.App) int CoreCreateConfig func(childComplexity int, envName string, config entities.Config) int CoreCreateEnvironment func(childComplexity int, env entities.Environment) int - CoreCreateImagePullSecret func(childComplexity int, envName string, imagePullSecretIn entities.ImagePullSecret) int + CoreCreateImagePullSecret func(childComplexity int, imagePullSecretIn entities.ImagePullSecret) int CoreCreateManagedResource func(childComplexity int, envName string, mres entities.ManagedResource) int CoreCreateRouter func(childComplexity int, envName string, router entities.Router) int CoreCreateSecret func(childComplexity int, envName string, secret entities.Secret) int @@ -651,7 +650,7 @@ type ComplexityRoot struct { CoreDeleteApp func(childComplexity int, envName string, appName string) int CoreDeleteConfig func(childComplexity int, envName string, configName string) int CoreDeleteEnvironment func(childComplexity int, envName string) int - CoreDeleteImagePullSecret func(childComplexity int, envName string, secretName string) int + CoreDeleteImagePullSecret func(childComplexity int, name string) int CoreDeleteManagedResource func(childComplexity int, envName string, mresName string) int CoreDeleteRouter func(childComplexity int, envName string, routerName string) int CoreDeleteSecret func(childComplexity int, envName string, secretName string) int @@ -688,7 +687,7 @@ type ComplexityRoot struct { CoreGetConfig func(childComplexity int, envName string, name string) int CoreGetConfigValues func(childComplexity int, envName string, queries []*domain.ConfigKeyRef) int CoreGetEnvironment func(childComplexity int, name string) int - CoreGetImagePullSecret func(childComplexity int, envName string, name string) int + CoreGetImagePullSecret func(childComplexity int, name string) int CoreGetManagedResouceOutputKeyValues func(childComplexity int, envName string, keyrefs []*domain.ManagedResourceKeyRef) int CoreGetManagedResouceOutputKeys func(childComplexity int, envName string, name string) int CoreGetManagedResource func(childComplexity int, envName string, name string) int @@ -699,7 +698,7 @@ type ComplexityRoot struct { CoreListApps func(childComplexity int, envName string, search *model.SearchApps, pq *repos.CursorPagination) int CoreListConfigs func(childComplexity int, envName string, search *model.SearchConfigs, pq *repos.CursorPagination) int CoreListEnvironments func(childComplexity int, search *model.SearchEnvironments, pq *repos.CursorPagination) int - CoreListImagePullSecrets func(childComplexity int, envName string, search *model.SearchImagePullSecrets, pq *repos.CursorPagination) int + CoreListImagePullSecrets func(childComplexity int, search *model.SearchImagePullSecrets, pq *repos.CursorPagination) int CoreListManagedResources func(childComplexity int, envName string, search *model.SearchManagedResources, pq *repos.CursorPagination) int CoreListRouters func(childComplexity int, envName string, search *model.SearchRouters, pq *repos.CursorPagination) int CoreListSecrets func(childComplexity int, envName string, search *model.SearchSecrets, pq *repos.CursorPagination) int @@ -709,7 +708,7 @@ type ComplexityRoot struct { CoreResyncApp func(childComplexity int, envName string, name string) int CoreResyncConfig func(childComplexity int, envName string, name string) int CoreResyncEnvironment func(childComplexity int, name string) int - CoreResyncImagePullSecret func(childComplexity int, envName string, name string) int + CoreResyncImagePullSecret func(childComplexity int, name string) int CoreResyncManagedResource func(childComplexity int, envName string, name string) int CoreResyncRouter func(childComplexity int, envName string, name string) int CoreResyncSecret func(childComplexity int, envName string, name string) int @@ -879,8 +878,8 @@ type MutationResolver interface { CoreUpdateEnvironment(ctx context.Context, env entities.Environment) (*entities.Environment, error) CoreDeleteEnvironment(ctx context.Context, envName string) (bool, error) CoreCloneEnvironment(ctx context.Context, sourceEnvName string, destinationEnvName string, displayName string, environmentRoutingMode v1.EnvironmentRoutingMode) (*entities.Environment, error) - CoreCreateImagePullSecret(ctx context.Context, envName string, imagePullSecretIn entities.ImagePullSecret) (*entities.ImagePullSecret, error) - CoreDeleteImagePullSecret(ctx context.Context, envName string, secretName string) (bool, error) + CoreCreateImagePullSecret(ctx context.Context, imagePullSecretIn entities.ImagePullSecret) (*entities.ImagePullSecret, error) + CoreDeleteImagePullSecret(ctx context.Context, name string) (bool, error) CoreCreateApp(ctx context.Context, envName string, app entities.App) (*entities.App, error) CoreUpdateApp(ctx context.Context, envName string, app entities.App) (*entities.App, error) CoreDeleteApp(ctx context.Context, envName string, appName string) (bool, error) @@ -910,9 +909,9 @@ type QueryResolver interface { CoreListEnvironments(ctx context.Context, search *model.SearchEnvironments, pq *repos.CursorPagination) (*model.EnvironmentPaginatedRecords, error) CoreGetEnvironment(ctx context.Context, name string) (*entities.Environment, error) CoreResyncEnvironment(ctx context.Context, name string) (bool, error) - CoreListImagePullSecrets(ctx context.Context, envName string, search *model.SearchImagePullSecrets, pq *repos.CursorPagination) (*model.ImagePullSecretPaginatedRecords, error) - CoreGetImagePullSecret(ctx context.Context, envName string, name string) (*entities.ImagePullSecret, error) - CoreResyncImagePullSecret(ctx context.Context, envName string, name string) (bool, error) + CoreListImagePullSecrets(ctx context.Context, search *model.SearchImagePullSecrets, pq *repos.CursorPagination) (*model.ImagePullSecretPaginatedRecords, error) + CoreGetImagePullSecret(ctx context.Context, name string) (*entities.ImagePullSecret, error) + CoreResyncImagePullSecret(ctx context.Context, name string) (bool, error) CoreListApps(ctx context.Context, envName string, search *model.SearchApps, pq *repos.CursorPagination) (*model.AppPaginatedRecords, error) CoreGetApp(ctx context.Context, envName string, name string) (*entities.App, error) CoreResyncApp(ctx context.Context, envName string, name string) (bool, error) @@ -1841,6 +1840,41 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Github__com___kloudlite___api___pkg___types__SyncStatus.SyncScheduledAt(childComplexity), true + case "Github__com___kloudlite___operator___apis___common____types__MsvcRef.apiVersion": + if e.complexity.Github__com___kloudlite___operator___apis___common____types__MsvcRef.APIVersion == nil { + break + } + + return e.complexity.Github__com___kloudlite___operator___apis___common____types__MsvcRef.APIVersion(childComplexity), true + + case "Github__com___kloudlite___operator___apis___common____types__MsvcRef.clusterName": + if e.complexity.Github__com___kloudlite___operator___apis___common____types__MsvcRef.ClusterName == nil { + break + } + + return e.complexity.Github__com___kloudlite___operator___apis___common____types__MsvcRef.ClusterName(childComplexity), true + + case "Github__com___kloudlite___operator___apis___common____types__MsvcRef.kind": + if e.complexity.Github__com___kloudlite___operator___apis___common____types__MsvcRef.Kind == nil { + break + } + + return e.complexity.Github__com___kloudlite___operator___apis___common____types__MsvcRef.Kind(childComplexity), true + + case "Github__com___kloudlite___operator___apis___common____types__MsvcRef.name": + if e.complexity.Github__com___kloudlite___operator___apis___common____types__MsvcRef.Name == nil { + break + } + + return e.complexity.Github__com___kloudlite___operator___apis___common____types__MsvcRef.Name(childComplexity), true + + case "Github__com___kloudlite___operator___apis___common____types__MsvcRef.namespace": + if e.complexity.Github__com___kloudlite___operator___apis___common____types__MsvcRef.Namespace == nil { + break + } + + return e.complexity.Github__com___kloudlite___operator___apis___common____types__MsvcRef.Namespace(childComplexity), true + case "Github__com___kloudlite___operator___apis___crds___v1__AppContainer.args": if e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppContainer.Args == nil { break @@ -2023,13 +2057,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSpec.TopologySpreadConstraints(childComplexity), true - case "Github__com___kloudlite___operator___apis___crds___v1__AppSvc.name": - if e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSvc.Name == nil { - break - } - - return e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSvc.Name(childComplexity), true - case "Github__com___kloudlite___operator___apis___crds___v1__AppSvc.port": if e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSvc.Port == nil { break @@ -2037,19 +2064,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSvc.Port(childComplexity), true - case "Github__com___kloudlite___operator___apis___crds___v1__AppSvc.targetPort": - if e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSvc.TargetPort == nil { + case "Github__com___kloudlite___operator___apis___crds___v1__AppSvc.protocol": + if e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSvc.Protocol == nil { break } - return e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSvc.TargetPort(childComplexity), true - - case "Github__com___kloudlite___operator___apis___crds___v1__AppSvc.type": - if e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSvc.Type == nil { - break - } - - return e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSvc.Type(childComplexity), true + return e.complexity.Github__com___kloudlite___operator___apis___crds___v1__AppSvc.Protocol(childComplexity), true case "Github__com___kloudlite___operator___apis___crds___v1__BasicAuth.enabled": if e.complexity.Github__com___kloudlite___operator___apis___crds___v1__BasicAuth.Enabled == nil { @@ -2380,34 +2400,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Github__com___kloudlite___operator___apis___crds___v1__MresResourceTemplate.Spec(childComplexity), true - case "Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef.apiVersion": - if e.complexity.Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef.APIVersion == nil { - break - } - - return e.complexity.Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef.APIVersion(childComplexity), true - - case "Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef.kind": - if e.complexity.Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef.Kind == nil { - break - } - - return e.complexity.Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef.Kind(childComplexity), true - - case "Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef.name": - if e.complexity.Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef.Name == nil { - break - } - - return e.complexity.Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef.Name(childComplexity), true - - case "Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef.namespace": - if e.complexity.Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef.Namespace == nil { - break - } - - return e.complexity.Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef.Namespace(childComplexity), true - case "Github__com___kloudlite___operator___apis___crds___v1__Probe.failureThreshold": if e.complexity.Github__com___kloudlite___operator___apis___crds___v1__Probe.FailureThreshold == nil { break @@ -2870,12 +2862,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.ImagePullSecret.DockerConfigJson(childComplexity), true - case "ImagePullSecret.environmentName": - if e.complexity.ImagePullSecret.EnvironmentName == nil { + case "ImagePullSecret.environments": + if e.complexity.ImagePullSecret.Environments == nil { break } - return e.complexity.ImagePullSecret.EnvironmentName(childComplexity), true + return e.complexity.ImagePullSecret.Environments(childComplexity), true case "ImagePullSecret.format": if e.complexity.ImagePullSecret.Format == nil { @@ -3495,7 +3487,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Mutation.CoreCreateImagePullSecret(childComplexity, args["envName"].(string), args["imagePullSecretIn"].(entities.ImagePullSecret)), true + return e.complexity.Mutation.CoreCreateImagePullSecret(childComplexity, args["imagePullSecretIn"].(entities.ImagePullSecret)), true case "Mutation.core_createManagedResource": if e.complexity.Mutation.CoreCreateManagedResource == nil { @@ -3591,7 +3583,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Mutation.CoreDeleteImagePullSecret(childComplexity, args["envName"].(string), args["secretName"].(string)), true + return e.complexity.Mutation.CoreDeleteImagePullSecret(childComplexity, args["name"].(string)), true case "Mutation.core_deleteManagedResource": if e.complexity.Mutation.CoreDeleteManagedResource == nil { @@ -3897,7 +3889,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Query.CoreGetImagePullSecret(childComplexity, args["envName"].(string), args["name"].(string)), true + return e.complexity.Query.CoreGetImagePullSecret(childComplexity, args["name"].(string)), true case "Query.core_getManagedResouceOutputKeyValues": if e.complexity.Query.CoreGetManagedResouceOutputKeyValues == nil { @@ -4029,7 +4021,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Query.CoreListImagePullSecrets(childComplexity, args["envName"].(string), args["search"].(*model.SearchImagePullSecrets), args["pq"].(*repos.CursorPagination)), true + return e.complexity.Query.CoreListImagePullSecrets(childComplexity, args["search"].(*model.SearchImagePullSecrets), args["pq"].(*repos.CursorPagination)), true case "Query.core_listManagedResources": if e.complexity.Query.CoreListManagedResources == nil { @@ -4144,7 +4136,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Query.CoreResyncImagePullSecret(childComplexity, args["envName"].(string), args["name"].(string)), true + return e.complexity.Query.CoreResyncImagePullSecret(childComplexity, args["name"].(string)), true case "Query.core_resyncManagedResource": if e.complexity.Query.CoreResyncManagedResource == nil { @@ -4581,6 +4573,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputCoreSearchVPNDevices, ec.unmarshalInputCursorPaginationIn, ec.unmarshalInputEnvironmentIn, + ec.unmarshalInputGithub__com___kloudlite___operator___apis___common____types__MsvcRefIn, ec.unmarshalInputGithub__com___kloudlite___operator___apis___crds___v1__AppContainerIn, ec.unmarshalInputGithub__com___kloudlite___operator___apis___crds___v1__AppInterceptPortMappingsIn, ec.unmarshalInputGithub__com___kloudlite___operator___apis___crds___v1__AppSpecIn, @@ -4600,7 +4593,6 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputGithub__com___kloudlite___operator___apis___crds___v1__InterceptIn, ec.unmarshalInputGithub__com___kloudlite___operator___apis___crds___v1__ManagedResourceSpecIn, ec.unmarshalInputGithub__com___kloudlite___operator___apis___crds___v1__MresResourceTemplateIn, - ec.unmarshalInputGithub__com___kloudlite___operator___apis___crds___v1__MsvcNamedRefIn, ec.unmarshalInputGithub__com___kloudlite___operator___apis___crds___v1__ProbeIn, ec.unmarshalInputGithub__com___kloudlite___operator___apis___crds___v1__RateLimitIn, ec.unmarshalInputGithub__com___kloudlite___operator___apis___crds___v1__RouteIn, @@ -4736,191 +4728,191 @@ directive @isLoggedInAndVerified on FIELD_DEFINITION directive @hasAccount on FIELD_DEFINITION enum ConsoleResType { - app - config - secret - router - managed_service - managed_resource - environment - vpn_device + app + config + secret + router + managed_service + managed_resource + environment + vpn_device } type ConsoleCheckNameAvailabilityOutput @shareable { - result: Boolean! - suggestedNames: [String!] + result: Boolean! + suggestedNames: [String!] } input SearchProjects { - text: MatchFilterIn - isReady: MatchFilterIn - markedForDeletion: MatchFilterIn + text: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn } input SearchImagePullSecrets { - text: MatchFilterIn - isReady: MatchFilterIn - markedForDeletion: MatchFilterIn + text: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn } input SearchEnvironments { - text: MatchFilterIn - isReady: MatchFilterIn - markedForDeletion: MatchFilterIn + text: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn } input SearchApps { - text: MatchFilterIn - isReady: MatchFilterIn - markedForDeletion: MatchFilterIn + text: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn } input SearchConfigs { - text: MatchFilterIn - isReady: MatchFilterIn - markedForDeletion: MatchFilterIn + text: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn } input SearchSecrets { - text: MatchFilterIn - isReady: MatchFilterIn - markedForDeletion: MatchFilterIn + text: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn } input SearchRouters { - text: MatchFilterIn - isReady: MatchFilterIn - markedForDeletion: MatchFilterIn + text: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn } input SearchManagedResources { - text: MatchFilterIn - managedServiceName: MatchFilterIn - isReady: MatchFilterIn - markedForDeletion: MatchFilterIn + text: MatchFilterIn + managedServiceName: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn } input SearchProjectManagedService { - text: MatchFilterIn - managedServiceName: MatchFilterIn - isReady: MatchFilterIn - markedForDeletion: MatchFilterIn + text: MatchFilterIn + managedServiceName: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn } input CoreSearchVPNDevices { - text: MatchFilterIn - isReady: MatchFilterIn - markedForDeletion: MatchFilterIn + text: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn } type Query { - core_checkNameAvailability(envName: String, resType: ConsoleResType!, name: String!): ConsoleCheckNameAvailabilityOutput! @isLoggedIn @hasAccount + core_checkNameAvailability(envName: String, resType: ConsoleResType!, name: String!): ConsoleCheckNameAvailabilityOutput! @isLoggedIn @hasAccount - # core_listProjects(search: SearchProjects, pq: CursorPaginationIn): ProjectPaginatedRecords @isLoggedInAndVerified @hasAccount - # core_getProject(name: String!): Project @isLoggedInAndVerified @hasAccount - # core_resyncProject(name: String!): Boolean! @isLoggedInAndVerified @hasAccount + # core_listProjects(search: SearchProjects, pq: CursorPaginationIn): ProjectPaginatedRecords @isLoggedInAndVerified @hasAccount + # core_getProject(name: String!): Project @isLoggedInAndVerified @hasAccount + # core_resyncProject(name: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_listEnvironments(search: SearchEnvironments, pq: CursorPaginationIn): EnvironmentPaginatedRecords @isLoggedInAndVerified @hasAccount - core_getEnvironment(name: String!): Environment @isLoggedInAndVerified @hasAccount - core_resyncEnvironment(name: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_listEnvironments(search: SearchEnvironments, pq: CursorPaginationIn): EnvironmentPaginatedRecords @isLoggedInAndVerified @hasAccount + core_getEnvironment(name: String!): Environment @isLoggedInAndVerified @hasAccount + core_resyncEnvironment(name: String!): Boolean! @isLoggedInAndVerified @hasAccount - # get image pull secrets - core_listImagePullSecrets(envName: String!, search: SearchImagePullSecrets, pq: CursorPaginationIn): ImagePullSecretPaginatedRecords @isLoggedInAndVerified @hasAccount - core_getImagePullSecret(envName: String!, name: String!): ImagePullSecret @isLoggedInAndVerified @hasAccount - core_resyncImagePullSecret(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount + # get image pull secrets + core_listImagePullSecrets(search: SearchImagePullSecrets, pq: CursorPaginationIn): ImagePullSecretPaginatedRecords @isLoggedInAndVerified @hasAccount + core_getImagePullSecret(name: String!): ImagePullSecret @isLoggedInAndVerified @hasAccount + core_resyncImagePullSecret(name: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_listApps(envName: String!, search: SearchApps, pq: CursorPaginationIn): AppPaginatedRecords @isLoggedInAndVerified @hasAccount - core_getApp(envName: String!, name: String!): App @isLoggedInAndVerified @hasAccount - core_resyncApp(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_restartApp(envName: String!, appName: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_listApps(envName: String!, search: SearchApps, pq: CursorPaginationIn): AppPaginatedRecords @isLoggedInAndVerified @hasAccount + core_getApp(envName: String!, name: String!): App @isLoggedInAndVerified @hasAccount + core_resyncApp(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_restartApp(envName: String!, appName: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_getConfigValues(envName: String!, queries: [ConfigKeyRefIn]): [ConfigKeyValueRef!] @isLoggedInAndVerified @hasAccount - core_listConfigs(envName: String!, search: SearchConfigs, pq: CursorPaginationIn): ConfigPaginatedRecords @isLoggedInAndVerified @hasAccount - core_getConfig(envName: String!, name: String!): Config @isLoggedInAndVerified @hasAccount - core_resyncConfig(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_getConfigValues(envName: String!, queries: [ConfigKeyRefIn]): [ConfigKeyValueRef!] @isLoggedInAndVerified @hasAccount + core_listConfigs(envName: String!, search: SearchConfigs, pq: CursorPaginationIn): ConfigPaginatedRecords @isLoggedInAndVerified @hasAccount + core_getConfig(envName: String!, name: String!): Config @isLoggedInAndVerified @hasAccount + core_resyncConfig(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_getSecretValues(envName: String!, queries: [SecretKeyRefIn!]): [SecretKeyValueRef!] @isLoggedInAndVerified @hasAccount - core_listSecrets(envName: String!, search: SearchSecrets, pq: CursorPaginationIn): SecretPaginatedRecords @isLoggedInAndVerified @hasAccount - core_getSecret(envName: String!, name: String!): Secret @isLoggedInAndVerified @hasAccount - core_resyncSecret(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_getSecretValues(envName: String!, queries: [SecretKeyRefIn!]): [SecretKeyValueRef!] @isLoggedInAndVerified @hasAccount + core_listSecrets(envName: String!, search: SearchSecrets, pq: CursorPaginationIn): SecretPaginatedRecords @isLoggedInAndVerified @hasAccount + core_getSecret(envName: String!, name: String!): Secret @isLoggedInAndVerified @hasAccount + core_resyncSecret(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_listRouters(envName: String!, search: SearchRouters, pq: CursorPaginationIn): RouterPaginatedRecords @isLoggedInAndVerified @hasAccount - core_getRouter(envName: String!, name: String!): Router @isLoggedInAndVerified @hasAccount - core_resyncRouter(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_listRouters(envName: String!, search: SearchRouters, pq: CursorPaginationIn): RouterPaginatedRecords @isLoggedInAndVerified @hasAccount + core_getRouter(envName: String!, name: String!): Router @isLoggedInAndVerified @hasAccount + core_resyncRouter(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_getManagedResouceOutputKeys(envName: String!, name: String!): [String!]! @isLoggedInAndVerified @hasAccount - core_getManagedResouceOutputKeyValues(envName: String!, keyrefs: [ManagedResourceKeyRefIn]): [ManagedResourceKeyValueRef!]! @isLoggedInAndVerified @hasAccount - core_listManagedResources(envName: String!, search: SearchManagedResources, pq: CursorPaginationIn): ManagedResourcePaginatedRecords @isLoggedInAndVerified @hasAccount - core_getManagedResource(envName: String!, name: String!): ManagedResource @isLoggedInAndVerified @hasAccount - core_resyncManagedResource(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_getManagedResouceOutputKeys(envName: String!, name: String!): [String!]! @isLoggedInAndVerified @hasAccount + core_getManagedResouceOutputKeyValues(envName: String!, keyrefs: [ManagedResourceKeyRefIn]): [ManagedResourceKeyValueRef!]! @isLoggedInAndVerified @hasAccount + core_listManagedResources(envName: String!, search: SearchManagedResources, pq: CursorPaginationIn): ManagedResourcePaginatedRecords @isLoggedInAndVerified @hasAccount + core_getManagedResource(envName: String!, name: String!): ManagedResource @isLoggedInAndVerified @hasAccount + core_resyncManagedResource(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount - # core_listProjectManagedServices(search: SearchProjectManagedService, pq: CursorPaginationIn): ProjectManagedServicePaginatedRecords @isLoggedInAndVerified @hasAccount - # core_getProjectManagedService( name: String!): ProjectManagedService @isLoggedInAndVerified @hasAccount - # core_resyncProjectManagedService(name: String!): Boolean! @isLoggedInAndVerified @hasAccount - # core_restartProjectManagedService(name: String!): Boolean! @isLoggedInAndVerified @hasAccount + # core_listProjectManagedServices(search: SearchProjectManagedService, pq: CursorPaginationIn): ProjectManagedServicePaginatedRecords @isLoggedInAndVerified @hasAccount + # core_getProjectManagedService( name: String!): ProjectManagedService @isLoggedInAndVerified @hasAccount + # core_resyncProjectManagedService(name: String!): Boolean! @isLoggedInAndVerified @hasAccount + # core_restartProjectManagedService(name: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_listVPNDevices(search: CoreSearchVPNDevices, pq: CursorPaginationIn): ConsoleVPNDevicePaginatedRecords @isLoggedInAndVerified @hasAccount - core_listVPNDevicesForUser: [ConsoleVPNDevice!] @isLoggedInAndVerified @hasAccount - core_getVPNDevice(name: String!): ConsoleVPNDevice @isLoggedInAndVerified @hasAccount + core_listVPNDevices(search: CoreSearchVPNDevices, pq: CursorPaginationIn): ConsoleVPNDevicePaginatedRecords @isLoggedInAndVerified @hasAccount + core_listVPNDevicesForUser: [ConsoleVPNDevice!] @isLoggedInAndVerified @hasAccount + core_getVPNDevice(name: String!): ConsoleVPNDevice @isLoggedInAndVerified @hasAccount } type Mutation { - # core_createProject(project: ProjectIn!): Project @isLoggedInAndVerified @hasAccount - # core_updateProject(project: ProjectIn!): Project @isLoggedInAndVerified @hasAccount - # core_deleteProject(name: String!): Boolean! @isLoggedInAndVerified @hasAccount + # core_createProject(project: ProjectIn!): Project @isLoggedInAndVerified @hasAccount + # core_updateProject(project: ProjectIn!): Project @isLoggedInAndVerified @hasAccount + # core_deleteProject(name: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_createEnvironment(env: EnvironmentIn!): Environment @isLoggedInAndVerified @hasAccount - core_updateEnvironment(env: EnvironmentIn!): Environment @isLoggedInAndVerified @hasAccount - core_deleteEnvironment(envName: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_cloneEnvironment(sourceEnvName: String!, destinationEnvName: String!, displayName: String!, environmentRoutingMode: Github__com___kloudlite___operator___apis___crds___v1__EnvironmentRoutingMode!): Environment @isLoggedInAndVerified @hasAccount + core_createEnvironment(env: EnvironmentIn!): Environment @isLoggedInAndVerified @hasAccount + core_updateEnvironment(env: EnvironmentIn!): Environment @isLoggedInAndVerified @hasAccount + core_deleteEnvironment(envName: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_cloneEnvironment(sourceEnvName: String!, destinationEnvName: String!, displayName: String!, environmentRoutingMode: Github__com___kloudlite___operator___apis___crds___v1__EnvironmentRoutingMode!): Environment @isLoggedInAndVerified @hasAccount - # image pull secrets - core_createImagePullSecret(envName: String!, imagePullSecretIn: ImagePullSecretIn!): ImagePullSecret @isLoggedInAndVerified @hasAccount - core_deleteImagePullSecret(envName: String!, secretName: String!): Boolean! @isLoggedInAndVerified @hasAccount + # image pull secrets + core_createImagePullSecret(imagePullSecretIn: ImagePullSecretIn!): ImagePullSecret @isLoggedInAndVerified @hasAccount + core_deleteImagePullSecret(name: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_createApp(envName: String!, app: AppIn!): App @isLoggedInAndVerified @hasAccount - core_updateApp(envName: String!, app: AppIn!): App @isLoggedInAndVerified @hasAccount - core_deleteApp(envName: String!, appName: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_interceptApp(envName: String!, appname: String!, deviceName: String!, intercept: Boolean!): Boolean! @isLoggedInAndVerified @hasAccount + core_createApp(envName: String!, app: AppIn!): App @isLoggedInAndVerified @hasAccount + core_updateApp(envName: String!, app: AppIn!): App @isLoggedInAndVerified @hasAccount + core_deleteApp(envName: String!, appName: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_interceptApp(envName: String!, appname: String!, deviceName: String!, intercept: Boolean!): Boolean! @isLoggedInAndVerified @hasAccount - core_createConfig(envName: String!, config: ConfigIn!): Config @isLoggedInAndVerified @hasAccount - core_updateConfig(envName: String!, config: ConfigIn!): Config @isLoggedInAndVerified @hasAccount - core_deleteConfig(envName: String!, configName: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_createConfig(envName: String!, config: ConfigIn!): Config @isLoggedInAndVerified @hasAccount + core_updateConfig(envName: String!, config: ConfigIn!): Config @isLoggedInAndVerified @hasAccount + core_deleteConfig(envName: String!, configName: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_createSecret(envName: String!, secret: SecretIn!): Secret @isLoggedInAndVerified @hasAccount - core_updateSecret(envName: String!, secret: SecretIn!): Secret @isLoggedInAndVerified @hasAccount - core_deleteSecret(envName: String!, secretName: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_createSecret(envName: String!, secret: SecretIn!): Secret @isLoggedInAndVerified @hasAccount + core_updateSecret(envName: String!, secret: SecretIn!): Secret @isLoggedInAndVerified @hasAccount + core_deleteSecret(envName: String!, secretName: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_createRouter(envName: String!, router: RouterIn!): Router @isLoggedInAndVerified @hasAccount - core_updateRouter(envName: String!, router: RouterIn!): Router @isLoggedInAndVerified @hasAccount - core_deleteRouter(envName: String!, routerName: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_createRouter(envName: String!, router: RouterIn!): Router @isLoggedInAndVerified @hasAccount + core_updateRouter(envName: String!, router: RouterIn!): Router @isLoggedInAndVerified @hasAccount + core_deleteRouter(envName: String!, routerName: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_createManagedResource(envName: String!, mres: ManagedResourceIn!): ManagedResource @isLoggedInAndVerified @hasAccount - core_updateManagedResource(envName: String!, mres: ManagedResourceIn!): ManagedResource @isLoggedInAndVerified @hasAccount - core_deleteManagedResource(envName: String!, mresName: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_createManagedResource(envName: String!, mres: ManagedResourceIn!): ManagedResource @isLoggedInAndVerified @hasAccount + core_updateManagedResource(envName: String!, mres: ManagedResourceIn!): ManagedResource @isLoggedInAndVerified @hasAccount + core_deleteManagedResource(envName: String!, mresName: String!): Boolean! @isLoggedInAndVerified @hasAccount - # core_createProjectManagedService(pmsvc: ProjectManagedServiceIn!): ProjectManagedService @isLoggedInAndVerified @hasAccount - # core_updateProjectManagedService(pmsvc: ProjectManagedServiceIn!): ProjectManagedService @isLoggedInAndVerified @hasAccount - # core_deleteProjectManagedService(pmsvcName: String!): Boolean! @isLoggedInAndVerified @hasAccount + # core_createProjectManagedService(pmsvc: ProjectManagedServiceIn!): ProjectManagedService @isLoggedInAndVerified @hasAccount + # core_updateProjectManagedService(pmsvc: ProjectManagedServiceIn!): ProjectManagedService @isLoggedInAndVerified @hasAccount + # core_deleteProjectManagedService(pmsvcName: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_createVPNDevice(vpnDevice: ConsoleVPNDeviceIn!): ConsoleVPNDevice @isLoggedInAndVerified @hasAccount - core_updateVPNDevice(vpnDevice: ConsoleVPNDeviceIn!): ConsoleVPNDevice @isLoggedInAndVerified @hasAccount + core_createVPNDevice(vpnDevice: ConsoleVPNDeviceIn!): ConsoleVPNDevice @isLoggedInAndVerified @hasAccount + core_updateVPNDevice(vpnDevice: ConsoleVPNDeviceIn!): ConsoleVPNDevice @isLoggedInAndVerified @hasAccount - core_updateVPNDevicePorts(deviceName: String!,ports: [PortIn!]!): Boolean! @isLoggedInAndVerified @hasAccount - core_updateVPNDeviceEnv(deviceName: String!,envName: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_updateVpnDeviceNs(deviceName: String!,ns: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_updateVpnClusterName(deviceName: String!,clusterName: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_updateVPNDevicePorts(deviceName: String!,ports: [PortIn!]!): Boolean! @isLoggedInAndVerified @hasAccount + core_updateVPNDeviceEnv(deviceName: String!,envName: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_updateVpnDeviceNs(deviceName: String!,ns: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_updateVpnClusterName(deviceName: String!,clusterName: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_deleteVPNDevice(deviceName: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_deleteVPNDevice(deviceName: String!): Boolean! @isLoggedInAndVerified @hasAccount } type Build @key(fields: "id") { - id: ID! @isLoggedInAndVerified @hasAccount + id: ID! @isLoggedInAndVerified @hasAccount } extend type App { - build: Build + build: Build } `, BuiltIn: false}, {Name: "../struct-to-graphql/app.graphqls", Input: `type App @shareable { @@ -4986,6 +4978,14 @@ type Github__com___kloudlite___api___pkg___types__SyncStatus @shareable { syncScheduledAt: Date } +type Github__com___kloudlite___operator___apis___common____types__MsvcRef @shareable { + apiVersion: String + clusterName: String! + kind: String + name: String! + namespace: String! +} + type Github__com___kloudlite___operator___apis___crds___v1__AppContainer @shareable { args: [String!] command: [String!] @@ -5022,10 +5022,8 @@ type Github__com___kloudlite___operator___apis___crds___v1__AppSpec @shareable { } type Github__com___kloudlite___operator___apis___crds___v1__AppSvc @shareable { - name: String port: Int! - targetPort: Int - type: String + protocol: String } type Github__com___kloudlite___operator___apis___crds___v1__BasicAuth @shareable { @@ -5116,17 +5114,10 @@ type Github__com___kloudlite___operator___apis___crds___v1__ManagedResourceSpec type Github__com___kloudlite___operator___apis___crds___v1__MresResourceTemplate @shareable { apiVersion: String! kind: String! - msvcRef: Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef! + msvcRef: Github__com___kloudlite___operator___apis___common____types__MsvcRef! spec: Map! } -type Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef @shareable { - apiVersion: String! - kind: String! - name: String! - namespace: String! -} - type Github__com___kloudlite___operator___apis___crds___v1__Probe @shareable { failureThreshold: Int httpGet: Github__com___kloudlite___operator___apis___crds___v1__HttpGetProbe @@ -5287,6 +5278,13 @@ type PageInfo @shareable { startCursor: String } +input Github__com___kloudlite___operator___apis___common____types__MsvcRefIn { + apiVersion: String + kind: String + name: String! + namespace: String! +} + input Github__com___kloudlite___operator___apis___crds___v1__AppContainerIn { args: [String!] command: [String!] @@ -5323,10 +5321,8 @@ input Github__com___kloudlite___operator___apis___crds___v1__AppSpecIn { } input Github__com___kloudlite___operator___apis___crds___v1__AppSvcIn { - name: String port: Int! - targetPort: Int - type: String + protocol: String } input Github__com___kloudlite___operator___apis___crds___v1__BasicAuthIn { @@ -5415,17 +5411,10 @@ input Github__com___kloudlite___operator___apis___crds___v1__ManagedResourceSpec input Github__com___kloudlite___operator___apis___crds___v1__MresResourceTemplateIn { apiVersion: String! kind: String! - msvcRef: Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRefIn! + msvcRef: Github__com___kloudlite___operator___apis___common____types__MsvcRefIn! spec: Map! } -input Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRefIn { - apiVersion: String! - kind: String! - name: String! - namespace: String! -} - input Github__com___kloudlite___operator___apis___crds___v1__ProbeIn { failureThreshold: Int httpGet: Github__com___kloudlite___operator___apis___crds___v1__HttpGetProbeIn @@ -5783,7 +5772,7 @@ input EnvironmentIn { creationTime: Date! displayName: String! dockerConfigJson: String - environmentName: String! + environments: [String!] format: Github__com___kloudlite___api___apps___console___internal___entities__PullSecretFormat! id: ID! lastUpdatedBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! @@ -5811,6 +5800,7 @@ type ImagePullSecretPaginatedRecords @shareable { input ImagePullSecretIn { displayName: String! dockerConfigJson: String + environments: [String!] format: Github__com___kloudlite___api___apps___console___internal___entities__PullSecretFormat! metadata: MetadataIn! registryPassword: String @@ -6225,24 +6215,15 @@ func (ec *executionContext) field_Mutation_core_createEnvironment_args(ctx conte func (ec *executionContext) field_Mutation_core_createImagePullSecret_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["envName"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envName")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["envName"] = arg0 - var arg1 entities.ImagePullSecret + var arg0 entities.ImagePullSecret if tmp, ok := rawArgs["imagePullSecretIn"]; ok { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("imagePullSecretIn")) - arg1, err = ec.unmarshalNImagePullSecretIn2githubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋentitiesᚐImagePullSecret(ctx, tmp) + arg0, err = ec.unmarshalNImagePullSecretIn2githubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋentitiesᚐImagePullSecret(ctx, tmp) if err != nil { return nil, err } } - args["imagePullSecretIn"] = arg1 + args["imagePullSecretIn"] = arg0 return args, nil } @@ -6400,23 +6381,14 @@ func (ec *executionContext) field_Mutation_core_deleteImagePullSecret_args(ctx c var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["envName"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envName")) + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } } - args["envName"] = arg0 - var arg1 string - if tmp, ok := rawArgs["secretName"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("secretName")) - arg1, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["secretName"] = arg1 + args["name"] = arg0 return args, nil } @@ -6949,23 +6921,14 @@ func (ec *executionContext) field_Query_core_getImagePullSecret_args(ctx context var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["envName"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envName")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["envName"] = arg0 - var arg1 string if tmp, ok := rawArgs["name"]; ok { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - arg1, err = ec.unmarshalNString2string(ctx, tmp) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } } - args["name"] = arg1 + args["name"] = arg0 return args, nil } @@ -7221,33 +7184,24 @@ func (ec *executionContext) field_Query_core_listEnvironments_args(ctx context.C func (ec *executionContext) field_Query_core_listImagePullSecrets_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["envName"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envName")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["envName"] = arg0 - var arg1 *model.SearchImagePullSecrets + var arg0 *model.SearchImagePullSecrets if tmp, ok := rawArgs["search"]; ok { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("search")) - arg1, err = ec.unmarshalOSearchImagePullSecrets2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐSearchImagePullSecrets(ctx, tmp) + arg0, err = ec.unmarshalOSearchImagePullSecrets2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐSearchImagePullSecrets(ctx, tmp) if err != nil { return nil, err } } - args["search"] = arg1 - var arg2 *repos.CursorPagination + args["search"] = arg0 + var arg1 *repos.CursorPagination if tmp, ok := rawArgs["pq"]; ok { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pq")) - arg2, err = ec.unmarshalOCursorPaginationIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐCursorPagination(ctx, tmp) + arg1, err = ec.unmarshalOCursorPaginationIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋpkgᚋreposᚐCursorPagination(ctx, tmp) if err != nil { return nil, err } } - args["pq"] = arg2 + args["pq"] = arg1 return args, nil } @@ -7465,23 +7419,14 @@ func (ec *executionContext) field_Query_core_resyncImagePullSecret_args(ctx cont var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["envName"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("envName")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["envName"] = arg0 - var arg1 string if tmp, ok := rawArgs["name"]; ok { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - arg1, err = ec.unmarshalNString2string(ctx, tmp) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } } - args["name"] = arg1 + args["name"] = arg0 return args, nil } @@ -13163,6 +13108,220 @@ func (ec *executionContext) fieldContext_Github__com___kloudlite___api___pkg___t return fc, nil } +func (ec *executionContext) _Github__com___kloudlite___operator___apis___common____types__MsvcRef_apiVersion(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCommonTypesMsvcRef) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___common____types__MsvcRef_apiVersion(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.APIVersion, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___common____types__MsvcRef_apiVersion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___operator___apis___common____types__MsvcRef", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Github__com___kloudlite___operator___apis___common____types__MsvcRef_clusterName(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCommonTypesMsvcRef) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___common____types__MsvcRef_clusterName(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ClusterName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___common____types__MsvcRef_clusterName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___operator___apis___common____types__MsvcRef", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Github__com___kloudlite___operator___apis___common____types__MsvcRef_kind(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCommonTypesMsvcRef) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___common____types__MsvcRef_kind(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Kind, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___common____types__MsvcRef_kind(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___operator___apis___common____types__MsvcRef", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Github__com___kloudlite___operator___apis___common____types__MsvcRef_name(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCommonTypesMsvcRef) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___common____types__MsvcRef_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___common____types__MsvcRef_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___operator___apis___common____types__MsvcRef", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Github__com___kloudlite___operator___apis___common____types__MsvcRef_namespace(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCommonTypesMsvcRef) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___common____types__MsvcRef_namespace(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Namespace, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___common____types__MsvcRef_namespace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Github__com___kloudlite___operator___apis___common____types__MsvcRef", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___v1__AppContainer_args(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCrdsV1AppContainer) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppContainer_args(ctx, field) if err != nil { @@ -14277,14 +14436,10 @@ func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___ap IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "name": - return ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_name(ctx, field) case "port": return ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_port(ctx, field) - case "targetPort": - return ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_targetPort(ctx, field) - case "type": - return ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_type(ctx, field) + case "protocol": + return ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_protocol(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___operator___apis___crds___v1__AppSvc", field.Name) }, @@ -14404,47 +14559,6 @@ func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___ap return fc, nil } -func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___v1__AppSvc_name(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCrdsV1AppSvc) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_name(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Github__com___kloudlite___operator___apis___crds___v1__AppSvc", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___v1__AppSvc_port(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCrdsV1AppSvc) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_port(ctx, field) if err != nil { @@ -14489,8 +14603,8 @@ func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___ap return fc, nil } -func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___v1__AppSvc_targetPort(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCrdsV1AppSvc) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_targetPort(ctx, field) +func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___v1__AppSvc_protocol(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCrdsV1AppSvc) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_protocol(ctx, field) if err != nil { return graphql.Null } @@ -14503,48 +14617,7 @@ func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___ }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.TargetPort, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*int) - fc.Result = res - return ec.marshalOInt2ᚖint(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_targetPort(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Github__com___kloudlite___operator___apis___crds___v1__AppSvc", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___v1__AppSvc_type(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCrdsV1AppSvc) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_type(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Type, nil + return obj.Protocol, nil }) if err != nil { ec.Error(ctx, err) @@ -14558,7 +14631,7 @@ func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___ return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___crds___v1__AppSvc_protocol(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Github__com___kloudlite___operator___apis___crds___v1__AppSvc", Field: field, @@ -16523,9 +16596,9 @@ func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___ } return graphql.Null } - res := resTmp.(*model.GithubComKloudliteOperatorApisCrdsV1MsvcNamedRef) + res := resTmp.(*model.GithubComKloudliteOperatorApisCommonTypesMsvcRef) fc.Result = res - return ec.marshalNGithub__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteOperatorApisCrdsV1MsvcNamedRef(ctx, field.Selections, res) + return ec.marshalNGithub__com___kloudlite___operator___apis___common____types__MsvcRef2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteOperatorApisCommonTypesMsvcRef(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___crds___v1__MresResourceTemplate_msvcRef(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -16537,15 +16610,17 @@ func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___ap Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "apiVersion": - return ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef_apiVersion(ctx, field) + return ec.fieldContext_Github__com___kloudlite___operator___apis___common____types__MsvcRef_apiVersion(ctx, field) + case "clusterName": + return ec.fieldContext_Github__com___kloudlite___operator___apis___common____types__MsvcRef_clusterName(ctx, field) case "kind": - return ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef_kind(ctx, field) + return ec.fieldContext_Github__com___kloudlite___operator___apis___common____types__MsvcRef_kind(ctx, field) case "name": - return ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef_name(ctx, field) + return ec.fieldContext_Github__com___kloudlite___operator___apis___common____types__MsvcRef_name(ctx, field) case "namespace": - return ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef_namespace(ctx, field) + return ec.fieldContext_Github__com___kloudlite___operator___apis___common____types__MsvcRef_namespace(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Github__com___kloudlite___operator___apis___common____types__MsvcRef", field.Name) }, } return fc, nil @@ -16595,182 +16670,6 @@ func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___ap return fc, nil } -func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef_apiVersion(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCrdsV1MsvcNamedRef) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef_apiVersion(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.APIVersion, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef_apiVersion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef_kind(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCrdsV1MsvcNamedRef) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef_kind(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Kind, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef_kind(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef_name(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCrdsV1MsvcNamedRef) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef_name(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef_namespace(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCrdsV1MsvcNamedRef) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef_namespace(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Namespace, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef_namespace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___v1__Probe_failureThreshold(ctx context.Context, field graphql.CollectedField, obj *model.GithubComKloudliteOperatorApisCrdsV1Probe) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Github__com___kloudlite___operator___apis___crds___v1__Probe_failureThreshold(ctx, field) if err != nil { @@ -19637,8 +19536,8 @@ func (ec *executionContext) fieldContext_ImagePullSecret_dockerConfigJson(ctx co return fc, nil } -func (ec *executionContext) _ImagePullSecret_environmentName(ctx context.Context, field graphql.CollectedField, obj *entities.ImagePullSecret) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ImagePullSecret_environmentName(ctx, field) +func (ec *executionContext) _ImagePullSecret_environments(ctx context.Context, field graphql.CollectedField, obj *entities.ImagePullSecret) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ImagePullSecret_environments(ctx, field) if err != nil { return graphql.Null } @@ -19651,24 +19550,21 @@ func (ec *executionContext) _ImagePullSecret_environmentName(ctx context.Context }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.EnvironmentName, nil + return obj.Environments, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.([]string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚕstringᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ImagePullSecret_environmentName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ImagePullSecret_environments(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ImagePullSecret", Field: field, @@ -20284,8 +20180,8 @@ func (ec *executionContext) fieldContext_ImagePullSecretEdge_node(ctx context.Co return ec.fieldContext_ImagePullSecret_displayName(ctx, field) case "dockerConfigJson": return ec.fieldContext_ImagePullSecret_dockerConfigJson(ctx, field) - case "environmentName": - return ec.fieldContext_ImagePullSecret_environmentName(ctx, field) + case "environments": + return ec.fieldContext_ImagePullSecret_environments(ctx, field) case "format": return ec.fieldContext_ImagePullSecret_format(ctx, field) case "id": @@ -23777,7 +23673,7 @@ func (ec *executionContext) _Mutation_core_createImagePullSecret(ctx context.Con resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().CoreCreateImagePullSecret(rctx, fc.Args["envName"].(string), fc.Args["imagePullSecretIn"].(entities.ImagePullSecret)) + return ec.resolvers.Mutation().CoreCreateImagePullSecret(rctx, fc.Args["imagePullSecretIn"].(entities.ImagePullSecret)) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsLoggedInAndVerified == nil { @@ -23834,8 +23730,8 @@ func (ec *executionContext) fieldContext_Mutation_core_createImagePullSecret(ctx return ec.fieldContext_ImagePullSecret_displayName(ctx, field) case "dockerConfigJson": return ec.fieldContext_ImagePullSecret_dockerConfigJson(ctx, field) - case "environmentName": - return ec.fieldContext_ImagePullSecret_environmentName(ctx, field) + case "environments": + return ec.fieldContext_ImagePullSecret_environments(ctx, field) case "format": return ec.fieldContext_ImagePullSecret_format(ctx, field) case "id": @@ -23891,7 +23787,7 @@ func (ec *executionContext) _Mutation_core_deleteImagePullSecret(ctx context.Con resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().CoreDeleteImagePullSecret(rctx, fc.Args["envName"].(string), fc.Args["secretName"].(string)) + return ec.resolvers.Mutation().CoreDeleteImagePullSecret(rctx, fc.Args["name"].(string)) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsLoggedInAndVerified == nil { @@ -26871,7 +26767,7 @@ func (ec *executionContext) _Query_core_listImagePullSecrets(ctx context.Context resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().CoreListImagePullSecrets(rctx, fc.Args["envName"].(string), fc.Args["search"].(*model.SearchImagePullSecrets), fc.Args["pq"].(*repos.CursorPagination)) + return ec.resolvers.Query().CoreListImagePullSecrets(rctx, fc.Args["search"].(*model.SearchImagePullSecrets), fc.Args["pq"].(*repos.CursorPagination)) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsLoggedInAndVerified == nil { @@ -26957,7 +26853,7 @@ func (ec *executionContext) _Query_core_getImagePullSecret(ctx context.Context, resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().CoreGetImagePullSecret(rctx, fc.Args["envName"].(string), fc.Args["name"].(string)) + return ec.resolvers.Query().CoreGetImagePullSecret(rctx, fc.Args["name"].(string)) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsLoggedInAndVerified == nil { @@ -27014,8 +26910,8 @@ func (ec *executionContext) fieldContext_Query_core_getImagePullSecret(ctx conte return ec.fieldContext_ImagePullSecret_displayName(ctx, field) case "dockerConfigJson": return ec.fieldContext_ImagePullSecret_dockerConfigJson(ctx, field) - case "environmentName": - return ec.fieldContext_ImagePullSecret_environmentName(ctx, field) + case "environments": + return ec.fieldContext_ImagePullSecret_environments(ctx, field) case "format": return ec.fieldContext_ImagePullSecret_format(ctx, field) case "id": @@ -27071,7 +26967,7 @@ func (ec *executionContext) _Query_core_resyncImagePullSecret(ctx context.Contex resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().CoreResyncImagePullSecret(rctx, fc.Args["envName"].(string), fc.Args["name"].(string)) + return ec.resolvers.Query().CoreResyncImagePullSecret(rctx, fc.Args["name"].(string)) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsLoggedInAndVerified == nil { @@ -34324,6 +34220,62 @@ func (ec *executionContext) unmarshalInputEnvironmentIn(ctx context.Context, obj return it, nil } +func (ec *executionContext) unmarshalInputGithub__com___kloudlite___operator___apis___common____types__MsvcRefIn(ctx context.Context, obj interface{}) (model.GithubComKloudliteOperatorApisCommonTypesMsvcRefIn, error) { + var it model.GithubComKloudliteOperatorApisCommonTypesMsvcRefIn + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"apiVersion", "kind", "name", "namespace"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "apiVersion": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersion")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.APIVersion = data + case "kind": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Kind = data + case "name": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "namespace": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Namespace = data + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputGithub__com___kloudlite___operator___apis___crds___v1__AppContainerIn(ctx context.Context, obj interface{}) (model.GithubComKloudliteOperatorApisCrdsV1AppContainerIn, error) { var it model.GithubComKloudliteOperatorApisCrdsV1AppContainerIn asMap := map[string]interface{}{} @@ -34625,22 +34577,13 @@ func (ec *executionContext) unmarshalInputGithub__com___kloudlite___operator___a asMap[k] = v } - fieldsInOrder := [...]string{"name", "port", "targetPort", "type"} + fieldsInOrder := [...]string{"port", "protocol"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "name": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.Name = data case "port": var err error @@ -34650,24 +34593,15 @@ func (ec *executionContext) unmarshalInputGithub__com___kloudlite___operator___a return it, err } it.Port = data - case "targetPort": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("targetPort")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) - if err != nil { - return it, err - } - it.TargetPort = data - case "type": + case "protocol": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("type")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("protocol")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Type = data + it.Protocol = data } } @@ -35359,7 +35293,7 @@ func (ec *executionContext) unmarshalInputGithub__com___kloudlite___operator___a var err error ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("msvcRef")) - data, err := ec.unmarshalNGithub__com___kloudlite___operator___apis___crds___v1__MsvcNamedRefIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteOperatorApisCrdsV1MsvcNamedRefIn(ctx, v) + data, err := ec.unmarshalNGithub__com___kloudlite___operator___apis___common____types__MsvcRefIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteOperatorApisCommonTypesMsvcRefIn(ctx, v) if err != nil { return it, err } @@ -35379,62 +35313,6 @@ func (ec *executionContext) unmarshalInputGithub__com___kloudlite___operator___a return it, nil } -func (ec *executionContext) unmarshalInputGithub__com___kloudlite___operator___apis___crds___v1__MsvcNamedRefIn(ctx context.Context, obj interface{}) (model.GithubComKloudliteOperatorApisCrdsV1MsvcNamedRefIn, error) { - var it model.GithubComKloudliteOperatorApisCrdsV1MsvcNamedRefIn - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"apiVersion", "kind", "name", "namespace"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "apiVersion": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("apiVersion")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.APIVersion = data - case "kind": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Kind = data - case "name": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Name = data - case "namespace": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Namespace = data - } - } - - return it, nil -} - func (ec *executionContext) unmarshalInputGithub__com___kloudlite___operator___apis___crds___v1__ProbeIn(ctx context.Context, obj interface{}) (model.GithubComKloudliteOperatorApisCrdsV1ProbeIn, error) { var it model.GithubComKloudliteOperatorApisCrdsV1ProbeIn asMap := map[string]interface{}{} @@ -35919,7 +35797,7 @@ func (ec *executionContext) unmarshalInputImagePullSecretIn(ctx context.Context, asMap[k] = v } - fieldsInOrder := [...]string{"displayName", "dockerConfigJson", "format", "metadata", "registryPassword", "registryURL", "registryUsername"} + fieldsInOrder := [...]string{"displayName", "dockerConfigJson", "environments", "format", "metadata", "registryPassword", "registryURL", "registryUsername"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -35944,6 +35822,15 @@ func (ec *executionContext) unmarshalInputImagePullSecretIn(ctx context.Context, return it, err } it.DockerConfigJson = data + case "environments": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environments")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.Environments = data case "format": var err error @@ -39045,6 +38932,59 @@ func (ec *executionContext) _Github__com___kloudlite___api___pkg___types__SyncSt return out } +var github__com___kloudlite___operator___apis___common____types__MsvcRefImplementors = []string{"Github__com___kloudlite___operator___apis___common____types__MsvcRef"} + +func (ec *executionContext) _Github__com___kloudlite___operator___apis___common____types__MsvcRef(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteOperatorApisCommonTypesMsvcRef) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, github__com___kloudlite___operator___apis___common____types__MsvcRefImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Github__com___kloudlite___operator___apis___common____types__MsvcRef") + case "apiVersion": + out.Values[i] = ec._Github__com___kloudlite___operator___apis___common____types__MsvcRef_apiVersion(ctx, field, obj) + case "clusterName": + out.Values[i] = ec._Github__com___kloudlite___operator___apis___common____types__MsvcRef_clusterName(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "kind": + out.Values[i] = ec._Github__com___kloudlite___operator___apis___common____types__MsvcRef_kind(ctx, field, obj) + case "name": + out.Values[i] = ec._Github__com___kloudlite___operator___apis___common____types__MsvcRef_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "namespace": + out.Values[i] = ec._Github__com___kloudlite___operator___apis___common____types__MsvcRef_namespace(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + var github__com___kloudlite___operator___apis___crds___v1__AppContainerImplementors = []string{"Github__com___kloudlite___operator___apis___crds___v1__AppContainer"} func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___v1__AppContainer(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteOperatorApisCrdsV1AppContainer) graphql.Marshaler { @@ -39225,17 +39165,13 @@ func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___ switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("Github__com___kloudlite___operator___apis___crds___v1__AppSvc") - case "name": - out.Values[i] = ec._Github__com___kloudlite___operator___apis___crds___v1__AppSvc_name(ctx, field, obj) case "port": out.Values[i] = ec._Github__com___kloudlite___operator___apis___crds___v1__AppSvc_port(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "targetPort": - out.Values[i] = ec._Github__com___kloudlite___operator___apis___crds___v1__AppSvc_targetPort(ctx, field, obj) - case "type": - out.Values[i] = ec._Github__com___kloudlite___operator___apis___crds___v1__AppSvc_type(ctx, field, obj) + case "protocol": + out.Values[i] = ec._Github__com___kloudlite___operator___apis___crds___v1__AppSvc_protocol(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -39920,60 +39856,6 @@ func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___ return out } -var github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRefImplementors = []string{"Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef"} - -func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteOperatorApisCrdsV1MsvcNamedRef) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRefImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef") - case "apiVersion": - out.Values[i] = ec._Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef_apiVersion(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "kind": - out.Values[i] = ec._Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef_kind(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "name": - out.Values[i] = ec._Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "namespace": - out.Values[i] = ec._Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef_namespace(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - var github__com___kloudlite___operator___apis___crds___v1__ProbeImplementors = []string{"Github__com___kloudlite___operator___apis___crds___v1__Probe"} func (ec *executionContext) _Github__com___kloudlite___operator___apis___crds___v1__Probe(ctx context.Context, sel ast.SelectionSet, obj *model.GithubComKloudliteOperatorApisCrdsV1Probe) graphql.Marshaler { @@ -40833,11 +40715,8 @@ func (ec *executionContext) _ImagePullSecret(ctx context.Context, sel ast.Select } case "dockerConfigJson": out.Values[i] = ec._ImagePullSecret_dockerConfigJson(ctx, field, obj) - case "environmentName": - out.Values[i] = ec._ImagePullSecret_environmentName(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } + case "environments": + out.Values[i] = ec._ImagePullSecret_environments(ctx, field, obj) case "format": field := field @@ -44541,6 +44420,21 @@ func (ec *executionContext) marshalNGithub__com___kloudlite___api___pkg___types_ return ec._Github__com___kloudlite___api___pkg___types__SyncStatus(ctx, sel, &v) } +func (ec *executionContext) marshalNGithub__com___kloudlite___operator___apis___common____types__MsvcRef2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteOperatorApisCommonTypesMsvcRef(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteOperatorApisCommonTypesMsvcRef) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Github__com___kloudlite___operator___apis___common____types__MsvcRef(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNGithub__com___kloudlite___operator___apis___common____types__MsvcRefIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteOperatorApisCommonTypesMsvcRefIn(ctx context.Context, v interface{}) (*model.GithubComKloudliteOperatorApisCommonTypesMsvcRefIn, error) { + res, err := ec.unmarshalInputGithub__com___kloudlite___operator___apis___common____types__MsvcRefIn(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) marshalNGithub__com___kloudlite___operator___apis___crds___v1__AppContainer2ᚕᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteOperatorApisCrdsV1AppContainerᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.GithubComKloudliteOperatorApisCrdsV1AppContainer) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup @@ -44796,21 +44690,6 @@ func (ec *executionContext) unmarshalNGithub__com___kloudlite___operator___apis_ return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNGithub__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteOperatorApisCrdsV1MsvcNamedRef(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteOperatorApisCrdsV1MsvcNamedRef) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - return ec._Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNGithub__com___kloudlite___operator___apis___crds___v1__MsvcNamedRefIn2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteOperatorApisCrdsV1MsvcNamedRefIn(ctx context.Context, v interface{}) (*model.GithubComKloudliteOperatorApisCrdsV1MsvcNamedRefIn, error) { - res, err := ec.unmarshalInputGithub__com___kloudlite___operator___apis___crds___v1__MsvcNamedRefIn(ctx, v) - return &res, graphql.ErrorOnPath(ctx, err) -} - func (ec *executionContext) marshalNGithub__com___kloudlite___operator___apis___crds___v1__Route2ᚖgithubᚗcomᚋkloudliteᚋapiᚋappsᚋconsoleᚋinternalᚋappᚋgraphᚋmodelᚐGithubComKloudliteOperatorApisCrdsV1Route(ctx context.Context, sel ast.SelectionSet, v *model.GithubComKloudliteOperatorApisCrdsV1Route) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -45913,7 +45792,7 @@ func (ec *executionContext) marshalNfederation__Scope2ᚕᚕstringᚄ(ctx contex return ret } -func (ec *executionContext) unmarshalOAny2interface(ctx context.Context, v interface{}) (any, error) { +func (ec *executionContext) unmarshalOAny2interface(ctx context.Context, v interface{}) (interface{}, error) { if v == nil { return nil, nil } @@ -45921,7 +45800,7 @@ func (ec *executionContext) unmarshalOAny2interface(ctx context.Context, v inter return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalOAny2interface(ctx context.Context, sel ast.SelectionSet, v any) graphql.Marshaler { +func (ec *executionContext) marshalOAny2interface(ctx context.Context, sel ast.SelectionSet, v interface{}) graphql.Marshaler { if v == nil { return graphql.Null } diff --git a/apps/console/internal/app/graph/model/models_gen.go b/apps/console/internal/app/graph/model/models_gen.go index 742597908..1a1ae612f 100644 --- a/apps/console/internal/app/graph/model/models_gen.go +++ b/apps/console/internal/app/graph/model/models_gen.go @@ -84,6 +84,21 @@ type GithubComKloudliteAPIPkgTypesEncodedString struct { Value string `json:"value"` } +type GithubComKloudliteOperatorApisCommonTypesMsvcRef struct { + APIVersion *string `json:"apiVersion,omitempty"` + ClusterName string `json:"clusterName"` + Kind *string `json:"kind,omitempty"` + Name string `json:"name"` + Namespace string `json:"namespace"` +} + +type GithubComKloudliteOperatorApisCommonTypesMsvcRefIn struct { + APIVersion *string `json:"apiVersion,omitempty"` + Kind *string `json:"kind,omitempty"` + Name string `json:"name"` + Namespace string `json:"namespace"` +} + type GithubComKloudliteOperatorApisCrdsV1AppContainer struct { Args []string `json:"args,omitempty"` Command []string `json:"command,omitempty"` @@ -155,17 +170,13 @@ type GithubComKloudliteOperatorApisCrdsV1AppSpecIn struct { } type GithubComKloudliteOperatorApisCrdsV1AppSvc struct { - Name *string `json:"name,omitempty"` - Port int `json:"port"` - TargetPort *int `json:"targetPort,omitempty"` - Type *string `json:"type,omitempty"` + Port int `json:"port"` + Protocol *string `json:"protocol,omitempty"` } type GithubComKloudliteOperatorApisCrdsV1AppSvcIn struct { - Name *string `json:"name,omitempty"` - Port int `json:"port"` - TargetPort *int `json:"targetPort,omitempty"` - Type *string `json:"type,omitempty"` + Port int `json:"port"` + Protocol *string `json:"protocol,omitempty"` } type GithubComKloudliteOperatorApisCrdsV1BasicAuth struct { @@ -339,31 +350,17 @@ type GithubComKloudliteOperatorApisCrdsV1ManagedResourceSpecIn struct { type GithubComKloudliteOperatorApisCrdsV1MresResourceTemplate struct { APIVersion string `json:"apiVersion"` Kind string `json:"kind"` - MsvcRef *GithubComKloudliteOperatorApisCrdsV1MsvcNamedRef `json:"msvcRef"` + MsvcRef *GithubComKloudliteOperatorApisCommonTypesMsvcRef `json:"msvcRef"` Spec map[string]interface{} `json:"spec"` } type GithubComKloudliteOperatorApisCrdsV1MresResourceTemplateIn struct { APIVersion string `json:"apiVersion"` Kind string `json:"kind"` - MsvcRef *GithubComKloudliteOperatorApisCrdsV1MsvcNamedRefIn `json:"msvcRef"` + MsvcRef *GithubComKloudliteOperatorApisCommonTypesMsvcRefIn `json:"msvcRef"` Spec map[string]interface{} `json:"spec"` } -type GithubComKloudliteOperatorApisCrdsV1MsvcNamedRef struct { - APIVersion string `json:"apiVersion"` - Kind string `json:"kind"` - Name string `json:"name"` - Namespace string `json:"namespace"` -} - -type GithubComKloudliteOperatorApisCrdsV1MsvcNamedRefIn struct { - APIVersion string `json:"apiVersion"` - Kind string `json:"kind"` - Name string `json:"name"` - Namespace string `json:"namespace"` -} - type GithubComKloudliteOperatorApisCrdsV1Probe struct { FailureThreshold *int `json:"failureThreshold,omitempty"` HTTPGet *GithubComKloudliteOperatorApisCrdsV1HTTPGetProbe `json:"httpGet,omitempty"` diff --git a/apps/console/internal/app/graph/schema.graphqls b/apps/console/internal/app/graph/schema.graphqls index ecd6eac15..c9951393d 100644 --- a/apps/console/internal/app/graph/schema.graphqls +++ b/apps/console/internal/app/graph/schema.graphqls @@ -3,189 +3,189 @@ directive @isLoggedInAndVerified on FIELD_DEFINITION directive @hasAccount on FIELD_DEFINITION enum ConsoleResType { - app - config - secret - router - managed_service - managed_resource - environment - vpn_device + app + config + secret + router + managed_service + managed_resource + environment + vpn_device } type ConsoleCheckNameAvailabilityOutput @shareable { - result: Boolean! - suggestedNames: [String!] + result: Boolean! + suggestedNames: [String!] } input SearchProjects { - text: MatchFilterIn - isReady: MatchFilterIn - markedForDeletion: MatchFilterIn + text: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn } input SearchImagePullSecrets { - text: MatchFilterIn - isReady: MatchFilterIn - markedForDeletion: MatchFilterIn + text: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn } input SearchEnvironments { - text: MatchFilterIn - isReady: MatchFilterIn - markedForDeletion: MatchFilterIn + text: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn } input SearchApps { - text: MatchFilterIn - isReady: MatchFilterIn - markedForDeletion: MatchFilterIn + text: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn } input SearchConfigs { - text: MatchFilterIn - isReady: MatchFilterIn - markedForDeletion: MatchFilterIn + text: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn } input SearchSecrets { - text: MatchFilterIn - isReady: MatchFilterIn - markedForDeletion: MatchFilterIn + text: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn } input SearchRouters { - text: MatchFilterIn - isReady: MatchFilterIn - markedForDeletion: MatchFilterIn + text: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn } input SearchManagedResources { - text: MatchFilterIn - managedServiceName: MatchFilterIn - isReady: MatchFilterIn - markedForDeletion: MatchFilterIn + text: MatchFilterIn + managedServiceName: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn } input SearchProjectManagedService { - text: MatchFilterIn - managedServiceName: MatchFilterIn - isReady: MatchFilterIn - markedForDeletion: MatchFilterIn + text: MatchFilterIn + managedServiceName: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn } input CoreSearchVPNDevices { - text: MatchFilterIn - isReady: MatchFilterIn - markedForDeletion: MatchFilterIn + text: MatchFilterIn + isReady: MatchFilterIn + markedForDeletion: MatchFilterIn } type Query { - core_checkNameAvailability(envName: String, resType: ConsoleResType!, name: String!): ConsoleCheckNameAvailabilityOutput! @isLoggedIn @hasAccount + core_checkNameAvailability(envName: String, resType: ConsoleResType!, name: String!): ConsoleCheckNameAvailabilityOutput! @isLoggedIn @hasAccount - # core_listProjects(search: SearchProjects, pq: CursorPaginationIn): ProjectPaginatedRecords @isLoggedInAndVerified @hasAccount - # core_getProject(name: String!): Project @isLoggedInAndVerified @hasAccount - # core_resyncProject(name: String!): Boolean! @isLoggedInAndVerified @hasAccount + # core_listProjects(search: SearchProjects, pq: CursorPaginationIn): ProjectPaginatedRecords @isLoggedInAndVerified @hasAccount + # core_getProject(name: String!): Project @isLoggedInAndVerified @hasAccount + # core_resyncProject(name: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_listEnvironments(search: SearchEnvironments, pq: CursorPaginationIn): EnvironmentPaginatedRecords @isLoggedInAndVerified @hasAccount - core_getEnvironment(name: String!): Environment @isLoggedInAndVerified @hasAccount - core_resyncEnvironment(name: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_listEnvironments(search: SearchEnvironments, pq: CursorPaginationIn): EnvironmentPaginatedRecords @isLoggedInAndVerified @hasAccount + core_getEnvironment(name: String!): Environment @isLoggedInAndVerified @hasAccount + core_resyncEnvironment(name: String!): Boolean! @isLoggedInAndVerified @hasAccount - # get image pull secrets - core_listImagePullSecrets(envName: String!, search: SearchImagePullSecrets, pq: CursorPaginationIn): ImagePullSecretPaginatedRecords @isLoggedInAndVerified @hasAccount - core_getImagePullSecret(envName: String!, name: String!): ImagePullSecret @isLoggedInAndVerified @hasAccount - core_resyncImagePullSecret(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount + # get image pull secrets + core_listImagePullSecrets(search: SearchImagePullSecrets, pq: CursorPaginationIn): ImagePullSecretPaginatedRecords @isLoggedInAndVerified @hasAccount + core_getImagePullSecret(name: String!): ImagePullSecret @isLoggedInAndVerified @hasAccount + core_resyncImagePullSecret(name: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_listApps(envName: String!, search: SearchApps, pq: CursorPaginationIn): AppPaginatedRecords @isLoggedInAndVerified @hasAccount - core_getApp(envName: String!, name: String!): App @isLoggedInAndVerified @hasAccount - core_resyncApp(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_restartApp(envName: String!, appName: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_listApps(envName: String!, search: SearchApps, pq: CursorPaginationIn): AppPaginatedRecords @isLoggedInAndVerified @hasAccount + core_getApp(envName: String!, name: String!): App @isLoggedInAndVerified @hasAccount + core_resyncApp(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_restartApp(envName: String!, appName: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_getConfigValues(envName: String!, queries: [ConfigKeyRefIn]): [ConfigKeyValueRef!] @isLoggedInAndVerified @hasAccount - core_listConfigs(envName: String!, search: SearchConfigs, pq: CursorPaginationIn): ConfigPaginatedRecords @isLoggedInAndVerified @hasAccount - core_getConfig(envName: String!, name: String!): Config @isLoggedInAndVerified @hasAccount - core_resyncConfig(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_getConfigValues(envName: String!, queries: [ConfigKeyRefIn]): [ConfigKeyValueRef!] @isLoggedInAndVerified @hasAccount + core_listConfigs(envName: String!, search: SearchConfigs, pq: CursorPaginationIn): ConfigPaginatedRecords @isLoggedInAndVerified @hasAccount + core_getConfig(envName: String!, name: String!): Config @isLoggedInAndVerified @hasAccount + core_resyncConfig(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_getSecretValues(envName: String!, queries: [SecretKeyRefIn!]): [SecretKeyValueRef!] @isLoggedInAndVerified @hasAccount - core_listSecrets(envName: String!, search: SearchSecrets, pq: CursorPaginationIn): SecretPaginatedRecords @isLoggedInAndVerified @hasAccount - core_getSecret(envName: String!, name: String!): Secret @isLoggedInAndVerified @hasAccount - core_resyncSecret(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_getSecretValues(envName: String!, queries: [SecretKeyRefIn!]): [SecretKeyValueRef!] @isLoggedInAndVerified @hasAccount + core_listSecrets(envName: String!, search: SearchSecrets, pq: CursorPaginationIn): SecretPaginatedRecords @isLoggedInAndVerified @hasAccount + core_getSecret(envName: String!, name: String!): Secret @isLoggedInAndVerified @hasAccount + core_resyncSecret(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_listRouters(envName: String!, search: SearchRouters, pq: CursorPaginationIn): RouterPaginatedRecords @isLoggedInAndVerified @hasAccount - core_getRouter(envName: String!, name: String!): Router @isLoggedInAndVerified @hasAccount - core_resyncRouter(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_listRouters(envName: String!, search: SearchRouters, pq: CursorPaginationIn): RouterPaginatedRecords @isLoggedInAndVerified @hasAccount + core_getRouter(envName: String!, name: String!): Router @isLoggedInAndVerified @hasAccount + core_resyncRouter(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_getManagedResouceOutputKeys(envName: String!, name: String!): [String!]! @isLoggedInAndVerified @hasAccount - core_getManagedResouceOutputKeyValues(envName: String!, keyrefs: [ManagedResourceKeyRefIn]): [ManagedResourceKeyValueRef!]! @isLoggedInAndVerified @hasAccount - core_listManagedResources(envName: String!, search: SearchManagedResources, pq: CursorPaginationIn): ManagedResourcePaginatedRecords @isLoggedInAndVerified @hasAccount - core_getManagedResource(envName: String!, name: String!): ManagedResource @isLoggedInAndVerified @hasAccount - core_resyncManagedResource(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_getManagedResouceOutputKeys(envName: String!, name: String!): [String!]! @isLoggedInAndVerified @hasAccount + core_getManagedResouceOutputKeyValues(envName: String!, keyrefs: [ManagedResourceKeyRefIn]): [ManagedResourceKeyValueRef!]! @isLoggedInAndVerified @hasAccount + core_listManagedResources(envName: String!, search: SearchManagedResources, pq: CursorPaginationIn): ManagedResourcePaginatedRecords @isLoggedInAndVerified @hasAccount + core_getManagedResource(envName: String!, name: String!): ManagedResource @isLoggedInAndVerified @hasAccount + core_resyncManagedResource(envName: String!, name: String!): Boolean! @isLoggedInAndVerified @hasAccount - # core_listProjectManagedServices(search: SearchProjectManagedService, pq: CursorPaginationIn): ProjectManagedServicePaginatedRecords @isLoggedInAndVerified @hasAccount - # core_getProjectManagedService( name: String!): ProjectManagedService @isLoggedInAndVerified @hasAccount - # core_resyncProjectManagedService(name: String!): Boolean! @isLoggedInAndVerified @hasAccount - # core_restartProjectManagedService(name: String!): Boolean! @isLoggedInAndVerified @hasAccount + # core_listProjectManagedServices(search: SearchProjectManagedService, pq: CursorPaginationIn): ProjectManagedServicePaginatedRecords @isLoggedInAndVerified @hasAccount + # core_getProjectManagedService( name: String!): ProjectManagedService @isLoggedInAndVerified @hasAccount + # core_resyncProjectManagedService(name: String!): Boolean! @isLoggedInAndVerified @hasAccount + # core_restartProjectManagedService(name: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_listVPNDevices(search: CoreSearchVPNDevices, pq: CursorPaginationIn): ConsoleVPNDevicePaginatedRecords @isLoggedInAndVerified @hasAccount - core_listVPNDevicesForUser: [ConsoleVPNDevice!] @isLoggedInAndVerified @hasAccount - core_getVPNDevice(name: String!): ConsoleVPNDevice @isLoggedInAndVerified @hasAccount + core_listVPNDevices(search: CoreSearchVPNDevices, pq: CursorPaginationIn): ConsoleVPNDevicePaginatedRecords @isLoggedInAndVerified @hasAccount + core_listVPNDevicesForUser: [ConsoleVPNDevice!] @isLoggedInAndVerified @hasAccount + core_getVPNDevice(name: String!): ConsoleVPNDevice @isLoggedInAndVerified @hasAccount } type Mutation { - # core_createProject(project: ProjectIn!): Project @isLoggedInAndVerified @hasAccount - # core_updateProject(project: ProjectIn!): Project @isLoggedInAndVerified @hasAccount - # core_deleteProject(name: String!): Boolean! @isLoggedInAndVerified @hasAccount + # core_createProject(project: ProjectIn!): Project @isLoggedInAndVerified @hasAccount + # core_updateProject(project: ProjectIn!): Project @isLoggedInAndVerified @hasAccount + # core_deleteProject(name: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_createEnvironment(env: EnvironmentIn!): Environment @isLoggedInAndVerified @hasAccount - core_updateEnvironment(env: EnvironmentIn!): Environment @isLoggedInAndVerified @hasAccount - core_deleteEnvironment(envName: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_cloneEnvironment(sourceEnvName: String!, destinationEnvName: String!, displayName: String!, environmentRoutingMode: Github__com___kloudlite___operator___apis___crds___v1__EnvironmentRoutingMode!): Environment @isLoggedInAndVerified @hasAccount + core_createEnvironment(env: EnvironmentIn!): Environment @isLoggedInAndVerified @hasAccount + core_updateEnvironment(env: EnvironmentIn!): Environment @isLoggedInAndVerified @hasAccount + core_deleteEnvironment(envName: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_cloneEnvironment(sourceEnvName: String!, destinationEnvName: String!, displayName: String!, environmentRoutingMode: Github__com___kloudlite___operator___apis___crds___v1__EnvironmentRoutingMode!): Environment @isLoggedInAndVerified @hasAccount - # image pull secrets - core_createImagePullSecret(envName: String!, imagePullSecretIn: ImagePullSecretIn!): ImagePullSecret @isLoggedInAndVerified @hasAccount - core_deleteImagePullSecret(envName: String!, secretName: String!): Boolean! @isLoggedInAndVerified @hasAccount + # image pull secrets + core_createImagePullSecret(imagePullSecretIn: ImagePullSecretIn!): ImagePullSecret @isLoggedInAndVerified @hasAccount + core_deleteImagePullSecret(name: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_createApp(envName: String!, app: AppIn!): App @isLoggedInAndVerified @hasAccount - core_updateApp(envName: String!, app: AppIn!): App @isLoggedInAndVerified @hasAccount - core_deleteApp(envName: String!, appName: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_interceptApp(envName: String!, appname: String!, deviceName: String!, intercept: Boolean!): Boolean! @isLoggedInAndVerified @hasAccount + core_createApp(envName: String!, app: AppIn!): App @isLoggedInAndVerified @hasAccount + core_updateApp(envName: String!, app: AppIn!): App @isLoggedInAndVerified @hasAccount + core_deleteApp(envName: String!, appName: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_interceptApp(envName: String!, appname: String!, deviceName: String!, intercept: Boolean!): Boolean! @isLoggedInAndVerified @hasAccount - core_createConfig(envName: String!, config: ConfigIn!): Config @isLoggedInAndVerified @hasAccount - core_updateConfig(envName: String!, config: ConfigIn!): Config @isLoggedInAndVerified @hasAccount - core_deleteConfig(envName: String!, configName: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_createConfig(envName: String!, config: ConfigIn!): Config @isLoggedInAndVerified @hasAccount + core_updateConfig(envName: String!, config: ConfigIn!): Config @isLoggedInAndVerified @hasAccount + core_deleteConfig(envName: String!, configName: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_createSecret(envName: String!, secret: SecretIn!): Secret @isLoggedInAndVerified @hasAccount - core_updateSecret(envName: String!, secret: SecretIn!): Secret @isLoggedInAndVerified @hasAccount - core_deleteSecret(envName: String!, secretName: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_createSecret(envName: String!, secret: SecretIn!): Secret @isLoggedInAndVerified @hasAccount + core_updateSecret(envName: String!, secret: SecretIn!): Secret @isLoggedInAndVerified @hasAccount + core_deleteSecret(envName: String!, secretName: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_createRouter(envName: String!, router: RouterIn!): Router @isLoggedInAndVerified @hasAccount - core_updateRouter(envName: String!, router: RouterIn!): Router @isLoggedInAndVerified @hasAccount - core_deleteRouter(envName: String!, routerName: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_createRouter(envName: String!, router: RouterIn!): Router @isLoggedInAndVerified @hasAccount + core_updateRouter(envName: String!, router: RouterIn!): Router @isLoggedInAndVerified @hasAccount + core_deleteRouter(envName: String!, routerName: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_createManagedResource(envName: String!, mres: ManagedResourceIn!): ManagedResource @isLoggedInAndVerified @hasAccount - core_updateManagedResource(envName: String!, mres: ManagedResourceIn!): ManagedResource @isLoggedInAndVerified @hasAccount - core_deleteManagedResource(envName: String!, mresName: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_createManagedResource(envName: String!, mres: ManagedResourceIn!): ManagedResource @isLoggedInAndVerified @hasAccount + core_updateManagedResource(envName: String!, mres: ManagedResourceIn!): ManagedResource @isLoggedInAndVerified @hasAccount + core_deleteManagedResource(envName: String!, mresName: String!): Boolean! @isLoggedInAndVerified @hasAccount - # core_createProjectManagedService(pmsvc: ProjectManagedServiceIn!): ProjectManagedService @isLoggedInAndVerified @hasAccount - # core_updateProjectManagedService(pmsvc: ProjectManagedServiceIn!): ProjectManagedService @isLoggedInAndVerified @hasAccount - # core_deleteProjectManagedService(pmsvcName: String!): Boolean! @isLoggedInAndVerified @hasAccount + # core_createProjectManagedService(pmsvc: ProjectManagedServiceIn!): ProjectManagedService @isLoggedInAndVerified @hasAccount + # core_updateProjectManagedService(pmsvc: ProjectManagedServiceIn!): ProjectManagedService @isLoggedInAndVerified @hasAccount + # core_deleteProjectManagedService(pmsvcName: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_createVPNDevice(vpnDevice: ConsoleVPNDeviceIn!): ConsoleVPNDevice @isLoggedInAndVerified @hasAccount - core_updateVPNDevice(vpnDevice: ConsoleVPNDeviceIn!): ConsoleVPNDevice @isLoggedInAndVerified @hasAccount + core_createVPNDevice(vpnDevice: ConsoleVPNDeviceIn!): ConsoleVPNDevice @isLoggedInAndVerified @hasAccount + core_updateVPNDevice(vpnDevice: ConsoleVPNDeviceIn!): ConsoleVPNDevice @isLoggedInAndVerified @hasAccount - core_updateVPNDevicePorts(deviceName: String!,ports: [PortIn!]!): Boolean! @isLoggedInAndVerified @hasAccount - core_updateVPNDeviceEnv(deviceName: String!,envName: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_updateVpnDeviceNs(deviceName: String!,ns: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_updateVpnClusterName(deviceName: String!,clusterName: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_updateVPNDevicePorts(deviceName: String!,ports: [PortIn!]!): Boolean! @isLoggedInAndVerified @hasAccount + core_updateVPNDeviceEnv(deviceName: String!,envName: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_updateVpnDeviceNs(deviceName: String!,ns: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_updateVpnClusterName(deviceName: String!,clusterName: String!): Boolean! @isLoggedInAndVerified @hasAccount - core_deleteVPNDevice(deviceName: String!): Boolean! @isLoggedInAndVerified @hasAccount + core_deleteVPNDevice(deviceName: String!): Boolean! @isLoggedInAndVerified @hasAccount } type Build @key(fields: "id") { - id: ID! @isLoggedInAndVerified @hasAccount + id: ID! @isLoggedInAndVerified @hasAccount } extend type App { - build: Build + build: Build } diff --git a/apps/console/internal/app/graph/schema.resolvers.go b/apps/console/internal/app/graph/schema.resolvers.go index 1ba3feb8a..9c7fb497f 100644 --- a/apps/console/internal/app/graph/schema.resolvers.go +++ b/apps/console/internal/app/graph/schema.resolvers.go @@ -67,22 +67,22 @@ func (r *mutationResolver) CoreCloneEnvironment(ctx context.Context, sourceEnvNa } // CoreCreateImagePullSecret is the resolver for the core_createImagePullSecret field. -func (r *mutationResolver) CoreCreateImagePullSecret(ctx context.Context, envName string, imagePullSecretIn entities.ImagePullSecret) (*entities.ImagePullSecret, error) { +func (r *mutationResolver) CoreCreateImagePullSecret(ctx context.Context, imagePullSecretIn entities.ImagePullSecret) (*entities.ImagePullSecret, error) { cc, err := toConsoleContext(ctx) if err != nil { return nil, errors.NewE(err) } - return r.Domain.CreateImagePullSecret(newResourceContext(cc, envName), imagePullSecretIn) + return r.Domain.CreateImagePullSecret(cc, imagePullSecretIn) } // CoreDeleteImagePullSecret is the resolver for the core_deleteImagePullSecret field. -func (r *mutationResolver) CoreDeleteImagePullSecret(ctx context.Context, envName string, secretName string) (bool, error) { +func (r *mutationResolver) CoreDeleteImagePullSecret(ctx context.Context, name string) (bool, error) { cc, err := toConsoleContext(ctx) if err != nil { return false, errors.NewE(err) } - if err := r.Domain.DeleteImagePullSecret(newResourceContext(cc, envName), secretName); err != nil { + if err := r.Domain.DeleteImagePullSecret(cc, name); err != nil { return false, errors.NewE(err) } return true, nil @@ -400,7 +400,7 @@ func (r *queryResolver) CoreResyncEnvironment(ctx context.Context, name string) } // CoreListImagePullSecrets is the resolver for the infra_listImagePullSecrets field. -func (r *queryResolver) CoreListImagePullSecrets(ctx context.Context, envName string, search *model.SearchImagePullSecrets, pq *repos.CursorPagination) (*model.ImagePullSecretPaginatedRecords, error) { +func (r *queryResolver) CoreListImagePullSecrets(ctx context.Context, search *model.SearchImagePullSecrets, pq *repos.CursorPagination) (*model.ImagePullSecretPaginatedRecords, error) { cc, err := toConsoleContext(ctx) if err != nil { return nil, errors.NewE(err) @@ -418,7 +418,7 @@ func (r *queryResolver) CoreListImagePullSecrets(ctx context.Context, envName st } } - pullSecrets, err := r.Domain.ListImagePullSecrets(newResourceContext(cc, envName), filter, fn.DefaultIfNil(pq, repos.DefaultCursorPagination)) + pullSecrets, err := r.Domain.ListImagePullSecrets(cc, filter, fn.DefaultIfNil(pq, repos.DefaultCursorPagination)) if err != nil { return nil, errors.NewE(err) } @@ -427,22 +427,22 @@ func (r *queryResolver) CoreListImagePullSecrets(ctx context.Context, envName st } // InfraGetImagePullSecret is the resolver for the infra_getImagePullSecret field. -func (r *queryResolver) CoreGetImagePullSecret(ctx context.Context, envName string, name string) (*entities.ImagePullSecret, error) { +func (r *queryResolver) CoreGetImagePullSecret(ctx context.Context, name string) (*entities.ImagePullSecret, error) { cc, err := toConsoleContext(ctx) if err != nil { return nil, errors.NewE(err) } - return r.Domain.GetImagePullSecret(newResourceContext(cc, envName), name) + return r.Domain.GetImagePullSecret(cc, name) } // CoreResyncImagePullSecret is the resolver for the core_resyncImagePullSecret field. -func (r *queryResolver) CoreResyncImagePullSecret(ctx context.Context, envName string, name string) (bool, error) { +func (r *queryResolver) CoreResyncImagePullSecret(ctx context.Context, name string) (bool, error) { cc, err := toConsoleContext(ctx) if err != nil { return false, errors.NewE(err) } - if err := r.Domain.ResyncImagePullSecret(newResourceContext(cc, envName), name); err != nil { + if err := r.Domain.ResyncImagePullSecret(cc, name); err != nil { return false, errors.NewE(err) } return true, nil diff --git a/apps/console/internal/app/graph/struct-to-graphql/common-types.graphqls b/apps/console/internal/app/graph/struct-to-graphql/common-types.graphqls index c3961b97c..cfaecfb58 100644 --- a/apps/console/internal/app/graph/struct-to-graphql/common-types.graphqls +++ b/apps/console/internal/app/graph/struct-to-graphql/common-types.graphqls @@ -18,6 +18,14 @@ type Github__com___kloudlite___api___pkg___types__SyncStatus @shareable { syncScheduledAt: Date } +type Github__com___kloudlite___operator___apis___common____types__MsvcRef @shareable { + apiVersion: String + clusterName: String! + kind: String + name: String! + namespace: String! +} + type Github__com___kloudlite___operator___apis___crds___v1__AppContainer @shareable { args: [String!] command: [String!] @@ -54,10 +62,8 @@ type Github__com___kloudlite___operator___apis___crds___v1__AppSpec @shareable { } type Github__com___kloudlite___operator___apis___crds___v1__AppSvc @shareable { - name: String port: Int! - targetPort: Int - type: String + protocol: String } type Github__com___kloudlite___operator___apis___crds___v1__BasicAuth @shareable { @@ -148,17 +154,10 @@ type Github__com___kloudlite___operator___apis___crds___v1__ManagedResourceSpec type Github__com___kloudlite___operator___apis___crds___v1__MresResourceTemplate @shareable { apiVersion: String! kind: String! - msvcRef: Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef! + msvcRef: Github__com___kloudlite___operator___apis___common____types__MsvcRef! spec: Map! } -type Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRef @shareable { - apiVersion: String! - kind: String! - name: String! - namespace: String! -} - type Github__com___kloudlite___operator___apis___crds___v1__Probe @shareable { failureThreshold: Int httpGet: Github__com___kloudlite___operator___apis___crds___v1__HttpGetProbe @@ -319,6 +318,13 @@ type PageInfo @shareable { startCursor: String } +input Github__com___kloudlite___operator___apis___common____types__MsvcRefIn { + apiVersion: String + kind: String + name: String! + namespace: String! +} + input Github__com___kloudlite___operator___apis___crds___v1__AppContainerIn { args: [String!] command: [String!] @@ -355,10 +361,8 @@ input Github__com___kloudlite___operator___apis___crds___v1__AppSpecIn { } input Github__com___kloudlite___operator___apis___crds___v1__AppSvcIn { - name: String port: Int! - targetPort: Int - type: String + protocol: String } input Github__com___kloudlite___operator___apis___crds___v1__BasicAuthIn { @@ -447,17 +451,10 @@ input Github__com___kloudlite___operator___apis___crds___v1__ManagedResourceSpec input Github__com___kloudlite___operator___apis___crds___v1__MresResourceTemplateIn { apiVersion: String! kind: String! - msvcRef: Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRefIn! + msvcRef: Github__com___kloudlite___operator___apis___common____types__MsvcRefIn! spec: Map! } -input Github__com___kloudlite___operator___apis___crds___v1__MsvcNamedRefIn { - apiVersion: String! - kind: String! - name: String! - namespace: String! -} - input Github__com___kloudlite___operator___apis___crds___v1__ProbeIn { failureThreshold: Int httpGet: Github__com___kloudlite___operator___apis___crds___v1__HttpGetProbeIn diff --git a/apps/console/internal/app/graph/struct-to-graphql/imagepullsecret.graphqls b/apps/console/internal/app/graph/struct-to-graphql/imagepullsecret.graphqls index 4f8a2be67..fc608aa13 100644 --- a/apps/console/internal/app/graph/struct-to-graphql/imagepullsecret.graphqls +++ b/apps/console/internal/app/graph/struct-to-graphql/imagepullsecret.graphqls @@ -4,7 +4,7 @@ type ImagePullSecret @shareable { creationTime: Date! displayName: String! dockerConfigJson: String - environmentName: String! + environments: [String!] format: Github__com___kloudlite___api___apps___console___internal___entities__PullSecretFormat! id: ID! lastUpdatedBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! @@ -32,6 +32,7 @@ type ImagePullSecretPaginatedRecords @shareable { input ImagePullSecretIn { displayName: String! dockerConfigJson: String + environments: [String!] format: Github__com___kloudlite___api___apps___console___internal___entities__PullSecretFormat! metadata: MetadataIn! registryPassword: String diff --git a/apps/console/internal/app/process-resource-updates.go b/apps/console/internal/app/process-resource-updates.go index b73280503..574159428 100644 --- a/apps/console/internal/app/process-resource-updates.go +++ b/apps/console/internal/app/process-resource-updates.go @@ -29,7 +29,6 @@ func newResourceContext(ctx domain.ConsoleContext, environmentName string) domai } var ( - //projectGVK = fn.GVK("crds.kloudlite.io/v1", "Project") appsGVK = fn.GVK("crds.kloudlite.io/v1", "App") environmentGVK = fn.GVK("crds.kloudlite.io/v1", "Environment") deviceGVK = fn.GVK("wireguard.kloudlite.io/v1", "Device") @@ -241,20 +240,20 @@ func ProcessResourceUpdates(consumer ResourceUpdateConsumer, d domain.Domain, lo return errors.NewE(err) } - rctx, err := getResourceContext(dctx, entities.ResourceTypeSecret, ru.ClusterName, obj) - if err != nil { - return errors.NewE(err) - } - if secret.Type == corev1.SecretTypeDockerConfigJson { // secret is an image pull secret ips := entities.ImagePullSecret{ ObjectMeta: secret.ObjectMeta, } if resStatus == types.ResourceStatusDeleted { - return d.OnImagePullSecretDeleteMessage(rctx, ips) + return d.OnImagePullSecretDeleteMessage(dctx, ips) } - return d.OnImagePullSecretUpdateMessage(rctx, ips, resStatus, opts) + return d.OnImagePullSecretUpdateMessage(dctx, ips, resStatus, opts) + } + + rctx, err := getResourceContext(dctx, entities.ResourceTypeSecret, ru.ClusterName, obj) + if err != nil { + return errors.NewE(err) } if resStatus == types.ResourceStatusDeleted { diff --git a/apps/console/internal/domain/api.go b/apps/console/internal/domain/api.go index 618331317..8d0b1c1a7 100644 --- a/apps/console/internal/domain/api.go +++ b/apps/console/internal/domain/api.go @@ -217,16 +217,16 @@ type Domain interface { ResyncManagedResource(ctx ResourceContext, name string) error // image pull secrets - ListImagePullSecrets(ctx ResourceContext, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.ImagePullSecret], error) - GetImagePullSecret(ctx ResourceContext, name string) (*entities.ImagePullSecret, error) - CreateImagePullSecret(ctx ResourceContext, secret entities.ImagePullSecret) (*entities.ImagePullSecret, error) - DeleteImagePullSecret(ctx ResourceContext, name string) error + ListImagePullSecrets(ctx ConsoleContext, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.ImagePullSecret], error) + GetImagePullSecret(ctx ConsoleContext, name string) (*entities.ImagePullSecret, error) + CreateImagePullSecret(ctx ConsoleContext, secret entities.ImagePullSecret) (*entities.ImagePullSecret, error) + DeleteImagePullSecret(ctx ConsoleContext, name string) error - OnImagePullSecretApplyError(ctx ResourceContext, errMsg string, name string, opts UpdateAndDeleteOpts) error - OnImagePullSecretDeleteMessage(ctx ResourceContext, ips entities.ImagePullSecret) error - OnImagePullSecretUpdateMessage(ctx ResourceContext, ips entities.ImagePullSecret, status types.ResourceStatus, opts UpdateAndDeleteOpts) error + OnImagePullSecretApplyError(ctx ConsoleContext, errMsg string, name string, opts UpdateAndDeleteOpts) error + OnImagePullSecretDeleteMessage(ctx ConsoleContext, ips entities.ImagePullSecret) error + OnImagePullSecretUpdateMessage(ctx ConsoleContext, ips entities.ImagePullSecret, status types.ResourceStatus, opts UpdateAndDeleteOpts) error - ResyncImagePullSecret(ctx ResourceContext, name string) error + ResyncImagePullSecret(ctx ConsoleContext, name string) error GetEnvironmentResourceMapping(ctx ConsoleContext, resType entities.ResourceType, clusterName string, namespace string, name string) (*entities.ResourceMapping, error) //GetProjectResourceMapping(ctx ConsoleContext, resType entities.ResourceType, clusterName string, namespace string, name string) (*entities.ResourceMapping, error) diff --git a/apps/console/internal/domain/domain.go b/apps/console/internal/domain/domain.go index b94c03ca7..6260e1013 100644 --- a/apps/console/internal/domain/domain.go +++ b/apps/console/internal/domain/domain.go @@ -400,25 +400,6 @@ func (d *domain) canReadSecretsFromAccount(ctx context.Context, userId string, a return nil } -//func (d *domain) checkProjectAccess(ctx ConsoleContext, projectName string, action iamT.Action) error { -// co, err := d.iamClient.Can(ctx, &iam.CanIn{ -// UserId: string(ctx.UserId), -// ResourceRefs: []string{ -// iamT.NewResourceRef(ctx.AccountName, iamT.ResourceAccount, ctx.AccountName), -// iamT.NewResourceRef(ctx.AccountName, iamT.ResourceProject, projectName), -// }, -// Action: string(action), -// }) -// if err != nil { -// return errors.NewE(err) -// } -// -// if !co.Status { -// return errors.Newf("unauthorized to access project %q", projectName) -// } -// return nil -//} - func (d *domain) checkEnvironmentAccess(ctx ResourceContext, action iamT.Action) error { co, err := d.iamClient.Can(ctx, &iam.CanIn{ UserId: string(ctx.UserId), diff --git a/apps/console/internal/domain/environment.go b/apps/console/internal/domain/environment.go index 32988bb56..c11861555 100644 --- a/apps/console/internal/domain/environment.go +++ b/apps/console/internal/domain/environment.go @@ -114,6 +114,12 @@ func (d *domain) ListEnvironments(ctx ConsoleContext, search map[string]repos.Ma return d.environmentRepo.FindPaginated(ctx, d.environmentRepo.MergeMatchFilters(filter, search), pq) } +func (d *domain) listEnvironments(ctx ConsoleContext) ([]*entities.Environment, error) { + return d.environmentRepo.Find(ctx, repos.Query{ + Filter: repos.Filter{fields.AccountName: ctx.AccountName}, + }) +} + func (d *domain) findEnvironmentByTargetNs(ctx ConsoleContext, targetNs string) (*entities.Environment, error) { w, err := d.environmentRepo.FindOne(ctx, repos.Filter{ fields.AccountName: ctx.AccountName, diff --git a/apps/console/internal/domain/image-pull-secret.go b/apps/console/internal/domain/image-pull-secret.go index 4fbcbe8ae..328f22bac 100644 --- a/apps/console/internal/domain/image-pull-secret.go +++ b/apps/console/internal/domain/image-pull-secret.go @@ -4,10 +4,11 @@ import ( "encoding/base64" "encoding/json" + iamT "github.com/kloudlite/api/apps/iam/types" + "github.com/kloudlite/api/apps/console/internal/entities" fc "github.com/kloudlite/api/apps/console/internal/entities/field-constants" "github.com/kloudlite/api/common" - "github.com/kloudlite/api/common/fields" "github.com/kloudlite/api/pkg/errors" "github.com/kloudlite/api/pkg/repos" t "github.com/kloudlite/api/pkg/types" @@ -17,21 +18,16 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -func (d *domain) ListImagePullSecrets(ctx ResourceContext, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.ImagePullSecret], error) { - if err := d.canReadResourcesInEnvironment(ctx); err != nil { +func (d *domain) ListImagePullSecrets(ctx ConsoleContext, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.ImagePullSecret], error) { + if err := d.canPerformActionInAccount(ctx, iamT.ListImagePullSecrets); err != nil { return nil, errors.NewE(err) } - filters := ctx.DBFilters() - - return d.pullSecretsRepo.FindPaginated(ctx, d.pullSecretsRepo.MergeMatchFilters(filters, search), pagination) + return d.pullSecretsRepo.FindPaginated(ctx, d.pullSecretsRepo.MergeMatchFilters(entities.FilterListImagePullSecret(ctx.AccountName), search), pagination) } -func (d *domain) findImagePullSecret(ctx ResourceContext, name string) (*entities.ImagePullSecret, error) { - ips, err := d.pullSecretsRepo.FindOne( - ctx, - ctx.DBFilters().Add(fields.MetadataName, name), - ) +func (d *domain) findImagePullSecret(ctx ConsoleContext, name string) (*entities.ImagePullSecret, error) { + ips, err := d.pullSecretsRepo.FindOne(ctx, entities.FilterUniqueImagePullSecret(ctx.AccountName, name)) if err != nil { return nil, errors.NewE(err) } @@ -42,11 +38,10 @@ func (d *domain) findImagePullSecret(ctx ResourceContext, name string) (*entitie return ips, nil } -func (d *domain) GetImagePullSecret(ctx ResourceContext, name string) (*entities.ImagePullSecret, error) { - if err := d.canReadResourcesInEnvironment(ctx); err != nil { +func (d *domain) GetImagePullSecret(ctx ConsoleContext, name string) (*entities.ImagePullSecret, error) { + if err := d.canPerformActionInAccount(ctx, iamT.GetImagePullSecret); err != nil { return nil, errors.NewE(err) } - return d.findImagePullSecret(ctx, name) } @@ -93,8 +88,8 @@ func generateImagePullSecret(ips entities.ImagePullSecret) (corev1.Secret, error return secret, nil } -func (d *domain) CreateImagePullSecret(ctx ResourceContext, ips entities.ImagePullSecret) (*entities.ImagePullSecret, error) { - if err := d.canMutateResourcesInEnvironment(ctx); err != nil { +func (d *domain) CreateImagePullSecret(ctx ConsoleContext, ips entities.ImagePullSecret) (*entities.ImagePullSecret, error) { + if err := d.canPerformActionInAccount(ctx, iamT.CreateImagePullSecret); err != nil { return nil, errors.NewE(err) } @@ -102,13 +97,6 @@ func (d *domain) CreateImagePullSecret(ctx ResourceContext, ips entities.ImagePu return nil, errors.NewE(err) } - env, err := d.findEnvironment(ctx.ConsoleContext, ctx.EnvironmentName) - if err != nil { - return nil, errors.NewE(err) - } - - ips.Namespace = env.Spec.TargetNamespace - ips.IncrementRecordVersion() ips.CreatedBy = common.CreatedOrUpdatedBy{ @@ -119,19 +107,15 @@ func (d *domain) CreateImagePullSecret(ctx ResourceContext, ips entities.ImagePu ips.LastUpdatedBy = ips.CreatedBy ips.AccountName = ctx.AccountName - ips.EnvironmentName = ctx.EnvironmentName + ips.Environments = []string{"*"} ips.SyncStatus = t.GenSyncStatus(t.SyncActionApply, ips.RecordVersion) pullSecret, err := generateImagePullSecret(ips) if err != nil { - return nil, errors.NewEf(err, "failed to create a valid kubernetes secret") + return nil, errors.NewEf(err, "failed to create a valid kubernetes ips") } ips.GeneratedK8sSecret = pullSecret - if _, err := d.upsertEnvironmentResourceMapping(ctx, &ips); err != nil { - return nil, errors.NewE(err) - } - nips, err := d.pullSecretsRepo.Create(ctx, &ips) if err != nil { if d.pullSecretsRepo.ErrAlreadyExists(err) { @@ -141,17 +125,83 @@ func (d *domain) CreateImagePullSecret(ctx ResourceContext, ips entities.ImagePu return nil, errors.NewE(err) } - d.resourceEventPublisher.PublishResourceEvent(ctx, entities.ResourceTypeImagePullSecret, nips.Name, PublishAdd) + d.resourceEventPublisher.PublishConsoleEvent(ctx, entities.ResourceTypeImagePullSecret, nips.Name, PublishAdd) - if err := d.applyK8sResource(ctx, nips.EnvironmentName, &pullSecret, nips.RecordVersion); err != nil { - return nil, errors.NewE(err) + if err := d.applyImagePullSecret(ctx, nips); err != nil { + return nil, err } return nips, nil } -func (d *domain) UpdateImagePullSecret(ctx ResourceContext, ips entities.ImagePullSecret) (*entities.ImagePullSecret, error) { - if err := d.canMutateResourcesInEnvironment(ctx); err != nil { +func (d *domain) applyImagePullSecret(ctx ConsoleContext, ips *entities.ImagePullSecret) error { + environments := ips.Environments + + allEnvironments := false + for i := range ips.Environments { + if ips.Environments[i] == "*" { + allEnvironments = true + break + } + } + + if allEnvironments { + envs, err := d.listEnvironments(ctx) + if err != nil { + return err + } + for i := range envs { + environments = append(environments, envs[i].Name) + } + } + + for i := range environments { + if err := d.applyK8sResource(ctx, environments[i], &ips.GeneratedK8sSecret, ips.RecordVersion); err != nil { + return err + } + } + + return nil +} + +func (d *domain) deleteImagePullSecret(ctx ConsoleContext, ips *entities.ImagePullSecret) error { + environments := ips.Environments + + allEnvironments := false + for i := range ips.Environments { + if ips.Environments[i] == "*" { + allEnvironments = true + break + } + } + + if allEnvironments { + envs, err := d.listEnvironments(ctx) + if err != nil { + return err + } + for i := range envs { + environments = append(environments, envs[i].Name) + } + } + + for i := range environments { + if err := d.deleteK8sResource(ctx, environments[i], &corev1.Secret{ + TypeMeta: v1.TypeMeta{APIVersion: "v1", Kind: "Secret"}, + ObjectMeta: v1.ObjectMeta{Name: ips.Name, Namespace: ips.Namespace}, + }); err != nil { + if errors.Is(err, ErrNoClusterAttached) { + return d.pullSecretsRepo.DeleteById(ctx, ips.Id) + } + return err + } + } + + return nil +} + +func (d *domain) UpdateImagePullSecret(ctx ConsoleContext, ips entities.ImagePullSecret) (*entities.ImagePullSecret, error) { + if err := d.canPerformActionInAccount(ctx, iamT.UpdateImagePullSecret); err != nil { return nil, errors.NewE(err) } @@ -173,66 +223,59 @@ func (d *domain) UpdateImagePullSecret(ctx ResourceContext, ips entities.ImagePu return nil, errors.NewE(err) } - patchForUpdate := common.PatchForUpdate( - ctx, - &ips, - common.PatchOpts{ - XPatch: repos.Document{ - fc.ImagePullSecretFormat: ips.Format, - fc.ImagePullSecretDockerConfigJson: ips.DockerConfigJson, - fc.ImagePullSecretRegistryURL: ips.RegistryURL, - fc.ImagePullSecretRegistryUsername: ips.RegistryUsername, - fc.ImagePullSecretRegistryPassword: ips.RegistryPassword, - fc.ImagePullSecretGeneratedK8sSecret: pullSecret, - }, - }, - ) - upIps, err := d.pullSecretsRepo.Patch( - ctx, - ctx.DBFilters().Add(fields.MetadataName, ips.Name), - patchForUpdate, - ) - if err != nil { - return nil, errors.NewE(err) + patch := repos.Document{ + fc.ImagePullSecretFormat: ips.Format, + fc.ImagePullSecretDockerConfigJson: ips.DockerConfigJson, + fc.ImagePullSecretRegistryURL: ips.RegistryURL, + fc.ImagePullSecretRegistryUsername: ips.RegistryUsername, + fc.ImagePullSecretRegistryPassword: ips.RegistryPassword, + fc.ImagePullSecretGeneratedK8sSecret: pullSecret, } - d.resourceEventPublisher.PublishResourceEvent(ctx, entities.ResourceTypeImagePullSecret, upIps.Name, PublishUpdate) - if err := d.applyK8sResource(ctx, upIps.EnvironmentName, &pullSecret, upIps.RecordVersion); err != nil { + if ips.Environments != nil { + patch[fc.ImagePullSecretEnvironments] = ips.Environments + } + + patchForUpdate := common.PatchForUpdate(ctx, &ips, common.PatchOpts{XPatch: patch}) + upIps, err := d.pullSecretsRepo.Patch(ctx, entities.FilterUniqueImagePullSecret(ctx.AccountName, ips.Name), patchForUpdate) + if err != nil { return nil, errors.NewE(err) } + d.resourceEventPublisher.PublishConsoleEvent(ctx, entities.ResourceTypeImagePullSecret, upIps.Name, PublishUpdate) + return upIps, errors.NewE(err) } -func (d *domain) DeleteImagePullSecret(ctx ResourceContext, name string) error { - if err := d.canMutateResourcesInEnvironment(ctx); err != nil { +func (d *domain) DeleteImagePullSecret(ctx ConsoleContext, name string) error { + if err := d.canPerformActionInAccount(ctx, iamT.DeleteImagePullSecret); err != nil { return errors.NewE(err) } - uips, err := d.pullSecretsRepo.Patch( - ctx, - ctx.DBFilters().Add(fields.MetadataName, name), - common.PatchForMarkDeletion(), - ) + uips, err := d.pullSecretsRepo.Patch(ctx, entities.FilterUniqueImagePullSecret(ctx.AccountName, name), common.PatchForMarkDeletion()) if err != nil { return errors.NewE(err) } - d.resourceEventPublisher.PublishResourceEvent(ctx, entities.ResourceTypeApp, uips.Name, PublishUpdate) + d.resourceEventPublisher.PublishConsoleEvent(ctx, entities.ResourceTypeImagePullSecret, uips.Name, PublishUpdate) - if err := d.deleteK8sResource(ctx, "", &corev1.Secret{ - TypeMeta: v1.TypeMeta{APIVersion: "v1", Kind: "Secret"}, - ObjectMeta: v1.ObjectMeta{Name: uips.Name, Namespace: uips.Namespace}, - }); err != nil { - if errors.Is(err, ErrNoClusterAttached) { - return d.pullSecretsRepo.DeleteById(ctx, uips.Id) - } + if err := d.deleteImagePullSecret(ctx, uips); err != nil { return err } + + //if err := d.deleteK8sResource(ctx, "", &corev1.Secret{ + // TypeMeta: v1.TypeMeta{APIVersion: "v1", Kind: "Secret"}, + // ObjectMeta: v1.ObjectMeta{Name: uips.Name, Namespace: uips.Namespace}, + //}); err != nil { + // if errors.Is(err, ErrNoClusterAttached) { + // return d.pullSecretsRepo.DeleteById(ctx, uips.Id) + // } + // return err + //} return nil } -func (d *domain) OnImagePullSecretUpdateMessage(ctx ResourceContext, ips entities.ImagePullSecret, status types.ResourceStatus, opts UpdateAndDeleteOpts) error { +func (d *domain) OnImagePullSecretUpdateMessage(ctx ConsoleContext, ips entities.ImagePullSecret, status types.ResourceStatus, opts UpdateAndDeleteOpts) error { xips, err := d.findImagePullSecret(ctx, ips.Name) if err != nil { return errors.NewE(err) @@ -244,7 +287,7 @@ func (d *domain) OnImagePullSecretUpdateMessage(ctx ResourceContext, ips entitie recordVersion, err := d.MatchRecordVersion(ips.Annotations, xips.RecordVersion) if err != nil { - return d.resyncK8sResource(ctx, xips.EnvironmentName, xips.SyncStatus.Action, &xips.GeneratedK8sSecret, xips.RecordVersion) + return err } uips, err := d.pullSecretsRepo.PatchById( @@ -257,26 +300,23 @@ func (d *domain) OnImagePullSecretUpdateMessage(ctx ResourceContext, ips entitie return err } - d.resourceEventPublisher.PublishResourceEvent(ctx, uips.GetResourceType(), uips.GetName(), PublishUpdate) + d.resourceEventPublisher.PublishConsoleEvent(ctx, ips.GetResourceType(), uips.GetName(), PublishUpdate) return errors.NewE(err) } -func (d *domain) OnImagePullSecretDeleteMessage(ctx ResourceContext, ips entities.ImagePullSecret) error { - err := d.pullSecretsRepo.DeleteOne( - ctx, - ctx.DBFilters().Add(fields.MetadataName, ips.Name), - ) +func (d *domain) OnImagePullSecretDeleteMessage(ctx ConsoleContext, ips entities.ImagePullSecret) error { + err := d.pullSecretsRepo.DeleteOne(ctx, entities.FilterUniqueImagePullSecret(ctx.AccountName, ips.Name)) if err != nil { return errors.NewE(err) } - d.resourceEventPublisher.PublishResourceEvent(ctx, entities.ResourceTypeImagePullSecret, ips.Name, PublishDelete) + d.resourceEventPublisher.PublishConsoleEvent(ctx, ips.GetResourceType(), ips.Name, PublishDelete) return nil } -func (d *domain) OnImagePullSecretApplyError(ctx ResourceContext, errMsg string, name string, opts UpdateAndDeleteOpts) error { +func (d *domain) OnImagePullSecretApplyError(ctx ConsoleContext, errMsg string, name string, opts UpdateAndDeleteOpts) error { uips, err := d.pullSecretsRepo.Patch( ctx, - ctx.DBFilters().Add(fields.MetadataName, name), + entities.FilterUniqueImagePullSecret(ctx.AccountName, name), common.PatchForErrorFromAgent( errMsg, common.PatchOpts{ @@ -287,18 +327,20 @@ func (d *domain) OnImagePullSecretApplyError(ctx ResourceContext, errMsg string, if err != nil { return err } - d.resourceEventPublisher.PublishResourceEvent(ctx, entities.ResourceTypeImagePullSecret, uips.Name, PublishDelete) + d.resourceEventPublisher.PublishConsoleEvent(ctx, entities.ResourceTypeImagePullSecret, uips.Name, PublishDelete) return nil } -func (d *domain) ResyncImagePullSecret(ctx ResourceContext, name string) error { - if err := d.canMutateResourcesInEnvironment(ctx); err != nil { - return errors.NewE(err) - } - - xips, err := d.findImagePullSecret(ctx, name) - if err != nil { - return errors.NewE(err) - } - return d.resyncK8sResource(ctx, xips.EnvironmentName, xips.SyncStatus.Action, &xips.GeneratedK8sSecret, xips.RecordVersion) +func (d *domain) ResyncImagePullSecret(ctx ConsoleContext, name string) error { + return errors.Newf("not implemented") + // if err := d.canPerformActionInAccount(ctx, iamT.DeleteImagePullSecret); err != nil { + // return errors.NewE(err) + // } + // + // xips, err := d.findImagePullSecret(ctx, name) + // if err != nil { + // return errors.NewE(err) + // } + // + // return d.resyncK8sResource(ctx, xips.EnvironmentName, xips.SyncStatus.Action, &xips.GeneratedK8sSecret, xips.RecordVersion) } diff --git a/apps/console/internal/entities/field-constants/generated_constants.go b/apps/console/internal/entities/field-constants/generated_constants.go index e7c0bc86d..288f05781 100644 --- a/apps/console/internal/entities/field-constants/generated_constants.go +++ b/apps/console/internal/entities/field-constants/generated_constants.go @@ -64,6 +64,7 @@ const ( // constant vars generated for struct ImagePullSecret const ( ImagePullSecretDockerConfigJson = "dockerConfigJson" + ImagePullSecretEnvironments = "environments" ImagePullSecretFormat = "format" ImagePullSecretGeneratedK8sSecret = "generatedK8sSecret" ImagePullSecretRegistryPassword = "registryPassword" @@ -84,9 +85,11 @@ const ( ManagedResourceSpecResourceTemplateKind = "spec.resourceTemplate.kind" ManagedResourceSpecResourceTemplateMsvcRef = "spec.resourceTemplate.msvcRef" ManagedResourceSpecResourceTemplateMsvcRefApiVersion = "spec.resourceTemplate.msvcRef.apiVersion" + ManagedResourceSpecResourceTemplateMsvcRefClusterName = "spec.resourceTemplate.msvcRef.clusterName" ManagedResourceSpecResourceTemplateMsvcRefKind = "spec.resourceTemplate.msvcRef.kind" ManagedResourceSpecResourceTemplateMsvcRefName = "spec.resourceTemplate.msvcRef.name" ManagedResourceSpecResourceTemplateMsvcRefNamespace = "spec.resourceTemplate.msvcRef.namespace" + ManagedResourceSpecResourceTemplateMsvcRefSharedSecret = "spec.resourceTemplate.msvcRef.sharedSecret" ManagedResourceSpecResourceTemplateSpec = "spec.resourceTemplate.spec" ManagedResourceSyncedOutputSecretRef = "syncedOutputSecretRef" ManagedResourceSyncedOutputSecretRefApiVersion = "syncedOutputSecretRef.apiVersion" diff --git a/apps/console/internal/entities/image-pull-secret.go b/apps/console/internal/entities/image-pull-secret.go index d0c3c4987..5879e8a98 100644 --- a/apps/console/internal/entities/image-pull-secret.go +++ b/apps/console/internal/entities/image-pull-secret.go @@ -2,6 +2,8 @@ package entities import ( "fmt" + fc "github.com/kloudlite/api/apps/console/internal/entities/field-constants" + "github.com/kloudlite/api/common" "github.com/kloudlite/api/common/fields" "github.com/kloudlite/api/pkg/repos" @@ -22,6 +24,8 @@ type ImagePullSecret struct { repos.BaseEntity `json:",inline" graphql:"noinput"` metav1.ObjectMeta `json:"metadata"` + common.ResourceMetadata `json:",inline"` + Format PullSecretFormat `json:"format"` DockerConfigJson *string `json:"dockerConfigJson,omitempty"` @@ -31,11 +35,11 @@ type ImagePullSecret struct { GeneratedK8sSecret corev1.Secret `json:"generatedK8sSecret,omitempty" graphql:"ignore" struct-json-path:",ignore-nesting"` - AccountName string `json:"accountName" graphql:"noinput"` - EnvironmentName string `json:"environmentName" graphql:"noinput"` + AccountName string `json:"accountName" graphql:"noinput"` - common.ResourceMetadata `json:",inline"` - SyncStatus t.SyncStatus `json:"syncStatus" graphql:"noinput"` + Environments []string `json:"environments,omitempty"` + + SyncStatus t.SyncStatus `json:"syncStatus" graphql:"noinput"` } func (ips *ImagePullSecret) GetDisplayName() string { @@ -80,8 +84,15 @@ var ImagePullSecretIndexes = []repos.IndexField{ {Key: fields.MetadataName, Value: repos.IndexAsc}, {Key: fields.MetadataNamespace, Value: repos.IndexAsc}, {Key: fields.AccountName, Value: repos.IndexAsc}, - {Key: fields.EnvironmentName, Value: repos.IndexAsc}, }, Unique: true, }, } + +func FilterUniqueImagePullSecret(accountName string, name string) repos.Filter { + return repos.Filter{fc.AccountName: accountName, fc.MetadataName: name} +} + +func FilterListImagePullSecret(accountName string) repos.Filter { + return repos.Filter{fc.AccountName: accountName} +}