service-maintenance: Skip db cleanup
Let's enable the cloud cleanup first, and then move on to the db.
This commit is contained in:
parent
dbf396db2b
commit
4956e48a0b
2 changed files with 18 additions and 40 deletions
|
|
@ -39,19 +39,6 @@ func main() {
|
|||
logrus.Info("Dry run, no state will be changed")
|
||||
}
|
||||
|
||||
dbURL := fmt.Sprintf("postgres://%s:%s@%s:%s/%s?sslmode=%s",
|
||||
conf.PGUser,
|
||||
conf.PGPassword,
|
||||
conf.PGHost,
|
||||
conf.PGPort,
|
||||
conf.PGDatabase,
|
||||
conf.PGSSLMode,
|
||||
)
|
||||
jobs, err := dbjobqueue.New(dbURL)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
|
|
@ -94,6 +81,24 @@ func main() {
|
|||
wg.Wait()
|
||||
logrus.Info("🦀🦀🦀 cloud cleanup done 🦀🦀🦀")
|
||||
|
||||
if conf.PGHost == "" {
|
||||
logrus.Info("🦀🦀🦀 db host not defined, skipping db cleanup 🦀🦀🦀")
|
||||
return
|
||||
}
|
||||
|
||||
dbURL := fmt.Sprintf("postgres://%s:%s@%s:%s/%s?sslmode=%s",
|
||||
conf.PGUser,
|
||||
conf.PGPassword,
|
||||
conf.PGHost,
|
||||
conf.PGPort,
|
||||
conf.PGDatabase,
|
||||
conf.PGSSLMode,
|
||||
)
|
||||
jobs, err := dbjobqueue.New(dbURL)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
var jobTypes []string
|
||||
for _, a := range archs {
|
||||
jobTypes = append(jobTypes, fmt.Sprintf("%s:%s", jobType, a))
|
||||
|
|
|
|||
|
|
@ -248,33 +248,6 @@ objects:
|
|||
cpu: "${CPU_LIMIT}"
|
||||
memory: "${MEMORY_LIMIT}"
|
||||
env:
|
||||
- name: PGHOST
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: composer-db
|
||||
key: db.host
|
||||
- name: PGPORT
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: composer-db
|
||||
key: db.port
|
||||
- name: PGDATABASE
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: composer-db
|
||||
key: db.name
|
||||
- name: PGUSER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: composer-db
|
||||
key: db.user
|
||||
- name: PGPASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: composer-db
|
||||
key: db.password
|
||||
- name: PGSSLMODE
|
||||
value: "${PGSSLMODE}"
|
||||
- name: GCP_AUTH_PROVIDER_X509_CERT_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue