Skip to content

Commit 2f96c57

Browse files
perdasilvaPer Goncalves da Silvajoelanford
authored
⚠️ Bump ClusterCatalog API to v1 (#380)
* bump ClusterCatalog API to v1 Signed-off-by: Per Goncalves da Silva <[email protected]> * Update test/e2e/unpack_test.go --------- Signed-off-by: Per Goncalves da Silva <[email protected]> Co-authored-by: Per Goncalves da Silva <[email protected]> Co-authored-by: Joe Lanford <[email protected]>
1 parent 20acf03 commit 2f96c57

28 files changed

+443
-462
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Procedure steps marked with an asterisk (`*`) are likely to change with future A
1818

1919
```sh
2020
$ kubectl apply -f - << EOF
21-
apiVersion: olm.operatorframework.io/v1alpha1
21+
apiVersion: olm.operatorframework.io/v1
2222
kind: ClusterCatalog
2323
metadata:
2424
name: operatorhubio
@@ -42,7 +42,7 @@ Procedure steps marked with an asterisk (`*`) are likely to change with future A
4242
Namespace:
4343
Labels: olm.operatorframework.io/metadata.name=operatorhubio
4444
Annotations: <none>
45-
API Version: olm.operatorframework.io/v1alpha1
45+
API Version: olm.operatorframework.io/v1
4646
Kind: ClusterCatalog
4747
Metadata:
4848
Creation Timestamp: 2024-10-17T13:48:46Z

api/core/doc.go

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v1alpha1
17+
package v1
1818

1919
import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

api/core/v1alpha1/clustercatalog_types_test.go renamed to api/v1/clustercatalog_types_test.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package v1alpha1
1+
package v1
22

33
import (
44
"context"
@@ -20,10 +20,12 @@ import (
2020
"sigs.k8s.io/yaml"
2121
)
2222

23+
const crdFilePath = "../../config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml"
24+
2325
func TestImageSourceCELValidationRules(t *testing.T) {
24-
validators := fieldValidatorsFromFile(t, "../../../config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml")
26+
validators := fieldValidatorsFromFile(t, crdFilePath)
2527
pth := "openAPIV3Schema.properties.spec.properties.source.properties.image"
26-
validator, found := validators["v1alpha1"][pth]
28+
validator, found := validators[GroupVersion.Version][pth]
2729
require.True(t, found)
2830

2931
for name, tc := range map[string]struct {
@@ -157,9 +159,9 @@ func TestImageSourceCELValidationRules(t *testing.T) {
157159
}
158160

159161
func TestResolvedImageSourceCELValidation(t *testing.T) {
160-
validators := fieldValidatorsFromFile(t, "../../../config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml")
162+
validators := fieldValidatorsFromFile(t, crdFilePath)
161163
pth := "openAPIV3Schema.properties.status.properties.resolvedSource.properties.image.properties.ref"
162-
validator, found := validators["v1alpha1"][pth]
164+
validator, found := validators[GroupVersion.Version][pth]
163165
require.True(t, found)
164166

165167
for name, tc := range map[string]struct {
@@ -250,9 +252,9 @@ func TestResolvedImageSourceCELValidation(t *testing.T) {
250252
}
251253

252254
func TestClusterCatalogURLsCELValidation(t *testing.T) {
253-
validators := fieldValidatorsFromFile(t, "../../../config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml")
255+
validators := fieldValidatorsFromFile(t, crdFilePath)
254256
pth := "openAPIV3Schema.properties.status.properties.urls.properties.base"
255-
validator, found := validators["v1alpha1"][pth]
257+
validator, found := validators[GroupVersion.Version][pth]
256258
require.True(t, found)
257259
for name, tc := range map[string]struct {
258260
urls ClusterCatalogURLs
@@ -294,9 +296,9 @@ func TestClusterCatalogURLsCELValidation(t *testing.T) {
294296
}
295297

296298
func TestSourceCELValidation(t *testing.T) {
297-
validators := fieldValidatorsFromFile(t, "../../../config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml")
299+
validators := fieldValidatorsFromFile(t, crdFilePath)
298300
pth := "openAPIV3Schema.properties.spec.properties.source"
299-
validator, found := validators["v1alpha1"][pth]
301+
validator, found := validators[GroupVersion.Version][pth]
300302
require.True(t, found)
301303
for name, tc := range map[string]struct {
302304
source CatalogSource
@@ -335,9 +337,9 @@ func TestSourceCELValidation(t *testing.T) {
335337
}
336338

337339
func TestResolvedSourceCELValidation(t *testing.T) {
338-
validators := fieldValidatorsFromFile(t, "../../../config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml")
340+
validators := fieldValidatorsFromFile(t, crdFilePath)
339341
pth := "openAPIV3Schema.properties.status.properties.resolvedSource"
340-
validator, found := validators["v1alpha1"][pth]
342+
validator, found := validators[GroupVersion.Version][pth]
341343

342344
require.True(t, found)
343345
for name, tc := range map[string]struct {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
// Package v1alpha1 contains API Schema definitions for the core v1alpha1 API group
17+
// Package v1 contains API Schema definitions for the core v1 API group
1818
// +kubebuilder:object:generate=true
1919
// +groupName=olm.operatorframework.io
20-
package v1alpha1
20+
package v1
2121

2222
import (
2323
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -26,7 +26,7 @@ import (
2626

2727
var (
2828
// GroupVersion is group version used to register these objects
29-
GroupVersion = schema.GroupVersion{Group: "olm.operatorframework.io", Version: "v1alpha1"}
29+
GroupVersion = schema.GroupVersion{Group: "olm.operatorframework.io", Version: "v1"}
3030

3131
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
3232
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

api/core/v1alpha1/zz_generated.deepcopy.go renamed to api/v1/zz_generated.deepcopy.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/manager/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import (
5151
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
5252
crwebhook "sigs.k8s.io/controller-runtime/pkg/webhook"
5353

54-
"github.com/operator-framework/catalogd/api/core/v1alpha1"
54+
catalogdv1 "github.com/operator-framework/catalogd/api/v1"
5555
corecontrollers "github.com/operator-framework/catalogd/internal/controllers/core"
5656
"github.com/operator-framework/catalogd/internal/features"
5757
"github.com/operator-framework/catalogd/internal/garbagecollection"
@@ -76,7 +76,7 @@ const (
7676
func init() {
7777
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
7878

79-
utilruntime.Must(v1alpha1.AddToScheme(scheme))
79+
utilruntime.Must(catalogdv1.AddToScheme(scheme))
8080
//+kubebuilder:scaffold:scheme
8181
}
8282

config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ spec:
2424
- jsonPath: .metadata.creationTimestamp
2525
name: Age
2626
type: date
27-
name: v1alpha1
27+
name: v1
2828
schema:
2929
openAPIV3Schema:
3030
description: |-

config/base/default/clustercatalogs/default-catalogs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: olm.operatorframework.io/v1alpha1
1+
apiVersion: olm.operatorframework.io/v1
22
kind: ClusterCatalog
33
metadata:
44
name: operatorhubio

config/base/manager/webhook/manifests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ webhooks:
1010
service:
1111
name: webhook-service
1212
namespace: system
13-
path: /mutate-olm-operatorframework-io-v1alpha1-clustercatalog
13+
path: /mutate-olm-operatorframework-io-v1-clustercatalog
1414
failurePolicy: Fail
1515
name: inject-metadata-name.olm.operatorframework.io
1616
rules:
1717
- apiGroups:
1818
- olm.operatorframework.io
1919
apiVersions:
20-
- v1alpha1
20+
- v1
2121
operations:
2222
- CREATE
2323
- UPDATE

0 commit comments

Comments
 (0)