kubernetes

package
v1.11.0-snapshot.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2019 License: Apache-2.0 Imports: 33 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"
)

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

	PluralType = map[string]string{

		Gateways:         GatewayType,
		VirtualServices:  VirtualServiceType,
		DestinationRules: DestinationRuleType,
		Serviceentries:   ServiceentryType,
		Sidecars:         SidecarType,
		// 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 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 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) 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 bool
}

Host represents the FQDN format for Istio hostnames

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) 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) 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) 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) 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) GetIstioDetails

func (in *IstioClient) GetIstioDetails(namespace string, serviceName string) (*IstioDetails, error)

GetIstioDetails returns Istio details for a given namespace, on this version it collects the VirtualServices and DestinationRules defined for a namespace. If serviceName param is provided, it filters all the Istio objects pointing to a particular service. It returns an error on any problem.

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) 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) 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) 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) IsMaistraApi added in v1.0.4

func (in *IstioClient) IsMaistraApi() 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)
	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)
	GetIstioDetails(namespace string, serviceName string) (*IstioDetails, 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)
	GetServerVersion() (*version.Info, error)
	GetToken() string
	GetVirtualService(namespace string, virtualservice string) (IstioObject, error)
	GetVirtualServices(namespace string, serviceName string) ([]IstioObject, error)
	IsMaistraApi() bool
	IsOpenShift() bool
	UpdateIstioObject(api, namespace, resourceType, name, jsonPatch string) (IstioObject, error)
}

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

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
}

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

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