Skip to content

Commit

Permalink
update imports to drop alpha1 suffix
Browse files Browse the repository at this point in the history
and other minor version changes that were missed when bumping
API versions to v1.

Signed-off-by: everettraven <[email protected]>
  • Loading branch information
everettraven committed Nov 12, 2024
1 parent b6b087e commit 05f03c6
Show file tree
Hide file tree
Showing 21 changed files with 558 additions and 558 deletions.
6 changes: 3 additions & 3 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ resources:
group: olm
kind: ClusterExtension
path: github.com/operator-framework/operator-controller/api/v1
version: v1alpha1
version: v1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: operatorframework.io
group: olm
kind: Extension
path: github.com/operator-framework/operator-controller/api/v11
version: v1alpha1
path: github.com/operator-framework/operator-controller/api/v1
version: v1
version: "3"
10 changes: 5 additions & 5 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import (
catalogd "github.com/operator-framework/catalogd/api/core/v1alpha1"
helmclient "github.com/operator-framework/helm-operator-plugins/pkg/client"

ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1"
ocv1 "github.com/operator-framework/operator-controller/api/v1"
"github.com/operator-framework/operator-controller/internal/action"
"github.com/operator-framework/operator-controller/internal/applier"
"github.com/operator-framework/operator-controller/internal/authentication"
Expand Down Expand Up @@ -141,8 +141,8 @@ func main() {
setupLog.Info("set up manager")
cacheOptions := crcache.Options{
ByObject: map[client.Object]crcache.ByObject{
&ocv1alpha1.ClusterExtension{}: {Label: k8slabels.Everything()},
&catalogd.ClusterCatalog{}: {Label: k8slabels.Everything()},
&ocv1.ClusterExtension{}: {Label: k8slabels.Everything()},
&catalogd.ClusterCatalog{}: {Label: k8slabels.Everything()},
},
DefaultNamespaces: map[string]crcache.Config{
systemNamespace: {LabelSelector: k8slabels.Everything()},
Expand Down Expand Up @@ -196,7 +196,7 @@ func main() {
cfgGetter, err := helmclient.NewActionConfigGetter(mgr.GetConfig(), mgr.GetRESTMapper(),
helmclient.StorageDriverMapper(action.ChunkedStorageDriverMapper(coreClient, mgr.GetAPIReader(), systemNamespace)),
helmclient.ClientNamespaceMapper(func(obj client.Object) (string, error) {
ext := obj.(*ocv1alpha1.ClusterExtension)
ext := obj.(*ocv1.ClusterExtension)
return ext.Spec.Namespace, nil
}),
helmclient.ClientRestConfigMapper(clientRestConfigMapper),
Expand Down Expand Up @@ -291,7 +291,7 @@ func main() {

cm := contentmanager.NewManager(clientRestConfigMapper, mgr.GetConfig(), mgr.GetRESTMapper())
err = clusterExtensionFinalizers.Register(controllers.ClusterExtensionCleanupContentManagerCacheFinalizer, finalizers.FinalizerFunc(func(ctx context.Context, obj client.Object) (crfinalizer.Result, error) {
ext := obj.(*ocv1alpha1.ClusterExtension)
ext := obj.(*ocv1.ClusterExtension)
err := cm.Delete(ext)
return crfinalizer.Result{}, err
}))
Expand Down
4 changes: 2 additions & 2 deletions internal/action/restconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import (
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/client"

ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1"
ocv1 "github.com/operator-framework/operator-controller/api/v1"
"github.com/operator-framework/operator-controller/internal/authentication"
)

func ServiceAccountRestConfigMapper(tokenGetter *authentication.TokenGetter) func(ctx context.Context, o client.Object, c *rest.Config) (*rest.Config, error) {
return func(ctx context.Context, o client.Object, c *rest.Config) (*rest.Config, error) {
cExt := o.(*ocv1alpha1.ClusterExtension)
cExt := o.(*ocv1.ClusterExtension)
saKey := types.NamespacedName{
Name: cExt.Spec.ServiceAccount.Name,
Namespace: cExt.Spec.Namespace,
Expand Down
10 changes: 5 additions & 5 deletions internal/applier/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

helmclient "github.com/operator-framework/helm-operator-plugins/pkg/client"

ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1"
ocv1 "github.com/operator-framework/operator-controller/api/v1"
"github.com/operator-framework/operator-controller/internal/rukpak/convert"
"github.com/operator-framework/operator-controller/internal/rukpak/preflights/crdupgradesafety"
"github.com/operator-framework/operator-controller/internal/rukpak/util"
Expand Down Expand Up @@ -59,7 +59,7 @@ type Helm struct {

// shouldSkipPreflight is a helper to determine if the preflight check is CRDUpgradeSafety AND
// if it is set to enforcement None.
func shouldSkipPreflight(ctx context.Context, preflight Preflight, ext *ocv1alpha1.ClusterExtension, state string) bool {
func shouldSkipPreflight(ctx context.Context, preflight Preflight, ext *ocv1.ClusterExtension, state string) bool {
l := log.FromContext(ctx)
hasCRDUpgradeSafety := ext.Spec.Install != nil && ext.Spec.Install.Preflight != nil && ext.Spec.Install.Preflight.CRDUpgradeSafety != nil
_, isCRDUpgradeSafetyInstance := preflight.(*crdupgradesafety.Preflight)
Expand All @@ -68,7 +68,7 @@ func shouldSkipPreflight(ctx context.Context, preflight Preflight, ext *ocv1alph
if state == StateNeedsInstall || state == StateNeedsUpgrade {
l.Info("crdUpgradeSafety ", "policy", ext.Spec.Install.Preflight.CRDUpgradeSafety.Enforcement)
}
if ext.Spec.Install.Preflight.CRDUpgradeSafety.Enforcement == ocv1alpha1.CRDUpgradeSafetyEnforcementNone {
if ext.Spec.Install.Preflight.CRDUpgradeSafety.Enforcement == ocv1.CRDUpgradeSafetyEnforcementNone {
// Skip this preflight check because it is of type *crdupgradesafety.Preflight and the CRD Upgrade Safety
// policy is set to None
return true
Expand All @@ -77,7 +77,7 @@ func shouldSkipPreflight(ctx context.Context, preflight Preflight, ext *ocv1alph
return false
}

func (h *Helm) Apply(ctx context.Context, contentFS fs.FS, ext *ocv1alpha1.ClusterExtension, objectLabels map[string]string, storageLabels map[string]string) ([]client.Object, string, error) {
func (h *Helm) Apply(ctx context.Context, contentFS fs.FS, ext *ocv1.ClusterExtension, objectLabels map[string]string, storageLabels map[string]string) ([]client.Object, string, error) {
chrt, err := convert.RegistryV1ToHelmChart(ctx, contentFS, ext.Spec.Namespace, []string{corev1.NamespaceAll})
if err != nil {
return nil, "", err
Expand Down Expand Up @@ -151,7 +151,7 @@ func (h *Helm) Apply(ctx context.Context, contentFS fs.FS, ext *ocv1alpha1.Clust
return relObjects, state, nil
}

func (h *Helm) getReleaseState(cl helmclient.ActionInterface, ext *ocv1alpha1.ClusterExtension, chrt *chart.Chart, values chartutil.Values, post postrender.PostRenderer) (*release.Release, *release.Release, string, error) {
func (h *Helm) getReleaseState(cl helmclient.ActionInterface, ext *ocv1.ClusterExtension, chrt *chart.Chart, values chartutil.Values, post postrender.PostRenderer) (*release.Release, *release.Release, string, error) {
currentRelease, err := cl.Get(ext.GetName())
if err != nil && !errors.Is(err, driver.ErrReleaseNotFound) {
return nil, nil, StateError, err
Expand Down
6 changes: 3 additions & 3 deletions internal/bundleutil/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/operator-framework/operator-registry/alpha/declcfg"
"github.com/operator-framework/operator-registry/alpha/property"

ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1"
ocv1 "github.com/operator-framework/operator-controller/api/v1"
)

func GetVersion(b declcfg.Bundle) (*bsemver.Version, error) {
Expand All @@ -30,8 +30,8 @@ func GetVersion(b declcfg.Bundle) (*bsemver.Version, error) {
}

// MetadataFor returns a BundleMetadata for the given bundle name and version.
func MetadataFor(bundleName string, bundleVersion bsemver.Version) ocv1alpha1.BundleMetadata {
return ocv1alpha1.BundleMetadata{
func MetadataFor(bundleName string, bundleVersion bsemver.Version) ocv1.BundleMetadata {
return ocv1.BundleMetadata{
Name: bundleName,
Version: bundleVersion.String(),
}
Expand Down
10 changes: 5 additions & 5 deletions internal/catalogmetadata/filter/successors.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (

"github.com/operator-framework/operator-registry/alpha/declcfg"

ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1"
ocv1 "github.com/operator-framework/operator-controller/api/v1"
"github.com/operator-framework/operator-controller/internal/features"
)

func SuccessorsOf(installedBundle ocv1alpha1.BundleMetadata, channels ...declcfg.Channel) (Predicate[declcfg.Bundle], error) {
func SuccessorsOf(installedBundle ocv1.BundleMetadata, channels ...declcfg.Channel) (Predicate[declcfg.Bundle], error) {
var successors successorsPredicateFunc = legacySuccessor
if features.OperatorControllerFeatureGate.Enabled(features.ForceSemverUpgradeConstraints) {
successors = semverSuccessor
Expand Down Expand Up @@ -42,9 +42,9 @@ func SuccessorsOf(installedBundle ocv1alpha1.BundleMetadata, channels ...declcfg

// successorsPredicateFunc returns a predicate to find successors
// for a bundle. Predicate must not include the current version.
type successorsPredicateFunc func(installedBundle ocv1alpha1.BundleMetadata, channels ...declcfg.Channel) (Predicate[declcfg.Bundle], error)
type successorsPredicateFunc func(installedBundle ocv1.BundleMetadata, channels ...declcfg.Channel) (Predicate[declcfg.Bundle], error)

func legacySuccessor(installedBundle ocv1alpha1.BundleMetadata, channels ...declcfg.Channel) (Predicate[declcfg.Bundle], error) {
func legacySuccessor(installedBundle ocv1.BundleMetadata, channels ...declcfg.Channel) (Predicate[declcfg.Bundle], error) {
installedBundleVersion, err := bsemver.Parse(installedBundle.Version)
if err != nil {
return nil, fmt.Errorf("error parsing installed bundle version: %w", err)
Expand Down Expand Up @@ -88,7 +88,7 @@ func legacySuccessor(installedBundle ocv1alpha1.BundleMetadata, channels ...decl
// in a channel entry that is necessary to determine if a bundle is a successor.
// A semver range check is the only necessary element. If filtering by channel
// membership is necessary, an additional filter for that purpose should be applied.
func semverSuccessor(installedBundle ocv1alpha1.BundleMetadata, _ ...declcfg.Channel) (Predicate[declcfg.Bundle], error) {
func semverSuccessor(installedBundle ocv1.BundleMetadata, _ ...declcfg.Channel) (Predicate[declcfg.Bundle], error) {
currentVersion, err := mmsemver.NewVersion(installedBundle.Version)
if err != nil {
return nil, err
Expand Down
12 changes: 6 additions & 6 deletions internal/catalogmetadata/filter/successors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/operator-framework/operator-registry/alpha/declcfg"
"github.com/operator-framework/operator-registry/alpha/property"

ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1"
ocv1 "github.com/operator-framework/operator-controller/api/v1"
"github.com/operator-framework/operator-controller/internal/bundleutil"
"github.com/operator-framework/operator-controller/internal/catalogmetadata/compare"
"github.com/operator-framework/operator-controller/internal/features"
Expand Down Expand Up @@ -129,7 +129,7 @@ func TestSuccessorsPredicateWithForceSemverUpgradeConstraintsEnabled(t *testing.

for _, tt := range []struct {
name string
installedBundle ocv1alpha1.BundleMetadata
installedBundle ocv1.BundleMetadata
expectedResult []declcfg.Bundle
}{
{
Expand Down Expand Up @@ -162,7 +162,7 @@ func TestSuccessorsPredicateWithForceSemverUpgradeConstraintsEnabled(t *testing.
},
{
name: "installed bundle not found",
installedBundle: ocv1alpha1.BundleMetadata{
installedBundle: ocv1.BundleMetadata{
Name: "test-package.v9.0.0",
Version: "9.0.0",
},
Expand Down Expand Up @@ -281,7 +281,7 @@ func TestSuccessorsPredicateWithForceSemverUpgradeConstraintsDisabled(t *testing

for _, tt := range []struct {
name string
installedBundle ocv1alpha1.BundleMetadata
installedBundle ocv1.BundleMetadata
expectedResult []declcfg.Bundle
}{
{
Expand Down Expand Up @@ -319,7 +319,7 @@ func TestSuccessorsPredicateWithForceSemverUpgradeConstraintsDisabled(t *testing
},
{
name: "installed bundle not found",
installedBundle: ocv1alpha1.BundleMetadata{
installedBundle: ocv1.BundleMetadata{
Name: "test-package.v9.0.0",
Version: "9.0.0",
},
Expand Down Expand Up @@ -368,7 +368,7 @@ func TestLegacySuccessor(t *testing.T) {
},
},
}
installedBundle := ocv1alpha1.BundleMetadata{
installedBundle := ocv1.BundleMetadata{
Name: "package1.v0.0.1",
Version: "0.0.1",
}
Expand Down
18 changes: 9 additions & 9 deletions internal/contentmanager/cache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/controller-runtime/pkg/source"

ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1"
ocv1 "github.com/operator-framework/operator-controller/api/v1"
)

type mockWatcher struct {
Expand Down Expand Up @@ -64,7 +64,7 @@ func TestCacheWatch(t *testing.T) {
&mockSourcerer{
source: &mockSource{},
},
&ocv1alpha1.ClusterExtension{},
&ocv1.ClusterExtension{},
time.Second,
)

Expand All @@ -81,7 +81,7 @@ func TestCacheWatchInvalidGVK(t *testing.T) {
&mockSourcerer{
source: &mockSource{},
},
&ocv1alpha1.ClusterExtension{},
&ocv1.ClusterExtension{},
time.Second,
)

Expand All @@ -94,7 +94,7 @@ func TestCacheWatchSourcererError(t *testing.T) {
&mockSourcerer{
err: errors.New("error"),
},
&ocv1alpha1.ClusterExtension{},
&ocv1.ClusterExtension{},
time.Second,
)

Expand All @@ -109,7 +109,7 @@ func TestCacheWatchWatcherError(t *testing.T) {
&mockSourcerer{
source: &mockSource{},
},
&ocv1alpha1.ClusterExtension{},
&ocv1.ClusterExtension{},
time.Second,
)

Expand All @@ -126,7 +126,7 @@ func TestCacheWatchSourceWaitForSyncError(t *testing.T) {
err: errors.New("error"),
},
},
&ocv1alpha1.ClusterExtension{},
&ocv1.ClusterExtension{},
time.Second,
)

Expand All @@ -142,7 +142,7 @@ func TestCacheWatchExistingSourceNotPanic(t *testing.T) {
&mockSourcerer{
source: &mockSource{},
},
&ocv1alpha1.ClusterExtension{},
&ocv1.ClusterExtension{},
time.Second,
)

Expand All @@ -162,7 +162,7 @@ func TestCacheWatchRemovesStaleSources(t *testing.T) {
&mockSourcerer{
source: &mockSource{},
},
&ocv1alpha1.ClusterExtension{},
&ocv1.ClusterExtension{},
time.Second,
)

Expand All @@ -186,7 +186,7 @@ func TestCacheWatchRemovingStaleSourcesError(t *testing.T) {
&mockSourcerer{
source: &mockSource{},
},
&ocv1alpha1.ClusterExtension{},
&ocv1.ClusterExtension{},
time.Second,
)

Expand Down
Loading

0 comments on commit 05f03c6

Please sign in to comment.