X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/48350f3e8fe2f47eb6ff9f862a8d83fb8a027c6d..1fb68cf0a5f6ad058a54d4f822385983b3504987:/sdk/go/arvados/config.go diff --git a/sdk/go/arvados/config.go b/sdk/go/arvados/config.go index a70980cbde..00438bf340 100644 --- a/sdk/go/arvados/config.go +++ b/sdk/go/arvados/config.go @@ -17,13 +17,13 @@ import ( var DefaultConfigFile = func() string { if path := os.Getenv("ARVADOS_CONFIG"); path != "" { return path - } else { - return "/etc/arvados/config.yml" } + return "/etc/arvados/config.yml" }() type Config struct { - Clusters map[string]Cluster + Clusters map[string]Cluster + AutoReloadConfig bool } // GetConfig returns the current system config, loading it from @@ -66,6 +66,7 @@ type WebDAVCacheConfig struct { MaxPermissionEntries int MaxUUIDEntries int } + type Cluster struct { ClusterID string `json:"-"` ManagementToken string @@ -119,11 +120,13 @@ type Cluster struct { TrashSweepInterval Duration TrustAllContent bool ForwardSlashNameSubstitution string + S3FolderObjects bool BlobMissingReport string BalancePeriod Duration BalanceCollectionBatch int BalanceCollectionBuffers int + BalanceTimeout Duration WebDAVCache WebDAVCacheConfig } @@ -133,13 +136,53 @@ type Cluster struct { Repositories string } Login struct { - GoogleClientID string - GoogleClientSecret string - GoogleAlternateEmailAddresses bool - ProviderAppID string - ProviderAppSecret string - LoginCluster string - RemoteTokenRefresh Duration + LDAP struct { + Enable bool + URL URL + StartTLS bool + InsecureTLS bool + StripDomain string + AppendDomain string + SearchAttribute string + SearchBindUser string + SearchBindPassword string + SearchBase string + SearchFilters string + EmailAttribute string + UsernameAttribute string + } + Google struct { + Enable bool + ClientID string + ClientSecret string + AlternateEmailAddresses bool + } + OpenIDConnect struct { + Enable bool + Issuer string + ClientID string + ClientSecret string + EmailClaim string + EmailVerifiedClaim string + UsernameClaim string + } + PAM struct { + Enable bool + Service string + DefaultEmailDomain string + } + SSO struct { + Enable bool + ProviderAppID string + ProviderAppSecret string + } + Test struct { + Enable bool + Users map[string]TestUser + } + LoginCluster string + RemoteTokenRefresh Duration + TokenLifetime Duration } Mail struct { MailchimpAPIKey string @@ -176,6 +219,7 @@ type Cluster struct { UserNotifierEmailFrom string UserProfileNotificationAddress string PreferDomainForUsername string + UserSetupMailText string } Volumes map[string]Volume Workbench struct { @@ -216,6 +260,7 @@ type Cluster struct { InactivePageHTML string SSHHelpPageHTML string SSHHelpHostSuffix string + IdleTimeout Duration } ForceLegacyAPI14 bool @@ -231,12 +276,15 @@ type Volume struct { } type S3VolumeDriverParameters struct { + IAMRole string AccessKey string SecretKey string Endpoint string Region string Bucket string LocationConstraint bool + V2Signature bool + UseAWSS3v2Driver bool IndexPageSize int ConnectTimeout Duration ReadTimeout Duration @@ -273,7 +321,6 @@ type Services struct { Keepbalance Service Keepproxy Service Keepstore Service - Nodemanager Service RailsAPI Service SSO Service WebDAVDownload Service @@ -289,6 +336,11 @@ type Service struct { ExternalURL URL } +type TestUser struct { + Email string + Password string +} + // URL is a url.URL that is also usable as a JSON key/value. type URL url.URL @@ -298,6 +350,10 @@ func (su *URL) UnmarshalText(text []byte) error { u, err := url.Parse(string(text)) if err == nil { *su = URL(*u) + if su.Path == "" && su.Host != "" { + // http://example really means http://example/ + su.Path = "/" + } } return err } @@ -392,23 +448,25 @@ type ContainersConfig struct { type CloudVMsConfig struct { Enable bool - BootProbeCommand string - DeployRunnerBinary string - ImageID string - MaxCloudOpsPerSecond int - MaxProbesPerSecond int - PollInterval Duration - ProbeInterval Duration - SSHPort string - SyncInterval Duration - TimeoutBooting Duration - TimeoutIdle Duration - TimeoutProbe Duration - TimeoutShutdown Duration - TimeoutSignal Duration - TimeoutTERM Duration - ResourceTags map[string]string - TagKeyPrefix string + BootProbeCommand string + DeployRunnerBinary string + ImageID string + MaxCloudOpsPerSecond int + MaxProbesPerSecond int + MaxConcurrentInstanceCreateOps int + PollInterval Duration + ProbeInterval Duration + SSHPort string + SyncInterval Duration + TimeoutBooting Duration + TimeoutIdle Duration + TimeoutProbe Duration + TimeoutShutdown Duration + TimeoutSignal Duration + TimeoutStaleRunLock Duration + TimeoutTERM Duration + ResourceTags map[string]string + TagKeyPrefix string Driver string DriverParameters json.RawMessage @@ -421,6 +479,24 @@ var errDuplicateInstanceTypeName = errors.New("duplicate instance type name") // UnmarshalJSON handles old config files that provide an array of // instance types instead of a hash. func (it *InstanceTypeMap) UnmarshalJSON(data []byte) error { + fixup := func(t InstanceType) (InstanceType, error) { + if t.ProviderType == "" { + t.ProviderType = t.Name + } + if t.Scratch == 0 { + t.Scratch = t.IncludedScratch + t.AddedScratch + } else if t.AddedScratch == 0 { + t.AddedScratch = t.Scratch - t.IncludedScratch + } else if t.IncludedScratch == 0 { + t.IncludedScratch = t.Scratch - t.AddedScratch + } + + if t.Scratch != (t.IncludedScratch + t.AddedScratch) { + return t, fmt.Errorf("InstanceType %q: Scratch != (IncludedScratch + AddedScratch)", t.Name) + } + return t, nil + } + if len(data) > 0 && data[0] == '[' { var arr []InstanceType err := json.Unmarshal(data, &arr) @@ -436,19 +512,9 @@ func (it *InstanceTypeMap) UnmarshalJSON(data []byte) error { if _, ok := (*it)[t.Name]; ok { return errDuplicateInstanceTypeName } - if t.ProviderType == "" { - t.ProviderType = t.Name - } - if t.Scratch == 0 { - t.Scratch = t.IncludedScratch + t.AddedScratch - } else if t.AddedScratch == 0 { - t.AddedScratch = t.Scratch - t.IncludedScratch - } else if t.IncludedScratch == 0 { - t.IncludedScratch = t.Scratch - t.AddedScratch - } - - if t.Scratch != (t.IncludedScratch + t.AddedScratch) { - return fmt.Errorf("%v: Scratch != (IncludedScratch + AddedScratch)", t.Name) + t, err := fixup(t) + if err != nil { + return err } (*it)[t.Name] = t } @@ -464,8 +530,9 @@ func (it *InstanceTypeMap) UnmarshalJSON(data []byte) error { *it = InstanceTypeMap(hash) for name, t := range *it { t.Name = name - if t.ProviderType == "" { - t.ProviderType = name + t, err := fixup(t) + if err != nil { + return err } (*it)[name] = t } @@ -499,7 +566,7 @@ func (ss *StringSet) UnmarshalJSON(data []byte) error { return err } *ss = make(map[string]struct{}, len(hash)) - for t, _ := range hash { + for t := range hash { (*ss)[t] = struct{}{} } @@ -513,7 +580,6 @@ const ( ServiceNameController ServiceName = "arvados-controller" ServiceNameDispatchCloud ServiceName = "arvados-dispatch-cloud" ServiceNameHealth ServiceName = "arvados-health" - ServiceNameNodemanager ServiceName = "arvados-node-manager" ServiceNameWorkbench1 ServiceName = "arvados-workbench1" ServiceNameWorkbench2 ServiceName = "arvados-workbench2" ServiceNameWebsocket ServiceName = "arvados-ws" @@ -531,7 +597,6 @@ func (svcs Services) Map() map[ServiceName]Service { ServiceNameController: svcs.Controller, ServiceNameDispatchCloud: svcs.DispatchCloud, ServiceNameHealth: svcs.Health, - ServiceNameNodemanager: svcs.Nodemanager, ServiceNameWorkbench1: svcs.Workbench1, ServiceNameWorkbench2: svcs.Workbench2, ServiceNameWebsocket: svcs.Websocket,