GoogleCloudPlatform / GoogleCloudPlatform/deploymentmanager-samples

Ref in Instance Template errors with CYCLIC_REFERENCES

Open
#670 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jinja
Stars
951
Forks
700
PR merge metrics
No merged PRs in 30d

Description

When 'updating' a deployment that contains an instant template similar to your:

https://github.com/GoogleCloudPlatform/deploymentmanager-samples/tree/master/examples/v2/igm-updater

If the instance template contains references:

ex.
https://github.com/alexapplebaum/deploymentmanager-samples/tree/cyclic/community/full-stack-autoscale-vm

https://github.com/alexapplebaum/deploymentmanager-samples/blob/cyclic/community/full-stack-autoscale-vm/parent/parent.py#L56

Rendered Config:
```
networkInterfaces:
- accessConfigs:
- name: Management NAT
type: ONE_TO_ONE_NAT
network: $(ref.mycyclic-network0.selfLink)
subnetwork: $(ref.mycyclic-mgmt1.selfLink)

```

It errors out with:
```
$ gcloud deployment-manager deployments update myparent --config parent-2.yaml
The fingerprint of the deployment is b'OrC90UgOl7yY-lGlOMt_yA=='
Waiting for update [operation-1628281354059-5c8e9cbb3fd70-4ceff8f4-ae04ad50]...failed.
ERROR: (gcloud.deployment-manager.deployments.update) Error in Operation [operation-1628281354059-5c8e9cbb3fd70-4ceff8f4-ae04ad50]: errors:
- code: CYCLIC_REFERENCES
message: |
A cycle was found during reference analysis:
Detected cycle:
mycyclic-network0 <- myparent-it-v-1 <- myparent-igm <- myparent-it-v-2

```

NOTE: The igm-updater example mentioned has networks hardcoded. If you hardcode the networks as strings instead, the deployment manager can update the deployment just fine. However, we would obviously like to leverage references for benefits mentioned here:

https://cloud.google.com/deployment-manager/docs/configuration/use-references

1) To avoid parallel deployments and create the dependency graph.
2) Make dynamic per inputs
3) etc.

NOTE: First deployment works fine with the references. It is only the Update process (in order to toggle the instance template to trigger a rolling update as per the igm updater example) but updating is required lifecycle functionality.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.