Skip to content

Commit

Permalink
Add Support for Redis when Auth is Disabled in Kubedb (#77)
Browse files Browse the repository at this point in the history
Signed-off-by: Emon46 <emon@appscode.com>
  • Loading branch information
Emon46 authored and tamalsaha committed Apr 29, 2023
1 parent 8372b08 commit b67eb58
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions pkg/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,23 @@ func (opt *redisOptions) newSessionWrapper(cmd string) *sessionWrapper {
}

func (session *sessionWrapper) setDatabaseCredentials(kubeClient kubernetes.Interface, appBinding *appcatalog.AppBinding) error {
appBindingSecret, err := kubeClient.CoreV1().Secrets(appBinding.Namespace).Get(context.TODO(), appBinding.Spec.Secret.Name, metav1.GetOptions{})
if err != nil {
return err
}
if appBinding.Spec.Secret != nil {
appBindingSecret, err := kubeClient.CoreV1().Secrets(appBinding.Namespace).Get(context.TODO(), appBinding.Spec.Secret.Name, metav1.GetOptions{})
if err != nil {
return err
}

err = appBinding.TransformSecret(kubeClient, appBindingSecret.Data)
if err != nil {
return err
}
err = appBinding.TransformSecret(kubeClient, appBindingSecret.Data)
if err != nil {
return err
}

// set auth env for redis-cli
session.sh.SetEnv(EnvRedisCLIAuth, string(appBindingSecret.Data[RedisPassword]))
// set auth env for redis-cli
session.sh.SetEnv(EnvRedisCLIAuth, string(appBindingSecret.Data[RedisPassword]))

// set auth env for redis-dump-go
session.sh.SetEnv(EnvRedisDumpGoAuth, string(appBindingSecret.Data[RedisPassword]))
// set auth env for redis-dump-go
session.sh.SetEnv(EnvRedisDumpGoAuth, string(appBindingSecret.Data[RedisPassword]))
}

return nil
}
Expand Down

0 comments on commit b67eb58

Please sign in to comment.