Skip to content

Commit

Permalink
Added changes to avoid creationg of job cred secret when ssl is disab…
Browse files Browse the repository at this point in the history
…led in bl

Signed-off-by: kesavan thiruvenkadasamy <[email protected]>
  • Loading branch information
px-kesavan committed Oct 30, 2023
1 parent 8676e20 commit a866ec7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/controllers/dataexport/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ func (c *Controller) createJobCredCertSecrets(

// Check if the above env is present and read the certs file contents and
// secret for the job pod for kopia to access the same
err := createCertificateSecret(utils.GetCertSecretName(dataExport.Name), namespace, dataExport.Labels)
err := createCertificateSecret(utils.GetCertSecretName(dataExport.Name), namespace, blName, blNamespace, dataExport.Labels)
if err != nil {
msg := fmt.Sprintf("error in creating certificate secret[%v/%v]: %v", namespace, dataExport.Name, err)
logrus.Errorf(msg)
Expand Down Expand Up @@ -2156,7 +2156,15 @@ func createAzureSecret(secretName string, backupLocation *storkapi.BackupLocatio
return err
}

func createCertificateSecret(secretName, namespace string, labels map[string]string) error {
func createCertificateSecret(secretName, namespace, blName, blNamespace string, labels map[string]string) error {
backupLocation, err := readBackupLocation(blName, blNamespace, "")
if err != nil {
return err
}
// when DisableSSL is true, dont create job cert secrets.
if backupLocation.Location.Type == storkapi.BackupLocationS3 && backupLocation.Location.S3Config.DisableSSL {
return nil
}
drivers.CertFilePath = os.Getenv(drivers.CertDirPath)
if drivers.CertFilePath != "" {
certificateData, err := os.ReadFile(filepath.Join(drivers.CertFilePath, drivers.CertFileName))
Expand Down

0 comments on commit a866ec7

Please sign in to comment.