Skip to content

Commit

Permalink
Proof of concept for custom secret mount paths
Browse files Browse the repository at this point in the history
ddl-ignacio-rossi committed Jan 17, 2025

Verified

This commit was signed with the committer’s verified signature.
1 parent b512e38 commit 58157a0
Showing 5 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
@@ -3328,6 +3328,9 @@
".SecretReference": {
"type": "object",
"properties": {
"mountPath": {
"type": "string"
},
"name": {
"type": "string"
},
Original file line number Diff line number Diff line change
@@ -140,6 +140,8 @@ spec:
expose to individual image builds.
items:
properties:
mountPath:
type: string
name:
type: string
namespace:
1 change: 1 addition & 0 deletions pkg/api/hephaestus/v1/types.go
Original file line number Diff line number Diff line change
@@ -64,6 +64,7 @@ type RegistryCredentials struct {
type SecretReference struct {
Name string `json:"name,omitempty"`
Namespace string `json:"namespace,omitempty"`
MountPath string `json:"mountPath,omitempty"`
}

// ImageBuildStatusTransitionMessage contains information about ImageBuild status transitions.
6 changes: 6 additions & 0 deletions pkg/api/hephaestus/v1/zz_generated.openapi.go

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

4 changes: 4 additions & 0 deletions pkg/controller/support/secrets/secrets.go
Original file line number Diff line number Diff line change
@@ -69,6 +69,10 @@ func ReadSecrets(
}
}

if secretRef.MountPath != "" {
path = secretRef.MountPath
}

// builds a path for the secret like {namespace}/{name}/{key} to avoid hash key collisions
for filename, data := range secret.Data {
name := strings.Join([]string{path, filename}, "/")

0 comments on commit 58157a0

Please sign in to comment.