Skip to content

feat: Add local-path-provisioner CSI #693

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

Merged
merged 1 commit into from
May 31, 2024
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: 8 additions & 6 deletions api/v1alpha1/addon_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ const (
CNIProviderCalico = "Calico"
CNIProviderCilium = "Cilium"

CSIProviderAWSEBS = "aws-ebs"
CSIProviderNutanix = "nutanix"
CSIProviderAWSEBS = "aws-ebs"
CSIProviderNutanix = "nutanix"
CSIProviderLocalPath = "local-path"

VirtualIPProviderKubeVIP = "KubeVIP"

Expand All @@ -45,8 +46,9 @@ const (
type StorageProvisioner string

const (
AWSEBSProvisioner StorageProvisioner = "ebs.csi.aws.com"
NutanixProvisioner StorageProvisioner = "csi.nutanix.com"
AWSEBSProvisioner StorageProvisioner = "ebs.csi.aws.com"
NutanixProvisioner StorageProvisioner = "csi.nutanix.com"
LocalPathProvisioner StorageProvisioner = "rancher.io/local-path"
)

// FIXME: Remove the CCM providers from the API. Users do not provider this
Expand Down Expand Up @@ -110,7 +112,7 @@ type ClusterAutoscaler struct {
type DefaultStorage struct {
// Name of the CSI Provider for the default storage class.
// +kubebuilder:validation:Required
// +kubebuilder:validation:Enum=aws-ebs;nutanix
// +kubebuilder:validation:Enum=aws-ebs;nutanix;local-path
ProviderName string `json:"providerName"`

// Name of storage class config in any of the provider objects.
Expand All @@ -131,7 +133,7 @@ type CSI struct {
type CSIProvider struct {
// Name of the CSI Provider.
// +kubebuilder:validation:Required
// +kubebuilder:validation:Enum=aws-ebs;nutanix
// +kubebuilder:validation:Enum=aws-ebs;nutanix;local-path
Name string `json:"name"`

// StorageClassConfig is a list of storage class configurations for this CSI provider.
Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha1/crds/caren.nutanix.com_awsclusterconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ spec:
enum:
- aws-ebs
- nutanix
- local-path
type: string
storageClassConfigName:
description: Name of storage class config in any of the
Expand Down Expand Up @@ -151,6 +152,7 @@ spec:
enum:
- aws-ebs
- nutanix
- local-path
type: string
storageClassConfig:
description: StorageClassConfig is a list of storage
Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha1/crds/caren.nutanix.com_dockerclusterconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ spec:
enum:
- aws-ebs
- nutanix
- local-path
type: string
storageClassConfigName:
description: Name of storage class config in any of the
Expand Down Expand Up @@ -152,6 +153,7 @@ spec:
enum:
- aws-ebs
- nutanix
- local-path
type: string
storageClassConfig:
description: StorageClassConfig is a list of storage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ spec:
enum:
- aws-ebs
- nutanix
- local-path
type: string
storageClassConfigName:
description: Name of storage class config in any of the
Expand Down Expand Up @@ -160,6 +161,7 @@ spec:
enum:
- aws-ebs
- nutanix
- local-path
type: string
storageClassConfig:
description: StorageClassConfig is a list of storage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ spec:
enum:
- aws-ebs
- nutanix
- local-path
type: string
storageClassConfigName:
description: Name of storage class config in any of the
Expand Down Expand Up @@ -152,6 +153,7 @@ spec:
enum:
- aws-ebs
- nutanix
- local-path
type: string
storageClassConfig:
description: StorageClassConfig is a list of storage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ data:
ChartName: cluster-autoscaler
ChartVersion: 9.37.0
RepositoryURL: https://kubernetes.github.io/autoscaler
local-path-provisioner-csi: |
ChartName: local-path-provisioner
ChartVersion: v0.0.29
RepositoryURL: https://charts.containeroo.ch
metallb: |
ChartName: metallb
ChartVersion: v0.14.5
Expand Down
9 changes: 9 additions & 0 deletions examples/capi-quick-start/docker-cluster-calico-crs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ spec:
cni:
provider: Calico
strategy: ClusterResourceSet
csi:
defaultStorage:
providerName: local-path
storageClassConfigName: local-path
providers:
- name: local-path
storageClassConfig:
- name: local-path
strategy: HelmAddon
nfd:
strategy: ClusterResourceSet
encryptionAtRest:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ spec:
cni:
provider: Calico
strategy: HelmAddon
csi:
defaultStorage:
providerName: local-path
storageClassConfigName: local-path
providers:
- name: local-path
storageClassConfig:
- name: local-path
strategy: HelmAddon
nfd:
strategy: HelmAddon
encryptionAtRest:
Expand Down
9 changes: 9 additions & 0 deletions examples/capi-quick-start/docker-cluster-cilium-crs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ spec:
cni:
provider: Cilium
strategy: ClusterResourceSet
csi:
defaultStorage:
providerName: local-path
storageClassConfigName: local-path
providers:
- name: local-path
storageClassConfig:
- name: local-path
strategy: HelmAddon
nfd:
strategy: ClusterResourceSet
encryptionAtRest:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ spec:
cni:
provider: Cilium
strategy: HelmAddon
csi:
defaultStorage:
providerName: local-path
storageClassConfigName: local-path
providers:
- name: local-path
storageClassConfig:
- name: local-path
strategy: HelmAddon
nfd:
strategy: HelmAddon
encryptionAtRest:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2023 Nutanix. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

metadata:
name: local-path-provisioner

namespace: kube-system

helmCharts:
- name: local-path-provisioner
repo: https://charts.containeroo.ch
releaseName: local-path-provisioner
version: ${LOCAL_PATH_CSI_CHART_VERSION}
includeCRDs: true
skipTests: true
namespace: kube-system
3 changes: 3 additions & 0 deletions hack/examples/bases/docker/cluster/kustomization.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ patches:
- target:
kind: Cluster
path: ../../../patches/cluster-autoscaler.yaml
- target:
kind: Cluster
path: ../../../patches/docker/csi.yaml
- target:
kind: Cluster
path: ../../../patches/encryption.yaml
14 changes: 14 additions & 0 deletions hack/examples/patches/docker/csi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2024 Nutanix. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

- op: "add"
path: "/spec/topology/variables/0/value/addons/csi"
value:
defaultStorage:
providerName: local-path
storageClassConfigName: local-path
providers:
- name: local-path
storageClassConfig:
- name: local-path
strategy: HelmAddon
1 change: 1 addition & 0 deletions make/addons.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export AWS_CSI_SNAPSHOT_CONTROLLER_VERSION := v6.3.3
export AWS_EBS_CSI_CHART_VERSION := v2.28.1
export NUTANIX_STORAGE_CSI_CHART_VERSION := v3.0.0-beta.1912
export NUTANIX_SNAPSHOT_CSI_CHART_VERSION := v6.3.2
export LOCAL_PATH_CSI_CHART_VERSION := v0.0.29
# a map of AWS CCM versions
export AWS_CCM_VERSION_127 := v1.27.1
export AWS_CCM_CHART_VERSION_127 := 0.0.8
Expand Down
17 changes: 9 additions & 8 deletions pkg/handlers/generic/lifecycle/config/cm.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ import (
type Component string

const (
Autoscaler Component = "cluster-autoscaler"
Tigera Component = "tigera-operator"
Cilium Component = "cilium"
NFD Component = "nfd"
NutanixStorageCSI Component = "nutanix-storage-csi"
NutanixSnapshotCSI Component = "nutanix-snapshot-csi"
NutanixCCM Component = "nutanix-ccm"
MetalLB Component = "metallb"
Autoscaler Component = "cluster-autoscaler"
Tigera Component = "tigera-operator"
Cilium Component = "cilium"
NFD Component = "nfd"
NutanixStorageCSI Component = "nutanix-storage-csi"
NutanixSnapshotCSI Component = "nutanix-snapshot-csi"
NutanixCCM Component = "nutanix-ccm"
MetalLB Component = "metallb"
LocalPathProvisionerCSI Component = "local-path-provisioner-csi"
)

type HelmChartGetter struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/handlers/generic/lifecycle/csi/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (c *CSIHandler) AfterControlPlaneInitialized(
c.variablePath...)
if err != nil {
if variables.IsNotFoundError(err) {
log.Info("Skipping CSI handler, the cluster does not define the CSI variable")
log.V(5).Info("Skipping CSI handler, the cluster does not define the CSI variable")
return
}
msg := "failed to read the CSI variable from the cluster"
Expand Down
Loading
Loading