// WithPassword is an option to specify a password when creating the MysqlUser
WithPassword is an option to specify a password when creating the MysqlUser
// WithPassword is an option to specify a password when creating the MysqlUser
func WithPassword(cl client.Client, password string) MySQLUserOption {
	return func(mu *mysqluser.MySQLUser) error {
		secret := &corev1.Secret{
			ObjectMeta: metav1.ObjectMeta{
				Name:      mu.Name,
				Namespace: mu.Namespace,
			},
			Data: map[string][]byte{
				"password": []byte(password),
			},
		}
		Expect(cl.Create(context.TODO(), secret))
		mu.Spec.Password = corev1.SecretKeySelector{
			LocalObjectReference: corev1.LocalObjectReference{Name: secret.Name},
			Key:                  "password",
		}
		return nil
	}
}
func WithPassword ( cl client . Client , password string ) MySQLUserOption { return func ( mu * mysqluser . MySQLUser ) error { secret := & corev1 . Secret { ObjectMeta : metav1 . ObjectMeta { Name : mu . Name , Namespace : mu . Namespace , } , Data : map [ string ] [ ] byte { " " : [ ] byte ( password ) , } , } Expect ( cl . Create ( context . TODO ( ) , secret ) ) mu . Spec . Password = corev1 . SecretKeySelector { LocalObjectReference : corev1 . LocalObjectReference { Name : secret . Name } , Key : " " , } return nil } }
WithPassword is an option to specify a password when creating the MysqlUser
WithPassword is an option to specify a password when creating the MysqlUser