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

[release-1.24] fix: create private endpoint failure when vnetResourceGroup is specified #1529

Merged

Conversation

andyzhangx
Copy link
Member

What type of PR is this?

/kind bug

What this PR does / why we need it:

fix: create private endpoint failure when vnetResourceGroup is specified in azure file storage class

cherrypick of #1528

this PR adds a new parameter vnetResourceGroup into getSubnet func, if vnetResourceGroup is provided, then use it, otherwise use vnetResourceGroup from cloud provider config which keeps the same logic

related config and error msg
  apiVersion: storage.k8s.io/v1
  kind: StorageClass
  metadata:
    name: my-azurefile
  mountOptions:
  - dir_mode=0777
  - file_mode=0777
  - uid=0
  - gid=0
  - mfsymlinks
  - cache=strict
  - actimeo=30
  - nobrl
  parameters:
    networkEndpointType: privateEndpoint
    skuName: Premium_LRS
    subnetName: default
    vnetName: my-vnet  # this is the name of the private vnet created on step 3
    vnetResourceGroup: aks-ds-rg
  provisioner: file.csi.azure.com
  reclaimPolicy: Delete
  volumeBindingMode: Immediate
I0726 13:12:03.775852       1 utils.go:77] GRPC call: /csi.v1.Controller/CreateVolume
 
I0726 13:12:03.775883       1 utils.go:78] GRPC request: {"capacity_range":{"required_bytes":10737418240},"name":"pvc-9ac5081e-1483-4a9c-9915-e21ea222e53d","parameters":{"csi.storage.k8s.io/pv/name":"pvc-9ac5081e-1483-4a9c-9915-e21ea222e53d","csi.storage.k8s.io/pvc/name":"my-azurefile","csi.storage.k8s.io/pvc/namespace":"default","networkEndpointType":"privateEndpoint","skuName":"Premium_LRS","subnetName":"default","vnetName":"my-vnet","vnetResourceGroup":"aks-ds-rg"},"volume_capabilities":[{"AccessType":{"Mount":{"mount_flags":["dir_mode=0777","file_mode=0777","uid=0","gid=0","mfsymlinks","cache=strict","actimeo=30","nobrl"]}},"access_mode":{"mode":5}}]}
 
I0726 13:12:04.313940       1 azure_storageaccount.go:413] azure - no matching account found, begin to create a new account yyy in resource group MC_aks-ds-rg_aks-test_australiacentral, location: australiacentral, accountType: Premium_LRS, accountKind: FileStorage, tags: map[k8s-azure-created-by:azure]
 
I0726 13:12:04.313999       1 azure_storageaccount.go:438] set AllowBlobPublicAccess(false) for storage account(yyy)
 
I0726 13:12:04.313940       1 azure_storageaccount.go:413] azure - no matching account found, begin to create a new account yyy in resource group MC_aks-ds-rg_aks-test_australiacentral, location: australiacentral, accountType: Premium_LRS, accountKind: FileStorage, tags: map[k8s-azure-created-by:azure]
 
I0726 13:12:04.313999       1 azure_storageaccount.go:438] set AllowBlobPublicAccess(false) for storage account(yyy)
 
I0726 13:12:30.176409       1 azure_storageaccount.go:583] Creating private endpoint(yyy-pvtendpoint) for account (yyy)
 
I0726 13:12:30.248922       1 azure_subnetclient.go:135] Received error in subnet.get.request: resourceID: /subscriptions/xxx/resourceGroups/MC_aks-ds-rg_aks-test_australiacentral/providers/Microsoft.Network/virtualNetworks/my-vnet/subnets/default, error: Retriable: false, RetryAfter: 0s, HTTPStatusCode: 404, RawError: {"error":{"code":"ResourceNotFound","message":"The Resource 'Microsoft.Network/virtualNetworks/my-vnet' under resource group 'MC_aks-ds-rg_aks-test_australiacentral' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix"}}
 
I0726 13:12:30.249020       1 azure_subnet_repo.go:65] Subnet "default" not found
 
E0726 13:12:30.249040       1 azure_storageaccount.go:590] SubnetPropertiesFormat of (my-vnet, default) is nil
 
I0726 13:12:30.450263       1 azure_armclient.go:302] Received error in sendAsync.send: resourceID: http://localhost:7788/subscriptions/xxx/resourceGroups/aks-ds-rg/providers/Microsoft.Network/virtualNetworks/my-vnet/subnets/default?api-version=2022-07-01, error: Retriable: false, RetryAfter: 0s, HTTPStatusCode: 400, RawError: {
 
  "error": {
 
    "code": "AddressPrefixStringCannotBeNullOrEmpty",
 
    "message": "Address prefix string for resource /subscriptions/xxx/resourceGroups/aks-ds-rg/providers/Microsoft.Network/virtualNetworks/my-vnet/subnets/default cannot be null or empty.",
 
    "details": []
 
  }

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

fix: subnet update issue when vnetResourceGroup is specified in azure file storage class

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

fix: subnet update issue when vnetResourceGroup is specified in azure file storage class

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 1, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andyzhangx

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

The pull request process is described 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

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 1, 2024
@andyzhangx
Copy link
Member Author

/retest

@andyzhangx andyzhangx merged commit 79501bc into kubernetes-sigs:release-1.24 Aug 2, 2024
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants