From dba921277a4993b8f0d729daf540568402f5726e Mon Sep 17 00:00:00 2001 From: omris94 <46892443+omris94@users.noreply.github.com> Date: Wed, 17 Jul 2024 15:51:45 +0300 Subject: [PATCH] Rename `v1` api version to `v1beta1` (#454) --- helm-charts | 2 +- .../{v1 => v1beta1}/clientintents_types.go | 2 +- .../api/{v1 => v1beta1}/groupversion_info.go | 6 +- .../kafkaserverconfig_types.go | 2 +- .../mysqlserverconfig_types.go | 2 +- .../api/{v1 => v1beta1}/otterize_labels.go | 2 +- .../postgresqlserverconfig_types.go | 2 +- .../{v1 => v1beta1}/protectedservice_types.go | 2 +- .../api/{v1 => v1beta1}/serviceidentity.go | 2 +- src/operator/api/{v1 => v1beta1}/webhooks.go | 2 +- .../api/{v1 => v1beta1}/webhooks_test.go | 2 +- .../{v1 => v1beta1}/zz_generated.deepcopy.go | 2 +- .../k8s.otterize.com_clientintents.patched | 276 +++++++++--------- .../crd/k8s.otterize.com_clientintents.yaml | 276 +++++++++--------- ...8s.otterize.com_kafkaserverconfigs.patched | 14 +- .../k8s.otterize.com_kafkaserverconfigs.yaml | 14 +- ...8s.otterize.com_mysqlserverconfigs.patched | 8 +- .../k8s.otterize.com_mysqlserverconfigs.yaml | 8 +- ...terize.com_postgresqlserverconfigs.patched | 8 +- ....otterize.com_postgresqlserverconfigs.yaml | 8 +- ...k8s.otterize.com_protectedservices.patched | 14 +- .../k8s.otterize.com_protectedservices.yaml | 14 +- src/operator/config/webhook/manifests-patched | 18 +- src/operator/config/webhook/manifests.yaml | 18 +- .../external_traffic_network_policy_test.go | 4 +- ...ith_ingress_controllers_configured_test.go | 4 +- ...fic_network_policy_with_no_intents_test.go | 4 +- .../intents_reconcilers/iam/iam_reconciler.go | 3 + .../intents_reconcilers/kafka_acls_test.go | 4 +- .../controllers/pod_reconcilers/pods_test.go | 4 +- src/operator/main.go | 14 +- ...lientintents-customresourcedefinition.yaml | 276 +++++++++--------- ...erverconfigs-customresourcedefinition.yaml | 14 +- ...erverconfigs-customresourcedefinition.yaml | 8 +- ...erverconfigs-customresourcedefinition.yaml | 8 +- ...ctedservices-customresourcedefinition.yaml | 14 +- .../webhooks/clientintents_webhook_v1.go | 34 +-- .../webhooks/database_server_conf_utils.go | 4 +- .../webhooks/mysqlserverconfigs_webhook_v1.go | 10 +- .../postgresqlserverconfigs_webhook_v1.go | 10 +- .../webhooks/protectedservices_webhook_v1.go | 18 +- src/operator/webhooks/webhook_suite_test.go | 4 +- .../graphqlclient/schema.graphql | 5 + .../telemetries/telemetriesgql/schema.graphql | 20 +- 44 files changed, 596 insertions(+), 570 deletions(-) rename src/operator/api/{v1 => v1beta1}/clientintents_types.go (99%) rename src/operator/api/{v1 => v1beta1}/groupversion_info.go (90%) rename src/operator/api/{v1 => v1beta1}/kafkaserverconfig_types.go (99%) rename src/operator/api/{v1 => v1beta1}/mysqlserverconfig_types.go (98%) rename src/operator/api/{v1 => v1beta1}/otterize_labels.go (99%) rename src/operator/api/{v1 => v1beta1}/postgresqlserverconfig_types.go (99%) rename src/operator/api/{v1 => v1beta1}/protectedservice_types.go (99%) rename src/operator/api/{v1 => v1beta1}/serviceidentity.go (98%) rename src/operator/api/{v1 => v1beta1}/webhooks.go (99%) rename src/operator/api/{v1 => v1beta1}/webhooks_test.go (99%) rename src/operator/api/{v1 => v1beta1}/zz_generated.deepcopy.go (99%) diff --git a/helm-charts b/helm-charts index 536523706..5681feb00 160000 --- a/helm-charts +++ b/helm-charts @@ -1 +1 @@ -Subproject commit 536523706eb7863985ade5354ba9b910626b2ccf +Subproject commit 5681feb00024a61d28f2606c14a5fe9f5b2a5555 diff --git a/src/operator/api/v1/clientintents_types.go b/src/operator/api/v1beta1/clientintents_types.go similarity index 99% rename from src/operator/api/v1/clientintents_types.go rename to src/operator/api/v1beta1/clientintents_types.go index 990f729d7..34f8cde0e 100644 --- a/src/operator/api/v1/clientintents_types.go +++ b/src/operator/api/v1beta1/clientintents_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1beta1 import ( "encoding/json" diff --git a/src/operator/api/v1/groupversion_info.go b/src/operator/api/v1beta1/groupversion_info.go similarity index 90% rename from src/operator/api/v1/groupversion_info.go rename to src/operator/api/v1beta1/groupversion_info.go index 6c38714af..0cd769ad1 100644 --- a/src/operator/api/v1/groupversion_info.go +++ b/src/operator/api/v1beta1/groupversion_info.go @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package v1 contains API Schema definitions for the otterize v1 API group +// Package v1beta1 contains API Schema definitions for the otterize v1 API group // +kubebuilder:object:generate=true // +groupName=k8s.otterize.com -package v1 +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: "k8s.otterize.com", Version: "v1"} + GroupVersion = schema.GroupVersion{Group: "k8s.otterize.com", Version: "v1beta1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} diff --git a/src/operator/api/v1/kafkaserverconfig_types.go b/src/operator/api/v1beta1/kafkaserverconfig_types.go similarity index 99% rename from src/operator/api/v1/kafkaserverconfig_types.go rename to src/operator/api/v1beta1/kafkaserverconfig_types.go index 7db528e3d..750c7a1b1 100644 --- a/src/operator/api/v1/kafkaserverconfig_types.go +++ b/src/operator/api/v1beta1/kafkaserverconfig_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/src/operator/api/v1/mysqlserverconfig_types.go b/src/operator/api/v1beta1/mysqlserverconfig_types.go similarity index 98% rename from src/operator/api/v1/mysqlserverconfig_types.go rename to src/operator/api/v1beta1/mysqlserverconfig_types.go index ebb113f0f..0b0efcaab 100644 --- a/src/operator/api/v1/mysqlserverconfig_types.go +++ b/src/operator/api/v1beta1/mysqlserverconfig_types.go @@ -1,4 +1,4 @@ -package v1 +package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/src/operator/api/v1/otterize_labels.go b/src/operator/api/v1beta1/otterize_labels.go similarity index 99% rename from src/operator/api/v1/otterize_labels.go rename to src/operator/api/v1beta1/otterize_labels.go index 49da27008..4c2d65a4b 100644 --- a/src/operator/api/v1/otterize_labels.go +++ b/src/operator/api/v1beta1/otterize_labels.go @@ -1,4 +1,4 @@ -package v1 +package v1beta1 import ( "context" diff --git a/src/operator/api/v1/postgresqlserverconfig_types.go b/src/operator/api/v1beta1/postgresqlserverconfig_types.go similarity index 99% rename from src/operator/api/v1/postgresqlserverconfig_types.go rename to src/operator/api/v1beta1/postgresqlserverconfig_types.go index 4c76c98fb..cd22ae059 100644 --- a/src/operator/api/v1/postgresqlserverconfig_types.go +++ b/src/operator/api/v1beta1/postgresqlserverconfig_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/src/operator/api/v1/protectedservice_types.go b/src/operator/api/v1beta1/protectedservice_types.go similarity index 99% rename from src/operator/api/v1/protectedservice_types.go rename to src/operator/api/v1beta1/protectedservice_types.go index ad7d7913b..f59da23e3 100644 --- a/src/operator/api/v1/protectedservice_types.go +++ b/src/operator/api/v1beta1/protectedservice_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1beta1 import ( "github.com/otterize/intents-operator/src/shared/serviceidresolver/serviceidentity" diff --git a/src/operator/api/v1/serviceidentity.go b/src/operator/api/v1beta1/serviceidentity.go similarity index 98% rename from src/operator/api/v1/serviceidentity.go rename to src/operator/api/v1beta1/serviceidentity.go index a01067c3d..756a38db7 100644 --- a/src/operator/api/v1/serviceidentity.go +++ b/src/operator/api/v1beta1/serviceidentity.go @@ -1,4 +1,4 @@ -package v1 +package v1beta1 import "github.com/otterize/intents-operator/src/shared/serviceidresolver/serviceidentity" diff --git a/src/operator/api/v1/webhooks.go b/src/operator/api/v1beta1/webhooks.go similarity index 99% rename from src/operator/api/v1/webhooks.go rename to src/operator/api/v1beta1/webhooks.go index 3dc0d56bc..362be76c5 100644 --- a/src/operator/api/v1/webhooks.go +++ b/src/operator/api/v1beta1/webhooks.go @@ -1,4 +1,4 @@ -package v1 +package v1beta1 import ( "github.com/otterize/intents-operator/src/operator/api/v2alpha1" diff --git a/src/operator/api/v1/webhooks_test.go b/src/operator/api/v1beta1/webhooks_test.go similarity index 99% rename from src/operator/api/v1/webhooks_test.go rename to src/operator/api/v1beta1/webhooks_test.go index 19f673c91..b67c635e3 100644 --- a/src/operator/api/v1/webhooks_test.go +++ b/src/operator/api/v1beta1/webhooks_test.go @@ -1,4 +1,4 @@ -package v1 +package v1beta1 import ( "github.com/otterize/intents-operator/src/operator/api/v2alpha1" diff --git a/src/operator/api/v1/zz_generated.deepcopy.go b/src/operator/api/v1beta1/zz_generated.deepcopy.go similarity index 99% rename from src/operator/api/v1/zz_generated.deepcopy.go rename to src/operator/api/v1beta1/zz_generated.deepcopy.go index cd371745e..daeb78966 100644 --- a/src/operator/api/v1/zz_generated.deepcopy.go +++ b/src/operator/api/v1beta1/zz_generated.deepcopy.go @@ -18,7 +18,7 @@ limitations under the License. // Code generated by controller-gen. DO NOT EDIT. -package v1 +package v1beta1 import ( runtime "k8s.io/apimachinery/pkg/runtime" diff --git a/src/operator/config/crd/k8s.otterize.com_clientintents.patched b/src/operator/config/crd/k8s.otterize.com_clientintents.patched index 6fc9f77a9..fbf5c934f 100644 --- a/src/operator/config/crd/k8s.otterize.com_clientintents.patched +++ b/src/operator/config/crd/k8s.otterize.com_clientintents.patched @@ -27,7 +27,142 @@ spec: singular: clientintents scope: Namespaced versions: - - name: v1 + - name: v1alpha2 + schema: + openAPIV3Schema: + description: ClientIntents is the Schema for the intents 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: IntentsSpec defines the desired state of ClientIntents + properties: + calls: + items: + properties: + databaseResources: + items: + properties: + databaseName: + type: string + operations: + items: + enum: + - ALL + - SELECT + - INSERT + - UPDATE + - DELETE + type: string + type: array + table: + type: string + required: + - databaseName + type: object + type: array + name: + type: string + resources: + items: + properties: + methods: + items: + enum: + - GET + - POST + - PUT + - DELETE + - OPTIONS + - TRACE + - PATCH + - CONNECT + type: string + type: array + path: + type: string + required: + - methods + - path + type: object + type: array + topics: + items: + properties: + name: + type: string + operations: + items: + enum: + - all + - consume + - produce + - create + - alter + - delete + - describe + - ClusterAction + - DescribeConfigs + - AlterConfigs + - IdempotentWrite + type: string + type: array + required: + - name + - operations + type: object + type: array + type: + enum: + - http + - kafka + - database + type: string + required: + - name + type: object + type: array + service: + properties: + name: + type: string + required: + - name + type: object + required: + - calls + - service + type: object + status: + description: IntentsStatus defines the observed state of ClientIntents + properties: + upToDate: + description: |- + upToDate field reflects whether the client intents have successfully been applied + to the cluster to the state specified + type: boolean + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1alpha3 schema: openAPIV3Schema: description: ClientIntents is the Schema for the intents API @@ -292,145 +427,10 @@ spec: type: object type: object served: true - storage: true - subresources: - status: {} - - name: v1alpha2 - schema: - openAPIV3Schema: - description: ClientIntents is the Schema for the intents 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: IntentsSpec defines the desired state of ClientIntents - properties: - calls: - items: - properties: - databaseResources: - items: - properties: - databaseName: - type: string - operations: - items: - enum: - - ALL - - SELECT - - INSERT - - UPDATE - - DELETE - type: string - type: array - table: - type: string - required: - - databaseName - type: object - type: array - name: - type: string - resources: - items: - properties: - methods: - items: - enum: - - GET - - POST - - PUT - - DELETE - - OPTIONS - - TRACE - - PATCH - - CONNECT - type: string - type: array - path: - type: string - required: - - methods - - path - type: object - type: array - topics: - items: - properties: - name: - type: string - operations: - items: - enum: - - all - - consume - - produce - - create - - alter - - delete - - describe - - ClusterAction - - DescribeConfigs - - AlterConfigs - - IdempotentWrite - type: string - type: array - required: - - name - - operations - type: object - type: array - type: - enum: - - http - - kafka - - database - type: string - required: - - name - type: object - type: array - service: - properties: - name: - type: string - required: - - name - type: object - required: - - calls - - service - type: object - status: - description: IntentsStatus defines the observed state of ClientIntents - properties: - upToDate: - description: |- - upToDate field reflects whether the client intents have successfully been applied - to the cluster to the state specified - type: boolean - type: object - type: object - served: true storage: false subresources: status: {} - - name: v1alpha3 + - name: v1beta1 schema: openAPIV3Schema: description: ClientIntents is the Schema for the intents API @@ -695,7 +695,7 @@ spec: type: object type: object served: true - storage: false + storage: true subresources: status: {} - name: v2alpha1 diff --git a/src/operator/config/crd/k8s.otterize.com_clientintents.yaml b/src/operator/config/crd/k8s.otterize.com_clientintents.yaml index d3c381074..c4c800c31 100644 --- a/src/operator/config/crd/k8s.otterize.com_clientintents.yaml +++ b/src/operator/config/crd/k8s.otterize.com_clientintents.yaml @@ -14,7 +14,142 @@ spec: singular: clientintents scope: Namespaced versions: - - name: v1 + - name: v1alpha2 + schema: + openAPIV3Schema: + description: ClientIntents is the Schema for the intents 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: IntentsSpec defines the desired state of ClientIntents + properties: + calls: + items: + properties: + databaseResources: + items: + properties: + databaseName: + type: string + operations: + items: + enum: + - ALL + - SELECT + - INSERT + - UPDATE + - DELETE + type: string + type: array + table: + type: string + required: + - databaseName + type: object + type: array + name: + type: string + resources: + items: + properties: + methods: + items: + enum: + - GET + - POST + - PUT + - DELETE + - OPTIONS + - TRACE + - PATCH + - CONNECT + type: string + type: array + path: + type: string + required: + - methods + - path + type: object + type: array + topics: + items: + properties: + name: + type: string + operations: + items: + enum: + - all + - consume + - produce + - create + - alter + - delete + - describe + - ClusterAction + - DescribeConfigs + - AlterConfigs + - IdempotentWrite + type: string + type: array + required: + - name + - operations + type: object + type: array + type: + enum: + - http + - kafka + - database + type: string + required: + - name + type: object + type: array + service: + properties: + name: + type: string + required: + - name + type: object + required: + - calls + - service + type: object + status: + description: IntentsStatus defines the observed state of ClientIntents + properties: + upToDate: + description: |- + upToDate field reflects whether the client intents have successfully been applied + to the cluster to the state specified + type: boolean + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1alpha3 schema: openAPIV3Schema: description: ClientIntents is the Schema for the intents API @@ -280,145 +415,10 @@ spec: type: object type: object served: true - storage: true - subresources: - status: {} - - name: v1alpha2 - schema: - openAPIV3Schema: - description: ClientIntents is the Schema for the intents 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: IntentsSpec defines the desired state of ClientIntents - properties: - calls: - items: - properties: - databaseResources: - items: - properties: - databaseName: - type: string - operations: - items: - enum: - - ALL - - SELECT - - INSERT - - UPDATE - - DELETE - type: string - type: array - table: - type: string - required: - - databaseName - type: object - type: array - name: - type: string - resources: - items: - properties: - methods: - items: - enum: - - GET - - POST - - PUT - - DELETE - - OPTIONS - - TRACE - - PATCH - - CONNECT - type: string - type: array - path: - type: string - required: - - methods - - path - type: object - type: array - topics: - items: - properties: - name: - type: string - operations: - items: - enum: - - all - - consume - - produce - - create - - alter - - delete - - describe - - ClusterAction - - DescribeConfigs - - AlterConfigs - - IdempotentWrite - type: string - type: array - required: - - name - - operations - type: object - type: array - type: - enum: - - http - - kafka - - database - type: string - required: - - name - type: object - type: array - service: - properties: - name: - type: string - required: - - name - type: object - required: - - calls - - service - type: object - status: - description: IntentsStatus defines the observed state of ClientIntents - properties: - upToDate: - description: |- - upToDate field reflects whether the client intents have successfully been applied - to the cluster to the state specified - type: boolean - type: object - type: object - served: true storage: false subresources: status: {} - - name: v1alpha3 + - name: v1beta1 schema: openAPIV3Schema: description: ClientIntents is the Schema for the intents API @@ -684,7 +684,7 @@ spec: type: object type: object served: true - storage: false + storage: true subresources: status: {} - name: v2alpha1 diff --git a/src/operator/config/crd/k8s.otterize.com_kafkaserverconfigs.patched b/src/operator/config/crd/k8s.otterize.com_kafkaserverconfigs.patched index a81e16529..864049764 100644 --- a/src/operator/config/crd/k8s.otterize.com_kafkaserverconfigs.patched +++ b/src/operator/config/crd/k8s.otterize.com_kafkaserverconfigs.patched @@ -28,7 +28,7 @@ spec: singular: kafkaserverconfig scope: Namespaced versions: - - name: v1 + - name: v1alpha2 schema: openAPIV3Schema: description: KafkaServerConfig is the Schema for the kafkaserverconfigs API @@ -62,8 +62,6 @@ spec: type: boolean service: properties: - kind: - type: string name: type: string required: @@ -109,10 +107,10 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} - - name: v1alpha2 + - name: v1alpha3 schema: openAPIV3Schema: description: KafkaServerConfig is the Schema for the kafkaserverconfigs API @@ -146,6 +144,8 @@ spec: type: boolean service: properties: + kind: + type: string name: type: string required: @@ -194,7 +194,7 @@ spec: storage: false subresources: status: {} - - name: v1alpha3 + - name: v1beta1 schema: openAPIV3Schema: description: KafkaServerConfig is the Schema for the kafkaserverconfigs API @@ -275,7 +275,7 @@ spec: type: object type: object served: true - storage: false + storage: true subresources: status: {} - name: v2alpha1 diff --git a/src/operator/config/crd/k8s.otterize.com_kafkaserverconfigs.yaml b/src/operator/config/crd/k8s.otterize.com_kafkaserverconfigs.yaml index 90fc3d64c..a2a8188a3 100644 --- a/src/operator/config/crd/k8s.otterize.com_kafkaserverconfigs.yaml +++ b/src/operator/config/crd/k8s.otterize.com_kafkaserverconfigs.yaml @@ -14,7 +14,7 @@ spec: singular: kafkaserverconfig scope: Namespaced versions: - - name: v1 + - name: v1alpha2 schema: openAPIV3Schema: description: KafkaServerConfig is the Schema for the kafkaserverconfigs API @@ -48,8 +48,6 @@ spec: type: boolean service: properties: - kind: - type: string name: type: string required: @@ -95,10 +93,10 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} - - name: v1alpha2 + - name: v1alpha3 schema: openAPIV3Schema: description: KafkaServerConfig is the Schema for the kafkaserverconfigs API @@ -132,6 +130,8 @@ spec: type: boolean service: properties: + kind: + type: string name: type: string required: @@ -180,7 +180,7 @@ spec: storage: false subresources: status: {} - - name: v1alpha3 + - name: v1beta1 schema: openAPIV3Schema: description: KafkaServerConfig is the Schema for the kafkaserverconfigs API @@ -261,7 +261,7 @@ spec: type: object type: object served: true - storage: false + storage: true subresources: status: {} - name: v2alpha1 diff --git a/src/operator/config/crd/k8s.otterize.com_mysqlserverconfigs.patched b/src/operator/config/crd/k8s.otterize.com_mysqlserverconfigs.patched index 464af2983..3d2128024 100644 --- a/src/operator/config/crd/k8s.otterize.com_mysqlserverconfigs.patched +++ b/src/operator/config/crd/k8s.otterize.com_mysqlserverconfigs.patched @@ -28,7 +28,7 @@ spec: singular: mysqlserverconfig scope: Namespaced versions: - - name: v1 + - name: v1alpha3 schema: openAPIV3Schema: description: MySQLServerConfig is the Schema for the mysqlserverconfig API @@ -94,10 +94,10 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} - - name: v1alpha3 + - name: v1beta1 schema: openAPIV3Schema: description: MySQLServerConfig is the Schema for the mysqlserverconfig API @@ -163,7 +163,7 @@ spec: type: object type: object served: true - storage: false + storage: true subresources: status: {} - name: v2alpha1 diff --git a/src/operator/config/crd/k8s.otterize.com_mysqlserverconfigs.yaml b/src/operator/config/crd/k8s.otterize.com_mysqlserverconfigs.yaml index ed984555a..13369251c 100644 --- a/src/operator/config/crd/k8s.otterize.com_mysqlserverconfigs.yaml +++ b/src/operator/config/crd/k8s.otterize.com_mysqlserverconfigs.yaml @@ -14,7 +14,7 @@ spec: singular: mysqlserverconfig scope: Namespaced versions: - - name: v1 + - name: v1alpha3 schema: openAPIV3Schema: description: MySQLServerConfig is the Schema for the mysqlserverconfig API @@ -87,10 +87,10 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} - - name: v1alpha3 + - name: v1beta1 schema: openAPIV3Schema: description: MySQLServerConfig is the Schema for the mysqlserverconfig API @@ -163,7 +163,7 @@ spec: type: object type: object served: true - storage: false + storage: true subresources: status: {} - name: v2alpha1 diff --git a/src/operator/config/crd/k8s.otterize.com_postgresqlserverconfigs.patched b/src/operator/config/crd/k8s.otterize.com_postgresqlserverconfigs.patched index 20562b785..b3b101982 100644 --- a/src/operator/config/crd/k8s.otterize.com_postgresqlserverconfigs.patched +++ b/src/operator/config/crd/k8s.otterize.com_postgresqlserverconfigs.patched @@ -28,7 +28,7 @@ spec: singular: postgresqlserverconfig scope: Namespaced versions: - - name: v1 + - name: v1alpha3 schema: openAPIV3Schema: description: PostgreSQLServerConfig is the Schema for the postgresqlserverconfig API @@ -94,10 +94,10 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} - - name: v1alpha3 + - name: v1beta1 schema: openAPIV3Schema: description: PostgreSQLServerConfig is the Schema for the postgresqlserverconfig API @@ -163,7 +163,7 @@ spec: type: object type: object served: true - storage: false + storage: true subresources: status: {} - name: v2alpha1 diff --git a/src/operator/config/crd/k8s.otterize.com_postgresqlserverconfigs.yaml b/src/operator/config/crd/k8s.otterize.com_postgresqlserverconfigs.yaml index 3bae2fbc0..1bf43a88c 100644 --- a/src/operator/config/crd/k8s.otterize.com_postgresqlserverconfigs.yaml +++ b/src/operator/config/crd/k8s.otterize.com_postgresqlserverconfigs.yaml @@ -14,7 +14,7 @@ spec: singular: postgresqlserverconfig scope: Namespaced versions: - - name: v1 + - name: v1alpha3 schema: openAPIV3Schema: description: PostgreSQLServerConfig is the Schema for the postgresqlserverconfig @@ -89,10 +89,10 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} - - name: v1alpha3 + - name: v1beta1 schema: openAPIV3Schema: description: PostgreSQLServerConfig is the Schema for the postgresqlserverconfig @@ -167,7 +167,7 @@ spec: type: object type: object served: true - storage: false + storage: true subresources: status: {} - name: v2alpha1 diff --git a/src/operator/config/crd/k8s.otterize.com_protectedservices.patched b/src/operator/config/crd/k8s.otterize.com_protectedservices.patched index 4e76b89c4..ebd3793f0 100644 --- a/src/operator/config/crd/k8s.otterize.com_protectedservices.patched +++ b/src/operator/config/crd/k8s.otterize.com_protectedservices.patched @@ -28,7 +28,7 @@ spec: singular: protectedservice scope: Namespaced versions: - - name: v1 + - name: v1alpha2 schema: openAPIV3Schema: description: ProtectedService is the Schema for the protectedservice API @@ -53,8 +53,6 @@ spec: spec: description: ProtectedServiceSpec defines the desired state of ProtectedService properties: - kind: - type: string name: type: string type: object @@ -63,10 +61,10 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} - - name: v1alpha2 + - name: v1alpha3 schema: openAPIV3Schema: description: ProtectedService is the Schema for the protectedservice API @@ -91,6 +89,8 @@ spec: spec: description: ProtectedServiceSpec defines the desired state of ProtectedService properties: + kind: + type: string name: type: string type: object @@ -102,7 +102,7 @@ spec: storage: false subresources: status: {} - - name: v1alpha3 + - name: v1beta1 schema: openAPIV3Schema: description: ProtectedService is the Schema for the protectedservice API @@ -137,7 +137,7 @@ spec: type: object type: object served: true - storage: false + storage: true subresources: status: {} - name: v2alpha1 diff --git a/src/operator/config/crd/k8s.otterize.com_protectedservices.yaml b/src/operator/config/crd/k8s.otterize.com_protectedservices.yaml index f2a8fc08c..fd1000203 100644 --- a/src/operator/config/crd/k8s.otterize.com_protectedservices.yaml +++ b/src/operator/config/crd/k8s.otterize.com_protectedservices.yaml @@ -14,7 +14,7 @@ spec: singular: protectedservice scope: Namespaced versions: - - name: v1 + - name: v1alpha2 schema: openAPIV3Schema: description: ProtectedService is the Schema for the protectedservice API @@ -39,8 +39,6 @@ spec: spec: description: ProtectedServiceSpec defines the desired state of ProtectedService properties: - kind: - type: string name: type: string type: object @@ -49,10 +47,10 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} - - name: v1alpha2 + - name: v1alpha3 schema: openAPIV3Schema: description: ProtectedService is the Schema for the protectedservice API @@ -77,6 +75,8 @@ spec: spec: description: ProtectedServiceSpec defines the desired state of ProtectedService properties: + kind: + type: string name: type: string type: object @@ -88,7 +88,7 @@ spec: storage: false subresources: status: {} - - name: v1alpha3 + - name: v1beta1 schema: openAPIV3Schema: description: ProtectedService is the Schema for the protectedservice API @@ -123,7 +123,7 @@ spec: type: object type: object served: true - storage: false + storage: true subresources: status: {} - name: v2alpha1 diff --git a/src/operator/config/webhook/manifests-patched b/src/operator/config/webhook/manifests-patched index e59f0be04..92d555587 100644 --- a/src/operator/config/webhook/manifests-patched +++ b/src/operator/config/webhook/manifests-patched @@ -44,15 +44,15 @@ webhooks: service: name: intents-operator-webhook-service namespace: {{ .Release.Namespace }} - path: /validate-k8s-otterize-com-v1-clientintents + path: /validate-k8s-otterize-com-v1alpha3-clientintents failurePolicy: Fail matchPolicy: Exact - name: clientintentsv1.kb.io + name: clientintentsv1alpha3.kb.io rules: - apiGroups: - k8s.otterize.com apiVersions: - - v1 + - v1alpha3 operations: - CREATE - UPDATE @@ -65,15 +65,15 @@ webhooks: service: name: intents-operator-webhook-service namespace: {{ .Release.Namespace }} - path: /validate-k8s-otterize-com-v1alpha3-clientintents + path: /validate-k8s-otterize-com-v1beta1-clientintents failurePolicy: Fail matchPolicy: Exact - name: clientintentsv1alpha3.kb.io + name: clientintentsv1beta1.kb.io rules: - apiGroups: - k8s.otterize.com apiVersions: - - v1alpha3 + - v1beta1 operations: - CREATE - UPDATE @@ -136,7 +136,7 @@ webhooks: - apiGroups: - k8s.otterize.com apiVersions: - - v1 + - v1beta1 operations: - CREATE - UPDATE @@ -199,7 +199,7 @@ webhooks: - apiGroups: - k8s.otterize.com apiVersions: - - v1 + - v1beta1 operations: - CREATE - UPDATE @@ -262,7 +262,7 @@ webhooks: - apiGroups: - k8s.otterize.com apiVersions: - - v1 + - v1beta1 operations: - CREATE - UPDATE diff --git a/src/operator/config/webhook/manifests.yaml b/src/operator/config/webhook/manifests.yaml index e627260b6..6a964e836 100644 --- a/src/operator/config/webhook/manifests.yaml +++ b/src/operator/config/webhook/manifests.yaml @@ -31,15 +31,15 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-k8s-otterize-com-v1-clientintents + path: /validate-k8s-otterize-com-v1alpha3-clientintents failurePolicy: Fail matchPolicy: Exact - name: clientintentsv1.kb.io + name: clientintentsv1alpha3.kb.io rules: - apiGroups: - k8s.otterize.com apiVersions: - - v1 + - v1alpha3 operations: - CREATE - UPDATE @@ -52,15 +52,15 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-k8s-otterize-com-v1alpha3-clientintents + path: /validate-k8s-otterize-com-v1beta1-clientintents failurePolicy: Fail matchPolicy: Exact - name: clientintentsv1alpha3.kb.io + name: clientintentsv1beta1.kb.io rules: - apiGroups: - k8s.otterize.com apiVersions: - - v1alpha3 + - v1beta1 operations: - CREATE - UPDATE @@ -123,7 +123,7 @@ webhooks: - apiGroups: - k8s.otterize.com apiVersions: - - v1 + - v1beta1 operations: - CREATE - UPDATE @@ -186,7 +186,7 @@ webhooks: - apiGroups: - k8s.otterize.com apiVersions: - - v1 + - v1beta1 operations: - CREATE - UPDATE @@ -249,7 +249,7 @@ webhooks: - apiGroups: - k8s.otterize.com apiVersions: - - v1 + - v1beta1 operations: - CREATE - UPDATE diff --git a/src/operator/controllers/intents_reconcilers/external_traffic_network_policy/external_traffic_network_policy_test.go b/src/operator/controllers/intents_reconcilers/external_traffic_network_policy/external_traffic_network_policy_test.go index 4ad250db8..597c63f1a 100644 --- a/src/operator/controllers/intents_reconcilers/external_traffic_network_policy/external_traffic_network_policy_test.go +++ b/src/operator/controllers/intents_reconcilers/external_traffic_network_policy/external_traffic_network_policy_test.go @@ -5,9 +5,9 @@ import ( "fmt" "github.com/amit7itz/goset" "github.com/google/uuid" - otterizev1 "github.com/otterize/intents-operator/src/operator/api/v1" otterizev1alpha2 "github.com/otterize/intents-operator/src/operator/api/v1alpha2" otterizev1alpha3 "github.com/otterize/intents-operator/src/operator/api/v1alpha3" + otterizev1beta1 "github.com/otterize/intents-operator/src/operator/api/v1beta1" otterizev2alpha1 "github.com/otterize/intents-operator/src/operator/api/v2alpha1" "github.com/otterize/intents-operator/src/operator/controllers" "github.com/otterize/intents-operator/src/operator/controllers/external_traffic" @@ -67,7 +67,7 @@ func (s *ExternalNetworkPolicyReconcilerTestSuite) SetupSuite() { utilruntime.Must(istiosecurityscheme.AddToScheme(s.TestEnv.Scheme)) utilruntime.Must(otterizev1alpha2.AddToScheme(s.TestEnv.Scheme)) utilruntime.Must(otterizev1alpha3.AddToScheme(s.TestEnv.Scheme)) - utilruntime.Must(otterizev1.AddToScheme(s.TestEnv.Scheme)) + utilruntime.Must(otterizev1beta1.AddToScheme(s.TestEnv.Scheme)) utilruntime.Must(otterizev2alpha1.AddToScheme(s.TestEnv.Scheme)) s.RestConfig, err = s.TestEnv.Start() diff --git a/src/operator/controllers/intents_reconcilers/external_traffic_network_policy/external_traffic_network_policy_with_ingress_controllers_configured_test.go b/src/operator/controllers/intents_reconcilers/external_traffic_network_policy/external_traffic_network_policy_with_ingress_controllers_configured_test.go index 7040a4594..6fbc6c23d 100644 --- a/src/operator/controllers/intents_reconcilers/external_traffic_network_policy/external_traffic_network_policy_with_ingress_controllers_configured_test.go +++ b/src/operator/controllers/intents_reconcilers/external_traffic_network_policy/external_traffic_network_policy_with_ingress_controllers_configured_test.go @@ -5,9 +5,9 @@ import ( "fmt" "github.com/amit7itz/goset" "github.com/google/uuid" - otterizev1 "github.com/otterize/intents-operator/src/operator/api/v1" otterizev1alpha2 "github.com/otterize/intents-operator/src/operator/api/v1alpha2" otterizev1alpha3 "github.com/otterize/intents-operator/src/operator/api/v1alpha3" + otterizev1beta1 "github.com/otterize/intents-operator/src/operator/api/v1beta1" otterizev2alpha1 "github.com/otterize/intents-operator/src/operator/api/v2alpha1" "github.com/otterize/intents-operator/src/operator/controllers" "github.com/otterize/intents-operator/src/operator/controllers/external_traffic" @@ -74,7 +74,7 @@ func (s *ExternalNetworkPolicyReconcilerWithIngressControllersConfiguredTestSuit utilruntime.Must(istiosecurityscheme.AddToScheme(s.TestEnv.Scheme)) utilruntime.Must(otterizev1alpha2.AddToScheme(s.TestEnv.Scheme)) utilruntime.Must(otterizev1alpha3.AddToScheme(s.TestEnv.Scheme)) - utilruntime.Must(otterizev1.AddToScheme(s.TestEnv.Scheme)) + utilruntime.Must(otterizev1beta1.AddToScheme(s.TestEnv.Scheme)) utilruntime.Must(otterizev2alpha1.AddToScheme(s.TestEnv.Scheme)) s.RestConfig, err = s.TestEnv.Start() diff --git a/src/operator/controllers/intents_reconcilers/external_traffic_network_policy/external_traffic_network_policy_with_no_intents_test.go b/src/operator/controllers/intents_reconcilers/external_traffic_network_policy/external_traffic_network_policy_with_no_intents_test.go index d4609c088..5add75bcb 100644 --- a/src/operator/controllers/intents_reconcilers/external_traffic_network_policy/external_traffic_network_policy_with_no_intents_test.go +++ b/src/operator/controllers/intents_reconcilers/external_traffic_network_policy/external_traffic_network_policy_with_no_intents_test.go @@ -4,9 +4,9 @@ import ( "context" "fmt" "github.com/amit7itz/goset" - otterizev1 "github.com/otterize/intents-operator/src/operator/api/v1" otterizev1alpha2 "github.com/otterize/intents-operator/src/operator/api/v1alpha2" otterizev1alpha3 "github.com/otterize/intents-operator/src/operator/api/v1alpha3" + otterizev1beta1 "github.com/otterize/intents-operator/src/operator/api/v1beta1" otterizev2alpha1 "github.com/otterize/intents-operator/src/operator/api/v2alpha1" "github.com/otterize/intents-operator/src/operator/controllers" "github.com/otterize/intents-operator/src/operator/controllers/external_traffic" @@ -63,7 +63,7 @@ func (s *ExternalNetworkPolicyReconcilerWithNoIntentsTestSuite) SetupSuite() { utilruntime.Must(istiosecurityscheme.AddToScheme(s.TestEnv.Scheme)) utilruntime.Must(otterizev1alpha2.AddToScheme(s.TestEnv.Scheme)) utilruntime.Must(otterizev1alpha3.AddToScheme(s.TestEnv.Scheme)) - utilruntime.Must(otterizev1.AddToScheme(s.TestEnv.Scheme)) + utilruntime.Must(otterizev1beta1.AddToScheme(s.TestEnv.Scheme)) utilruntime.Must(otterizev2alpha1.AddToScheme(s.TestEnv.Scheme)) s.RestConfig, err = s.TestEnv.Start() diff --git a/src/operator/controllers/intents_reconcilers/iam/iam_reconciler.go b/src/operator/controllers/intents_reconcilers/iam/iam_reconciler.go index 3a2f4d1c9..4205d69de 100644 --- a/src/operator/controllers/intents_reconcilers/iam/iam_reconciler.go +++ b/src/operator/controllers/intents_reconcilers/iam/iam_reconciler.go @@ -141,6 +141,9 @@ func (r *IAMIntentsReconciler) hasMultipleClientsForServiceAccount(ctx context.C countUsesOfServiceAccountName := 0 for _, intent := range intentsWithSameTypeInSameNamespace { pod, err := r.serviceIdResolver.ResolveClientIntentToPod(ctx, intent) + if errors.Is(err, serviceidresolver.ErrPodNotFound) { + continue + } if err != nil { return false, errors.Wrap(err) } diff --git a/src/operator/controllers/intents_reconcilers/kafka_acls_test.go b/src/operator/controllers/intents_reconcilers/kafka_acls_test.go index d1595095b..1652f74cb 100644 --- a/src/operator/controllers/intents_reconcilers/kafka_acls_test.go +++ b/src/operator/controllers/intents_reconcilers/kafka_acls_test.go @@ -5,9 +5,9 @@ import ( "fmt" "github.com/Shopify/sarama" "github.com/google/uuid" - otterizev1 "github.com/otterize/intents-operator/src/operator/api/v1" otterizev1alpha2 "github.com/otterize/intents-operator/src/operator/api/v1alpha2" otterizev1alpha3 "github.com/otterize/intents-operator/src/operator/api/v1alpha3" + otterizev1beta1 "github.com/otterize/intents-operator/src/operator/api/v1beta1" otterizev2alpha1 "github.com/otterize/intents-operator/src/operator/api/v2alpha1" "github.com/otterize/intents-operator/src/operator/controllers/intents_reconcilers/consts" intentsreconcilersmocks "github.com/otterize/intents-operator/src/operator/controllers/intents_reconcilers/mocks" @@ -72,7 +72,7 @@ func (s *KafkaACLReconcilerTestSuite) SetupSuite() { utilruntime.Must(istiosecurityscheme.AddToScheme(s.TestEnv.Scheme)) utilruntime.Must(otterizev1alpha2.AddToScheme(s.TestEnv.Scheme)) utilruntime.Must(otterizev1alpha3.AddToScheme(s.TestEnv.Scheme)) - utilruntime.Must(otterizev1.AddToScheme(s.TestEnv.Scheme)) + utilruntime.Must(otterizev1beta1.AddToScheme(s.TestEnv.Scheme)) utilruntime.Must(otterizev2alpha1.AddToScheme(s.TestEnv.Scheme)) s.RestConfig, err = s.TestEnv.Start() diff --git a/src/operator/controllers/pod_reconcilers/pods_test.go b/src/operator/controllers/pod_reconcilers/pods_test.go index 3829f82a0..8451dbc8c 100644 --- a/src/operator/controllers/pod_reconcilers/pods_test.go +++ b/src/operator/controllers/pod_reconcilers/pods_test.go @@ -3,9 +3,9 @@ package pod_reconcilers import ( "context" "fmt" - otterizev1 "github.com/otterize/intents-operator/src/operator/api/v1" otterizev1alpha2 "github.com/otterize/intents-operator/src/operator/api/v1alpha2" otterizev1alpha3 "github.com/otterize/intents-operator/src/operator/api/v1alpha3" + otterizev1beta1 "github.com/otterize/intents-operator/src/operator/api/v1beta1" otterizev2alpha1 "github.com/otterize/intents-operator/src/operator/api/v2alpha1" mocks "github.com/otterize/intents-operator/src/operator/controllers/intents_reconcilers/mocks" podreconcilersmocks "github.com/otterize/intents-operator/src/operator/controllers/pod_reconcilers/mocks" @@ -49,7 +49,7 @@ func (s *WatcherPodLabelReconcilerTestSuite) SetupSuite() { utilruntime.Must(istiosecurityscheme.AddToScheme(s.TestEnv.Scheme)) utilruntime.Must(otterizev1alpha2.AddToScheme(s.TestEnv.Scheme)) utilruntime.Must(otterizev1alpha3.AddToScheme(s.TestEnv.Scheme)) - utilruntime.Must(otterizev1.AddToScheme(s.TestEnv.Scheme)) + utilruntime.Must(otterizev1beta1.AddToScheme(s.TestEnv.Scheme)) utilruntime.Must(otterizev2alpha1.AddToScheme(s.TestEnv.Scheme)) s.RestConfig, err = s.TestEnv.Start() diff --git a/src/operator/main.go b/src/operator/main.go index 149847876..050778199 100644 --- a/src/operator/main.go +++ b/src/operator/main.go @@ -20,8 +20,8 @@ import ( "context" "github.com/amit7itz/goset" "github.com/bombsimon/logrusr/v3" - otterizev1 "github.com/otterize/intents-operator/src/operator/api/v1" otterizev1alpha2 "github.com/otterize/intents-operator/src/operator/api/v1alpha2" + otterizev1beta1 "github.com/otterize/intents-operator/src/operator/api/v1beta1" otterizev2alpha1 "github.com/otterize/intents-operator/src/operator/api/v2alpha1" "github.com/otterize/intents-operator/src/operator/controllers" "github.com/otterize/intents-operator/src/operator/controllers/external_traffic" @@ -98,7 +98,7 @@ func init() { utilruntime.Must(istiosecurityscheme.AddToScheme(scheme)) utilruntime.Must(otterizev1alpha2.AddToScheme(scheme)) utilruntime.Must(otterizev1alpha3.AddToScheme(scheme)) - utilruntime.Must(otterizev1.AddToScheme(scheme)) + utilruntime.Must(otterizev1beta1.AddToScheme(scheme)) utilruntime.Must(otterizev2alpha1.AddToScheme(scheme)) // Config Connector CRDs @@ -559,7 +559,7 @@ func initWebhookValidators(mgr manager.Manager) { } intentsValidatorV1 := webhooks.NewIntentsValidatorV1(mgr.GetClient()) - if err := (&otterizev1.ClientIntents{}).SetupWebhookWithManager(mgr, intentsValidatorV1); err != nil { + if err := (&otterizev1beta1.ClientIntents{}).SetupWebhookWithManager(mgr, intentsValidatorV1); err != nil { logrus.WithError(err).Panic(err, "unable to create webhook v1", "webhook", "ClientIntents") } @@ -579,7 +579,7 @@ func initWebhookValidators(mgr manager.Manager) { } protectedServiceValidatorV1 := webhooks.NewProtectedServiceValidatorV1(mgr.GetClient()) - if err := (&otterizev1.ProtectedService{}).SetupWebhookWithManager(mgr, protectedServiceValidatorV1); err != nil { + if err := (&otterizev1beta1.ProtectedService{}).SetupWebhookWithManager(mgr, protectedServiceValidatorV1); err != nil { logrus.WithError(err).Panic("unable to create webhook v1", "webhook", "ProtectedService") } @@ -596,7 +596,7 @@ func initWebhookValidators(mgr manager.Manager) { logrus.WithError(err).Panic("unable to create webhook v1alpha3", "webhook", "KafkaServerConfig") } - if err := (&otterizev1.KafkaServerConfig{}).SetupWebhookWithManager(mgr); err != nil { + if err := (&otterizev1beta1.KafkaServerConfig{}).SetupWebhookWithManager(mgr); err != nil { logrus.WithError(err).Panic("unable to create webhook v1", "webhook", "KafkaServerConfig") } @@ -610,7 +610,7 @@ func initWebhookValidators(mgr manager.Manager) { } pgServerConfValidatorV1 := webhooks.NewPostgresConfValidatorV1(mgr.GetClient()) - if err := (&otterizev1.PostgreSQLServerConfig{}).SetupWebhookWithManager(mgr, pgServerConfValidatorV1); err != nil { + if err := (&otterizev1beta1.PostgreSQLServerConfig{}).SetupWebhookWithManager(mgr, pgServerConfValidatorV1); err != nil { logrus.WithError(err).Panic("unable to create webhook v1", "webhook", "PostgreSQLServerConfig") } @@ -625,7 +625,7 @@ func initWebhookValidators(mgr manager.Manager) { } mysqlServerConfValidatorV1 := webhooks.NewMySQLConfValidatorV1(mgr.GetClient()) - if err := (&otterizev1.MySQLServerConfig{}).SetupWebhookWithManager(mgr, mysqlServerConfValidatorV1); err != nil { + if err := (&otterizev1beta1.MySQLServerConfig{}).SetupWebhookWithManager(mgr, mysqlServerConfValidatorV1); err != nil { logrus.WithError(err).Panic("unable to create webhook v1", "webhook", "MySQLServerConfig") } diff --git a/src/operator/otterizecrds/clientintents-customresourcedefinition.yaml b/src/operator/otterizecrds/clientintents-customresourcedefinition.yaml index 6fc9f77a9..fbf5c934f 100644 --- a/src/operator/otterizecrds/clientintents-customresourcedefinition.yaml +++ b/src/operator/otterizecrds/clientintents-customresourcedefinition.yaml @@ -27,7 +27,142 @@ spec: singular: clientintents scope: Namespaced versions: - - name: v1 + - name: v1alpha2 + schema: + openAPIV3Schema: + description: ClientIntents is the Schema for the intents 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: IntentsSpec defines the desired state of ClientIntents + properties: + calls: + items: + properties: + databaseResources: + items: + properties: + databaseName: + type: string + operations: + items: + enum: + - ALL + - SELECT + - INSERT + - UPDATE + - DELETE + type: string + type: array + table: + type: string + required: + - databaseName + type: object + type: array + name: + type: string + resources: + items: + properties: + methods: + items: + enum: + - GET + - POST + - PUT + - DELETE + - OPTIONS + - TRACE + - PATCH + - CONNECT + type: string + type: array + path: + type: string + required: + - methods + - path + type: object + type: array + topics: + items: + properties: + name: + type: string + operations: + items: + enum: + - all + - consume + - produce + - create + - alter + - delete + - describe + - ClusterAction + - DescribeConfigs + - AlterConfigs + - IdempotentWrite + type: string + type: array + required: + - name + - operations + type: object + type: array + type: + enum: + - http + - kafka + - database + type: string + required: + - name + type: object + type: array + service: + properties: + name: + type: string + required: + - name + type: object + required: + - calls + - service + type: object + status: + description: IntentsStatus defines the observed state of ClientIntents + properties: + upToDate: + description: |- + upToDate field reflects whether the client intents have successfully been applied + to the cluster to the state specified + type: boolean + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1alpha3 schema: openAPIV3Schema: description: ClientIntents is the Schema for the intents API @@ -292,145 +427,10 @@ spec: type: object type: object served: true - storage: true - subresources: - status: {} - - name: v1alpha2 - schema: - openAPIV3Schema: - description: ClientIntents is the Schema for the intents 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: IntentsSpec defines the desired state of ClientIntents - properties: - calls: - items: - properties: - databaseResources: - items: - properties: - databaseName: - type: string - operations: - items: - enum: - - ALL - - SELECT - - INSERT - - UPDATE - - DELETE - type: string - type: array - table: - type: string - required: - - databaseName - type: object - type: array - name: - type: string - resources: - items: - properties: - methods: - items: - enum: - - GET - - POST - - PUT - - DELETE - - OPTIONS - - TRACE - - PATCH - - CONNECT - type: string - type: array - path: - type: string - required: - - methods - - path - type: object - type: array - topics: - items: - properties: - name: - type: string - operations: - items: - enum: - - all - - consume - - produce - - create - - alter - - delete - - describe - - ClusterAction - - DescribeConfigs - - AlterConfigs - - IdempotentWrite - type: string - type: array - required: - - name - - operations - type: object - type: array - type: - enum: - - http - - kafka - - database - type: string - required: - - name - type: object - type: array - service: - properties: - name: - type: string - required: - - name - type: object - required: - - calls - - service - type: object - status: - description: IntentsStatus defines the observed state of ClientIntents - properties: - upToDate: - description: |- - upToDate field reflects whether the client intents have successfully been applied - to the cluster to the state specified - type: boolean - type: object - type: object - served: true storage: false subresources: status: {} - - name: v1alpha3 + - name: v1beta1 schema: openAPIV3Schema: description: ClientIntents is the Schema for the intents API @@ -695,7 +695,7 @@ spec: type: object type: object served: true - storage: false + storage: true subresources: status: {} - name: v2alpha1 diff --git a/src/operator/otterizecrds/kafkaserverconfigs-customresourcedefinition.yaml b/src/operator/otterizecrds/kafkaserverconfigs-customresourcedefinition.yaml index a81e16529..864049764 100644 --- a/src/operator/otterizecrds/kafkaserverconfigs-customresourcedefinition.yaml +++ b/src/operator/otterizecrds/kafkaserverconfigs-customresourcedefinition.yaml @@ -28,7 +28,7 @@ spec: singular: kafkaserverconfig scope: Namespaced versions: - - name: v1 + - name: v1alpha2 schema: openAPIV3Schema: description: KafkaServerConfig is the Schema for the kafkaserverconfigs API @@ -62,8 +62,6 @@ spec: type: boolean service: properties: - kind: - type: string name: type: string required: @@ -109,10 +107,10 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} - - name: v1alpha2 + - name: v1alpha3 schema: openAPIV3Schema: description: KafkaServerConfig is the Schema for the kafkaserverconfigs API @@ -146,6 +144,8 @@ spec: type: boolean service: properties: + kind: + type: string name: type: string required: @@ -194,7 +194,7 @@ spec: storage: false subresources: status: {} - - name: v1alpha3 + - name: v1beta1 schema: openAPIV3Schema: description: KafkaServerConfig is the Schema for the kafkaserverconfigs API @@ -275,7 +275,7 @@ spec: type: object type: object served: true - storage: false + storage: true subresources: status: {} - name: v2alpha1 diff --git a/src/operator/otterizecrds/mysqlserverconfigs-customresourcedefinition.yaml b/src/operator/otterizecrds/mysqlserverconfigs-customresourcedefinition.yaml index 464af2983..3d2128024 100644 --- a/src/operator/otterizecrds/mysqlserverconfigs-customresourcedefinition.yaml +++ b/src/operator/otterizecrds/mysqlserverconfigs-customresourcedefinition.yaml @@ -28,7 +28,7 @@ spec: singular: mysqlserverconfig scope: Namespaced versions: - - name: v1 + - name: v1alpha3 schema: openAPIV3Schema: description: MySQLServerConfig is the Schema for the mysqlserverconfig API @@ -94,10 +94,10 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} - - name: v1alpha3 + - name: v1beta1 schema: openAPIV3Schema: description: MySQLServerConfig is the Schema for the mysqlserverconfig API @@ -163,7 +163,7 @@ spec: type: object type: object served: true - storage: false + storage: true subresources: status: {} - name: v2alpha1 diff --git a/src/operator/otterizecrds/postgresqlserverconfigs-customresourcedefinition.yaml b/src/operator/otterizecrds/postgresqlserverconfigs-customresourcedefinition.yaml index 20562b785..b3b101982 100644 --- a/src/operator/otterizecrds/postgresqlserverconfigs-customresourcedefinition.yaml +++ b/src/operator/otterizecrds/postgresqlserverconfigs-customresourcedefinition.yaml @@ -28,7 +28,7 @@ spec: singular: postgresqlserverconfig scope: Namespaced versions: - - name: v1 + - name: v1alpha3 schema: openAPIV3Schema: description: PostgreSQLServerConfig is the Schema for the postgresqlserverconfig API @@ -94,10 +94,10 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} - - name: v1alpha3 + - name: v1beta1 schema: openAPIV3Schema: description: PostgreSQLServerConfig is the Schema for the postgresqlserverconfig API @@ -163,7 +163,7 @@ spec: type: object type: object served: true - storage: false + storage: true subresources: status: {} - name: v2alpha1 diff --git a/src/operator/otterizecrds/protectedservices-customresourcedefinition.yaml b/src/operator/otterizecrds/protectedservices-customresourcedefinition.yaml index 4e76b89c4..ebd3793f0 100644 --- a/src/operator/otterizecrds/protectedservices-customresourcedefinition.yaml +++ b/src/operator/otterizecrds/protectedservices-customresourcedefinition.yaml @@ -28,7 +28,7 @@ spec: singular: protectedservice scope: Namespaced versions: - - name: v1 + - name: v1alpha2 schema: openAPIV3Schema: description: ProtectedService is the Schema for the protectedservice API @@ -53,8 +53,6 @@ spec: spec: description: ProtectedServiceSpec defines the desired state of ProtectedService properties: - kind: - type: string name: type: string type: object @@ -63,10 +61,10 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} - - name: v1alpha2 + - name: v1alpha3 schema: openAPIV3Schema: description: ProtectedService is the Schema for the protectedservice API @@ -91,6 +89,8 @@ spec: spec: description: ProtectedServiceSpec defines the desired state of ProtectedService properties: + kind: + type: string name: type: string type: object @@ -102,7 +102,7 @@ spec: storage: false subresources: status: {} - - name: v1alpha3 + - name: v1beta1 schema: openAPIV3Schema: description: ProtectedService is the Schema for the protectedservice API @@ -137,7 +137,7 @@ spec: type: object type: object served: true - storage: false + storage: true subresources: status: {} - name: v2alpha1 diff --git a/src/operator/webhooks/clientintents_webhook_v1.go b/src/operator/webhooks/clientintents_webhook_v1.go index 52edd263f..35088719b 100644 --- a/src/operator/webhooks/clientintents_webhook_v1.go +++ b/src/operator/webhooks/clientintents_webhook_v1.go @@ -19,7 +19,7 @@ package webhooks import ( "context" "fmt" - otterizev1 "github.com/otterize/intents-operator/src/operator/api/v1" + otterizev1beta1 "github.com/otterize/intents-operator/src/operator/api/v1beta1" "github.com/otterize/intents-operator/src/shared/errors" "golang.org/x/net/idna" k8serrors "k8s.io/apimachinery/pkg/api/errors" @@ -40,7 +40,7 @@ type IntentsValidatorV1 struct { func (v *IntentsValidatorV1) SetupWebhookWithManager(mgr ctrl.Manager) error { return ctrl.NewWebhookManagedBy(mgr). - For(&otterizev1.ClientIntents{}). + For(&otterizev1beta1.ClientIntents{}). WithValidator(v). Complete() } @@ -51,15 +51,15 @@ func NewIntentsValidatorV1(c client.Client) *IntentsValidatorV1 { } } -//+kubebuilder:webhook:matchPolicy=Exact,path=/validate-k8s-otterize-com-v1-clientintents,mutating=false,failurePolicy=fail,sideEffects=None,groups=k8s.otterize.com,resources=clientintents,verbs=create;update,versions=v1,name=clientintentsv1.kb.io,admissionReviewVersions=v1 +//+kubebuilder:webhook:matchPolicy=Exact,path=/validate-k8s-otterize-com-v1beta1-clientintents,mutating=false,failurePolicy=fail,sideEffects=None,groups=k8s.otterize.com,resources=clientintents,verbs=create;update,versions=v1beta1,name=clientintentsv1beta1.kb.io,admissionReviewVersions=v1 var _ webhook.CustomValidator = &IntentsValidatorV1{} // ValidateCreate implements webhook.Validator so a webhook will be registered for the type func (v *IntentsValidatorV1) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) { var allErrs field.ErrorList - intentsObj := obj.(*otterizev1.ClientIntents) - intentsList := &otterizev1.ClientIntentsList{} + intentsObj := obj.(*otterizev1beta1.ClientIntents) + intentsList := &otterizev1beta1.ClientIntentsList{} if err := v.List(ctx, intentsList, &client.ListOptions{Namespace: intentsObj.Namespace}); err != nil { return nil, errors.Wrap(err) } @@ -84,8 +84,8 @@ func (v *IntentsValidatorV1) ValidateCreate(ctx context.Context, obj runtime.Obj // ValidateUpdate implements webhook.Validator so a webhook will be registered for the type func (v *IntentsValidatorV1) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (admission.Warnings, error) { var allErrs field.ErrorList - intentsObj := newObj.(*otterizev1.ClientIntents) - intentsList := &otterizev1.ClientIntentsList{} + intentsObj := newObj.(*otterizev1beta1.ClientIntents) + intentsList := &otterizev1beta1.ClientIntentsList{} if err := v.List(ctx, intentsList, &client.ListOptions{Namespace: intentsObj.Namespace}); err != nil { return nil, errors.Wrap(err) } @@ -113,8 +113,8 @@ func (v *IntentsValidatorV1) ValidateDelete(ctx context.Context, obj runtime.Obj } func (v *IntentsValidatorV1) validateNoDuplicateClients( - intentsObj *otterizev1.ClientIntents, - intentsList *otterizev1.ClientIntentsList) *field.Error { + intentsObj *otterizev1beta1.ClientIntents, + intentsList *otterizev1beta1.ClientIntentsList) *field.Error { desiredClientName := intentsObj.GetServiceName() for _, existingIntent := range intentsList.Items { @@ -133,7 +133,7 @@ func (v *IntentsValidatorV1) validateNoDuplicateClients( } // validateSpec -func (v *IntentsValidatorV1) validateSpec(intents *otterizev1.ClientIntents) *field.Error { +func (v *IntentsValidatorV1) validateSpec(intents *otterizev1beta1.ClientIntents) *field.Error { // validate that if kind is specified, it starts with an uppercase letter if kind := intents.Spec.Service.Kind; kind != "" && strings.ToUpper(string(kind[0])) != string(kind[0]) { return &field.Error{ @@ -143,28 +143,28 @@ func (v *IntentsValidatorV1) validateSpec(intents *otterizev1.ClientIntents) *fi } } for _, intent := range intents.GetCallsList() { - if len(intent.Name) == 0 && intent.Type != otterizev1.IntentTypeInternet { + if len(intent.Name) == 0 && intent.Type != otterizev1beta1.IntentTypeInternet { return &field.Error{ Type: field.ErrorTypeRequired, Field: "name", Detail: "invalid intent format, field name is required", } } - if intent.Type == otterizev1.IntentTypeHTTP { + if intent.Type == otterizev1beta1.IntentTypeHTTP { if intent.Topics != nil { return &field.Error{ Type: field.ErrorTypeForbidden, Field: "topics", - Detail: fmt.Sprintf("invalid intent format. type %s cannot contain kafka topics", otterizev1.IntentTypeHTTP), + Detail: fmt.Sprintf("invalid intent format. type %s cannot contain kafka topics", otterizev1beta1.IntentTypeHTTP), } } } - if intent.Type == otterizev1.IntentTypeInternet { // every ips should be valid ip + if intent.Type == otterizev1beta1.IntentTypeInternet { // every ips should be valid ip if intent.Internet == nil { return &field.Error{ Type: field.ErrorTypeRequired, Field: "internet", - Detail: fmt.Sprintf("invalid intent format. type %s must contain internet object", otterizev1.IntentTypeInternet), + Detail: fmt.Sprintf("invalid intent format. type %s must contain internet object", otterizev1beta1.IntentTypeInternet), } } hasIPs := len(intent.Internet.Ips) > 0 @@ -173,7 +173,7 @@ func (v *IntentsValidatorV1) validateSpec(intents *otterizev1.ClientIntents) *fi return &field.Error{ Type: field.ErrorTypeRequired, Field: "ips", - Detail: fmt.Sprintf("invalid intent format. type %s must contain ips or domanin names", otterizev1.IntentTypeInternet), + Detail: fmt.Sprintf("invalid intent format. type %s must contain ips or domanin names", otterizev1beta1.IntentTypeInternet), } } for _, dns := range intent.Internet.Domains { @@ -192,7 +192,7 @@ func (v *IntentsValidatorV1) validateSpec(intents *otterizev1.ClientIntents) *fi return &field.Error{ Type: field.ErrorTypeRequired, Field: "ips", - Detail: fmt.Sprintf("invalid intent format. type %s must contain ips", otterizev1.IntentTypeInternet), + Detail: fmt.Sprintf("invalid intent format. type %s must contain ips", otterizev1beta1.IntentTypeInternet), } } diff --git a/src/operator/webhooks/database_server_conf_utils.go b/src/operator/webhooks/database_server_conf_utils.go index f438cca50..1c0668735 100644 --- a/src/operator/webhooks/database_server_conf_utils.go +++ b/src/operator/webhooks/database_server_conf_utils.go @@ -3,8 +3,8 @@ package webhooks import ( "context" "fmt" - otterizev1 "github.com/otterize/intents-operator/src/operator/api/v1" otterizev1alpha3 "github.com/otterize/intents-operator/src/operator/api/v1alpha3" + otterizev1beta1 "github.com/otterize/intents-operator/src/operator/api/v1beta1" otterizev2alpha1 "github.com/otterize/intents-operator/src/operator/api/v2alpha1" "github.com/otterize/intents-operator/src/shared/errors" "github.com/samber/lo" @@ -136,7 +136,7 @@ func validateCredentialsNotEmptyV1alpha3(credentials otterizev1alpha3.DatabaseCr return nil } -func validateCredentialsNotEmptyV1(credentials otterizev1.DatabaseCredentials) *field.Error { +func validateCredentialsNotEmptyV1(credentials otterizev1beta1.DatabaseCredentials) *field.Error { if (credentials.Username == "" || credentials.Password == "") && credentials.SecretRef == nil { return &field.Error{ Type: field.ErrorTypeRequired, diff --git a/src/operator/webhooks/mysqlserverconfigs_webhook_v1.go b/src/operator/webhooks/mysqlserverconfigs_webhook_v1.go index 0791d6a66..8743fd0f0 100644 --- a/src/operator/webhooks/mysqlserverconfigs_webhook_v1.go +++ b/src/operator/webhooks/mysqlserverconfigs_webhook_v1.go @@ -19,7 +19,7 @@ package webhooks import ( "context" goerrors "errors" - otterizev1 "github.com/otterize/intents-operator/src/operator/api/v1" + otterizev1beta1 "github.com/otterize/intents-operator/src/operator/api/v1beta1" "github.com/otterize/intents-operator/src/shared/errors" k8serrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" @@ -37,7 +37,7 @@ type MySQLConfValidatorV1 struct { func (v *MySQLConfValidatorV1) SetupWebhookWithManager(mgr ctrl.Manager) error { return ctrl.NewWebhookManagedBy(mgr). - For(&otterizev1.MySQLServerConfig{}). + For(&otterizev1beta1.MySQLServerConfig{}). WithValidator(v). Complete() } @@ -48,7 +48,7 @@ func NewMySQLConfValidatorV1(c client.Client) *MySQLConfValidatorV1 { } } -//+kubebuilder:webhook:matchPolicy=Exact,path=/validate-k8s-otterize-com-v1-mysqlserverconfig,mutating=false,failurePolicy=fail,sideEffects=None,groups=k8s.otterize.com,resources=mysqlserverconfigs,verbs=create;update,versions=v1,name=mysqlserverconfigv1.kb.io,admissionReviewVersions=v1 +//+kubebuilder:webhook:matchPolicy=Exact,path=/validate-k8s-otterize-com-v1-mysqlserverconfig,mutating=false,failurePolicy=fail,sideEffects=None,groups=k8s.otterize.com,resources=mysqlserverconfigs,verbs=create;update,versions=v1beta1,name=mysqlserverconfigv1.kb.io,admissionReviewVersions=v1 var _ webhook.CustomValidator = &MySQLConfValidatorV1{} @@ -60,7 +60,7 @@ func (v *MySQLConfValidatorV1) ValidateDelete(ctx context.Context, obj runtime.O // ValidateCreate implements webhook.Validator so a webhook will be registered for the type func (v *MySQLConfValidatorV1) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) { allErrs := field.ErrorList{} - mysqlServerConf := obj.(*otterizev1.MySQLServerConfig) + mysqlServerConf := obj.(*otterizev1beta1.MySQLServerConfig) gvk := mysqlServerConf.GroupVersionKind() if err := validateCredentialsNotEmptyV1(mysqlServerConf.Spec.Credentials); err != nil { @@ -86,7 +86,7 @@ func (v *MySQLConfValidatorV1) ValidateCreate(ctx context.Context, obj runtime.O // ValidateUpdate implements webhook.Validator so a webhook will be registered for the type func (v *MySQLConfValidatorV1) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (admission.Warnings, error) { allErrs := field.ErrorList{} - mysqlServerConf := newObj.(*otterizev1.MySQLServerConfig) + mysqlServerConf := newObj.(*otterizev1beta1.MySQLServerConfig) gvk := mysqlServerConf.GroupVersionKind() if err := validateCredentialsNotEmptyV1(mysqlServerConf.Spec.Credentials); err != nil { diff --git a/src/operator/webhooks/postgresqlserverconfigs_webhook_v1.go b/src/operator/webhooks/postgresqlserverconfigs_webhook_v1.go index 79237776c..e55ede02b 100644 --- a/src/operator/webhooks/postgresqlserverconfigs_webhook_v1.go +++ b/src/operator/webhooks/postgresqlserverconfigs_webhook_v1.go @@ -19,7 +19,7 @@ package webhooks import ( "context" goerrors "errors" - otterizev1 "github.com/otterize/intents-operator/src/operator/api/v1" + otterizev1beta1 "github.com/otterize/intents-operator/src/operator/api/v1beta1" "github.com/otterize/intents-operator/src/shared/errors" k8serrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" @@ -37,7 +37,7 @@ type PostgresConfValidatorV1 struct { func (v *PostgresConfValidatorV1) SetupWebhookWithManager(mgr ctrl.Manager) error { return ctrl.NewWebhookManagedBy(mgr). - For(&otterizev1.PostgreSQLServerConfig{}). + For(&otterizev1beta1.PostgreSQLServerConfig{}). WithValidator(v). Complete() } @@ -48,7 +48,7 @@ func NewPostgresConfValidatorV1(c client.Client) *PostgresConfValidatorV1 { } } -//+kubebuilder:webhook:matchPolicy=Exact,path=/validate-k8s-otterize-com-v1-postgresqlserverconfig,mutating=false,failurePolicy=fail,sideEffects=None,groups=k8s.otterize.com,resources=postgresqlserverconfigs,verbs=create;update,versions=v1,name=postgresqlserverconfigv1.kb.io,admissionReviewVersions=v1 +//+kubebuilder:webhook:matchPolicy=Exact,path=/validate-k8s-otterize-com-v1-postgresqlserverconfig,mutating=false,failurePolicy=fail,sideEffects=None,groups=k8s.otterize.com,resources=postgresqlserverconfigs,verbs=create;update,versions=v1beta1,name=postgresqlserverconfigv1.kb.io,admissionReviewVersions=v1 var _ webhook.CustomValidator = &PostgresConfValidatorV1{} @@ -60,7 +60,7 @@ func (v *PostgresConfValidatorV1) ValidateDelete(ctx context.Context, obj runtim // ValidateCreate implements webhook.Validator so a webhook will be registered for the type func (v *PostgresConfValidatorV1) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) { allErrs := field.ErrorList{} - pgServerConf := obj.(*otterizev1.PostgreSQLServerConfig) + pgServerConf := obj.(*otterizev1beta1.PostgreSQLServerConfig) gvk := pgServerConf.GroupVersionKind() if err := validateCredentialsNotEmptyV1(pgServerConf.Spec.Credentials); err != nil { @@ -86,7 +86,7 @@ func (v *PostgresConfValidatorV1) ValidateCreate(ctx context.Context, obj runtim // ValidateUpdate implements webhook.Validator so a webhook will be registered for the type func (v *PostgresConfValidatorV1) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (admission.Warnings, error) { allErrs := field.ErrorList{} - pgServerConf := newObj.(*otterizev1.PostgreSQLServerConfig) + pgServerConf := newObj.(*otterizev1beta1.PostgreSQLServerConfig) gvk := pgServerConf.GroupVersionKind() if err := validateCredentialsNotEmptyV1(pgServerConf.Spec.Credentials); err != nil { diff --git a/src/operator/webhooks/protectedservices_webhook_v1.go b/src/operator/webhooks/protectedservices_webhook_v1.go index 74099f242..34421fbf6 100644 --- a/src/operator/webhooks/protectedservices_webhook_v1.go +++ b/src/operator/webhooks/protectedservices_webhook_v1.go @@ -20,7 +20,7 @@ import ( "context" "fmt" "github.com/asaskevich/govalidator" - otterizev1 "github.com/otterize/intents-operator/src/operator/api/v1" + otterizev1beta1 "github.com/otterize/intents-operator/src/operator/api/v1beta1" "github.com/otterize/intents-operator/src/shared/errors" k8serrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" @@ -39,7 +39,7 @@ type ProtectedServiceValidatorV1 struct { func (v *ProtectedServiceValidatorV1) SetupWebhookWithManager(mgr ctrl.Manager) error { return ctrl.NewWebhookManagedBy(mgr). - For(&otterizev1.ProtectedService{}). + For(&otterizev1beta1.ProtectedService{}). WithValidator(v). Complete() } @@ -50,16 +50,16 @@ func NewProtectedServiceValidatorV1(c client.Client) *ProtectedServiceValidatorV } } -//+kubebuilder:webhook:matchPolicy=Exact,path=/validate-k8s-otterize-com-v1-protectedservice,mutating=false,failurePolicy=fail,sideEffects=None,groups=k8s.otterize.com,resources=protectedservice,verbs=create;update,versions=v1,name=protectedservicev1.kb.io,admissionReviewVersions=v1 +//+kubebuilder:webhook:matchPolicy=Exact,path=/validate-k8s-otterize-com-v1-protectedservice,mutating=false,failurePolicy=fail,sideEffects=None,groups=k8s.otterize.com,resources=protectedservice,verbs=create;update,versions=v1beta1,name=protectedservicev1.kb.io,admissionReviewVersions=v1 var _ webhook.CustomValidator = &ProtectedServiceValidatorV1{} // ValidateCreate implements webhook.Validator so a webhook will be registered for the type func (v *ProtectedServiceValidatorV1) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) { var allErrs field.ErrorList - protectedService := obj.(*otterizev1.ProtectedService) + protectedService := obj.(*otterizev1beta1.ProtectedService) - protectedServicesList := &otterizev1.ProtectedServiceList{} + protectedServicesList := &otterizev1beta1.ProtectedServiceList{} if err := v.List(ctx, protectedServicesList, &client.ListOptions{Namespace: protectedService.Namespace}); err != nil { return nil, errors.Wrap(err) } @@ -85,9 +85,9 @@ func (v *ProtectedServiceValidatorV1) ValidateCreate(ctx context.Context, obj ru // ValidateUpdate implements webhook.Validator so a webhook will be registered for the type func (v *ProtectedServiceValidatorV1) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (admission.Warnings, error) { var allErrs field.ErrorList - protectedService := newObj.(*otterizev1.ProtectedService) + protectedService := newObj.(*otterizev1beta1.ProtectedService) - protectedServicesList := &otterizev1.ProtectedServiceList{} + protectedServicesList := &otterizev1beta1.ProtectedServiceList{} if err := v.List(ctx, protectedServicesList, &client.ListOptions{Namespace: protectedService.Namespace}); err != nil { return nil, errors.Wrap(err) } @@ -116,7 +116,7 @@ func (v *ProtectedServiceValidatorV1) ValidateDelete(ctx context.Context, obj ru } func (v *ProtectedServiceValidatorV1) validateNoDuplicateClients( - protectedService *otterizev1.ProtectedService, protectedServicesList *otterizev1.ProtectedServiceList) *field.Error { + protectedService *otterizev1beta1.ProtectedService, protectedServicesList *otterizev1beta1.ProtectedServiceList) *field.Error { protectedServiceName := protectedService.Spec.Name for _, protectedServiceFromList := range protectedServicesList.Items { @@ -135,7 +135,7 @@ func (v *ProtectedServiceValidatorV1) validateNoDuplicateClients( } // validateSpec -func (v *ProtectedServiceValidatorV1) validateSpec(protectedService *otterizev1.ProtectedService) *field.Error { +func (v *ProtectedServiceValidatorV1) validateSpec(protectedService *otterizev1beta1.ProtectedService) *field.Error { serviceName := strings.ReplaceAll(protectedService.Spec.Name, "-", "") serviceName = strings.ReplaceAll(serviceName, "_", "") // Validate Service Name contains only lowercase alphanumeric characters diff --git a/src/operator/webhooks/webhook_suite_test.go b/src/operator/webhooks/webhook_suite_test.go index 36d59b1e3..5640ff700 100644 --- a/src/operator/webhooks/webhook_suite_test.go +++ b/src/operator/webhooks/webhook_suite_test.go @@ -19,9 +19,9 @@ import ( "context" "errors" "fmt" - otterizev1 "github.com/otterize/intents-operator/src/operator/api/v1" otterizev1alpha2 "github.com/otterize/intents-operator/src/operator/api/v1alpha2" otterizev1alpha3 "github.com/otterize/intents-operator/src/operator/api/v1alpha3" + otterizev1beta1 "github.com/otterize/intents-operator/src/operator/api/v1beta1" otterizev2alpha1 "github.com/otterize/intents-operator/src/operator/api/v2alpha1" "github.com/otterize/intents-operator/src/shared/testbase" "github.com/sirupsen/logrus" @@ -63,7 +63,7 @@ func (s *ValidationWebhookTestSuite) SetupSuite() { utilruntime.Must(istiosecurityscheme.AddToScheme(s.TestEnv.Scheme)) utilruntime.Must(otterizev1alpha2.AddToScheme(s.TestEnv.Scheme)) utilruntime.Must(otterizev1alpha3.AddToScheme(s.TestEnv.Scheme)) - utilruntime.Must(otterizev1.AddToScheme(s.TestEnv.Scheme)) + utilruntime.Must(otterizev1beta1.AddToScheme(s.TestEnv.Scheme)) utilruntime.Must(otterizev2alpha1.AddToScheme(s.TestEnv.Scheme)) s.RestConfig, err = s.TestEnv.Start() diff --git a/src/shared/otterizecloud/graphqlclient/schema.graphql b/src/shared/otterizecloud/graphqlclient/schema.graphql index 2580f67ce..ceaf9b2d0 100644 --- a/src/shared/otterizecloud/graphqlclient/schema.graphql +++ b/src/shared/otterizecloud/graphqlclient/schema.graphql @@ -64,6 +64,10 @@ directive @validate( customConstraint: CustomConstraint ) on INPUT_FIELD_DEFINITION | ARGUMENT_DEFINITION +type AWSCustomer { + awsAccountId: String! +} + type AWSGeneralResource { resource: String! isWildcard: Boolean! @@ -2033,6 +2037,7 @@ type User { authProviderUserId: String! tutorials: [UserTutorial!] activeTutorial: UserTutorial! + awsCustomer: AWSCustomer } enum UserErrorType { diff --git a/src/shared/telemetries/telemetriesgql/schema.graphql b/src/shared/telemetries/telemetriesgql/schema.graphql index 95ff18cbb..ceaf9b2d0 100644 --- a/src/shared/telemetries/telemetriesgql/schema.graphql +++ b/src/shared/telemetries/telemetriesgql/schema.graphql @@ -64,6 +64,10 @@ directive @validate( customConstraint: CustomConstraint ) on INPUT_FIELD_DEFINITION | ARGUMENT_DEFINITION +type AWSCustomer { + awsAccountId: String! +} + type AWSGeneralResource { resource: String! isWildcard: Boolean! @@ -720,6 +724,12 @@ input IncomingTrafficIntentInput { source: IncomingInternetSourceInput! } +input IngressControllerConfigInput { + name: String! + namespace: String! + kind: String! +} + input InputAccessGraphFilter { clusterIds: InputIDFilterValue serviceIds: InputIDFilterValue @@ -741,10 +751,13 @@ input InputIDFilterValue { input InputIntegrationAccessGraphFilter { environmentIds: [ID!] + environmentFilterType: IDFilterOperators clusterIds: [ID!] + clusterFilterType: IDFilterOperators + namespaceIds: [ID!] + namespaceFilterType: IDFilterOperators serviceIds: [ID!] serviceFilterType: IDFilterOperators - namespaceIds: [ID!] } input InputTimeFilterValue { @@ -782,8 +795,11 @@ type Integration { type IntegrationAccessGraphFilter { environmentIds: [ID!] + environmentFilterType: IDFilterOperators clusterIds: [ID!] + clusterFilterType: IDFilterOperators namespaceIds: [ID!] + namespaceFilterType: IDFilterOperators serviceIds: [ID!] serviceFilterType: IDFilterOperators lastSeenAfter: Time @@ -923,6 +939,7 @@ input IntentsOperatorConfigurationInput { azureIAMPolicyEnforcementEnabled: Boolean databaseEnforcementEnabled: Boolean enforcedNamespaces: [String!] + ingressControllerConfig: [IngressControllerConfigInput!] } type InternetConfig { @@ -2020,6 +2037,7 @@ type User { authProviderUserId: String! tutorials: [UserTutorial!] activeTutorial: UserTutorial! + awsCustomer: AWSCustomer } enum UserErrorType {