mirror of https://github.com/kubernetes/kops.git
Merge pull request #11583 from dntosas/json-logging
Add support for logging-format option (text/json)
This commit is contained in:
commit
4df9da09d0
|
@ -554,6 +554,16 @@ spec:
|
|||
defaultUnreachableTolerationSeconds: 600
|
||||
```
|
||||
|
||||
### LogFormat
|
||||
|
||||
Choose between log format. Permitted formats: "json", "text". Default: "text".
|
||||
|
||||
```yaml
|
||||
spec:
|
||||
kubeAPIServer:
|
||||
logFormat: json
|
||||
```
|
||||
|
||||
## externalDns
|
||||
|
||||
This block contains configuration options for your `external-DNS` provider.
|
||||
|
@ -698,6 +708,16 @@ spec:
|
|||
eventBurst: 10
|
||||
```
|
||||
|
||||
### LogFormat
|
||||
|
||||
Choose between log format. Permitted formats: "json", "text". Default: "text".
|
||||
|
||||
```yaml
|
||||
spec:
|
||||
kubelet:
|
||||
logFormat: json
|
||||
```
|
||||
|
||||
## kubeScheduler
|
||||
|
||||
This block contains configurations for `kube-scheduler`. See https://kubernetes.io/docs/admin/kube-scheduler/
|
||||
|
@ -713,6 +733,16 @@ Will make kube-scheduler use the scheduler policy from configmap "scheduler-poli
|
|||
|
||||
Note that as of Kubernetes 1.8.0 kube-scheduler does not reload its configuration from configmap automatically. You will need to ssh into the master instance and restart the Docker container manually.
|
||||
|
||||
### LogFormat
|
||||
|
||||
Choose between log format. Permitted formats: "json", "text". Default: "text".
|
||||
|
||||
```yaml
|
||||
spec:
|
||||
kubeScheduler:
|
||||
logFormat: json
|
||||
```
|
||||
|
||||
## kubeDNS
|
||||
|
||||
This block contains configurations for [CoreDNS](https://coredns.io/).
|
||||
|
@ -795,6 +825,16 @@ spec:
|
|||
|
||||
For more details on `horizontalPodAutoscaler` flags see the [official HPA docs](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) and the [kOps guides on how to set it up](horizontal_pod_autoscaling.md).
|
||||
|
||||
### LogFormat
|
||||
|
||||
Choose between log format. Permitted formats: "json", "text". Default: "text".
|
||||
|
||||
```yaml
|
||||
spec:
|
||||
kubeControllerManager:
|
||||
logFormat: json
|
||||
```
|
||||
|
||||
## Feature Gates
|
||||
|
||||
Feature gates can be configured on the kubelet.
|
||||
|
@ -1322,7 +1362,7 @@ The `discoveryStore` option causes kOps to publish an OIDC-compatible discovery
|
|||
to a path in an S3 bucket. This would ordinarily be a different bucket than the state store.
|
||||
kOps will automatically configure `spec.kubeAPIServer.serviceAccountIssuer` and default
|
||||
`spec.kubeAPIServer.serviceAccountJWKSURI` to the corresponding
|
||||
HTTPS URL.
|
||||
HTTPS URL.
|
||||
|
||||
The `enableAWSOIDCProvider` configures AWS to trust the service account issuer to
|
||||
authenticate service accounts for IAM Roles for Service Accounts (IRSA). In order for this to work,
|
||||
|
|
|
@ -1510,6 +1510,10 @@ spec:
|
|||
items:
|
||||
type: string
|
||||
type: array
|
||||
logFormat:
|
||||
description: 'LogFormat is the logging format of the api. Supported
|
||||
values: text, json. Default: text'
|
||||
type: string
|
||||
logLevel:
|
||||
description: LogLevel is the logging level of the api
|
||||
format: int32
|
||||
|
@ -1917,6 +1921,10 @@ spec:
|
|||
is enabled.
|
||||
type: string
|
||||
type: object
|
||||
logFormat:
|
||||
description: 'LogFormat is the logging format of the controler
|
||||
manager. Supported values: text, json. Default: text'
|
||||
type: string
|
||||
logLevel:
|
||||
description: LogLevel is the defined logLevel
|
||||
format: int32
|
||||
|
@ -2259,6 +2267,10 @@ spec:
|
|||
is enabled.
|
||||
type: string
|
||||
type: object
|
||||
logFormat:
|
||||
description: 'LogFormat is the logging format of the scheduler.
|
||||
Supported values: text, json. Default: text'
|
||||
type: string
|
||||
logLevel:
|
||||
description: LogLevel is the logging level
|
||||
format: int32
|
||||
|
@ -2504,6 +2516,10 @@ spec:
|
|||
description: KubeletCgroups is the absolute name of cgroups to
|
||||
isolate the kubelet in.
|
||||
type: string
|
||||
logFormat:
|
||||
description: 'LogFormat is the logging format of the kubelet.
|
||||
Supported values: text, json. Default: text'
|
||||
type: string
|
||||
logLevel:
|
||||
description: LogLevel is the logging level of the kubelet
|
||||
format: int32
|
||||
|
@ -2910,6 +2926,10 @@ spec:
|
|||
description: KubeletCgroups is the absolute name of cgroups to
|
||||
isolate the kubelet in.
|
||||
type: string
|
||||
logFormat:
|
||||
description: 'LogFormat is the logging format of the kubelet.
|
||||
Supported values: text, json. Default: text'
|
||||
type: string
|
||||
logLevel:
|
||||
description: LogLevel is the logging level of the kubelet
|
||||
format: int32
|
||||
|
|
|
@ -470,6 +470,10 @@ spec:
|
|||
description: KubeletCgroups is the absolute name of cgroups to
|
||||
isolate the kubelet in.
|
||||
type: string
|
||||
logFormat:
|
||||
description: 'LogFormat is the logging format of the kubelet.
|
||||
Supported values: text, json. Default: text'
|
||||
type: string
|
||||
logLevel:
|
||||
description: LogLevel is the logging level of the kubelet
|
||||
format: int32
|
||||
|
|
|
@ -45,6 +45,10 @@ type KubeletConfigSpec struct {
|
|||
KubeconfigPath string `json:"kubeconfigPath,omitempty" flag:"kubeconfig"`
|
||||
// RequireKubeconfig indicates a kubeconfig is required
|
||||
RequireKubeconfig *bool `json:"requireKubeconfig,omitempty" flag:"require-kubeconfig"`
|
||||
// LogFormat is the logging format of the kubelet.
|
||||
// Supported values: text, json.
|
||||
// Default: text
|
||||
LogFormat string `json:"logFormat,omitempty" flag:"logging-format" flag-empty:"text"`
|
||||
// LogLevel is the logging level of the kubelet
|
||||
LogLevel *int32 `json:"logLevel,omitempty" flag:"v" flag-empty:"0"`
|
||||
// config is the path to the config file or directory of files
|
||||
|
@ -269,6 +273,10 @@ type KubeAPIServerConfig struct {
|
|||
Image string `json:"image,omitempty"`
|
||||
// DisableBasicAuth removes the --basic-auth-file flag
|
||||
DisableBasicAuth *bool `json:"disableBasicAuth,omitempty"`
|
||||
// LogFormat is the logging format of the api.
|
||||
// Supported values: text, json.
|
||||
// Default: text
|
||||
LogFormat string `json:"logFormat,omitempty" flag:"logging-format" flag-empty:"text"`
|
||||
// LogLevel is the logging level of the api
|
||||
LogLevel int32 `json:"logLevel,omitempty" flag:"v" flag-empty:"0"`
|
||||
// CloudProvider is the name of the cloudProvider we are using, aws, gce etcd
|
||||
|
@ -511,6 +519,10 @@ type KubeAPIServerConfig struct {
|
|||
type KubeControllerManagerConfig struct {
|
||||
// Master is the url for the kube api master
|
||||
Master string `json:"master,omitempty" flag:"master"`
|
||||
// LogFormat is the logging format of the controler manager.
|
||||
// Supported values: text, json.
|
||||
// Default: text
|
||||
LogFormat string `json:"logFormat,omitempty" flag:"logging-format" flag-empty:"text"`
|
||||
// LogLevel is the defined logLevel
|
||||
LogLevel int32 `json:"logLevel,omitempty" flag:"v" flag-empty:"0"`
|
||||
// ServiceAccountPrivateKeyFile is the location of the private key for service account token signing.
|
||||
|
@ -663,6 +675,10 @@ type CloudControllerManagerConfig struct {
|
|||
type KubeSchedulerConfig struct {
|
||||
// Master is a url to the kube master
|
||||
Master string `json:"master,omitempty" flag:"master"`
|
||||
// LogFormat is the logging format of the scheduler.
|
||||
// Supported values: text, json.
|
||||
// Default: text
|
||||
LogFormat string `json:"logFormat,omitempty" flag:"logging-format" flag-empty:"text"`
|
||||
// LogLevel is the logging level
|
||||
LogLevel int32 `json:"logLevel,omitempty" flag:"v"`
|
||||
// Image is the docker image to use
|
||||
|
|
|
@ -45,6 +45,10 @@ type KubeletConfigSpec struct {
|
|||
KubeconfigPath string `json:"kubeconfigPath,omitempty" flag:"kubeconfig"`
|
||||
// RequireKubeconfig indicates a kubeconfig is required
|
||||
RequireKubeconfig *bool `json:"requireKubeconfig,omitempty" flag:"require-kubeconfig"`
|
||||
// LogFormat is the logging format of the kubelet.
|
||||
// Supported values: text, json.
|
||||
// Default: text
|
||||
LogFormat string `json:"logFormat,omitempty" flag:"logging-format" flag-empty:"text"`
|
||||
// LogLevel is the logging level of the kubelet
|
||||
LogLevel *int32 `json:"logLevel,omitempty" flag:"v" flag-empty:"0"`
|
||||
// config is the path to the config file or directory of files
|
||||
|
@ -269,6 +273,10 @@ type KubeAPIServerConfig struct {
|
|||
Image string `json:"image,omitempty"`
|
||||
// DisableBasicAuth removes the --basic-auth-file flag
|
||||
DisableBasicAuth *bool `json:"disableBasicAuth,omitempty"`
|
||||
// LogFormat is the logging format of the api.
|
||||
// Supported values: text, json.
|
||||
// Default: text
|
||||
LogFormat string `json:"logFormat,omitempty" flag:"logging-format" flag-empty:"text"`
|
||||
// LogLevel is the logging level of the api
|
||||
LogLevel int32 `json:"logLevel,omitempty" flag:"v" flag-empty:"0"`
|
||||
// CloudProvider is the name of the cloudProvider we are using, aws, gce etcd
|
||||
|
@ -511,6 +519,10 @@ type KubeAPIServerConfig struct {
|
|||
type KubeControllerManagerConfig struct {
|
||||
// Master is the url for the kube api master
|
||||
Master string `json:"master,omitempty" flag:"master"`
|
||||
// LogFormat is the logging format of the controler manager.
|
||||
// Supported values: text, json.
|
||||
// Default: text
|
||||
LogFormat string `json:"logFormat,omitempty" flag:"logging-format" flag-empty:"text"`
|
||||
// LogLevel is the defined logLevel
|
||||
LogLevel int32 `json:"logLevel,omitempty" flag:"v" flag-empty:"0"`
|
||||
// ServiceAccountPrivateKeyFile is the location of the private key for service account token signing.
|
||||
|
@ -662,6 +674,10 @@ type CloudControllerManagerConfig struct {
|
|||
type KubeSchedulerConfig struct {
|
||||
// Master is a url to the kube master
|
||||
Master string `json:"master,omitempty" flag:"master"`
|
||||
// LogFormat is the logging format of the scheduler.
|
||||
// Supported values: text, json.
|
||||
// Default: text
|
||||
LogFormat string `json:"logFormat,omitempty" flag:"logging-format" flag-empty:"text"`
|
||||
// LogLevel is the logging level
|
||||
LogLevel int32 `json:"logLevel,omitempty" flag:"v"`
|
||||
// Image is the docker image to use
|
||||
|
|
|
@ -4587,6 +4587,7 @@ func Convert_kops_KopeioNetworkingSpec_To_v1alpha2_KopeioNetworkingSpec(in *kops
|
|||
func autoConvert_v1alpha2_KubeAPIServerConfig_To_kops_KubeAPIServerConfig(in *KubeAPIServerConfig, out *kops.KubeAPIServerConfig, s conversion.Scope) error {
|
||||
out.Image = in.Image
|
||||
out.DisableBasicAuth = in.DisableBasicAuth
|
||||
out.LogFormat = in.LogFormat
|
||||
out.LogLevel = in.LogLevel
|
||||
out.CloudProvider = in.CloudProvider
|
||||
out.SecurePort = in.SecurePort
|
||||
|
@ -4697,6 +4698,7 @@ func Convert_v1alpha2_KubeAPIServerConfig_To_kops_KubeAPIServerConfig(in *KubeAP
|
|||
func autoConvert_kops_KubeAPIServerConfig_To_v1alpha2_KubeAPIServerConfig(in *kops.KubeAPIServerConfig, out *KubeAPIServerConfig, s conversion.Scope) error {
|
||||
out.Image = in.Image
|
||||
out.DisableBasicAuth = in.DisableBasicAuth
|
||||
out.LogFormat = in.LogFormat
|
||||
out.LogLevel = in.LogLevel
|
||||
out.CloudProvider = in.CloudProvider
|
||||
out.SecurePort = in.SecurePort
|
||||
|
@ -4806,6 +4808,7 @@ func Convert_kops_KubeAPIServerConfig_To_v1alpha2_KubeAPIServerConfig(in *kops.K
|
|||
|
||||
func autoConvert_v1alpha2_KubeControllerManagerConfig_To_kops_KubeControllerManagerConfig(in *KubeControllerManagerConfig, out *kops.KubeControllerManagerConfig, s conversion.Scope) error {
|
||||
out.Master = in.Master
|
||||
out.LogFormat = in.LogFormat
|
||||
out.LogLevel = in.LogLevel
|
||||
out.ServiceAccountPrivateKeyFile = in.ServiceAccountPrivateKeyFile
|
||||
out.Image = in.Image
|
||||
|
@ -4872,6 +4875,7 @@ func Convert_v1alpha2_KubeControllerManagerConfig_To_kops_KubeControllerManagerC
|
|||
|
||||
func autoConvert_kops_KubeControllerManagerConfig_To_v1alpha2_KubeControllerManagerConfig(in *kops.KubeControllerManagerConfig, out *KubeControllerManagerConfig, s conversion.Scope) error {
|
||||
out.Master = in.Master
|
||||
out.LogFormat = in.LogFormat
|
||||
out.LogLevel = in.LogLevel
|
||||
out.ServiceAccountPrivateKeyFile = in.ServiceAccountPrivateKeyFile
|
||||
out.Image = in.Image
|
||||
|
@ -5062,6 +5066,7 @@ func Convert_kops_KubeProxyConfig_To_v1alpha2_KubeProxyConfig(in *kops.KubeProxy
|
|||
|
||||
func autoConvert_v1alpha2_KubeSchedulerConfig_To_kops_KubeSchedulerConfig(in *KubeSchedulerConfig, out *kops.KubeSchedulerConfig, s conversion.Scope) error {
|
||||
out.Master = in.Master
|
||||
out.LogFormat = in.LogFormat
|
||||
out.LogLevel = in.LogLevel
|
||||
out.Image = in.Image
|
||||
if in.LeaderElection != nil {
|
||||
|
@ -5092,6 +5097,7 @@ func Convert_v1alpha2_KubeSchedulerConfig_To_kops_KubeSchedulerConfig(in *KubeSc
|
|||
|
||||
func autoConvert_kops_KubeSchedulerConfig_To_v1alpha2_KubeSchedulerConfig(in *kops.KubeSchedulerConfig, out *KubeSchedulerConfig, s conversion.Scope) error {
|
||||
out.Master = in.Master
|
||||
out.LogFormat = in.LogFormat
|
||||
out.LogLevel = in.LogLevel
|
||||
out.Image = in.Image
|
||||
if in.LeaderElection != nil {
|
||||
|
@ -5132,6 +5138,7 @@ func autoConvert_v1alpha2_KubeletConfigSpec_To_kops_KubeletConfigSpec(in *Kubele
|
|||
out.TLSMinVersion = in.TLSMinVersion
|
||||
out.KubeconfigPath = in.KubeconfigPath
|
||||
out.RequireKubeconfig = in.RequireKubeconfig
|
||||
out.LogFormat = in.LogFormat
|
||||
out.LogLevel = in.LogLevel
|
||||
out.PodManifestPath = in.PodManifestPath
|
||||
out.HostnameOverride = in.HostnameOverride
|
||||
|
@ -5226,6 +5233,7 @@ func autoConvert_kops_KubeletConfigSpec_To_v1alpha2_KubeletConfigSpec(in *kops.K
|
|||
out.TLSMinVersion = in.TLSMinVersion
|
||||
out.KubeconfigPath = in.KubeconfigPath
|
||||
out.RequireKubeconfig = in.RequireKubeconfig
|
||||
out.LogFormat = in.LogFormat
|
||||
out.LogLevel = in.LogLevel
|
||||
out.PodManifestPath = in.PodManifestPath
|
||||
out.HostnameOverride = in.HostnameOverride
|
||||
|
|
|
@ -574,6 +574,11 @@ func validateKubeAPIServer(v *kops.KubeAPIServerConfig, c *kops.Cluster, fldPath
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if v.LogFormat != "" {
|
||||
allErrs = append(allErrs, IsValidValue(fldPath.Child("logFormat"), &v.LogFormat, []string{"text", "json"})...)
|
||||
}
|
||||
|
||||
return allErrs
|
||||
}
|
||||
|
||||
|
@ -637,6 +642,10 @@ func validateKubelet(k *kops.KubeletConfigSpec, c *kops.Cluster, kubeletPath *fi
|
|||
}
|
||||
}
|
||||
|
||||
if k.LogFormat != "" {
|
||||
allErrs = append(allErrs, IsValidValue(kubeletPath.Child("logFormat"), &k.LogFormat, []string{"text", "json"})...)
|
||||
}
|
||||
|
||||
}
|
||||
return allErrs
|
||||
}
|
||||
|
|
|
@ -289,6 +289,12 @@ func TestValidateKubeAPIServer(t *testing.T) {
|
|||
"Unsupported value::KubeAPIServer.authorizationMode",
|
||||
},
|
||||
},
|
||||
{
|
||||
Input: kops.KubeAPIServerConfig{
|
||||
LogFormat: "no-json",
|
||||
},
|
||||
ExpectedErrors: []string{"Unsupported value::KubeAPIServer.logFormat"},
|
||||
},
|
||||
}
|
||||
for _, g := range grid {
|
||||
if g.Cluster == nil {
|
||||
|
|
Loading…
Reference in New Issue