shwstppr commented on a change in pull request #4329:
URL: https://github.com/apache/cloudstack/pull/4329#discussion_r693882850



##########
File path: 
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java
##########
@@ -203,11 +218,19 @@ protected void logTransitStateDetachIsoAndThrow(final 
Level logLevel, final Stri
         throw new CloudRuntimeException(message, e);
     }
 
+    protected void deleteTemplateLaunchPermission() {
+        if (clusterTemplate != null && owner != null) {
+            LOGGER.info("Revoking launch permission for systemVM template");
+            launchPermissionDao.removePermissions(clusterTemplate.getId(), 
Collections.singletonList(owner.getId()));
+        }
+    }
+
     protected void logTransitStateAndThrow(final Level logLevel, final String 
message, final Long kubernetesClusterId, final KubernetesCluster.Event event, 
final Exception e) throws CloudRuntimeException {
         logMessage(logLevel, message, e);
         if (kubernetesClusterId != null && event != null) {
             stateTransitTo(kubernetesClusterId, event);
         }
+        deleteTemplateLaunchPermission();

Review comment:
       Is it possible to call it only when needed? Not sure but as I can 
understand this might be called everytime there is an issue the k8s cluster 
such as upgrade/start (from stopped state) as well. Revoking permission log can 
be confusing in those cases. Though not a major issue




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to