Skip to content

Commit

Permalink
Merge pull request #195 from uselagoon/misc-keys
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon authored Dec 5, 2022
2 parents 418ea00 + 07f162f commit 5f482ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
4 changes: 2 additions & 2 deletions controller-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ echo '
\"misc\":{
\"miscResource\":\"eyJhcGlWZXJzaW9uIjoiYmFja3VwLmFwcHVpby5jaC92MWFscGhhMSIsImtpbmQiOiJSZXN0b3JlIiwibWV0YWRhdGEiOnsibmFtZSI6InJlc3RvcmUtYmYwNzJhMC11cXhxbzMifSwic3BlYyI6eyJzbmFwc2hvdCI6ImJmMDcyYTA5ZTE3NzI2ZGE1NGFkYzc5OTM2ZWM4NzQ1NTIxOTkzNTk5ZDQxMjExZGZjOTQ2NmRmZDViYzMyYTUiLCJyZXN0b3JlTWV0aG9kIjp7InMzIjp7fX0sImJhY2tlbmQiOnsiczMiOnsiYnVja2V0IjoiYmFhcy1uZ2lueC1leGFtcGxlIn0sInJlcG9QYXNzd29yZFNlY3JldFJlZiI6eyJrZXkiOiJyZXBvLXB3IiwibmFtZSI6ImJhYXMtcmVwby1wdyJ9fX19\"
},
\"key\":\"kubernetes:restic:backup:restore\",
\"key\":\"deploytarget:restic:backup:restore\",
\"environment\":{
\"name\":\"main\",
\"openshiftProjectName\":\"nginx-example-main\"
Expand Down Expand Up @@ -332,7 +332,7 @@ echo '
\"misc\":{
\"miscResource\":\"eyJtZXRhZGF0YSI6eyJuYW1lIjoicmVzdG9yZS1iZjA3MmEwLXVxeHFvNCJ9LCJzcGVjIjp7InNuYXBzaG90IjoiYmYwNzJhMDllMTc3MjZkYTU0YWRjNzk5MzZlYzg3NDU1MjE5OTM1OTlkNDEyMTFkZmM5NDY2ZGZkNWJjMzJhNSIsInJlc3RvcmVNZXRob2QiOnsiczMiOnt9fSwiYmFja2VuZCI6eyJzMyI6eyJidWNrZXQiOiJiYWFzLW5naW54LWV4YW1wbGUifSwicmVwb1Bhc3N3b3JkU2VjcmV0UmVmIjp7ImtleSI6InJlcG8tcHciLCJuYW1lIjoiYmFhcy1yZXBvLXB3In19fX0=\"
},
\"key\":\"kubernetes:restic:backup:restore\",
\"key\":\"deploytarget:restic:backup:restore\",
\"environment\":{
\"name\":\"main\",
\"openshiftProjectName\":\"nginx-example-main\"
Expand Down
23 changes: 5 additions & 18 deletions internal/messenger/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ func (m *Messenger) Consumer(targetName string) { //error {
m.RandomNamespacePrefix,
)
switch jobSpec.Key {
case "kubernetes:build:cancel":
case "deploytarget:build:cancel", "kubernetes:build:cancel":
opLog.Info(
fmt.Sprintf(
"Received build cancellation for project %s, environment %s - %s",
Expand All @@ -318,7 +318,7 @@ func (m *Messenger) Consumer(targetName string) { //error {
message.Ack(false) // ack to remove from queue
return
}
case "kubernetes:task:cancel":
case "deploytarget:task:cancel", "kubernetes:task:cancel":
opLog.Info(
fmt.Sprintf(
"Received task cancellation for project %s, environment %s - %s",
Expand All @@ -333,7 +333,7 @@ func (m *Messenger) Consumer(targetName string) { //error {
message.Ack(false) // ack to remove from queue
return
}
case "kubernetes:restic:backup:restore":
case "deploytarget:restic:backup:restore", "kubernetes:restic:backup:restore":
opLog.Info(
fmt.Sprintf(
"Received backup restoration for project %s, environment %s",
Expand All @@ -347,7 +347,7 @@ func (m *Messenger) Consumer(targetName string) { //error {
message.Ack(false) // ack to remove from queue
return
}
case "kubernetes:route:migrate":
case "deploytarget:route:migrate", "kubernetes:route:migrate", "openshift:route:migrate":
opLog.Info(
fmt.Sprintf(
"Received ingress migration for project %s",
Expand All @@ -360,20 +360,7 @@ func (m *Messenger) Consumer(targetName string) { //error {
message.Ack(false) // ack to remove from queue
return
}
case "openshift:route:migrate":
opLog.Info(
fmt.Sprintf(
"Received route migration for project %s",
jobSpec.Project.Name,
),
)
err := m.IngressRouteMigration(namespace, jobSpec)
if err != nil {
//@TODO: send msg back to lagoon and update task to failed?
message.Ack(false) // ack to remove from queue
return
}
case "kubernetes:task:advanced":
case "deploytarget:task:advanced", "kubernetes:task:advanced":
opLog.Info(
fmt.Sprintf(
"Received advanced task for project %s",
Expand Down

0 comments on commit 5f482ec

Please sign in to comment.