Documentation ¶
Index ¶
- Constants
- func ByCoordinates(namespace, name string) fields.Selector
- func ClientServiceName(clusterName string) string
- func ClusterListOpt(clusterName string) metav1.ListOptions
- func ConfigSecret(clusterName string) string
- func CreateAndWaitPod(kubecli corev1client.CoreV1Interface, ns string, pod *v1.Pod, ...) (*v1.Pod, error)
- func CreateClientService(kubecli corev1client.CoreV1Interface, clusterName, ns string, ...) error
- func CreateConfigSecret(kubecli corev1client.CoreV1Interface, ...) error
- func CreateMgmtService(kubecli corev1client.CoreV1Interface, clusterName, clusterVersion, ns string, ...) error
- func CreatePatch(o, n, datastruct interface{}) ([]byte, error)
- func ExecInContainer(ctx context.Context, kubeClient kubernetes.Interface, kubeCfg *rest.Config, ...) (int, error)
- func GetClusterList(restcli rest.Interface, ns string) (*v1alpha2.NatsClusterList, error)
- func GetNATSVersion(pod *v1.Pod) string
- func GetPodNames(pods []*v1.Pod) []string
- func InClusterConfig() (*rest.Config, error)
- func InitCRDs(extsClient extsclientset.Interface) error
- func IsKubernetesResourceAlreadyExistError(err error) bool
- func IsKubernetesResourceNotFoundError(err error) bool
- func IsPodReady(pod *v1.Pod) bool
- func LabelSelectorForCluster(clusterName string) labels.Selector
- func LabelsForCluster(clusterName string) map[string]string
- func MakeNATSImage(version string, serverImage string) string
- func ManagementServiceName(clusterName string) string
- func MustNewKubeClientFromConfig(cfg *rest.Config) kubernetes.Interface
- func MustNewKubeConfig(kubeconfig string) *rest.Config
- func MustNewKubeExtClient(cfg *rest.Config) extsclientset.Interface
- func MustNewNatsClientFromConfig(cfg *rest.Config) natsclient.Interface
- func NatsServiceRoleLabelSelectorForCluster(clusterName string) labels.Selector
- func NewNatsPodSpec(namespace, name, clusterName string, cs v1alpha2.ClusterSpec, ...) *v1.Pod
- func PodSpecToPrettyJSON(pod *v1.Pod) (string, error)
- func PodWithAntiAffinity(pod *v1.Pod, clusterName string) *v1.Pod
- func PodWithNodeSelector(p *v1.Pod, ns map[string]string) *v1.Pod
- func ResourceKey(obj interface{}) string
- func SetNATSVersion(pod *v1.Pod, version string)
- func UniquePodName() string
- func UpdateConfigSecret(kubecli corev1client.CoreV1Interface, ...) error
- func WaitCRDs(extsClient extsclientset.Interface) error
- func WaitUntilDeploymentCondition(ctx context.Context, kubeClient kubernetes.Interface, namespace, name string, ...) error
- func WaitUntilPodCondition(ctx context.Context, kubeClient corev1.CoreV1Interface, pod *v1.Pod, ...) error
- func WaitUntilPodReady(ctx context.Context, kubeClient corev1.CoreV1Interface, pod *v1.Pod) error
- type NatsClusterCRUpdateFunc
Constants ¶
const ( LabelAppKey = "app" LabelAppValue = "nats" LabelClusterNameKey = "nats_cluster" LabelClusterVersionKey = "nats_version" )
const (
TolerateUnreadyEndpointsAnnotation = "service.alpha.kubernetes.io/tolerate-unready-endpoints"
)
Variables ¶
This section is empty.
Functions ¶
func ByCoordinates ¶
ByCoordinates returns a field selector that can be used to filter Kubernetes resources based on their name and namespace.
func ClientServiceName ¶
ClientServiceName returns the name of the client service based on the specified cluster name.
func ClusterListOpt ¶
func ClusterListOpt(clusterName string) metav1.ListOptions
We are using internal api types for cluster related.
func ConfigSecret ¶
ConfigSecret returns the name of the secret that contains the configuration for the NATS cluster with the specified name.
func CreateAndWaitPod ¶
func CreateAndWaitPod(kubecli corev1client.CoreV1Interface, ns string, pod *v1.Pod, timeout time.Duration) (*v1.Pod, error)
CreateAndWaitPod is an util for testing. We should eventually get rid of this in critical code path and move it to test util.
func CreateClientService ¶
func CreateClientService(kubecli corev1client.CoreV1Interface, clusterName, ns string, owner metav1.OwnerReference) error
func CreateConfigSecret ¶
func CreateConfigSecret(kubecli corev1client.CoreV1Interface, operatorcli natsalphav2client.NatsV1alpha2Interface, clusterName, ns string, cluster v1alpha2.ClusterSpec, owner metav1.OwnerReference) error
CreateConfigSecret creates the secret that contains the configuration file for a given NATS cluster..
func CreateMgmtService ¶
func CreateMgmtService(kubecli corev1client.CoreV1Interface, clusterName, clusterVersion, ns string, owner metav1.OwnerReference) error
CreateMgmtService creates an headless service for NATS management purposes.
func CreatePatch ¶
func ExecInContainer ¶
func ExecInContainer(ctx context.Context, kubeClient kubernetes.Interface, kubeCfg *rest.Config, podNamespace, podName, containerName string, args ...string) (int, error)
ExecInContainer runs a command in the specified container, blocking until the command finishes execution or the specified context times out. It returns the command's exit code (if available), its output (stdout and stderr) and the associated error (if any).
func GetClusterList ¶
func GetNATSVersion ¶
func GetPodNames ¶
func InClusterConfig ¶
func InitCRDs ¶
func InitCRDs(extsClient extsclientset.Interface) error
InitCRDs registers the CRDs for the nats.io/v1alpha2 API and waits for them to become ready.
func IsPodReady ¶
IsPodReady returns false if the Pod Status is nil
func LabelSelectorForCluster ¶
LabelSelectorForCluster returns a label selector that matches resources belonging to the NATS cluster with the specified name.
func LabelsForCluster ¶
func MakeNATSImage ¶
func ManagementServiceName ¶
func MustNewKubeClientFromConfig ¶
func MustNewKubeClientFromConfig(cfg *rest.Config) kubernetes.Interface
MustNewKubeClientFromConfig builds a Kubernetes client based on the specified configuration object.
func MustNewKubeConfig ¶
MustNewKubeConfig builds a configuration object by either reading from the specified kubeconfig file or by using an in-cluster config.
func MustNewKubeExtClient ¶
func MustNewKubeExtClient(cfg *rest.Config) extsclientset.Interface
MustNewKubeExtClient creates a new client for the apiextensions.k8s.io/v1beta1 API.
func MustNewNatsClientFromConfig ¶
func MustNewNatsClientFromConfig(cfg *rest.Config) natsclient.Interface
MustNewNatsClientFromConfig builds a client for our API based on the specified configuration object.
func NatsServiceRoleLabelSelectorForCluster ¶
NatsServiceRoleLabelSelectorForCuster returns a label selector that matches NatsServiceRole resources referencing the NATS cluster with the specified name.
func NewNatsPodSpec ¶
func NewNatsPodSpec(namespace, name, clusterName string, cs v1alpha2.ClusterSpec, owner metav1.OwnerReference) *v1.Pod
NewNatsPodSpec returns a NATS peer pod specification, based on the cluster specification.
func PodWithAntiAffinity ¶
PodWithAntiAffinity sets pod anti-affinity with the pods in the same NATS cluster
func ResourceKey ¶
func ResourceKey(obj interface{}) string
ResourceKey returns the "namespace/name" key that represents the specified resource.
func SetNATSVersion ¶
func UpdateConfigSecret ¶
func UpdateConfigSecret( kubecli corev1client.CoreV1Interface, operatorcli natsalphav2client.NatsV1alpha2Interface, clusterName, ns string, cluster v1alpha2.ClusterSpec, owner metav1.OwnerReference, ) error
UpdateConfigSecret applies the new configuration of the cluster, such as modifying the routes available in the cluster.
func WaitCRDs ¶
func WaitCRDs(extsClient extsclientset.Interface) error
WaitCRDs waits for the CRDs to become ready.
func WaitUntilDeploymentCondition ¶
func WaitUntilDeploymentCondition(ctx context.Context, kubeClient kubernetes.Interface, namespace, name string, fn watch.ConditionFunc) error
WaitUntilDeploymentCondition establishes a watch on the specified deployment and blocks until the specified condition function is satisfied.
func WaitUntilPodCondition ¶
func WaitUntilPodCondition(ctx context.Context, kubeClient corev1.CoreV1Interface, pod *v1.Pod, fn watch.ConditionFunc) error
WaitUntilPodCondition establishes a watch on the specified pod and blocks until the specified condition function is satisfied.
func WaitUntilPodReady ¶
WaitUntilPodReady establishes a watch on the specified pod and blocks until the pod is running, ready and has its ".status.podIP" field populated.
Types ¶
type NatsClusterCRUpdateFunc ¶
type NatsClusterCRUpdateFunc func(*v1alpha2.NatsCluster)
NatsClusterCRUpdateFunc is a function to be used when atomically updating a Cluster CR.