@@ -120,17 +120,21 @@ func (impl *DeploymentConfigurationServiceImpl) ConfigAutoComplete(appId int, en
120
120
121
121
func (impl * DeploymentConfigurationServiceImpl ) GetAllConfigData (ctx context.Context , configDataQueryParams * bean2.ConfigDataQueryParams , userHasAdminAccess bool ) (* bean2.DeploymentAndCmCsConfigDto , error ) {
122
122
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
+ }
126
127
if configDataQueryParams .IsEnvNameProvided () {
127
- env , err := impl .environmentRepository .FindByName (configDataQueryParams .EnvName )
128
+ env , err := impl .environmentRepository .FindEnvByNameWithClusterDetails (configDataQueryParams .EnvName )
128
129
if err != nil {
129
130
impl .logger .Errorw ("GetAllConfigData, error in getting environment model by envName" , "envName" , configDataQueryParams .EnvName , "err" , err )
130
131
return nil , err
131
132
}
132
133
envId = env .Id
133
134
clusterId = env .ClusterId
135
+ systemMetadata .EnvironmentName = env .Name
136
+ systemMetadata .Namespace = env .Name
137
+ systemMetadata .ClusterName = env .Cluster .ClusterName
134
138
}
135
139
appId , err = impl .appRepository .FindAppIdByName (configDataQueryParams .AppName )
136
140
if err != nil {
@@ -145,7 +149,7 @@ func (impl *DeploymentConfigurationServiceImpl) GetAllConfigData(ctx context.Con
145
149
return impl .getConfigDataForDeploymentHistory (ctx , configDataQueryParams , userHasAdminAccess )
146
150
}
147
151
// 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 )
149
153
}
150
154
151
155
func (impl * DeploymentConfigurationServiceImpl ) getConfigDataForCdRollback (ctx context.Context , configDataQueryParams * bean2.ConfigDataQueryParams , userHasAdminAccess bool ) (* bean2.DeploymentAndCmCsConfigDto , error ) {
@@ -357,12 +361,12 @@ func (impl *DeploymentConfigurationServiceImpl) encodeSecretDataFromNonAdminUser
357
361
}
358
362
359
363
func (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 ) {
361
365
configDataDto := & bean2.DeploymentAndCmCsConfigDto {}
362
366
var err error
363
367
switch configDataQueryParams .ConfigType {
364
368
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 )
366
370
if err != nil {
367
371
impl .logger .Errorw ("GetAllConfigData, error in config data for PublishedOnly" , "configDataQueryParams" , configDataQueryParams , "err" , err )
368
372
return nil , err
@@ -407,7 +411,7 @@ func (impl *DeploymentConfigurationServiceImpl) getCmCsEditDataForPublishedOnly(
407
411
return configDataDto , nil
408
412
}
409
413
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 ) {
411
415
412
416
configDataDto := & bean2.DeploymentAndCmCsConfigDto {}
413
417
secretData , err := impl .getSecretConfigResponse ("" , 0 , envId , appId )
@@ -435,7 +439,7 @@ func (impl *DeploymentConfigurationServiceImpl) getCmCsPublishedConfigResponse(c
435
439
return nil , err
436
440
}
437
441
438
- resolvedCmCsMetadataDto , err := impl .ResolveCmCs (ctx , envId , appId , clusterId , userHasAdminAccess )
442
+ resolvedCmCsMetadataDto , err := impl .ResolveCmCs (ctx , envId , appId , clusterId , userHasAdminAccess , systemMetadata )
439
443
if err != nil {
440
444
impl .logger .Errorw ("error in resolving cm and cs for published only config only response" , "appId" , appId , "envId" , envId , "err" , err )
441
445
return nil , err
@@ -504,11 +508,12 @@ func (impl *DeploymentConfigurationServiceImpl) getMergedCmCs(envId, appId int)
504
508
}, nil
505
509
}
506
510
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 ) {
508
512
scope := resourceQualifiers.Scope {
509
- AppId : appId ,
510
- EnvId : envId ,
511
- ClusterId : clusterId ,
513
+ AppId : appId ,
514
+ EnvId : envId ,
515
+ ClusterId : clusterId ,
516
+ SystemMetadata : systemMetadata ,
512
517
}
513
518
cmcsMetadataDto , err := impl .getMergedCmCs (envId , appId )
514
519
if err != nil {
@@ -609,13 +614,13 @@ func (impl *DeploymentConfigurationServiceImpl) getPublishedDeploymentConfig(ctx
609
614
}
610
615
611
616
func (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 ) {
613
618
614
619
if configDataQueryParams .IsRequestMadeForOneResource () {
615
620
return impl .getCmCsEditDataForPublishedOnly (configDataQueryParams , envId , appId )
616
621
}
617
622
//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 )
619
624
if err != nil {
620
625
impl .logger .Errorw ("getPublishedConfigData, error in getting cm cs for PublishedOnly state" , "appName" , configDataQueryParams .AppName , "envName" , configDataQueryParams .EnvName , "err" , err )
621
626
return nil , err
0 commit comments