v1alpha1

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceKind     = "Service"
	ServiceListKind = "ServiceList"

	ServiceSingular  = "service"
	ServicePlural    = "services"
	ServiceShortName = "ts" // = Turandot (or TOSCA) Service

	ServiceNotInstantiated ServiceInstantiationState = "NotInstantiated"
	ServiceInstantiating   ServiceInstantiationState = "Instantiating"
	ServiceInstantiated    ServiceInstantiationState = "Instantiated"

	ModeAccepted ModeState = "Accepted"
	ModeRejected ModeState = "Rejected"
	ModeAchieved ModeState = "Achieved"
	ModeFailed   ModeState = "Failed"
)
View Source
const Version = "v1alpha1"

+k8s:deepcopy-gen=package +groupName=turandot.puccini.cloud

Variables

View Source
var AddToScheme = schemeBuilder.AddToScheme

Registers this API group and version to a scheme Note: Generator *requires* it to be called "AddToScheme"

View Source
var SchemeGroupVersion = schema.GroupVersion{Group: group.GroupName, Version: Version}

Group version used to register these objects Note: Generator *requires* it to be called "SchemeGroupVersion"

View Source
var ServiceCustomResourceDefinition = apiextensions.CustomResourceDefinition{
	ObjectMeta: meta.ObjectMeta{
		Name: ServiceResourcesName,
	},
	Spec: apiextensions.CustomResourceDefinitionSpec{
		Group: group.GroupName,
		Names: apiextensions.CustomResourceDefinitionNames{
			Singular: ServiceSingular,
			Plural:   ServicePlural,
			Kind:     ServiceKind,
			ListKind: ServiceListKind,
			ShortNames: []string{
				ServiceShortName,
			},
			Categories: []string{
				"all",
			},
		},
		Scope: apiextensions.NamespaceScoped,
		Versions: []apiextensions.CustomResourceDefinitionVersion{
			{
				Name:    Version,
				Served:  true,
				Storage: true,
				Subresources: &apiextensions.CustomResourceSubresources{
					Status: &apiextensions.CustomResourceSubresourceStatus{},
				},
				Schema: &apiextensions.CustomResourceValidation{
					OpenAPIV3Schema: &apiextensions.JSONSchemaProps{
						Description: "Turandot service",
						Type:        "object",
						Required:    []string{"spec"},
						Properties: map[string]apiextensions.JSONSchemaProps{
							"spec": {
								Type:     "object",
								Required: []string{"serviceTemplate"},
								Properties: map[string]apiextensions.JSONSchemaProps{
									"serviceTemplate": {
										Description: "Service template used to instantiate this service (can be a direct or indirect reference)",
										Type:        "object",
										Properties: map[string]apiextensions.JSONSchemaProps{
											"direct": {
												Description: "Direct reference to the service template used to instantiate this service",
												Type:        "object",
												Required:    []string{"url"},
												Properties: map[string]apiextensions.JSONSchemaProps{
													"url": {
														Description: "Full URL of service template (CSAR or YAML file)",
														Type:        "string",
													},
													"tlsSecret": {
														Description: "Name of TLS Secret required for connecting to the URL (optional)",
														Type:        "string",
													},
													"tlsSecretDataKey": {
														Description: "Name of key within the TLS Secret data required for connecting to the registry (optional)",
														Type:        "string",
													},
													"authSecret": {
														Description: "Name of authentication Secret required for connecting to the URL (optional)",
														Type:        "string",
													},
												},
											},
											"indirect": {
												Description: "Indirect reference to the service template used to instantiate this service",
												Type:        "object",
												Required:    []string{"registry", "name"},
												Properties: map[string]apiextensions.JSONSchemaProps{
													"namespace": {
														Description: "Namespace for Turandot registry resource (optional; defaults to same namespace as this service)",
														Type:        "string",
													},
													"registry": {
														Description: "Name of Turandot registry resource",
														Type:        "string",
													},
													"name": {
														Description: "Name of service template artifact in the registry (CSAR or YAML artifact)",
														Type:        "string",
													},
												},
											},
										},
										OneOf: []apiextensions.JSONSchemaProps{
											{
												Required: []string{"direct"},
											},
											{
												Required: []string{"indirect"},
											},
										},
									},
									"inputs": {
										Description: "TOSCA inputs to apply to the service template during instantiation",
										Type:        "object",
										Nullable:    true,
										AdditionalProperties: &apiextensions.JSONSchemaPropsOrBool{
											Schema: &apiextensions.JSONSchemaProps{
												Type: "string",
											},
										},
									},
									"mode": {
										Description: "Desired service mode",
										Type:        "string",
									},
								},
							},
							"status": {
								Type: "object",
								Properties: map[string]apiextensions.JSONSchemaProps{
									"cloutPath": {
										Description: "Path to instantiated service's Clout file (local to Turandot operator)",
										Type:        "string",
									},
									"cloutHash": {
										Description: "Last known hash of service's Clout file",
										Type:        "string",
									},
									"serviceTemplateUrl": {
										Description: "Full URL of service template (CSAR or YAML file)",
										Type:        "string",
									},
									"inputs": {
										Description: "TOSCA inputs that were applied to the service template when instantiatied",
										Type:        "object",
										Nullable:    true,
										AdditionalProperties: &apiextensions.JSONSchemaPropsOrBool{
											Schema: &apiextensions.JSONSchemaProps{
												Type: "string",
											},
										},
									},
									"outputs": {
										Description: "Last known TOSCA outputs",
										Type:        "object",
										Nullable:    true,
										AdditionalProperties: &apiextensions.JSONSchemaPropsOrBool{
											Schema: &apiextensions.JSONSchemaProps{
												Type: "string",
											},
										},
									},
									"instantiationState": {
										Description: "Current service instantiation state",
										Type:        "string",
										Enum: []apiextensions.JSON{
											kubernetes.JSONString(ServiceNotInstantiated),
											kubernetes.JSONString(ServiceInstantiating),
											kubernetes.JSONString(ServiceInstantiated),
										},
									},
									"mode": {
										Description: "Current service mode",
										Type:        "string",
									},
									"nodeStates": {
										Description: "Last known node states",
										Type:        "object",
										Nullable:    true,
										AdditionalProperties: &apiextensions.JSONSchemaPropsOrBool{
											Schema: &apiextensions.JSONSchemaProps{
												Type: "object",
												Properties: map[string]apiextensions.JSONSchemaProps{
													"mode": {
														Description: "Service mode",
														Type:        "string",
													},
													"state": {
														Description: "Node state for service mode",
														Type:        "string",
														Enum: []apiextensions.JSON{
															kubernetes.JSONString(ModeAccepted),
															kubernetes.JSONString(ModeRejected),
															kubernetes.JSONString(ModeAchieved),
															kubernetes.JSONString(ModeFailed),
														},
													},
													"message": {
														Description: "Human-readable information regarding the node state (optional)",
														Type:        "string",
													},
												},
											},
										},
									},
								},
							},
						},
					},
				},
				AdditionalPrinterColumns: []apiextensions.CustomResourceColumnDefinition{
					{
						Name:     "ServiceTemplateUrl",
						Type:     "string",
						JSONPath: ".status.serviceTemplateUrl",
					},
					{
						Name:     "Mode",
						Type:     "string",
						JSONPath: ".status.mode",
					},
				},
			},
		},
	},
}
View Source
var ServiceGVK = SchemeGroupVersion.WithKind(ServiceKind)
View Source
var ServiceResourcesName = fmt.Sprintf("%s.%s", ServicePlural, group.GroupName)

Functions

func Kind

func Kind(kind string) schema.GroupKind

Takes an unqualified kind and returns a group-qualified GroupKind Note: Generator *requires* it to be called "Kind"

func Resource

func Resource(resource string) schema.GroupResource

Takes an unqualified resource and returns a group-qualified GroupResource Note: Generator *requires* it to be called "Resource"

func ServiceToARD added in v0.4.0

func ServiceToARD(service *Service) ard.StringMap

Types

type ModeState added in v0.3.0

type ModeState string

type Service

type Service struct {
	meta.TypeMeta   `json:",inline"`
	meta.ObjectMeta `json:"metadata,omitempty"`

	Spec   ServiceSpec   `json:"spec"`
	Status ServiceStatus `json:"status"`
}

+genclient +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*Service) DeepCopy

func (in *Service) DeepCopy() *Service

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Service.

func (*Service) DeepCopyInto

func (in *Service) DeepCopyInto(out *Service)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Service) DeepCopyObject

func (in *Service) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ServiceInstantiationState added in v0.3.0

type ServiceInstantiationState string

type ServiceList

type ServiceList struct {
	meta.TypeMeta `json:",inline"`
	meta.ListMeta `json:"metadata"`

	Items []Service `json:"items"`
}

+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*ServiceList) DeepCopy

func (in *ServiceList) DeepCopy() *ServiceList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceList.

func (*ServiceList) DeepCopyInto

func (in *ServiceList) DeepCopyInto(out *ServiceList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ServiceList) DeepCopyObject

func (in *ServiceList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ServiceNodeModeState added in v0.3.0

type ServiceNodeModeState struct {
	Mode    string    `json:"mode"`    // Service mode
	State   ModeState `json:"state"`   // Node state for service mode
	Message string    `json:"message"` // Human-readable information regarding the node state (optional)
}

func (*ServiceNodeModeState) DeepCopy added in v0.3.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceNodeModeState.

func (*ServiceNodeModeState) DeepCopyInto added in v0.3.0

func (in *ServiceNodeModeState) DeepCopyInto(out *ServiceNodeModeState)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ServiceSpec

type ServiceSpec struct {
	ServiceTemplate ServiceTemplate   `json:"serviceTemplate"` // Service template used to instantiate this service (can be a direct or indirect reference)
	Inputs          map[string]string `json:"inputs"`          // TOSCA inputs to apply to the service template during instantiation
	Mode            string            `json:"mode"`            // Desired service mode
}

func (*ServiceSpec) DeepCopy

func (in *ServiceSpec) DeepCopy() *ServiceSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceSpec.

func (*ServiceSpec) DeepCopyInto

func (in *ServiceSpec) DeepCopyInto(out *ServiceSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ServiceStatus

type ServiceStatus struct {
	CloutPath string `json:"cloutPath"` // Path to instantiated service's Clout file (local to Turandot operator)
	CloutHash string `json:"cloutHash"` // Last known hash of service's Clout file

	ServiceTemplateURL string            `json:"serviceTemplateUrl"` // Full URL of service template (CSAR or YAML file)
	Inputs             map[string]string `json:"inputs"`             // TOSCA inputs that were applied to the service template when instantiatied
	Outputs            map[string]string `json:"outputs"`            // Last known TOSCA outputs

	InstantiationState ServiceInstantiationState       `json:"instantiationState"` // Current service instantiation state
	Mode               string                          `json:"mode"`               // Current service mode
	NodeStates         map[string]ServiceNodeModeState `json:"nodeStates"`         // Last known node states
}

func (*ServiceStatus) DeepCopy

func (in *ServiceStatus) DeepCopy() *ServiceStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceStatus.

func (*ServiceStatus) DeepCopyInto

func (in *ServiceStatus) DeepCopyInto(out *ServiceStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ServiceTemplate added in v0.4.0

type ServiceTemplate struct {
	Direct   *ServiceTemplateDirect   `json:"direct,omitempty"`   // Direct reference to the service template used to instantiate this service
	Indirect *ServiceTemplateIndirect `json:"indirect,omitempty"` // Indirect reference to the service template used to instantiate this service
}

func (*ServiceTemplate) DeepCopy added in v0.4.0

func (in *ServiceTemplate) DeepCopy() *ServiceTemplate

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceTemplate.

func (*ServiceTemplate) DeepCopyInto added in v0.4.0

func (in *ServiceTemplate) DeepCopyInto(out *ServiceTemplate)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ServiceTemplateDirect added in v0.4.0

type ServiceTemplateDirect struct {
	URL              string `json:"url"`                        // Full URL of service template (CSAR or YAML file)
	TLSSecret        string `json:"tlsSecret,omitempty"`        // Name of TLS Secret required for connecting to the URL (optional)
	TLSSecretDataKey string `json:"tlsSecretDataKey,omitempty"` // Name of key within the TLS Secret data required for connecting to the URL (optional)
	AuthSecret       string `json:"authSecret,omitempty"`       // Name of authentication Secret required for connecting to the URL (optional)
}

func (*ServiceTemplateDirect) DeepCopy added in v0.4.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceTemplateDirect.

func (*ServiceTemplateDirect) DeepCopyInto added in v0.4.0

func (in *ServiceTemplateDirect) DeepCopyInto(out *ServiceTemplateDirect)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ServiceTemplateIndirect added in v0.4.0

type ServiceTemplateIndirect struct {
	Namespace string `json:"namespace,omitempty"` // Namespace for Turandot registry resource (optional; defaults to same namespace as this service)
	Registry  string `json:"registry"`            // Name of Turandot registry resource
	Name      string `json:"name"`                // Name of service template artifact in the registry (CSAR or YAML artifact)
}

func (*ServiceTemplateIndirect) DeepCopy added in v0.4.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceTemplateIndirect.

func (*ServiceTemplateIndirect) DeepCopyInto added in v0.4.0

func (in *ServiceTemplateIndirect) DeepCopyInto(out *ServiceTemplateIndirect)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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