Skip to content

Commit

Permalink
updated to use kubernetes#8455
Browse files Browse the repository at this point in the history
  • Loading branch information
rdrgmnzs authored and granular-ryanbonham committed May 22, 2020
1 parent 93b9554 commit b3881b6
Show file tree
Hide file tree
Showing 10 changed files with 106 additions and 43 deletions.
37 changes: 30 additions & 7 deletions k8s/crds/kops.k8s.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -567,13 +567,36 @@ spec:
manager:
description: Manager describes the manager configuration
properties:
etcdConfigOverwrite:
additionalProperties:
type: string
description: EtcdConfigOverwrite allows etcd setting to be
overwritten with ENV variables. The setting are not validated.
A list of config ENV vars can be found at https://github.com/etcd-io/etcd/blob/master/Documentation/op-guide/configuration.md
type: object
env:
description: Env allows users to pass in env variables to
the etcd-manager container. Variables starting with ETCD_
will be further passed down to the etcd process. This allows
etcd setting to be configured/overwriten. No config validation
is done. A list of etcd config ENV vars can be found at
https://github.com/etcd-io/etcd/blob/master/Documentation/op-guide/configuration.md
items:
description: EnvVar represents an environment variable present
in a Container.
properties:
name:
description: Name of the environment variable. Must
be a C_IDENTIFIER.
type: string
value:
description: 'Variable references $(VAR_NAME) are expanded
using the previous defined environment variables in
the container and any service environment variables.
If a variable cannot be resolved, the reference in
the input string will be unchanged. The $(VAR_NAME)
syntax can be escaped with a double $$, ie: $$(VAR_NAME).
Escaped references will never be expanded, regardless
of whether the variable exists or not. Defaults to
"".'
type: string
required:
- name
type: object
type: array
image:
description: Image is the etcd manager image to use.
type: string
Expand Down
8 changes: 5 additions & 3 deletions pkg/apis/kops/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,9 +453,11 @@ type EtcdBackupSpec struct {
type EtcdManagerSpec struct {
// Image is the etcd manager image to use.
Image string `json:"image,omitempty"`
// EtcdConfigOverwrite allows etcd setting to be overwritten with ENV variables. The setting are not validated.
// A list of config ENV vars can be found at https://github.com/etcd-io/etcd/blob/master/Documentation/op-guide/configuration.md
EtcdConfigOverwrite map[string]string `json:"etcdConfigOverwrite,omitempty"`
// Env allows users to pass in env variables to the etcd-manager container.
// Variables starting with ETCD_ will be further passed down to the etcd process.
// This allows etcd setting to be overwriten. No config validation is done.
// A list of etcd config ENV vars can be found at https://github.com/etcd-io/etcd/blob/master/Documentation/op-guide/configuration.md
Env []EnvVar `json:"env,omitempty"`
}

// EtcdMemberSpec is a specification for a etcd member
Expand Down
8 changes: 5 additions & 3 deletions pkg/apis/kops/v1alpha1/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,11 @@ type EtcdBackupSpec struct {
type EtcdManagerSpec struct {
// Image is the etcd manager image to use.
Image string `json:"image,omitempty"`
// EtcdConfigOverwrite allows etcd setting to be overwritten with ENV variables. The setting are not validated.
// A list of config ENV vars can be found at https://github.com/etcd-io/etcd/blob/master/Documentation/op-guide/configuration.md
EtcdConfigOverwrite map[string]string `json:"etcdConfigOverwrite,omitempty"`
// Env allows users to pass in env variables to the etcd-manager container.
// Variables starting with ETCD_ will be further passed down to the etcd process.
// This allows etcd setting to be configured/overwriten. No config validation is done.
// A list of etcd config ENV vars can be found at https://github.com/etcd-io/etcd/blob/master/Documentation/op-guide/configuration.md
Env []EnvVar `json:"env,omitempty"`
}

// EtcdMemberSpec is a specification for a etcd member
Expand Down
24 changes: 22 additions & 2 deletions pkg/apis/kops/v1alpha1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions pkg/apis/kops/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions pkg/apis/kops/v1alpha2/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,11 @@ type EtcdBackupSpec struct {
type EtcdManagerSpec struct {
// Image is the etcd manager image to use.
Image string `json:"image,omitempty"`
// EtcdConfigOverwrite allows etcd setting to be overwritten with ENV variables. The setting are not validated.
// A list of config ENV vars can be found at https://github.com/etcd-io/etcd/blob/master/Documentation/op-guide/configuration.md
EtcdConfigOverwrite map[string]string `json:"etcdConfigOverwrite,omitempty"`
// Env allows users to pass in env variables to the etcd-manager container.
// Variables starting with ETCD_ will be further passed down to the etcd process.
// This allows etcd setting to be configured/overwriten. No config validation is done.
// A list of etcd config ENV vars can be found at https://github.com/etcd-io/etcd/blob/master/Documentation/op-guide/configuration.md
Env []EnvVar `json:"env,omitempty"`
}

// EtcdMemberSpec is a specification for a etcd member
Expand Down
24 changes: 22 additions & 2 deletions pkg/apis/kops/v1alpha2/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions pkg/apis/kops/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions pkg/apis/kops/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions pkg/model/components/etcdmanager/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,12 +449,12 @@ func (b *EtcdManagerBuilder) buildPod(etcdCluster *kops.EtcdClusterSpec) (*v1.Po

container.Env = envMap.ToEnvVars()

if etcdCluster.Manager != nil && len(etcdCluster.Manager.EtcdConfigOverwrite) > 0 {
for name, value := range etcdCluster.Manager.EtcdConfigOverwrite {
klog.Warningf("overloading ENV var in manifest %s with %s=%s", bundle, name, value)
if etcdCluster.Manager != nil && len(etcdCluster.Manager.Env) > 0 {
for _, envVar := range etcdCluster.Manager.Env {
klog.Warningf("overloading ENV var in manifest %s with %s=%s", bundle, envVar.Name, envVar.Value)
configOverwrite := v1.EnvVar{
Name: name,
Value: value,
Name: envVar.Name,
Value: envVar.Value,
}

container.Env = append(container.Env, configOverwrite)
Expand Down

0 comments on commit b3881b6

Please sign in to comment.