Documentation ¶
Index ¶
- Constants
- Variables
- func GetFromStructPath(node interface{}, path string) (interface{}, bool, error)
- func GetFromTreePath(inputTree map[string]interface{}, path util.Path) (interface{}, bool, error)
- func IsComponentEnabledFromValue(valuePath string, valueSpec map[string]interface{}) (bool, error)
- func IsComponentEnabledInSpec(featureName FeatureName, componentName ComponentName, ...) (bool, error)
- func IsFeatureEnabledInSpec(featureName FeatureName, controlPlaneSpec *v1alpha2.IstioControlPlaneSpec) (bool, error)
- func Namespace(featureName FeatureName, componentName ComponentName, ...) (string, error)
- func NamespaceFromValue(valuePath string, valueSpec map[string]interface{}) (string, error)
- func Set(val, out interface{}) error
- func SetFromPath(node interface{}, path string, out interface{}) (bool, error)
- type ComponentName
- type FeatureName
- type ManifestMap
Constants ¶
const ( // OperatorAPINamespace is the API namespace for operator config. // TODO: move this to a base definitions file when one is created. OperatorAPINamespace = "operator.istio.io" )
Variables ¶
var ( ComponentNameToFeatureName = map[ComponentName]FeatureName{ IstioBaseComponentName: IstioBaseFeatureName, PilotComponentName: TrafficManagementFeatureName, GalleyComponentName: ConfigManagementFeatureName, SidecarInjectorComponentName: AutoInjectionFeatureName, PolicyComponentName: PolicyFeatureName, TelemetryComponentName: TelemetryFeatureName, CitadelComponentName: SecurityFeatureName, CertManagerComponentName: SecurityFeatureName, NodeAgentComponentName: SecurityFeatureName, IngressComponentName: GatewayFeatureName, EgressComponentName: GatewayFeatureName, PrometheusComponentName: TelemetryFeatureName, PrometheusOperatorComponentName: TelemetryFeatureName, GrafanaComponentName: TelemetryFeatureName, KialiComponentName: TelemetryFeatureName, TracingComponentName: TelemetryFeatureName, CNIComponentName: ThirdPartyFeatureName, } )
Functions ¶
func GetFromStructPath ¶
GetFromStructPath returns the value at path from the given node, or false if the path does not exist. Node and all intermediate along path must be type struct ptr.
func GetFromTreePath ¶
GetFromTreePath returns the value at path from the given tree, or false if the path does not exist.
func IsComponentEnabledFromValue ¶
IsComponentEnabledFromValue get whether component is enabled in helm value.yaml tree. valuePath points to component path in the values tree.
func IsComponentEnabledInSpec ¶
func IsComponentEnabledInSpec(featureName FeatureName, componentName ComponentName, controlPlaneSpec *v1alpha2.IstioControlPlaneSpec) (bool, error)
IsComponentEnabledInSpec reports whether the given feature and component are enabled in the given spec. The logic is, in order of evaluation: 1. if the feature is not defined, the component is disabled, else 2. if the feature is disabled, the component is disabled, else 3. if the component is not defined, it is reported disabled, else 4. if the component disabled, it is reported disabled, else 5. the component is enabled. This follows the logic description in IstioControlPlane proto. IsComponentEnabledInSpec assumes that controlPlaneSpec has been validated. TODO: remove extra validations when comfort level is high enough.
func IsFeatureEnabledInSpec ¶
func IsFeatureEnabledInSpec(featureName FeatureName, controlPlaneSpec *v1alpha2.IstioControlPlaneSpec) (bool, error)
IsFeatureEnabledInSpec reports whether the given feature is enabled in the given spec. This follows the logic description in IstioControlPlane proto. IsFeatureEnabledInSpec assumes that controlPlaneSpec has been validated.
func Namespace ¶
func Namespace(featureName FeatureName, componentName ComponentName, controlPlaneSpec *v1alpha2.IstioControlPlaneSpec) (string, error)
Namespace returns the namespace for the component. It follows these rules: 1. If DefaultNamespace is unset, log and error and return the empty string. 2. If the feature and component namespaces are unset, return DefaultNamespace. 3. If the feature namespace is set but component name is unset, return the feature namespace. 4. Otherwise return the component namespace. Namespace assumes that controlPlaneSpec has been validated. TODO: remove extra validations when comfort level is high enough.
func NamespaceFromValue ¶
NamespaceFromValue gets the namespace value in helm value.yaml tree.
func Set ¶
func Set(val, out interface{}) error
Set sets out with the value at path from node. out is not set if the path doesn't exist or the value is nil.
func SetFromPath ¶
SetFromPath sets out with the value at path from node. out is not set if the path doesn't exist or the value is nil. All intermediate along path must be type struct ptr. Out must be either a struct ptr or map ptr. TODO: move these out to a separate package.
Types ¶
type ComponentName ¶
type ComponentName string
ComponentName is a component name string, typed to constrain allowed values.
const ( // IstioComponent names corresponding to the IstioControlPlane proto component names. Must be the same, since these // are used for struct traversal. IstioBaseComponentName ComponentName = "crds" PilotComponentName ComponentName = "Pilot" GalleyComponentName ComponentName = "Galley" SidecarInjectorComponentName ComponentName = "Injector" PolicyComponentName ComponentName = "Policy" TelemetryComponentName ComponentName = "Telemetry" CitadelComponentName ComponentName = "Citadel" CertManagerComponentName ComponentName = "CertManager" NodeAgentComponentName ComponentName = "NodeAgent" IngressComponentName ComponentName = "IngressGateway" EgressComponentName ComponentName = "EgressGateway" // The following are third party components, not a part of the IstioControlPlaneAPI but still installed in some // profiles through the Helm API. PrometheusComponentName ComponentName = "Prometheus" PrometheusOperatorComponentName ComponentName = "PrometheusOperator" GrafanaComponentName ComponentName = "Grafana" KialiComponentName ComponentName = "Kiali" CNIComponentName ComponentName = "CNI" TracingComponentName ComponentName = "Tracing" )
type FeatureName ¶
type FeatureName string
FeatureName is a feature name string, typed to constrain allowed values.
const ( // IstioFeature names, must be the same as feature names defined in the IstioControlPlane proto, since these are // used to reference structure paths. IstioBaseFeatureName FeatureName = "Base" TrafficManagementFeatureName FeatureName = "TrafficManagement" PolicyFeatureName FeatureName = "Policy" TelemetryFeatureName FeatureName = "Telemetry" SecurityFeatureName FeatureName = "Security" ConfigManagementFeatureName FeatureName = "ConfigManagement" AutoInjectionFeatureName FeatureName = "AutoInjection" GatewayFeatureName FeatureName = "Gateways" ThirdPartyFeatureName FeatureName = "ThirdParty" )
type ManifestMap ¶
type ManifestMap map[ComponentName]string
ManifestMap is a map of ComponentName to its manifest string.