Documentation ¶
Overview ¶
Copyright © 2020 Red Hat Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func AnyMcfgPoolLabelMatches(nodeSelector map[string]string, poolList *mcfgv1.MachineConfigPoolList) (bool, *mcfgv1.MachineConfigPool)
- func ComplianceOperatorRootCA(certname string, expire int) ([]byte, []byte, error)
- func DNSLengthName(hashPrefix string, format string, a ...interface{}) string
- func FindNewestPod(pods []corev1.Pod) *corev1.Pod
- func GetComponentImage(component ComplianceComponent) string
- func GetControlPlaneTopology() string
- func GetFirstNodeRole(nodeSelector map[string]string) string
- func GetFirstNodeRoleLabel(nodeSelector map[string]string) string
- func GetInstructionsForRule(rule *xmlquery.Node, ocilTable NodeByIdHashTable, valuesList map[string]string) (instructionText string, valuesRendered []string)
- func GetKCFromMC(mc *mcfgv1.MachineConfig, client runtimeclient.Client) (*mcfgv1.KubeletConfig, error)
- func GetNodeRoleSelector(role string) map[string]string
- func GetNodeRoles(nodeSelector map[string]string) []string
- func GetPlatform() string
- func GetResultConfigMap(owner metav1.Object, configMapName, filename, nodeName string, ...) *corev1.ConfigMap
- func GetScanNameFromProfile(profileName string, nodeSelector map[string]string) string
- func GetScanType(annotations map[string]string) compliancev1alpha1.ComplianceScanType
- func GetWarningsForRule(rule *xmlquery.Node) []string
- func HaveOutdatedRemediations(client runtimeclient.Client) (error, bool)
- func IDToDNSFriendlyName(ruleIdRef string) string
- func IsHostedControlPlane() bool
- func IsKind(obj *unstructured.Unstructured, kind string) bool
- func IsKubeletConfig(obj *unstructured.Unstructured) bool
- func IsMachineConfig(obj *unstructured.Unstructured) bool
- func IsMcfgPoolUsingKC(pool *mcfgv1.MachineConfigPool) (bool, string, error)
- func LengthName(maxLen int, hashPrefix string, format string, a ...interface{}) (string, error)
- func McfgPoolLabelMatches(nodeSelector map[string]string, pool *mcfgv1.MachineConfigPool) bool
- func NewClientCert(caCert, caKey []byte, certname string, expire int) ([]byte, []byte, error)
- func NewServerCert(caCert, caKey []byte, certname string, expire int) ([]byte, []byte, error)
- func ParseContent(dsReader io.Reader) (*xmlquery.Node, error)
- func ParseMachineConfig(rem *compv1alpha1.ComplianceRemediation, obj *unstructured.Unstructured) (*mcfgv1.MachineConfig, error)
- func ReadObjectsFromYAML(r io.Reader) ([]*unstructured.Unstructured, error)
- func RemoveDuplicate(input []string) []string
- func RenderValues(in string, valuesList map[string]string) (string, []string, error)
- func RuleHasApiObjectWarning(rule *xmlquery.Node) bool
- func RuleHasHideTagWarning(rule *xmlquery.Node) bool
- func ValidatePriorityClassExist(name string, client client.Client) (bool, string)
- func XmlNodeAsMarkdown(node *xmlquery.Node) string
- func XmlNodeAsMarkdownPreRender(node *xmlquery.Node, needsSpace bool) string
- type ComplianceComponent
- type CtlplaneSchedulingInfo
- type Directory
- type NodeByIdHashTable
- func GetRuleOvalTest(rule *xmlquery.Node, defTable NodeByIdHashTable) NodeByIdHashTable
- func GetRuleProfile(rule *xmlquery.Node, profileTable NodeByIdHashTable) NodeByIdHashTable
- func NewDefHashTable(dsDom *xmlquery.Node) NodeByIdHashTable
- func NewOcilQuestionTable(dsDom *xmlquery.Node) NodeByIdHashTable
- func NewProfileTable(dsDom *xmlquery.Node) NodeByIdHashTable
- type ParseResult
- type ParseResultContext
- type ParseResultContextItem
- type ResourcePath
Constants ¶
const ( OPENSCAP = iota OPERATOR CONTENT )
Variables ¶
This section is empty.
Functions ¶
func AnyMcfgPoolLabelMatches ¶
func AnyMcfgPoolLabelMatches(nodeSelector map[string]string, poolList *mcfgv1.MachineConfigPoolList) (bool, *mcfgv1.MachineConfigPool)
AnyMcfgPoolLabelMatches verifies if the given nodeSelector matches the nodeSelector in any of the given MachineConfigPools
func DNSLengthName ¶
func FindNewestPod ¶
FindNewestPod finds the newest pod in the given set
func GetComponentImage ¶
func GetComponentImage(component ComplianceComponent) string
GetComponentImage returns a full image pull spec for a given component based on the component type
func GetControlPlaneTopology ¶ added in v1.5.0
func GetControlPlaneTopology() string
func GetFirstNodeRole ¶
func GetFirstNodeRoleLabel ¶
func GetInstructionsForRule ¶
func GetKCFromMC ¶
func GetKCFromMC(mc *mcfgv1.MachineConfig, client runtimeclient.Client) (*mcfgv1.KubeletConfig, error)
func GetNodeRoleSelector ¶
func GetNodeRoles ¶
func GetPlatform ¶ added in v1.5.0
func GetPlatform() string
func GetResultConfigMap ¶
func GetResultConfigMap(owner metav1.Object, configMapName, filename, nodeName string, contents io.Reader, compressed bool, exitcode string, warnings string) *corev1.ConfigMap
GetResultConfigMap gets a configmap that reflects a result or an error for a scan
func GetScanNameFromProfile ¶ added in v1.5.0
func GetScanType ¶ added in v1.4.0
func GetScanType(annotations map[string]string) compliancev1alpha1.ComplianceScanType
func GetWarningsForRule ¶
func HaveOutdatedRemediations ¶
func HaveOutdatedRemediations(client runtimeclient.Client) (error, bool)
func IDToDNSFriendlyName ¶
IDToDNSFriendlyName gets the ID from the scan and returns a DNS friendly name
func IsHostedControlPlane ¶ added in v1.5.0
func IsHostedControlPlane() bool
func IsKind ¶
func IsKind(obj *unstructured.Unstructured, kind string) bool
func IsKubeletConfig ¶
func IsKubeletConfig(obj *unstructured.Unstructured) bool
func IsMachineConfig ¶
func IsMachineConfig(obj *unstructured.Unstructured) bool
IsMachineConfig checks if the specified object is a MachineConfig object
func IsMcfgPoolUsingKC ¶
func IsMcfgPoolUsingKC(pool *mcfgv1.MachineConfigPool) (bool, string, error)
isMcfgPoolUsingKC check if a MachineConfig Pool is using a custom Kubelet Config if any custom Kublet Config used, return name of generated latest KC machine config from the custom kubelet config
func LengthName ¶
LengthName creates a string of maximum defined length.
func McfgPoolLabelMatches ¶
func McfgPoolLabelMatches(nodeSelector map[string]string, pool *mcfgv1.MachineConfigPool) bool
McfgPoolLabelMatches verifies if the given nodeSelector matches the given MachineConfigPool's nodeSelector
func NewClientCert ¶
func NewServerCert ¶
func ParseContent ¶
ParseContent parses the DataStream and returns the XML document
func ParseMachineConfig ¶
func ParseMachineConfig(rem *compv1alpha1.ComplianceRemediation, obj *unstructured.Unstructured) (*mcfgv1.MachineConfig, error)
ParseMachineConfig parses a Machineconfig object from an unstructured object for a specific remediation.
func ReadObjectsFromYAML ¶
func ReadObjectsFromYAML(r io.Reader) ([]*unstructured.Unstructured, error)
Reads a YAML file and returns an unstructured object from it. This object can be taken into use by the dynamic client
func RemoveDuplicate ¶ added in v1.1.0
func RenderValues ¶
func RuleHasApiObjectWarning ¶
func RuleHasHideTagWarning ¶ added in v0.1.60
func ValidatePriorityClassExist ¶
validate priority class exists by name
func XmlNodeAsMarkdown ¶
Types ¶
type ComplianceComponent ¶
type ComplianceComponent uint
type CtlplaneSchedulingInfo ¶
type CtlplaneSchedulingInfo struct { Selector map[string]string Tolerations []corev1.Toleration }
type NodeByIdHashTable ¶
func GetRuleOvalTest ¶
func GetRuleOvalTest(rule *xmlquery.Node, defTable NodeByIdHashTable) NodeByIdHashTable
func GetRuleProfile ¶ added in v1.4.0
func GetRuleProfile(rule *xmlquery.Node, profileTable NodeByIdHashTable) NodeByIdHashTable
func NewDefHashTable ¶
func NewDefHashTable(dsDom *xmlquery.Node) NodeByIdHashTable
func NewOcilQuestionTable ¶
func NewOcilQuestionTable(dsDom *xmlquery.Node) NodeByIdHashTable
func NewProfileTable ¶ added in v1.4.0
func NewProfileTable(dsDom *xmlquery.Node) NodeByIdHashTable
type ParseResult ¶
type ParseResult struct { Id string CheckResult *compv1alpha1.ComplianceCheckResult Remediations []*compv1alpha1.ComplianceRemediation }
type ParseResultContext ¶
type ParseResultContext struct {
// contains filtered or unexported fields
}
ParseResultContext keeps track of items that are consistent across all "sources" in a ComplianceScan as well as items that are inconsistent
func NewParseResultContext ¶
func NewParseResultContext() *ParseResultContext
func (*ParseResultContext) AddResults ¶
func (prCtx *ParseResultContext) AddResults(source string, parsedResList []*ParseResult)
ParseResultContext.AddResults adds a batch of results coming from the parser and partitions them into either the consistent or the inconsistent list
func (*ParseResultContext) GetConsistentResults ¶
func (prCtx *ParseResultContext) GetConsistentResults() []*ParseResultContextItem
type ParseResultContextItem ¶
type ParseResultContextItem struct { ParseResult Annotations map[string]string Labels map[string]string // contains filtered or unexported fields }
ParseResultContextItem wraps ParseResult with some metadata that need to be added to the created k8s object based on the processing result as well as which nodes the result comes from and whether it's been processed during a single loop that processes a single CM yet or not. The sources are used to keep track of which nodes differ from the "canonical" state of the check
type ResourcePath ¶
func GetPathFromWarningXML ¶
getPathsFromRuleWarning finds the API endpoint from in. The expected structure is:
<warning category="general" lang="en-US"><code class="ocp-api-endpoint">/apis/config.openshift.io/v1/oauths/cluster </code></warning>