GoogleCloudPlatform / k8s-config-connector

GCP Config Connector, a Kubernetes add-on for managing GCP resources
https://cloud.google.com/config-connector/docs/overview
Apache License 2.0
865 stars 202 forks source link

RHEL images on an instance result in Update call failed: cannot make changes to immutable field(s): [bootDisk.0.InitializeParams.0.Image] error #682

Open dfellmeth-google opened 2 years ago

dfellmeth-google commented 2 years ago

A simple ComputeInstance yaml with all rhel-sap-cloud images I have tested result in the same error after kubectl apply -f instance.yaml from kubectl describe computeinstances:

  Warning  UpdateFailed  3s (x3 over 9s)  computeinstance-controller  Update call failed: cannot make changes to immutable field(s): [bootDisk.0.InitializeParams.0.Image]
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeInstance
metadata:
  name: image-bug
spec:
  machineType: n1-highmem-32
  zone: us-central1-a
  bootDisk:
    initializeParams:
      type: pd-balanced
      size: 50
      sourceImageRef:
        external: rhel-sap-cloud/rhel-8-4-sap-ha
  networkInterface:
  - networkRef:
      external: default
jcanseco commented 1 year ago

I think this is the result of unfortunate defaulting by the GCE API (i.e. the GCE API takes the value of the field spec.bootDisk.initializeParams.sourceImageRef.external and changes it to something else).

It seems you can avoid the issue by specifying a more specific image instead, like projects/rhel-sap-cloud/global/images/rhel-8-4-sap-v20220719.

Would doing that work you for in the interim? It's unfortunately non-ideal, though it's not immediately obvious to me right now what a correct fix for this would be.

dfellmeth-google commented 1 year ago

Yes that does work, and other image families work fine, just the rhel-sap-cloud ones have this particular problem. For example if I specify suse-sap-cloud/sles-15-sp4-sap the error does not occur

jcanseco commented 1 year ago

Great, thanks for confirming.

For example if I specify suse-sap-cloud/sles-15-sp4-sap the error does not occur

And thank you; this is good info to know.