Repository navigation
feat!: removed deprecated SDK fields and bridges - #5615
Conversation
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
β Deploy Preview for zarf-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
dwertent
left a comment
There was a problem hiding this comment.
I left a few comments, I hope I didn't miss anything.
The only "blocker" from my pov is the deprecated agentTLS config write
| } | ||
|
|
||
| if s != nil { | ||
| s.Reconcile() |
There was a problem hiding this comment.
No familiar with the code, but this looks like a behavior change.
There was a problem hiding this comment.
A side affect of removing the agentTLS and nodeport fields on state. Now that there are no bridges, there's nothing to reconcile.
|
|
||
| s := &state.State{} | ||
| err = json.Unmarshal(secret.Data[state.ZarfStateDataKey], s) | ||
| // Keep the pre-v0.85 agent fields at the read boundary; saves use only state.State. |
There was a problem hiding this comment.
I believe there is a good reason not to remove this deprecated part.
Maybe we should comment why it's not being removed now.
Also, for future reference maybe it's worth documenting the deprecated fields, e.g.
// Deprecated: AgentInfo is deprecated as of v0.85 and will be removed in a future release.
// Use state.AgentInfo directly instead.
AgentInfo *state.AgentInfo `json:"agentInfo"`
// Deprecated: AgentTLS is maintained only for backwards compatibility with pre-v0.85 states.
AgentTLS pki.GeneratedPKI `json:"agentTLS"`
// Deprecated: AgentTLSUserProvided is no longer used internally.
AgentTLSUserProvided bool `json:"agentTLSUserProvided"`
// Deprecated: AgentMutationPolicy will be removed in the next major version.
AgentMutationPolicy state.MutationPolicy `json:"agentMutationPolicy"`
There was a problem hiding this comment.
Essentially my stance here is that if someone upgrades to v1.0, then they shouldn't downgrade back to pre-v1.0 (in this case v0.84.0 which was before we introduced the struct to replace the agent config). This would be consistent with the stance I'm taking in #5619. Open to being more conservative. Curious on @brandtkeller's thoughts on this approach.
There was a problem hiding this comment.
Agree - we need to be noisy about v1.0.0 and compatibility - but I would advocate for the same.
| s.GitServer.GitServerMode = state.GitServerModeInternal | ||
| } else { | ||
| s.RegistryInfo.RegistryMode = state.RegistryModeExternal | ||
| s.GitServer.GitServerMode = state.GitServerModeExternal |
There was a problem hiding this comment.
I just want to make sure this change (renaming RegistryInfo to GitServer) is intentional
There was a problem hiding this comment.
Yup, essentially we're deleting a bridge that has been around for a long time (for registry info) and adding one for git server info for a field that was introduced, but did not have it.
This lets us decouple the address from whether the git server is internal in case in the future we are to ever change the address.
| // strLevels maps a string to its Level. | ||
| var strLevels = map[string]Level{ | ||
| // NOTE(mkcp): Map trace to debug for backwards compatibility. | ||
| "trace": Debug, |
There was a problem hiding this comment.
It's good to see this is removed :)
| tPrinter.Writer = writer | ||
| } | ||
| _ = tPrinter.WithHasHeader().WithData(table).Render() //nolint:errcheck | ||
| _ = pterm.DefaultTable.WithWriter(writer).WithHasHeader().WithData(table).Render() //nolint:errcheck // Table output is best effort, matching the other message printers. |
There was a problem hiding this comment.
Thanks for adding the comment
| } | ||
|
|
||
| func (c remoteReferenceCache) load(ctx context.Context, importURL, arch string, remoteOptions types.RemoteOptions, cachePath string) (loadedComponentConfig, error) { | ||
| remote, err := zoci.NewRemoteWithOptions(ctx, importURL, ocispec.Platform{Architecture: arch}, zoci.RemoteClientOptions{ |
There was a problem hiding this comment.
It's probably too late for this comment, but it's interesting that we didn't create a package for v1beta1 and instead we are just adding that as a suffix to the file name.
There was a problem hiding this comment.
It should be doable in the future, the functions regarding the specific v1beta1 import process are private with a few helper exceptions
|
|
||
| func (r configDecoderRegistry) Decoder(format string) (viper.Decoder, error) { | ||
| switch strings.ToLower(format) { | ||
| case "yaml", "yml", "toml": |
There was a problem hiding this comment.
I don't think this is needed, if the file has the wrong format, viper will fail and print that the format is not supported.
There was a problem hiding this comment.
We are intentionally limiting the formats that we support to yaml and toml whereas by default viper supports things like .env and .json. I did just realize that our help text forzarf dev generate-config is off though.
| // AgentInfo contains information Zarf uses to configure the agent. | ||
| AgentInfo AgentInfo `json:"agentInfo"` | ||
| // Deprecated: Use AgentInfo.TLS instead. Kept for backwards compatibility with state JSON written by older Zarf versions. | ||
| AgentTLS pki.GeneratedPKI `json:"agentTLS"` |
There was a problem hiding this comment.
ok, now I see the deprecated agent config.
I think we should leave it here with omitempty and deprecated comment and not add it in the code the way we have (#5615 (comment)).
| require.Equal(t, expectedIDs[i], component.Name) | ||
| } | ||
|
|
||
| // Deprecated signing flags remain compatible with this publish flow. |
There was a problem hiding this comment.
It looks like we changed the comment but the flags remain the same
There was a problem hiding this comment.
We now are signing through zarf package sign instead of zarf package publish (signing through publish is deprecated)
|
|
||
| var sha string | ||
| // shas for package published 2023-08-08T22:13:51Z | ||
| // Digests for dos-games 1.3.0, published January 26, 2026. |
There was a problem hiding this comment.
nit: A link to the run that published rather than the date.
Future work/suggestion: maybe we should have a WF once a week/month whatever bumping the packages and publishing a new image (and then overriding the image here), this way, users who have CVE related policies in there clusters can install the demo without problems.
There was a problem hiding this comment.
The run logs are long expired https://github.com/zarf-dev/zarf/actions/runs/21369659860/job/61510621383 π
There was a problem hiding this comment.
The point of this particular test is to make sure that old Zarf packages work with newer Zarf (hence me having to update this, we actually broke compat with 2023 packages in this PR). But yeah we probably shouldn't use a small user facing example for this test, and instead have a big package that relies on every feature of Zarf so we actually test all the features of the schema / layout.
But yeah a weekly update of our examples would be great, we do not update them nearly enough rn
brandtkeller
left a comment
There was a problem hiding this comment.
neat to see and well executed - lgtm
Description
The v1.0 release gives us an opportunity to remove deprecated sdk fields.
Removed old state fields. Kept a bridge for reading old agent fields which have been replaced by an
AgentInfostruct in v0.85.0, but removed the fields from state.Added an automatic entry to GitServerMode which was introduced in v0.87.0 (should have already had this).
This also removes compatibility with older packages that have a different format. Packages created in v0.50.0 (March 20, 2025) are no longer compatible. (Crane->Oras annotations).
Removed some exported functions that are unused in Zarf and unlikely to be used by SDK consumers
I missed a few deprecated flags in an earlier PR:
--output-directoryflag on create which was replaced by--output--signing-keyflags fromzarf package publishfor skeletons, but changed that stance since I realized that they can be signed usingzarf package signChecklist before merging