mirror of https://github.com/kubernetes/kops.git
feat(karpenter): Variabilize Image, logFormat and logLevel
This commit is contained in:
parent
76eda9b9f4
commit
4a01fc30c4
|
|
@ -1508,6 +1508,12 @@ spec:
|
|||
properties:
|
||||
enabled:
|
||||
type: boolean
|
||||
image:
|
||||
type: string
|
||||
logEncoding:
|
||||
type: string
|
||||
logLevel:
|
||||
type: string
|
||||
type: object
|
||||
keyStore:
|
||||
description: KeyStore is the VFS path to where SSL keys and certificates
|
||||
|
|
|
|||
|
|
@ -250,6 +250,9 @@ type ScalewaySpec struct {
|
|||
|
||||
type KarpenterConfig struct {
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
LogEncoding string `json:"logFormat,omitempty"`
|
||||
LogLevel string `json:"logLevel,omitempty"`
|
||||
Image string `json:"image,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceAccountIssuerDiscoveryConfig configures an OIDC Issuer.
|
||||
|
|
|
|||
|
|
@ -256,6 +256,9 @@ type PodIdentityWebhookSpec struct {
|
|||
|
||||
type KarpenterConfig struct {
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
LogEncoding string `json:"logEncoding,omitempty"`
|
||||
LogLevel string `json:"logLevel,omitempty"`
|
||||
Image string `json:"image,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceAccountIssuerDiscoveryConfig configures an OIDC Issuer.
|
||||
|
|
|
|||
|
|
@ -4540,6 +4540,9 @@ func Convert_kops_InstanceRequirementsSpec_To_v1alpha2_InstanceRequirementsSpec(
|
|||
|
||||
func autoConvert_v1alpha2_KarpenterConfig_To_kops_KarpenterConfig(in *KarpenterConfig, out *kops.KarpenterConfig, s conversion.Scope) error {
|
||||
out.Enabled = in.Enabled
|
||||
out.LogEncoding = in.LogEncoding
|
||||
out.LogLevel = in.LogLevel
|
||||
out.Image = in.Image
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -4550,6 +4553,9 @@ func Convert_v1alpha2_KarpenterConfig_To_kops_KarpenterConfig(in *KarpenterConfi
|
|||
|
||||
func autoConvert_kops_KarpenterConfig_To_v1alpha2_KarpenterConfig(in *kops.KarpenterConfig, out *KarpenterConfig, s conversion.Scope) error {
|
||||
out.Enabled = in.Enabled
|
||||
out.LogEncoding = in.LogEncoding
|
||||
out.LogLevel = in.LogLevel
|
||||
out.Image = in.Image
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -246,6 +246,9 @@ type ScalewaySpec struct {
|
|||
|
||||
type KarpenterConfig struct {
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
LogEncoding string `json:"logEncoding,omitempty"`
|
||||
LogLevel string `json:"logLevel,omitempty"`
|
||||
Image string `json:"image,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceAccountIssuerDiscoveryConfig configures an OIDC Issuer.
|
||||
|
|
|
|||
|
|
@ -4899,6 +4899,9 @@ func Convert_kops_InstanceRootVolumeSpec_To_v1alpha3_InstanceRootVolumeSpec(in *
|
|||
|
||||
func autoConvert_v1alpha3_KarpenterConfig_To_kops_KarpenterConfig(in *KarpenterConfig, out *kops.KarpenterConfig, s conversion.Scope) error {
|
||||
out.Enabled = in.Enabled
|
||||
out.LogEncoding = in.LogEncoding
|
||||
out.LogLevel = in.LogLevel
|
||||
out.Image = in.Image
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -4909,6 +4912,9 @@ func Convert_v1alpha3_KarpenterConfig_To_kops_KarpenterConfig(in *KarpenterConfi
|
|||
|
||||
func autoConvert_kops_KarpenterConfig_To_v1alpha3_KarpenterConfig(in *kops.KarpenterConfig, out *KarpenterConfig, s conversion.Scope) error {
|
||||
out.Enabled = in.Enabled
|
||||
out.LogEncoding = in.LogEncoding
|
||||
out.LogLevel = in.LogLevel
|
||||
out.Image = in.Image
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
Copyright 2020 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package components
|
||||
|
||||
import (
|
||||
"k8s.io/kops/pkg/apis/kops"
|
||||
"k8s.io/kops/upup/pkg/fi/loader"
|
||||
)
|
||||
|
||||
// KarpenterOptionsBuilder adds options for the cilium to the model
|
||||
type KarpenterOptionsBuilder struct {
|
||||
Context *OptionsContext
|
||||
}
|
||||
|
||||
var _ loader.OptionsBuilder = &KarpenterOptionsBuilder{}
|
||||
|
||||
func (b *KarpenterOptionsBuilder) BuildOptions(o interface{}) error {
|
||||
clusterSpec := o.(*kops.ClusterSpec)
|
||||
c := clusterSpec.Karpenter
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if c.Image == "" {
|
||||
c.Image = "public.ecr.aws/karpenter/controller:v0.28.1"
|
||||
}
|
||||
|
||||
if c.LogEncoding == "" {
|
||||
c.LogEncoding = "console"
|
||||
}
|
||||
|
||||
if c.LogLevel == "" {
|
||||
c.LogLevel = "debug"
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -61,6 +61,9 @@ spec:
|
|||
useServiceAccountExternalPermissions: true
|
||||
karpenter:
|
||||
enabled: true
|
||||
image: public.ecr.aws/karpenter/controller:v0.28.1
|
||||
logEncoding: console
|
||||
logLevel: debug
|
||||
keyStore: memfs://clusters.example.com/minimal.example.com/pki
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
|
|
|
|||
|
|
@ -1119,7 +1119,7 @@ data:
|
|||
# https://github.com/uber-go/zap/blob/aa3e73ec0896f8b066ddf668597a02f89628ee50/config.go
|
||||
zap-logger-config: |
|
||||
{
|
||||
"level": "debug",
|
||||
"level": "{{ .Karpenter.LogLevel }}",
|
||||
"development": false,
|
||||
"disableStacktrace": true,
|
||||
"disableCaller": true,
|
||||
|
|
@ -1129,7 +1129,7 @@ data:
|
|||
},
|
||||
"outputPaths": ["stdout"],
|
||||
"errorOutputPaths": ["stderr"],
|
||||
"encoding": "console",
|
||||
"encoding": "{{ .Karpenter.LogEncoding }}",
|
||||
"encoderConfig": {
|
||||
"timeKey": "time",
|
||||
"levelKey": "level",
|
||||
|
|
@ -1482,7 +1482,7 @@ spec:
|
|||
dnsPolicy: ClusterFirst
|
||||
containers:
|
||||
- name: controller
|
||||
image: public.ecr.aws/karpenter/controller:v0.28.1
|
||||
image: {{ .Karpenter.Image }}
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: KUBERNETES_MIN_VERSION
|
||||
|
|
|
|||
|
|
@ -293,6 +293,7 @@ func (c *populateClusterSpec) run(ctx context.Context, clientset simple.Clientse
|
|||
codeModels = append(codeModels, &components.GCPCloudControllerManagerOptionsBuilder{OptionsContext: optionsContext})
|
||||
codeModels = append(codeModels, &components.GCPPDCSIDriverOptionsBuilder{OptionsContext: optionsContext})
|
||||
codeModels = append(codeModels, &components.HetznerCloudControllerManagerOptionsBuilder{OptionsContext: optionsContext})
|
||||
codeModels = append(codeModels, &components.KarpenterOptionsBuilder{Context: optionsContext})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue