in controllers/etcdadmconfig_controller.go [430:448]
func (r *EtcdadmConfigReconciler) resolveRegistryCredentials(ctx context.Context, config *etcdbootstrapv1.EtcdadmConfig) ([]byte, []byte, error) {
secret := &corev1.Secret{}
key := types.NamespacedName{Namespace: config.Namespace, Name: registrySecretName}
if err := r.Client.Get(ctx, key, secret); err != nil {
if apierrors.IsNotFound(err) {
return nil, nil, errors.Wrapf(err, "secret not found: %s", key)
}
return nil, nil, errors.Wrapf(err, "failed to retrieve Secret %q", key)
}
username, ok := secret.Data[registryUsernameKey]
if !ok {
return nil, nil, errors.Errorf("secret references non-existent secret key: %q", "username")
}
password, ok := secret.Data[registryPasswordKey]
if !ok {
return nil, nil, errors.Errorf("secret references non-existent secret key: %q", "password")
}
return username, password, nil
}