feat: Upload DCs secrets - #1173
Open
sambuc wants to merge 3 commits into
Open
Conversation
sambuc
marked this pull request as ready for review
July 16, 2026 15:47
leafty
reviewed
Jul 17, 2026
Comment on lines
+648
to
+655
| switch as.Spec.SessionLocation { | ||
| case Remote: | ||
| return as.RemoteSessionDataSources() | ||
| case Local: | ||
| return as.LocalSessionDataSources() | ||
| default: | ||
| panic("invalid session location") | ||
| } |
Member
There was a problem hiding this comment.
We should do a little bit of defensive programming here: this method should work even if the CRD is outdated and doesn't have the location field.
Suggested change
| switch as.Spec.SessionLocation { | |
| case Remote: | |
| return as.RemoteSessionDataSources() | |
| case Local: | |
| return as.LocalSessionDataSources() | |
| default: | |
| panic("invalid session location") | |
| } | |
| if as.Spec.SessionLocation == Remote { | |
| return as.RemoteSessionDataSources() | |
| } | |
| // as.Spec.SessionLocation == Local | |
| return as.LocalSessionDataSources() |
| { | ||
| Name: fmt.Sprintf("%s-%s", prefix, as.Name), | ||
| VolumeSource: v1.VolumeSource{ | ||
| Secret: &v1.SecretVolumeSource{ |
Member
There was a problem hiding this comment.
We should add Optional: ptr.To(false), no?
| VolumeSource: v1.VolumeSource{ | ||
| Secret: &v1.SecretVolumeSource{ | ||
| SecretName: as.InternalSecretName(), | ||
| DefaultMode: ptr.To(int32(256)), // decimal value of 0400 for the access flags (chmod-like) |
Member
There was a problem hiding this comment.
Suggested change
| DefaultMode: ptr.To(int32(256)), // decimal value of 0400 for the access flags (chmod-like) | |
| DefaultMode: ptr.To(int32(0400)), // chmod: r-- --- --- |
| } | ||
| volMounts := []v1.VolumeMount{ | ||
| { | ||
| Name: fmt.Sprintf("%s-%s", prefix, as.Name), |
Member
There was a problem hiding this comment.
You will have two dashes
Suggested change
| Name: fmt.Sprintf("%s-%s", prefix, as.Name), | |
| Name: fmt.Sprintf("%s%s", prefix, as.Name), |
Comment on lines
+15
to
+17
| const UserSecretProxyFolder = "/secrets-user" | ||
| const DataConnectorProxyFolder = "/secrets-dcs" | ||
| const DataConnectorSecretProxyFolder = "/secrets-dcs-secrets" |
| const DataConnectorSecretProxyFolder = "/secrets-dcs-secrets" | ||
|
|
||
| type DataConnector struct { | ||
| root string |
Comment on lines
+59
to
+61
| if dir.IsDir() || strings.HasPrefix(dir.Name(), "..") { | ||
| continue | ||
| } |
Member
There was a problem hiding this comment.
os.ReadDir() will not return . or ..
Suggested change
| if dir.IsDir() || strings.HasPrefix(dir.Name(), "..") { | |
| continue | |
| } | |
| if dir.IsDir() { | |
| continue | |
| } |
|
|
||
| func (dc *DataConnector) fernetKey() (*fernet.Key, error) { | ||
| // the fernet key is mounted as part of the data source secret | ||
| if encodedKey, err := os.ReadFile(path.Join(dc.root, dc.Name, "secretKey")); err == nil { |
Member
There was a problem hiding this comment.
Since this is a local file, you should use filepath.Join() and not path.Join()
Comment on lines
+97
to
+98
| // Put it in a file, which will allow for passing to `rclone obscure -` before being placed in the config file. | ||
| configFiles[k] = v |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Stack