git.iko.soy/typeable/octopod
on master help sign in
split the 'destroy' command to 'delete' and 'cleanup' commands
commit5870eb6fe737ab04070b5ecdba980a3fd53fa2a9 authorAndrei Orlov <aaorlov1@gmail.com> dateWed 10 Jun 2020, 13:58 (6 years ago) parente8f2d56
15 files changed+210−55
migrations/deploy/archived_flag.sql+17 migrations/revert/archived_flag.sql+10 migrations/sqitch.plan+1 migrations/verify/archived_flag.sql+7 src/API.hs+5−2 src/DMC.hs+20−8 src/DMC/Args.hs+12−3 src/DMS.hs+74−28 src/Types.hs+4 utils/b2b-utils/Cargo.lock+2−2 utils/b2b-utils/Cargo.toml+4 utils/b2b-utils/docker/Dockerfile+1 utils/b2b-utils/docker/build_docker.sh+1 utils/b2b-utils/src/bin/cleanup.rs+52 utils/b2b-utils/src/bin/delete.rs−12
migrations/deploy/archived_flag.sqlnew file+17
@@ -0,0 +1,17 @@
1+-- Deploy dm:archived_flag to pg
2+
3+BEGIN;
4+
5+ALTER TABLE deployments ADD archived BOOLEAN NOT NULL DEFAULT 'f';
6+ALTER TABLE deployments ADD archived_at TIMESTAMPTZ;
7+
8+CREATE INDEX deployments_archived_archived_at_idx ON deployments USING BTREE (archived, archived_at);
9+
10+
11+ALTER TABLE deployment_logs ADD archived BOOLEAN NOT NULL DEFAULT 'f';
12+
13+
14+COMMIT;
15+
16+ALTER TYPE actions ADD VALUE 'delete' AFTER 'update';
17+ALTER TYPE actions ADD VALUE 'restore' AFTER 'delete';
migrations/revert/archived_flag.sqlnew file+10
@@ -0,0 +1,10 @@
1+-- Revert dm:archived_flag from pg
2+
3+BEGIN;
4+
5+ALTER TABLE deployments DROP archived;
6+ALTER TABLE deployments DROP archived_at;
7+
8+ALTER TABLE deployment_logs DROP archived;
9+
10+COMMIT;
migrations/sqitch.plan+1
@@ -4,3 +4,4 @@
44
55deployments 2020-02-09T15:47:32Z root <root@f56c3faaf0bf> # Creates deployments table.
66deployment_logs 2020-02-28T21:35:30Z Andrei Orlov <aaorlov1@gmail.com> # Creates deployment_logs table.
7+archived_flag 2020-06-09T20:30:45Z Andrei Orlov <aaorlov1@gmail.com> # Add archived flag to 'deployments' and 'deployment_logs' tables
migrations/verify/archived_flag.sqlnew file+7
@@ -0,0 +1,7 @@
1+-- Verify dm:archived_flag on pg
2+
3+BEGIN;
4+
5+-- XXX Add verifications here.
6+
7+ROLLBACK;
src/API.hs+5−2
@@ -13,11 +13,13 @@ type CreateEndpoint =
1313type GetEndpoint c = c :> Get '[JSON] Deployment
1414type EditEndpoint c =
1515 c :> ReqBody '[JSON] EnvPairs :> PatchNoContent '[PlainText] NoContent
16−type DestroyEndpoint c = c :> DeleteNoContent '[PlainText] NoContent
16+type DeleteEndpoint c = c :> DeleteNoContent '[PlainText] NoContent
1717type UpdateEndpoint c =
1818 c :> ReqBody '[JSON] DeploymentUpdate :> PutNoContent '[PlainText] NoContent
1919type InfoEndpoint c = c :> "info" :> Get '[JSON] [DeploymentInfo]
2020type StatusEndpoint c = c :> "status" :> Get '[JSON] DeploymentStatus
21+type CleanupEndpoint c =
22+ c :> "cleanup" :> DeleteNoContent '[PlainText] NoContent
2123
2224-- FIXME: Text as a return type for many endpoints
2325type DeploymentAPI' c =
@@ -27,10 +29,11 @@ type DeploymentAPI' c =
2729 :<|> CreateEndpoint
2830 :<|> GetEndpoint c
2931 :<|> EditEndpoint c
30− :<|> DestroyEndpoint c
32+ :<|> DeleteEndpoint c
3133 :<|> UpdateEndpoint c
3234 :<|> InfoEndpoint c
3335 :<|> StatusEndpoint c
36+ :<|> CleanupEndpoint c
3437 )
3538 :<|> "ping" :> GetNoContent '[PlainText] NoContent
3639 )
src/DMC.hs+20−8
@@ -46,9 +46,10 @@ runDMC = do
4646 handleCreate $ Deployment (coerce tName) (coerce tTag) envPairs
4747 ListC _ _ -> handleList
4848 EditC tName _ _ -> handleEdit . coerce $ tName
49− DestroyC tName _ _ -> handleDestroy . coerce $ tName
49+ DeleteC tName _ _ -> handleDelete . coerce $ tName
5050 UpdateC tName tTag _ _ -> handleUpdate (coerce tName) (coerce tTag)
5151 InfoC tName _ _ -> handleInfo . coerce $ tName
52+ CleanupC tName _ _ -> handleCleanup . coerce $ tName
5253
5354dmsHostName :: String
5455dmsHostName = "dm.stage.thebestagent.pro"
@@ -87,7 +88,7 @@ handleList = do
8788 liftIO $ do
8889 resp <- runClientM listH clientEnv
8990 let
90− getName (DeploymentFullInfo (Deployment dName _ _) _ _ _) = dName
91+ getName (DeploymentFullInfo (Deployment dName _ _) _ _ _ _) = dName
9192 names = T.unlines . coerce . (getName <$>) <$> resp
9293 handleResponse T.putStr names
9394
@@ -119,11 +120,11 @@ editEnvs editor currentEnvPairs = withTempFile "" "dmc" $ \filePath handle -> do
119120 T.putStrLn "sending update..."
120121 pure envPairs
121122
122−handleDestroy :: DeploymentName -> ReaderT ClientEnv IO ()
123−handleDestroy dName = do
123+handleDelete :: DeploymentName -> ReaderT ClientEnv IO ()
124+handleDelete dName = do
124125 clientEnv <- ask
125126 liftIO $
126− handleResponse (const $ pure ()) =<< runClientM (destroyH dName) clientEnv
127+ handleResponse (const $ pure ()) =<< runClientM (deleteH dName) clientEnv
127128
128129handleUpdate :: DeploymentName -> DeploymentTag -> ReaderT ClientEnv IO ()
129130handleUpdate dName dTag = do
@@ -145,6 +146,12 @@ handleInfo dName = do
145146 where
146147 notFoundMsg = "deployment " ++ unpack (coerce dName) ++ " not found"
147148
149+handleCleanup :: DeploymentName -> ReaderT ClientEnv IO ()
150+handleCleanup dName = do
151+ clientEnv <- ask
152+ liftIO $
153+ handleResponse (const $ pure ()) =<< runClientM (cleanupH dName) clientEnv
154+
148155listH :: ClientM [DeploymentFullInfo]
149156
150157createH :: Deployment -> ClientM NoContent
@@ -153,20 +160,25 @@ getH :: DeploymentName -> ClientM Deployment
153160
154161editH :: DeploymentName -> EnvPairs -> ClientM NoContent
155162
156−destroyH :: DeploymentName -> ClientM NoContent
163+deleteH :: DeploymentName -> ClientM NoContent
157164
158165updateH :: DeploymentName -> DeploymentUpdate -> ClientM NoContent
159166
160167infoH :: DeploymentName -> ClientM [DeploymentInfo]
161168
169+_statusH :: DeploymentName -> ClientM DeploymentStatus
170+
171+cleanupH :: DeploymentName -> ClientM NoContent
172+
162173( listH
163174 :<|> createH
164175 :<|> getH
165176 :<|> editH
166− :<|> destroyH
177+ :<|> deleteH
167178 :<|> updateH
168179 :<|> infoH
169− :<|> _)
180+ :<|> _statusH
181+ :<|> cleanupH)
170182 :<|> _ = client (Proxy @API)
171183
172184handleResponse :: (a -> IO ()) -> Either ClientError a -> IO ()
src/DMC/Args.hs+12−3
@@ -22,7 +22,7 @@ data Args
2222 { name :: Text
2323 , tlsCertPath :: Maybe ByteString
2424 , tlsKeyPath :: Maybe ByteString }
25− | Destroy
25+ | Delete
2626 { name :: Text
2727 , tlsCertPath :: Maybe ByteString
2828 , tlsKeyPath :: Maybe ByteString }
@@ -35,6 +35,10 @@ data Args
3535 { name :: Text
3636 , tlsCertPath :: Maybe ByteString
3737 , tlsKeyPath :: Maybe ByteString }
38+ | Cleanup
39+ { name :: Text
40+ , tlsCertPath :: Maybe ByteString
41+ , tlsKeyPath :: Maybe ByteString }
3842 deriving stock (Show, Generic)
3943
4044instance ParseRecord Args where
@@ -56,7 +60,7 @@ data DMCArgs
5660 { deploymentName :: Text
5761 , dmcTLSCertPath :: Maybe TLSCertPath
5862 , dmcTLSKeyPath :: Maybe TLSKeyPath }
59− | DestroyC
63+ | DeleteC
6064 { deploymentName :: Text
6165 , dmcTLSCertPath :: Maybe TLSCertPath
6266 , dmcTLSKeyPath :: Maybe TLSKeyPath }
@@ -69,6 +73,10 @@ data DMCArgs
6973 { deploymentName :: Text
7074 , dmcTLSCertPath :: Maybe TLSCertPath
7175 , dmcTLSKeyPath :: Maybe TLSKeyPath }
76+ | CleanupC
77+ { deploymentName :: Text
78+ , dmcTLSCertPath :: Maybe TLSCertPath
79+ , dmcTLSKeyPath :: Maybe TLSKeyPath }
7280 deriving stock (Show, Generic)
7381
7482parseArgs :: IO DMCArgs
@@ -78,6 +86,7 @@ parseArgs = do
7886 Create n t e c k -> CreateC n t e (coerce <$> c) (coerce <$> k)
7987 List c k -> ListC (coerce <$> c) (coerce <$> k)
8088 Edit n c k -> EditC n (coerce <$> c) (coerce <$> k)
81− Destroy n c k -> DestroyC n (coerce <$> c) (coerce <$> k)
89+ Delete n c k -> DeleteC n (coerce <$> c) (coerce <$> k)
8290 Update n t c k -> UpdateC n t (coerce <$> c) (coerce <$> k)
8391 Info n c k -> InfoC n (coerce <$> c) (coerce <$> k)
92+ Cleanup n c k -> CleanupC n (coerce <$> c) (coerce <$> k)
src/DMS.hs+74−28
@@ -44,7 +44,8 @@ data AppState = AppState
4444 , creation_command :: Command
4545 , update_command :: Command
4646 , deletion_command :: Command
47− , checking_command :: Command }
47+ , checking_command :: Command
48+ , cleanup_command :: Command }
4849
4950data DeploymentException
5051 = DeploymentFailed Int
@@ -69,6 +70,7 @@ runDMS = do
6970 update_cmd <- coerce . pack <$> getEnvOrDie "UPDATE_COMMAND"
7071 deletion_cmd <- coerce . pack <$> getEnvOrDie "DELETION_COMMAND"
7172 checking_cmd <- coerce . pack <$> getEnvOrDie "CHECKING_COMMAND"
73+ cleanup_cmd <- coerce . pack <$> getEnvOrDie "CLEANUP_COMMAND"
7274 pgPool <- initConnectionPool
7375 (unDBConnectionString $ dmsDB opts) (unDBPoolSize $ dmsDBPoolSize opts)
7476 let
@@ -83,6 +85,7 @@ runDMS = do
8385 update_cmd
8486 deletion_cmd
8587 checking_cmd
88+ cleanup_cmd
8689 serverPort = dmsPort opts
8790 uiServerPort = unServerPort $ dmsUIPort opts
8891 tlsOpts =
@@ -106,22 +109,22 @@ app s = serve api $ hoistServer api (nt s) server
106109server :: ServerT API AppM
107110server =
108111 (listH :<|> createH :<|> getH :<|> editH
109− :<|> destroyH :<|> updateH :<|> infoH :<|> statusH) :<|> pingH
112+ :<|> deleteH :<|> updateH :<|> infoH :<|> statusH :<|> cleanupH) :<|> pingH
110113
111114listH :: AppM [DeploymentFullInfo]
112115listH = do
113116 AppState {pool = p, logger = l, base_domain = d} <- ask
114117
115118 retrieved <- liftIO $ withResource p $ \conn -> query_ conn q
116− deployments <- liftIO $ for retrieved $ \(n, t, e, ct, ut) -> do
119+ deployments <- liftIO $ for retrieved $ \(n, t, e, a, ct, ut) -> do
117120 es <- parseEnvs (lines e)
118− pure $ DeploymentFullInfo (Deployment n t es) ct ut (depUrls d n)
121+ pure $ DeploymentFullInfo (Deployment n t es) a ct ut (depUrls d n)
119122
120123 liftIO . logInfo l $ "get deployments: " <> (pack . show $ deployments)
121124 return deployments
122125 where
123126 q =
124− "SELECT name, tag, envs, extract(epoch from created_at)::int, \
127+ "SELECT name, tag, envs, archived, extract(epoch from created_at)::int, \
125128 \extract(epoch from updated_at)::int \
126129 \FROM deployments ORDER BY name"
127130 depUrls domain dName =
@@ -160,7 +163,7 @@ createH dep = do
160163 log $ "call " <> unwords (cmd : args)
161164 ec <- withProcessWait (proc (unpack cmd) (unpack <$> args)) waitProcess
162165 log $ "deployment created, deployment: " <> (pack . show $ dep)
163− createDeploymentLog pgPool dep "create" ec
166+ createDeploymentLog pgPool dep "create" ec $ ArchivedFlag False
164167 handleExitCode ec
165168 pure NoContent
166169
@@ -193,6 +196,7 @@ selectDeploymentLogs p dName = do
193196selectDeployment :: PgPool -> DeploymentName -> IO Deployment
194197selectDeployment p n = selectDeployments p n >>= \case
195198 [d] -> pure d
199+ [] -> error "deployment not found"
196200 _ -> error "more than one deployment found in the database"
197201
198202selectDeployments :: PgPool -> DeploymentName -> IO [Deployment]
@@ -229,7 +233,7 @@ editH dName dEnvs = do
229233 $ "deployment edited, name: " <> coerce dName
230234 <> ", envs: " <> formatEnvPairs dEnvs
231235 let dep = Deployment dName dTag dEnvs
232− createDeploymentLog pgPool dep "edit" ec
236+ createDeploymentLog pgPool dep "edit" ec $ ArchivedFlag False
233237 handleExitCode ec
234238 return ()
235239 _ ->
@@ -246,8 +250,8 @@ editH dName dEnvs = do
246250 -- FIXME: make EnvPairs a newtype and give it ToField instance
247251 (formatEnvPairs dEnvs, dName)
248252
249−destroyH :: DeploymentName -> AppM NoContent
250−destroyH dName = do
253+deleteH :: DeploymentName -> AppM NoContent
254+deleteH dName = do
251255 st <- ask
252256 let
253257 log = logInfo (logger st)
@@ -259,24 +263,23 @@ destroyH dName = do
259263 ]
260264 cmd = coerce $ deletion_command st
261265 liftIO $ do
266+ dep <- selectDeployment pgPool dName
262267 log $ "call " <> unwords (cmd : args)
263268 ec <- withProcessWait (proc (unpack cmd) (unpack <$> args)) waitProcess
264− void $ deleteDeploymentLogs pgPool dName
265− void $ deleteDeployment pgPool dName
266− log $ "deployment destroyed, name: " <> coerce dName
269+ void $ archiveDeployment pgPool dName
270+ void $ createDeploymentLog pgPool dep "delete" ec $ ArchivedFlag True
271+ log $ "deployment deleted, name: " <> coerce dName
267272 handleExitCode ec
268273 pure NoContent
269274
270−deleteDeploymentLogs :: PgPool -> DeploymentName -> IO Int64
271−deleteDeploymentLogs p n = withResource p $ \conn -> execute
272− conn
273− "DELETE FROM deployment_logs WHERE deployment_id in\
274− \ (SELECT id FROM deployments where name = ?)"
275− (Only n)
276−
277−deleteDeployment :: PgPool -> DeploymentName -> IO Int64
278−deleteDeployment p n = withResource p $ \conn ->
279− execute conn "DELETE FROM deployments WHERE name = ?" (Only n)
275+archiveDeployment :: PgPool -> DeploymentName -> IO Int64
276+archiveDeployment p dName = withResource p $ \conn -> do
277+ let
278+ q =
279+ "UPDATE deployments \
280+ \SET archived = 't', archived_at = now() \
281+ \WHERE name = ?"
282+ execute conn q (Only dName)
280283
281284updateH :: DeploymentName -> DeploymentUpdate -> AppM NoContent
282285updateH dName DeploymentUpdate { newTag = dTag, newEnvs = nEnvs } = do
@@ -304,7 +307,11 @@ updateH dName DeploymentUpdate { newTag = dTag, newEnvs = nEnvs } = do
304307 ec <- withProcessWait (proc (unpack cmd) (unpack <$> args)) waitProcess
305308 log $ "deployment updated, name: "
306309 <> coerce dName <> ", tag: " <> coerce dTag
307− createDeploymentLog pgPool (Deployment dName dTag envPairs) "update" ec
310+ void $ do
311+ let
312+ dep = Deployment dName dTag envPairs
313+ arch = ArchivedFlag False
314+ createDeploymentLog pgPool dep "update" ec arch
308315 handleExitCode ec
309316 return ()
310317 _ ->
@@ -355,6 +362,38 @@ statusH dName = do
355362 ExitSuccess -> Ok
356363 _ -> Error
357364
365+cleanupH :: DeploymentName -> AppM NoContent
366+cleanupH dName = do
367+ st <- ask
368+ let
369+ log = logInfo (logger st)
370+ pgPool = pool st
371+ args =
372+ [ "--project-name", coerce $ project_name st
373+ , "--namespace", coerce $ namespace st
374+ , "--name", coerce dName
375+ ]
376+ cmd = coerce $ cleanup_command st
377+ liftIO $ do
378+ log $ "call " <> unwords (cmd : args)
379+ ec <- withProcessWait (proc (unpack cmd) (unpack <$> args)) waitProcess
380+ void $ deleteDeploymentLogs pgPool dName
381+ void $ deleteDeployment pgPool dName
382+ log $ "deployment destroyed, name: " <> coerce dName
383+ handleExitCode ec
384+ pure NoContent
385+
386+deleteDeploymentLogs :: PgPool -> DeploymentName -> IO Int64
387+deleteDeploymentLogs p n = withResource p $ \conn -> execute
388+ conn
389+ "DELETE FROM deployment_logs WHERE deployment_id in\
390+ \ (SELECT id FROM deployments where name = ?)"
391+ (Only n)
392+
393+deleteDeployment :: PgPool -> DeploymentName -> IO Int64
394+deleteDeployment p n = withResource p $ \conn ->
395+ execute conn "DELETE FROM deployments WHERE name = ?" (Only n)
396+
358397waitProcess :: (Show o, Show e) => Process i o e -> IO ExitCode
359398waitProcess p = do
360399 print . getStdout $ p
@@ -365,21 +404,28 @@ handleExitCode :: ExitCode -> IO ()
365404handleExitCode ExitSuccess = return ()
366405handleExitCode (ExitFailure c) = throwIO $ DeploymentFailed c
367406
368−createDeploymentLog :: PgPool -> Deployment -> Action -> ExitCode -> IO ()
369−createDeploymentLog pgPool (Deployment n t e) a ec = do
407+createDeploymentLog
408+ :: PgPool
409+ -> Deployment
410+ -> Action
411+ -> ExitCode
412+ -> ArchivedFlag
413+ -> IO ()
414+createDeploymentLog pgPool (Deployment dName dTag dEnvs) act ec arch = do
370415 let
371416 exitCode' = case ec of
372417 ExitSuccess -> 0
373418 ExitFailure err -> err
419+ arch' = unArchivedFlag arch
374420 q =
375421 "INSERT INTO deployment_logs \
376− \(deployment_id, action, tag, envs, exit_code) (\
377− \SELECT id, ?, ?, ?, ? \
422+ \(deployment_id, action, tag, envs, exit_code, archived) (\
423+ \SELECT id, ?, ?, ?, ?, ? \
378424 \FROM deployments \
379425 \WHERE name = ? \
380426 \)"
381427 void $ withResource pgPool $ \conn ->
382− execute conn q (a, t, formatEnvPairs e, exitCode', n)
428+ execute conn q (act, dTag, formatEnvPairs dEnvs, exitCode', arch', dName)
383429
384430logInfo :: TimedFastLogger -> Text -> IO ()
385431logInfo l = logWithSeverity l "INFO"
src/Types.hs+4
@@ -50,6 +50,9 @@ newtype DeploymentTag = DeploymentTag { unDeploymentTag :: Text }
5050newtype Action = Action { unAction :: Text }
5151 deriving (Show, FromJSON, ToJSON, FromField, ToField, IsString)
5252
53+newtype ArchivedFlag = ArchivedFlag { unArchivedFlag :: Bool }
54+ deriving (Show, FromJSON, ToJSON, FromField, ToField)
55+
5356data Deployment = Deployment
5457 { name :: DeploymentName
5558 , tag :: DeploymentTag
@@ -77,6 +80,7 @@ data DeploymentInfo = DeploymentInfo
7780
7881data DeploymentFullInfo = DeploymentFullInfo
7982 { deployment :: Deployment
83+ , archived :: Bool
8084 , createdAt :: Int
8185 , updatedAt :: Int
8286 , urls :: [(Text, Text)]
utils/b2b-utils/Cargo.lock+2−2
@@ -77,9 +77,9 @@ dependencies = [
7777
7878[[package]]
7979name = "libc"
80−version = "0.2.70"
80+version = "0.2.71"
8181source = "registry+https://github.com/rust-lang/crates.io-index"
82−checksum = "3baa92041a6fec78c687fa0cc2b3fae8884f743d672cf551bed1d6dac6988d0f"
82+checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49"
8383
8484[[package]]
8585name = "ppv-lite86"
utils/b2b-utils/Cargo.toml+4
@@ -23,3 +23,7 @@ path = "src/bin/delete.rs"
2323[[bin]]
2424name = "check"
2525path = "src/bin/check.rs"
26+
27+[[bin]]
28+name = "cleanup"
29+path = "src/bin/cleanup.rs"
utils/b2b-utils/docker/Dockerfile+1
@@ -4,3 +4,4 @@ ADD tmp/create /utils/
44ADD tmp/update /utils/
55ADD tmp/delete /utils/
66ADD tmp/check /utils/
7+ADD tmp/cleanup /utils/
utils/b2b-utils/docker/build_docker.sh+1
@@ -6,6 +6,7 @@ cp ../target/x86_64-unknown-linux-musl/release/create ./tmp
66cp ../target/x86_64-unknown-linux-musl/release/update ./tmp
77cp ../target/x86_64-unknown-linux-musl/release/delete ./tmp
88cp ../target/x86_64-unknown-linux-musl/release/check ./tmp
9+cp ../target/x86_64-unknown-linux-musl/release/cleanup ./tmp
910
1011docker build --no-cache -f Dockerfile -t 560065381221.dkr.ecr.us-east-1.amazonaws.com/dms:b2b-utils .
1112
utils/b2b-utils/src/bin/cleanup.rsnew file+52
@@ -0,0 +1,52 @@
1+use clap::{App, Arg};
2+use std::process::Command;
3+
4+use b2b_utils::*;
5+
6+fn main() -> std::io::Result<()> {
7+ let matches = App::new("delete")
8+ .version("0.1")
9+ .arg(
10+ Arg::with_name("project-name")
11+ .long("project-name")
12+ .short("p")
13+ .required(true)
14+ .takes_value(true),
15+ )
16+ .arg(
17+ Arg::with_name("namespace")
18+ .long("namespace")
19+ .short("s")
20+ .required(true)
21+ .takes_value(true),
22+ )
23+ .arg(
24+ Arg::with_name("name")
25+ .long("name")
26+ .short("n")
27+ .required(true)
28+ .takes_value(true),
29+ )
30+ .get_matches();
31+
32+ let project_name = matches.value_of("project-name").expect("get project-name");
33+ let namespace = matches.value_of("namespace").expect("get namepace");
34+ let name = matches.value_of("name").expect("get name");
35+ println!("project_name: {:?}", project_name);
36+ println!("namespace: {:?}", namespace);
37+ println!("name: {:?}", name);
38+
39+ let output = Command::new("kubectl")
40+ .args(delete_pvcs_atrs(namespace, name))
41+ .output()
42+ .expect("delete PVCs");
43+ print_command_result(output);
44+
45+ let output = Command::new("kubectl")
46+ .args(delete_cert_atrs(namespace, name))
47+ .output()
48+ .expect("delete certificates");
49+ print_command_result(output);
50+
51+ Ok(())
52+}
utils/b2b-utils/src/bin/delete.rs−12
@@ -48,17 +48,5 @@ fn main() -> std::io::Result<()> {
4848 .expect("delete infra");
4949 print_command_result(output);
5050
51− let output = Command::new("kubectl")
52− .args(delete_pvcs_atrs(namespace, name))
53− .output()
54− .expect("delete PVCs");
55− print_command_result(output);
56−
57− let output = Command::new("kubectl")
58− .args(delete_cert_atrs(namespace, name))
59− .output()
60− .expect("delete certificates");
61− print_command_result(output);
62−
6351 Ok(())
6452}