code: func (c *ClusterConfigV3) CheckAndSetDefaults() error {
  	// make sure we have defaults for all metadata fields
  	err := c.Metadata.CheckAndSetDefaults()
  	if err != nil {
  		return trace.Wrap(err)
  	}
  
  	if c.Spec.SessionRecording == "" {
  		c.Spec.SessionRecording = RecordAtNode
  	}
  	if c.Spec.ProxyChecksHostKeys == "" {
  		c.Spec.ProxyChecksHostKeys = HostKeyCheckYes
  	}
  
  	// check if the recording type is valid
  	all := []string{RecordAtNode, RecordAtProxy, RecordOff}
  	ok := utils.SliceContainsStr(all, c.Spec.SessionRecording)
  	if !ok {
  		return trace.BadParameter("session_recording must either be: %v", strings.Join(all, ","))
  	}
  
  	// check if host key checking mode is valid
  	all = []string{HostKeyCheckYes, HostKeyCheckNo}
  	ok = utils.SliceContainsStr(all, c.Spec.ProxyChecksHostKeys)
  	if !ok {
  		return trace.BadParameter("proxy_checks_host_keys must be one of: %v", strings.Join(all, ","))
  	}
  
  	// Set the keep-alive interval and max missed keep-alives before the
  	// client is disconnected.
  	if c.Spec.KeepAliveInterval.Duration() == 0 {
  		c.Spec.KeepAliveInterval = NewDuration(defaults.KeepAliveInterval)
  	}
  	if c.Spec.KeepAliveCountMax == 0 {
  		c.Spec.KeepAliveCountMax = int64(defaults.KeepAliveCountMax)
  	}
  
  	return nil
  }
docs: // CheckAndSetDefaults checks validity of all parameters and sets defaults.