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

Bug: asoctl-imported AKS resource has no spec.owner field #4564

Open
arsdragonfly opened this issue Feb 6, 2025 · 2 comments
Open

Bug: asoctl-imported AKS resource has no spec.owner field #4564

arsdragonfly opened this issue Feb 6, 2025 · 2 comments
Assignees
Labels
bug 🪲 Something isn't working waiting-on-user-response Waiting on more information from the original user before progressing.

Comments

@arsdragonfly
Copy link

Describe the bug

asoctl-imported AKS resource has no owner field.

Sample output:

zheyushen@DESKTOP-2VRVE78:~$ ./asoctl import azure-resource /subscriptions/02a122b3-ea01-470f-98eb-cfe7780e2b47/resourceGroups/zheyuslinkyrg/providers/microsoft.containerservice/managedClusters/zheyuslinky2
16:39:03 INF Imported kind=ManagedCluster.containerservice.azure.com name=zheyuslinky2
16:39:25 INF Successful imports Count=1 Group=containerservice.azure.com Kind=ManagedCluster
---
apiVersion: containerservice.azure.com/v1api20240901
kind: ManagedCluster
metadata:
  creationTimestamp: null
  name: zheyuslinky2
spec:
  addonProfiles:
    azureKeyvaultSecretsProvider:
      enabled: false
    azurepolicy:
      enabled: false
    omsAgent:
      config:
        logAnalyticsWorkspaceResourceID: /subscriptions/02a122b3-ea01-470f-98eb-cfe7780e2b47/resourcegroups/DefaultResourceGroup-EUS/providers/Microsoft.OperationalInsights/workspaces/DefaultWorkspace-02a122b3-ea01-470f-98eb-cfe7780e2b47-EUS
        useAADAuth: "true"
      enabled: true
  agentPoolProfiles:
  - count: 2
    enableAutoScaling: true
    enableFIPS: false
    enableNodePublicIP: false
    kubeletDiskType: OS
    maxCount: 5
    maxPods: 110
    minCount: 2
    mode: System
    name: agentpool
    orchestratorVersion: 1.30.7
    osDiskSizeGB: 128
    osDiskType: Managed
    osSKU: Ubuntu
    osType: Linux
    powerState:
      code: Running
    securityProfile:
      enableSecureBoot: false
      enableVTPM: false
    type: VirtualMachineScaleSets
    upgradeSettings:
      maxSurge: 10%
    vmSize: Standard_D2as_v6
  autoScalerProfile:
    balance-similar-node-groups: "false"
    daemonset-eviction-for-empty-nodes: false
    daemonset-eviction-for-occupied-nodes: true
    expander: random
    ignore-daemonsets-utilization: false
    max-empty-bulk-delete: "10"
    max-graceful-termination-sec: "600"
    max-node-provision-time: 15m
    max-total-unready-percentage: "45"
    new-pod-scale-up-delay: 0s
    ok-total-unready-count: "3"
    scale-down-delay-after-add: 10m
    scale-down-delay-after-delete: 10s
    scale-down-delay-after-failure: 3m
    scale-down-unneeded-time: 10m
    scale-down-unready-time: 20m
    scale-down-utilization-threshold: "0.5"
    scan-interval: 10s
    skip-nodes-with-local-storage: "false"
    skip-nodes-with-system-pods: "true"
  autoUpgradeProfile:
    nodeOSUpgradeChannel: NodeImage
    upgradeChannel: patch
  azureMonitorProfile:
    metrics:
      enabled: true
      kubeStateMetrics:
        metricAnnotationsAllowList: ""
        metricLabelsAllowlist: ""
  azureName: zheyuslinky2
  disableLocalAccounts: false
  dnsPrefix: zheyuslinky2-dns
  enableRBAC: true
  identity:
    type: SystemAssigned
  identityProfile:
    kubeletidentity:
      clientId: 1d8cd124-7550-40d2-98da-bbc18b0d16fc
      objectId: 2c74c7a2-4673-4842-b254-74383177978c
      resourceReference:
        armId: /subscriptions/02a122b3-ea01-470f-98eb-cfe7780e2b47/resourcegroups/MC_zheyuslinkyrg_zheyuslinky2_westus3/providers/Microsoft.ManagedIdentity/userAssignedIdentities/zheyuslinky2-agentpool
  kubernetesVersion: 1.30.7
  location: westus3
  metricsProfile:
    costAnalysis:
      enabled: false
  networkProfile:
    dnsServiceIP: 10.0.0.10
    ipFamilies:
    - IPv4
    loadBalancerProfile:
      backendPoolType: NodeIPConfiguration
      effectiveOutboundIPs:
      - reference:
          armId: /subscriptions/02a122b3-ea01-470f-98eb-cfe7780e2b47/resourceGroups/MC_zheyuslinkyrg_zheyuslinky2_westus3/providers/Microsoft.Network/publicIPAddresses/6b83a45f-9dee-45b1-8b00-1e6341893be2
      managedOutboundIPs:
        count: 1
    loadBalancerSku: standard
    networkDataplane: azure
    networkPlugin: azure
    networkPluginMode: overlay
    networkPolicy: none
    outboundType: loadBalancer
    podCidr: 10.244.0.0/16
    podCidrs:
    - 10.244.0.0/16
    serviceCidr: 10.0.0.0/16
    serviceCidrs:
    - 10.0.0.0/16
  nodeResourceGroup: MC_zheyuslinkyrg_zheyuslinky2_westus3
  oidcIssuerProfile:
    enabled: true
  securityProfile:
    imageCleaner:
      enabled: true
      intervalHours: 168
    workloadIdentity:
      enabled: true
  servicePrincipalProfile:
    clientId: msi
  sku:
    name: Base
    tier: Free
  storageProfile:
    diskCSIDriver:
      enabled: true
    fileCSIDriver:
      enabled: true
    snapshotController:
      enabled: true
  supportPlan: KubernetesOfficial
  windowsProfile:
    adminUsername: azureuser
    enableCSIProxy: true
  workloadAutoScalerProfile: {}
---

Expected behavior

generated YAML should have owner field, otherwise #3270 occurs.

To Reproduce

create an AKS cluster, then try to use asoctl import azure-resource.

@arsdragonfly arsdragonfly added the bug 🪲 Something isn't working label Feb 6, 2025
@arsdragonfly arsdragonfly changed the title Bug: asoctl-imported AKS resource has no owner field Bug: asoctl-imported AKS resource has no spec.owner field Feb 6, 2025
@theunrepentantgeek
Copy link
Member

theunrepentantgeek commented Feb 9, 2025

What owner would you expect to be set on the Managed Cluster in the generated YAML file?

I haven't yet identified a suitable rule for asoctl to use that can be applied to any resource when it's imported, which is why it's currently omitted. So far, I have only a partial rule - that nested resources within the same import get owner set to that parent.

@theunrepentantgeek
Copy link
Member

@matthchr suggests we could set the owner of the top imported resource using an armId.

What do you think of this?

@theunrepentantgeek theunrepentantgeek added waiting-on-user-response Waiting on more information from the original user before progressing. and removed needs-triage 🔍 labels Feb 10, 2025
@theunrepentantgeek theunrepentantgeek self-assigned this Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working waiting-on-user-response Waiting on more information from the original user before progressing.
Projects
Development

No branches or pull requests

2 participants