kubernetes

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2020 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Kubernetes Controllers
	CronJobType               = "CronJob"
	DeploymentType            = "Deployment"
	DeploymentConfigType      = "DeploymentConfig"
	JobType                   = "Job"
	PodType                   = "Pod"
	ReplicationControllerType = "ReplicationController"
	ReplicaSetType            = "ReplicaSet"
	ServiceType               = "Service"
	StatefulSetType           = "StatefulSet"

	DestinationRules        = "destinationrules"
	DestinationRuleType     = "DestinationRule"
	DestinationRuleTypeList = "DestinationRuleList"

	Gateways        = "gateways"
	GatewayType     = "Gateway"
	GatewayTypeList = "GatewayList"

	EnvoyFilters        = "envoyfilters"
	EnvoyFilterType     = "EnvoyFilter"
	EnvoyFilterTypeList = "EnvoyFilterList"

	Sidecars        = "sidecars"
	SidecarType     = "Sidecar"
	SidecarTypeList = "SidecarList"

	ServiceEntries       = "serviceentries"
	ServiceEntryType     = "ServiceEntry"
	ServiceentryTypeList = "ServiceEntryList"

	VirtualServices        = "virtualservices"
	VirtualServiceType     = "VirtualService"
	VirtualServiceTypeList = "VirtualServiceList"

	WorkloadEntries       = "workloadentries"
	WorkloadEntryType     = "WorkloadEntry"
	WorkloadEntryTypeList = "WorkloadEntryList"

	QuotaSpecs        = "quotaspecs"
	QuotaSpecType     = "QuotaSpec"
	QuotaSpecTypeList = "QuotaSpecList"

	QuotaSpecBindings        = "quotaspecbindings"
	QuotaSpecBindingType     = "QuotaSpecBinding"
	QuotaSpecBindingTypeList = "QuotaSpecBindingList"

	Policies       = "policies"
	PolicyType     = "Policy"
	PolicyTypeList = "PolicyList"

	MeshPolicies       = "meshpolicies"
	MeshPolicyType     = "MeshPolicy"
	MeshPolicyTypeList = "MeshPolicyList"

	ServiceMeshPolicies       = "servicemeshpolicies"
	ServiceMeshPolicyType     = "ServiceMeshPolicy"
	ServiceMeshPolicyTypeList = "ServiceMeshPolicyList"

	// Rbac
	ClusterRbacConfigs        = "clusterrbacconfigs"
	ClusterRbacConfigType     = "ClusterRbacConfig"
	ClusterRbacConfigTypeList = "ClusterRbacConfigList"

	RbacConfigs        = "rbacconfigs"
	RbacConfigType     = "RbacConfig"
	RbacConfigTypeList = "RbacConfigList"

	ServiceRoles        = "serviceroles"
	ServiceRoleType     = "ServiceRole"
	ServiceRoleTypeList = "ServiceRoleList"

	ServiceRoleBindings        = "servicerolebindings"
	ServiceRoleBindingType     = "ServiceRoleBinding"
	ServiceRoleBindingTypeList = "ServiceRoleBindingList"

	ServiceMeshRbacConfigs        = "servicemeshrbacconfigs"
	ServiceMeshRbacConfigType     = "ServiceMeshRbacConfig"
	ServiceMeshRbacConfigTypeList = "ServiceMeshRbacConfigList"

	// Authorization PeerAuthentications
	AuthorizationPolicies         = "authorizationpolicies"
	AuthorizationPoliciesType     = "AuthorizationPolicy"
	AuthorizationPoliciesTypeList = "AuthorizationPolicyList"

	// Peer Authentications
	PeerAuthentications         = "peerauthentications"
	PeerAuthenticationsType     = "PeerAuthentication"
	PeerAuthenticationsTypeList = "PeerAuthenticationList"

	// Request Authentications
	RequestAuthentications         = "requestauthentications"
	RequestAuthenticationsType     = "RequestAuthentication"
	RequestAuthenticationsTypeList = "RequestAuthenticationList"

	// AttributeManifest
	AttributeManifests        = "attributemanifests"
	AttributeManifestType     = "attributemanifest"
	AttributeManifestTypeList = "attributemanifestList"

	// HttpApiSpecBinding
	HttpApiSpecBindings        = "httpapispecbindings"
	HttpApiSpecBindingType     = "HTTPAPISpecBinding"
	HttpApiSpecBindingTypeList = "HTTPAPISpecBindingList"

	// HttpApiSpec
	HttpApiSpecs        = "httpapispecs"
	HttpApiSpecType     = "HTTPAPISpec"
	HttpApiSpecTypeList = "HTTPAPISpecList"

	Rules        = "rules"
	RuleType     = "rule"
	RuleTypeList = "ruleList"

	Adapters        = "adapters"
	AdapterType     = "adapter"
	AdapterTypeList = "adapterList"

	Handlers        = "handlers"
	HandlerType     = "handler"
	HandlerTypeList = "handlerList"

	Instances        = "instances"
	InstanceType     = "instance"
	InstanceTypeList = "instanceList"

	Templates        = "templates"
	TemplateType     = "template"
	TemplateTypeList = "templateList"

	Iter8Experiments        = "experiments"
	Iter8ExperimentType     = "Experiment"
	Iter8ExperimentTypeList = "ExperimentList"
	Iter8ConfigMap          = "iter8config-metrics"
)

Variables

View Source
var (
	ConfigGroupVersion = schema.GroupVersion{
		Group:   "config.istio.io",
		Version: "v1alpha2",
	}
	ApiConfigVersion = ConfigGroupVersion.Group + "/" + ConfigGroupVersion.Version

	NetworkingGroupVersion = schema.GroupVersion{
		Group:   "networking.istio.io",
		Version: "v1alpha3",
	}
	ApiNetworkingVersion = NetworkingGroupVersion.Group + "/" + NetworkingGroupVersion.Version

	AuthenticationGroupVersion = schema.GroupVersion{
		Group:   "authentication.istio.io",
		Version: "v1alpha1",
	}
	ApiAuthenticationVersion = AuthenticationGroupVersion.Group + "/" + AuthenticationGroupVersion.Version

	RbacGroupVersion = schema.GroupVersion{
		Group:   "rbac.istio.io",
		Version: "v1alpha1",
	}
	ApiRbacVersion = RbacGroupVersion.Group + "/" + RbacGroupVersion.Version

	MaistraAuthenticationGroupVersion = schema.GroupVersion{
		Group:   "authentication.maistra.io",
		Version: "v1",
	}
	ApiMaistraAuthenticationVersion = MaistraAuthenticationGroupVersion.Group + "/" + MaistraAuthenticationGroupVersion.Version

	MaistraRbacGroupVersion = schema.GroupVersion{
		Group:   "rbac.maistra.io",
		Version: "v1",
	}
	ApiMaistraRbacVersion = MaistraRbacGroupVersion.Group + "/" + MaistraRbacGroupVersion.Version

	SecurityGroupVersion = schema.GroupVersion{
		Group:   "security.istio.io",
		Version: "v1beta1",
	}
	ApiSecurityVersion = SecurityGroupVersion.Group + "/" + SecurityGroupVersion.Version

	// We will add a new extesion API in a similar way as we added the Kubernetes + Istio APIs
	Iter8GroupVersion = schema.GroupVersion{
		Group:   "iter8.tools",
		Version: "v1alpha1",
	}
	ApiIter8Version = Iter8GroupVersion.Group + "/" + Iter8GroupVersion.Version

	// A map to get the plural for a Istio type using the singlar type
	PluralType = map[string]string{

		Gateways:         GatewayType,
		VirtualServices:  VirtualServiceType,
		DestinationRules: DestinationRuleType,
		ServiceEntries:   ServiceEntryType,
		Sidecars:         SidecarType,
		WorkloadEntries:  WorkloadEntryType,
		EnvoyFilters:     EnvoyFilterType,

		Rules:               RuleType,
		QuotaSpecs:          QuotaSpecType,
		QuotaSpecBindings:   QuotaSpecBindingType,
		AttributeManifests:  AttributeManifestType,
		HttpApiSpecBindings: HttpApiSpecBindingType,
		HttpApiSpecs:        HttpApiSpecType,
		Adapters:            AdapterType,
		Handlers:            HandlerType,
		Instances:           InstanceType,
		Templates:           TemplateType,

		Policies:            PolicyType,
		MeshPolicies:        MeshPolicyType,
		ServiceMeshPolicies: ServiceMeshPolicyType,

		ClusterRbacConfigs:     ClusterRbacConfigType,
		RbacConfigs:            RbacConfigType,
		ServiceRoles:           ServiceRoleType,
		ServiceRoleBindings:    ServiceRoleBindingType,
		ServiceMeshRbacConfigs: ServiceMeshRbacConfigType,

		AuthorizationPolicies:  AuthorizationPoliciesType,
		PeerAuthentications:    PeerAuthenticationsType,
		RequestAuthentications: RequestAuthenticationsType,

		Iter8Experiments: Iter8ExperimentType,
	}

	ResourceTypesToAPI = map[string]string{
		DestinationRules:       NetworkingGroupVersion.Group,
		VirtualServices:        NetworkingGroupVersion.Group,
		ServiceEntries:         NetworkingGroupVersion.Group,
		Gateways:               NetworkingGroupVersion.Group,
		Sidecars:               NetworkingGroupVersion.Group,
		WorkloadEntries:        NetworkingGroupVersion.Group,
		EnvoyFilters:           NetworkingGroupVersion.Group,
		Adapters:               ConfigGroupVersion.Group,
		Templates:              ConfigGroupVersion.Group,
		Rules:                  ConfigGroupVersion.Group,
		Handlers:               ConfigGroupVersion.Group,
		Instances:              ConfigGroupVersion.Group,
		QuotaSpecs:             ConfigGroupVersion.Group,
		QuotaSpecBindings:      ConfigGroupVersion.Group,
		AttributeManifests:     ConfigGroupVersion.Group,
		HttpApiSpecBindings:    ConfigGroupVersion.Group,
		HttpApiSpecs:           ConfigGroupVersion.Group,
		Policies:               AuthenticationGroupVersion.Group,
		MeshPolicies:           AuthenticationGroupVersion.Group,
		ClusterRbacConfigs:     RbacGroupVersion.Group,
		RbacConfigs:            RbacGroupVersion.Group,
		ServiceRoles:           RbacGroupVersion.Group,
		ServiceRoleBindings:    RbacGroupVersion.Group,
		ServiceMeshPolicies:    MaistraAuthenticationGroupVersion.Group,
		ServiceMeshRbacConfigs: MaistraRbacGroupVersion.Group,
		AuthorizationPolicies:  SecurityGroupVersion.Group,
		PeerAuthentications:    SecurityGroupVersion.Group,
		RequestAuthentications: SecurityGroupVersion.Group,

		Iter8Experiments: Iter8GroupVersion.Group,
	}

	ApiToVersion = map[string]string{
		NetworkingGroupVersion.Group:            ApiNetworkingVersion,
		ConfigGroupVersion.Group:                ApiConfigVersion,
		AuthenticationGroupVersion.Group:        ApiAuthenticationVersion,
		RbacGroupVersion.Group:                  ApiRbacVersion,
		MaistraAuthenticationGroupVersion.Group: ApiMaistraAuthenticationVersion,
		MaistraRbacGroupVersion.Group:           ApiMaistraRbacVersion,
		SecurityGroupVersion.Group:              ApiSecurityVersion,
	}
)
View Source
var KialiToken string

Functions

func ConfigClient

func ConfigClient() (*rest.Config, error)

ConfigClient return a client with the correct configuration Returns configuration if Kiali is in Cluster when InCluster is true Returns configuration if Kiali is not int Cluster when InCluster is false It returns an error on any problem

func DestinationRuleHasMTLSEnabledForHost added in v0.16.0

func DestinationRuleHasMTLSEnabledForHost(expectedHost string, destinationRule IstioObject) (bool, string)

func DestinationRuleHasMeshWideMTLSEnabled added in v0.16.0

func DestinationRuleHasMeshWideMTLSEnabled(destinationRule IstioObject) (bool, string)

func DestinationRuleHasNamespaceWideMTLSEnabled added in v0.16.0

func DestinationRuleHasNamespaceWideMTLSEnabled(namespace string, destinationRule IstioObject) (bool, string)

func FilterByHost

func FilterByHost(host, serviceName, namespace string) bool

func FilterByRoute added in v0.6.0

func FilterByRoute(spec map[string]interface{}, protocols []string, service string, namespace string, serviceEntries map[string]struct{}) bool

func FilterPodsForController added in v0.9.0

func FilterPodsForController(controllerName string, controllerType string, allPods []core_v1.Pod) []core_v1.Pod

func FilterPodsForEndpoints added in v0.8.0

func FilterPodsForEndpoints(endpoints *core_v1.Endpoints, unfiltered []core_v1.Pod) []core_v1.Pod

FilterPodsForEndpoints performs a second pass was selector may return too many data This case happens when a "nil" selector (such as one of default/kubernetes service) is used

func FilterPodsForSelector added in v0.9.0

func FilterPodsForSelector(selector labels.Selector, allPods []core_v1.Pod) []core_v1.Pod

func FilterPodsForService

func FilterPodsForService(s *core_v1.Service, allPods []core_v1.Pod) []core_v1.Pod

FilterPodsForService returns a subpart of pod list filtered according service selector

func FilterServicesForSelector added in v0.9.0

func FilterServicesForSelector(selector labels.Selector, allServices []core_v1.Service) []core_v1.Service

func GatewayNames added in v0.7.0

func GatewayNames(gateways [][]IstioObject) map[string]struct{}

GatewayNames extracts the gateway names for easier matching

func GetKialiToken added in v0.21.0

func GetKialiToken() (string, error)

func HasMatchingServiceEntries added in v1.15.0

func HasMatchingServiceEntries(service string, serviceEntries map[string][]string) bool

func HasMatchingServices added in v1.15.0

func HasMatchingServices(service string, services []core_v1.Service) bool

func HasMatchingWorkloads added in v1.15.0

func HasMatchingWorkloads(service string, workloadList []labels.Set) bool

func MatchPortNameRule added in v0.19.0

func MatchPortNameRule(portName, protocol string) bool

func MatchPortNameWithValidProtocols added in v0.19.0

func MatchPortNameWithValidProtocols(portName string) bool

func NewNotFound added in v0.7.0

func NewNotFound(name, group, resource string) error

NewNotFound is a helper method to create a NotFound error similar as used by the kubernetes client. This method helps upper layers to send a explicit NotFound error without querying the backend.

func ParseTwoPartHost added in v1.15.0

func ParseTwoPartHost(host Host) (string, string)

func PeerAuthnHasMTLSEnabled added in v1.18.1

func PeerAuthnHasMTLSEnabled(peerAuthn IstioObject) (bool, string)

func PeerAuthnHasStrictMTLS added in v1.18.1

func PeerAuthnHasStrictMTLS(peerAuthn IstioObject) bool

func ServiceEntryHostnames added in v0.7.0

func ServiceEntryHostnames(serviceEntries []IstioObject) map[string][]string

ServiceEntryHostnames returns a list of hostnames defined in the ServiceEntries Specs. Key in the resulting map is the protocol (in lowercase) + hostname exported for test

func ValidatePort added in v0.15.0

func ValidatePort(portDef interface{}) bool

ValidaPort parses the Istio Port definition and validates the naming scheme

Types

type ClientFactory added in v0.16.0

type ClientFactory interface {
	GetClient(token string) (ClientInterface, error)
}

ClientFactory interface for the clientFactory object

func GetClientFactory added in v0.17.0

func GetClientFactory() (ClientFactory, error)

GetClientFactory returns the client factory. Creates a new one if necessary

type ClientInterface added in v1.20.0

type ClientInterface interface {
	GetServerVersion() (*version.Info, error)
	GetToken() string
	GetIstioConfigMap() (*IstioMeshConfig, error)
	IsMaistraApi() bool
	IsOpenShift() bool
	IsMixerDisabled() bool
	K8SClientInterface
	IstioClientInterface
	Iter8ClientInterface
	OSClientInterface
}

ClientInterface for mocks (only mocked function are necessary here)

type GenericIstioObject added in v0.11.0

type GenericIstioObject struct {
	meta_v1.TypeMeta   `json:",inline" yaml:",inline"`
	meta_v1.ObjectMeta `json:"metadata" yaml:"metadata"`
	Spec               map[string]interface{} `json:"spec"`
}

GenericIstioObject is a type to test Istio types defined by Istio as a Kubernetes extension.

func (*GenericIstioObject) DeepCopy added in v0.11.0

func (in *GenericIstioObject) DeepCopy() *GenericIstioObject

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

func (*GenericIstioObject) DeepCopyInto added in v0.11.0

func (in *GenericIstioObject) DeepCopyInto(out *GenericIstioObject)

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

func (*GenericIstioObject) DeepCopyIstioObject added in v0.11.0

func (in *GenericIstioObject) DeepCopyIstioObject() IstioObject

DeepCopyIstioObject is an autogenerated deepcopy function, copying the receiver, creating a new IstioObject.

func (*GenericIstioObject) DeepCopyObject added in v0.11.0

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

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

func (*GenericIstioObject) GetObjectMeta added in v0.11.0

func (in *GenericIstioObject) GetObjectMeta() meta_v1.ObjectMeta

GetObjectMeta from a wrapper

func (*GenericIstioObject) GetSpec added in v0.11.0

func (in *GenericIstioObject) GetSpec() map[string]interface{}

GetSpec from a wrapper

func (*GenericIstioObject) GetTypeMeta added in v0.16.0

func (in *GenericIstioObject) GetTypeMeta() meta_v1.TypeMeta

GetTypeMeta from a wrapper

func (*GenericIstioObject) HasMatchLabelsSelector added in v1.18.1

func (in *GenericIstioObject) HasMatchLabelsSelector() bool

func (*GenericIstioObject) HasWorkloadSelectorLabels added in v1.16.0

func (in *GenericIstioObject) HasWorkloadSelectorLabels() bool

func (*GenericIstioObject) SetObjectMeta added in v0.11.0

func (in *GenericIstioObject) SetObjectMeta(metadata meta_v1.ObjectMeta)

SetObjectMeta for a wrapper

func (*GenericIstioObject) SetSpec added in v0.11.0

func (in *GenericIstioObject) SetSpec(spec map[string]interface{})

SetSpec for a wrapper

func (*GenericIstioObject) SetTypeMeta added in v0.16.0

func (in *GenericIstioObject) SetTypeMeta(typemeta meta_v1.TypeMeta)

SetObjectMeta for a wrapper

type GenericIstioObjectList added in v0.11.0

type GenericIstioObjectList struct {
	meta_v1.TypeMeta `json:",inline"`
	meta_v1.ListMeta `json:"metadata"`
	Items            []GenericIstioObject `json:"items"`
}

GenericIstioObjectList is the generic Kubernetes API list wrapper

func (*GenericIstioObjectList) DeepCopy added in v0.11.0

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

func (*GenericIstioObjectList) DeepCopyInto added in v0.11.0

func (in *GenericIstioObjectList) DeepCopyInto(out *GenericIstioObjectList)

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

func (*GenericIstioObjectList) DeepCopyObject added in v0.11.0

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

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

func (*GenericIstioObjectList) GetItems added in v0.11.0

func (in *GenericIstioObjectList) GetItems() []IstioObject

GetItems from a wrapper

type Host added in v0.15.0

type Host struct {
	Service   string
	Namespace string
	Cluster   string
	// CompleteInput is true when Service, Namespace and Cluster fields are present.
	// It is true for simple service names and FQDN services.
	// It is false for service.namespace format and service entries.
	CompleteInput bool
}

Host represents the FQDN format for Istio hostnames

func GetHost added in v1.12.0

func GetHost(hostName, namespace, cluster string, clusterNamespaces []string) Host

GetHost parses hostName and returns a Host struct. It considers Namespaces in the cluster to be more accurate when deciding if the hostName is a ServiceEntry or a service.namespace host definition.

func ParseGatewayAsHost added in v1.19.0

func ParseGatewayAsHost(gateway, currentNamespace, currentCluster string) Host

func ParseHost added in v0.15.0

func ParseHost(hostName, namespace, cluster string) Host

ParseHost takes as an input a hostname (simple or full FQDN), namespace and clusterName and returns a parsed Host struct

func (Host) String added in v0.15.0

func (h Host) String() string

String outputs a full FQDN version of the Host

type IstioClientInterface

type IstioClientInterface interface {
	GetAuthorizationDetails(namespace string) (*RBACDetails, error)
	CreateIstioObject(api, namespace, resourceType, json string) (IstioObject, error)
	DeleteIstioObject(api, namespace, resourceType, name string) error
	GetIstioObject(namespace, resourceType, name string) (IstioObject, error)
	GetIstioObjects(namespace, resourceType, labelSelector string) ([]IstioObject, error)
	UpdateIstioObject(api, namespace, resourceType, name, jsonPatch string) (IstioObject, error)
}

type IstioDetails

type IstioDetails struct {
	VirtualServices  []IstioObject `json:"virtualservices"`
	DestinationRules []IstioObject `json:"destinationrules"`
	ServiceEntries   []IstioObject `json:"serviceentries"`
	Gateways         []IstioObject `json:"gateways"`
	Sidecars         []IstioObject `json:"sidecars"`
}

IstioDetails is a wrapper to group all Istio objects related to a Service. Used to fetch all Istio information in a single operation instead to invoke individual APIs per each group.

type IstioMeshConfig added in v1.18.1

type IstioMeshConfig struct {
	DisableMixerHttpReports bool  `yaml:"disableMixerHttpReports,omitempty"`
	EnableAutoMtls          *bool `yaml:"enableAutoMtls,omitempty"`
}

func (IstioMeshConfig) GetEnableAutoMtls added in v1.18.1

func (imc IstioMeshConfig) GetEnableAutoMtls() bool

type IstioObject

type IstioObject interface {
	runtime.Object
	GetSpec() map[string]interface{}
	SetSpec(map[string]interface{})
	GetTypeMeta() meta_v1.TypeMeta
	SetTypeMeta(meta_v1.TypeMeta)
	GetObjectMeta() meta_v1.ObjectMeta
	SetObjectMeta(meta_v1.ObjectMeta)
	DeepCopyIstioObject() IstioObject
	HasWorkloadSelectorLabels() bool
	HasMatchLabelsSelector() bool
}

IstioObject is a k8s wrapper interface for config objects. Taken from istio.io

func FilterDestinationRules added in v1.8.0

func FilterDestinationRules(allDr []IstioObject, namespace string, serviceName string) []IstioObject

func FilterVirtualServices added in v1.8.0

func FilterVirtualServices(allVs []IstioObject, namespace string, serviceName string) []IstioObject

type IstioObjectList

type IstioObjectList interface {
	runtime.Object
	GetItems() []IstioObject
}

IstioObjectList is a k8s wrapper interface for list config objects. Taken from istio.io

type Iter8AnalyticMetric added in v1.18.1

type Iter8AnalyticMetric struct {
	Name               string `yaml:"name"`
	IsCounter          bool   `yaml:"is_counter"`
	AbsentValue        string `yaml:"absent_value"`
	SampleSizeTemplate string `yaml:"sample_size_query_template"`
}

Metric structure of cm/iter8_metric

type Iter8ClientInterface added in v1.15.0

type Iter8ClientInterface interface {
	CreateIter8Experiment(namespace string, json string) (Iter8Experiment, error)
	UpdateIter8Experiment(namespace string, name string, json string) (Iter8Experiment, error)
	DeleteIter8Experiment(namespace string, name string) error
	GetIter8Experiment(namespace string, name string) (Iter8Experiment, error)
	GetIter8Experiments(namespace string) ([]Iter8Experiment, error)
	IsIter8Api() bool
	Iter8ConfigMap() ([]string, error)
}

type Iter8Experiment added in v1.15.0

type Iter8Experiment interface {
	runtime.Object
	GetSpec() Iter8ExperimentSpec
	SetSpec(Iter8ExperimentSpec)
	GetStatus() Iter8ExperimentStatus
	SetStatus(Iter8ExperimentStatus)
	GetMetrics() Iter8ExperimentMetrics
	SetMetrics(Iter8ExperimentMetrics)
	GetTypeMeta() meta_v1.TypeMeta
	SetTypeMeta(meta_v1.TypeMeta)
	GetObjectMeta() meta_v1.ObjectMeta
	SetObjectMeta(meta_v1.ObjectMeta)
	DeepCopyIter8Object() Iter8Experiment
}

Iter8Experiment is a dynamic object to map Iter8 Experiments

type Iter8ExperimentAction added in v1.20.0

type Iter8ExperimentAction string

type Iter8ExperimentList added in v1.15.0

type Iter8ExperimentList interface {
	runtime.Object
	GetItems() []Iter8Experiment
}

type Iter8ExperimentMetrics added in v1.15.0

type Iter8ExperimentMetrics map[string]struct {
	AbsentValue        string `json:"absent_value,omitempty"`
	IsCounter          bool   `json:"is_counter,omitempty"`
	QueryTemplate      string `json:"query_template,omitempty"`
	SampleSizeTemplate string `json:"sample_size_template,omitempty"`
}

type Iter8ExperimentObject added in v1.15.0

type Iter8ExperimentObject struct {
	meta_v1.TypeMeta   `json:",inline"`
	meta_v1.ObjectMeta `json:"metadata"`
	Spec               Iter8ExperimentSpec    `json:"spec"`
	Status             Iter8ExperimentStatus  `json:"status"`
	Metrics            Iter8ExperimentMetrics `json:"metrics"`
	Action             Iter8ExperimentAction  `json:"action,omitempty"`
}

func (*Iter8ExperimentObject) DeepCopy added in v1.15.0

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

func (*Iter8ExperimentObject) DeepCopyInto added in v1.15.0

func (in *Iter8ExperimentObject) DeepCopyInto(out *Iter8ExperimentObject)

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

func (*Iter8ExperimentObject) DeepCopyIter8Object added in v1.15.0

func (in *Iter8ExperimentObject) DeepCopyIter8Object() Iter8Experiment

func (*Iter8ExperimentObject) DeepCopyObject added in v1.15.0

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

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

func (*Iter8ExperimentObject) GetMetrics added in v1.15.0

func (*Iter8ExperimentObject) GetObjectMeta added in v1.15.0

func (in *Iter8ExperimentObject) GetObjectMeta() meta_v1.ObjectMeta

GetObjectMeta from a wrapper

func (*Iter8ExperimentObject) GetSpec added in v1.15.0

GetSpec from a wrapper

func (*Iter8ExperimentObject) GetStatus added in v1.15.0

func (*Iter8ExperimentObject) GetTypeMeta added in v1.15.0

func (in *Iter8ExperimentObject) GetTypeMeta() meta_v1.TypeMeta

GetTypeMeta from a wrapper

func (*Iter8ExperimentObject) SetMetrics added in v1.15.0

func (in *Iter8ExperimentObject) SetMetrics(metrics Iter8ExperimentMetrics)

SetSpec for a wrapper

func (*Iter8ExperimentObject) SetObjectMeta added in v1.15.0

func (in *Iter8ExperimentObject) SetObjectMeta(metadata meta_v1.ObjectMeta)

SetObjectMeta for a wrapper

func (*Iter8ExperimentObject) SetSpec added in v1.15.0

func (in *Iter8ExperimentObject) SetSpec(spec Iter8ExperimentSpec)

SetSpec for a wrapper

func (*Iter8ExperimentObject) SetStatus added in v1.15.0

func (in *Iter8ExperimentObject) SetStatus(status Iter8ExperimentStatus)

SetStatus for a wrapper

func (*Iter8ExperimentObject) SetTypeMeta added in v1.15.0

func (in *Iter8ExperimentObject) SetTypeMeta(typemeta meta_v1.TypeMeta)

SetObjectMeta for a wrapper

type Iter8ExperimentObjectList added in v1.15.0

type Iter8ExperimentObjectList struct {
	meta_v1.TypeMeta `json:",inline"`
	meta_v1.ListMeta `json:"metadata"`
	Items            []Iter8ExperimentObject `json:"items"`
}

func (*Iter8ExperimentObjectList) DeepCopy added in v1.15.0

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

func (*Iter8ExperimentObjectList) DeepCopyInto added in v1.15.0

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

func (*Iter8ExperimentObjectList) DeepCopyObject added in v1.15.0

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

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

func (*Iter8ExperimentObjectList) GetItems added in v1.15.0

func (in *Iter8ExperimentObjectList) GetItems() []Iter8Experiment

GetItems from a wrapper

type Iter8ExperimentSpec added in v1.15.0

type Iter8ExperimentSpec struct {
	TargetService struct {
		ApiVersion string `json:"apiVersion"`
		Name       string `json:"name"`
		Namespace  string `json:"namespace"`
		Baseline   string `json:"baseline"`
		Candidate  string `json:"candidate"`
	} `json:"targetService"`
	TrafficControl struct {
		Strategy             string  `json:"strategy,omitempty"`
		MaxTrafficPercentage float64 `json:"maxTrafficPercentage,omitempty"`
		TrafficStepSize      float64 `json:"trafficStepSize,omitempty"`
		Interval             string  `json:"interval,omitempty"`
		MaxIterations        int     `json:"maxIterations,omitempty"`
		OnSuccess            string  `json:"onSuccess,omitempty"`
		Confidence           float64 `json:"confidence,omitempty"`
	} `json:"trafficControl,omitempty"`
	Analysis struct {
		AnalyticsService string `json:"analyticsService,omitempty"`
		GrafanaEndpoint  string `json:"grafanaEndpoint,omitempty"`
		SuccessCriteria  []struct {
			MetricName    string  `json:"metricName,omitempty"`
			ToleranceType string  `json:"toleranceType,omitempty"`
			Tolerance     float64 `json:"tolerance,omitempty"`
			SampleSize    int     `json:"sampleSize,omitempty"`
			MinMax        struct {
				Min float64 `json:"min,omitempty"`
				Max float64 `json:"max,omitempty"`
			} `json:"min_max,omitempty"`
			StopOnFailure bool `json:"stopOnFailure,omitempty"`
		} `json:"successCriteria,omitempty"`
		Reward *struct {
			MetricName string `json:"metricName,omitempty"`
			MinMax     string `json:"min_max,omitempty"`
		} `json:"reward,omitempty"`
	} `json:"analysis,omitempty"`
	Assessment       string                   `json:"assessment,omitempty"`
	Cleanup          string                   `json:"cleanup,omitempty"`
	RoutingReference *core_v1.ObjectReference `json:"routingReference,omitempty"`
}

Linked with https://github.com/iter8-tools/iter8-controller/blob/master/pkg/apis/iter8/v1alpha1/experiment_types.go

type Iter8ExperimentStatus added in v1.15.0

type Iter8ExperimentStatus struct {
	Conditions []struct {
		LastTransitionTime string `json:"lastTransitionTime"`
		Message            string `json:"message"`
		Reason             string `json:"reason"`
		Status             string `json:"status"`
		Type               string `json:"type"`
	} `json:"conditions"`
	CreateTimeStamp   int64                  `json:"createTimestamp"`
	StartTimeStamp    int64                  `json:"startTimestamp"`
	EndTimestamp      int64                  `json:"endTimestamp"`
	LastIncrementTime string                 `json:"lastIncrementTime"`
	CurrentIteration  int                    `json:"currentIteration"`
	AnalysisState     map[string]interface{} `json:"analysisState"`
	GrafanaURL        string                 `json:"grafanaURL"`
	Assestment        struct {
		Conclusions           []string `json:"conclusions"`
		AllSuccessCriteriaMet bool     `json:"all_success_criteria_met,omitempty"`
		AbortExperiment       bool     `json:"abort_experiment,omitempty"`
		SuccessCriteriaStatus []struct {
			// Name of the metric to which the criterion applies
			// example: iter8_latency
			MetricName string `json:"metric_name"`

			// Assessment of this success criteria in plain English
			Conclusions []string `json:"conclusions"`

			// Indicates whether or not the success criterion for the corresponding metric has been met
			SuccessCriterionMet bool `json:"success_criterion_met"`

			// Indicates whether or not the experiment must be aborted on the basis of the criterion for this metric
			AbortExperiment bool `json:"abort_experiment"`
		} `json:"success_criteria,omitempty"`
	} `json:"assessment"`
	TrafficSplitPercentage struct {
		Baseline  int `json:"baseline"`
		Candidate int `json:"candidate"`
	} `json:"trafficSplitPercentage"`
	Phase   string `json:"phase"`
	Message string `json:"message"`
}

type K8SClient added in v1.20.0

type K8SClient struct {
	ClientInterface
	// contains filtered or unexported fields
}

K8SClient is the client struct for Kubernetes and Istio APIs It hides the way it queries each API

func NewClientFromConfig added in v0.9.0

func NewClientFromConfig(config *rest.Config) (*K8SClient, error)

NewClientFromConfig creates a new client to the Kubernetes and Istio APIs. It takes the assumption that Istio is deployed into the cluster. It hides the access to Kubernetes/Openshift credentials. It hides the low level use of the API of Kubernetes and Istio, it should be considered as an implementation detail. It returns an error on any problem.

func (*K8SClient) CreateIstioObject added in v1.20.0

func (in *K8SClient) CreateIstioObject(api, namespace, resourceType, json string) (IstioObject, error)

CreateIstioObject creates an Istio object

func (*K8SClient) CreateIter8Experiment added in v1.20.0

func (in *K8SClient) CreateIter8Experiment(namespace string, json string) (Iter8Experiment, error)

func (*K8SClient) DeleteIstioObject added in v1.20.0

func (in *K8SClient) DeleteIstioObject(api, namespace, resourceType, name string) error

DeleteIstioObject deletes an Istio object from either config api or networking api

func (*K8SClient) DeleteIter8Experiment added in v1.20.0

func (in *K8SClient) DeleteIter8Experiment(namespace string, name string) error

func (*K8SClient) GetAuthorizationDetails added in v1.20.0

func (in *K8SClient) GetAuthorizationDetails(namespace string) (*RBACDetails, error)

GetAuthorizationDetails returns ServiceRoles, ServiceRoleBindings and ClusterRbacDetails

func (*K8SClient) GetConfigMap added in v1.20.0

func (in *K8SClient) GetConfigMap(namespace, configName string) (*core_v1.ConfigMap, error)

GetConfigMap fetches and returns the specified ConfigMap definition from the cluster

func (*K8SClient) GetCronJobs added in v1.20.0

func (in *K8SClient) GetCronJobs(namespace string) ([]batch_v1beta1.CronJob, error)

func (*K8SClient) GetDeployment added in v1.20.0

func (in *K8SClient) GetDeployment(namespace, deploymentName string) (*apps_v1.Deployment, error)

GetDeployment returns the definition of a specific deployment. It returns an error on any problem.

func (*K8SClient) GetDeploymentConfig added in v1.20.0

func (in *K8SClient) GetDeploymentConfig(namespace, deploymentconfigName string) (*osapps_v1.DeploymentConfig, error)

GetDeployment returns the definition of a specific deployment. It returns an error on any problem.

func (*K8SClient) GetDeploymentConfigs added in v1.20.0

func (in *K8SClient) GetDeploymentConfigs(namespace string) ([]osapps_v1.DeploymentConfig, error)

GetDeployments returns an array of deployments for a given namespace. An empty labelSelector will fetch all Deployments for a namespace. It returns an error on any problem.

func (*K8SClient) GetDeployments added in v1.20.0

func (in *K8SClient) GetDeployments(namespace string) ([]apps_v1.Deployment, error)

GetDeployments returns an array of deployments for a given namespace. It returns an error on any problem.

func (*K8SClient) GetDeploymentsByLabel added in v1.20.0

func (in *K8SClient) GetDeploymentsByLabel(namespace string, labelSelector string) ([]apps_v1.Deployment, error)

GetDeployments returns an array of deployments for a given namespace and a set of labels. An empty labelSelector will fetch all Deployments for a namespace. It returns an error on any problem.

func (*K8SClient) GetEndpoints added in v1.20.0

func (in *K8SClient) GetEndpoints(namespace, serviceName string) (*core_v1.Endpoints, error)

GetEndpoints return the list of endpoint of a specific service. It returns an error on any problem.

func (*K8SClient) GetIstioConfigApi added in v1.20.0

func (client *K8SClient) GetIstioConfigApi() *rest.RESTClient

GetIstioConfigApi returns the istio config rest client

func (*K8SClient) GetIstioConfigMap added in v1.20.0

func (in *K8SClient) GetIstioConfigMap() (*IstioMeshConfig, error)

func (*K8SClient) GetIstioNetworkingApi added in v1.20.0

func (client *K8SClient) GetIstioNetworkingApi() *rest.RESTClient

GetIstioNetworkingApi returns the istio config rest client

func (*K8SClient) GetIstioObject added in v1.20.0

func (in *K8SClient) GetIstioObject(namespace, resourceType, name string) (IstioObject, error)

func (*K8SClient) GetIstioObjects added in v1.20.0

func (in *K8SClient) GetIstioObjects(namespace, resourceType, labelSelector string) ([]IstioObject, error)

func (*K8SClient) GetIstioRbacApi added in v1.20.0

func (client *K8SClient) GetIstioRbacApi() *rest.RESTClient

GetIstioRbacApi returns the istio rbac rest client

func (*K8SClient) GetIstioSecurityApi added in v1.20.0

func (client *K8SClient) GetIstioSecurityApi() *rest.RESTClient

GetIstioSecurityApi returns the istio security rest client

func (*K8SClient) GetIter8Experiment added in v1.20.0

func (in *K8SClient) GetIter8Experiment(namespace string, name string) (Iter8Experiment, error)

func (*K8SClient) GetIter8Experiments added in v1.20.0

func (in *K8SClient) GetIter8Experiments(namespace string) ([]Iter8Experiment, error)

func (*K8SClient) GetJobs added in v1.20.0

func (in *K8SClient) GetJobs(namespace string) ([]batch_v1.Job, error)

func (*K8SClient) GetK8sApi added in v1.20.0

func (client *K8SClient) GetK8sApi() *kube.Clientset

GetK8sApi returns the clientset referencing all K8s rest clients

func (*K8SClient) GetNamespace added in v1.20.0

func (in *K8SClient) GetNamespace(namespace string) (*core_v1.Namespace, error)

GetNamespace fetches and returns the specified namespace definition from the cluster

func (*K8SClient) GetNamespaces added in v1.20.0

func (in *K8SClient) GetNamespaces(labelSelector string) ([]core_v1.Namespace, error)

GetNamespaces returns a list of all namespaces of the cluster. It returns a list of all namespaces of the cluster. It returns an error on any problem.

func (*K8SClient) GetPod added in v1.20.0

func (in *K8SClient) GetPod(namespace, name string) (*core_v1.Pod, error)

GetPod returns the pod definitions for a given pod name. It returns an error on any problem.

func (*K8SClient) GetPodLogs added in v1.20.0

func (in *K8SClient) GetPodLogs(namespace, name string, opts *core_v1.PodLogOptions) (*PodLogs, error)

GetPod returns the pod definitions for a given pod name. It returns an error on any problem.

func (*K8SClient) GetPods added in v1.20.0

func (in *K8SClient) GetPods(namespace, labelSelector string) ([]core_v1.Pod, error)

GetPods returns the pods definitions for a given set of labels. An empty labelSelector will fetch all pods found per a namespace. It returns an error on any problem.

func (*K8SClient) GetProject added in v1.20.0

func (in *K8SClient) GetProject(name string) (*osproject_v1.Project, error)

GetProject fetches and returns the definition of the project with the specified name by querying the cluster API. GetProject will fail if the underlying cluster is not Openshift.

func (*K8SClient) GetProjects added in v1.20.0

func (in *K8SClient) GetProjects(labelSelector string) ([]osproject_v1.Project, error)

func (*K8SClient) GetReplicaSets added in v1.20.0

func (in *K8SClient) GetReplicaSets(namespace string) ([]apps_v1.ReplicaSet, error)

func (*K8SClient) GetReplicationControllers added in v1.20.0

func (in *K8SClient) GetReplicationControllers(namespace string) ([]core_v1.ReplicationController, error)

func (*K8SClient) GetRoute added in v1.20.0

func (in *K8SClient) GetRoute(namespace, name string) (*osroutes_v1.Route, error)

GetRoute returns the external URL endpoint of a specific route name. It returns an error on any problem.

func (*K8SClient) GetSelfSubjectAccessReview added in v1.20.0

func (in *K8SClient) GetSelfSubjectAccessReview(namespace, api, resourceType string, verbs []string) ([]*auth_v1.SelfSubjectAccessReview, error)

GetSelfSubjectAccessReview provides information on Kiali permissions

func (*K8SClient) GetServerVersion added in v1.20.0

func (in *K8SClient) GetServerVersion() (*version.Info, error)

GetServerVersion fetches and returns information about the version Kubernetes that is running

func (*K8SClient) GetService added in v1.20.0

func (in *K8SClient) GetService(namespace, serviceName string) (*core_v1.Service, error)

GetService returns the definition of a specific service. It returns an error on any problem.

func (*K8SClient) GetServices added in v1.20.0

func (in *K8SClient) GetServices(namespace string, selectorLabels map[string]string) ([]core_v1.Service, error)

GetServices returns a list of services for a given namespace. If selectorLabels is defined the list of services is filtered for those that matches Services selector labels. It returns an error on any problem.

func (*K8SClient) GetStatefulSet added in v1.20.0

func (in *K8SClient) GetStatefulSet(namespace string, statefulsetName string) (*apps_v1.StatefulSet, error)

func (*K8SClient) GetStatefulSets added in v1.20.0

func (in *K8SClient) GetStatefulSets(namespace string) ([]apps_v1.StatefulSet, error)

func (*K8SClient) GetToken added in v1.20.0

func (client *K8SClient) GetToken() string

GetToken returns the BearerToken used from the config

func (*K8SClient) IsIter8Api added in v1.20.0

func (in *K8SClient) IsIter8Api() bool

func (*K8SClient) IsMaistraApi added in v1.20.0

func (in *K8SClient) IsMaistraApi() bool

func (*K8SClient) IsMixerDisabled added in v1.20.0

func (in *K8SClient) IsMixerDisabled() bool

func (*K8SClient) IsOpenShift added in v1.20.0

func (in *K8SClient) IsOpenShift() bool

func (*K8SClient) Iter8ConfigMap added in v1.20.0

func (in *K8SClient) Iter8ConfigMap() ([]string, error)

func (*K8SClient) UpdateIstioObject added in v1.20.0

func (in *K8SClient) UpdateIstioObject(api, namespace, resourceType, name, jsonPatch string) (IstioObject, error)

UpdateIstioObject updates an Istio object from either config api or networking api

func (*K8SClient) UpdateIter8Experiment added in v1.20.0

func (in *K8SClient) UpdateIter8Experiment(namespace string, name string, json string) (Iter8Experiment, error)

type K8SClientInterface added in v1.20.0

type K8SClientInterface interface {
	GetConfigMap(namespace, configName string) (*core_v1.ConfigMap, error)
	GetCronJobs(namespace string) ([]batch_v1beta1.CronJob, error)
	GetDeployment(namespace string, deploymentName string) (*apps_v1.Deployment, error)
	GetDeployments(namespace string) ([]apps_v1.Deployment, error)
	GetDeploymentsByLabel(namespace string, labelSelector string) ([]apps_v1.Deployment, error)
	GetDeploymentConfig(namespace string, deploymentconfigName string) (*osapps_v1.DeploymentConfig, error)
	GetDeploymentConfigs(namespace string) ([]osapps_v1.DeploymentConfig, error)
	GetEndpoints(namespace string, serviceName string) (*core_v1.Endpoints, error)
	GetJobs(namespace string) ([]batch_v1.Job, error)
	GetNamespace(namespace string) (*core_v1.Namespace, error)
	GetNamespaces(labelSelector string) ([]core_v1.Namespace, error)
	GetPod(namespace, name string) (*core_v1.Pod, error)
	GetPodLogs(namespace, name string, opts *core_v1.PodLogOptions) (*PodLogs, error)
	GetPods(namespace, labelSelector string) ([]core_v1.Pod, error)
	GetReplicationControllers(namespace string) ([]core_v1.ReplicationController, error)
	GetReplicaSets(namespace string) ([]apps_v1.ReplicaSet, error)
	GetSelfSubjectAccessReview(namespace, api, resourceType string, verbs []string) ([]*auth_v1.SelfSubjectAccessReview, error)
	GetService(namespace string, serviceName string) (*core_v1.Service, error)
	GetServices(namespace string, selectorLabels map[string]string) ([]core_v1.Service, error)
	GetStatefulSet(namespace string, statefulsetName string) (*apps_v1.StatefulSet, error)
	GetStatefulSets(namespace string) ([]apps_v1.StatefulSet, error)
}

type MTLSDetails added in v0.15.0

type MTLSDetails struct {
	DestinationRules        []IstioObject `json:"destinationrules"`
	MeshPeerAuthentications []IstioObject `json:"meshpeerauthentications"`
	ServiceMeshPolicies     []IstioObject `json:"servicemeshpolicies"`
	PeerAuthentications     []IstioObject `json:"peerauthentications"`
	EnabledAutoMtls         bool          `json:"enabledautomtls"`
}

MTLSDetails is a wrapper to group all Istio objects related to non-local mTLS configurations

type OSClientInterface added in v1.20.0

type OSClientInterface interface {
	GetProject(project string) (*osproject_v1.Project, error)
	GetProjects(labelSelector string) ([]osproject_v1.Project, error)
	GetRoute(namespace string, name string) (*osroutes_v1.Route, error)
}

type PodLogs added in v0.18.0

type PodLogs struct {
	Logs string `json:"logs,omitempty"`
}

type RBACDetails added in v0.17.0

type RBACDetails struct {
	ClusterRbacConfigs     []IstioObject `json:"clusterrbacconfigs"`
	ServiceMeshRbacConfigs []IstioObject `json:"servicemeshrbacconfigs"`
	ServiceRoles           []IstioObject `json:"serviceroles"`
	ServiceRoleBindings    []IstioObject `json:"servicerolebindings"`
	AuthorizationPolicies  []IstioObject `json:"authorizationpolicies"`
}

RBACDetails is a wrapper for objects related to Istio RBAC (Role Based Access Control)

type ServiceDetails

type ServiceDetails struct {
	Service     *core_v1.Service                            `json:"service"`
	Endpoints   *core_v1.Endpoints                          `json:"endpoints"`
	Deployments *apps_v1.DeploymentList                     `json:"deployments"`
	Autoscalers *autoscaling_v1.HorizontalPodAutoscalerList `json:"autoscalers"`
	Pods        []core_v1.Pod                               `json:"pods"`
}

ServiceDetails is a wrapper to group full Service description, Endpoints and Pods. Used to fetch all details in a single operation instead to invoke individual APIs per each group.

type ServiceList

type ServiceList struct {
	Services    *core_v1.ServiceList
	Pods        *core_v1.PodList
	Deployments *apps_v1.DeploymentList
}

ServiceList holds list of services, pods and deployments

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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