コード例 #1
0
ファイル: tiller.py プロジェクト: krystaknight/armada
 def _post_update_actions(self, actions, namespace):
     try:
         for action in actions.get('create', []):
             name = action.get("name")
             action_type = action.get("type")
             if "job" in action_type:
                 LOG.info("Creating %s in namespace: %s", name, namespace)
                 self.k8s.create_job_action(name, action_type)
                 continue
     except Exception:
         raise ex.PreUpdateJobCreateException()
         LOG.debug("POST: Could not create anything, please check yaml")
コード例 #2
0
ファイル: tiller.py プロジェクト: vkdrao4git/armada
    def _pre_update_actions(self, actions, release_name, namespace, chart,
                            disable_hooks, values):
        '''
        :params actions - array of items actions
        :params namespace - name of pod for actions
        '''

        try:
            for action in actions.get('update', []):
                name = action.get('name')
                LOG.info('Updating %s ', name)
                action_type = action.get('type')
                labels = action.get('labels')

                self.rolling_upgrade_pod_deployment(name, release_name,
                                                    namespace, labels,
                                                    action_type, chart,
                                                    disable_hooks, values)
        except Exception:
            LOG.debug("Pre: Could not update anything, please check yaml")

        try:
            for action in actions.get('delete', []):
                name = action.get('name')
                action_type = action.get('type')
                labels = action.get('labels', None)

                self.delete_resources(release_name, name, action_type, labels,
                                      namespace)

                # Ensure pods get deleted when job is deleted
                if 'job' in action_type:
                    self.delete_resources(release_name, name, 'pod', labels,
                                          namespace)
        except Exception:
            raise ex.PreUpdateJobDeleteException(name, namespace)

            LOG.debug("PRE: Could not delete anything, please check yaml")

        try:
            for action in actions.get('create', []):
                name = action.get("name")
                action_type = action.get("type")
                if "job" in action_type:
                    LOG.info("Creating %s in namespace: %s", name, namespace)
                    self.k8s.create_job_action(name, action_type)
                    continue
        except Exception:
            raise ex.PreUpdateJobCreateException(name, namespace)

            LOG.debug("PRE: Could not create anything, please check yaml")