mirror of
https://github.com/czhu12/canine.git
synced 2025-12-30 15:49:54 -06:00
destroy project will destroy namespace
This commit is contained in:
@@ -68,7 +68,7 @@ class ProjectsController < ApplicationController
|
||||
|
||||
# DELETE /projects/1 or /projects/1.json
|
||||
def destroy
|
||||
@project.destroy!
|
||||
Projects::DestroyJob.perform_later(@project)
|
||||
respond_to do |format|
|
||||
format.html { redirect_to projects_url, status: :see_other, notice: "Project was successfully destroyed." }
|
||||
format.json { head :no_content }
|
||||
|
||||
12
app/jobs/projects/destroy_job.rb
Normal file
12
app/jobs/projects/destroy_job.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
class Projects::DestroyJob < ApplicationJob
|
||||
|
||||
def perform(project)
|
||||
kubeconfig = project.cluster.kubeconfig
|
||||
kubectl = K8::Kubectl.new(kubeconfig)
|
||||
|
||||
kubectl.call("delete namespace #{project.name}")
|
||||
|
||||
project.destroy!
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user