mirror of https://github.com/kubernetes/kops.git
enable log rotation using built in docker option
This commit is contained in:
parent
59d097b6be
commit
256640d3d4
|
@ -21,6 +21,7 @@ type DockerConfig struct {
|
||||||
LogLevel *string `json:"logLevel,omitempty" flag:"log-level"`
|
LogLevel *string `json:"logLevel,omitempty" flag:"log-level"`
|
||||||
IPTables *bool `json:"ipTables,omitempty" flag:"iptables"`
|
IPTables *bool `json:"ipTables,omitempty" flag:"iptables"`
|
||||||
IPMasq *bool `json:"ipMasq,omitempty" flag:"ip-masq"`
|
IPMasq *bool `json:"ipMasq,omitempty" flag:"ip-masq"`
|
||||||
|
LogOpt *string `json:"logOpt,omitempty" flag:"log-opt"`
|
||||||
|
|
||||||
// Storage maps to the docker storage flag
|
// Storage maps to the docker storage flag
|
||||||
// But nodeup will also process a comma-separate list, selecting the first supported option
|
// But nodeup will also process a comma-separate list, selecting the first supported option
|
||||||
|
|
|
@ -21,6 +21,7 @@ type DockerConfig struct {
|
||||||
LogLevel *string `json:"logLevel,omitempty" flag:"log-level"`
|
LogLevel *string `json:"logLevel,omitempty" flag:"log-level"`
|
||||||
IPTables *bool `json:"ipTables,omitempty" flag:"iptables"`
|
IPTables *bool `json:"ipTables,omitempty" flag:"iptables"`
|
||||||
IPMasq *bool `json:"ipMasq,omitempty" flag:"ip-masq"`
|
IPMasq *bool `json:"ipMasq,omitempty" flag:"ip-masq"`
|
||||||
|
LogOpt *string `json:"logOpt,omitempty" flag:"log-opt"`
|
||||||
|
|
||||||
// Storage maps to the docker storage flag
|
// Storage maps to the docker storage flag
|
||||||
// But nodeup will also process a comma-separate list, selecting the first supported option
|
// But nodeup will also process a comma-separate list, selecting the first supported option
|
||||||
|
|
|
@ -659,6 +659,7 @@ func autoConvert_v1alpha1_DockerConfig_To_kops_DockerConfig(in *DockerConfig, ou
|
||||||
out.LogLevel = in.LogLevel
|
out.LogLevel = in.LogLevel
|
||||||
out.IPTables = in.IPTables
|
out.IPTables = in.IPTables
|
||||||
out.IPMasq = in.IPMasq
|
out.IPMasq = in.IPMasq
|
||||||
|
out.LogOpt = in.LogOpt
|
||||||
out.Storage = in.Storage
|
out.Storage = in.Storage
|
||||||
out.InsecureRegistry = in.InsecureRegistry
|
out.InsecureRegistry = in.InsecureRegistry
|
||||||
out.MTU = in.MTU
|
out.MTU = in.MTU
|
||||||
|
@ -676,6 +677,7 @@ func autoConvert_kops_DockerConfig_To_v1alpha1_DockerConfig(in *kops.DockerConfi
|
||||||
out.LogLevel = in.LogLevel
|
out.LogLevel = in.LogLevel
|
||||||
out.IPTables = in.IPTables
|
out.IPTables = in.IPTables
|
||||||
out.IPMasq = in.IPMasq
|
out.IPMasq = in.IPMasq
|
||||||
|
out.LogOpt = in.LogOpt
|
||||||
out.Storage = in.Storage
|
out.Storage = in.Storage
|
||||||
out.InsecureRegistry = in.InsecureRegistry
|
out.InsecureRegistry = in.InsecureRegistry
|
||||||
out.MTU = in.MTU
|
out.MTU = in.MTU
|
||||||
|
|
|
@ -21,6 +21,7 @@ type DockerConfig struct {
|
||||||
LogLevel *string `json:"logLevel,omitempty" flag:"log-level"`
|
LogLevel *string `json:"logLevel,omitempty" flag:"log-level"`
|
||||||
IPTables *bool `json:"ipTables,omitempty" flag:"iptables"`
|
IPTables *bool `json:"ipTables,omitempty" flag:"iptables"`
|
||||||
IPMasq *bool `json:"ipMasq,omitempty" flag:"ip-masq"`
|
IPMasq *bool `json:"ipMasq,omitempty" flag:"ip-masq"`
|
||||||
|
LogOpt *string `json:"logOpt,omitempty" flag:"log-opt"`
|
||||||
|
|
||||||
// Storage maps to the docker storage flag
|
// Storage maps to the docker storage flag
|
||||||
// But nodeup will also process a comma-separate list, selecting the first supported option
|
// But nodeup will also process a comma-separate list, selecting the first supported option
|
||||||
|
|
|
@ -741,6 +741,7 @@ func autoConvert_v1alpha2_DockerConfig_To_kops_DockerConfig(in *DockerConfig, ou
|
||||||
out.LogLevel = in.LogLevel
|
out.LogLevel = in.LogLevel
|
||||||
out.IPTables = in.IPTables
|
out.IPTables = in.IPTables
|
||||||
out.IPMasq = in.IPMasq
|
out.IPMasq = in.IPMasq
|
||||||
|
out.LogOpt = in.LogOpt
|
||||||
out.Storage = in.Storage
|
out.Storage = in.Storage
|
||||||
out.InsecureRegistry = in.InsecureRegistry
|
out.InsecureRegistry = in.InsecureRegistry
|
||||||
out.MTU = in.MTU
|
out.MTU = in.MTU
|
||||||
|
@ -758,6 +759,7 @@ func autoConvert_kops_DockerConfig_To_v1alpha2_DockerConfig(in *kops.DockerConfi
|
||||||
out.LogLevel = in.LogLevel
|
out.LogLevel = in.LogLevel
|
||||||
out.IPTables = in.IPTables
|
out.IPTables = in.IPTables
|
||||||
out.IPMasq = in.IPMasq
|
out.IPMasq = in.IPMasq
|
||||||
|
out.LogOpt = in.LogOpt
|
||||||
out.Storage = in.Storage
|
out.Storage = in.Storage
|
||||||
out.InsecureRegistry = in.InsecureRegistry
|
out.InsecureRegistry = in.InsecureRegistry
|
||||||
out.MTU = in.MTU
|
out.MTU = in.MTU
|
||||||
|
|
|
@ -5,3 +5,4 @@ Docker:
|
||||||
IPMasq: false
|
IPMasq: false
|
||||||
# Note the alternative syntax... with a comma we will try each of the filesystems in turn
|
# Note the alternative syntax... with a comma we will try each of the filesystems in turn
|
||||||
Storage: overlay,aufs
|
Storage: overlay,aufs
|
||||||
|
LogOpt: "max-size=10m"
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
/var/lib/docker/containers/*/*-json.log {
|
|
||||||
rotate 5
|
|
||||||
copytruncate
|
|
||||||
missingok
|
|
||||||
notifempty
|
|
||||||
compress
|
|
||||||
maxsize 10M
|
|
||||||
daily
|
|
||||||
create 0644 root root
|
|
||||||
}
|
|
|
@ -98,6 +98,7 @@ func TestPopulateCluster_Docker_Spec(t *testing.T) {
|
||||||
c.Spec.Docker = &api.DockerConfig{
|
c.Spec.Docker = &api.DockerConfig{
|
||||||
MTU: fi.Int32(5678),
|
MTU: fi.Int32(5678),
|
||||||
InsecureRegistry: fi.String("myregistry.com:1234"),
|
InsecureRegistry: fi.String("myregistry.com:1234"),
|
||||||
|
LogOpt: fi.String("env=FOO"),
|
||||||
}
|
}
|
||||||
|
|
||||||
err := PerformAssignments(c)
|
err := PerformAssignments(c)
|
||||||
|
@ -119,6 +120,10 @@ func TestPopulateCluster_Docker_Spec(t *testing.T) {
|
||||||
if fi.StringValue(full.Spec.Docker.InsecureRegistry) != "myregistry.com:1234" {
|
if fi.StringValue(full.Spec.Docker.InsecureRegistry) != "myregistry.com:1234" {
|
||||||
t.Fatalf("Unexpected Docker InsecureRegistry: %v", full.Spec.Docker.InsecureRegistry)
|
t.Fatalf("Unexpected Docker InsecureRegistry: %v", full.Spec.Docker.InsecureRegistry)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if fi.StringValue(full.Spec.Docker.LogOpt) != "env=FOO" {
|
||||||
|
t.Fatalf("Unexpected Docker LogOpt: %v", full.Spec.Docker.LogOpt)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPopulateCluster_StorageDefault(t *testing.T) {
|
func TestPopulateCluster_StorageDefault(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue