kubernetes

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: Apache-2.0 Imports: 34 Imported by: 156

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"

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

	Serviceentries       = "serviceentries"
	ServiceentryType     = "ServiceEntry"
	ServiceentryTypeList = "ServiceEntryList"

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

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

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

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

	// Request Authentications
	RequestAuthentications         = "requestauthentications"
	RequestAuthenticationsType     = "RequestAuthentication"
	RequestAuthenticationsTypeList = "RequestAuthenticationList"
)
View Source
const IstioConfigmapName = "istio"

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

	PluralType = map[string]string{

		Gateways:         GatewayType,
		VirtualServices:  VirtualServiceType,
		DestinationRules: DestinationRuleType,
		Serviceentries:   ServiceentryType,
		Sidecars:         SidecarType,
		WorkloadEntries:  WorkloadEntryType,

		AuthorizationPolicies:  AuthorizationPoliciesType,
		PeerAuthentications:    PeerAuthenticationsType,
		RequestAuthentications: RequestAuthenticationsType,
		// contains filtered or unexported fields
	}
)
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 PolicyHasMTLSEnabled added in v0.16.0

func PolicyHasMTLSEnabled(policy IstioObject) (bool, string)

func PolicyHasStrictMTLS added in v0.17.0

func PolicyHasStrictMTLS(policy 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) (IstioClientInterface, 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 GenericIstioObject added in v0.11.0

type GenericIstioObject struct {
	meta_v1.TypeMeta   `json:",inline"`
	meta_v1.ObjectMeta `json:"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) 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 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 IstioClient

type IstioClient struct {
	IstioClientInterface
	// contains filtered or unexported fields
}

IstioClient 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) (*IstioClient, 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 (*IstioClient) CreateIstioObject added in v0.14.0

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

CreateIstioObject creates an Istio object

func (*IstioClient) CreateIter8Experiment added in v1.15.0

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

func (*IstioClient) DeleteIstioObject added in v0.9.1

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

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

func (*IstioClient) DeleteIter8Experiment added in v1.16.0

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

func (*IstioClient) GetAdapter added in v0.11.0

func (in *IstioClient) GetAdapter(namespace, adapterType, adapterName string) (IstioObject, error)

func (*IstioClient) GetAdapters added in v0.11.0

func (in *IstioClient) GetAdapters(namespace, labelSelector string) ([]IstioObject, error)

func (*IstioClient) GetAuthorizationDetails added in v0.17.0

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

GetAuthorizationDetails returns ServiceRoles, ServiceRoleBindings and ClusterRbacDetails

func (*IstioClient) GetAuthorizationPolicies added in v1.12.0

func (in *IstioClient) GetAuthorizationPolicies(namespace string) ([]IstioObject, error)

func (*IstioClient) GetAuthorizationPolicy added in v1.12.0

func (in *IstioClient) GetAuthorizationPolicy(namespace string, name string) (IstioObject, error)

func (*IstioClient) GetClusterRbacConfig added in v0.15.0

func (in *IstioClient) GetClusterRbacConfig(name string) (IstioObject, error)

func (*IstioClient) GetClusterRbacConfigs added in v0.15.0

func (in *IstioClient) GetClusterRbacConfigs() ([]IstioObject, error)

func (*IstioClient) GetConfigMap added in v1.17.0

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

GetConfigMap fetches and returns the specified ConfigMap definition from the cluster

func (*IstioClient) GetCronJobs added in v0.9.0

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

func (*IstioClient) GetDeployment added in v0.6.0

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

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

func (*IstioClient) GetDeploymentConfig added in v0.9.0

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

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

func (*IstioClient) GetDeploymentConfigs added in v0.9.0

func (in *IstioClient) 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 (*IstioClient) GetDeployments

func (in *IstioClient) 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 (*IstioClient) GetDeploymentsByLabel added in v0.20.0

func (in *IstioClient) 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 (*IstioClient) GetDestinationRule

func (in *IstioClient) GetDestinationRule(namespace string, destinationrule string) (IstioObject, error)

func (*IstioClient) GetDestinationRules

func (in *IstioClient) GetDestinationRules(namespace string, serviceName string) ([]IstioObject, error)

GetDestinationRules returns all DestinationRules for a given namespace. If serviceName param is provided it will filter all DestinationRules having a host defined on a particular service. It returns an error on any problem.

func (*IstioClient) GetEndpoints added in v0.8.0

func (in *IstioClient) 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 (*IstioClient) GetGateway

func (in *IstioClient) GetGateway(namespace string, gateway string) (IstioObject, error)

func (*IstioClient) GetGateways

func (in *IstioClient) GetGateways(namespace string) ([]IstioObject, error)

GetGateways return all Gateways for a given namespace. It returns an error on any problem.

func (*IstioClient) GetIstioConfigApi added in v0.9.0

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

GetIstioConfigApi returns the istio config rest client

func (*IstioClient) GetIstioNetworkingApi added in v0.9.0

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

GetIstioNetworkingApi returns the istio config rest client

func (*IstioClient) GetIstioRbacApi added in v0.15.0

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

GetIstioRbacApi returns the istio rbac rest client

func (*IstioClient) GetIstioRule added in v0.11.0

func (in *IstioClient) GetIstioRule(namespace string, istiorule string) (IstioObject, error)

func (*IstioClient) GetIstioRules

func (in *IstioClient) GetIstioRules(namespace string, labelSelector string) ([]IstioObject, error)

GetIstioRules returns a list of mixer rules for a given namespace.

func (*IstioClient) GetIstioSecurityApi added in v1.12.0

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

GetIstioSecurityApi returns the istio security rest client

func (*IstioClient) GetIter8Experiment added in v1.15.0

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

func (*IstioClient) GetIter8Experiments added in v1.15.0

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

func (*IstioClient) GetJobs added in v0.9.0

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

func (*IstioClient) GetK8sApi added in v0.9.0

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

GetK8sApi returns the clientset referencing all K8s rest clients

func (*IstioClient) GetMeshPolicies added in v0.15.0

func (in *IstioClient) GetMeshPolicies() ([]IstioObject, error)

func (*IstioClient) GetMeshPolicy added in v0.15.0

func (in *IstioClient) GetMeshPolicy(policyName string) (IstioObject, error)

func (*IstioClient) GetNamespace added in v0.9.1

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

GetNamespace fetches and returns the specified namespace definition from the cluster

func (*IstioClient) GetNamespaces

func (in *IstioClient) 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 (*IstioClient) GetPeerAuthentication added in v1.18.0

func (in *IstioClient) GetPeerAuthentication(namespace string, name string) (IstioObject, error)

func (*IstioClient) GetPeerAuthentications added in v1.18.0

func (in *IstioClient) GetPeerAuthentications(namespace string) ([]IstioObject, error)

func (*IstioClient) GetPod added in v0.18.0

func (in *IstioClient) 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 (*IstioClient) GetPodLogs added in v0.18.0

func (in *IstioClient) 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 (*IstioClient) GetPods

func (in *IstioClient) 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 (*IstioClient) GetPolicies added in v0.14.0

func (in *IstioClient) GetPolicies(namespace string) ([]IstioObject, error)

func (*IstioClient) GetPolicy added in v0.14.0

func (in *IstioClient) GetPolicy(namespace string, policyName string) (IstioObject, error)

func (*IstioClient) GetProject added in v0.9.1

func (in *IstioClient) 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 (*IstioClient) GetProjects added in v0.8.0

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

func (*IstioClient) GetQuotaSpec added in v0.5.0

func (in *IstioClient) GetQuotaSpec(namespace string, quotaSpecName string) (IstioObject, error)

func (*IstioClient) GetQuotaSpecBinding added in v0.5.0

func (in *IstioClient) GetQuotaSpecBinding(namespace string, quotaSpecBindingName string) (IstioObject, error)

func (*IstioClient) GetQuotaSpecBindings added in v0.5.0

func (in *IstioClient) GetQuotaSpecBindings(namespace string) ([]IstioObject, error)

GetQuotaSpecBindings returns all QuotaSpecBindings objects for a given namespace. It returns an error on any problem.

func (*IstioClient) GetQuotaSpecs added in v0.5.0

func (in *IstioClient) GetQuotaSpecs(namespace string) ([]IstioObject, error)

GetQuotaSpecs returns all QuotaSpecs objects for a given namespace. It returns an error on any problem.

func (*IstioClient) GetRbacConfig added in v0.16.0

func (in *IstioClient) GetRbacConfig(namespace string, name string) (IstioObject, error)

func (*IstioClient) GetRbacConfigs added in v0.16.0

func (in *IstioClient) GetRbacConfigs(namespace string) ([]IstioObject, error)

func (*IstioClient) GetReplicaSets added in v0.9.0

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

func (*IstioClient) GetReplicationControllers added in v0.9.0

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

func (*IstioClient) GetRequestAuthentication added in v1.18.0

func (in *IstioClient) GetRequestAuthentication(namespace string, name string) (IstioObject, error)

func (*IstioClient) GetRequestAuthentications added in v1.18.0

func (in *IstioClient) GetRequestAuthentications(namespace string) ([]IstioObject, error)

func (*IstioClient) GetRoute added in v0.20.0

func (in *IstioClient) 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 (*IstioClient) GetSelfSubjectAccessReview added in v0.9.1

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

GetSelfSubjectAccessReview provides information on Kiali permissions

func (*IstioClient) GetServerVersion added in v0.20.0

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

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

func (*IstioClient) GetService

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

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

func (*IstioClient) GetServiceEntries added in v0.5.0

func (in *IstioClient) GetServiceEntries(namespace string) ([]IstioObject, error)

GetServiceEntries return all ServiceEntry objects for a given namespace. It returns an error on any problem.

func (*IstioClient) GetServiceEntry added in v0.5.0

func (in *IstioClient) GetServiceEntry(namespace string, serviceEntryName string) (IstioObject, error)

func (*IstioClient) GetServiceMeshPolicies added in v1.0.4

func (in *IstioClient) GetServiceMeshPolicies(namespace string) ([]IstioObject, error)

func (*IstioClient) GetServiceMeshPolicy added in v1.0.4

func (in *IstioClient) GetServiceMeshPolicy(namespace string, name string) (IstioObject, error)

func (*IstioClient) GetServiceMeshRbacConfig added in v1.0.4

func (in *IstioClient) GetServiceMeshRbacConfig(namespace string, name string) (IstioObject, error)

func (*IstioClient) GetServiceMeshRbacConfigs added in v1.0.4

func (in *IstioClient) GetServiceMeshRbacConfigs(namespace string) ([]IstioObject, error)

func (*IstioClient) GetServiceRole added in v0.15.0

func (in *IstioClient) GetServiceRole(namespace string, name string) (IstioObject, error)

func (*IstioClient) GetServiceRoleBinding added in v0.15.0

func (in *IstioClient) GetServiceRoleBinding(namespace string, name string) (IstioObject, error)

func (*IstioClient) GetServiceRoleBindings added in v0.15.0

func (in *IstioClient) GetServiceRoleBindings(namespace string) ([]IstioObject, error)

func (*IstioClient) GetServiceRoles added in v0.15.0

func (in *IstioClient) GetServiceRoles(namespace string) ([]IstioObject, error)

func (*IstioClient) GetServices

func (in *IstioClient) 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 (*IstioClient) GetSidecar added in v0.21.0

func (in *IstioClient) GetSidecar(namespace string, sidecar string) (IstioObject, error)

func (*IstioClient) GetSidecars added in v0.21.0

func (in *IstioClient) GetSidecars(namespace string) ([]IstioObject, error)

GetSidecars return all Sidecars for a given namespace. It returns an error on any problem

func (*IstioClient) GetStatefulSet added in v0.9.0

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

func (*IstioClient) GetStatefulSets added in v0.9.0

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

func (*IstioClient) GetTemplate added in v0.11.0

func (in *IstioClient) GetTemplate(namespace, templateType, templateName string) (IstioObject, error)

func (*IstioClient) GetTemplates added in v0.11.0

func (in *IstioClient) GetTemplates(namespace, labelSelector string) ([]IstioObject, error)

func (*IstioClient) GetToken added in v1.9.0

func (client *IstioClient) GetToken() string

GetToken returns the BearerToken used from the config

func (*IstioClient) GetVirtualService

func (in *IstioClient) GetVirtualService(namespace string, virtualservice string) (IstioObject, error)

func (*IstioClient) GetVirtualServices

func (in *IstioClient) GetVirtualServices(namespace string, serviceName string) ([]IstioObject, error)

GetVirtualServices return all VirtualServices for a given namespace. If serviceName param is provided it will filter all VirtualServices having a host defined on a particular service. It returns an error on any problem.

func (*IstioClient) GetWorkloadEntries added in v1.18.0

func (in *IstioClient) GetWorkloadEntries(namespace string) ([]IstioObject, error)

GetWorkloadEntries return all WorkloadEntries for a given namespace. It returns an error on any problem

func (*IstioClient) GetWorkloadEntry added in v1.18.0

func (in *IstioClient) GetWorkloadEntry(namespace string, name string) (IstioObject, error)

func (*IstioClient) IsIter8Api added in v1.15.0

func (in *IstioClient) IsIter8Api() bool

func (*IstioClient) IsMaistraApi added in v1.0.4

func (in *IstioClient) IsMaistraApi() bool

func (*IstioClient) IsMixerDisabled added in v1.18.0

func (in *IstioClient) IsMixerDisabled() bool

func (*IstioClient) IsOpenShift added in v0.8.0

func (in *IstioClient) IsOpenShift() bool

func (*IstioClient) UpdateIstioObject added in v0.12.0

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

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

type IstioClientInterface

type IstioClientInterface interface {
	CreateIstioObject(api, namespace, resourceType, json string) (IstioObject, error)
	DeleteIstioObject(api, namespace, resourceType, name string) error
	GetAdapter(namespace, adapterType, adapterName string) (IstioObject, error)
	GetAdapters(namespace, labelSelector string) ([]IstioObject, error)
	GetAuthorizationDetails(namespace string) (*RBACDetails, error)
	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)
	GetDestinationRule(namespace string, destinationrule string) (IstioObject, error)
	GetDestinationRules(namespace string, serviceName string) ([]IstioObject, error)
	GetEndpoints(namespace string, serviceName string) (*core_v1.Endpoints, error)
	GetGateway(namespace string, gateway string) (IstioObject, error)
	GetGateways(namespace string) ([]IstioObject, error)
	GetIstioRule(namespace string, istiorule string) (IstioObject, error)
	GetIstioRules(namespace string, labelSelector string) ([]IstioObject, 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)
	GetProject(project string) (*osproject_v1.Project, error)
	GetProjects(labelSelector string) ([]osproject_v1.Project, error)
	GetQuotaSpec(namespace string, quotaSpecName string) (IstioObject, error)
	GetQuotaSpecs(namespace string) ([]IstioObject, error)
	GetQuotaSpecBinding(namespace string, quotaSpecBindingName string) (IstioObject, error)
	GetQuotaSpecBindings(namespace string) ([]IstioObject, error)
	GetReplicationControllers(namespace string) ([]core_v1.ReplicationController, error)
	GetReplicaSets(namespace string) ([]apps_v1.ReplicaSet, error)
	GetRoute(namespace string, name string) (*osroutes_v1.Route, error)
	GetSidecar(namespace string, sidecar string) (IstioObject, error)
	GetSidecars(namespace string) ([]IstioObject, 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)
	GetServiceEntries(namespace string) ([]IstioObject, error)
	GetServiceEntry(namespace string, serviceEntryName string) (IstioObject, error)
	GetStatefulSet(namespace string, statefulsetName string) (*apps_v1.StatefulSet, error)
	GetStatefulSets(namespace string) ([]apps_v1.StatefulSet, error)
	GetTemplate(namespace, templateType, templateName string) (IstioObject, error)
	GetTemplates(namespace, labelSelector string) ([]IstioObject, error)
	GetPolicy(namespace string, policyName string) (IstioObject, error)
	GetPolicies(namespace string) ([]IstioObject, error)
	GetMeshPolicy(policyName string) (IstioObject, error)
	GetMeshPolicies() ([]IstioObject, error)
	GetClusterRbacConfig(name string) (IstioObject, error)
	GetClusterRbacConfigs() ([]IstioObject, error)
	GetRbacConfig(namespace string, name string) (IstioObject, error)
	GetRbacConfigs(namespace string) ([]IstioObject, error)
	GetServiceMeshPolicy(namespace string, name string) (IstioObject, error)
	GetServiceMeshPolicies(namespace string) ([]IstioObject, error)
	GetServiceMeshRbacConfig(namespace string, name string) (IstioObject, error)
	GetServiceMeshRbacConfigs(namespace string) ([]IstioObject, error)
	GetServiceRole(namespace string, name string) (IstioObject, error)
	GetServiceRoles(namespace string) ([]IstioObject, error)
	GetServiceRoleBinding(namespace string, name string) (IstioObject, error)
	GetServiceRoleBindings(namespace string) ([]IstioObject, error)
	GetAuthorizationPolicy(namespace string, name string) (IstioObject, error)
	GetAuthorizationPolicies(namespace string) ([]IstioObject, error)
	GetPeerAuthentication(namespace string, name string) (IstioObject, error)
	GetPeerAuthentications(namespace string) ([]IstioObject, error)
	GetWorkloadEntry(namespace string, name string) (IstioObject, error)
	GetWorkloadEntries(namespace string) ([]IstioObject, error)
	GetRequestAuthentication(namespace string, name string) (IstioObject, error)
	GetRequestAuthentications(namespace string) ([]IstioObject, error)
	GetServerVersion() (*version.Info, error)
	GetToken() string
	GetVirtualService(namespace string, virtualservice string) (IstioObject, error)
	GetVirtualServices(namespace string, serviceName string) ([]IstioObject, error)
	IsMaistraApi() bool
	IsOpenShift() bool
	IsMixerDisabled() bool
	UpdateIstioObject(api, namespace, resourceType, name, jsonPatch string) (IstioObject, error)
	Iter8ClientInterface
}

IstioClientInterface for mocks (only mocked function are necessary here)

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 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
}

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

func FilterDestinationRules added in v1.9.0

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

func FilterVirtualServices added in v1.9.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 Iter8ClientInterface added in v1.15.0

type Iter8ClientInterface interface {
	CreateIter8Experiment(namespace 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
}

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 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"`
}

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 *struct {
		ApiVersion string `json:"apiVersion,omitempty"`
		Kind       string `json:"kind,omitempty"`
		Name       string `json:"name,omitempty"`
	} `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"`
	} `json:"assessment"`
	TrafficSplitPercentage struct {
		Baseline  int `json:"baseline"`
		Candidate int `json:"candidate"`
	} `json:"trafficSplitPercentage"`
	Phase   string `json:"phase"`
	Message string `json:"message"`
}

type MTLSDetails added in v0.15.0

type MTLSDetails struct {
	DestinationRules    []IstioObject `json:"destinationrules"`
	MeshPolicies        []IstioObject `json:"meshpolicies"`
	ServiceMeshPolicies []IstioObject `json:"servicemeshpolicies"`
	Policies            []IstioObject `json:"policies"`
}

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

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