Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[csi/aws] Bump templates + add support for warm pools #11304

Merged
merged 2 commits into from
Apr 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion k8s/crds/kops.k8s.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,20 @@ spec:
driver
properties:
enabled:
description: Enabled enables the AWS EBS CSI driver
description: 'Enabled enables the AWS EBS CSI driver Default:
false'
type: boolean
version:
description: 'Version is the container image tag used. Default:
The latest stable release which is compatible with your
Kubernetes version'
type: string
volumeAttachLimit:
description: 'VolumeAttachLimit is the maximum number of volumes
attachable per node. If specified, the limit applies to
all nodes. If not specified, the value is approximated from
the instance type. Default: -'
type: integer
type: object
azure:
description: Azure cloud-config options
Expand Down
1 change: 1 addition & 0 deletions nodeup/pkg/model/BUILD.bazel

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

58 changes: 58 additions & 0 deletions nodeup/pkg/model/awsebscsidriver.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
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 model

import (
"k8s.io/kops/upup/pkg/fi"
)

// AWSEBSCSIDriverBuilder writes AWSEBSCSIDriver's assets
type AWSEBSCSIDriverBuilder struct {
*NodeupModelContext
}

var _ fi.ModelBuilder = &AWSEBSCSIDriverBuilder{}

// Build is responsible for configuring the EBS CSI Driver stuff
func (b *AWSEBSCSIDriverBuilder) Build(c *fi.ModelBuilderContext) error {
csi := b.Cluster.Spec.CloudConfig.AWSEBSCSIDriver

if csi == nil {
return nil
}

// Pulling CSI driver image
image := "k8s.gcr.io/provider-aws/aws-ebs-csi-driver:" + *csi.Version
b.WarmPullImage(c, image)

// Pulling CSI sidecars images
sidecars := []string{
"csi-provisioner:v2.2.0",
"csi-attacher:v3.2.0",
"csi-snapshotter:v4.0.0",
"csi-resizer:v1.1.0",
"csi-node-driver-registrar:v2.1.0",
"livenessprobe:v2.2.0",
}
for _, s := range sidecars {
image = "k8s.gcr.io/sig-storage/" + s
b.WarmPullImage(c, image)
}

return nil

}
13 changes: 12 additions & 1 deletion pkg/apis/kops/componentconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -836,8 +836,19 @@ type CloudConfiguration struct {

// AWSEBSCSIDriver is the config for the AWS EBS CSI driver
type AWSEBSCSIDriver struct {
//Enabled enables the AWS EBS CSI driver
// Enabled enables the AWS EBS CSI driver
// Default: false
Enabled *bool `json:"enabled,omitempty"`

// Version is the container image tag used.
// Default: The latest stable release which is compatible with your Kubernetes version
Version *string `json:"version,omitempty"`

// VolumeAttachLimit is the maximum number of volumes attachable per node.
// If specified, the limit applies to all nodes.
// If not specified, the value is approximated from the instance type.
// Default: -
VolumeAttachLimit *int `json:"volumeAttachLimit,omitempty"`
}

// NodeTerminationHandlerConfig determines the node termination handler configuration.
Expand Down
13 changes: 12 additions & 1 deletion pkg/apis/kops/v1alpha2/componentconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -835,8 +835,19 @@ type CloudConfiguration struct {

// AWSEBSCSIDriver is the config for the AWS EBS CSI driver
type AWSEBSCSIDriver struct {
//Enabled enables the AWS EBS CSI driver
// Enabled enables the AWS EBS CSI driver
// Default: false
Enabled *bool `json:"enabled,omitempty"`

// Version is the container image tag used.
// Default: The latest stable release which is compatible with your Kubernetes version
Version *string `json:"version,omitempty"`

// VolumeAttachLimit is the maximum number of volumes attachable per node.
// If specified, the limit applies to all nodes.
// If not specified, the value is approximated from the instance type.
// Default: -
VolumeAttachLimit *int `json:"volumeAttachLimit,omitempty"`
}

// NodeTerminationHandlerConfig determines the node termination handler configuration.
Expand Down
4 changes: 4 additions & 0 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: 10 additions & 0 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: 10 additions & 0 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.

1 change: 1 addition & 0 deletions pkg/model/components/BUILD.bazel

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

46 changes: 46 additions & 0 deletions pkg/model/components/awsebscsidriver.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
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"
"k8s.io/kops/upup/pkg/fi/loader"
)

// AWSEBSCSIDriverOptionsBuilder adds options for the AWS EBS CSI driver to the model
type AWSEBSCSIDriverOptionsBuilder struct {
*OptionsContext
}

var _ loader.OptionsBuilder = &AWSEBSCSIDriverOptionsBuilder{}

func (b *AWSEBSCSIDriverOptionsBuilder) BuildOptions(o interface{}) error {
clusterSpec := o.(*kops.ClusterSpec)
c := clusterSpec.CloudConfig.AWSEBSCSIDriver
if c == nil {
return nil
}

if c.Version == nil {
version := "v0.10.1"
c.Version = fi.String(version)
}

return nil

}
Loading