16580: remove more references to Nodemanager.
[arvados.git] / sdk / go / arvados / config.go
index 6ec8f345d75f430ecd4fe8ffab4bfa665f569770..c21addbba99284e5ad3e634e24e75e5deac9558e 100644 (file)
@@ -11,7 +11,7 @@ import (
        "net/url"
        "os"
 
-       "git.curoverse.com/arvados.git/sdk/go/config"
+       "git.arvados.org/arvados.git/sdk/go/config"
 )
 
 var DefaultConfigFile = func() string {
@@ -23,7 +23,8 @@ var DefaultConfigFile = func() string {
 }()
 
 type Config struct {
-       Clusters map[string]Cluster
+       Clusters         map[string]Cluster
+       AutoReloadConfig bool
 }
 
 // GetConfig returns the current system config, loading it from
@@ -66,6 +67,7 @@ type WebDAVCacheConfig struct {
        MaxPermissionEntries int
        MaxUUIDEntries       int
 }
+
 type Cluster struct {
        ClusterID       string `json:"-"`
        ManagementToken string
@@ -115,14 +117,16 @@ type Cluster struct {
                        Function  string
                        Protected bool
                }
-               PreserveVersionIfIdle Duration
-               TrashSweepInterval    Duration
-               TrustAllContent       bool
+               PreserveVersionIfIdle        Duration
+               TrashSweepInterval           Duration
+               TrustAllContent              bool
+               ForwardSlashNameSubstitution string
 
                BlobMissingReport        string
                BalancePeriod            Duration
                BalanceCollectionBatch   int
                BalanceCollectionBuffers int
+               BalanceTimeout           Duration
 
                WebDAVCache WebDAVCacheConfig
        }
@@ -132,10 +136,46 @@ type Cluster struct {
                Repositories string
        }
        Login struct {
-               GoogleClientID     string
-               GoogleClientSecret string
-               ProviderAppID      string
-               ProviderAppSecret  string
+               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
+               }
                LoginCluster       string
                RemoteTokenRefresh Duration
        }
@@ -173,6 +213,7 @@ type Cluster struct {
                NewUsersAreActive                     bool
                UserNotifierEmailFrom                 string
                UserProfileNotificationAddress        string
+               PreferDomainForUsername               string
        }
        Volumes   map[string]Volume
        Workbench struct {
@@ -211,9 +252,11 @@ type Cluster struct {
                VocabularyURL          string
                WelcomePageHTML        string
                InactivePageHTML       string
+               SSHHelpPageHTML        string
+               SSHHelpHostSuffix      string
        }
 
-       EnableBetaController14287 bool
+       ForceLegacyAPI14 bool
 }
 
 type Volume struct {
@@ -226,12 +269,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
@@ -268,7 +314,6 @@ type Services struct {
        Keepbalance    Service
        Keepproxy      Service
        Keepstore      Service
-       Nodemanager    Service
        RailsAPI       Service
        SSO            Service
        WebDAVDownload Service
@@ -293,6 +338,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
 }
@@ -359,7 +408,7 @@ type ContainersConfig struct {
        Logging struct {
                MaxAge                       Duration
                LogBytesPerEvent             int
-               LogSecondsBetweenEvents      int
+               LogSecondsBetweenEvents      Duration
                LogThrottlePeriod            Duration
                LogThrottleBytes             int
                LogThrottleLines             int
@@ -388,6 +437,7 @@ type CloudVMsConfig struct {
        Enable bool
 
        BootProbeCommand     string
+       DeployRunnerBinary   string
        ImageID              string
        MaxCloudOpsPerSecond int
        MaxProbesPerSecond   int
@@ -415,6 +465,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)
@@ -430,19 +498,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
                }
@@ -458,8 +516,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
        }
@@ -493,7 +552,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{}{}
        }
 
@@ -507,7 +566,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"
@@ -525,7 +583,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,