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

add azure disk modifier #5958

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

handlerww
Copy link
Contributor

@handlerww handlerww commented Nov 25, 2024

What problem does this PR solve?

This PR introduces the Azure Disk Modifier. As of Kubernetes 1.31, the VolumeModifyClass feature remains in beta and is not enabled by default on Azure. As a workaround, we have implemented the Azure Disk Modifier by drawing inspiration from this project's AWS disk modifier implementation. This enhancement allows for disk modification capabilities on Azure, aligning with the existing functionality available for AWS.

This feature will use the kubelet identity of AKS, you should grant kubelet identity permission to modify the disk.

What is changed and how does it work?

Code changes

  • Has Go code change
  • Has CI related scripts change

Tests

  • Unit test
  • E2E test
  • Manual test
  • No code

Side effects

  • Breaking backward compatibility
  • Other side effects:

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Release Notes

Please refer to Release Notes Language Style Guide before writing the release note.


Manual test

kubectl create -f - <<EOF
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
   name: premium2-4000-1000
parameters:
   cachingMode: None
   skuName: PremiumV2_LRS
   DiskIOPSReadWrite: "4000"
   DiskMBpsReadWrite: "1000"
provisioner: disk.csi.azure.com
reclaimPolicy: Delete
volumeBindingMode: Immediate
allowVolumeExpansion: true
EOF
kubectl create -f - <<EOF
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
   name: premium2-4000-800
parameters:
   cachingMode: None
   skuName: PremiumV2_LRS
   DiskIOPSReadWrite: "4000"
   DiskMBpsReadWrite: "800"
provisioner: disk.csi.azure.com
reclaimPolicy: Delete
volumeBindingMode: Immediate
allowVolumeExpansion: true
EOF
kubectl apply -f - <<EOF
apiVersion: pingcap.com/v1alpha1
kind: TidbCluster
metadata:
  name: basic
  namespace: tidb-cluster
spec:
  version: v8.1.0
  timezone: UTC
  pvReclaimPolicy: Delete
  enableDynamicConfiguration: true
  configUpdateStrategy: RollingUpdate
  discovery: {}
  helper:
    image: alpine:3.16.0
  pd:
    baseImage: pingcap/pd
    maxFailoverCount: 0
    replicas: 1
    storageClassName: premium2-4000-1000
    requests:
      storage: "10Gi"
    config: {}
  tikv:
    baseImage: pingcap/tikv
    maxFailoverCount: 0
    evictLeaderTimeout: 1m
    replicas: 1
    storageClassName: premium2-4000-1000
    requests:
      storage: "10Gi"
    config:
      storage:
        reserve-space: "0MB"
      rocksdb:
        max-open-files: 256
      raftdb:
        max-open-files: 256
  tidb:
    baseImage: pingcap/tidb
    maxFailoverCount: 0
    replicas: 1
    service:
      type: ClusterIP
    config: {}
EOF

Modify the storage request and storage class name, then on Azure portal the disk properties changed as expected.

Copy link
Contributor

ti-chi-bot bot commented Nov 25, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from handlerww, ensuring that each of them provides their approval before proceeding. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the size/XXL label Nov 25, 2024
@handlerww handlerww force-pushed the handlerww/azure-disk-modifier branch 2 times, most recently from c74cf4f to b58b0fa Compare November 26, 2024 07:29
@codecov-commenter
Copy link

codecov-commenter commented Nov 26, 2024

Codecov Report

Attention: Patch coverage is 56.08466% with 83 lines in your changes missing coverage. Please review.

Project coverage is 56.98%. Comparing base (a16b2e8) to head (3cdbac0).
Report is 9 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5958      +/-   ##
==========================================
- Coverage   57.19%   56.98%   -0.21%     
==========================================
  Files         259      260       +1     
  Lines       33233    45024   +11791     
==========================================
+ Hits        19008    25658    +6650     
- Misses      12291    17382    +5091     
- Partials     1934     1984      +50     
Flag Coverage Δ
unittest 56.98% <56.08%> (-0.21%) ⬇️

@handlerww handlerww marked this pull request as ready for review November 26, 2024 07:50
Comment on lines +11 to +13
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute v1.0.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a newer version for these modules? then it can reduce the bump in the future.

Comment on lines +285 to +286
diskName = parts[len(parts)-1]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to check extract if len(parts) = 9 above, or should we use strings.SplitN hear?

Comment on lines +295 to +298
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
return fmt.Errorf("failed to obtain a credential: %v", err)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the behavior without an Azure config? can we do the same check as we did for AWS in dependences.go?

Comment on lines +64 to +65
IsCompleted bool
IsFailed bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these statuses exist for Azure?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants