Skip to content

Commit

Permalink
Add efsSystemID to infrastatus
Browse files Browse the repository at this point in the history
  • Loading branch information
hebelsan committed Oct 2, 2024
1 parent 7cc4774 commit 6f8663e
Show file tree
Hide file tree
Showing 11 changed files with 151 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
Original file line number Diff line number Diff line change
@@ -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 }}
provisioningMode: efs-ap # only one currently available
fileSystemId: {{ .Values.fileSystemID }}
directoryPerms: "700"
Original file line number Diff line number Diff line change
@@ -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: ""
Expand Down
43 changes: 43 additions & 0 deletions hack/api-reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,36 @@ reconciliation is possible.</p>
</tr>
</tbody>
</table>
<h3 id="aws.provider.extensions.gardener.cloud/v1alpha1.CSI">CSI
</h3>
<p>
(<em>Appears on:</em>
<a href="#aws.provider.extensions.gardener.cloud/v1alpha1.InfrastructureStatus">InfrastructureStatus</a>)
</p>
<p>
<p>CSI contains information about the created AWS CSI related resources.</p>
</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>efsFileSystemID</code></br>
<em>
string
</em>
</td>
<td>
<p>EfsSystemID contains the efsFileSystem.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="aws.provider.extensions.gardener.cloud/v1alpha1.CloudControllerManagerConfig">CloudControllerManagerConfig
</h3>
<p>
Expand Down Expand Up @@ -829,6 +859,19 @@ VPCStatus
<p>VPC contains information about the created AWS VPC and some related resources.</p>
</td>
</tr>
<tr>
<td>
<code>csi</code></br>
<em>
<a href="#aws.provider.extensions.gardener.cloud/v1alpha1.CSI">
CSI
</a>
</em>
</td>
<td>
<p>CSI contains information about the created AWS CSI related resources.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="aws.provider.extensions.gardener.cloud/v1alpha1.InstanceMetadataOptions">InstanceMetadataOptions
Expand Down
8 changes: 8 additions & 0 deletions pkg/apis/aws/types_infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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"
Expand Down
8 changes: 8 additions & 0 deletions pkg/apis/aws/v1alpha1/types_infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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"
Expand Down
36 changes: 36 additions & 0 deletions pkg/apis/aws/v1alpha1/zz_generated.conversion.go

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

17 changes: 17 additions & 0 deletions pkg/apis/aws/v1alpha1/zz_generated.deepcopy.go

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

17 changes: 17 additions & 0 deletions pkg/apis/aws/zz_generated.deepcopy.go

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

18 changes: 12 additions & 6 deletions pkg/controller/controlplane/valuesprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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},
Expand All @@ -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
}
5 changes: 5 additions & 0 deletions pkg/controller/infrastructure/infraflow/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -281,6 +282,10 @@ func (c *FlowContext) computeInfrastructureStatus() *awsv1alpha1.InfrastructureS
}
}

if efsSystemID != "" {
status.CSI.EfsSystemID = efsSystemID
}

return status
}

Expand Down

0 comments on commit 6f8663e

Please sign in to comment.