Skip to content

Commit

Permalink
task: added new fields for eso secrets (#2899)
Browse files Browse the repository at this point in the history
* added new fields for eso secrets

* updated bean for secret history
  • Loading branch information
kartik-579 authored Jan 27, 2023
1 parent 6623258 commit 9942c64
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
22 changes: 15 additions & 7 deletions pkg/pipeline/ConfigMapService.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@ type ExternalSecret struct {
}

type ESOSecretData struct {
SecretStore json.RawMessage `json:"secretStore,omitempty"`
EsoData []ESOData `json:"esoData,omitempty"`
SecretStore json.RawMessage `json:"secretStore,omitempty"`
SecretStoreRef json.RawMessage `json:"secretStoreRef,omitempty"`
EsoData []ESOData `json:"esoData,omitempty"`
RefreshInterval string `json:"refreshInterval,omitempty"`
}

type ESOData struct {
Expand Down Expand Up @@ -553,6 +555,7 @@ func (impl ConfigMapServiceImpl) CSGlobalAddUpdate(configMapRequest *ConfigDataR
}
for _, item := range secretsList.ConfigData {
if item.Name == configData.Name {
found = true
item.Data = configData.Data
item.MountPath = configData.MountPath
item.Type = configData.Type
Expand All @@ -561,7 +564,6 @@ func (impl ConfigMapServiceImpl) CSGlobalAddUpdate(configMapRequest *ConfigDataR
item.ESOSecretData = configData.ESOSecretData
item.ExternalSecret = configData.ExternalSecret
item.RoleARN = configData.RoleARN
found = true
item.SubPath = configData.SubPath
item.FilePermission = configData.FilePermission
}
Expand Down Expand Up @@ -687,8 +689,10 @@ func (impl ConfigMapServiceImpl) CSGlobalFetch(appId int) (*ConfigDataRequest, e
}

esoSecretData := ESOSecretData{
SecretStore: item.ESOSecretData.SecretStore,
EsoData: esoData,
SecretStore: item.ESOSecretData.SecretStore,
SecretStoreRef: item.ESOSecretData.SecretStoreRef,
EsoData: esoData,
RefreshInterval: item.ESOSecretData.RefreshInterval,
}
item.ESOSecretData = esoSecretData
configs = append(configs, item)
Expand Down Expand Up @@ -889,6 +893,8 @@ func (impl ConfigMapServiceImpl) CSEnvironmentFetch(appId int, envId int) (*Conf
item.DefaultESOSecretData = item.ESOSecretData
item.ESOSecretData.EsoData = nil
item.ESOSecretData.SecretStore = nil
item.ESOSecretData.SecretStoreRef = nil
item.ESOSecretData.RefreshInterval = ""
item.DefaultMountPath = item.MountPath
item.Data = nil
item.ExternalSecret = nil
Expand Down Expand Up @@ -958,8 +964,10 @@ func (impl ConfigMapServiceImpl) CSEnvironmentFetch(appId int, envId int) (*Conf
}

esoSecretData := ESOSecretData{
SecretStore: item.ESOSecretData.SecretStore,
EsoData: esoData,
SecretStore: item.ESOSecretData.SecretStore,
SecretStoreRef: item.ESOSecretData.SecretStoreRef,
EsoData: esoData,
RefreshInterval: item.ESOSecretData.RefreshInterval,
}
item.ESOSecretData = esoSecretData

Expand Down
6 changes: 4 additions & 2 deletions pkg/pipeline/history/bean.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,10 @@ type ExternalSecret struct {
}

type ESOSecretData struct {
SecretStore json.RawMessage `json:"secretStore"`
EsoData []ESOData `json:"esoData"`
SecretStore json.RawMessage `json:"secretStore,omitempty"`
SecretStoreRef json.RawMessage `json:"secretStoreRef,omitempty"`
EsoData []ESOData `json:"esoData"`
RefreshInterval string `json:"refreshInterval,omitempty"`
}

type ESOData struct {
Expand Down

0 comments on commit 9942c64

Please sign in to comment.