func()

in cmd/healthchecker/options/options.go [77:100]


func (hco *HealthCheckerOptions) IsValid() error {
	// Make sure the component specified is valid.
	if hco.Component != types.KubeletComponent && hco.Component != types.DockerComponent &&
		hco.Component != types.CRIComponent && hco.Component != types.KubeProxyComponent {
		return fmt.Errorf("the component specified is not supported. Supported components are : <kubelet/docker/cri/kube-proxy>")
	}
	// Make sure the service is specified if repair is enabled.
	if hco.EnableRepair && hco.Service == "" {
		return fmt.Errorf("service cannot be empty when repair is enabled")
	}
	// Skip checking further if the component is not cri.
	if hco.Component != types.CRIComponent {
		return nil
	}
	// Make sure the crictl path is not empty for cri component.
	if hco.Component == types.CRIComponent && hco.CriCtlPath == "" {
		return fmt.Errorf("the crictl-path cannot be empty for cri component")
	}
	// Make sure the cri socker path is not empty for cri component.
	if hco.Component == types.CRIComponent && hco.CriSocketPath == "" {
		return fmt.Errorf("the cri-socket-path cannot be empty for cri component")
	}
	return nil
}