func (m *Manipulator) DoCreate(config *CreateConfig) error {
	podList, err := m.kubeClient.CoreV1().Pods(config.Namespace).List(metaV1.ListOptions{LabelSelector: config.PodLabel})
	if err != nil {
		return fmt.Errorf("unable to find cassandra pods with label %s: %v", config.PodLabel, err)
	}
	if len(podList.Items) == 0 {
		return fmt.Errorf("no cassandra pods found with label %s in namespace %s", config.PodLabel, config.Namespace)
	}
	var failedPods []string
	snapshotTimestamp := time.Now()
	for _, pod := range podList.Items {
		if err := m.nodetoolClient.CreateSnapshot(snapshotTimestamp, config.Keyspaces, &pod, config.SnapshotTimeout); err != nil {
			log.Errorf("Error while taking snapshot for pod %s.%s: %v", pod.Namespace, pod.Name, err)
			failedPods = append(failedPods, pod.Name)
		}
	}
	if len(failedPods) > 0 {
		return fmt.Errorf("snapshot creation failed for pods: %v", failedPods)
	}
	return nil
}
DoCreate creates snapshots for one or more keyspaces of a cluster
package snapshot
import (
	"fmt"
	log "github.com/sirupsen/logrus"
	"github.com/sky-uk/cassandra-operator/cassandra-snapshot/pkg/nodetool"
	"github.com/sky-uk/cassandra-operator/cassandra-snapshot/pkg/snapshot/filter"
	"k8s.io/api/core/v1"
	metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/kubernetes"
	"k8s.io/client-go/rest"
	"time"
)
type CreateConfig struct {
	Keyspaces       []string
	Namespace       string
	PodLabel        string
	SnapshotTimeout time.Duration
}
type CleanupConfig struct {
	Namespace       string
	RetentionPeriod time.Duration
	Keyspaces       []string
	PodLabel        string
	CleanupTimeout  time.Duration
}
type Manipulator struct {
	kubeconfig     *rest.Config
	kubeClient     *kubernetes.Clientset
	nodetoolClient *nodetool.Nodetool
}
func New() *Manipulator {
	kubeconfig := kubernetesConfig()
	kubeClient := kubernetesClient(kubeconfig)
	return &Manipulator{
		kubeconfig:     kubeconfig,
		kubeClient:     kubeClient,
		nodetoolClient: nodetool.New(kubeClient, kubeconfig),
	}
}