Skip to content

Commit

Permalink
⚠️ Bump ClusterCatalog API to v1 (#380)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
3 people authored Nov 8, 2024
1 parent 20acf03 commit 2f96c57
Show file tree
Hide file tree
Showing 28 changed files with 443 additions and 462 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Procedure steps marked with an asterisk (`*`) are likely to change with future A

```sh
$ kubectl apply -f - << EOF
apiVersion: olm.operatorframework.io/v1alpha1
apiVersion: olm.operatorframework.io/v1
kind: ClusterCatalog
metadata:
name: operatorhubio
Expand All @@ -42,7 +42,7 @@ Procedure steps marked with an asterisk (`*`) are likely to change with future A
Namespace:
Labels: olm.operatorframework.io/metadata.name=operatorhubio
Annotations: <none>
API Version: olm.operatorframework.io/v1alpha1
API Version: olm.operatorframework.io/v1
Kind: ClusterCatalog
Metadata:
Creation Timestamp: 2024-10-17T13:48:46Z
Expand Down
21 changes: 0 additions & 21 deletions api/core/doc.go

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1
package v1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v1alpha1
package v1

import (
"context"
Expand All @@ -20,10 +20,12 @@ import (
"sigs.k8s.io/yaml"
)

const crdFilePath = "../../config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml"

func TestImageSourceCELValidationRules(t *testing.T) {
validators := fieldValidatorsFromFile(t, "../../../config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml")
validators := fieldValidatorsFromFile(t, crdFilePath)
pth := "openAPIV3Schema.properties.spec.properties.source.properties.image"
validator, found := validators["v1alpha1"][pth]
validator, found := validators[GroupVersion.Version][pth]
require.True(t, found)

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

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

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

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

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

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

require.True(t, found)
for name, tc := range map[string]struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

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

import (
"k8s.io/apimachinery/pkg/runtime/schema"
Expand All @@ -26,7 +26,7 @@ import (

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

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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import (
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
crwebhook "sigs.k8s.io/controller-runtime/pkg/webhook"

"github.com/operator-framework/catalogd/api/core/v1alpha1"
catalogdv1 "github.com/operator-framework/catalogd/api/v1"
corecontrollers "github.com/operator-framework/catalogd/internal/controllers/core"
"github.com/operator-framework/catalogd/internal/features"
"github.com/operator-framework/catalogd/internal/garbagecollection"
Expand All @@ -76,7 +76,7 @@ const (
func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))

utilruntime.Must(v1alpha1.AddToScheme(scheme))
utilruntime.Must(catalogdv1.AddToScheme(scheme))
//+kubebuilder:scaffold:scheme
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
name: v1
schema:
openAPIV3Schema:
description: |-
Expand Down
2 changes: 1 addition & 1 deletion config/base/default/clustercatalogs/default-catalogs.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: olm.operatorframework.io/v1alpha1
apiVersion: olm.operatorframework.io/v1
kind: ClusterCatalog
metadata:
name: operatorhubio
Expand Down
4 changes: 2 additions & 2 deletions config/base/manager/webhook/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ webhooks:
service:
name: webhook-service
namespace: system
path: /mutate-olm-operatorframework-io-v1alpha1-clustercatalog
path: /mutate-olm-operatorframework-io-v1-clustercatalog
failurePolicy: Fail
name: inject-metadata-name.olm.operatorframework.io
rules:
- apiGroups:
- olm.operatorframework.io
apiVersions:
- v1alpha1
- v1
operations:
- CREATE
- UPDATE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: olm.operatorframework.io/v1alpha1
apiVersion: olm.operatorframework.io/v1
kind: ClusterCatalog
metadata:
name: operatorhubio
Expand Down
2 changes: 1 addition & 1 deletion docs/fetching-catalog-contents.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ This section outlines a way of exposing the `Catalogd` Service's endpoints outsi

```sh
$ kubectl apply -f - << EOF
apiVersion: olm.operatorframework.io/v1alpha1
apiVersion: olm.operatorframework.io/v1
kind: ClusterCatalog
metadata:
name: operatorhubio
Expand Down
Loading

0 comments on commit 2f96c57

Please sign in to comment.