Skip to content

Commit

Permalink
feat OCM-12069 | add class and resources for cluster migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVulaj committed Jan 17, 2025
1 parent 596845e commit b173089
Show file tree
Hide file tree
Showing 7 changed files with 194 additions and 0 deletions.
23 changes: 23 additions & 0 deletions model/clusters_mgmt/v1/cluster_migration_resource.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
Copyright (c) 2025 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
}
}
27 changes: 27 additions & 0 deletions model/clusters_mgmt/v1/cluster_migration_state_type.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
Copyright (c) 2025 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.
*/

// The state of the cluster migration.
enum ClusterMigrationState {
@json(name = "scheduled")
Scheduled

@json(name = "in progress")
InProgress

@json(name = "completed")
Completed
}
40 changes: 40 additions & 0 deletions model/clusters_mgmt/v1/cluster_migration_type.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
Copyright (c) 2025 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
}
21 changes: 21 additions & 0 deletions model/clusters_mgmt/v1/cluster_migration_type_type.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
Copyright (c) 2025 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.
*/

// Type of cluster migration.
enum ClusterMigrationType {
@json(name = "SdnToOvnClusterMigration")
SdnToOvn
}
49 changes: 49 additions & 0 deletions model/clusters_mgmt/v1/cluster_migrations_resource.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
Copyright (c) 2025 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
}

// Returns a reference to the service that manages a specific cluster migration.
locator ClusterMigration {
target ClusterMigration
variable ID
}
}
4 changes: 4 additions & 0 deletions model/clusters_mgmt/v1/cluster_resource.model
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,8 @@ resource Cluster {
locator KubeletConfig {
target KubeletConfig
}

locator ClusterMigration {
target ClusterMigration
}
}
30 changes: 30 additions & 0 deletions model/clusters_mgmt/v1/sdn_to_ovn_cluster_migration_type.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
Copyright (c) 2025 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.
*/

// 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
}

0 comments on commit b173089

Please sign in to comment.