Documentation ¶
Overview ¶
cmdUtils provides utilities that are meant to be used by the various executables that the managed tokens library provides
Index ¶
- func CheckExperimentOverride(experiment string) string
- func GetCondorCollectorHostFromConfiguration(checkServiceConfigPath string) string
- func GetKeytabFromConfiguration(checkServiceConfigPath string) string
- func GetScheddsFromConfiguration(checkServiceConfigPath string) ([]string, error)
- func GetServiceConfigOverrideKeyOrGlobalKey(checkServiceConfigPath, key string) (configPath string, overridden bool)
- func GetServiceCreddVaultTokenPathRoot(checkServiceConfigPath string) string
- func GetServiceName(s service.Service) string
- func GetUserPrincipalAndHtgettokenoptsFromConfiguration(checkServiceConfigPath string) (userPrincipal string, htgettokenOpts string)
- func GetUserPrincipalFromConfiguration(checkServiceConfigPath string) string
- func GetVaultServer(checkServiceConfigPath string) (string, error)
- func SetCondorCollectorHostInCommandEnvironment(collector string) func(*environment.CommandEnvironment)
- func SetHtgettokenOptsInCommandEnvironment(htgettokenopts string) func(*environment.CommandEnvironment)
- func Setkrb5ccnameInCommandEnvironment(krb5ccname string) func(*environment.CommandEnvironment)
- type ExperimentOverriddenService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckExperimentOverride ¶
CheckExperimentOverride checks the configuration for a given experiment to see if it has an "experimentOverride" key defined. If it does, it will return that override value. Else, it will return the passed in experiment string
func GetCondorCollectorHostFromConfiguration ¶
GetCondorCollectorHostFromConfiguration gets the _condor_COLLECTOR_HOST environment variable from the Viper configuration
func GetKeytabFromConfiguration ¶
GetKeytabFromConfiguration checks the configuration at the checkServiceConfigPath for an override for the path to the kerberos keytab. If the override does not exist, it uses the configuration to calculate the default path to the keytab
func GetScheddsFromConfiguration ¶
GetScheddsFromConfiguration gets the schedd names that match the configured constraint by querying the condor collector. It can be overridden by setting the checkServiceConfigPath's condorCreddHostOverride field, in which case that value will be set as the schedd
func GetServiceConfigOverrideKeyOrGlobalKey ¶
func GetServiceConfigOverrideKeyOrGlobalKey(checkServiceConfigPath, key string) (configPath string, overridden bool)
GetServiceConfigOverrideKeyOrGlobalKey checks to see if key + "Override" is defined at the checkServiceConfigPath in the configuration. If so, the full configuration path is returned, and the overridden bool is set to true. If not, the original key is returned, and the overridden bool is set to false
func GetServiceCreddVaultTokenPathRoot ¶ added in v0.11.1
GetKeytabFromConfiguration checks the configuration at the checkServiceConfigPath for an override for the path to the directory where the condorVaultStorer worker should look for and store service/credd-specific vault tokens. If the override does not exist, it uses the configuration to calculate the default path to the relevant directory
func GetServiceName ¶
GetServiceName type checks the service.Service passed in, and returns the appropriate service name for registration and logging purposes.
func GetUserPrincipalAndHtgettokenoptsFromConfiguration ¶
func GetUserPrincipalAndHtgettokenoptsFromConfiguration(checkServiceConfigPath string) (userPrincipal string, htgettokenOpts string)
GetUserPrincipalAndHtgettokenoptsFromConfiguration gets a worker.Config's kerberos principal and with it, the value for the HTGETTOKENOPTS environment variable
func GetUserPrincipalFromConfiguration ¶
GetUserPrincipalFromConfiguration gets the configured kerberos principal
func GetVaultServer ¶
GetVaultServer queries various sources to get the correct vault server or SEC_CREDENTIAL_GETTOKEN_OPTS setting, which condor_vault_storer needs to store the refresh token in a vault server. The order of precedence is:
1. Environment variable _condor_SEC_CREDENTIAL_GETTOKEN_OPTS 2. Configuration file for managed tokens 3. Condor configuration file SEC_CREDENTIAL_GETTOKEN_OPTS value
func SetCondorCollectorHostInCommandEnvironment ¶
func SetCondorCollectorHostInCommandEnvironment(collector string) func(*environment.CommandEnvironment)
SetCondorCollectorHostInCommandEnvironment returns a function that sets the _condor_COLLECTOR_HOST environment variable in an environment.CommandEnvironment
func SetHtgettokenOptsInCommandEnvironment ¶
func SetHtgettokenOptsInCommandEnvironment(htgettokenopts string) func(*environment.CommandEnvironment)
SetHtgettokenOptsInCommandEnvironment returns a function that sets the HTGETTOKENOPTS environment variable in an environment.CommandEnvironment
func Setkrb5ccnameInCommandEnvironment ¶
func Setkrb5ccnameInCommandEnvironment(krb5ccname string) func(*environment.CommandEnvironment)
Setkrb5ccname returns a function that sets the KRB5CCNAME directory environment variable in an environment.CommandEnvironment
Types ¶
type ExperimentOverriddenService ¶
type ExperimentOverriddenService struct { // Service should contain the actual experiment name (the overridden experiment name), not the configuration key service.Service // ConfigExperiment is the configuration key under the experiments section where this // experiment can be found ConfigExperiment string // ConfigService is the service obtained by using the configExperiment concatenated with an underscore, and Service.Role() ConfigService string }
ExperimentOverriddenService is a service where the experiment is overridden. We want to monitor/act on the config key, but use the service name that might duplicate another service.
func NewExperimentOverriddenService ¶
func NewExperimentOverriddenService(serviceName, configKey string) *ExperimentOverriddenService
NewExperimentOverriddenService returns a new *ExperimentOverriddenService by using the service name and configuration key
func (*ExperimentOverriddenService) ConfigName ¶
func (e *ExperimentOverriddenService) ConfigName() string
ConfigName returns the value stored in the ConfigService key, meant to be a concatenation of the return value of the Experiment() method, "_", and the return value of the Role() method The reason for having this separate method is to avoid duplicated service names for multiple experiment configurations that have the same overridden experiment values and roles but are meant to be handled independently, for example, for different condor pools
func (*ExperimentOverriddenService) Experiment ¶
func (e *ExperimentOverriddenService) Experiment() string
func (*ExperimentOverriddenService) Name ¶
func (e *ExperimentOverriddenService) Name() string
Name returns the ExperimentOverriddenService's Service.Name field
func (*ExperimentOverriddenService) Role ¶
func (e *ExperimentOverriddenService) Role() string