Skip to content

Conversation

@jiangzho
Copy link
Contributor

What changes were proposed in this pull request?

This PR fixes the logic to patch ownerReference on pre-resources for application. It would decorate the proposed spec instead of created resource with generated fields.

Why are the changes needed?

At initialization phase, operator would request pre-resources for driver first, then apply the owner references on these resources with created driver pod uid.

The latter patching is currently failing as it's decorating on created resource (which have managed fields set).

Message: metadata.managedFields must be nil.

... when using the Apply operation you cannot define managedFields in the body of the request that you submit.

https://kubernetes.io/docs/reference/using-api/server-side-apply/

The patch body shall not include generated managedFields .

Does this PR introduce any user-facing change?

No

How was this patch tested?

Unit tests added

Was this patch authored or co-authored using generative AI tooling?

No

…r Resources

### What changes were proposed in this pull request?

This PR fixes the logic to patch ownerReference on pre-resources for application. It would decorate the proposed spec instead of created resource with generated fields.

### Why are the changes needed?

At initialization phase, operator would request pre-resources for driver first, then apply the owner references on these resources with created driver pod uid.

The latter patching is currently failing as it's decorating on created resource (which have managed fields set).

```
Message: metadata.managedFields must be nil.
```

> ... when using the Apply operation you cannot define managedFields in the body of the request that you submit.

https://kubernetes.io/docs/reference/using-api/server-side-apply/

The patch body shall not include generated `managedFields` .

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

Unit tests added

### Was this patch authored or co-authored using generative AI tooling?

No
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM. Thank you, @jiangzho .
Merged to main.

@jiangzho jiangzho deleted the cleanup branch May 17, 2025 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants