github.com/kubernetes-incubator/kube-aws@v0.16.4/pkg/api/types.go (about)

     1  package api
     2  
     3  type Worker struct {
     4  	APIEndpointName         string           `yaml:"apiEndpointName,omitempty"`
     5  	NodePools               []WorkerNodePool `yaml:"nodePools,omitempty"`
     6  	NodePoolRollingStrategy string           `yaml:"nodePoolRollingStrategy,omitempty"`
     7  	UnknownKeys             `yaml:",inline"`
     8  }
     9  
    10  // Kubelet options
    11  type Kubelet struct {
    12  	SystemReservedResources string                 `yaml:"systemReserved,omitempty"`
    13  	KubeReservedResources   string                 `yaml:"kubeReserved,omitempty"`
    14  	Kubeconfig              string                 `yaml:"kubeconfig,omitempty"`
    15  	Mounts                  []ContainerVolumeMount `yaml:"mounts,omitempty"`
    16  	Flags                   CommandLineFlags       `yaml:"flags,omitempty"`
    17  }
    18  
    19  type Experimental struct {
    20  	Admission                        Admission                 `yaml:"admission"`
    21  	AuditLog                         AuditLog                  `yaml:"auditLog"`
    22  	Authentication                   Authentication            `yaml:"authentication"`
    23  	AwsEnvironment                   AwsEnvironment            `yaml:"awsEnvironment"`
    24  	AwsNodeLabels                    AwsNodeLabels             `yaml:"awsNodeLabels"`
    25  	EphemeralImageStorage            EphemeralImageStorage     `yaml:"ephemeralImageStorage"`
    26  	GpuSupport                       GpuSupport                `yaml:"gpuSupport,omitempty"`
    27  	KubeletOpts                      string                    `yaml:"kubeletOpts,omitempty"`
    28  	LoadBalancer                     LoadBalancer              `yaml:"loadBalancer"`
    29  	TargetGroup                      TargetGroup               `yaml:"targetGroup"`
    30  	NodeDrainer                      NodeDrainer               `yaml:"nodeDrainer"`
    31  	Oidc                             Oidc                      `yaml:"oidc"`
    32  	DisableSecurityGroupIngress      bool                      `yaml:"disableSecurityGroupIngress"`
    33  	NodeMonitorGracePeriod           string                    `yaml:"nodeMonitorGracePeriod"`
    34  	SkipIOPerformanceEtcdVolumeCheck bool                      `yaml:"skipIOPerformanceEtcdVolumeCheck"`
    35  	CloudControllerManager           CloudControllerManager    `yaml:"cloudControllerManager"`
    36  	ContainerStorageInterface        ContainerStorageInterface `yaml:"containerStorageInterface"`
    37  	UnknownKeys                      `yaml:",inline"`
    38  }
    39  
    40  type CloudControllerManager struct {
    41  	Enabled bool `yaml:"enabled"`
    42  }
    43  
    44  type ContainerStorageInterface struct {
    45  	Enabled                bool  `yaml:"enabled"`
    46  	Debug                  bool  `yaml:"debug"`
    47  	CSIProvisioner         Image `yaml:"csiProvisioner"`
    48  	CSIAttacher            Image `yaml:"csiAttacher"`
    49  	CSILivenessProbe       Image `yaml:"csiLivenessProbe"`
    50  	CSINodeDriverRegistrar Image `yaml:"csiNodeDriverRegistrar"`
    51  	AmazonEBSDriver        Image `yaml:"amazonEBSDriver"`
    52  }
    53  
    54  func (c Experimental) Validate(name string) error {
    55  	if err := c.NodeDrainer.Validate(); err != nil {
    56  		return err
    57  	}
    58  
    59  	return nil
    60  }
    61  
    62  type Admission struct {
    63  	AlwaysPullImages                     AlwaysPullImages                     `yaml:"alwaysPullImages"`
    64  	OwnerReferencesPermissionEnforcement OwnerReferencesPermissionEnforcement `yaml:"ownerReferencesPermissionEnforcement"`
    65  	EventRateLimit                       EventRateLimit                       `yaml:"eventRateLimit"`
    66  }
    67  
    68  type AlwaysPullImages struct {
    69  	Enabled bool `yaml:"enabled"`
    70  }
    71  
    72  type OwnerReferencesPermissionEnforcement struct {
    73  	Enabled bool `yaml:"enabled"`
    74  }
    75  
    76  type PersistentVolumeClaimResize struct {
    77  	Enabled bool `yaml:"enabled"`
    78  }
    79  
    80  type EventRateLimit struct {
    81  	Enabled bool   `yaml:"enabled"`
    82  	Limits  string `yaml:"limits"`
    83  }
    84  
    85  type AuditLog struct {
    86  	Enabled   bool   `yaml:"enabled"`
    87  	LogPath   string `yaml:"logPath"`
    88  	MaxAge    int    `yaml:"maxAge"`
    89  	MaxBackup int    `yaml:"maxBackup"`
    90  	MaxSize   int    `yaml:"maxSize"`
    91  }
    92  
    93  type Authentication struct {
    94  	Webhook Webhook `yaml:"webhook"`
    95  }
    96  
    97  type Webhook struct {
    98  	Enabled  bool   `yaml:"enabled"`
    99  	CacheTTL string `yaml:"cacheTTL"`
   100  	Config   string `yaml:"configBase64"`
   101  }
   102  
   103  type AwsEnvironment struct {
   104  	Enabled     bool              `yaml:"enabled"`
   105  	Environment map[string]string `yaml:"environment"`
   106  }
   107  
   108  type AwsNodeLabels struct {
   109  	Enabled bool `yaml:"enabled"`
   110  }
   111  
   112  type EncryptionAtRest struct {
   113  	Enabled bool `yaml:"enabled"`
   114  }
   115  
   116  type PodAutoscalerUseRestClient struct {
   117  	Enabled bool `yaml:"enabled"`
   118  }
   119  
   120  type EphemeralImageStorage struct {
   121  	Enabled    bool   `yaml:"enabled"`
   122  	Disk       string `yaml:"disk"`
   123  	Filesystem string `yaml:"filesystem"`
   124  }
   125  
   126  type GpuSupport struct {
   127  	Enabled      bool   `yaml:"enabled"`
   128  	Version      string `yaml:"version"`
   129  	InstallImage string `yaml:"installImage"`
   130  }
   131  
   132  type KubeResourcesAutosave struct {
   133  	Enabled bool `yaml:"enabled"`
   134  	S3Path  string
   135  }
   136  
   137  type AmazonSsmAgent struct {
   138  	Enabled     bool   `yaml:"enabled"`
   139  	DownloadUrl string `yaml:"downloadUrl"`
   140  	Sha1Sum     string `yaml:"sha1sum"`
   141  }
   142  
   143  type CloudWatchLogging struct {
   144  	Enabled         bool `yaml:"enabled"`
   145  	RetentionInDays int  `yaml:"retentionInDays"`
   146  	LocalStreaming  `yaml:"localStreaming"`
   147  }
   148  
   149  type LocalStreaming struct {
   150  	Enabled  bool   `yaml:"enabled"`
   151  	Filter   string `yaml:"filter"`
   152  	Interval int    `yaml:"interval"`
   153  }
   154  
   155  type HostOS struct {
   156  	BashPrompt BashPrompt `yaml:"bashPrompt,omitempty"`
   157  	MOTDBanner MOTDBanner `yaml:"motdBanner,omitempty"`
   158  }
   159  
   160  func (c *LocalStreaming) IntervalSec() int64 {
   161  	// Convert from seconds to milliseconds (and return as int64 type)
   162  	return int64(c.Interval * 1000)
   163  }
   164  
   165  func (c *CloudWatchLogging) MergeIfEmpty(other CloudWatchLogging) {
   166  	if c.Enabled == false && c.RetentionInDays == 0 {
   167  		c.Enabled = other.Enabled
   168  		c.RetentionInDays = other.RetentionInDays
   169  	}
   170  }
   171  
   172  type LoadBalancer struct {
   173  	Enabled          bool     `yaml:"enabled"`
   174  	Names            []string `yaml:"names"`
   175  	SecurityGroupIds []string `yaml:"securityGroupIds"`
   176  }
   177  
   178  type TargetGroup struct {
   179  	Enabled          bool     `yaml:"enabled"`
   180  	Arns             []string `yaml:"arns"`
   181  	SecurityGroupIds []string `yaml:"securityGroupIds"`
   182  }
   183  
   184  type KubeProxy struct {
   185  	IPVSMode         IPVSMode               `yaml:"ipvsMode"`
   186  	ComputeResources ComputeResources       `yaml:"resources,omitempty"`
   187  	Config           map[string]interface{} `yaml:"config,omitempty"`
   188  }
   189  
   190  type IPVSMode struct {
   191  	Enabled       bool   `yaml:"enabled"`
   192  	Scheduler     string `yaml:"scheduler"`
   193  	SyncPeriod    string `yaml:"syncPeriod"`
   194  	MinSyncPeriod string `yaml:"minSyncPeriod"`
   195  }
   196  
   197  type CoreDNSLocal struct {
   198  	Enabled          bool             `yaml:"enabled"`
   199  	ComputeResources ComputeResources `yaml:"resources,omitempty"`
   200  }
   201  
   202  type DNSMasq struct {
   203  	CoreDNSLocal  CoreDNSLocal `yaml:"coreDNSLocal"`
   204  	CacheSize     int          `yaml:"cacheSize"`
   205  	DNSForwardMax int          `yaml:"dnsForwardMax"`
   206  	NegTTL        int          `yaml:"negTTL"`
   207  }
   208  
   209  type KubeDnsAutoscaler struct {
   210  	CoresPerReplica int `yaml:"coresPerReplica"`
   211  	NodesPerReplica int `yaml:"nodesPerReplica"`
   212  	Min             int `yaml:"min"`
   213  }
   214  
   215  type KubeDns struct {
   216  	Provider                     string            `yaml:"provider"`
   217  	NodeLocalResolver            bool              `yaml:"nodeLocalResolver"`
   218  	NodeLocalResolverOptions     []string          `yaml:"nodeLocalResolverOptions"`
   219  	DNSMasq                      DNSMasq           `yaml:"dnsmasq"`
   220  	DeployToControllers          bool              `yaml:"deployToControllers"`
   221  	AntiAffinityAvailabilityZone bool              `yaml:"antiAffinityAvailabilityZone"`
   222  	TTL                          int               `yaml:"ttl"`
   223  	Autoscaler                   KubeDnsAutoscaler `yaml:"autoscaler"`
   224  	DnsDeploymentResources       ComputeResources  `yaml:"dnsDeploymentResources,omitempty"`
   225  	ExtraCoreDNSConfig           string            `yaml:"extraCoreDNSConfig"`
   226  	AdditionalZoneCoreDNSConfig  string            `yaml:"additionalZoneCoreDNSConfig"`
   227  }
   228  
   229  func (c *KubeDns) MergeIfEmpty(other KubeDns) {
   230  	if c.NodeLocalResolver == false && c.DeployToControllers == false {
   231  		c.NodeLocalResolver = other.NodeLocalResolver
   232  		c.DeployToControllers = other.DeployToControllers
   233  	}
   234  }