Documentation ¶
Overview ¶
* Tencent is pleased to support the open source community by making TKEStack available. * * Copyright (C) 2012-2019 Tencent. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use * this file except in compliance with the License. You may obtain a copy of the * License at * * https://opensource.org/licenses/Apache-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License.
* Tencent is pleased to support the open source community by making TKEStack available. * * Copyright (C) 2012-2019 Tencent. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use * this file except in compliance with the License. You may obtain a copy of the * License at * * https://opensource.org/licenses/Apache-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func CrdApiVersionAndKind(crd *extensionv1.CustomResourceDefinition) (string, string)
- func CreateCRDApp(podMeta v1.ObjectMeta, replicas int64, ...) *unstructured.Unstructured
- func CreateCRDPod(name, namespace string, annotations map[string]string, ...) *corev1.Pod
- type CustomResourceDefinitionBuilder
- type PodBuilder
- type UnstructuredBuilder
Constants ¶
This section is empty.
Variables ¶
var ( ReplicasFields = []string{"spec", "replicas"} ReplicasPath = "." + strings.Join(ReplicasFields, ".") FooCrd = CustomResourceDefinition(). WithName("foo"). WithSubresources(&extensionv1.CustomResourceSubresources{ Scale: &extensionv1.CustomResourceSubresourceScale{ SpecReplicasPath: ReplicasPath, }, }). WithGroupVersion("test.org", "v2").Get() NotScalableCrd = CustomResourceDefinition(). WithName("not-scalable"). WithSubresources(&extensionv1.CustomResourceSubresources{}). WithGroupVersion("test.org", "v1").Get() )
Functions ¶
func CrdApiVersionAndKind ¶
func CrdApiVersionAndKind(crd *extensionv1.CustomResourceDefinition) (string, string)
CrdApiVersionAndKind returns the apiVersion and kind of the given CustomResourceDefinition
func CreateCRDApp ¶
func CreateCRDApp(podMeta v1.ObjectMeta, replicas int64, crd *extensionv1.CustomResourceDefinition) *unstructured.Unstructured
CreateCRDApp creates an app based on its child pod meta and custom resource definition
func CreateCRDPod ¶
func CreateCRDPod(name, namespace string, annotations map[string]string, crd *extensionv1.CustomResourceDefinition) *corev1.Pod
CreateCRDPod creates a pod based on its controller custom resource definition
Types ¶
type CustomResourceDefinitionBuilder ¶
type CustomResourceDefinitionBuilder interface { WithName(name string) CustomResourceDefinitionBuilder WithGroupVersion(group, version string) CustomResourceDefinitionBuilder WithSubresources(crs *extensionv1.CustomResourceSubresources) CustomResourceDefinitionBuilder Get() *extensionv1.CustomResourceDefinition }
CustomResourceDefinitionBuilder helps building CustomResourceDefinition for tests.
func CustomResourceDefinition ¶
func CustomResourceDefinition() CustomResourceDefinitionBuilder
CustomResourceDefinition returns new CustomResourceDefinitionBuilder.
type PodBuilder ¶
type PodBuilder interface { WithName(name string) PodBuilder WithNamespace(namespace string) PodBuilder AddContainer(container apiv1.Container) PodBuilder AddOwnerReferences(ownerReference metav1.OwnerReference) PodBuilder WithLabels(labels map[string]string) PodBuilder WithAnnotations(annotations map[string]string) PodBuilder WithPhase(phase apiv1.PodPhase) PodBuilder Get() *apiv1.Pod }
PodBuilder helps building pods for tests.
type UnstructuredBuilder ¶
type UnstructuredBuilder interface { WithName(name string) UnstructuredBuilder WithNamespace(namespace string) UnstructuredBuilder WithLabels(labels map[string]string) UnstructuredBuilder WithApiVersionKind(apiVersion, kind string) UnstructuredBuilder WithOwnerReferences(owners []metav1.OwnerReference) UnstructuredBuilder AddNestedField(value interface{}, fields ...string) UnstructuredBuilder Get() *unstructured.Unstructured }
UnstructuredBuilder helps building Unstructured for tests.
func Unstructured ¶
func Unstructured() UnstructuredBuilder
Unstructured returns new UnstructuredBuilder.