// IsControllerPresent : Check if Controller already exists
558406
func (d *OvsdbDriver) IsControllerPresent(target string) bool {
	d.cacheLock.RLock()
	defer d.cacheLock.RUnlock()

	// walk the local cache
	for tName, table := range d.cache {
		if tName == "Controller" {
			for _, row := range table {
				for fieldName, value := range row.Fields {
					if fieldName == "target" {
						if value == target {
							// Controller exists.
							return true
						}
					}
				}
			}
		}
	}

	// We could not find the controller
	return false
}
264249
func (m *Module) ControllerByName(name, action string) (ctype *ControllerType) {
	comparison := name
	if strings.Index(name, namespaceSeperator) < 0 {
		comparison = m.Namespace() + name
	}
	for _, c := range m.ControllerTypeList {
		if c.Name() == comparison {
			ctype = c
			break
		}
	}
	return
}
70777
func (dc *DeploymentController) resolveControllerRef(namespace string, controllerRef *metav1.OwnerReference) *apps.Deployment {
	// We can't look up by UID, so look up by Name and then verify UID.
	// Don't even try to look up by Name if it's the wrong Kind.
	if controllerRef.Kind != controllerKind.Kind {
		return nil
	}
	d, err := dc.dLister.Deployments(namespace).Get(controllerRef.Name)
	if err != nil {
		return nil
	}
	if d.UID != controllerRef.UID {
		// The controller we found with this Name is not the same one that the
		// ControllerRef points to.
		return nil
	}
	return d
}
966771
func (m *MockEnviron) ControllerInstances(arg0 context.ProviderCallContext, arg1 string) ([]instance.Id, error) {
	ret := m.ctrl.Call(m, "ControllerInstances", arg0, arg1)
	ret0, _ := ret[0].([]instance.Id)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}
922235
func IsCallerPresent(ctx context.Context) bool {

	callerIdentity := ctx.Value(CallerIdentityKey)
	isPresent := callerIdentity != nil && callerIdentity != ""

	return isPresent
}
55940
func isControlPlane() bool {
	filepath := kubeadmconstants.GetStaticPodFilepath(kubeadmconstants.KubeAPIServer, kubeadmconstants.GetStaticPodDirectory())
	if _, err := os.Stat(filepath); os.IsNotExist(err) {
		return false
	}
	return true
}
879699
func (s *precheckShim) ControllerBackend() (PrecheckBackend, error) {
	return PrecheckShim(s.controllerState, s.controllerState)
}
929285
func (c *Client) ExternalControllerInfo(controllerUUID string) (*crossmodel.ControllerInfo, error) {
	if !names.IsValidController(controllerUUID) {
		return nil, errors.NotValidf("controller UUID %q", controllerUUID)
	}
	controllerTag := names.NewControllerTag(controllerUUID)
	args := params.Entities{[]params.Entity{{
		Tag: controllerTag.String(),
	}}}
	var results params.ExternalControllerInfoResults
	err := c.facade.FacadeCall("ExternalControllerInfo", args, &results)
	if err != nil {
		return nil, errors.Trace(err)
	}
	if len(results.Results) != 1 {
		return nil, errors.Errorf("expected 1 result, got %d", len(results.Results))
	}
	result := results.Results[0]
	if result.Error != nil {
		return nil, result.Error
	}
	return &crossmodel.ControllerInfo{
		ControllerTag: controllerTag,
		Alias:         result.Result.Alias,
		Addrs:         result.Result.Addrs,
		CACert:        result.Result.CACert,
	}, nil
}
451320
func (bc *BuildController) handleControllerConfig() []error {
	configErrs := bc.readClusterImageConfig()
	err := bc.readClusterBuildControllerConfig()
	if err != nil {
		configErrs = append(configErrs, err)
	}
	return configErrs
}
136598
func UpdateControllerDetailsFromLogin(
	store jujuclient.ControllerStore, controllerName string,
	params UpdateControllerParams,
) error {
	controllerDetails, err := store.ControllerByName(controllerName)
	if err != nil {
		return errors.Trace(err)
	}
	return updateControllerDetailsFromLogin(store, controllerName, controllerDetails, params)
}
1223268
func (ec *externalControllers) Controller(controllerUUID string) (ExternalController, error) {
	doc, err := ec.controller(controllerUUID)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return &externalController{*doc}, nil
}
495397
func (c *KubeAPIServerConfig) HasAdmissionController(name string) bool {
	for _, x := range c.AdmissionControl {
		if x == name {
			return true
		}
	}

	for _, x := range c.DisableAdmissionPlugins {
		if x == name {
			return false
		}
	}
	for _, x := range c.EnableAdmissionPlugins {
		if x == name {
			return true
		}
	}

	return false
}
164875
func (cte *ControllerTypeEvents) check(theType reflect.Type, fieldPath []int) {
	typeChecker := func(checkType reflect.Type) {
		for index := 0; index < checkType.NumMethod(); index++ {
			m := checkType.Method(index)
			// Must be two arguments, the second returns the controller type
			// Go cannot differentiate between promoted methods and
			// embedded methods, this allows the embedded method to be run
			// https://github.com/golang/go/issues/21162
			if m.Type.NumOut() == 2 && m.Type.Out(1) == checkType {
				if checkType.Kind() == reflect.Ptr {
					controllerLog.Debug("Found controller type event method pointer", "name", checkType.Elem().Name(), "methodname", m.Name)
				} else {
					controllerLog.Debug("Found controller type event method", "name", checkType.Name(), "methodname", m.Name)
				}
				controllerFieldPath := newFieldPath(checkType.Kind() == reflect.Ptr, m.Func, fieldPath)
				switch strings.ToLower(m.Name) {
				case "before":
					cte.Before = append([]*ControllerFieldPath{controllerFieldPath}, cte.Before...)
				case "after":
					cte.After = append(cte.After, controllerFieldPath)
				case "panic":
					cte.Panic = append(cte.Panic, controllerFieldPath)
				case "finally":
					cte.Finally = append(cte.Finally, controllerFieldPath)
				}
			}
		}
	}

	// Check methods of both types
	typeChecker(theType)
	typeChecker(reflect.PtrTo(theType))

	// Check for any sub controllers, ignore any pointers to controllers revel.Controller
	for i := 0; i < theType.NumField(); i++ {
		v := theType.Field(i)

		switch v.Type.Kind() {
		case reflect.Struct:
			cte.check(v.Type, append(fieldPath, i))
		}
	}
}
38375
func (c *registerCommand) controllerDetails(ctx *cmd.Context, p *registrationParams, controllerName string) (jujuclient.ControllerDetails, jujuclient.AccountDetails, error) {
	if p.publicHost != "" {
		return c.publicControllerDetails(p.publicHost, controllerName)
	}
	return c.nonPublicControllerDetails(ctx, p, controllerName)
}
370903
func (info *UpgradeInfo) ControllersReady() []string {
	result := make([]string, len(info.doc.ControllersReady))
	copy(result, info.doc.ControllersReady)
	return result
}
1089624
func (env *maasEnviron) ControllerInstances(ctx context.ProviderCallContext, controllerUUID string) ([]instance.Id, error) {
	if !env.usingMAAS2() {
		return env.controllerInstances1(ctx, controllerUUID)
	}
	return env.controllerInstances2(ctx, controllerUUID)
}
1258401
func (c *ConnectToken) SessionPresent() bool {
	c.m.RLock()
	defer c.m.RUnlock()
	return c.sessionPresent
}