Skip to content

Commit

Permalink
Merge pull request #2086 from ConnorJC3/controller-topology-standard-…
Browse files Browse the repository at this point in the history
…label

Migrate CreateVolume response topology to standard label topology.kubernetes.io/zone
  • Loading branch information
k8s-ci-robot authored Jul 19, 2024
2 parents 2c4937a + 959ede9 commit c1c6641
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 32 deletions.
2 changes: 1 addition & 1 deletion examples/kubernetes/static-provisioning/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This example shows you how to create and consume a `PersistentVolume` from an ex
required:
nodeSelectorTerms:
- matchExpressions:
- key: topology.ebs.csi.aws.com/zone
- key: topology.kubernetes.io/zone
operator: In
values:
- {availability zone}
Expand Down
4 changes: 2 additions & 2 deletions examples/kubernetes/static-provisioning/manifests/pv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
required:
nodeSelectorTerms:
- matchExpressions:
- key: topology.ebs.csi.aws.com/zone
- key: topology.kubernetes.io/zone
operator: In
values:
- us-east-2c
- us-east-2c
4 changes: 2 additions & 2 deletions examples/kubernetes/storageclass/manifests/storageclass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ parameters:
encrypted: "true"
allowedTopologies:
- matchLabelExpressions:
- key: topology.ebs.csi.aws.com/zone
- key: topology.kubernetes.io/zone
values:
- us-east-2c
- us-east-2c
2 changes: 1 addition & 1 deletion pkg/driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ func newCreateVolumeResponse(disk *cloud.Disk, ctx map[string]string) *csi.Creat
}
}

segments := map[string]string{ZoneTopologyKey: disk.AvailabilityZone}
segments := map[string]string{WellKnownZoneTopologyKey: disk.AvailabilityZone}

arn, err := arn.Parse(disk.OutpostArn)

Expand Down
48 changes: 24 additions & 24 deletions pkg/driver/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ func TestCreateVolume(t *testing.T) {
Requisite: []*csi.Topology{
{
Segments: map[string]string{
ZoneTopologyKey: expZone,
AwsAccountIDKey: outpostArn.AccountID,
AwsOutpostIDKey: outpostArn.Resource,
AwsRegionKey: outpostArn.Region,
AwsPartitionKey: outpostArn.Partition,
WellKnownZoneTopologyKey: expZone,
AwsAccountIDKey: outpostArn.AccountID,
AwsOutpostIDKey: outpostArn.Resource,
AwsRegionKey: outpostArn.Region,
AwsPartitionKey: outpostArn.Partition,
},
},
},
Expand All @@ -164,11 +164,11 @@ func TestCreateVolume(t *testing.T) {
AccessibleTopology: []*csi.Topology{
{
Segments: map[string]string{
ZoneTopologyKey: expZone,
AwsAccountIDKey: outpostArn.AccountID,
AwsOutpostIDKey: outpostArn.Resource,
AwsRegionKey: outpostArn.Region,
AwsPartitionKey: outpostArn.Partition,
WellKnownZoneTopologyKey: expZone,
AwsAccountIDKey: outpostArn.AccountID,
AwsOutpostIDKey: outpostArn.Resource,
AwsRegionKey: outpostArn.Region,
AwsPartitionKey: outpostArn.Partition,
},
},
},
Expand Down Expand Up @@ -1232,7 +1232,7 @@ func TestCreateVolume(t *testing.T) {
AccessibilityRequirements: &csi.TopologyRequirement{
Requisite: []*csi.Topology{
{
Segments: map[string]string{ZoneTopologyKey: expZone},
Segments: map[string]string{WellKnownZoneTopologyKey: expZone},
},
},
},
Expand All @@ -1245,7 +1245,7 @@ func TestCreateVolume(t *testing.T) {
AccessibilityRequirements: &csi.TopologyRequirement{
Requisite: []*csi.Topology{
{
Segments: map[string]string{ZoneTopologyKey: expZone},
Segments: map[string]string{WellKnownZoneTopologyKey: expZone},
},
},
},
Expand All @@ -1256,7 +1256,7 @@ func TestCreateVolume(t *testing.T) {
VolumeContext: map[string]string{},
AccessibleTopology: []*csi.Topology{
{
Segments: map[string]string{ZoneTopologyKey: expZone},
Segments: map[string]string{WellKnownZoneTopologyKey: expZone},
},
},
}
Expand Down Expand Up @@ -2084,17 +2084,17 @@ func TestGetOutpostArn(t *testing.T) {
requirement: &csi.TopologyRequirement{
Requisite: []*csi.Topology{
{
Segments: map[string]string{ZoneTopologyKey: expZone},
Segments: map[string]string{WellKnownZoneTopologyKey: expZone},
},
},
Preferred: []*csi.Topology{
{
Segments: map[string]string{
ZoneTopologyKey: expZone,
AwsAccountIDKey: outpostArn.AccountID,
AwsOutpostIDKey: outpostArn.Resource,
AwsRegionKey: outpostArn.Region,
AwsPartitionKey: outpostArn.Partition,
WellKnownZoneTopologyKey: expZone,
AwsAccountIDKey: outpostArn.AccountID,
AwsOutpostIDKey: outpostArn.Resource,
AwsRegionKey: outpostArn.Region,
AwsPartitionKey: outpostArn.Partition,
},
},
},
Expand All @@ -2108,11 +2108,11 @@ func TestGetOutpostArn(t *testing.T) {
Requisite: []*csi.Topology{
{
Segments: map[string]string{
ZoneTopologyKey: expZone,
AwsAccountIDKey: outpostArn.AccountID,
AwsOutpostIDKey: outpostArn.Resource,
AwsRegionKey: outpostArn.Region,
AwsPartitionKey: outpostArn.Partition,
WellKnownZoneTopologyKey: expZone,
AwsAccountIDKey: outpostArn.AccountID,
AwsOutpostIDKey: outpostArn.Resource,
AwsRegionKey: outpostArn.Region,
AwsPartitionKey: outpostArn.Partition,
},
},
},
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/driver/ebs_csi_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ func (d *ebsCSIDriver) GetDynamicProvisionStorageClass(parameters map[string]str
{
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
{
// TODO we should use the new topology key eventually
Key: ebscsidriver.ZoneTopologyKey,
Key: ebscsidriver.WellKnownZoneTopologyKey,
Values: allowedTopologyValues,
},
},
Expand Down

0 comments on commit c1c6641

Please sign in to comment.