Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ank CLI set state fails when providing a new state containing only the changed field values #397

Closed
inf17101 opened this issue Oct 21, 2024 · 4 comments
Assignees
Labels
bug Something isn't working. Issue will appear in the change log "Bug Fixes" ignore-for-release
Milestone

Comments

@inf17101
Copy link
Contributor

inf17101 commented Oct 21, 2024

In the user documentation the ank set state command providing a new state with only the changed fields (e.g., restartPolicy) fails with:

  • missing field agent
  • missing field runtimeConfig
  • missing field runtime
  • missing field apiVersion

This is in the section Working with CompleteState.

Currently, providing only the changed field like restartPolicy (like in the user doc example) is not possible:

desiredState:
  workloads:
    nginx:
      restartPolicy: NEVER

The command of the user doc fails: ank -k set state desiredState.workloads.nginx.restartPolicy new-state.yaml

It complains about missing fields and apiVersion. The apiVersion is obviously missing, but it shall be possible to provide only the changed fields when providing the correct update mask afterwards without providing agent, runtimeConfig and runtime if the workload already exists.

Current Behavior

The Ank CLI set state command does not accept minimum required information for the new state.

Expected Behavior

Ank CLI shall support providing only the changed field values if the workload exists in the desiredState.

Steps to Reproduce

Execute the Working With CompleteState section's set state command with changing the restartPolicy field on the current main branch. It fails.

Context (Environment)

Logs

Example error message:

error: Failed to set state: 'Could not serialize YAML object: 'missing field `agent`''

Additional Information

The error is thrown from the ank cli: ank/src/cli_error.rs which has to do with the serde_yaml parsing:

CliError::YamlSerialization(message) => {
    write!(f, "Could not serialize YAML object: '{message}'")
}

Potentially related PRs from the past: #340, #383

Final result

To be filled by the one closing the issue.

@inf17101 inf17101 added the bug Something isn't working. Issue will appear in the change log "Bug Fixes" label Oct 21, 2024
@krucod3
Copy link
Contributor

krucod3 commented Oct 21, 2024

According to @inf17101, this was working correctly in v0.4.1, so it's an unreleased regression on main => ignore for release + v0.5.0

@krucod3 krucod3 added this to the v0.5 milestone Oct 21, 2024
@HorjuRares
Copy link
Contributor

I can also tackle this one.

@krucod3
Copy link
Contributor

krucod3 commented Nov 12, 2024

The regression is fixed, but we still to fix the real problem.
@HorjuRares, please link the new issue here. We will take care of it in the next release.

@krucod3 krucod3 closed this as completed Nov 12, 2024
@HorjuRares
Copy link
Contributor

The follow-up for this issue can be found in: #414

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working. Issue will appear in the change log "Bug Fixes" ignore-for-release
Projects
None yet
Development

No branches or pull requests

3 participants