puppetlabs / puppetlabs-azure_arm

The Puppet Azure ARM Module
Apache License 2.0
4 stars 16 forks source link

UnmarshalError upon creating aks cluster #22

Open jandunk opened 5 years ago

jandunk commented 5 years ago

I'm trying to deploy an aks cluster but it fails upon creation.

Describe the Bug

Cluster does not get created and an error is thrown:

[root@vm51 manifests]# puppet agent -t Info: Retrieving pluginfacts Info: Retrieving plugin Info: Caching catalog for vm51.xxx.local Info: Applying configuration version '1566684169' Info: Calling operation ManagedClusters_List Info: Getting oauth2 token Info: Authentication succeeded Info: Called (Get) endpoint at https://management.azure.com/subscriptions/xxx/providers/Microsoft.ContainerService/managedClusters?api-version=2018-03-31, success was true Info: Checking if resource puppet-k8s-mc of type exists, returning Info: Entered create for resource puppet-k8s-mc of type ManagedCluster Info: Calling operation ManagedClusters_CreateOrUpdate Info: Getting oauth2 token Info: Authentication succeeded Info: Called (Put) endpoint at https://management.azure.com/subscriptions/xxx/resourceGroups/puppet-k8s-rg/providers/Microsoft.ContainerService/managedClusters/puppet-k8s-mc?api-version=2018-03-31, success was false Alert: Exception during create. The state of the resource is unknown. ex is Create failed. Response is # and body is { "code": "UnmarshalError", "message": "UnmarshalEntity encountered error: json: cannot unmarshal string into Go struct field Properties.agentPoolProfiles of type v20180331.AgentPoolProfile." } and backtrace is ["/var/lib/puppet/lib/puppet/provider/azure_managed_cluster/azure_managed_cluster.rb:147:in create'", "/usr/share/ruby/vendor_ruby/puppet/property/ensure.rb:16:inblock in defaultvalues'", "/usr/share/ruby/vendor_ruby/puppet/property.rb:197:in call_valuemethod'", "/usr/share/ruby/vendor_ruby/puppet/property.rb:498:inset'", "/usr/share/ruby/vendor_ruby/puppet/property.rb:581:in sync'", "/usr/share/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:204:insync'", "/usr/share/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:128:in sync_if_needed'", "/usr/share/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:81:inperform_changes'", "/usr/share/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:20:in evaluate'", "/usr/share/ruby/vendor_ruby/puppet/transaction.rb:204:inapply'", "/usr/share/ruby/vendor_ruby/puppet/transaction.rb:217:in eval_resource'", "/usr/share/ruby/vendor_ruby/puppet/transaction.rb:147:incall'", "/usr/share/ruby/vendor_ruby/puppet/transaction.rb:147:in block (2 levels) in evaluate'", "/usr/share/ruby/vendor_ruby/puppet/util.rb:335:inblock in thinmark'", "/usr/share/ruby/benchmark.rb:296:in realtime'", "/usr/share/ruby/vendor_ruby/puppet/util.rb:334:inthinmark'", "/usr/share/ruby/vendor_ruby/puppet/transaction.rb:147:in block in evaluate'", "/usr/share/ruby/vendor_ruby/puppet/graph/relationship_graph.rb:118:intraverse'", "/usr/share/ruby/vendor_ruby/puppet/transaction.rb:138:in evaluate'", "/usr/share/ruby/vendor_ruby/puppet/resource/catalog.rb:169:inblock in apply'", "/usr/share/ruby/vendor_ruby/puppet/util/log.rb:149:in with_destination'", "/usr/share/ruby/vendor_ruby/puppet/transaction/report.rb:112:inas_logging_destination'", "/usr/share/ruby/vendor_ruby/puppet/resource/catalog.rb:168:in apply'", "/usr/share/ruby/vendor_ruby/puppet/configurer.rb:120:inblock in apply_catalog'", "/usr/share/ruby/vendor_ruby/puppet/util.rb:161:in block in benchmark'", "/usr/share/ruby/benchmark.rb:296:inrealtime'", "/usr/share/ruby/vendor_ruby/puppet/util.rb:160:in benchmark'", "/usr/share/ruby/vendor_ruby/puppet/configurer.rb:119:inapply_catalog'", "/usr/share/ruby/vendor_ruby/puppet/configurer.rb:227:in run_internal'", "/usr/share/ruby/vendor_ruby/puppet/configurer.rb:134:inblock in run'", "/usr/share/ruby/vendor_ruby/puppet/context.rb:64:in override'", "/usr/share/ruby/vendor_ruby/puppet.rb:246:inoverride'", "/usr/share/ruby/vendor_ruby/puppet/configurer.rb:133:in run'", "/usr/share/ruby/vendor_ruby/puppet/agent.rb:47:inblock (4 levels) in run'", "/usr/share/ruby/vendor_ruby/puppet/agent/locker.rb:20:in lock'", "/usr/share/ruby/vendor_ruby/puppet/agent.rb:47:inblock (3 levels) in run'", "/usr/share/ruby/vendor_ruby/puppet/agent.rb:117:in with_client'", "/usr/share/ruby/vendor_ruby/puppet/agent.rb:44:inblock (2 levels) in run'", "/usr/share/ruby/vendor_ruby/puppet/agent.rb:82:in run_in_fork'", "/usr/share/ruby/vendor_ruby/puppet/agent.rb:43:inblock in run'", "/usr/share/ruby/vendor_ruby/puppet/application.rb:179:in call'", "/usr/share/ruby/vendor_ruby/puppet/application.rb:179:incontrolled_run'", "/usr/share/ruby/vendor_ruby/puppet/agent.rb:41:in run'", "/usr/share/ruby/vendor_ruby/puppet/application/agent.rb:361:inonetime'", "/usr/share/ruby/vendor_ruby/puppet/application/agent.rb:327:in run_command'", "/usr/share/ruby/vendor_ruby/puppet/application.rb:381:inblock (2 levels) in run'", "/usr/share/ruby/vendor_ruby/puppet/application.rb:507:in plugin_hook'", "/usr/share/ruby/vendor_ruby/puppet/application.rb:381:inblock in run'", "/usr/share/ruby/vendor_ruby/puppet/util.rb:496:in exit_on_fail'", "/usr/share/ruby/vendor_ruby/puppet/application.rb:381:inrun'", "/usr/share/ruby/vendor_ruby/puppet/util/command_line.rb:146:in run'", "/usr/share/ruby/vendor_ruby/puppet/util/command_line.rb:92:inexecute'", "/usr/bin/puppet:8:in `

'"] Error: Create failed. Response is # and body is { "code": "UnmarshalError", "message": "UnmarshalEntity encountered error: json: cannot unmarshal string into Go struct field Properties.agentPoolProfiles of type v20180331.AgentPoolProfile." } Error: /Stage[main]/Main/Node[vm51.xxx.local]/Azure_managed_cluster[puppet-k8s-mc]/ensure: change from absent to present failed: Create failed. Response is # and body is { "code": "UnmarshalError", "message": "UnmarshalEntity encountered error: json: cannot unmarshal string into Go struct field Properties.agentPoolProfiles of type v20180331.AgentPoolProfile." } Info: Calling operation ResourceGroups_List Info: Getting oauth2 token Info: Authentication succeeded Info: Called (Get) endpoint at https://management.azure.com/subscriptions/xxxx/resourcegroups?api-version=2018-05-01, success was true Info: Checking if resource puppet-k8s-rg of type exists, returning true

I have defined Properties.agentPoolProfiles without quotes in my manifest file but somehow it is not parsed as an integer.

Expected Behavior

Cluster gets created.

Steps to Reproduce

puppet agent -t

Environment

  • Version [3.8.7]
  • Platform [CentOS 7.6]

Additional Context

node 'vm51.xxxx.local' {

file {'/etc/motd': content => 'test test ',

}

$base_name = 'puppet-k8s' $rg = "${base_name}-rg" $location = 'uksouth' $mc = "${base_name}-mc" $client_id = 'xxx' $subscription_id = 'xxx' $secret_id = 'xxxx'

azure_resource_group { $rg: ensure => present, parameters => {}, location => $location }

azure_managed_cluster { $mc: ensure => present, location => $location, resource_group_name => $rg, resource_name => $mc, parameters => {}, properties => { kubernetesVersion => '1.14.6', dnsPrefix => $mc, agentPoolProfiles =>[ name => 'agentpool', count => Integer[1], vmSize => 'Standard_B2s', storageProfile => 'ManagedDisks', maxPods => 110, osType => 'Linux' ], servicePrincipalProfile => { clientId => $client_id, secret => $secret_id }, addonProfiles => { httpApplicationRouting => { enabled => true, }, omsagent => { enabled => true, config => { logAnalyticsWorkspaceResourceID => "/subscriptions/${subscription_id}/resourcegroups/defaultresourcegroup-suk/providers/microsoft.operationalinsights/workspaces/defaultworkspace-${subscription_id}-suk" #lint:ignore:140chars } } }, enableRBAC => false, networkProfile => { networkPlugin => 'kubenet', } }, }

}

jandunk commented 5 years ago

Sorry pasted the wrong file value is defined like so: count => 1,

jandunk commented 5 years ago

and wrong error:

Alert: Exception during create. The state of the resource is unknown. ex is Create failed. Response is # and body is { "code": "UnmarshalError", "message": "UnmarshalEntity encountered error: json: cannot unmarshal string into Go struct field AgentPoolProfile.count of type int." } and backtrace is ["/var/lib/puppet/lib/puppet/provider/azure_managed_cluster/azure_managed_cluster.rb:147:in create'", "/usr/share/ruby/vendor_ruby/puppet/property/ensure.rb:16:inblock in defaultvalues'", "/usr/share/ruby/vendor_ruby/puppet/property.rb:197:in call_valuemethod'", "/usr/share/ruby/vendor_ruby/puppet/property.rb:498:inset'", "/usr/share/ruby/vendor_ruby/puppet/property.rb:581:in sync'", "/usr/share/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:204:insync'", "/usr/share/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:128:in sync_if_needed'", "/usr/share/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:81:inperform_changes'", "/usr/share/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:20:in evaluate'", "/usr/share/ruby/vendor_ruby/puppet/transaction.rb:204:inapply'", "/usr/share/ruby/vendor_ruby/puppet/transaction.rb:217:in eval_resource'", "/usr/share/ruby/vendor_ruby/puppet/transaction.rb:147:incall'", "/usr/share/ruby/vendor_ruby/puppet/transaction.rb:147:in block (2 levels) in evaluate'", "/usr/share/ruby/vendor_ruby/puppet/util.rb:335:inblock in thinmark'", "/usr/share/ruby/benchmark.rb:296:in realtime'", "/usr/share/ruby/vendor_ruby/puppet/util.rb:334:inthinmark'", "/usr/share/ruby/vendor_ruby/puppet/transaction.rb:147:in block in evaluate'", "/usr/share/ruby/vendor_ruby/puppet/graph/relationship_graph.rb:118:intraverse'", "/usr/share/ruby/vendor_ruby/puppet/transaction.rb:138:in evaluate'", "/usr/share/ruby/vendor_ruby/puppet/resource/catalog.rb:169:inblock in apply'", "/usr/share/ruby/vendor_ruby/puppet/util/log.rb:149:in with_destination'", "/usr/share/ruby/vendor_ruby/puppet/transaction/report.rb:112:inas_logging_destination'", "/usr/share/ruby/vendor_ruby/puppet/resource/catalog.rb:168:in apply'", "/usr/share/ruby/vendor_ruby/puppet/configurer.rb:120:inblock in apply_catalog'", "/usr/share/ruby/vendor_ruby/puppet/util.rb:161:in block in benchmark'", "/usr/share/ruby/benchmark.rb:296:inrealtime'", "/usr/share/ruby/vendor_ruby/puppet/util.rb:160:in benchmark'", "/usr/share/ruby/vendor_ruby/puppet/configurer.rb:119:inapply_catalog'", "/usr/share/ruby/vendor_ruby/puppet/configurer.rb:227:in run_internal'", "/usr/share/ruby/vendor_ruby/puppet/configurer.rb:134:inblock in run'", "/usr/share/ruby/vendor_ruby/puppet/context.rb:64:in override'", "/usr/share/ruby/vendor_ruby/puppet.rb:246:inoverride'", "/usr/share/ruby/vendor_ruby/puppet/configurer.rb:133:in run'", "/usr/share/ruby/vendor_ruby/puppet/agent.rb:47:inblock (4 levels) in run'", "/usr/share/ruby/vendor_ruby/puppet/agent/locker.rb:20:in lock'", "/usr/share/ruby/vendor_ruby/puppet/agent.rb:47:inblock (3 levels) in run'", "/usr/share/ruby/vendor_ruby/puppet/agent.rb:117:in with_client'", "/usr/share/ruby/vendor_ruby/puppet/agent.rb:44:inblock (2 levels) in run'", "/usr/share/ruby/vendor_ruby/puppet/agent.rb:82:in run_in_fork'", "/usr/share/ruby/vendor_ruby/puppet/agent.rb:43:inblock in run'", "/usr/share/ruby/vendor_ruby/puppet/application.rb:179:in call'", "/usr/share/ruby/vendor_ruby/puppet/application.rb:179:incontrolled_run'", "/usr/share/ruby/vendor_ruby/puppet/agent.rb:41:in run'", "/usr/share/ruby/vendor_ruby/puppet/application/agent.rb:361:inonetime'", "/usr/share/ruby/vendor_ruby/puppet/application/agent.rb:327:in run_command'", "/usr/share/ruby/vendor_ruby/puppet/application.rb:381:inblock (2 levels) in run'", "/usr/share/ruby/vendor_ruby/puppet/application.rb:507:in plugin_hook'", "/usr/share/ruby/vendor_ruby/puppet/application.rb:381:inblock in run'", "/usr/share/ruby/vendor_ruby/puppet/util.rb:496:in exit_on_fail'", "/usr/share/ruby/vendor_ruby/puppet/application.rb:381:inrun'", "/usr/share/ruby/vendor_ruby/puppet/util/command_line.rb:146:in run'", "/usr/share/ruby/vendor_ruby/puppet/util/command_line.rb:92:inexecute'", "/usr/bin/puppet:8:in `

'"] Error: Create failed. Response is # and body is { "code": "UnmarshalError", "message": "UnmarshalEntity encountered error: json: cannot unmarshal string into Go struct field AgentPoolProfile.count of type int." } Error: /Stage[main]/Main/Node[vm51.dunk.local]/Azure_managed_cluster[puppet-k8s-mc]/ensure: change from absent to present failed: Create failed. Response is # and body is { "code": "UnmarshalError", "message": "UnmarshalEntity encountered error: json: cannot unmarshal string into Go struct field AgentPoolProfile.count of type int." }

renu418 commented 3 years ago

facing same issue, earlier it was working but today it isn't. I tried converting the count into int, still it gives same error