Skip to content

Commit

Permalink
feat: add SecretStore field for GeneratorRequest (#1284)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangndst authored Sep 2, 2024
1 parent c8b4a0c commit 5d9480c
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 26 deletions.
8 changes: 7 additions & 1 deletion pkg/modules/generators/app_configurations_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ func getModuleName(accessory v1.Accessory) (string, error) {
}

func (g *appConfigurationGenerator) initModuleRequest(config moduleConfig) (*proto.GeneratorRequest, error) {
var workloadConfig, devConfig, platformConfig, ctx []byte
var workloadConfig, secretStoreConfig, devConfig, platformConfig, ctx []byte
var err error
// Attention: we MUST yaml.v2 to serialize the object,
// because we have introduced MapSlice in the Workload which is supported only in the yaml.v2
Expand All @@ -594,6 +594,11 @@ func (g *appConfigurationGenerator) initModuleRequest(config moduleConfig) (*pro
return nil, fmt.Errorf("marshal workload config failed. %w", err)
}
}
if g.ws.SecretStore != nil {
if secretStoreConfig, err = yamlv2.Marshal(g.ws.SecretStore); err != nil {
return nil, fmt.Errorf("marshal secret store config failed. %w", err)
}
}
if config.devConfig != nil {
if devConfig, err = yaml.Marshal(config.devConfig); err != nil {
return nil, fmt.Errorf("marshal dev module config failed. %w", err)
Expand All @@ -618,6 +623,7 @@ func (g *appConfigurationGenerator) initModuleRequest(config moduleConfig) (*pro
DevConfig: devConfig,
PlatformConfig: platformConfig,
Context: ctx,
SecretStore: secretStoreConfig,
}
return protoRequest, nil
}
Expand Down
43 changes: 27 additions & 16 deletions pkg/modules/proto/module.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/modules/proto/module.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ message GeneratorRequest {
bytes platform_config = 6;
// context contains workspace-level configurations, such as topologies, server endpoints, metadata, etc.
bytes context = 7;
// SecretStore represents a secure external location for storing secrets.
bytes secret_store = 8;
}

// GeneratorResponse represents the generate result of the generator.
Expand Down
34 changes: 25 additions & 9 deletions pkg/modules/proto/module_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5d9480c

Please sign in to comment.