Skip to content

Commit 26041d7

Browse files
author
NETIZEN-11
committed
feat: Stabilize ResourceGroup API to v1
- 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 #4450 - API Types Stabilization
1 parent 1de6827 commit 26041d7

3 files changed

Lines changed: 90 additions & 1 deletion

File tree

pkg/api/resourcegroup/v1/doc.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2026 The kpt Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Package v1 contains the stable v1 API for ResourceGroup.
16+
// This API is stable and follows semantic versioning.
17+
// Breaking changes will only be introduced in a new major version (v2).
18+
//
19+
// +kubebuilder:object:generate=true
20+
// +groupName=kpt.dev
21+
package v1

pkg/api/resourcegroup/v1/types.go

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Copyright 2021,2026 The kpt Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Package v1 defines ResourceGroup schema.
16+
// Version: v1 (stable)
17+
// swagger:meta
18+
package v1
19+
20+
import (
21+
"k8s.io/apimachinery/pkg/runtime/schema"
22+
"sigs.k8s.io/cli-utils/pkg/common"
23+
"sigs.k8s.io/kustomize/kyaml/yaml"
24+
)
25+
26+
const (
27+
RGFileName = "resourcegroup.yaml"
28+
// RGInventoryIDLabel is the label name used for storing an inventory ID.
29+
RGInventoryIDLabel = common.InventoryLabel
30+
31+
// Deprecated: prefer ResourceGroupGVK
32+
RGFileKind = "ResourceGroup"
33+
// Deprecated: prefer ResourceGroupGVK
34+
RGFileGroup = "kpt.dev"
35+
// Deprecated: prefer ResourceGroupGVK
36+
RGFileVersion = "v1"
37+
// Deprecated: prefer ResourceGroupGVK
38+
RGFileAPIVersion = RGFileGroup + "/" + RGFileVersion
39+
)
40+
41+
// ResourceGroupGVK is the GroupVersionKind of ResourceGroup objects
42+
func ResourceGroupGVK() schema.GroupVersionKind {
43+
return schema.GroupVersionKind{
44+
Group: "kpt.dev",
45+
Version: "v1",
46+
Kind: "ResourceGroup",
47+
}
48+
}
49+
50+
// DefaultMeta is the ResourceMeta for ResourceGroup instances.
51+
var DefaultMeta = yaml.ResourceMeta{
52+
TypeMeta: yaml.TypeMeta{
53+
APIVersion: RGFileAPIVersion,
54+
Kind: RGFileKind,
55+
},
56+
}
57+
58+
// ResourceGroup contains the inventory information about a package managed with kpt.
59+
// This is the stable v1 API for ResourceGroup.
60+
// swagger:model resourcegroup
61+
type ResourceGroup struct {
62+
yaml.ResourceMeta `yaml:",inline" json:",inline"`
63+
}

pkg/api/resourcegroup/v1alpha1/types.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
// Package defines ResourceGroup schema.
15+
// Package v1alpha1 defines ResourceGroup schema.
1616
// Version: v1alpha1
17+
//
18+
// Deprecated: v1alpha1 is deprecated. Use github.com/kptdev/kpt/pkg/api/resourcegroup/v1 instead.
19+
// This package is maintained for backward compatibility only and will be removed in v2.0.0.
1720
// swagger:meta
1821
package v1alpha1
1922

@@ -39,6 +42,8 @@ const (
3942
)
4043

4144
// ResourceGroupGVK is the GroupVersionKind of ResourceGroup objects
45+
//
46+
// Deprecated: Use github.com/kptdev/kpt/pkg/api/resourcegroup/v1.ResourceGroupGVK instead.
4247
func ResourceGroupGVK() schema.GroupVersionKind {
4348
return schema.GroupVersionKind{
4449
Group: "kpt.dev",

0 commit comments

Comments
 (0)