diff --git a/deploy/crds/cincinnati.openshift.io_cincinnatis_crd.yaml b/deploy/crds/cincinnati.openshift.io_cincinnatis_crd.yaml index ad7ef3e9..d1fb5446 100644 --- a/deploy/crds/cincinnati.openshift.io_cincinnatis_crd.yaml +++ b/deploy/crds/cincinnati.openshift.io_cincinnatis_crd.yaml @@ -31,12 +31,6 @@ spec: spec: description: CincinnatiSpec defines the desired state of Cincinnati properties: - certConfigMapKey: - description: CertConfigMapKey refers to the ConfigMap key that holds - a CA cert to the registry Cincinnati will contact to build the upgrade - graph. The name of the ConfigMap holding the key comes from the field - additionalTrustedCA in the image.config.openshift.io API. - type: string graphDataImage: description: GraphDataImage is a container image that contains the Cincinnati graph data. The data is copied to /var/lib/cincinnati/graph-data. @@ -93,8 +87,8 @@ spec: type: array type: object type: object - version: v1alpha1 + version: v1beta1 versions: - - name: v1alpha1 + - name: v1beta1 served: true storage: true diff --git a/deploy/crds/cincinnati.openshift.io_v1alpha1_cincinnati_cr.yaml b/deploy/crds/cincinnati.openshift.io_v1beta1_cincinnati_cr.yaml similarity index 82% rename from deploy/crds/cincinnati.openshift.io_v1alpha1_cincinnati_cr.yaml rename to deploy/crds/cincinnati.openshift.io_v1beta1_cincinnati_cr.yaml index db7c8810..16323f13 100644 --- a/deploy/crds/cincinnati.openshift.io_v1alpha1_cincinnati_cr.yaml +++ b/deploy/crds/cincinnati.openshift.io_v1beta1_cincinnati_cr.yaml @@ -1,4 +1,4 @@ -apiVersion: cincinnati.openshift.io/v1alpha1 +apiVersion: cincinnati.openshift.io/v1beta1 kind: Cincinnati metadata: name: example-cincinnati diff --git a/deploy/olm-catalog/cincinnati-operator/0.0.1/cincinnati-operator.v0.0.1.clusterserviceversion.yaml b/deploy/olm-catalog/cincinnati-operator/0.0.1/cincinnati-operator.v0.0.1.clusterserviceversion.yaml index ae9ae637..88106bfc 100644 --- a/deploy/olm-catalog/cincinnati-operator/0.0.1/cincinnati-operator.v0.0.1.clusterserviceversion.yaml +++ b/deploy/olm-catalog/cincinnati-operator/0.0.1/cincinnati-operator.v0.0.1.clusterserviceversion.yaml @@ -1,11 +1,11 @@ -apiVersion: operators.coreos.com/v1alpha1 +apiVersion: operators.coreos.com/v1beta1 kind: ClusterServiceVersion metadata: annotations: alm-examples: |- [ { - "apiVersion": "cincinnati.openshift.io/v1alpha1", + "apiVersion": "cincinnati.openshift.io/v1beta1", "kind": "Cincinnati", "metadata": { "name": "cincinnati-instance" @@ -34,7 +34,7 @@ spec: - description: Cincinnati is the Schema for a Cincinnati service. kind: Cincinnati name: cincinnatis.cincinnati.openshift.io - version: v1alpha1 + version: v1beta1 description: |- # Use Case Running a Cincinnati instance in a cluster is appealing for offline OpenShift diff --git a/docs/graph-data-init-container.md b/docs/graph-data-init-container.md index 8b86eae5..e33aae60 100644 --- a/docs/graph-data-init-container.md +++ b/docs/graph-data-init-container.md @@ -32,7 +32,7 @@ container image. For the example above: ``` -apiVersion: cincinnati.openshift.io/v1alpha1 +apiVersion: cincinnati.openshift.io/v1beta1 kind: Cincinnati metadata: name: example-cincinnati diff --git a/pkg/apis/addtoscheme_cincinnati_v1alpha1.go b/pkg/apis/addtoscheme_cincinnati_v1beta1.go similarity index 71% rename from pkg/apis/addtoscheme_cincinnati_v1alpha1.go rename to pkg/apis/addtoscheme_cincinnati_v1beta1.go index 627b2d20..2a7b5487 100644 --- a/pkg/apis/addtoscheme_cincinnati_v1alpha1.go +++ b/pkg/apis/addtoscheme_cincinnati_v1beta1.go @@ -1,10 +1,10 @@ package apis import ( - "github.com/openshift/cincinnati-operator/pkg/apis/cincinnati/v1alpha1" + "github.com/openshift/cincinnati-operator/pkg/apis/cincinnati/v1beta1" ) func init() { // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back - AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme) + AddToSchemes = append(AddToSchemes, v1beta1.SchemeBuilder.AddToScheme) } diff --git a/pkg/apis/cincinnati/v1alpha1/doc.go b/pkg/apis/cincinnati/v1alpha1/doc.go deleted file mode 100644 index 727c3e59..00000000 --- a/pkg/apis/cincinnati/v1alpha1/doc.go +++ /dev/null @@ -1,4 +0,0 @@ -// Package v1alpha1 contains API Schema definitions for the cincinnati v1alpha1 API group -// +k8s:deepcopy-gen=package,register -// +groupName=cincinnati.openshift.io -package v1alpha1 diff --git a/pkg/apis/cincinnati/v1alpha1/cincinnati_types.go b/pkg/apis/cincinnati/v1beta1/cincinnati_types.go similarity index 99% rename from pkg/apis/cincinnati/v1alpha1/cincinnati_types.go rename to pkg/apis/cincinnati/v1beta1/cincinnati_types.go index 4c425cef..653ea5fb 100644 --- a/pkg/apis/cincinnati/v1alpha1/cincinnati_types.go +++ b/pkg/apis/cincinnati/v1beta1/cincinnati_types.go @@ -1,4 +1,4 @@ -package v1alpha1 +package v1beta1 import ( conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1" diff --git a/pkg/apis/cincinnati/v1beta1/doc.go b/pkg/apis/cincinnati/v1beta1/doc.go new file mode 100644 index 00000000..318a67cf --- /dev/null +++ b/pkg/apis/cincinnati/v1beta1/doc.go @@ -0,0 +1,4 @@ +// Package v1beta1 contains API Schema definitions for the cincinnati v1beta1 API group +// +k8s:deepcopy-gen=package,register +// +groupName=cincinnati.openshift.io +package v1beta1 diff --git a/pkg/apis/cincinnati/v1alpha1/register.go b/pkg/apis/cincinnati/v1beta1/register.go similarity index 78% rename from pkg/apis/cincinnati/v1alpha1/register.go rename to pkg/apis/cincinnati/v1beta1/register.go index 8125839e..e7ae5f50 100644 --- a/pkg/apis/cincinnati/v1alpha1/register.go +++ b/pkg/apis/cincinnati/v1beta1/register.go @@ -1,9 +1,9 @@ // NOTE: Boilerplate only. Ignore this file. -// Package v1alpha1 contains API Schema definitions for the cincinnati v1alpha1 API group +// Package v1beta1 contains API Schema definitions for the cincinnati v1beta1 API group // +k8s:deepcopy-gen=package,register // +groupName=cincinnati.openshift.io -package v1alpha1 +package v1beta1 import ( "k8s.io/apimachinery/pkg/runtime/schema" @@ -12,7 +12,7 @@ import ( var ( // SchemeGroupVersion is group version used to register these objects - SchemeGroupVersion = schema.GroupVersion{Group: "cincinnati.openshift.io", Version: "v1alpha1"} + SchemeGroupVersion = schema.GroupVersion{Group: "cincinnati.openshift.io", Version: "v1beta1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} diff --git a/pkg/apis/cincinnati/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/cincinnati/v1beta1/zz_generated.deepcopy.go similarity index 99% rename from pkg/apis/cincinnati/v1alpha1/zz_generated.deepcopy.go rename to pkg/apis/cincinnati/v1beta1/zz_generated.deepcopy.go index 7024d934..33249003 100644 --- a/pkg/apis/cincinnati/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/cincinnati/v1beta1/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // Code generated by operator-sdk. DO NOT EDIT. -package v1alpha1 +package v1beta1 import ( v1 "github.com/openshift/custom-resource-status/conditions/v1" diff --git a/pkg/apis/cincinnati/v1alpha1/zz_generated.openapi.go b/pkg/apis/cincinnati/v1beta1/zz_generated.openapi.go similarity index 94% rename from pkg/apis/cincinnati/v1alpha1/zz_generated.openapi.go rename to pkg/apis/cincinnati/v1beta1/zz_generated.openapi.go index 563022dc..10570dd7 100644 --- a/pkg/apis/cincinnati/v1alpha1/zz_generated.openapi.go +++ b/pkg/apis/cincinnati/v1beta1/zz_generated.openapi.go @@ -2,7 +2,7 @@ // This file was autogenerated by openapi-gen. Do not edit it manually! -package v1alpha1 +package v1beta1 import ( common "k8s.io/kube-openapi/pkg/common" diff --git a/pkg/controller/cincinnati/cincinnati_controller.go b/pkg/controller/cincinnati/cincinnati_controller.go index e04f52c8..129d0119 100644 --- a/pkg/controller/cincinnati/cincinnati_controller.go +++ b/pkg/controller/cincinnati/cincinnati_controller.go @@ -24,7 +24,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/source" apicfgv1 "github.com/openshift/api/config/v1" - cv1alpha1 "github.com/openshift/cincinnati-operator/pkg/apis/cincinnati/v1alpha1" + cv1beta1 "github.com/openshift/cincinnati-operator/pkg/apis/cincinnati/v1beta1" "github.com/openshift/cluster-image-registry-operator/pkg/defaults" ) @@ -60,7 +60,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { } // Watch for changes to primary resource Cincinnati - err = c.Watch(&source.Kind{Type: &cv1alpha1.Cincinnati{}}, &handler.EnqueueRequestForObject{}) + err = c.Watch(&source.Kind{Type: &cv1beta1.Cincinnati{}}, &handler.EnqueueRequestForObject{}) if err != nil { return err } @@ -74,7 +74,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { } { err = c.Watch(&source.Kind{Type: obj}, &handler.EnqueueRequestForOwner{ IsController: true, - OwnerType: &cv1alpha1.Cincinnati{}, + OwnerType: &cv1beta1.Cincinnati{}, }) if err != nil { return err @@ -93,7 +93,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { //Watch for all ConfigMap changes, only Reconcile when name == Image.Spec.AdditionalTrustedCA.Name err = c.Watch(&source.Kind{Type: &corev1.ConfigMap{}}, &handler.EnqueueRequestsFromMapFunc{ToRequests: &mapper{mgr.GetClient()}}, - predicate.GenerationChangedPredicate{}) + ) if err != nil { log.Error(err, "Error watching ConfigMap API") return err @@ -122,7 +122,7 @@ func (r *ReconcileCincinnati) Reconcile(request reconcile.Request) (reconcile.Re reqLogger.Info("Reconciling Cincinnati") // Fetch the Cincinnati instance - instance := &cv1alpha1.Cincinnati{} + instance := &cv1beta1.Cincinnati{} err := r.client.Get(ctx, request.NamespacedName, instance) if err != nil { if errors.IsNotFound(err) { @@ -135,7 +135,7 @@ func (r *ReconcileCincinnati) Reconcile(request reconcile.Request) (reconcile.Re } instanceCopy := instance.DeepCopy() - instanceCopy.Status = cv1alpha1.CincinnatiStatus{} + instanceCopy.Status = cv1beta1.CincinnatiStatus{} // this object creates all the kube resources we need and then holds them as // the canonical reference for those resources during reconciliation. @@ -145,7 +145,7 @@ func (r *ReconcileCincinnati) Reconcile(request reconcile.Request) (reconcile.Re return reconcile.Result{}, err } - for _, f := range []func(context.Context, logr.Logger, *cv1alpha1.Cincinnati, *kubeResources) error{ + for _, f := range []func(context.Context, logr.Logger, *cv1beta1.Cincinnati, *kubeResources) error{ r.ensureConfig, r.ensureEnvConfig, r.ensureAdditionalTrustedCA, @@ -167,7 +167,7 @@ func (r *ReconcileCincinnati) Reconcile(request reconcile.Request) (reconcile.Re // appropriate. if err == nil { conditionsv1.SetStatusCondition(&instanceCopy.Status.Conditions, conditionsv1.Condition{ - Type: cv1alpha1.ConditionReconcileCompleted, + Type: cv1beta1.ConditionReconcileCompleted, Status: corev1.ConditionTrue, Reason: "Success", Message: "", @@ -182,9 +182,9 @@ func (r *ReconcileCincinnati) Reconcile(request reconcile.Request) (reconcile.Re } // handleErr logs the error and sets an appropriate Condition on the status. -func handleErr(reqLogger logr.Logger, status *cv1alpha1.CincinnatiStatus, reason string, e error) { +func handleErr(reqLogger logr.Logger, status *cv1beta1.CincinnatiStatus, reason string, e error) { conditionsv1.SetStatusCondition(&status.Conditions, conditionsv1.Condition{ - Type: cv1alpha1.ConditionReconcileCompleted, + Type: cv1beta1.ConditionReconcileCompleted, Status: corev1.ConditionFalse, Reason: reason, Message: e.Error(), @@ -192,7 +192,7 @@ func handleErr(reqLogger logr.Logger, status *cv1alpha1.CincinnatiStatus, reason reqLogger.Error(e, reason) } -func (r *ReconcileCincinnati) ensureAdditionalTrustedCA(ctx context.Context, reqLogger logr.Logger, instance *cv1alpha1.Cincinnati, resources *kubeResources) error { +func (r *ReconcileCincinnati) ensureAdditionalTrustedCA(ctx context.Context, reqLogger logr.Logger, instance *cv1beta1.Cincinnati, resources *kubeResources) error { // Check if the Cluster is aware of a registry requiring an // AdditionalTrustedCA image := &apicfgv1.Image{} @@ -247,7 +247,7 @@ func (r *ReconcileCincinnati) ensureAdditionalTrustedCA(ctx context.Context, req return nil } -func (r *ReconcileCincinnati) ensureDeployment(ctx context.Context, reqLogger logr.Logger, instance *cv1alpha1.Cincinnati, resources *kubeResources) error { +func (r *ReconcileCincinnati) ensureDeployment(ctx context.Context, reqLogger logr.Logger, instance *cv1beta1.Cincinnati, resources *kubeResources) error { deployment := resources.deployment if err := controllerutil.SetControllerReference(instance, deployment, r.scheme); err != nil { return err @@ -347,7 +347,7 @@ func (r *ReconcileCincinnati) ensureDeployment(ctx context.Context, reqLogger lo return nil } -func (r *ReconcileCincinnati) ensurePodDisruptionBudget(ctx context.Context, reqLogger logr.Logger, instance *cv1alpha1.Cincinnati, resources *kubeResources) error { +func (r *ReconcileCincinnati) ensurePodDisruptionBudget(ctx context.Context, reqLogger logr.Logger, instance *cv1beta1.Cincinnati, resources *kubeResources) error { pdb := resources.podDisruptionBudget // Set Cincinnati instance as the owner and controller if err := controllerutil.SetControllerReference(instance, pdb, r.scheme); err != nil { @@ -382,7 +382,7 @@ func (r *ReconcileCincinnati) ensurePodDisruptionBudget(ctx context.Context, req return nil } -func (r *ReconcileCincinnati) ensureConfig(ctx context.Context, reqLogger logr.Logger, instance *cv1alpha1.Cincinnati, resources *kubeResources) error { +func (r *ReconcileCincinnati) ensureConfig(ctx context.Context, reqLogger logr.Logger, instance *cv1beta1.Cincinnati, resources *kubeResources) error { config := resources.graphBuilderConfig // Set Cincinnati instance as the owner and controller if err := controllerutil.SetControllerReference(instance, config, r.scheme); err != nil { @@ -396,7 +396,7 @@ func (r *ReconcileCincinnati) ensureConfig(ctx context.Context, reqLogger logr.L return nil } -func (r *ReconcileCincinnati) ensureEnvConfig(ctx context.Context, reqLogger logr.Logger, instance *cv1alpha1.Cincinnati, resources *kubeResources) error { +func (r *ReconcileCincinnati) ensureEnvConfig(ctx context.Context, reqLogger logr.Logger, instance *cv1beta1.Cincinnati, resources *kubeResources) error { config := resources.envConfig // Set Cincinnati instance as the owner and controller if err := controllerutil.SetControllerReference(instance, config, r.scheme); err != nil { @@ -410,7 +410,7 @@ func (r *ReconcileCincinnati) ensureEnvConfig(ctx context.Context, reqLogger log return nil } -func (r *ReconcileCincinnati) ensureGraphBuilderService(ctx context.Context, reqLogger logr.Logger, instance *cv1alpha1.Cincinnati, resources *kubeResources) error { +func (r *ReconcileCincinnati) ensureGraphBuilderService(ctx context.Context, reqLogger logr.Logger, instance *cv1beta1.Cincinnati, resources *kubeResources) error { service := resources.graphBuilderService // Set Cincinnati instance as the owner and controller if err := controllerutil.SetControllerReference(instance, service, r.scheme); err != nil { @@ -424,7 +424,7 @@ func (r *ReconcileCincinnati) ensureGraphBuilderService(ctx context.Context, req return nil } -func (r *ReconcileCincinnati) ensurePolicyEngineService(ctx context.Context, reqLogger logr.Logger, instance *cv1alpha1.Cincinnati, resources *kubeResources) error { +func (r *ReconcileCincinnati) ensurePolicyEngineService(ctx context.Context, reqLogger logr.Logger, instance *cv1beta1.Cincinnati, resources *kubeResources) error { service := resources.policyEngineService // Set Cincinnati instance as the owner and controller if err := controllerutil.SetControllerReference(instance, service, r.scheme); err != nil { diff --git a/pkg/controller/cincinnati/cincinnati_controller_test.go b/pkg/controller/cincinnati/cincinnati_controller_test.go index e662b66e..0a2c9b0b 100644 --- a/pkg/controller/cincinnati/cincinnati_controller_test.go +++ b/pkg/controller/cincinnati/cincinnati_controller_test.go @@ -8,7 +8,7 @@ import ( configv1 "github.com/openshift/api/config/v1" "github.com/openshift/cincinnati-operator/pkg/apis" - cv1alpha1 "github.com/openshift/cincinnati-operator/pkg/apis/cincinnati/v1alpha1" + cv1beta1 "github.com/openshift/cincinnati-operator/pkg/apis/cincinnati/v1beta1" "github.com/openshift/cluster-image-registry-operator/pkg/defaults" conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1" "github.com/stretchr/testify/assert" @@ -56,7 +56,7 @@ func TestMain(m *testing.M) { func TestReconcileComplete(t *testing.T) { tests := []struct { name string - cincinnati *cv1alpha1.Cincinnati + cincinnati *cv1beta1.Cincinnati expectedConditions []conditionsv1.Condition }{ { @@ -64,7 +64,7 @@ func TestReconcileComplete(t *testing.T) { cincinnati: newDefaultCincinnati(), expectedConditions: []conditionsv1.Condition{ { - Type: cv1alpha1.ConditionReconcileCompleted, + Type: cv1beta1.ConditionReconcileCompleted, Status: corev1.ConditionTrue, }, }, @@ -80,7 +80,7 @@ func TestReconcileComplete(t *testing.T) { if err != nil { t.Fatal(err) } - instance := &cv1alpha1.Cincinnati{} + instance := &cv1beta1.Cincinnati{} err = r.client.Get(context.TODO(), request.NamespacedName, instance) if err != nil { t.Fatal(err) @@ -199,7 +199,7 @@ func TestEnsureAdditionalTrustedCA(t *testing.T) { func TestEnsureDeployment(t *testing.T) { tests := []struct { name string - cincinnati *cv1alpha1.Cincinnati + cincinnati *cv1beta1.Cincinnati caCert bool }{ { @@ -209,7 +209,7 @@ func TestEnsureDeployment(t *testing.T) { }, { name: "EnsureDeploymentWithGraphDataImage", - cincinnati: func() *cv1alpha1.Cincinnati { + cincinnati: func() *cv1beta1.Cincinnati { cincinnati := newDefaultCincinnati() cincinnati.Spec.GraphDataImage = testGraphDataImage return cincinnati @@ -311,7 +311,7 @@ func TestEnsurePolicyEngineService(t *testing.T) { func TestEnsurePodDisruptionBudget(t *testing.T) { tests := []struct { name string - cincinnati *cv1alpha1.Cincinnati + cincinnati *cv1beta1.Cincinnati }{ { name: "EnsurePodDisruptionBudgetReplicas1", @@ -319,7 +319,7 @@ func TestEnsurePodDisruptionBudget(t *testing.T) { }, { name: "EnsurePodDisruptionBudgetReplicas10", - cincinnati: func() *cv1alpha1.Cincinnati { + cincinnati: func() *cv1beta1.Cincinnati { cincinnati := newDefaultCincinnati() cincinnati.Spec.Replicas = 10 return cincinnati @@ -352,7 +352,7 @@ func TestEnsurePodDisruptionBudget(t *testing.T) { } } -func newRequest(cincinnati *cv1alpha1.Cincinnati) reconcile.Request { +func newRequest(cincinnati *cv1beta1.Cincinnati) reconcile.Request { namespacedName := types.NamespacedName{ Namespace: cincinnati.ObjectMeta.Namespace, Name: cincinnati.ObjectMeta.Name, @@ -368,8 +368,8 @@ func newTestReconciler(initObjs ...runtime.Object) *ReconcileCincinnati { } } -func newDefaultCincinnati() *cv1alpha1.Cincinnati { - return &cv1alpha1.Cincinnati{ +func newDefaultCincinnati() *cv1beta1.Cincinnati { + return &cv1beta1.Cincinnati{ TypeMeta: metav1.TypeMeta{ Kind: testCincinnatiKind, APIVersion: testCincinnatiAPIVersion, @@ -378,7 +378,7 @@ func newDefaultCincinnati() *cv1alpha1.Cincinnati { Name: testName, Namespace: testNamespace, }, - Spec: cv1alpha1.CincinnatiSpec{ + Spec: cv1beta1.CincinnatiSpec{ Replicas: testReplicas, Registry: testRegistry, Repository: testRepository, @@ -412,14 +412,14 @@ func newConfigMap() *corev1.ConfigMap { } } -func verifyConditions(t *testing.T, expectedConditions []conditionsv1.Condition, cincinnati *cv1alpha1.Cincinnati) { +func verifyConditions(t *testing.T, expectedConditions []conditionsv1.Condition, cincinnati *cv1beta1.Cincinnati) { for _, condition := range expectedConditions { assert.True(t, conditionsv1.IsStatusConditionPresentAndEqual(cincinnati.Status.Conditions, condition.Type, condition.Status)) } assert.Equal(t, len(expectedConditions), len(cincinnati.Status.Conditions)) } -func verifyOwnerReference(t *testing.T, ownerReference metav1.OwnerReference, cincinnati *cv1alpha1.Cincinnati) { +func verifyOwnerReference(t *testing.T, ownerReference metav1.OwnerReference, cincinnati *cv1beta1.Cincinnati) { assert.Equal(t, ownerReference.Name, cincinnati.Name) //Note: These properties seem to be derived from runtime object and do not seem to match the expected values. //assert.Equal(t, ownerReference.Kind, cincinnati.Kind) diff --git a/pkg/controller/cincinnati/mapper.go b/pkg/controller/cincinnati/mapper.go index c1e2a0f0..79c30c6f 100644 --- a/pkg/controller/cincinnati/mapper.go +++ b/pkg/controller/cincinnati/mapper.go @@ -10,7 +10,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" apicfgv1 "github.com/openshift/api/config/v1" - cv1alpha1 "github.com/openshift/cincinnati-operator/pkg/apis/cincinnati/v1alpha1" + cv1beta1 "github.com/openshift/cincinnati-operator/pkg/apis/cincinnati/v1beta1" "github.com/openshift/cluster-image-registry-operator/pkg/defaults" ) @@ -50,7 +50,7 @@ func (m *mapper) Map(obj handler.MapObject) []reconcile.Request { } func (m *mapper) requeueCincinnatis() []reconcile.Request { - cincinnatis := &cv1alpha1.CincinnatiList{} + cincinnatis := &cv1beta1.CincinnatiList{} err := m.client.List(context.TODO(), cincinnatis) if err != nil { return []reconcile.Request{} diff --git a/pkg/controller/cincinnati/names.go b/pkg/controller/cincinnati/names.go index 10f53776..5f38420e 100644 --- a/pkg/controller/cincinnati/names.go +++ b/pkg/controller/cincinnati/names.go @@ -1,7 +1,7 @@ package cincinnati import ( - cv1alpha1 "github.com/openshift/cincinnati-operator/pkg/apis/cincinnati/v1alpha1" + cv1beta1 "github.com/openshift/cincinnati-operator/pkg/apis/cincinnati/v1beta1" "k8s.io/apimachinery/pkg/util/intstr" ) @@ -20,37 +20,37 @@ const ( NameCertConfigMapKey = "cincinnati-registry" ) -func nameDeployment(instance *cv1alpha1.Cincinnati) string { +func nameDeployment(instance *cv1beta1.Cincinnati) string { return instance.Name } -func namePodDisruptionBudget(instance *cv1alpha1.Cincinnati) string { +func namePodDisruptionBudget(instance *cv1beta1.Cincinnati) string { return instance.Name } -func nameEnvConfig(instance *cv1alpha1.Cincinnati) string { +func nameEnvConfig(instance *cv1beta1.Cincinnati) string { return instance.Name + "-env" } -func nameConfig(instance *cv1alpha1.Cincinnati) string { +func nameConfig(instance *cv1beta1.Cincinnati) string { return instance.Name + "-config" } -func namePolicyEngineService(instance *cv1alpha1.Cincinnati) string { +func namePolicyEngineService(instance *cv1beta1.Cincinnati) string { return instance.Name + "-policy-engine" } -func nameGraphBuilderService(instance *cv1alpha1.Cincinnati) string { +func nameGraphBuilderService(instance *cv1beta1.Cincinnati) string { return instance.Name + "-graph-builder" } -func nameAdditionalTrustedCA(instance *cv1alpha1.Cincinnati) string { +func nameAdditionalTrustedCA(instance *cv1beta1.Cincinnati) string { return instance.Name + "-trusted-ca" } // When running a single replica, allow 0 available so we don't block node // drains. Otherwise require 1. -func getMinAvailablePBD(instance *cv1alpha1.Cincinnati) intstr.IntOrString { +func getMinAvailablePBD(instance *cv1beta1.Cincinnati) intstr.IntOrString { minAvailable := intstr.FromInt(0) if instance.Spec.Replicas >= 2 { minAvailable = intstr.FromInt(1) diff --git a/pkg/controller/cincinnati/new.go b/pkg/controller/cincinnati/new.go index c34ac84e..bfa69643 100644 --- a/pkg/controller/cincinnati/new.go +++ b/pkg/controller/cincinnati/new.go @@ -15,7 +15,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" - cv1alpha1 "github.com/openshift/cincinnati-operator/pkg/apis/cincinnati/v1alpha1" + cv1beta1 "github.com/openshift/cincinnati-operator/pkg/apis/cincinnati/v1beta1" ) const ( @@ -77,7 +77,7 @@ type kubeResources struct { policyEngineService *corev1.Service } -func newKubeResources(instance *cv1alpha1.Cincinnati, image string) (*kubeResources, error) { +func newKubeResources(instance *cv1beta1.Cincinnati, image string) (*kubeResources, error) { k := kubeResources{} gbConfig, err := k.newGraphBuilderConfig(instance) @@ -110,7 +110,7 @@ func newKubeResources(instance *cv1alpha1.Cincinnati, image string) (*kubeResour return &k, nil } -func (k *kubeResources) newPodDisruptionBudget(instance *cv1alpha1.Cincinnati) *policyv1beta1.PodDisruptionBudget { +func (k *kubeResources) newPodDisruptionBudget(instance *cv1beta1.Cincinnati) *policyv1beta1.PodDisruptionBudget { minAvailable := getMinAvailablePBD(instance) return &policyv1beta1.PodDisruptionBudget{ ObjectMeta: metav1.ObjectMeta{ @@ -128,7 +128,7 @@ func (k *kubeResources) newPodDisruptionBudget(instance *cv1alpha1.Cincinnati) * } } -func (k *kubeResources) newGraphBuilderService(instance *cv1alpha1.Cincinnati) *corev1.Service { +func (k *kubeResources) newGraphBuilderService(instance *cv1beta1.Cincinnati) *corev1.Service { name := nameGraphBuilderService(instance) return &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ @@ -162,7 +162,7 @@ func (k *kubeResources) newGraphBuilderService(instance *cv1alpha1.Cincinnati) * } } -func (k *kubeResources) newPolicyEngineService(instance *cv1alpha1.Cincinnati) *corev1.Service { +func (k *kubeResources) newPolicyEngineService(instance *cv1beta1.Cincinnati) *corev1.Service { name := namePolicyEngineService(instance) return &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ @@ -196,7 +196,7 @@ func (k *kubeResources) newPolicyEngineService(instance *cv1alpha1.Cincinnati) * } } -func (k *kubeResources) newEnvConfig(instance *cv1alpha1.Cincinnati) *corev1.ConfigMap { +func (k *kubeResources) newEnvConfig(instance *cv1beta1.Cincinnati) *corev1.ConfigMap { return &corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ Name: nameEnvConfig(instance), @@ -214,7 +214,7 @@ func (k *kubeResources) newEnvConfig(instance *cv1alpha1.Cincinnati) *corev1.Con } } -func (k *kubeResources) newGraphBuilderConfig(instance *cv1alpha1.Cincinnati) (*corev1.ConfigMap, error) { +func (k *kubeResources) newGraphBuilderConfig(instance *cv1beta1.Cincinnati) (*corev1.ConfigMap, error) { tmpl, err := template.New("gb").Parse(graphBuilderTOML) if err != nil { return nil, err @@ -234,7 +234,7 @@ func (k *kubeResources) newGraphBuilderConfig(instance *cv1alpha1.Cincinnati) (* }, nil } -func (k *kubeResources) newDeployment(instance *cv1alpha1.Cincinnati, externalCACert bool) *appsv1.Deployment { +func (k *kubeResources) newDeployment(instance *cv1beta1.Cincinnati, externalCACert bool) *appsv1.Deployment { name := nameDeployment(instance) maxUnavailable := intstr.FromString("50%") maxSurge := intstr.FromString("100%") @@ -326,7 +326,7 @@ func (k *kubeResources) newDeployment(instance *cv1alpha1.Cincinnati, externalCA return dep } -func (k *kubeResources) newGraphDataInitContainer(instance *cv1alpha1.Cincinnati) *corev1.Container { +func (k *kubeResources) newGraphDataInitContainer(instance *cv1beta1.Cincinnati) *corev1.Container { return &corev1.Container{ Name: NameInitContainerGraphData, Image: instance.Spec.GraphDataImage, @@ -340,7 +340,7 @@ func (k *kubeResources) newGraphDataInitContainer(instance *cv1alpha1.Cincinnati } } -func (k *kubeResources) newGraphBuilderContainer(instance *cv1alpha1.Cincinnati, image string, externalCACert bool) *corev1.Container { +func (k *kubeResources) newGraphBuilderContainer(instance *cv1beta1.Cincinnati, image string, externalCACert bool) *corev1.Container { g := &corev1.Container{ Name: NameContainerGraphBuilder, Image: image, @@ -428,7 +428,7 @@ func (k *kubeResources) newGraphBuilderContainer(instance *cv1alpha1.Cincinnati, return g } -func (k *kubeResources) newPolicyEngineContainer(instance *cv1alpha1.Cincinnati, image string) *corev1.Container { +func (k *kubeResources) newPolicyEngineContainer(instance *cv1beta1.Cincinnati, image string) *corev1.Container { envConfigName := nameEnvConfig(instance) return &corev1.Container{ Name: NameContainerPolicyEngine,