configmaps

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RestoreSucceeded = "succeeded"

	RedisConfKey = "redis.conf"

	Aclfile = "users.acl"
)

Variables

View Source
var ErrBadInput = errors.New("admin-secret-missing")

Functions

func AclConfigMapName

func AclConfigMapName(clusterName string) string

func GenerateAclconf

func GenerateAclconf(conflog logr.Logger, client client.Client, cluster *redisv1alpha1.DistributedRedisCluster) (string, map[string]string, error)
func Getsecretversions(conflog logr.Logger, client client.Client, cluster *redisv1alpha1.DistributedRedisCluster) (map[string]string, error) {
	secretversion := make(map[string]string)

	if cluster.Spec.AdminSecret == nil {
		err := fmt.Errorf("admin secret refrence not defined in CR")
		conflog.Error(err, "in Getsecretversions:")
		secretversion["admin-secret"] = "default"
	} else {
		conflog.Info("Getsecretversions", "fetting secret revision for", cluster.Spec.AdminSecret.Name)
		_, versionID, err := GetAclStringFromSecrets(conflog, client, cluster, cluster.Spec.AdminSecret.Name)
		if err != nil {
			conflog.Error(err, "admin secret unable to get")
			return secretversion, err

		} else {
			secretversion[cluster.Spec.AdminSecret.Name] = versionID
		}
	}

	if cluster.Spec.DefaultSecret == nil {
		err := fmt.Errorf("default secret refrence not defined in CR")
		conflog.Error(err, "in Getsecretversions:")
		return secretversion, err
	} else {
		conflog.Info("Getsecretversions", "fetting secret revision for", cluster.Spec.DefaultSecret.Name)
		_, versionID, err := GetAclStringFromSecrets(conflog, client, cluster, cluster.Spec.DefaultSecret.Name)
		if err != nil {
			conflog.Error(err, "default secret unable to get")
			return secretversion, err

		} else {
			secretversion[cluster.Spec.DefaultSecret.Name] = versionID
		}
	}

	if cluster.Spec.AdditionalSecret != nil {
		for _, ref := range cluster.Spec.AdditionalSecret {
			sceretrefname := ref.Name
			conflog.Info("Getsecretversions", "fetting secret revision for", sceretrefname)
			_, versionID, err := GetAclStringFromSecrets(conflog, client, cluster, sceretrefname)
			if err != nil {
				conflog.Error(err, "additional secret unable to get")
			} else {
				secretversion[sceretrefname] = versionID
			}
		}
	}
	return secretversion, nil
}

func GetAclStringFromSecrets

func GetAclStringFromSecrets(conflog logr.Logger, client client.Client, cluster *redisv1alpha1.DistributedRedisCluster, secretname string) (string, string, error)

func GetAcldataFromSecrets

func GetAcldataFromSecrets(client client.Client, cluster *redisv1alpha1.DistributedRedisCluster, secretname string) (map[string]string, string, error)

Extract the auth,acldata from secrets.

func GetHashedPassword

func GetHashedPassword(password string) string

func Getsecretversions

func Getsecretversions(conflog logr.Logger, client client.Client, cluster *redisv1alpha1.DistributedRedisCluster) (map[string]string, error)

func NewACLConfigMap

func NewACLConfigMap(conflog logr.Logger, client client.Client, cluster *redisv1alpha1.DistributedRedisCluster, labels map[string]string) (*corev1.ConfigMap, map[string]string, error, bool)

func NewConfigMapForCR

func NewConfigMapForCR(cluster *redisv1alpha1.DistributedRedisCluster, labels map[string]string) *corev1.ConfigMap

NewConfigMapForCR creates a new ConfigMap for the given Cluster

func NewConfigMapForRestore

func NewConfigMapForRestore(cluster *redisv1alpha1.DistributedRedisCluster, labels map[string]string) *corev1.ConfigMap

func RedisConfigMapName

func RedisConfigMapName(clusterName string) string

func RestoreConfigMapName

func RestoreConfigMapName(clusterName string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL