Hello I had an issue here and couldn't find the so...
# general
f
Hello I had an issue here and couldn't find the solution on the documentation I created a
gcp.container.NodePool
with
Copy code
management=gcp.container.NodePoolManagementArgs(
        auto_repair=False,
        auto_upgrade=False
)
But I got an error
**creating failed**
* error creating NodePool: googleapi: Error 400: Auto_upgrade and auto_repair cannot be false when release_channel STABLE is set., badRequest
Then I deleted the management and tried to
pulumi up
again but I get the error
* googleapi: Error 404: Not found: node pool "dev-preemptible-nodes-8d7b054" not found., notFound
Pulumi didn't create the NodePool and now it is trying to update. How can I force to retry the creation ?
I'm using v3.3.1, Python3.8, and local state
l
You can
pulumi state delete
the resource from Pulumi's local state.
You can use
pulumi stack --show-urns
to find the URN to use with
pulumi state delete
.
1
Did you delete the management using the GCP console? If a resource is managed in Pulumi, it's almost always best to manage it via code. To force a deletion, you can comment out the code and run
pulumi up
.
f
That worked
I didn't delete. It was never created because google API returned 400. I started learning pulumi today so I'm not sure this is was supposed to happen or not. First I tried to create but pulumi failed so I would expect that my node pool would not be added to the state. Was that a bug or is it normal do happen ?
l
I've never known a resource to be created in state and not in the provider... if an error is returned, then Pulumi handles it correctly, for me..
Is it possible that Pulumi created multiple provider resources from the one Pulumi resource? Or that GCP created more than one resource? Unfortunately the devs are having a staff vacation today, so the experts probably won't see this question until tomorrow..
f
Thanks for the help I will leave the code here in case anyone wants to see in the future.
Copy code
from pulumi import Config, export, Output
from pulumi_gcp.config import project, zone
from pulumi_kubernetes import Provider
import pulumi_gcp as gcp


config = Config(None)
NODE_COUNT = config.get_int('node_count') or 1
NODE_MACHINE_TYPE = config.get('node_machine_type') or 'n1-standard-1'
# MASTER_VERSION = config.get('master_version')
REGION = config.get('region') or 'us-east1'
LOCATION = config.get('location') or 'us-east1-b'
PROJECT = config.get('project') or 'calm-hologram-315323'

dev_network = gcp.compute.Network(
    "dev-network",
    auto_create_subnetworks=False
)
dev_subnetwork = gcp.compute.Subnetwork(
    "dev-subnetwork",
    region=REGION,
    network=dev_network.name,
    ip_cidr_range="10.2.0.0/16",
    secondary_ip_ranges=[
        gcp.compute.SubnetworkSecondaryIpRangeArgs(
            range_name    = "services-range",
            ip_cidr_range = "192.168.1.0/24"
        ),
        gcp.compute.SubnetworkSecondaryIpRangeArgs(
            range_name    = "pod-ranges",
            ip_cidr_range = "192.168.64.0/22"
        )
    ]
)

default = gcp.serviceaccount.Account("default-account",
    account_id="dev-service-account-id",
    display_name="Dev GKE Service Account",
    project=PROJECT
)

dev_cluster = gcp.container.Cluster("dev",
    location=LOCATION,
    project=PROJECT,
    remove_default_node_pool=True,
    initial_node_count=1,
    release_channel=gcp.container.ClusterReleaseChannelArgs(
        channel='STABLE'
    ),
    network=dev_network.name,
    subnetwork=dev_subnetwork.name,
    ip_allocation_policy=gcp.container.ClusterIpAllocationPolicyArgs(
        cluster_secondary_range_name=dev_subnetwork.secondary_ip_ranges[0].range_name,
        services_secondary_range_name=dev_subnetwork.secondary_ip_ranges[1].range_name
    )
)

dev_preemptible_nodes = gcp.container.NodePool("dev-preemptible-nodes",
    location=LOCATION,
    cluster=dev_cluster.name,
    autoscaling=gcp.container.NodePoolAutoscalingArgs(
        min_node_count=0,
        max_node_count=6
    ),
    management=gcp.container.NodePoolManagementArgs(
        auto_repair=False,
        auto_upgrade=False
    ),
    node_config=gcp.container.NodePoolNodeConfigArgs(
        disk_size_gb=30,
        preemptible=True,
        disk_type='pd-ssd',
        image_type='UBUNTU_CONTAINERD',
        machine_type=NODE_MACHINE_TYPE,
        metadata={
            "disable-legacy-endpoints": True
        },
        service_account=default.email,
        oauth_scopes=["<https://www.googleapis.com/auth/cloud-platform>"],
    )
)
To reproduce you need to run, wait for the update to break, comment line 65 and run again