diff --git a/charts/internal/shoot-system-components/charts/csi-driver-efs/templates/controller-deployment.yaml b/charts/internal/shoot-system-components/charts/csi-driver-efs/templates/controller-deployment.yaml index 10807cede..e61ee2ac5 100644 --- a/charts/internal/shoot-system-components/charts/csi-driver-efs/templates/controller-deployment.yaml +++ b/charts/internal/shoot-system-components/charts/csi-driver-efs/templates/controller-deployment.yaml @@ -73,8 +73,6 @@ spec: valueFrom: fieldRef: fieldPath: spec.nodeName - - name: AWS_REGION - value: {{ .Values.region }} volumeMounts: - name: socket-dir mountPath: /var/lib/csi/sockets/pluginproxy/ diff --git a/charts/internal/shoot-system-components/charts/csi-driver-efs/templates/storageclass.yaml b/charts/internal/shoot-system-components/charts/csi-driver-efs/templates/storageclass.yaml index 52cba1a3f..adb598127 100644 --- a/charts/internal/shoot-system-components/charts/csi-driver-efs/templates/storageclass.yaml +++ b/charts/internal/shoot-system-components/charts/csi-driver-efs/templates/storageclass.yaml @@ -1,26 +1,9 @@ -{{- range .Values.storageClasses }} kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: - name: {{ .name }} - {{- with .annotations }} - annotations: - {{ toYaml . | indent 4 }} - {{- end }} + name: efs-sc provisioner: efs.csi.aws.com - {{- with .mountOptions }} -mountOptions: - {{ toYaml . }} - {{- end }} - {{- with .parameters }} parameters: - {{ toYaml . | indent 2 }} - {{- end }} - {{- with .reclaimPolicy }} -reclaimPolicy: {{ . }} - {{- end }} - {{- with .volumeBindingMode }} -volumeBindingMode: {{ . }} - {{- end }} ---- -{{- end }} \ No newline at end of file + provisioningMode: efs-ap # only one currently available + fileSystemId: {{ .Values.fileSystemID }} + directoryPerms: "700" \ No newline at end of file diff --git a/charts/internal/shoot-system-components/charts/csi-driver-efs/values.yaml b/charts/internal/shoot-system-components/charts/csi-driver-efs/values.yaml index 2f2096e46..d7df986e8 100644 --- a/charts/internal/shoot-system-components/charts/csi-driver-efs/values.yaml +++ b/charts/internal/shoot-system-components/charts/csi-driver-efs/values.yaml @@ -1,6 +1,4 @@ -# Default values for aws-efs-csi-driver. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. +fileSystemID: "" nameOverride: "" fullnameOverride: "" diff --git a/hack/api-reference/api.md b/hack/api-reference/api.md index 112e70f70..ef8cc0c35 100644 --- a/hack/api-reference/api.md +++ b/hack/api-reference/api.md @@ -408,6 +408,36 @@ reconciliation is possible.

+

CSI +

+

+(Appears on: +InfrastructureStatus) +

+

+

CSI contains information about the created AWS CSI related resources.

+

+ + + + + + + + + + + + + +
FieldDescription
+efsFileSystemID
+ +string + +
+

EfsSystemID contains the efsFileSystem.

+

CloudControllerManagerConfig

@@ -829,6 +859,19 @@ VPCStatus

VPC contains information about the created AWS VPC and some related resources.

+ + +csi
+ + +CSI + + + + +

CSI contains information about the created AWS CSI related resources.

+ +

InstanceMetadataOptions diff --git a/pkg/apis/aws/types_infrastructure.go b/pkg/apis/aws/types_infrastructure.go index f6c1e8ee3..4156ec817 100644 --- a/pkg/apis/aws/types_infrastructure.go +++ b/pkg/apis/aws/types_infrastructure.go @@ -50,6 +50,8 @@ type InfrastructureStatus struct { IAM IAM // VPC contains information about the created AWS VPC and some related resources. VPC VPCStatus + // CSI contains information about the created AWS CSI related resources. + CSI CSI `json:"csi"` } // Networks holds information about the Kubernetes and infrastructure networks. @@ -121,6 +123,12 @@ type VPCStatus struct { SecurityGroups []SecurityGroup } +// CSI contains information about the created AWS CSI related resources. +type CSI struct { + // EfsSystemID contains the efsFileSystem. + EfsSystemID string +} + const ( // PurposeNodes is a constant describing that the respective resource is used for nodes. PurposeNodes string = "nodes" diff --git a/pkg/apis/aws/v1alpha1/types_infrastructure.go b/pkg/apis/aws/v1alpha1/types_infrastructure.go index 566099471..7f699c94c 100644 --- a/pkg/apis/aws/v1alpha1/types_infrastructure.go +++ b/pkg/apis/aws/v1alpha1/types_infrastructure.go @@ -53,6 +53,8 @@ type InfrastructureStatus struct { IAM IAM `json:"iam"` // VPC contains information about the created AWS VPC and some related resources. VPC VPCStatus `json:"vpc"` + // CSI contains information about the created AWS CSI related resources. + CSI CSI `json:"csi"` } // Networks holds information about the Kubernetes and infrastructure networks. @@ -130,6 +132,12 @@ type VPCStatus struct { SecurityGroups []SecurityGroup `json:"securityGroups"` } +// CSI contains information about the created AWS CSI related resources. +type CSI struct { + // EfsSystemID contains the efsFileSystem. + EfsSystemID string `json:"efsFileSystemID"` +} + const ( // PurposeNodes is a constant describing that the respective resource is used for nodes. PurposeNodes string = "nodes" diff --git a/pkg/apis/aws/v1alpha1/zz_generated.conversion.go b/pkg/apis/aws/v1alpha1/zz_generated.conversion.go index b78ff5fb1..4cda7077e 100644 --- a/pkg/apis/aws/v1alpha1/zz_generated.conversion.go +++ b/pkg/apis/aws/v1alpha1/zz_generated.conversion.go @@ -25,6 +25,16 @@ func init() { // RegisterConversions adds conversion functions to the given scheme. // Public to allow building arbitrary schemes. func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*CSI)(nil), (*aws.CSI)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_CSI_To_aws_CSI(a.(*CSI), b.(*aws.CSI), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*aws.CSI)(nil), (*CSI)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_aws_CSI_To_v1alpha1_CSI(a.(*aws.CSI), b.(*CSI), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*CloudControllerManagerConfig)(nil), (*aws.CloudControllerManagerConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_CloudControllerManagerConfig_To_aws_CloudControllerManagerConfig(a.(*CloudControllerManagerConfig), b.(*aws.CloudControllerManagerConfig), scope) }); err != nil { @@ -338,6 +348,26 @@ func RegisterConversions(s *runtime.Scheme) error { return nil } +func autoConvert_v1alpha1_CSI_To_aws_CSI(in *CSI, out *aws.CSI, s conversion.Scope) error { + out.EfsSystemID = in.EfsSystemID + return nil +} + +// Convert_v1alpha1_CSI_To_aws_CSI is an autogenerated conversion function. +func Convert_v1alpha1_CSI_To_aws_CSI(in *CSI, out *aws.CSI, s conversion.Scope) error { + return autoConvert_v1alpha1_CSI_To_aws_CSI(in, out, s) +} + +func autoConvert_aws_CSI_To_v1alpha1_CSI(in *aws.CSI, out *CSI, s conversion.Scope) error { + out.EfsSystemID = in.EfsSystemID + return nil +} + +// Convert_aws_CSI_To_v1alpha1_CSI is an autogenerated conversion function. +func Convert_aws_CSI_To_v1alpha1_CSI(in *aws.CSI, out *CSI, s conversion.Scope) error { + return autoConvert_aws_CSI_To_v1alpha1_CSI(in, out, s) +} + func autoConvert_v1alpha1_CloudControllerManagerConfig_To_aws_CloudControllerManagerConfig(in *CloudControllerManagerConfig, out *aws.CloudControllerManagerConfig, s conversion.Scope) error { out.FeatureGates = *(*map[string]bool)(unsafe.Pointer(&in.FeatureGates)) out.UseCustomRouteController = (*bool)(unsafe.Pointer(in.UseCustomRouteController)) @@ -622,6 +652,9 @@ func autoConvert_v1alpha1_InfrastructureStatus_To_aws_InfrastructureStatus(in *I if err := Convert_v1alpha1_VPCStatus_To_aws_VPCStatus(&in.VPC, &out.VPC, s); err != nil { return err } + if err := Convert_v1alpha1_CSI_To_aws_CSI(&in.CSI, &out.CSI, s); err != nil { + return err + } return nil } @@ -640,6 +673,9 @@ func autoConvert_aws_InfrastructureStatus_To_v1alpha1_InfrastructureStatus(in *a if err := Convert_aws_VPCStatus_To_v1alpha1_VPCStatus(&in.VPC, &out.VPC, s); err != nil { return err } + if err := Convert_aws_CSI_To_v1alpha1_CSI(&in.CSI, &out.CSI, s); err != nil { + return err + } return nil } diff --git a/pkg/apis/aws/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/aws/v1alpha1/zz_generated.deepcopy.go index c222f5524..3b475de33 100644 --- a/pkg/apis/aws/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/aws/v1alpha1/zz_generated.deepcopy.go @@ -14,6 +14,22 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CSI) DeepCopyInto(out *CSI) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CSI. +func (in *CSI) DeepCopy() *CSI { + if in == nil { + return nil + } + out := new(CSI) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CloudControllerManagerConfig) DeepCopyInto(out *CloudControllerManagerConfig) { *out = *in @@ -357,6 +373,7 @@ func (in *InfrastructureStatus) DeepCopyInto(out *InfrastructureStatus) { out.EC2 = in.EC2 in.IAM.DeepCopyInto(&out.IAM) in.VPC.DeepCopyInto(&out.VPC) + out.CSI = in.CSI return } diff --git a/pkg/apis/aws/zz_generated.deepcopy.go b/pkg/apis/aws/zz_generated.deepcopy.go index b5fd696f1..38efe53bb 100644 --- a/pkg/apis/aws/zz_generated.deepcopy.go +++ b/pkg/apis/aws/zz_generated.deepcopy.go @@ -14,6 +14,22 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CSI) DeepCopyInto(out *CSI) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CSI. +func (in *CSI) DeepCopy() *CSI { + if in == nil { + return nil + } + out := new(CSI) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CloudControllerManagerConfig) DeepCopyInto(out *CloudControllerManagerConfig) { *out = *in @@ -357,6 +373,7 @@ func (in *InfrastructureStatus) DeepCopyInto(out *InfrastructureStatus) { out.EC2 = in.EC2 in.IAM.DeepCopyInto(&out.IAM) in.VPC.DeepCopyInto(&out.VPC) + out.CSI = in.CSI return } diff --git a/pkg/controller/controlplane/valuesprovider.go b/pkg/controller/controlplane/valuesprovider.go index e394d3a5b..78599f10a 100644 --- a/pkg/controller/controlplane/valuesprovider.go +++ b/pkg/controller/controlplane/valuesprovider.go @@ -421,7 +421,12 @@ func (vp *valuesProvider) GetControlPlaneShootChartValues( return nil, err } - return getControlPlaneShootChartValues(cluster, cpConfig, cp, secretsReader, infraConfig) + infraStatus, err := vp.decodeInfrastructureStatus(cp) + if err != nil { + return nil, err + } + + return getControlPlaneShootChartValues(cluster, cpConfig, cp, secretsReader, infraConfig, infraStatus) } // GetControlPlaneShootCRDsChartValues returns the values for the control plane shoot CRDs chart applied by the generic actuator. @@ -770,6 +775,7 @@ func getControlPlaneShootChartValues( cp *extensionsv1alpha1.ControlPlane, secretsReader secretsmanager.Reader, infraConfig *apisaws.InfrastructureConfig, + infraStatus *apisaws.InfrastructureStatus, ) (map[string]interface{}, error) { kubernetesVersion := cluster.Shoot.Spec.Kubernetes.Version @@ -803,7 +809,7 @@ func getControlPlaneShootChartValues( return nil, err } - csiDriverEfsValues := getControlPlaneShootChartCSIEfsValues(infraConfig) + csiDriverEfsValues := getControlPlaneShootChartCSIEfsValues(infraConfig, infraStatus) return map[string]interface{}{ aws.CloudControllerManagerName: map[string]interface{}{"enabled": true}, @@ -820,16 +826,16 @@ func isCSIEfsEnabled(infraConfig *apisaws.InfrastructureConfig) bool { func getControlPlaneShootChartCSIEfsValues( infraConfig *apisaws.InfrastructureConfig, + infraStatus *apisaws.InfrastructureStatus, ) map[string]interface{} { csiEsfEnabled := isCSIEfsEnabled(infraConfig) values := map[string]interface{}{ "enabled": csiEsfEnabled, } - //if csiManilaEnabled { - // TODO - // values["vpaEnabled"] = gardencorev1beta1helper.ShootWantsVerticalPodAutoscaler(cluster.Shoot) - //} + if csiEsfEnabled { + values["fileSystemID"] = infraStatus.CSI.EfsSystemID + } return values } diff --git a/pkg/controller/infrastructure/infraflow/context.go b/pkg/controller/infrastructure/infraflow/context.go index b043bb25a..874c5a8f0 100644 --- a/pkg/controller/infrastructure/infraflow/context.go +++ b/pkg/controller/infrastructure/infraflow/context.go @@ -212,6 +212,7 @@ func (c *FlowContext) computeInfrastructureStatus() *awsv1alpha1.InfrastructureS ec2KeyName := ptr.Deref(c.state.Get(NameKeyPair), "") iamInstanceProfileName := ptr.Deref(c.state.Get(NameIAMInstanceProfile), "") arnIAMRole := ptr.Deref(c.state.Get(ARNIAMRole), "") + efsSystemID := ptr.Deref(c.state.Get(NameEfsSystemID), "") if c.config.Networks.VPC.ID != nil { vpcID = *c.config.Networks.VPC.ID @@ -281,6 +282,10 @@ func (c *FlowContext) computeInfrastructureStatus() *awsv1alpha1.InfrastructureS } } + if efsSystemID != "" { + status.CSI.EfsSystemID = efsSystemID + } + return status }