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

Fix PluginV1 fields backward compatibility #41944

Merged
merged 3 commits into from
May 27, 2024

Conversation

smallinsky
Copy link
Contributor

@smallinsky smallinsky commented May 23, 2024

What

Fix feature UnmarshalPlugin compatibility

Extending plugin struct

When a new plugin or new field is added to the PluginV1 struct:

--- a/api/proto/teleport/legacy/types/types.proto
+++ b/api/proto/teleport/legacy/types/types.proto
@@ -5934,6 +5934,8 @@ message PluginOktaSettings {
+
+  bool EnableFeatureX = 5;
 }

the UnmarshalPlugin will marshal proto to the following JSON object:

{
  "kind": "plugin",
  "version": "v1",
   "spec": {
    "okta": {
       "enableFeatureX": true
    }
  },
  }
}

and the plugin will be successfully installed.

Downgrading Teleport Version

When Teleport is downgraded, the marshal function will fail with an unknown field error, producing a lot of periodic noise, and will not start the plugin, breaking backward compatibility.

This will also occurs when a new plugin type is added to PluginSpecV1

To fix that the AllowUnknownFields: true needs to be set.

@smallinsky smallinsky requested review from r0mant and tcsc May 23, 2024 13:21
Copy link

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

6 similar comments
Copy link

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

Copy link

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

Copy link

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

Copy link

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

Copy link

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

Copy link

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

@smallinsky smallinsky added no-changelog Indicates that a PR does not require a changelog entry backport/branch/v14 backport/branch/v15 labels May 23, 2024
Copy link
Collaborator

@r0mant r0mant left a comment

Choose a reason for hiding this comment

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

Can you add a test for this?

@smallinsky smallinsky force-pushed the smallinsky/fix_plugin_fields_backward_compability branch 3 times, most recently from d60052e to dd7f0d0 Compare May 23, 2024 17:14
@smallinsky smallinsky force-pushed the smallinsky/fix_plugin_fields_backward_compability branch from dd7f0d0 to bdb5920 Compare May 23, 2024 17:16
@smallinsky smallinsky added this pull request to the merge queue May 24, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 24, 2024
@smallinsky smallinsky added this pull request to the merge queue May 27, 2024
Merged via the queue into master with commit f28c4aa May 27, 2024
38 checks passed
@smallinsky smallinsky deleted the smallinsky/fix_plugin_fields_backward_compability branch May 27, 2024 09:27
@public-teleport-github-review-bot

@smallinsky See the table below for backport results.

Branch Result
branch/v14 Create PR
branch/v15 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/branch/v14 backport/branch/v15 no-changelog Indicates that a PR does not require a changelog entry size/sm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants