Documentation ¶
Index ¶
- Constants
- func AddLineNumber(r *resource.Instance, ann string, m diag.Message) bool
- func ConvertHostToFQDN(namespace resource.Namespace, host string) string
- func DeploymentInMesh(r *resource.Instance, c analysis.Context) bool
- func ErrorLine(r *resource.Instance, path string) (line int, found bool)
- func ExtractLabelFromSelectorString(s string) string
- func GetDestinationHost(sourceNs resource.Namespace, exportTo []string, host string, ...) *v1alpha3.ServiceEntry
- func GetFullNameFromFQDN(fqdn string) resource.FullName
- func GetInjectorConfigMapName(revision string) string
- func GetResourceNameFromHost(defaultNamespace resource.Namespace, host string) resource.FullName
- func InitServiceEntryHostMap(ctx analysis.Context) map[ScopedFqdn]*v1alpha3.ServiceEntry
- func IsExportToAllNamespaces(exportTos []string) bool
- func IsIstioControlPlane(r *resource.Instance) bool
- func NamespaceInAmbientMode(r *resource.Instance) bool
- func PodInAmbientMode(r *resource.Instance) bool
- func PodInMesh(r *resource.Instance, c analysis.Context) bool
- type EffectiveProxyConfigResolver
- type ScopedFqdn
Constants ¶
const ( DefaultClusterLocalDomain = "svc." + constants.DefaultClusterLocalDomain ExportToNamespaceLocal = "." ExportToAllNamespaces = "*" IstioProxyName = "istio-proxy" IstioOperator = "istio-operator" MeshGateway = "mesh" Wildcard = "*" MeshConfigName = "istio" InjectionLabelName = "istio-injection" InjectionLabelEnableValue = "enabled" InjectionConfigMap = "istio-sidecar-injector" InjectionConfigMapValue = "values" InjectorWebhookConfigKey = "sidecarInjectorWebhook" InjectorWebhookConfigValue = "enableNamespacesByDefault" )
const ( // Path for host in VirtualService. // Required parameters: route rule, route rule index, route index. DestinationHost = "{.spec.%s[%d].route[%d].destination.host}" // Path for mirror host in VirtualService. // Required parameters: http index. MirrorHost = "{.spec.http[%d].mirror.host}" // Path for mirrors host in VirtualService. // Required parameters: http index, mirror index. MirrorsHost = "{.spec.http[%d].mirrors[%d].host}" // Path for VirtualService gateway. // Required parameters: gateway index. VSGateway = "{.spec.gateways[%d]}" // Path for regex match of uri, scheme, method and authority. // Required parameters: http index, match index, where to match. URISchemeMethodAuthorityRegexMatch = "{.spec.http[%d].match[%d].%s.regex}" // Path for regex match of headers and queryParams. // Required parameters: http index, match index, where to match, match key. HeaderAndQueryParamsRegexMatch = "{.spec.http[%d].match[%d].%s.%s.regex}" // Path for regex match of allowOrigins. // Required parameters: http index, allowOrigins index. AllowOriginsRegexMatch = "{.spec.http[%d].corsPolicy.allowOrigins[%d].regex}" // Path for workload selector. // Required parameters: selector label. WorkloadSelector = "{.spec.workloadSelector.labels.%s}" // Path for port from ports collections. // Required parameters: port index. PortInPorts = "{.spec.ports[%d].port}" // Path for fromRegistry in the mesh networks. // Required parameters: network name, endPoint index. FromRegistry = "{.networks.%s.endpoints[%d]}" // Path for the image in the container. // Required parameters: container index. ImageInContainer = "{.spec.containers[%d].image}" // Path for namespace in metadata. // Required parameters: none. MetadataNamespace = "{.metadata.namespace}" // Path for name in metadata. // Required parameters: none. MetadataName = "{.metadata.name}" // Path for namespace in authorizationPolicy. // Required parameters: rule index, from index, namespace index. AuthorizationPolicyNameSpace = "{.spec.rules[%d].from[%d].source.namespaces[%d]}" // Path for annotation. // Required parameters: annotation name. Annotation = "{.metadata.annotations.%s}" // Path for selector in Gateway. // Required parameters: selector label. GatewaySelector = "{.spec.selector.%s}" // Path for credentialName. // Required parameters: server index. CredentialName = "{.spec.servers[%d].tls.credentialName}" // Path for Port in ServiceEntry. // Required parameters: port index. ServiceEntryPort = "{.spec.ports[%d].name}" // Path for DestinationRule tls certificate. // Required parameters: none. DestinationRuleTLSCert = "{.spec.trafficPolicy.tls.caCertificates}" // Path for DestinationRule port-level tls certificate. // Required parameters: portLevelSettings index. DestinationRuleTLSPortLevelCert = "{.spec.trafficPolicy.portLevelSettings[%d].tls.caCertificates}" // Path for ConfigPatch in envoyFilter // Required parameters: envoyFilter config patch index EnvoyFilterConfigPath = "{.spec.configPatches[%d].patch.value}" // Path for selector in telemetry. // Required parameters: selector label. TelemetrySelector = "{.spec.selector.matchLabels.%s}" )
Variables ¶
This section is empty.
Functions ¶
func ConvertHostToFQDN ¶
ConvertHostToFQDN returns the given host as a FQDN, if it isn't already.
func DeploymentInMesh ¶
DeploymentInMesh returns true if deployment is in the service mesh (has sidecar)
func ExtractLabelFromSelectorString ¶
ExtractLabelFromSelectorString returns the label of the match in the k8s labels.Selector
func GetDestinationHost ¶
func GetDestinationHost(sourceNs resource.Namespace, exportTo []string, host string, serviceEntryHosts map[ScopedFqdn]*v1alpha3.ServiceEntry, ) *v1alpha3.ServiceEntry
func GetFullNameFromFQDN ¶
GetFullNameFromFQDN tries to parse namespace and name from a fqdn. Empty strings are returned if either namespace or name cannot be parsed.
func GetResourceNameFromHost ¶
GetResourceNameFromHost figures out the resource.FullName to look up from the provided host string We need to handle two possible formats: short name and FQDN https://istio.io/docs/reference/config/networking/v1alpha3/virtual-service/#Destination
func InitServiceEntryHostMap ¶
func InitServiceEntryHostMap(ctx analysis.Context) map[ScopedFqdn]*v1alpha3.ServiceEntry
func IsExportToAllNamespaces ¶
IsExportToAllNamespaces returns true if export to applies to all namespaces and false if it is set to namespace local.
func IsIstioControlPlane ¶
IsIstioControlPlane returns true for resources that are part of the Istio control plane
func NamespaceInAmbientMode ¶
NamespaceInAmbientMode returns true if a Namespace is configured as a ambient namespace.
func PodInAmbientMode ¶
PodInAmbientMode returns true if a Pod is in the service mesh with the ambient mode
Types ¶
type EffectiveProxyConfigResolver ¶
type EffectiveProxyConfigResolver struct {
// contains filtered or unexported fields
}
func NewEffectiveProxyConfigResolver ¶
func NewEffectiveProxyConfigResolver(c analysis.Context) *EffectiveProxyConfigResolver
type ScopedFqdn ¶
type ScopedFqdn string
func NewScopedFqdn ¶
func NewScopedFqdn(scope string, namespace resource.Namespace, host string) ScopedFqdn
NewScopedFqdn converts the passed host to FQDN if needed and applies the passed scope.
func (ScopedFqdn) GetScopeAndFqdn ¶
func (s ScopedFqdn) GetScopeAndFqdn() (string, string)
GetScopeAndFqdn splits ScopedFqdn back to scope namespace and fqdn parts
func (ScopedFqdn) InScopeOf ¶
func (s ScopedFqdn) InScopeOf(ns string) bool
InScopeOf returns true if ns is in the scope of ScopedFqdn