v1alpha2

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2023 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Overview

Package v1alpha2 contains API Schema definitions for the otterize v1alpha2 API group +kubebuilder:object:generate=true +groupName=k8s.otterize.com

Index

Constants

View Source
const (
	OtterizeAccessLabelPrefix              = "intents.otterize.com/access"
	OtterizeAccessLabelKey                 = "intents.otterize.com/access-%s"
	OtterizeClientLabelKey                 = "intents.otterize.com/client"
	OtterizeServerLabelKey                 = "intents.otterize.com/server"
	OtterizeNamespaceLabelKey              = "intents.otterize.com/namespace-name"
	AllIntentsRemovedAnnotation            = "intents.otterize.com/all-intents-removed"
	OtterizeCreatedForServiceAnnotation    = "intents.otterize.com/created-for-service"
	OtterizeCreatedForIngressAnnotation    = "intents.otterize.com/created-for-ingress"
	OtterizeNetworkPolicyNameTemplate      = "access-to-%s-from-%s"
	OtterizeNetworkPolicy                  = "intents.otterize.com/network-policy"
	OtterizeNetworkPolicyExternalTraffic   = "intents.otterize.com/network-policy-external-traffic"
	NetworkPolicyFinalizerName             = "intents.otterize.com/network-policy-finalizer"
	OtterizeTargetServerIndexField         = "spec.service.calls.server"
	EndpointsPodNamesIndexField            = "endpointsPodNames"
	IngressServiceNamesIndexField          = "ingressServiceNames"
	NetworkPoliciesByIngressNameIndexField = "networkPoliciesByIngressName"
	MaxOtterizeNameLength                  = 20
	MaxNamespaceLength                     = 20
)
View Source
const (
	ResourcePatternTypeLiteral = "literal"
	ResourcePatternTypePrefix  = "prefix"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "k8s.otterize.com", Version: "v1alpha2"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

func GetFormattedOtterizeIdentity

func GetFormattedOtterizeIdentity(name, ns string) string

GetFormattedOtterizeIdentity truncates names and namespaces to a 20 char len string (if required) It also adds a short md5 hash of the full name+ns string and returns the formatted string This is due to Kubernetes' limit on 63 char label keys/values

func GetOtterizeLabelsFromPod

func GetOtterizeLabelsFromPod(pod *v1.Pod) map[string]string

func HasOtterizeServerLabel

func HasOtterizeServerLabel(pod *v1.Pod, labelValue string) bool

func IsMissingOtterizeAccessLabels

func IsMissingOtterizeAccessLabels(pod *v1.Pod, otterizeAccessLabels map[string]string) bool

IsMissingOtterizeAccessLabels checks if a pod's labels need updating

func UpdateOtterizeAccessLabels

func UpdateOtterizeAccessLabels(pod *v1.Pod, otterizeAccessLabels map[string]string) *v1.Pod

UpdateOtterizeAccessLabels updates a pod's labels with Otterize labels representing their intents The pod is also labeled with "otterize-client=true" to mark it as having intents

Types

type ClientIntents

type ClientIntents struct {
	metav1.TypeMeta   `json:",inline" yaml:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`

	Spec   *IntentsSpec   `json:"spec,omitempty" yaml:"spec,omitempty"`
	Status *IntentsStatus `json:"status,omitempty" yaml:"status,omitempty"`
}

ClientIntents is the Schema for the intents API

func (*ClientIntents) BuildPodLabelSelector

func (in *ClientIntents) BuildPodLabelSelector() (labels.Selector, error)

BuildPodLabelSelector returns a label selector to match the otterize server labels for an intents resource

func (*ClientIntents) DeepCopy

func (in *ClientIntents) DeepCopy() *ClientIntents

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

func (*ClientIntents) DeepCopyInto

func (in *ClientIntents) DeepCopyInto(out *ClientIntents)

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

func (*ClientIntents) DeepCopyObject

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

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

func (*ClientIntents) GetCallsList

func (in *ClientIntents) GetCallsList() []Intent

func (*ClientIntents) GetIntentsLabelMapping

func (in *ClientIntents) GetIntentsLabelMapping(requestNamespace string) map[string]string

func (*ClientIntents) GetServiceName

func (in *ClientIntents) GetServiceName() string

func (*ClientIntents) HasKafkaTypeInCallList

func (in *ClientIntents) HasKafkaTypeInCallList() bool

type ClientIntentsList

type ClientIntentsList struct {
	metav1.TypeMeta `json:",inline" yaml:",inline"`
	metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`
	Items           []ClientIntents `json:"items" yaml:"items"`
}

ClientIntentsList contains a list of ClientIntents

func (*ClientIntentsList) DeepCopy

func (in *ClientIntentsList) DeepCopy() *ClientIntentsList

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

func (*ClientIntentsList) DeepCopyInto

func (in *ClientIntentsList) DeepCopyInto(out *ClientIntentsList)

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

func (*ClientIntentsList) DeepCopyObject

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

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

func (*ClientIntentsList) FormatAsOtterizeIntents

func (in *ClientIntentsList) FormatAsOtterizeIntents() ([]*graphqlclient.IntentInput, error)

type HTTPMethod

type HTTPMethod string

+kubebuilder:validation:Enum=GET;POST;PUT;DELETE;OPTIONS;TRACE;PATCH;CONNECT

const (
	HTTPMethodGet     HTTPMethod = "GET"
	HTTPMethodPost    HTTPMethod = "POST"
	HTTPMethodPut     HTTPMethod = "PUT"
	HTTPMethodDelete  HTTPMethod = "DELETE"
	HTTPMethodOptions HTTPMethod = "OPTIONS"
	HTTPMethodTrace   HTTPMethod = "TRACE"
	HTTPMethodPatch   HTTPMethod = "PATCH"
	HTTPMethodConnect HTTPMethod = "CONNECT"
)

type HTTPResource

type HTTPResource struct {
	Path    string       `json:"path"`
	Methods []HTTPMethod `json:"methods" yaml:"methods"`
}

func (*HTTPResource) DeepCopy

func (in *HTTPResource) DeepCopy() *HTTPResource

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

func (*HTTPResource) DeepCopyInto

func (in *HTTPResource) DeepCopyInto(out *HTTPResource)

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

type Intent

type Intent struct {
	Name string `json:"name" yaml:"name"`

	//+optional
	Type IntentType `json:"type,omitempty" yaml:"type,omitempty"`

	//+optional
	Topics []KafkaTopic `json:"topics,omitempty" yaml:"topics,omitempty"`

	//+optional
	HTTPResources []HTTPResource `json:"resources"`
}

func (*Intent) ConvertToCloudFormat

func (in *Intent) ConvertToCloudFormat(resourceNamespace string, clientName string) graphqlclient.IntentInput

func (*Intent) DeepCopy

func (in *Intent) DeepCopy() *Intent

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

func (*Intent) DeepCopyInto

func (in *Intent) DeepCopyInto(out *Intent)

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

func (*Intent) GetServerName

func (in *Intent) GetServerName() string

GetServerNamespace returns target namespace for intent if exists or the entire resource's namespace if the specific intent has no target namespace, as it's optional

func (*Intent) GetServerNamespace

func (in *Intent) GetServerNamespace(intentsObjNamespace string) string

GetServerNamespace returns target namespace for intent if exists or the entire resource's namespace if the specific intent has no target namespace, as it's optional

type IntentType

type IntentType string

+kubebuilder:validation:Enum=http;kafka

const (
	IntentTypeHTTP  IntentType = "http"
	IntentTypeKafka IntentType = "kafka"
)

type IntentsSpec

type IntentsSpec struct {
	Service Service  `json:"service" yaml:"service"`
	Calls   []Intent `json:"calls" yaml:"calls"`
}

IntentsSpec defines the desired state of ClientIntents

func (*IntentsSpec) DeepCopy

func (in *IntentsSpec) DeepCopy() *IntentsSpec

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

func (*IntentsSpec) DeepCopyInto

func (in *IntentsSpec) DeepCopyInto(out *IntentsSpec)

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

type IntentsStatus

type IntentsStatus struct {
}

IntentsStatus defines the observed state of ClientIntents

func (*IntentsStatus) DeepCopy

func (in *IntentsStatus) DeepCopy() *IntentsStatus

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

func (*IntentsStatus) DeepCopyInto

func (in *IntentsStatus) DeepCopyInto(out *IntentsStatus)

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

type KafkaOperation

type KafkaOperation string

+kubebuilder:validation:Enum=all;consume;produce;create;alter;delete;describe;ClusterAction;DescribeConfigs;AlterConfigs;IdempotentWrite

const (
	KafkaOperationAll             KafkaOperation = "all"
	KafkaOperationConsume         KafkaOperation = "consume"
	KafkaOperationProduce         KafkaOperation = "produce"
	KafkaOperationCreate          KafkaOperation = "create"
	KafkaOperationAlter           KafkaOperation = "alter"
	KafkaOperationDelete          KafkaOperation = "delete"
	KafkaOperationDescribe        KafkaOperation = "describe"
	KafkaOperationClusterAction   KafkaOperation = "ClusterAction"
	KafkaOperationDescribeConfigs KafkaOperation = "DescribeConfigs"
	KafkaOperationAlterConfigs    KafkaOperation = "AlterConfigs"
	KafkaOperationIdempotentWrite KafkaOperation = "IdempotentWrite"
)

type KafkaServerConfig

type KafkaServerConfig struct {
	metav1.TypeMeta   `json:",inline" yaml:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`

	Spec   KafkaServerConfigSpec   `json:"spec,omitempty" yaml:"spec,omitempty"`
	Status KafkaServerConfigStatus `json:"status,omitempty" yaml:"status,omitempty"`
}

KafkaServerConfig is the Schema for the kafkaserverconfigs API

func (*KafkaServerConfig) DeepCopy

func (in *KafkaServerConfig) DeepCopy() *KafkaServerConfig

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

func (*KafkaServerConfig) DeepCopyInto

func (in *KafkaServerConfig) DeepCopyInto(out *KafkaServerConfig)

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

func (*KafkaServerConfig) DeepCopyObject

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

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

type KafkaServerConfigList

type KafkaServerConfigList struct {
	metav1.TypeMeta `json:",inline" yaml:",inline"`
	metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`
	Items           []KafkaServerConfig `json:"items" yaml:"items"`
}

KafkaServerConfigList contains a list of KafkaServerConfig

func (*KafkaServerConfigList) DeepCopy

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

func (*KafkaServerConfigList) DeepCopyInto

func (in *KafkaServerConfigList) DeepCopyInto(out *KafkaServerConfigList)

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

func (*KafkaServerConfigList) DeepCopyObject

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

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

type KafkaServerConfigSpec

type KafkaServerConfigSpec struct {
	Service Service `json:"service,omitempty" yaml:"service,omitempty"`
	// If Intents for network policies are enabled, and there are other Intents to this Kafka server,
	// will automatically create an Intent so that the Intents Operator can connect. Set to true to disable.
	NoAutoCreateIntentsForOperator bool   `json:"noAutoCreateIntentsForOperator,omitempty" yaml:"noAutoCreateIntentsForOperator,omitempty"`
	Addr                           string `json:"addr,omitempty" yaml:"addr,omitempty"`
	// +kubebuilder:validation:Optional
	TLS    TLSSource     `json:"tls,omitempty" yaml:"tls,omitempty"`
	Topics []TopicConfig `json:"topics,omitempty" yaml:"topics,omitempty"`
}

KafkaServerConfigSpec defines the desired state of KafkaServerConfig

func (*KafkaServerConfigSpec) DeepCopy

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

func (*KafkaServerConfigSpec) DeepCopyInto

func (in *KafkaServerConfigSpec) DeepCopyInto(out *KafkaServerConfigSpec)

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

type KafkaServerConfigStatus

type KafkaServerConfigStatus struct {
}

KafkaServerConfigStatus defines the observed state of KafkaServerConfig

func (*KafkaServerConfigStatus) DeepCopy

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

func (*KafkaServerConfigStatus) DeepCopyInto

func (in *KafkaServerConfigStatus) DeepCopyInto(out *KafkaServerConfigStatus)

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

type KafkaTopic

type KafkaTopic struct {
	Name       string           `json:"name" yaml:"name"`
	Operations []KafkaOperation `json:"operations" yaml:"operations"`
}

func (*KafkaTopic) DeepCopy

func (in *KafkaTopic) DeepCopy() *KafkaTopic

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

func (*KafkaTopic) DeepCopyInto

func (in *KafkaTopic) DeepCopyInto(out *KafkaTopic)

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

type ResourcePatternType

type ResourcePatternType string

+kubebuilder:validation:Enum=literal;prefix

type Service

type Service struct {
	Name string `json:"name" yaml:"name"`
}

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.

type TLSSource

type TLSSource struct {
	// +kubebuilder:validation:Required
	CertFile string `json:"certFile" yaml:"certFile"`
	// +kubebuilder:validation:Required
	KeyFile string `json:"keyFile" yaml:"keyFile"`
	// +kubebuilder:validation:Required
	RootCAFile string `json:"rootCAFile" yaml:"rootCAFile"`
}

func (*TLSSource) DeepCopy

func (in *TLSSource) DeepCopy() *TLSSource

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

func (*TLSSource) DeepCopyInto

func (in *TLSSource) DeepCopyInto(out *TLSSource)

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

type TopicConfig

type TopicConfig struct {
	Topic                  string              `json:"topic" yaml:"topic"`
	Pattern                ResourcePatternType `json:"pattern" yaml:"pattern"`
	ClientIdentityRequired bool                `json:"clientIdentityRequired" yaml:"clientIdentityRequired"`
	IntentsRequired        bool                `json:"intentsRequired" yaml:"intentsRequired"`
}

func (*TopicConfig) DeepCopy

func (in *TopicConfig) DeepCopy() *TopicConfig

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

func (*TopicConfig) DeepCopyInto

func (in *TopicConfig) DeepCopyInto(out *TopicConfig)

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