cluster

package
v3.10.46-1+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2018 License: Apache-2.0 Imports: 27 Imported by: 0

README

Cluster Mirror

This document describes how to use the Cluster Mirror to create a Cluster Loader configuration of a local OpenShift cluster. Specifically the templates and pods that are contained in the various cluster namespaces.

The cluster mirror tool was conceived to provide a way to reproduce (with reasonably approximate fidelity) a control-plane workload. The idea is to make sure our scale testing efforts are as realistic as possible.

Use-cases include:

  • Replicating OpenShift Online clusters into lab environments for scale testing and R&D.
  • Reproducing customer environments in support situations.

Note: This tool does not inspect persistent storage, it does not look at the content of secrets and it does not export user data in any way. It takes a "fingerprint" of the target environment via API calls, and allows users to "replay" that environment elsewhere (in terms of number of namespaces, templates and pods and what type they are).

Running Cluster Mirror

Cluster Loader is implemented as an extended test in OpenShift, and thus is is distributed as a precompiled binary in the atomic-openshift-tests RPM.

Once you have the extended.test binary installed on your system, run:

$ export KUBECONFIG=${KUBECONFIG-$HOME/.kube/config}
$ ./extended.test --ginko.focus="Mirror cluster"

After the command completes there will be a file created in the current directory: cm.yml. This file can be then fed to the Cluster Loader command below to recreate various cluster objects that were mirrored.

The assumption for use with Cluster Loader is that the templates used in the source cluster have same filename in the quickstarts subdirectory (of current directory, relative to the cm.yml file).

Cluster Loader

Cluster Loader can take user generated OpenShift application configurations and load them onto an OpenShift cluster.

Running Cluster Loader

Cluster Loader is implemented as an extended test in OpenShift, and thus is is distributed as a precompiled binary in the atomic-openshift-tests RPM.

Once you have the extended.test binary installed on your system, run:

$ export KUBECONFIG=${KUBECONFIG-$HOME/.kube/config}
$ ./extended.test --ginko.focus="Load cluster" --viper-config=config/test

After the execution completes the cluster will have deployed the ojects defined in the configuration.

OpenShift.com -- Using Cluster Loader

Documentation

Index

Constants

View Source
const (
	IF_EXISTS_DELETE = "delete"
	IF_EXISTS_REUSE  = "reuse"
)

Variables

This section is empty.

Functions

func CreateConfigmaps

func CreateConfigmaps(oc *exutil.CLI, c kclientset.Interface, nsName string, configmaps map[string]interface{}) error

CreateConfigmaps creates config maps from files in user defined namespaces.

func CreatePods

func CreatePods(c kclientset.Interface, appName string, ns string, labels map[string]string, spec kapiv1.PodSpec, maxCount int, tuning *TuningSetType, sync *SyncObjectType) error

CreatePods creates pods in user defined namespaces with user configurable tuning sets

func CreateSecrets

func CreateSecrets(oc *exutil.CLI, c kclientset.Interface, nsName string, secrets map[string]interface{}) error

CreateSecrets creates secrets from files in user defined namespaces.

func CreateTemplates

func CreateTemplates(oc *exutil.CLI, c kclientset.Interface, nsName string, template ClusterLoaderObjectType, tuning *TuningSetType) error

CreateTemplates creates templates in user defined namespaces with user configurable tuning sets.

func DeleteProject

func DeleteProject(oc *exutil.CLI, name string, interval, timeout time.Duration) error

func InjectConfigMap

func InjectConfigMap(c kclientset.Interface, ns string, vars map[string]interface{}, config kapiv1.Pod) string

InjectConfigMap modifies the pod struct and replaces the environment variables.

func ParseConfig

func ParseConfig(config string, isFixture bool) error

ParseConfig will complete flag parsing as well as viper tasks

func ParsePods

func ParsePods(jsonFile string) (configStruct kapiv1.Pod)

ParsePods unmarshalls the json file defined in the CL config into a struct

func ProjectExists

func ProjectExists(oc *exutil.CLI, name string) (bool, error)

func Server

func Server(c *PodCount, port int, awaitShutdown bool) error

Server is the webservice that will synchronize the start and stop of Pods

func SetNamespaceLabels

func SetNamespaceLabels(c kclientset.Interface, name string, labels map[string]string) (*kapiv1.Namespace, error)

func SyncPods

func SyncPods(c kclientset.Interface, ns string, selectors map[string]string, timeout time.Duration, state kapiv1.PodPhase) (err error)

SyncPods waits for pods to enter a state

func SyncRunningPods

func SyncRunningPods(c kclientset.Interface, ns string, selectors map[string]string, timeout time.Duration) (err error)

SyncRunningPods waits for pods to enter Running state

func SyncSucceededPods

func SyncSucceededPods(c kclientset.Interface, ns string, selectors map[string]string, timeout time.Duration) (err error)

SyncSucceededPods waits for pods to enter Completed state

Types

type ClusterLoaderObjectType

type ClusterLoaderObjectType struct {
	Total      int                    `yaml:",omitempty"`
	Number     int                    `mapstructure:"num" yaml:"num"`
	Image      string                 `yaml:",omitempty"`
	Basename   string                 `yaml:",omitempty"`
	File       string                 `yaml:",omitempty"`
	Sync       SyncObjectType         `yaml:",omitempty"`
	Parameters map[string]interface{} `yaml:",omitempty"`
}

ClusterLoaderObjectType is nested object type for cluster loader struct

type ClusterLoaderType

type ClusterLoaderType struct {
	Number     int `mapstructure:"num" yaml:"num"`
	Basename   string
	IfExists   string                    `json:"ifexists"`
	Labels     map[string]string         `yaml:",omitempty"`
	Tuning     string                    `yaml:",omitempty"`
	Configmaps map[string]interface{}    `yaml:",omitempty"`
	Secrets    map[string]interface{}    `yaml:",omitempty"`
	Pods       []ClusterLoaderObjectType `yaml:",omitempty"`
	Templates  []ClusterLoaderObjectType `yaml:",omitempty"`
}

ClusterLoaderType struct only used for Cluster Loader test config

type ContextType

type ContextType struct {
	ClusterLoader struct {
		Cleanup    bool
		Projects   []ClusterLoaderType
		Sync       SyncObjectType  `yaml:",omitempty"`
		TuningSets []TuningSetType `yaml:",omitempty"`
	}
}

ContextType is the root config struct

var ConfigContext ContextType

ConfigContext variable of type ContextType

type PodCount

type PodCount struct {
	Started  int
	Stopped  int
	Shutdown chan bool
}

PodCount struct keeps HTTP requst counts and state

type ServiceInfo

type ServiceInfo struct {
	Name string
	IP   string
	Port int32
}

ServiceInfo struct to bundle env data

type SyncObjectType

type SyncObjectType struct {
	Server struct {
		Enabled bool
		Port    int
	}
	Running   bool
	Succeeded bool
	Selectors map[string]string
	Timeout   string
}

SyncObjectType is nested object type for cluster loader synchronisation functionality

type TuningSetObjectType

type TuningSetObjectType struct {
	Stepping struct {
		StepSize int
		Pause    time.Duration
		Timeout  time.Duration
	}
	RateLimit struct {
		Delay time.Duration
	}
}

TuningSetObjectType is shared struct for Pods & Templates

type TuningSetType

type TuningSetType struct {
	Name      string
	Pods      TuningSetObjectType
	Templates TuningSetObjectType
}

TuningSetType is nested type for controlling Cluster Loader deployment pattern

func GetTuningSet

func GetTuningSet(tuningSets []TuningSetType, podTuning string) (tuning *TuningSetType)

GetTuningSet matches the name of the tuning set defined in the project and returns a pointer to the set

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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