Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kumikoono created an issue. See original summary.

kumikoono’s picture

Status: Active » Needs review
FileSize
68.09 KB
kumikoono’s picture

Category: Task » Feature request
kumikoono’s picture

yas’s picture

Status: Needs review » Needs work

@kumikoono

Thank you for adding the feature. Could you please move the following code? (The position of k8s_update_dependencies() should be always at the bottom of the k8s.install explicitly since it is a specific function for us describing the dependencies, which might be lost somewhere in k8s.install in the future if we put a random position.)

FROM:

+++ b/modules/cloud_service_providers/k8s/k8s.install
@@ -2051,3 +2051,21 @@ function k8s_update_dependencies() {
 
   return $dependencies;
 }
+
+/**
+ * Add entity type k8s_priority_class and view k8s_priority_class.
+ */
+function k8s_update_8288() {
+  // Add entity type k8s_priority_class.
+  $definition_update_manager = \Drupal::entityDefinitionUpdateManager();
+  $entity_type = \Drupal::entityTypeManager()->getDefinition('k8s_priority_class');
+  $definition_update_manager->uninstallEntityType($entity_type);
+  $definition_update_manager->installEntityType($entity_type);
+
+  // Add view k8s_priority_class.
+  $files = [
+    'views.view.k8s_priority_class.yml',
+    'system.action.k8s_priority_class_delete_action.yml',
+  ];
+  \Drupal::service('cloud')->updateYmlDefinitions($files, 'k8s');
+}

TO:

/**
 * Add entity type k8s_priority_class and view k8s_priority_class.
 */
function k8s_update_8288() {
  // Add entity type k8s_priority_class.
  $definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  $entity_type = \Drupal::entityTypeManager()->getDefinition('k8s_priority_class');
  $definition_update_manager->uninstallEntityType($entity_type);
  $definition_update_manager->installEntityType($entity_type);

  // Add view k8s_priority_class.
  $files = [
    'views.view.k8s_priority_class.yml',
    'system.action.k8s_priority_class_delete_action.yml',
  ];
  \Drupal::service('cloud')->updateYmlDefinitions($files, 'k8s');
}

/**
 * Implements hook_update_dependencies().
 */
function k8s_update_dependencies() {
  $dependencies = [];

  $dependencies['k8s'] = [
    8226 => ['cloud' => 8122],
    8273 => ['cloud' => 8128],
    8274 => ['cloud' => 8131],
    8275 => ['cloud' => 8133],
  ];

  return $dependencies;
}
Xiaohua Guan’s picture

@kumikoono @yas

Thanks for your patch. I confirmed the operations in my local environment, and I found some problems as below.

class K8sBatchOperations {
     $entity_id = $k8s_service->getEntityId(
       'k8s_priority_class',
       'name',
       $name,
      );

"$name," should be "$name".

public function updatePriorityClass(array $params = []) {
    // Remove empty properties.
    $params['value'] = array_filter($params['value']);

The code "$params['value'] = array_filter($params['value']);" should be removed, because the value of $params['value'] is not array, and there is no properties in $params['value']. And after I fixed it, I can update priority class. Please try it.

kumikoono’s picture

@Xiaohua Guan @yas
Thanks for your review. After incorporating your comments, confirmed I was able to update the description of the existing priority class. It looks updating the value of the priority class is forbidden, though.

yas’s picture

@kumikoono

Thank you for your follow-up. If possible, could you please put the tab menu as shown below (in between Limit Range and ConfigMaps)?

48.png

kumikoono’s picture

Status: Needs work » Needs review
FileSize
62.41 KB
yas’s picture

Status: Needs review » Needs work
FileSize
297.97 KB

@kumikoono

Thank you for the update. Could you please the additional columns such as Value, Global Default and Description into the list view?

46.png

kumikoono’s picture

FileSize
71.97 KB

Thanks @yas, incorporated your comment.

kumikoono’s picture

Status: Needs work » Needs review
kumikoono’s picture

FileSize
78.37 KB
kumikoono’s picture

FileSize
78.1 KB
129.33 KB

@yas Thanks for your review. The view will be:

priority class view

Status: Needs review » Needs work

The last submitted patch, 14: 3158950-14.patch, failed testing. View results

yas’s picture

Status: Needs work » Needs review
FileSize
20.03 KB

@kumikoono

Thank you for the update. It looks perfect to me now.

@xiaohua-guan

Could you please review the patch?

Xiaohua Guan’s picture

Status: Needs review » Reviewed & tested by the community

@yas

The patch file looks good to me.

yas’s picture

@xiaohua-guan

Thank you for your review. I'll merge the patch to 8.x-1.x and 8.x-2.x and close this issue as Fixed.

  • yas committed 8fcda20 on 8.x-1.x authored by kumikoono
    Issue #3158950 by kumikoono, yas, Xiaohua Guan: Manage K8s Priority...

  • yas committed 9ecc2e2 on 8.x-2.x authored by kumikoono
    Issue #3158950 by kumikoono, yas, Xiaohua Guan: Manage K8s Priority...
yas’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.