From 993a0b35de61a14164584ac07a69a0f8e65ac081 Mon Sep 17 00:00:00 2001 From: MUzairS15 Date: Fri, 15 Mar 2024 17:14:41 +0530 Subject: [PATCH] upgrade v1beta1 Signed-off-by: MUzairS15 --- PROJECT | 8 +- api/{v1alpha1 => v1beta1}/broker_types.go | 2 +- .../broker_types_test.go | 2 +- api/{v1alpha1 => v1beta1}/common.go | 2 +- .../groupversion_info.go | 6 +- api/{v1alpha1 => v1beta1}/meshsync_types.go | 2 +- .../meshsync_types_test.go | 4 +- api/{v1alpha1 => v1beta1}/suite_test.go | 2 +- .../zz_generated.deepcopy.go | 2 +- ...eshery-operator.clusterserviceversion.yaml | 10 +- .../manifests/meshery.layer5.io_brokers.yaml | 130 ++--- .../meshery.layer5.io_meshsyncs.yaml | 148 ++--- .../crd/bases/meshery.layer5.io_brokers.yaml | 2 +- .../bases/meshery.layer5.io_meshsyncs.yaml | 2 +- ...eshery-operator.clusterserviceversion.yaml | 49 +- config/manifests/crd.yaml | 56 +- config/manifests/default.yaml | 536 +++++++++--------- config/samples/kustomization.yaml | 4 +- config/samples/meshery_v1alpha1_broker.yaml | 2 +- config/samples/meshery_v1alpha1_meshsync.yaml | 6 +- controllers/broker_controller.go | 10 +- controllers/broker_controller_test.go | 20 +- controllers/meshsync_controller.go | 16 +- controllers/meshsync_controller_test.go | 18 +- controllers/suit_test.go | 4 +- main.go | 4 +- pkg/broker/broker.go | 8 +- pkg/broker/broker_test.go | 14 +- pkg/broker/suit_test.go | 4 +- pkg/client/client.go | 20 +- pkg/client/{v1alpha1 => v1beta1}/broker.go | 34 +- pkg/client/{v1alpha1 => v1beta1}/meshsync.go | 34 +- .../v1alpha1.go => v1beta1/v1beta1.go} | 2 +- pkg/meshsync/meshsync.go | 4 +- pkg/meshsync/meshsync_test.go | 6 +- 35 files changed, 593 insertions(+), 580 deletions(-) rename api/{v1alpha1 => v1beta1}/broker_types.go (99%) rename api/{v1alpha1 => v1beta1}/broker_types_test.go (99%) rename api/{v1alpha1 => v1beta1}/common.go (98%) rename api/{v1alpha1 => v1beta1}/groupversion_info.go (89%) rename api/{v1alpha1 => v1beta1}/meshsync_types.go (99%) rename api/{v1alpha1 => v1beta1}/meshsync_types_test.go (98%) rename api/{v1alpha1 => v1beta1}/suite_test.go (98%) rename api/{v1alpha1 => v1beta1}/zz_generated.deepcopy.go (99%) rename pkg/client/{v1alpha1 => v1beta1}/broker.go (78%) rename pkg/client/{v1alpha1 => v1beta1}/meshsync.go (77%) rename pkg/client/{v1alpha1/v1alpha1.go => v1beta1/v1beta1.go} (97%) diff --git a/PROJECT b/PROJECT index 416d69f0..6bf3ca00 100644 --- a/PROJECT +++ b/PROJECT @@ -9,14 +9,14 @@ resources: group: meshery kind: MeshSync # TODO(user): Update the package path for your API if the below value is incorrect. - path: github.com/layer5io/meshery-operator/api/v1alpha1 - version: v1alpha1 + path: github.com/layer5io/meshery-operator/api/v1beta1 + version: v1beta1 - domain: layer5.io group: meshery kind: Broker # TODO(user): Update the package path for your API if the below value is incorrect. - path: github.com/layer5io/meshery-operator/api/v1alpha1 - version: v1alpha1 + path: github.com/layer5io/meshery-operator/api/v1beta1 + version: v1beta1 version: "3" plugins: go.sdk.operatorframework.io/v3-alpha: {} diff --git a/api/v1alpha1/broker_types.go b/api/v1beta1/broker_types.go similarity index 99% rename from api/v1alpha1/broker_types.go rename to api/v1beta1/broker_types.go index 7d8fbe51..9130afb4 100644 --- a/api/v1alpha1/broker_types.go +++ b/api/v1beta1/broker_types.go @@ -12,7 +12,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/api/v1alpha1/broker_types_test.go b/api/v1beta1/broker_types_test.go similarity index 99% rename from api/v1alpha1/broker_types_test.go rename to api/v1beta1/broker_types_test.go index 74ef77cf..d76d372d 100644 --- a/api/v1alpha1/broker_types_test.go +++ b/api/v1beta1/broker_types_test.go @@ -11,7 +11,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1beta1 // Import go packages diff --git a/api/v1alpha1/common.go b/api/v1beta1/common.go similarity index 98% rename from api/v1alpha1/common.go rename to api/v1beta1/common.go index 24e1d090..efe2b0e2 100644 --- a/api/v1alpha1/common.go +++ b/api/v1beta1/common.go @@ -1,4 +1,4 @@ -package v1alpha1 +package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/api/v1alpha1/groupversion_info.go b/api/v1beta1/groupversion_info.go similarity index 89% rename from api/v1alpha1/groupversion_info.go rename to api/v1beta1/groupversion_info.go index d1dc2166..235d7d04 100644 --- a/api/v1alpha1/groupversion_info.go +++ b/api/v1beta1/groupversion_info.go @@ -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 meshery v1alpha1 API group +// package v1beta1 contains API Schema definitions for the meshery v1beta1 API group // +kubebuilder:object:generate=true // +groupName=meshery.layer5.io -package v1alpha1 +package v1beta1 import ( "k8s.io/apimachinery/pkg/runtime/schema" @@ -26,7 +26,7 @@ import ( var ( // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "meshery.layer5.io", Version: "v1alpha1"} + GroupVersion = schema.GroupVersion{Group: "meshery.layer5.io", Version: "v1beta1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} diff --git a/api/v1alpha1/meshsync_types.go b/api/v1beta1/meshsync_types.go similarity index 99% rename from api/v1alpha1/meshsync_types.go rename to api/v1beta1/meshsync_types.go index 37229218..d9ea1429 100644 --- a/api/v1alpha1/meshsync_types.go +++ b/api/v1beta1/meshsync_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1beta1 import ( corev1 "k8s.io/api/core/v1" diff --git a/api/v1alpha1/meshsync_types_test.go b/api/v1beta1/meshsync_types_test.go similarity index 98% rename from api/v1alpha1/meshsync_types_test.go rename to api/v1beta1/meshsync_types_test.go index 57a613f2..b0545680 100644 --- a/api/v1alpha1/meshsync_types_test.go +++ b/api/v1beta1/meshsync_types_test.go @@ -1,4 +1,4 @@ -package v1alpha1 +package v1beta1 import ( "context" @@ -29,7 +29,7 @@ var _ = Describe("The test case for the meshsync CRDs", func() { FileManager string = "testcase-meshsync" Kind string = "MeshSync" - APIVersion string = "meshery.layer5.io/v1alpha1" + APIVersion string = "meshery.layer5.io/v1beta1" ) meshSync := &MeshSync{ diff --git a/api/v1alpha1/suite_test.go b/api/v1beta1/suite_test.go similarity index 98% rename from api/v1alpha1/suite_test.go rename to api/v1beta1/suite_test.go index ab444205..fa9d9829 100644 --- a/api/v1alpha1/suite_test.go +++ b/api/v1beta1/suite_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1beta1 import ( "testing" diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go similarity index 99% rename from api/v1alpha1/zz_generated.deepcopy.go rename to api/v1beta1/zz_generated.deepcopy.go index 071e494e..0808254b 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -19,7 +19,7 @@ limitations under the License. // Code generated by controller-gen. DO NOT EDIT. -package v1alpha1 +package v1beta1 import ( runtime "k8s.io/apimachinery/pkg/runtime" diff --git a/bundle/0.0.1/manifests/meshery-operator.clusterserviceversion.yaml b/bundle/0.0.1/manifests/meshery-operator.clusterserviceversion.yaml index 5c2b753c..c74c6e1a 100644 --- a/bundle/0.0.1/manifests/meshery-operator.clusterserviceversion.yaml +++ b/bundle/0.0.1/manifests/meshery-operator.clusterserviceversion.yaml @@ -1,11 +1,11 @@ -apiVersion: operators.coreos.com/v1alpha1 +apiVersion: operators.coreos.com/v1beta1 kind: ClusterServiceVersion metadata: annotations: alm-examples: |- [ { - "apiVersion": "meshery.layer5.io/v1alpha1", + "apiVersion": "meshery.layer5.io/v1beta1", "kind": "Broker", "metadata": { "annotations": { @@ -24,7 +24,7 @@ metadata: } }, { - "apiVersion": "meshery.layer5.io/v1alpha1", + "apiVersion": "meshery.layer5.io/v1beta1", "kind": "MeshSync", "metadata": { "annotations": { @@ -66,12 +66,12 @@ spec: owned: - kind: Broker name: brokers.meshery.layer5.io - version: v1alpha1 + version: v1beta1 - description: MeshSync is the Schema for the meshsyncs API displayName: Mesh Sync kind: MeshSync name: meshsyncs.meshery.layer5.io - version: v1alpha1 + version: v1beta1 description: Meshery Operator is the multi-service mesh operator and implementation of MeshSync. displayName: meshery-operator diff --git a/bundle/0.0.1/manifests/meshery.layer5.io_brokers.yaml b/bundle/0.0.1/manifests/meshery.layer5.io_brokers.yaml index 6917ef3d..64556cd4 100644 --- a/bundle/0.0.1/manifests/meshery.layer5.io_brokers.yaml +++ b/bundle/0.0.1/manifests/meshery.layer5.io_brokers.yaml @@ -14,74 +14,76 @@ spec: singular: broker scope: Namespaced versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - description: Broker is the Schema for the brokers API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: BrokerSpec defines the desired state of Broker - properties: - size: - format: int32 - type: integer - type: object - status: - description: BrokerStatus defines the observed state of Broker - properties: - conditions: - items: + - name: v1beta1 + schema: + openAPIV3Schema: + description: Broker is the Schema for the brokers API + properties: + apiVersion: + description: + "APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" + type: string + kind: + description: + "Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" + type: string + metadata: + type: object + spec: + description: BrokerSpec defines the desired state of Broker + properties: + size: + format: int32 + type: integer + type: object + status: + description: BrokerStatus defines the observed state of Broker + properties: + conditions: + items: + properties: + lastProbeTime: + format: date-time + type: string + lastTransitionTime: + format: date-time + type: string + message: + type: string + observedGeneration: + format: int64 + type: integer + reason: + type: string + status: + type: string + type: + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + endpoint: properties: - lastProbeTime: - format: date-time + external: type: string - lastTransitionTime: - format: date-time + internal: type: string - message: - type: string - observedGeneration: - format: int64 - type: integer - reason: - type: string - status: - type: string - type: - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type type: object - type: array - endpoint: - properties: - external: - type: string - internal: - type: string - type: object - type: object - type: object - served: true - storage: true - subresources: - status: {} + type: object + type: object + served: true + storage: true + subresources: + status: {} status: acceptedNames: kind: "" diff --git a/bundle/0.0.1/manifests/meshery.layer5.io_meshsyncs.yaml b/bundle/0.0.1/manifests/meshery.layer5.io_meshsyncs.yaml index 9715ffa5..70a0ac76 100644 --- a/bundle/0.0.1/manifests/meshery.layer5.io_meshsyncs.yaml +++ b/bundle/0.0.1/manifests/meshery.layer5.io_meshsyncs.yaml @@ -14,84 +14,86 @@ spec: singular: meshsync scope: Namespaced versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - description: MeshSync is the Schema for the meshsyncs API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: MeshSyncSpec defines the desired state of MeshSync - properties: - broker: - properties: - custom: + - name: v1beta1 + schema: + openAPIV3Schema: + description: MeshSync is the Schema for the meshsyncs API + properties: + apiVersion: + description: + "APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" + type: string + kind: + description: + "Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" + type: string + metadata: + type: object + spec: + description: MeshSyncSpec defines the desired state of MeshSync + properties: + broker: + properties: + custom: + properties: + url: + type: string + type: object + native: + properties: + name: + type: string + namespace: + type: string + type: object + type: object + size: + format: int32 + type: integer + type: object + status: + description: MeshSyncStatus defines the observed state of MeshSync + properties: + conditions: + items: properties: - url: + lastProbeTime: + format: date-time type: string - type: object - native: - properties: - name: + lastTransitionTime: + format: date-time + type: string + message: type: string - namespace: + observedGeneration: + format: int64 + type: integer + reason: type: string + status: + type: string + type: + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type type: object - type: object - size: - format: int32 - type: integer - type: object - status: - description: MeshSyncStatus defines the observed state of MeshSync - properties: - conditions: - items: - properties: - lastProbeTime: - format: date-time - type: string - lastTransitionTime: - format: date-time - type: string - message: - type: string - observedGeneration: - format: int64 - type: integer - reason: - type: string - status: - type: string - type: - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - publishing-to: - type: string - type: object - type: object - served: true - storage: true - subresources: - status: {} + type: array + publishing-to: + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} status: acceptedNames: kind: "" diff --git a/config/crd/bases/meshery.layer5.io_brokers.yaml b/config/crd/bases/meshery.layer5.io_brokers.yaml index 30bbe501..54a2999f 100644 --- a/config/crd/bases/meshery.layer5.io_brokers.yaml +++ b/config/crd/bases/meshery.layer5.io_brokers.yaml @@ -15,7 +15,7 @@ spec: singular: broker scope: Namespaced versions: - - name: v1alpha1 + - name: v1beta1 schema: openAPIV3Schema: description: Broker is the Schema for the brokers API diff --git a/config/crd/bases/meshery.layer5.io_meshsyncs.yaml b/config/crd/bases/meshery.layer5.io_meshsyncs.yaml index 4358c0da..e6adb2df 100644 --- a/config/crd/bases/meshery.layer5.io_meshsyncs.yaml +++ b/config/crd/bases/meshery.layer5.io_meshsyncs.yaml @@ -15,7 +15,7 @@ spec: singular: meshsync scope: Namespaced versions: - - name: v1alpha1 + - name: v1beta1 schema: openAPIV3Schema: description: MeshSync is the Schema for the meshsyncs API diff --git a/config/manifests/bases/meshery-operator.clusterserviceversion.yaml b/config/manifests/bases/meshery-operator.clusterserviceversion.yaml index df5cc647..e88a22bf 100644 --- a/config/manifests/bases/meshery-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/meshery-operator.clusterserviceversion.yaml @@ -1,8 +1,8 @@ -apiVersion: operators.coreos.com/v1alpha1 +apiVersion: operators.coreos.com/v1beta1 kind: ClusterServiceVersion metadata: annotations: - alm-examples: '[]' + alm-examples: "[]" capabilities: Basic Install name: meshery-operator.v0.0.0 namespace: placeholder @@ -10,39 +10,40 @@ spec: apiservicedefinitions: {} customresourcedefinitions: owned: - - description: MeshSync is the Schema for the meshsyncs API - displayName: Mesh Sync - kind: MeshSync - name: meshsyncs.meshery.layer5.io - version: v1alpha1 - description: Meshery Operator is the multi-service mesh operator and implementation + - description: MeshSync is the Schema for the meshsyncs API + displayName: Mesh Sync + kind: MeshSync + name: meshsyncs.meshery.layer5.io + version: v1beta1 + description: + Meshery Operator is the multi-service mesh operator and implementation of MeshSync. displayName: meshery-operator icon: - - base64data: "" - mediatype: "" + - base64data: "" + mediatype: "" install: spec: deployments: null strategy: "" installModes: - - supported: false - type: OwnNamespace - - supported: false - type: SingleNamespace - - supported: false - type: MultiNamespace - - supported: true - type: AllNamespaces + - supported: false + type: OwnNamespace + - supported: false + type: SingleNamespace + - supported: false + type: MultiNamespace + - supported: true + type: AllNamespaces keywords: - - servicemesh - - meshSync + - servicemesh + - meshSync links: - - name: Meshery Operator - url: https://meshery-operator.domain + - name: Meshery Operator + url: https://meshery-operator.domain maintainers: - - email: urakiny@gmai.com1 - name: aisuko + - email: urakiny@gmai.com1 + name: aisuko maturity: alpha provider: name: meshery diff --git a/config/manifests/crd.yaml b/config/manifests/crd.yaml index 3c7f4877..740574cd 100644 --- a/config/manifests/crd.yaml +++ b/config/manifests/crd.yaml @@ -20,14 +20,16 @@ spec: description: Broker is the Schema for the brokers API properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation + description: + "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" type: string kind: - description: 'Kind is a string value representing the REST resource this + description: + "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" type: string metadata: type: object @@ -62,11 +64,11 @@ spec: type: type: string required: - - lastTransitionTime - - message - - reason - - status - - type + - lastTransitionTime + - message + - reason + - status + - type type: object type: array endpoint: @@ -78,11 +80,11 @@ spec: type: object type: object type: object - version: v1alpha1 + version: v1beta1 versions: - - name: v1alpha1 - served: true - storage: true + - name: v1beta1 + served: true + storage: true status: acceptedNames: kind: "" @@ -112,14 +114,16 @@ spec: description: MeshSync is the Schema for the meshsyncs API properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation + description: + "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" type: string kind: - description: 'Kind is a string value representing the REST resource this + description: + "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" type: string metadata: type: object @@ -169,22 +173,22 @@ spec: type: type: string required: - - lastTransitionTime - - message - - reason - - status - - type + - lastTransitionTime + - message + - reason + - status + - type type: object type: array publishing-to: type: string type: object type: object - version: v1alpha1 + version: v1beta1 versions: - - name: v1alpha1 - served: true - storage: true + - name: v1beta1 + served: true + storage: true status: acceptedNames: kind: "" diff --git a/config/manifests/default.yaml b/config/manifests/default.yaml index 8bdc97a0..f1331ffb 100644 --- a/config/manifests/default.yaml +++ b/config/manifests/default.yaml @@ -14,74 +14,76 @@ spec: singular: broker scope: Namespaced versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - description: Broker is the Schema for the brokers API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: BrokerSpec defines the desired state of Broker - properties: - size: - format: int32 - type: integer - type: object - status: - description: BrokerStatus defines the observed state of Broker - properties: - conditions: - items: + - name: v1beta1 + schema: + openAPIV3Schema: + description: Broker is the Schema for the brokers API + properties: + apiVersion: + description: + "APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" + type: string + kind: + description: + "Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" + type: string + metadata: + type: object + spec: + description: BrokerSpec defines the desired state of Broker + properties: + size: + format: int32 + type: integer + type: object + status: + description: BrokerStatus defines the observed state of Broker + properties: + conditions: + items: + properties: + lastProbeTime: + format: date-time + type: string + lastTransitionTime: + format: date-time + type: string + message: + type: string + observedGeneration: + format: int64 + type: integer + reason: + type: string + status: + type: string + type: + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + endpoint: properties: - lastProbeTime: - format: date-time - type: string - lastTransitionTime: - format: date-time + external: type: string - message: + internal: type: string - observedGeneration: - format: int64 - type: integer - reason: - type: string - status: - type: string - type: - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type type: object - type: array - endpoint: - properties: - external: - type: string - internal: - type: string - type: object - type: object - type: object - served: true - storage: true - subresources: - status: {} + type: object + type: object + served: true + storage: true + subresources: + status: {} status: acceptedNames: kind: "" @@ -105,84 +107,86 @@ spec: singular: meshsync scope: Namespaced versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - description: MeshSync is the Schema for the meshsyncs API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: MeshSyncSpec defines the desired state of MeshSync - properties: - broker: - properties: - custom: + - name: v1beta1 + schema: + openAPIV3Schema: + description: MeshSync is the Schema for the meshsyncs API + properties: + apiVersion: + description: + "APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" + type: string + kind: + description: + "Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" + type: string + metadata: + type: object + spec: + description: MeshSyncSpec defines the desired state of MeshSync + properties: + broker: + properties: + custom: + properties: + url: + type: string + type: object + native: + properties: + name: + type: string + namespace: + type: string + type: object + type: object + size: + format: int32 + type: integer + type: object + status: + description: MeshSyncStatus defines the observed state of MeshSync + properties: + conditions: + items: properties: - url: + lastProbeTime: + format: date-time type: string - type: object - native: - properties: - name: + lastTransitionTime: + format: date-time + type: string + message: + type: string + observedGeneration: + format: int64 + type: integer + reason: type: string - namespace: + status: type: string + type: + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type type: object - type: object - size: - format: int32 - type: integer - type: object - status: - description: MeshSyncStatus defines the observed state of MeshSync - properties: - conditions: - items: - properties: - lastProbeTime: - format: date-time - type: string - lastTransitionTime: - format: date-time - type: string - message: - type: string - observedGeneration: - format: int64 - type: integer - reason: - type: string - status: - type: string - type: - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - publishing-to: - type: string - type: object - type: object - served: true - storage: true - subresources: - status: {} + type: array + publishing-to: + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} status: acceptedNames: kind: "" @@ -205,61 +209,61 @@ metadata: name: meshery-leader-election-role namespace: meshery rules: -- apiGroups: - - "" - resources: - - configmaps - verbs: - - get - - list - - watch - - create - - update - - patch - - delete -- apiGroups: - - "" - resources: - - configmaps/status - verbs: - - get - - update - - patch -- apiGroups: - - "" - resources: - - events - verbs: - - create - - patch + - apiGroups: + - "" + resources: + - configmaps + verbs: + - get + - list + - watch + - create + - update + - patch + - delete + - apiGroups: + - "" + resources: + - configmaps/status + verbs: + - get + - update + - patch + - apiGroups: + - "" + resources: + - events + verbs: + - create + - patch --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: meshery-controller-role rules: -- apiGroups: - - '*' - resources: - - '*' - verbs: - - create - - delete - - get - - list - - patch - - update - - watch + - apiGroups: + - "*" + resources: + - "*" + verbs: + - create + - delete + - get + - list + - patch + - update + - watch --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: meshery-metrics-reader rules: -- nonResourceURLs: - - /metrics - verbs: - - get + - nonResourceURLs: + - /metrics + verbs: + - get --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole @@ -267,44 +271,44 @@ metadata: creationTimestamp: null name: meshery-operator-role rules: -- apiGroups: - - meshery.layer5.io - resources: - - brokers - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - meshery.layer5.io - resources: - - brokers/status - verbs: - - get - - patch - - update + - apiGroups: + - meshery.layer5.io + resources: + - brokers + verbs: + - create + - delete + - get + - list + - patch + - update + - watch + - apiGroups: + - meshery.layer5.io + resources: + - brokers/status + verbs: + - get + - patch + - update --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: meshery-proxy-role rules: -- apiGroups: - - authentication.k8s.io - resources: - - tokenreviews - verbs: - - create -- apiGroups: - - authorization.k8s.io - resources: - - subjectaccessreviews - verbs: - - create + - apiGroups: + - authentication.k8s.io + resources: + - tokenreviews + verbs: + - create + - apiGroups: + - authorization.k8s.io + resources: + - subjectaccessreviews + verbs: + - create --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding @@ -316,9 +320,9 @@ roleRef: kind: Role name: meshery-leader-election-role subjects: -- kind: ServiceAccount - name: meshery-operator - namespace: meshery + - kind: ServiceAccount + name: meshery-operator + namespace: meshery --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding @@ -329,9 +333,9 @@ roleRef: kind: ClusterRole name: meshery-controller-role subjects: -- kind: ServiceAccount - name: meshery-operator - namespace: meshery + - kind: ServiceAccount + name: meshery-operator + namespace: meshery --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding @@ -342,9 +346,9 @@ roleRef: kind: ClusterRole name: meshery-operator-role subjects: -- kind: ServiceAccount - name: meshery-operator - namespace: meshery + - kind: ServiceAccount + name: meshery-operator + namespace: meshery --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding @@ -355,9 +359,9 @@ roleRef: kind: ClusterRole name: meshery-proxy-role subjects: -- kind: ServiceAccount - name: meshery-operator - namespace: meshery + - kind: ServiceAccount + name: meshery-operator + namespace: meshery --- apiVersion: v1 kind: Service @@ -369,9 +373,9 @@ metadata: namespace: meshery spec: ports: - - name: https - port: 8443 - targetPort: https + - name: https + port: 8443 + targetPort: https selector: app: meshery component: operator @@ -397,44 +401,44 @@ spec: component: operator spec: containers: - - args: - - --secure-listen-address=0.0.0.0:8443 - - --upstream=http://127.0.0.1:8080/ - - --logtostderr=true - - --v=10 - image: gcr.io/kubebuilder/kube-rbac-proxy:v0.5.0 - name: kube-rbac-proxy - ports: - - containerPort: 8443 - name: https - resources: - limits: - cpu: 100m - memory: 30Mi - requests: - cpu: 100m - memory: 20Mi - - args: - - --metrics-addr=127.0.0.1:8080 - - --enable-leader-election - command: - - /manager - image: layer5/meshery-operator:stable-latest - imagePullPolicy: Always - name: manager - ports: - - containerPort: 9443 - hostPort: 9443 - name: server - - containerPort: 8080 - hostPort: 8080 - name: metrics - resources: - limits: - cpu: 100m - memory: 30Mi - requests: - cpu: 100m - memory: 20Mi + - args: + - --secure-listen-address=0.0.0.0:8443 + - --upstream=http://127.0.0.1:8080/ + - --logtostderr=true + - --v=10 + image: gcr.io/kubebuilder/kube-rbac-proxy:v0.5.0 + name: kube-rbac-proxy + ports: + - containerPort: 8443 + name: https + resources: + limits: + cpu: 100m + memory: 30Mi + requests: + cpu: 100m + memory: 20Mi + - args: + - --metrics-addr=127.0.0.1:8080 + - --enable-leader-election + command: + - /manager + image: layer5/meshery-operator:stable-latest + imagePullPolicy: Always + name: manager + ports: + - containerPort: 9443 + hostPort: 9443 + name: server + - containerPort: 8080 + hostPort: 8080 + name: metrics + resources: + limits: + cpu: 100m + memory: 30Mi + requests: + cpu: 100m + memory: 20Mi serviceAccountName: meshery-operator terminationGracePeriodSeconds: 10 diff --git a/config/samples/kustomization.yaml b/config/samples/kustomization.yaml index 008f31e7..cbe94321 100644 --- a/config/samples/kustomization.yaml +++ b/config/samples/kustomization.yaml @@ -2,5 +2,5 @@ namePrefix: meshery- ## Append samples you want in your CSV to this file as resources ## # +kubebuilder:scaffold:manifestskustomizesamples resources: -- meshery_v1alpha1_meshsync.yaml -- meshery_v1alpha1_broker.yaml + - meshery_v1beta1_meshsync.yaml + - meshery_v1beta1_broker.yaml diff --git a/config/samples/meshery_v1alpha1_broker.yaml b/config/samples/meshery_v1alpha1_broker.yaml index 4cbb2527..55b96ecb 100644 --- a/config/samples/meshery_v1alpha1_broker.yaml +++ b/config/samples/meshery_v1alpha1_broker.yaml @@ -1,4 +1,4 @@ -apiVersion: meshery.layer5.io/v1alpha1 +apiVersion: meshery.layer5.io/v1beta1 kind: Broker metadata: name: meshery-broker diff --git a/config/samples/meshery_v1alpha1_meshsync.yaml b/config/samples/meshery_v1alpha1_meshsync.yaml index 13cf3406..92c50569 100644 --- a/config/samples/meshery_v1alpha1_meshsync.yaml +++ b/config/samples/meshery_v1alpha1_meshsync.yaml @@ -1,4 +1,4 @@ -apiVersion: meshery.layer5.io/v1alpha1 +apiVersion: meshery.layer5.io/v1beta1 kind: MeshSync metadata: name: meshery-meshsync @@ -18,6 +18,6 @@ spec: watch-list: apiVersion: v1 data: - # Use either the blacklist or the whitelist for the moment + # Use either the blacklist or the whitelist for the moment # blacklist: "[\"namespaces.v1.\",\"configmaps.v1.\",\"nodes.v1.\",\"secrets.v1.\",\"persistentvolumes.v1.\",\"persistentvolumeclaims.v1.\",\"replicasets.v1.apps\",\"pods.v1.\",\"services.v1.\",\"deployments.v1.apps\",\"statefulsets.v1.apps\",\"daemonsets.v1.apps\",\"ingresses.v1.networking.k8s.io\",\"endpoints.v1.\",\"endpointslices.v1.discovery.k8s.io\",\"cronjobs.v1.batch\",\"replicationcontrollers.v1.\",\"storageclasses.v1.storage.k8s.io\",\"clusterroles.v1.rbac.authorization.k8s.io\",\"volumeattachments.v1.storage.k8s.io\",\"apiservices.v1.apiregistration.k8s.io\"]" - whitelist: "[{\"Resource\":\"namespaces.v1.\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"configmaps.v1.\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"nodes.v1.\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"secrets.v1.\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"persistentvolumes.v1.\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"persistentvolumeclaims.v1.\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"replicasets.v1.apps\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"pods.v1.\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"services.v1.\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"deployments.v1.apps\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"statefulsets.v1.apps\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"daemonsets.v1.apps\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"ingresses.v1.networking.k8s.io\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"endpoints.v1.\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"endpointslices.v1.discovery.k8s.io\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"cronjobs.v1.batch\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"replicationcontrollers.v1.\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"storageclasses.v1.storage.k8s.io\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"clusterroles.v1.rbac.authorization.k8s.io\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"volumeattachments.v1.storage.k8s.io\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"apiservices.v1.apiregistration.k8s.io\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]}]" + whitelist: '[{"Resource":"namespaces.v1.","Events":["ADDED","MODIFIED","DELETED"]},{"Resource":"configmaps.v1.","Events":["ADDED","MODIFIED","DELETED"]},{"Resource":"nodes.v1.","Events":["ADDED","MODIFIED","DELETED"]},{"Resource":"secrets.v1.","Events":["ADDED","MODIFIED","DELETED"]},{"Resource":"persistentvolumes.v1.","Events":["ADDED","MODIFIED","DELETED"]},{"Resource":"persistentvolumeclaims.v1.","Events":["ADDED","MODIFIED","DELETED"]},{"Resource":"replicasets.v1.apps","Events":["ADDED","MODIFIED","DELETED"]},{"Resource":"pods.v1.","Events":["ADDED","MODIFIED","DELETED"]},{"Resource":"services.v1.","Events":["ADDED","MODIFIED","DELETED"]},{"Resource":"deployments.v1.apps","Events":["ADDED","MODIFIED","DELETED"]},{"Resource":"statefulsets.v1.apps","Events":["ADDED","MODIFIED","DELETED"]},{"Resource":"daemonsets.v1.apps","Events":["ADDED","MODIFIED","DELETED"]},{"Resource":"ingresses.v1.networking.k8s.io","Events":["ADDED","MODIFIED","DELETED"]},{"Resource":"endpoints.v1.","Events":["ADDED","MODIFIED","DELETED"]},{"Resource":"endpointslices.v1.discovery.k8s.io","Events":["ADDED","MODIFIED","DELETED"]},{"Resource":"cronjobs.v1.batch","Events":["ADDED","MODIFIED","DELETED"]},{"Resource":"replicationcontrollers.v1.","Events":["ADDED","MODIFIED","DELETED"]},{"Resource":"storageclasses.v1.storage.k8s.io","Events":["ADDED","MODIFIED","DELETED"]},{"Resource":"clusterroles.v1.rbac.authorization.k8s.io","Events":["ADDED","MODIFIED","DELETED"]},{"Resource":"volumeattachments.v1.storage.k8s.io","Events":["ADDED","MODIFIED","DELETED"]},{"Resource":"apiservices.v1.apiregistration.k8s.io","Events":["ADDED","MODIFIED","DELETED"]}]' diff --git a/controllers/broker_controller.go b/controllers/broker_controller.go index 8532db3b..906a0a03 100644 --- a/controllers/broker_controller.go +++ b/controllers/broker_controller.go @@ -27,7 +27,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - mesheryv1alpha1 "github.com/layer5io/meshery-operator/api/v1alpha1" + mesheryv1beta1 "github.com/layer5io/meshery-operator/api/v1beta1" brokerpackage "github.com/layer5io/meshery-operator/pkg/broker" "github.com/layer5io/meshery-operator/pkg/utils" kubeerror "k8s.io/apimachinery/pkg/api/errors" @@ -51,7 +51,7 @@ func (r *BrokerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr log = log.WithValues("controller", "Broker") log = log.WithValues("namespace", req.NamespacedName) log.Info("Reconciling broker") - baseResource := &mesheryv1alpha1.Broker{} + baseResource := &mesheryv1beta1.Broker{} // Check if resource exists err := r.Get(ctx, req.NamespacedName, baseResource) @@ -98,12 +98,12 @@ func (r *BrokerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr func (r *BrokerReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&mesheryv1alpha1.Broker{}). + For(&mesheryv1beta1.Broker{}). Complete(r) } func (r *BrokerReconciler) Cleanup() error { - objects := brokerpackage.GetObjects(&mesheryv1alpha1.Broker{ + objects := brokerpackage.GetObjects(&mesheryv1beta1.Broker{ ObjectMeta: v1.ObjectMeta{ Name: "meshery-broker", Namespace: "meshery", @@ -118,7 +118,7 @@ func (r *BrokerReconciler) Cleanup() error { return nil } -func (r *BrokerReconciler) reconcileBroker(ctx context.Context, enable bool, baseResource *mesheryv1alpha1.Broker, req ctrl.Request) (ctrl.Result, error) { +func (r *BrokerReconciler) reconcileBroker(ctx context.Context, enable bool, baseResource *mesheryv1beta1.Broker, req ctrl.Request) (ctrl.Result, error) { objects := brokerpackage.GetObjects(baseResource) for _, object := range objects { object.SetNamespace(baseResource.Namespace) diff --git a/controllers/broker_controller_test.go b/controllers/broker_controller_test.go index 27df70bf..97b19c57 100644 --- a/controllers/broker_controller_test.go +++ b/controllers/broker_controller_test.go @@ -19,7 +19,7 @@ package controllers import ( "context" - "github.com/layer5io/meshery-operator/api/v1alpha1" + "github.com/layer5io/meshery-operator/api/v1beta1" brokerpackage "github.com/layer5io/meshery-operator/pkg/broker" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -43,7 +43,7 @@ var _ = Describe("The test cases for customize resource: Broker's controller ", Context("Testing Broker's nothing found logic", func() { It("Getting broker resource should be failing", func() { namespace = "default" - broker := &v1alpha1.Broker{} + broker := &v1beta1.Broker{} err := k8sClient.Get(ctx, types.NamespacedName{Name: "default", Namespace: namespace}, broker) Expect(err).To(HaveOccurred()) }) @@ -51,16 +51,16 @@ var _ = Describe("The test cases for customize resource: Broker's controller ", It("Creating a broker resource", func() { namespace = "default" - broker := &v1alpha1.Broker{ + broker := &v1beta1.Broker{ TypeMeta: metav1.TypeMeta{ - APIVersion: "meshery.layer5.io/v1alpha1", + APIVersion: "meshery.layer5.io/v1beta1", Kind: "Broker", }, ObjectMeta: metav1.ObjectMeta{ Name: "default", Namespace: namespace, }, - Spec: v1alpha1.BrokerSpec{ + Spec: v1beta1.BrokerSpec{ Size: 1, }} @@ -69,7 +69,7 @@ var _ = Describe("The test cases for customize resource: Broker's controller ", It("Getting broker resource should be successful", func() { namespace = "default" - broker := &v1alpha1.Broker{} + broker := &v1beta1.Broker{} err := k8sClient.Get(ctx, types.NamespacedName{Name: "default", Namespace: namespace}, broker) Expect(err).ToNot(HaveOccurred()) Expect(broker.Spec.Size).To(Equal(int32(1))) @@ -77,14 +77,14 @@ var _ = Describe("The test cases for customize resource: Broker's controller ", It("Updating broker resource should be successful", func() { namespace = "default" - broker := &v1alpha1.Broker{} + broker := &v1beta1.Broker{} err := k8sClient.Get(ctx, types.NamespacedName{Name: "default", Namespace: namespace}, broker) Expect(err).ToNot(HaveOccurred()) broker.Spec.Size = 2 Expect(k8sClient.Update(ctx, broker)).Should(Succeed()) By("Checking if the broker resource is updated") - broker = &v1alpha1.Broker{} + broker = &v1beta1.Broker{} err = k8sClient.Get(ctx, types.NamespacedName{Name: "default", Namespace: namespace}, broker) Expect(err).ToNot(HaveOccurred()) Expect(broker.Spec.Size).To(Equal(int32(2))) @@ -93,7 +93,7 @@ var _ = Describe("The test cases for customize resource: Broker's controller ", Context("Testing Broker's brokerpackage.CheckHealth function", func() { It("Checking broker health functions", func() { namespace = "default" - broker := &v1alpha1.Broker{} + broker := &v1beta1.Broker{} err := k8sClient.Get(ctx, types.NamespacedName{Name: "default", Namespace: namespace}, broker) Expect(err).ToNot(HaveOccurred()) By("Checking if the broker is healthy, it should return an error") @@ -133,7 +133,7 @@ var _ = Describe("The test cases for customize resource: Broker's controller ", Context("Testing Broker's Cleanup logic", func() { It("Deleting broker resource should be succeeding", func() { namespace = "default" - broker := &v1alpha1.Broker{} + broker := &v1beta1.Broker{} err := k8sClient.Get(ctx, types.NamespacedName{Name: "default", Namespace: namespace}, broker) Expect(err).ToNot(HaveOccurred()) Expect(k8sClient.Delete(ctx, broker)).Should(Succeed()) diff --git a/controllers/meshsync_controller.go b/controllers/meshsync_controller.go index 00a7ccbc..66e3fac8 100644 --- a/controllers/meshsync_controller.go +++ b/controllers/meshsync_controller.go @@ -28,7 +28,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" util "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" - mesheryv1alpha1 "github.com/layer5io/meshery-operator/api/v1alpha1" + mesheryv1beta1 "github.com/layer5io/meshery-operator/api/v1beta1" brokerpackage "github.com/layer5io/meshery-operator/pkg/broker" meshsyncpackage "github.com/layer5io/meshery-operator/pkg/meshsync" "github.com/layer5io/meshery-operator/pkg/utils" @@ -52,7 +52,7 @@ func (r *MeshSyncReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c log = log.WithValues("controller", "MeshSync") log = log.WithValues("namespace", req.NamespacedName) log.Info("Reconciling MeshSync") - baseResource := &mesheryv1alpha1.MeshSync{} + baseResource := &mesheryv1beta1.MeshSync{} // Check if resource exists err := r.Get(ctx, req.NamespacedName, baseResource) @@ -93,12 +93,12 @@ func (r *MeshSyncReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c func (r *MeshSyncReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&mesheryv1alpha1.MeshSync{}). + For(&mesheryv1beta1.MeshSync{}). Complete(r) } func (r *MeshSyncReconciler) Cleanup() error { - objects := meshsyncpackage.GetObjects(&mesheryv1alpha1.MeshSync{ + objects := meshsyncpackage.GetObjects(&mesheryv1beta1.MeshSync{ ObjectMeta: v1.ObjectMeta{ Name: "meshery-meshsync", Namespace: "meshery", @@ -113,9 +113,9 @@ func (r *MeshSyncReconciler) Cleanup() error { return nil } -func (r *MeshSyncReconciler) reconcileBrokerConfig(ctx context.Context, baseResource *mesheryv1alpha1.MeshSync) error { - brokerresource := &mesheryv1alpha1.Broker{} - nullNativeResource := mesheryv1alpha1.NativeMeshsyncBroker{} +func (r *MeshSyncReconciler) reconcileBrokerConfig(ctx context.Context, baseResource *mesheryv1beta1.MeshSync) error { + brokerresource := &mesheryv1beta1.Broker{} + nullNativeResource := mesheryv1beta1.NativeMeshsyncBroker{} if baseResource.Spec.Broker.Native != nullNativeResource { brokerresource.ObjectMeta.Namespace = baseResource.Spec.Broker.Native.Namespace brokerresource.ObjectMeta.Name = baseResource.Spec.Broker.Native.Name @@ -131,7 +131,7 @@ func (r *MeshSyncReconciler) reconcileBrokerConfig(ctx context.Context, baseReso return nil } -func (r *MeshSyncReconciler) reconcileMeshsync(ctx context.Context, enable bool, baseResource *mesheryv1alpha1.MeshSync, req ctrl.Request) (ctrl.Result, error) { +func (r *MeshSyncReconciler) reconcileMeshsync(ctx context.Context, enable bool, baseResource *mesheryv1beta1.MeshSync, req ctrl.Request) (ctrl.Result, error) { object := meshsyncpackage.GetObjects(baseResource)[meshsyncpackage.ServerObject] err := r.Get(ctx, types.NamespacedName{ diff --git a/controllers/meshsync_controller_test.go b/controllers/meshsync_controller_test.go index 5557307a..092e7618 100644 --- a/controllers/meshsync_controller_test.go +++ b/controllers/meshsync_controller_test.go @@ -19,7 +19,7 @@ package controllers import ( "context" - "github.com/layer5io/meshery-operator/api/v1alpha1" + "github.com/layer5io/meshery-operator/api/v1beta1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -40,7 +40,7 @@ var _ = Describe("The test cases for customize resource: MeshSync's controller " Context("Testing meshSync's nothing found logic", func() { It("Getting meshSync resource should be failing", func() { namespace = "default" - meshSync := &v1alpha1.MeshSync{} + meshSync := &v1beta1.MeshSync{} err := k8sClient.Get(ctx, types.NamespacedName{Name: "default", Namespace: namespace}, meshSync) Expect(err).To(HaveOccurred()) }) @@ -48,16 +48,16 @@ var _ = Describe("The test cases for customize resource: MeshSync's controller " It("Creating a meshSync resource", func() { namespace = "default" - meshSync := &v1alpha1.MeshSync{ + meshSync := &v1beta1.MeshSync{ TypeMeta: metav1.TypeMeta{ - APIVersion: "meshery.layer5.io/v1alpha1", + APIVersion: "meshery.layer5.io/v1beta1", Kind: "MeshSync", }, ObjectMeta: metav1.ObjectMeta{ Name: "default", Namespace: namespace, }, - Spec: v1alpha1.MeshSyncSpec{ + Spec: v1beta1.MeshSyncSpec{ Size: 1, }} @@ -66,7 +66,7 @@ var _ = Describe("The test cases for customize resource: MeshSync's controller " It("Getting meshSync resource should be successful", func() { namespace = "default" - meshSync := &v1alpha1.MeshSync{} + meshSync := &v1beta1.MeshSync{} err := k8sClient.Get(ctx, types.NamespacedName{Name: "default", Namespace: namespace}, meshSync) Expect(err).ToNot(HaveOccurred()) Expect(meshSync.Spec.Size).To(Equal(int32(1))) @@ -74,14 +74,14 @@ var _ = Describe("The test cases for customize resource: MeshSync's controller " It("Updating meshSync resource should be successful", func() { namespace = "default" - meshSync := &v1alpha1.MeshSync{} + meshSync := &v1beta1.MeshSync{} err := k8sClient.Get(ctx, types.NamespacedName{Name: "default", Namespace: namespace}, meshSync) Expect(err).ToNot(HaveOccurred()) meshSync.Spec.Size = 2 Expect(k8sClient.Update(ctx, meshSync)).Should(Succeed()) By("Checking if the meshSync resource is updated") - meshSync = &v1alpha1.MeshSync{} + meshSync = &v1beta1.MeshSync{} err = k8sClient.Get(ctx, types.NamespacedName{Name: "default", Namespace: namespace}, meshSync) Expect(err).ToNot(HaveOccurred()) Expect(meshSync.Spec.Size).To(Equal(int32(2))) @@ -90,7 +90,7 @@ var _ = Describe("The test cases for customize resource: MeshSync's controller " Context("Testing MeshSync's Cleanup logic", func() { It("Deleting meshSync resource should be succeeding", func() { namespace = "default" - meshSync := &v1alpha1.MeshSync{} + meshSync := &v1beta1.MeshSync{} err := k8sClient.Get(ctx, types.NamespacedName{Name: "default", Namespace: namespace}, meshSync) Expect(err).ToNot(HaveOccurred()) Expect(k8sClient.Delete(ctx, meshSync)).Should(Succeed()) diff --git a/controllers/suit_test.go b/controllers/suit_test.go index 60dcb874..6543b6d7 100644 --- a/controllers/suit_test.go +++ b/controllers/suit_test.go @@ -36,7 +36,7 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" - mesheryv1alpha1 "github.com/layer5io/meshery-operator/api/v1alpha1" + mesheryv1beta1 "github.com/layer5io/meshery-operator/api/v1beta1" ) // Initialize test suite entrypoint @@ -82,7 +82,7 @@ var _ = BeforeSuite(func(ctx SpecContext) { scheme := runtime.NewScheme() - Expect(mesheryv1alpha1.AddToScheme(scheme)).To(Succeed()) + Expect(mesheryv1beta1.AddToScheme(scheme)).To(Succeed()) Expect(k8sscheme.AddToScheme(scheme)).To(Succeed()) Expect(apiv1.AddToScheme(scheme)).To(Succeed()) diff --git a/main.go b/main.go index 39feae01..1f09b22d 100644 --- a/main.go +++ b/main.go @@ -28,7 +28,7 @@ import ( _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" ctrl "sigs.k8s.io/controller-runtime" - mesheryv1alpha1 "github.com/layer5io/meshery-operator/api/v1alpha1" + mesheryv1beta1 "github.com/layer5io/meshery-operator/api/v1beta1" "github.com/layer5io/meshery-operator/controllers" "k8s.io/client-go/kubernetes" @@ -43,7 +43,7 @@ var ( func init() { // +kubebuilder:scaffold:scheme utilruntime.Must(clientgoscheme.AddToScheme(scheme)) - utilruntime.Must(mesheryv1alpha1.AddToScheme(scheme)) + utilruntime.Must(mesheryv1beta1.AddToScheme(scheme)) } func main() { diff --git a/pkg/broker/broker.go b/pkg/broker/broker.go index b65ac5e9..8826ea0e 100644 --- a/pkg/broker/broker.go +++ b/pkg/broker/broker.go @@ -6,7 +6,7 @@ import ( "net" neturl "net/url" - mesheryv1alpha1 "github.com/layer5io/meshery-operator/api/v1alpha1" + mesheryv1beta1 "github.com/layer5io/meshery-operator/api/v1beta1" utils "github.com/layer5io/meshery-operator/pkg/utils" v1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" @@ -27,7 +27,7 @@ type Object interface { metav1.Object } -func GetObjects(m *mesheryv1alpha1.Broker) map[string]Object { +func GetObjects(m *mesheryv1beta1.Broker) map[string]Object { return map[string]Object{ ServerConfig: getServerConfig(), AccountConfig: getAccountConfig(), @@ -65,7 +65,7 @@ func getAccountConfig() Object { return obj } -func CheckHealth(ctx context.Context, m *mesheryv1alpha1.Broker, client *kubernetes.Clientset) error { +func CheckHealth(ctx context.Context, m *mesheryv1beta1.Broker, client *kubernetes.Clientset) error { obj, err := client.AppsV1().StatefulSets(m.ObjectMeta.Namespace).Get(ctx, m.ObjectMeta.Name, metav1.GetOptions{}) if err != nil { return ErrGettingResource(err) @@ -86,7 +86,7 @@ func CheckHealth(ctx context.Context, m *mesheryv1alpha1.Broker, client *kuberne } // GetEndpoint returns those endpoints in the given service which match the selector. -func GetEndpoint(ctx context.Context, m *mesheryv1alpha1.Broker, client *kubernetes.Clientset, url string) error { +func GetEndpoint(ctx context.Context, m *mesheryv1beta1.Broker, client *kubernetes.Clientset, url string) error { var serviceObj *corev1.Service var err error diff --git a/pkg/broker/broker_test.go b/pkg/broker/broker_test.go index 76b61bb1..2a2d3bf8 100644 --- a/pkg/broker/broker_test.go +++ b/pkg/broker/broker_test.go @@ -19,7 +19,7 @@ package broker import ( "context" - mesheryv1alpha1 "github.com/layer5io/meshery-operator/api/v1alpha1" + mesheryv1beta1 "github.com/layer5io/meshery-operator/api/v1beta1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" v1 "k8s.io/api/apps/v1" @@ -39,12 +39,12 @@ var _ = Describe("Broker funtions test cases", func() { Context("Test for GetObjects function", func() { It("should return the map of objects", func() { - m := &mesheryv1alpha1.Broker{ + m := &mesheryv1beta1.Broker{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "test", }, - Spec: mesheryv1alpha1.BrokerSpec{ + Spec: mesheryv1beta1.BrokerSpec{ Size: 1, }, } @@ -69,12 +69,12 @@ var _ = Describe("Broker funtions test cases", func() { namespace := "default" name := "default" - m := &mesheryv1alpha1.Broker{ + m := &mesheryv1beta1.Broker{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace, }, - Spec: mesheryv1alpha1.BrokerSpec{ + Spec: mesheryv1beta1.BrokerSpec{ Size: 1, }, } @@ -116,12 +116,12 @@ var _ = Describe("Broker funtions test cases", func() { name := "default" namespace := "default" - m := &mesheryv1alpha1.Broker{ + m := &mesheryv1beta1.Broker{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace, }, - Spec: mesheryv1alpha1.BrokerSpec{ + Spec: mesheryv1beta1.BrokerSpec{ Size: 1, }, } diff --git a/pkg/broker/suit_test.go b/pkg/broker/suit_test.go index d679e52f..3b5424b9 100644 --- a/pkg/broker/suit_test.go +++ b/pkg/broker/suit_test.go @@ -35,7 +35,7 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" - mesheryv1alpha1 "github.com/layer5io/meshery-operator/api/v1alpha1" + mesheryv1beta1 "github.com/layer5io/meshery-operator/api/v1beta1" ) // Initialize test suite entrypoint @@ -80,7 +80,7 @@ var _ = BeforeSuite(func(ctx SpecContext) { scheme := runtime.NewScheme() - Expect(mesheryv1alpha1.AddToScheme(scheme)).To(Succeed()) + Expect(mesheryv1beta1.AddToScheme(scheme)).To(Succeed()) Expect(k8sscheme.AddToScheme(scheme)).To(Succeed()) Expect(apiv1.AddToScheme(scheme)).To(Succeed()) diff --git a/pkg/client/client.go b/pkg/client/client.go index df0113c2..9239ee6e 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -1,8 +1,8 @@ package client import ( - apiv1alpha1 "github.com/layer5io/meshery-operator/api/v1alpha1" - v1alpha1 "github.com/layer5io/meshery-operator/pkg/client/v1alpha1" + apiv1beta1 "github.com/layer5io/meshery-operator/api/v1beta1" + v1beta1 "github.com/layer5io/meshery-operator/pkg/client/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -15,20 +15,20 @@ import ( var ( Scheme = runtime.NewScheme() - SchemeGroupVersion = apiv1alpha1.GroupVersion + SchemeGroupVersion = apiv1beta1.GroupVersion ) type Interface interface { - CoreV1Alpha1() v1alpha1.CoreInterface + Corev1Beta1() v1beta1.CoreInterface } type Clientset struct { - corev1alpha1 *v1alpha1.CoreClient + corev1beta1 *v1beta1.CoreClient } -// CoreV1Alpha1 retrieves the CoreV1Alpha1Client -func (c *Clientset) CoreV1Alpha1() v1alpha1.CoreInterface { - return c.corev1alpha1 +// Corev1beta1 retrieves the Corev1beta1Client +func (c *Clientset) Corev1Beta1() v1beta1.CoreInterface { + return c.corev1beta1 } func New(config *rest.Config) (Interface, error) { @@ -43,7 +43,7 @@ func New(config *rest.Config) (Interface, error) { } return &Clientset{ - corev1alpha1: v1alpha1.New(client, runtime.NewParameterCodec(Scheme)), + corev1beta1: v1beta1.New(client, runtime.NewParameterCodec(Scheme)), }, nil } @@ -51,5 +51,5 @@ func init() { metav1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) // +kubebuilder:scaffold:scheme utilruntime.Must(clientgoscheme.AddToScheme(Scheme)) - utilruntime.Must(apiv1alpha1.AddToScheme(Scheme)) + utilruntime.Must(apiv1beta1.AddToScheme(Scheme)) } diff --git a/pkg/client/v1alpha1/broker.go b/pkg/client/v1beta1/broker.go similarity index 78% rename from pkg/client/v1alpha1/broker.go rename to pkg/client/v1beta1/broker.go index aa6fc289..55641369 100644 --- a/pkg/client/v1alpha1/broker.go +++ b/pkg/client/v1beta1/broker.go @@ -1,10 +1,10 @@ -package v1alpha1 +package v1beta1 import ( "context" "time" - v1alpha1 "github.com/layer5io/meshery-operator/api/v1alpha1" + v1beta1 "github.com/layer5io/meshery-operator/api/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" @@ -19,13 +19,13 @@ type BrokersGetter interface { // BrokerInterface has methods to work with Broker resources. type BrokerInterface interface { - Create(ctx context.Context, broker *v1alpha1.Broker, opts metav1.CreateOptions) (*v1alpha1.Broker, error) - Update(ctx context.Context, broker *v1alpha1.Broker, opts metav1.UpdateOptions) (*v1alpha1.Broker, error) + Create(ctx context.Context, broker *v1beta1.Broker, opts metav1.CreateOptions) (*v1beta1.Broker, error) + Update(ctx context.Context, broker *v1beta1.Broker, opts metav1.UpdateOptions) (*v1beta1.Broker, error) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1alpha1.Broker, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1alpha1.BrokerList, error) + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1beta1.Broker, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1beta1.BrokerList, error) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1alpha1.Broker, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1beta1.Broker, err error) } // broker implements BrokerInterface @@ -43,8 +43,8 @@ func newBrokers(c *CoreClient, namespace string) *broker { } // Get takes name of the broker, and returns the corresponding broker object, and an error if there is any. -func (c *broker) Get(ctx context.Context, name string, opts metav1.GetOptions) (result *v1alpha1.Broker, err error) { - result = &v1alpha1.Broker{} +func (c *broker) Get(ctx context.Context, name string, opts metav1.GetOptions) (result *v1beta1.Broker, err error) { + result = &v1beta1.Broker{} err = c.client.Get(). Namespace(c.ns). Resource("brokers"). @@ -56,12 +56,12 @@ func (c *broker) Get(ctx context.Context, name string, opts metav1.GetOptions) ( } // List takes label and field selectors, and returns the list of Brokers that match those selectors. -func (c *broker) List(ctx context.Context, opts metav1.ListOptions) (result *v1alpha1.BrokerList, err error) { +func (c *broker) List(ctx context.Context, opts metav1.ListOptions) (result *v1beta1.BrokerList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v1alpha1.BrokerList{} + result = &v1beta1.BrokerList{} err = c.client.Get(). Namespace(c.ns). Resource("brokers"). @@ -88,8 +88,8 @@ func (c *broker) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Inte } // Create takes the representation of a broker and creates it. Returns the server's representation of the broker, and an error, if there is any. -func (c *broker) Create(ctx context.Context, broker *v1alpha1.Broker, opts metav1.CreateOptions) (result *v1alpha1.Broker, err error) { - result = &v1alpha1.Broker{} +func (c *broker) Create(ctx context.Context, broker *v1beta1.Broker, opts metav1.CreateOptions) (result *v1beta1.Broker, err error) { + result = &v1beta1.Broker{} err = c.client.Post(). Namespace(c.ns). Resource("brokers"). @@ -101,8 +101,8 @@ func (c *broker) Create(ctx context.Context, broker *v1alpha1.Broker, opts metav } // Update takes the representation of a broker and updates it. Returns the server's representation of the broker, and an error, if there is any. -func (c *broker) Update(ctx context.Context, broker *v1alpha1.Broker, opts metav1.UpdateOptions) (result *v1alpha1.Broker, err error) { - result = &v1alpha1.Broker{} +func (c *broker) Update(ctx context.Context, broker *v1beta1.Broker, opts metav1.UpdateOptions) (result *v1beta1.Broker, err error) { + result = &v1beta1.Broker{} err = c.client.Put(). Namespace(c.ns). Resource("brokers"). @@ -126,8 +126,8 @@ func (c *broker) Delete(ctx context.Context, name string, opts metav1.DeleteOpti } // Patch applies the patch and returns the patched broker. -func (c *broker) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1alpha1.Broker, err error) { - result = &v1alpha1.Broker{} +func (c *broker) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1beta1.Broker, err error) { + result = &v1beta1.Broker{} err = c.client.Patch(pt). Namespace(c.ns). Resource("brokers"). diff --git a/pkg/client/v1alpha1/meshsync.go b/pkg/client/v1beta1/meshsync.go similarity index 77% rename from pkg/client/v1alpha1/meshsync.go rename to pkg/client/v1beta1/meshsync.go index cba5d986..238d9683 100644 --- a/pkg/client/v1alpha1/meshsync.go +++ b/pkg/client/v1beta1/meshsync.go @@ -1,10 +1,10 @@ -package v1alpha1 +package v1beta1 import ( "context" "time" - v1alpha1 "github.com/layer5io/meshery-operator/api/v1alpha1" + v1beta1 "github.com/layer5io/meshery-operator/api/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" @@ -19,13 +19,13 @@ type MeshSyncsGetter interface { // MeshSyncInterface has methods to work with MeshSync resources. type MeshSyncInterface interface { - Create(ctx context.Context, meshsync *v1alpha1.MeshSync, opts metav1.CreateOptions) (*v1alpha1.MeshSync, error) - Update(ctx context.Context, meshsync *v1alpha1.MeshSync, opts metav1.UpdateOptions) (*v1alpha1.MeshSync, error) + Create(ctx context.Context, meshsync *v1beta1.MeshSync, opts metav1.CreateOptions) (*v1beta1.MeshSync, error) + Update(ctx context.Context, meshsync *v1beta1.MeshSync, opts metav1.UpdateOptions) (*v1beta1.MeshSync, error) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1alpha1.MeshSync, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1alpha1.MeshSyncList, error) + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1beta1.MeshSync, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1beta1.MeshSyncList, error) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1alpha1.MeshSync, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1beta1.MeshSync, err error) } // meshsync implements MeshSyncInterface @@ -43,8 +43,8 @@ func newMeshSyncs(c *CoreClient, namespace string) *meshsync { } // Get takes name of the meshsync, and returns the corresponding meshsync object, and an error if there is any. -func (c *meshsync) Get(ctx context.Context, name string, opts metav1.GetOptions) (result *v1alpha1.MeshSync, err error) { - result = &v1alpha1.MeshSync{} +func (c *meshsync) Get(ctx context.Context, name string, opts metav1.GetOptions) (result *v1beta1.MeshSync, err error) { + result = &v1beta1.MeshSync{} err = c.client.Get(). Namespace(c.ns). Resource("meshsyncs"). @@ -56,12 +56,12 @@ func (c *meshsync) Get(ctx context.Context, name string, opts metav1.GetOptions) } // List takes label and field selectors, and returns the list of MeshSyncs that match those selectors. -func (c *meshsync) List(ctx context.Context, opts metav1.ListOptions) (result *v1alpha1.MeshSyncList, err error) { +func (c *meshsync) List(ctx context.Context, opts metav1.ListOptions) (result *v1beta1.MeshSyncList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v1alpha1.MeshSyncList{} + result = &v1beta1.MeshSyncList{} err = c.client.Get(). Namespace(c.ns). Resource("meshsyncs"). @@ -88,8 +88,8 @@ func (c *meshsync) Watch(ctx context.Context, opts metav1.ListOptions) (watch.In } // Create takes the representation of a meshsync and creates it. Returns the server's representation of the meshsync, and an error, if there is any. -func (c *meshsync) Create(ctx context.Context, meshsync *v1alpha1.MeshSync, opts metav1.CreateOptions) (result *v1alpha1.MeshSync, err error) { - result = &v1alpha1.MeshSync{} +func (c *meshsync) Create(ctx context.Context, meshsync *v1beta1.MeshSync, opts metav1.CreateOptions) (result *v1beta1.MeshSync, err error) { + result = &v1beta1.MeshSync{} err = c.client.Post(). Namespace(c.ns). Resource("meshsyncs"). @@ -101,8 +101,8 @@ func (c *meshsync) Create(ctx context.Context, meshsync *v1alpha1.MeshSync, opts } // Update takes the representation of a meshsync and updates it. Returns the server's representation of the meshsync, and an error, if there is any. -func (c *meshsync) Update(ctx context.Context, meshsync *v1alpha1.MeshSync, opts metav1.UpdateOptions) (result *v1alpha1.MeshSync, err error) { - result = &v1alpha1.MeshSync{} +func (c *meshsync) Update(ctx context.Context, meshsync *v1beta1.MeshSync, opts metav1.UpdateOptions) (result *v1beta1.MeshSync, err error) { + result = &v1beta1.MeshSync{} err = c.client.Put(). Namespace(c.ns). Resource("meshsyncs"). @@ -126,8 +126,8 @@ func (c *meshsync) Delete(ctx context.Context, name string, opts metav1.DeleteOp } // Patch applies the patch and returns the patched meshsync. -func (c *meshsync) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1alpha1.MeshSync, err error) { - result = &v1alpha1.MeshSync{} +func (c *meshsync) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1beta1.MeshSync, err error) { + result = &v1beta1.MeshSync{} err = c.client.Patch(pt). Namespace(c.ns). Resource("meshsyncs"). diff --git a/pkg/client/v1alpha1/v1alpha1.go b/pkg/client/v1beta1/v1beta1.go similarity index 97% rename from pkg/client/v1alpha1/v1alpha1.go rename to pkg/client/v1beta1/v1beta1.go index 657ad81b..81d48583 100644 --- a/pkg/client/v1alpha1/v1alpha1.go +++ b/pkg/client/v1beta1/v1beta1.go @@ -1,4 +1,4 @@ -package v1alpha1 +package v1beta1 import ( "k8s.io/apimachinery/pkg/runtime" diff --git a/pkg/meshsync/meshsync.go b/pkg/meshsync/meshsync.go index 56e3fb10..f7f59a11 100644 --- a/pkg/meshsync/meshsync.go +++ b/pkg/meshsync/meshsync.go @@ -17,7 +17,7 @@ limitations under the License. package meshsync import ( - mesheryv1alpha1 "github.com/layer5io/meshery-operator/api/v1alpha1" + mesheryv1beta1 "github.com/layer5io/meshery-operator/api/v1beta1" v1 "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -32,7 +32,7 @@ type Object interface { metav1.Object } -func GetObjects(m *mesheryv1alpha1.MeshSync) map[string]Object { +func GetObjects(m *mesheryv1beta1.MeshSync) map[string]Object { return map[string]Object{ ServerObject: getServerObject(m.ObjectMeta.Namespace, m.ObjectMeta.Name, m.Spec.Size, m.Status.PublishingTo), } diff --git a/pkg/meshsync/meshsync_test.go b/pkg/meshsync/meshsync_test.go index 4ec80e69..83a9bdba 100644 --- a/pkg/meshsync/meshsync_test.go +++ b/pkg/meshsync/meshsync_test.go @@ -19,17 +19,17 @@ package meshsync import ( "testing" - mesheryv1alpha1 "github.com/layer5io/meshery-operator/api/v1alpha1" + mesheryv1beta1 "github.com/layer5io/meshery-operator/api/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) func TestGetObjects(t *testing.T) { - m := &mesheryv1alpha1.MeshSync{ + m := &mesheryv1beta1.MeshSync{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "test", }, - Spec: mesheryv1alpha1.MeshSyncSpec{ + Spec: mesheryv1beta1.MeshSyncSpec{ Size: 1, }, }