Skip to content

feat: Stabilize ResourceGroup API to v1 with backward compatibility#4467

Open
NETIZEN-11 wants to merge 22 commits intokptdev:mainfrom
NETIZEN-11:feat/issue-4450-pr3-api-types
Open

feat: Stabilize ResourceGroup API to v1 with backward compatibility#4467
NETIZEN-11 wants to merge 22 commits intokptdev:mainfrom
NETIZEN-11:feat/issue-4450-pr3-api-types

Conversation

@NETIZEN-11
Copy link
Copy Markdown

Description

This PR introduces the stable v1 API for ResourceGroup while maintaining full backward compatibility with v1alpha1. It marks v1alpha1 as deprecated and provides a clear migration path for users.

Part of #4450 - Stabilize kpt API to version 1

Changes Made

New Stable v1 API

  1. pkg/api/resourcegroup/v1/types.go

    • Introduces stable v1 ResourceGroup type
    • Defines ResourceGroupGVK() function for GroupVersionKind
    • Maintains consistent API structure with v1alpha1
    • Includes constants for file naming and inventory labels
    • Follows Kubernetes API conventions
  2. pkg/api/resourcegroup/v1/doc.go

    • Package documentation for v1 API
    • Declares API stability guarantees
    • Includes kubebuilder annotations
    • Documents semantic versioning commitment

Deprecation of v1alpha1

  1. pkg/api/resourcegroup/v1alpha1/types.go
    • Marked package as deprecated
    • Added deprecation notices to all exported types and functions
    • Provides migration path to v1 API
    • Maintains full functionality for backward compatibility
    • Will be removed in v2.0.0

API Stability Guarantees

The v1 API provides the following guarantees:

  • No breaking changes within v1.x.x versions
  • Backward compatible additions only
  • Deprecated features will be supported until v2.0.0
  • Clear migration path for all changes

Migration Path

Users can migrate from v1alpha1 to v1 by updating imports:

// Before (v1alpha1)
import "github.com/kptdev/kpt/pkg/api/resourcegroup/v1alpha1"

// After (v1)
import "github.com/kptdev/kpt/pkg/api/resourcegroup/v1"

aravindtga and others added 20 commits April 1, 2026 20:57
* Add status.conditions to show the renderstatus to Kptfile

Signed-off-by: aravind.est <aravindhan.a@est.tech>

* Address copilot and dosubot comments

Signed-off-by: aravind.est <aravindhan.a@est.tech>

---------

Signed-off-by: aravind.est <aravindhan.a@est.tech>
Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
…nctions

- Upgrade sigs.k8s.io/kustomize/api from v0.20.1 to v0.21.0
- Upgrade sigs.k8s.io/kustomize/kyaml from v0.20.1 to v0.21.0
- Upgrade k8s.io/api from v0.34.1 to v0.35.0
- Upgrade k8s.io/apimachinery from v0.34.1 to v0.35.0
- Upgrade k8s.io/kubectl from v0.34.1 to v0.35.0
- Upgrade github.com/kptdev/krm-functions-catalog/functions/go/apply-setters from v0.2.2 to v0.2.4
- Update catalog function registry to reference new apply-setters version
- Run go mod tidy to resolve transitive dependencies

Resolves GitHub Issue kptdev#4406

All catalog functions remain compatible with new APIs - zero breaking changes encountered.
Zero compilation errors and zero failing tests across repository.

Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
…nctions

- Upgrade sigs.k8s.io/kustomize/api from v0.20.1 to v0.21.0
- Upgrade sigs.k8s.io/kustomize/kyaml from v0.20.1 to v0.21.0
- Upgrade k8s.io/api from v0.34.1 to v0.35.0
- Upgrade k8s.io/apimachinery from v0.34.1 to v0.35.0
- Upgrade k8s.io/kubectl from v0.34.1 to v0.35.0
- Upgrade github.com/kptdev/krm-functions-catalog/functions/go/apply-setters from v0.2.2 to v0.2.4
- Update catalog function registry to reference new apply-setters version
- Run go mod tidy to resolve transitive dependencies

Resolves GitHub Issue kptdev#4406

All catalog functions remain compatible with new APIs - zero breaking changes encountered.
Zero compilation errors and zero failing tests across repository.

Signed-off-by: NETIZEN-11 <nitesh@example.com>
Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
- Add new RenderStatus and PipelineStepResult structs as per GitHub issue kptdev#4390
- Clearly separate mutation pipeline steps from validation steps
- Capture execution failures (network errors, missing images, command failures)
- Record stderr and exit codes for each pipeline step
- Extract and categorize error results from function results
- Aggregate all failures into comprehensive ErrorSummary
- Update pipeline execution logic to populate detailed step results
- Maintain backward compatibility with existing Rendered conditions
- Add comprehensive unit tests for new functionality
- Fix JSON tags and serialization issues

This addresses the problems with the current schema:
- Difficult troubleshooting → Clear step-by-step execution details
- Unclear error reporting → Structured error information with aggregation
- Inability to represent execution failures → Detailed execution error capture
- Confusing result structure → Clean separation of mutation/validation steps

Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
…ng issues

- Add Windows build constraints to exclude wasmtime support
- Fix linting issues: spelling, unused parameters, unused functions
- Use errors.New for static error strings
- Remove unused setRenderCondition function

This resolves the failing CI checks for docker and podman builds.

Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
- Update k8s.io/apiextensions-apiserver from v0.34.1 to v0.35.0
- Add yaml tags to RenderStatus, PipelineStepResult, and ResultItem structs
- Fix result classification logic to use severity instead of ExitCode
- Fix YAML test input to use proper multiline format
- Run go mod tidy to normalize dependencies

All changes maintain Go formatting and project coding style.

Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
…subpackages

- Add isRootKptfile() helper function for robust root detection
- Enhance pkgContextResource() to generate package-context.yaml only for root packages
- Subpackages are now correctly suppressed to prevent duplicate ConfigMap creation
- Fix path normalization to handle relative paths like './Kptfile'
- Ensure only one ConfigMap 'kptfile.kpt.dev' exists in mutation pipeline

This resolves the 'ConfigMap already exists' error when rendering packages with subpackages.

Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
- Removed mistakenly pushed changes that were related to another issue
- Cleaned up commits to keep this PR focused on the intended issue
- No functional changes introduced

This ensures the PR only contains relevant changes.

Signed-off-by: NETIZEN-11 <niteshkumar121411@gmail.com>
Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
Signed-off-by: Michael Greaves <michael.greaves@nokia.com>
Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Michael Greaves <michael.greaves@nokia.com>
Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
Signed-off-by: Michael Greaves <michael.greaves@nokia.com>
Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
CI failure due to renderstatus merge fixed.
Env variable to use nodejs as wasm env moved to Makefile from Github workflow

Signed-off-by: aravind.est <aravindhan.a@est.tech>
Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
…subpackages

- Add isRootKptfile() helper function for robust root detection
- Enhance pkgContextResource() to generate package-context.yaml only for root packages
- Subpackages are now correctly suppressed to prevent duplicate ConfigMap creation
- Fix path normalization to handle relative paths like './Kptfile'
- Ensure only one ConfigMap 'kptfile.kpt.dev' exists in mutation pipeline
This resolves 'ConfigMap already exists' error when rendering packages with subpackages.
Signed-off-by: NETIZEN-11 <niteshkumar121411@gmail.com>

Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
…ML serialization, result classification, and test YAML parsing

Fixes applied:
1. Kubernetes Dependency Alignment - Updated all k8s.io modules to v0.35.0
2. YAML Serialization Fix - Added yaml tags alongside json tags in RenderStatus, PipelineStepResult, ResultItem
3. Correct Result Classification Logic - Updated extractResultsFromFnResults to use severity instead of ExitCode
4. Test YAML Parsing Fix - Fixed yaml.MustParse test input with proper multiline YAML

Result: Eliminates dependency/API mismatch, ensures correct YAML output, fixes logic bug in result classification, makes tests valid and reliable

Closes: kptdev#4432

Signed-off-by: NETIZEN-11 <niteshkumar121411@gmail.com>
Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
- Added Signed-off-by line to comply with Developer Certificate of Origin (DCO)
- Ensured commit author email matches GitHub account

Signed-off-by: NETIZEN-11 <niteshkumar121411@gmail.com>
Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
- Remove 50+ lines of commented dead code
- Resolve TODO comment with proper printer implementation
- Replace hardcoded strings with constants (KptfileName, EmptyTempDirPrefix, RootPackagePath)
- Split monolithic function into 7 focused functions
- Add comprehensive input validation and error handling
- Improve resource cleanup with proper defer statements
- Update copyright to 2022-2026 for modifications

Fixes kptdev#4379

Signed-off-by: NETIZEN-11 <niteshkumar121411@gmail.com>
Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
…n, and CRLF

- Update testdata Kptfiles to use apply-setters:v0.2.4 (was v0.2.0)
  which is not registered in the functions map, causing TestRender failures
- Fix validateFnConfigPathSyntax to use path.IsAbs (forward-slash) instead
  of filepath.IsAbs so absolute path detection works correctly on all platforms
- Normalize CRLF to LF in pkg_context_test.go when reading expected output
  files to fix TestPkgContextGenerator on Windows
- Remove unused absPath helper and os import from executor_test.go

Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
- Remove duplicate dependency declarations in go.mod (apply-setters v0.2.2 and krm-functions-sdk v1.0.0)
- Fix duplicate field initializations in executor_test.go hydrationContext structs
- Fix malformed if statement in runMutators function (removed unclosed if block)
- Implement setRenderConditionWithStatus function properly
- Remove redundant RenderStatus assignment in setRenderStatus function
- Remove duplicate type declarations in types.go (Status, RenderStatus, PipelineStepResult, ResultItem)
- Add Resource field to ResultItem struct (required by executor.go)

All compilation errors resolved and tests compile successfully.

Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
Copilot AI review requested due to automatic review settings April 6, 2026 08:26
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 6, 2026

Deploy Preview for kptdocs ready!

Name Link
🔨 Latest commit 596b621
🔍 Latest deploy log https://app.netlify.com/projects/kptdocs/deploys/69d5612b3704f1000891eb2e
😎 Deploy Preview https://deploy-preview-4467--kptdocs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. enhancement New feature or request go Pull requests that update Go code labels Apr 6, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 18 out of 19 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@NETIZEN-11 NETIZEN-11 force-pushed the feat/issue-4450-pr3-api-types branch from 26041d7 to 52b4935 Compare April 7, 2026 13:48
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels Apr 7, 2026
Copilot AI review requested due to automatic review settings April 7, 2026 19:41
@NETIZEN-11 NETIZEN-11 force-pushed the feat/issue-4450-pr3-api-types branch from 52b4935 to 26041d7 Compare April 7, 2026 19:41
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Apr 7, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 19 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

NETIZEN-11 and others added 2 commits April 8, 2026 01:23
- Introduce stable v1 API for ResourceGroup
- Add v1/types.go with stable ResourceGroup type
- Add v1/doc.go with API documentation
- Mark v1alpha1 as deprecated with migration path
- Maintain backward compatibility with v1alpha1
- Follow semantic versioning for API stability

Part of kptdev#4450 - API Types Stabilization

Signed-off-by: NETIZEN-11 <niteshkumar121411@gmail.com>
- Remove duplicate validator.Filter() call in runValidators function
- Remove duplicate setRenderStatus function (keeping setRenderConditionWithStatus)
- Fix code duplication issues identified in code review

Resolves code review comments on PR for issue kptdev#4450

Signed-off-by: NETIZEN-11 <niteshkumar121411@gmail.com>
Copilot AI review requested due to automatic review settings April 7, 2026 19:55
@NETIZEN-11 NETIZEN-11 force-pushed the feat/issue-4450-pr3-api-types branch from b55379b to 596b621 Compare April 7, 2026 19:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 19 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update Go code size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants