Skip to content

Conversation

@mozesl-nokia
Copy link
Contributor

Some additional changes we have made to the SDK in out Porch fork. Most of these changes will be used by the async render pipeline in Porch, so it would be nice to get them in ahead of time.

Please note some API changes, such as the renaming of fn.NewKptfileFromPackage to kptfile.NewFromPackage or that in the KubeObject wrapping Kptfile struct, the inner KubeObject is now anonymous. (We can discuss if these should be reverted)

Co-developed by @kispaljr and @dgyorgy-nokia

)

// Kptfile provides an API to manipulate the Kptfile of a kpt package
type Kptfile struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should try to move to a clearer name here. The mix of KptFile across the 2 repos is confusing.
I was thinking maybe something like:

PackageMetadata

It clarifies that the sdk works with the KptFile metadata only. (No "file" operations) and ties in with the kpt/krm package idea.
Would this be a major breaking change? I think it would be worth it to remove any confusion for end users.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, but I think the name should indicate that this is just a wrapper around KubeObject with Kptfile specific methods.

Would KptfileKubeObject be too long?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess so, on the KubeObject Wrapper. Ye the name is applicable to the whole pkg really so not sure. go/fn/kptfileko/
Whatever make sense to the reader really.

Copy link
Contributor

Choose a reason for hiding this comment

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

I know it's a pretty blunt metric but do we have any test coverage for the new code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added some unit tests, is 75.1% good enough for now?

Copy link
Contributor

Choose a reason for hiding this comment

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

Absolutely.

// If the function already exists, it is updated. If it doesn't exist, it is added at the specified position.
// If insertPosition is negative, the insert position is counted backwards from the end of the list
// (i.e. -1 will append to the list).
func (kf *Kptfile) UpsertPipelineFunctions(fns []kptfileapi.Function, fieldName string, insertPosition int) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice. I needed this a while back to insert a fn at a specific point in the pipeline. Thanks for adding it.

@efiacor efiacor added the go Pull requests that update Go code label Jan 26, 2026
mozesl-nokia and others added 2 commits January 28, 2026 11:58
Co-authored-by: kispaljr <istvan.kispal@nokia.com>
Co-authored-by: dgyorgy-nokia <daniel.gyorgy@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
@efiacor
Copy link
Contributor

efiacor commented Jan 28, 2026

Might have missed a sign-off on last commit @mozesl-nokia

Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
@liamfallon liamfallon merged commit ad2bf70 into kptdev:master Jan 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants