From 5d76c0b98a28befe56baad03f52f7932439c2fd4 Mon Sep 17 00:00:00 2001 From: Alex Vulaj Date: Fri, 17 Jan 2025 12:13:35 -0500 Subject: [PATCH] feat OCM-12069 | add class and resources for cluster migrations --- .../v1/cluster_migration_resource.model | 23 ++++++ .../v1/cluster_migration_type.model | 73 +++++++++++++++++++ .../v1/cluster_migrations_resource.model | 43 +++++++++++ 3 files changed, 139 insertions(+) create mode 100644 model/clusters_mgmt/v1/cluster_migration_resource.model create mode 100644 model/clusters_mgmt/v1/cluster_migration_type.model create mode 100644 model/clusters_mgmt/v1/cluster_migrations_resource.model diff --git a/model/clusters_mgmt/v1/cluster_migration_resource.model b/model/clusters_mgmt/v1/cluster_migration_resource.model new file mode 100644 index 00000000..f46b5be7 --- /dev/null +++ b/model/clusters_mgmt/v1/cluster_migration_resource.model @@ -0,0 +1,23 @@ +/* +Copyright (c) 2021 Red Hat, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +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. +*/ + +// Manages a specific cluster migration. +resource ClusterMigration { + // Retrieves the details of the cluster migration. + method Get { + out Body ClusterMigration + } +} \ No newline at end of file diff --git a/model/clusters_mgmt/v1/cluster_migration_type.model b/model/clusters_mgmt/v1/cluster_migration_type.model new file mode 100644 index 00000000..9adc5376 --- /dev/null +++ b/model/clusters_mgmt/v1/cluster_migration_type.model @@ -0,0 +1,73 @@ +/* +Copyright (c) 2019 Red Hat, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +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. +*/ + +// Representation of a cluster migration. +class ClusterMigration { + // Internal cluster ID. + ClusterID string + + // Type of cluster migration. The rest of the attributes will be populated according to this + // value. For example, if the type is `sdnToOvn` then only the `SdnToOvn` attribute will be + // populated. + Type ClusterMigrationType + + // The state of the cluster migration. + State ClusterMigrationState + + // Details for `SdnToOvn` cluster migrations. + SdnToOvn SdnToOvnClusterMigration + + // Date and time when the cluster migration was initially created, using the + // format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). + CreationTimestamp Date + + // Date and time when the cluster migration was last updated, using the + // format defined in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). + UpdatedTimestamp Date +} + +// Type of cluster migration. +enum ClusterMigrationType { + @json(name = "SdnToOvnClusterMigration") + SdnToOvn +} + +// The state of the cluster migration. +enum ClusterMigrationState { + @json(name = "scheduled") + Scheduled + + @json(name = "in progress") + InProgress + + @json(name = "completed") + Completed +} + +// Details for `SdnToOvn` cluster migrations. +struct SdnToOvnClusterMigration { + // The IP address range to use for the internalTransSwitchSubnet parameter of OVN-Kubernetes + // upon migration. + TransitIpv4 String + + // The IP address range to use for the internalJoinSubnet parameter of OVN-Kubernetes + // upon migration. + JoinIpv4 String + + // The IP address range to us for the internalMasqueradeSubnet parameter of OVN-Kubernetes + // upon migration. + MasqueradeIpv4 String +} diff --git a/model/clusters_mgmt/v1/cluster_migrations_resource.model b/model/clusters_mgmt/v1/cluster_migrations_resource.model new file mode 100644 index 00000000..a7c74188 --- /dev/null +++ b/model/clusters_mgmt/v1/cluster_migrations_resource.model @@ -0,0 +1,43 @@ +/* +Copyright (c) 2019 Red Hat, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +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. +*/ + +// Manages the collection of cluster migrations of a cluster. +resource ClusterMigrations { + method List { + // Index of the returned page, where one corresponds to the first page. As this + // collection doesn't support paging the result will always be `1`. + in out Page Integer = 1 + + // Number of items that will be contained in the returned page. As this collection + // doesn't support paging or searching the result will always be the total number of + // migrations of the cluster. + in out Size Integer = 100 + + // Total number of items of the collection that match the search criteria, + // regardless of the size of the page. As this collection doesn't support paging or + // searching the result will always be the total number of migrations of the cluster. + out Total Integer + + // Retrieved list of cluster migrations. + out Items []ClusterMigration + } + + // Adds a cluster migration to the database. + method Add { + // Description of the cluster migration. + in out Body ClusterMigration + } +} \ No newline at end of file