@@ -14,7 +14,7 @@ use crate::{
1414 volume:: { VolumeBuilder , VolumeMountBuilder } ,
1515 } ,
1616 commons:: product_image_selection:: ResolvedProductImage ,
17- crd:: git_sync:: v1alpha1:: GitSync ,
17+ crd:: git_sync:: v1alpha1:: { AccessSecret , GitSync } ,
1818 product_config_utils:: insert_or_update_env_vars,
1919 product_logging:: {
2020 framework:: capture_shell_output,
@@ -117,25 +117,22 @@ impl GitSyncResources {
117117 let mut resources = GitSyncResources :: default ( ) ;
118118
119119 for ( i, git_sync) in git_syncs. iter ( ) . enumerate ( ) {
120- if git_sync. credentials_secret . is_some ( ) && git_sync. ssh_secret . is_some ( ) {
121- // Gitsync will not allow the declaration of both ssh-key and password/token credentials
122- return Err ( Error :: MultipleCredentials ) ;
123- }
124-
125120 let mut env_vars = vec ! [ ] ;
126- if let Some ( git_credentials_secret) = & git_sync. credentials_secret {
121+
122+ if let Some ( AccessSecret :: Credentials { credentials_secret } ) = & git_sync. access_secret
123+ {
127124 env_vars. push ( GitSyncResources :: env_var_from_secret (
128125 "GITSYNC_USERNAME" ,
129- git_credentials_secret ,
126+ credentials_secret ,
130127 "user" ,
131128 ) ) ;
132129 env_vars. push ( GitSyncResources :: env_var_from_secret (
133130 "GITSYNC_PASSWORD" ,
134- git_credentials_secret ,
131+ credentials_secret ,
135132 "password" ,
136133 ) ) ;
137134 }
138- if git_sync. ssh_secret . is_some ( ) {
135+ if matches ! ( git_sync. access_secret , Some ( AccessSecret :: Ssh { .. } ) ) {
139136 env_vars. push ( EnvVar {
140137 name : "GITSYNC_SSH_KEY_FILE" . to_owned ( ) ,
141138 value : Some ( format ! ( "{SSH_MOUNT_PATH_PREFIX}-{i}/key" ) . to_owned ( ) ) ,
@@ -170,7 +167,7 @@ impl GitSyncResources {
170167
171168 git_sync_container_volume_mounts. extend_from_slice ( extra_volume_mounts) ;
172169
173- if git_sync. ssh_secret . is_some ( ) {
170+ if matches ! ( git_sync. access_secret , Some ( AccessSecret :: Ssh { .. } ) ) {
174171 let ssh_mount_path = format ! ( "{SSH_MOUNT_PATH_PREFIX}-{i}" ) ;
175172 let ssh_volume_name = format ! ( "{SSH_VOLUME_NAME_PREFIX}-{i}" ) ;
176173
@@ -225,11 +222,11 @@ impl GitSyncResources {
225222 . push ( git_content_volume_mount) ;
226223 resources. git_content_folders . push ( git_content_folder) ;
227224
228- if let Some ( get_ssh_secret ) = & git_sync. ssh_secret {
225+ if let Some ( AccessSecret :: Ssh { ssh_secret } ) = & git_sync. access_secret {
229226 let ssh_volume_name = format ! ( "{SSH_VOLUME_NAME_PREFIX}-{i}" ) ;
230227
231228 let ssh_secret_volume = VolumeBuilder :: new ( & ssh_volume_name)
232- . with_secret ( get_ssh_secret , false )
229+ . with_secret ( ssh_secret , false )
233230 . build ( ) ;
234231 resources. git_ssh_volumes . push ( ssh_secret_volume) ;
235232 }
0 commit comments