Skip to content

Commit 498658f

Browse files
authored
internal/scaffold/helm/chart.go: change default API version (#2859)
Changed default API version for new Helm-based operators to `helm.operator-sdk/v1alpha1`. The `k8s.io` domain is reserved, so CRDs should not use it without explicit appproval.
1 parent 1087d81 commit 498658f

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
entries:
2+
- description: >
3+
Changed default API version for new Helm-based operators
4+
to `helm.operator-sdk/v1alpha1`. The `k8s.io` domain is
5+
reserved, so CRDs should not use it without explicit appproval.
6+
See the [API Review Process](https://github.com/kubernetes/community/blob/81ec4af0ed02b4c5c0917a16563250b2f45250c2/sig-architecture/api-review-process.md#mandatory) for details.
7+
8+
kind: change
9+
10+
# Is this a breaking change?
11+
breaking: false
12+
13+
migration:
14+
header: Helm-based operators should not use `k8s.io` API version suffix
15+
body: |-
16+
Newly created Helm-based operators no longer use the `k8s.io` domain
17+
suffix as a default API version because it is reserved. APIs and CRDs
18+
using this domain [require API review][api-review] and approval.
19+
Existing projects that do not have this approval should migrate to use
20+
a new CRD API version suffix.
21+
22+
Make the following changes to migrate to a new group name:
23+
24+
- `watches.yaml` - Update the `group` field.
25+
- `deploy/role.yaml` - Update the `apiGroups` field in the policy rule giving access to the CRD.
26+
- `deploy/crds/`
27+
- Update the `metadata.name` and `spec.group` fields in the CRD files.
28+
- Update the `apiVersion` field in the CR files.
29+
- Rename the CRD and CR files to reflect the new group name.
30+
31+
[api-review]: https://github.com/kubernetes/community/blob/81ec4af0ed02b4c5c0917a16563250b2f45250c2/sig-architecture/api-review-process.md#mandatory

internal/scaffold/helm/chart.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ import (
2121
"os"
2222
"path/filepath"
2323

24-
"github.com/operator-framework/operator-sdk/internal/scaffold"
25-
2624
"github.com/iancoleman/strcase"
2725
log "github.com/sirupsen/logrus"
2826
"helm.sh/helm/v3/pkg/chart"
@@ -32,6 +30,8 @@ import (
3230
"helm.sh/helm/v3/pkg/downloader"
3331
"helm.sh/helm/v3/pkg/getter"
3432
"helm.sh/helm/v3/pkg/repo"
33+
34+
"github.com/operator-framework/operator-sdk/internal/scaffold"
3535
)
3636

3737
const (
@@ -42,7 +42,7 @@ const (
4242

4343
// DefaultAPIVersion is the Kubernetes CRD API Version used for fetched
4444
// charts when the --api-version flag is not specified
45-
DefaultAPIVersion string = "charts.helm.k8s.io/v1alpha1"
45+
DefaultAPIVersion string = "helm.operator-sdk/v1alpha1"
4646
)
4747

4848
// CreateChartOptions is used to configure how a Helm chart is scaffolded

0 commit comments

Comments
 (0)