@@ -120,17 +120,21 @@ func (impl *DeploymentConfigurationServiceImpl) ConfigAutoComplete(appId int, en
120120
121121func (impl * DeploymentConfigurationServiceImpl ) GetAllConfigData (ctx context.Context , configDataQueryParams * bean2.ConfigDataQueryParams , userHasAdminAccess bool ) (* bean2.DeploymentAndCmCsConfigDto , error ) {
122122 var err error
123- var envId int
124- var appId int
125- var clusterId int
123+ var envId , appId , clusterId int
124+ systemMetadata := & resourceQualifiers.SystemMetadata {
125+ AppName : configDataQueryParams .AppName ,
126+ }
126127 if configDataQueryParams .IsEnvNameProvided () {
127- env , err := impl .environmentRepository .FindByName (configDataQueryParams .EnvName )
128+ env , err := impl .environmentRepository .FindEnvByNameWithClusterDetails (configDataQueryParams .EnvName )
128129 if err != nil {
129130 impl .logger .Errorw ("GetAllConfigData, error in getting environment model by envName" , "envName" , configDataQueryParams .EnvName , "err" , err )
130131 return nil , err
131132 }
132133 envId = env .Id
133134 clusterId = env .ClusterId
135+ systemMetadata .EnvironmentName = env .Name
136+ systemMetadata .Namespace = env .Name
137+ systemMetadata .ClusterName = env .Cluster .ClusterName
134138 }
135139 appId , err = impl .appRepository .FindAppIdByName (configDataQueryParams .AppName )
136140 if err != nil {
@@ -145,7 +149,7 @@ func (impl *DeploymentConfigurationServiceImpl) GetAllConfigData(ctx context.Con
145149 return impl .getConfigDataForDeploymentHistory (ctx , configDataQueryParams , userHasAdminAccess )
146150 }
147151 // this would be the default case
148- return impl .getConfigDataForAppConfiguration (ctx , configDataQueryParams , appId , envId , clusterId , userHasAdminAccess )
152+ return impl .getConfigDataForAppConfiguration (ctx , configDataQueryParams , appId , envId , clusterId , userHasAdminAccess , systemMetadata )
149153}
150154
151155func (impl * DeploymentConfigurationServiceImpl ) getConfigDataForCdRollback (ctx context.Context , configDataQueryParams * bean2.ConfigDataQueryParams , userHasAdminAccess bool ) (* bean2.DeploymentAndCmCsConfigDto , error ) {
@@ -357,12 +361,12 @@ func (impl *DeploymentConfigurationServiceImpl) encodeSecretDataFromNonAdminUser
357361}
358362
359363func (impl * DeploymentConfigurationServiceImpl ) getConfigDataForAppConfiguration (ctx context.Context , configDataQueryParams * bean2.ConfigDataQueryParams ,
360- appId , envId , clusterId int , userHasAdminAccess bool ) (* bean2.DeploymentAndCmCsConfigDto , error ) {
364+ appId , envId , clusterId int , userHasAdminAccess bool , systemMetadata * resourceQualifiers. SystemMetadata ) (* bean2.DeploymentAndCmCsConfigDto , error ) {
361365 configDataDto := & bean2.DeploymentAndCmCsConfigDto {}
362366 var err error
363367 switch configDataQueryParams .ConfigType {
364368 default : // keeping default as PublishedOnly
365- configDataDto , err = impl .getPublishedConfigData (ctx , configDataQueryParams , appId , envId , clusterId , userHasAdminAccess )
369+ configDataDto , err = impl .getPublishedConfigData (ctx , configDataQueryParams , appId , envId , clusterId , userHasAdminAccess , systemMetadata )
366370 if err != nil {
367371 impl .logger .Errorw ("GetAllConfigData, error in config data for PublishedOnly" , "configDataQueryParams" , configDataQueryParams , "err" , err )
368372 return nil , err
@@ -407,7 +411,7 @@ func (impl *DeploymentConfigurationServiceImpl) getCmCsEditDataForPublishedOnly(
407411 return configDataDto , nil
408412}
409413
410- func (impl * DeploymentConfigurationServiceImpl ) getCmCsPublishedConfigResponse (ctx context.Context , envId , appId , clusterId int , userHasAdminAccess bool ) (* bean2.DeploymentAndCmCsConfigDto , error ) {
414+ func (impl * DeploymentConfigurationServiceImpl ) getCmCsPublishedConfigResponse (ctx context.Context , envId , appId , clusterId int , userHasAdminAccess bool , systemMetadata * resourceQualifiers. SystemMetadata ) (* bean2.DeploymentAndCmCsConfigDto , error ) {
411415
412416 configDataDto := & bean2.DeploymentAndCmCsConfigDto {}
413417 secretData , err := impl .getSecretConfigResponse ("" , 0 , envId , appId )
@@ -435,7 +439,7 @@ func (impl *DeploymentConfigurationServiceImpl) getCmCsPublishedConfigResponse(c
435439 return nil , err
436440 }
437441
438- resolvedCmCsMetadataDto , err := impl .ResolveCmCs (ctx , envId , appId , clusterId , userHasAdminAccess )
442+ resolvedCmCsMetadataDto , err := impl .ResolveCmCs (ctx , envId , appId , clusterId , userHasAdminAccess , systemMetadata )
439443 if err != nil {
440444 impl .logger .Errorw ("error in resolving cm and cs for published only config only response" , "appId" , appId , "envId" , envId , "err" , err )
441445 return nil , err
@@ -504,11 +508,12 @@ func (impl *DeploymentConfigurationServiceImpl) getMergedCmCs(envId, appId int)
504508 }, nil
505509}
506510
507- func (impl * DeploymentConfigurationServiceImpl ) ResolveCmCs (ctx context.Context , envId , appId , clusterId int , userHasAdminAccess bool ) (* bean2.ResolvedCmCsMetadataDto , error ) {
511+ func (impl * DeploymentConfigurationServiceImpl ) ResolveCmCs (ctx context.Context , envId , appId , clusterId int , userHasAdminAccess bool , systemMetadata * resourceQualifiers. SystemMetadata ) (* bean2.ResolvedCmCsMetadataDto , error ) {
508512 scope := resourceQualifiers.Scope {
509- AppId : appId ,
510- EnvId : envId ,
511- ClusterId : clusterId ,
513+ AppId : appId ,
514+ EnvId : envId ,
515+ ClusterId : clusterId ,
516+ SystemMetadata : systemMetadata ,
512517 }
513518 cmcsMetadataDto , err := impl .getMergedCmCs (envId , appId )
514519 if err != nil {
@@ -609,13 +614,13 @@ func (impl *DeploymentConfigurationServiceImpl) getPublishedDeploymentConfig(ctx
609614}
610615
611616func (impl * DeploymentConfigurationServiceImpl ) getPublishedConfigData (ctx context.Context , configDataQueryParams * bean2.ConfigDataQueryParams ,
612- appId , envId , clusterId int , userHasAdminAccess bool ) (* bean2.DeploymentAndCmCsConfigDto , error ) {
617+ appId , envId , clusterId int , userHasAdminAccess bool , systemMetadata * resourceQualifiers. SystemMetadata ) (* bean2.DeploymentAndCmCsConfigDto , error ) {
613618
614619 if configDataQueryParams .IsRequestMadeForOneResource () {
615620 return impl .getCmCsEditDataForPublishedOnly (configDataQueryParams , envId , appId )
616621 }
617622 //ConfigMapsData and SecretsData are populated here
618- configData , err := impl .getCmCsPublishedConfigResponse (ctx , envId , appId , clusterId , userHasAdminAccess )
623+ configData , err := impl .getCmCsPublishedConfigResponse (ctx , envId , appId , clusterId , userHasAdminAccess , systemMetadata )
619624 if err != nil {
620625 impl .logger .Errorw ("getPublishedConfigData, error in getting cm cs for PublishedOnly state" , "appName" , configDataQueryParams .AppName , "envName" , configDataQueryParams .EnvName , "err" , err )
621626 return nil , err
0 commit comments