pulp-operator icon indicating copy to clipboard operation
pulp-operator copied to clipboard

Missing CRD schema causes Terraform to recreate resources

Open grzleadams opened this issue 1 year ago • 0 comments

Version This issue isn't directly related to any specific version of the Operator, but we're on v1.0.0-beta.4.

Describe the bug We created our Pulp resource for the Operator using the Terraform kubernetes_manifest resource. When we made an update to spec.pulp_settings in the resource, Terraform wanted to delete and recreate the Pulp resource. It sounds like the kubernetes provider (specifically, the kubernetes_manifest resource) will do this when x-kubernetes-preserve-unknown-fields is set to true (as it is in pulps.repo-manager.pulpproject.org) and a schema is not provided.

To Reproduce Steps to reproduce the behavior:

  1. Deploy a Pulp instance via the Operator by creating a kubernetes_manifest resource using the Terraform provider.
  2. Update spec.pulp_settings.
  3. Do a terraform apply and watch it try to delete and recreate the resource.

Expected behavior The resource should update in place.

Additional context Obviously I worked around this by just updating the Pulp spec with kubectl, but this is kind of a bummer. Was using x-kubernetes-preserve-unknown-fields a conscious choice? I'm also not sure if updating in-place vs. deleting and recreating matters... I suspect it would depend on the storage class (and whether the PVs get auto-cleaned or not). I'm a little afraid to try it and find out.

grzleadams avatar May 03 '24 20:05 grzleadams