Skip to content

Commit

Permalink
Merge pull request #8 from amazeeio/minor-fixes
Browse files Browse the repository at this point in the history
fix: minor typos and fixes
  • Loading branch information
shreddedbacon authored Sep 23, 2021
2 parents 331bdcd + 17b8309 commit 859d53b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 2 additions & 3 deletions handlers/paused.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@ func NewCleanup(client client.Client, enableDebug bool) *Cleanup {
// upload their certificate to fastly and will unpause them to allow them to retry
// after 5 attempts it will give up
func (h *Cleanup) CheckPausedCertStatus() {
fmt.Println("paused")
opLog := ctrl.Log.WithName("handlers").WithName("PausedCertStatusCheck")
namespaces := &corev1.NamespaceList{}
if err := h.Client.List(context.Background(), namespaces); err != nil {
opLog.Error(err, fmt.Sprintf("Unable to list namespaces created by Lagoon, there may be none or something went wrong"))
opLog.Error(err, fmt.Sprintf("Unable to list namespaces, there may be none or something went wrong"))
return
}
for _, ns := range namespaces.Items {
opLog.Info(fmt.Sprintf("Checking LagoonBuilds in namespace %s", ns.ObjectMeta.Name))
opLog.Info(fmt.Sprintf("Checking ingresses in namespace %s", ns.ObjectMeta.Name))
ingresses := &networkv1beta1.IngressList{}
listOption := (&client.ListOptions{}).ApplyOptions([]client.ListOption{
client.InNamespace(ns.ObjectMeta.Name),
Expand Down
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func main() {
fastlyAPIToken = getEnv("FASTLY_API_TOKEN", fastlyAPIToken)
fastlyPlatformTLSConfiguration = getEnv("FASTLY_PLATFORM_TLS_CONFIGURATION_ID", fastlyPlatformTLSConfiguration)
clusterName = getEnv("CLUSTER_NAME", clusterName)
enablePausedStatusCron = getEnvBool("ENABEL_PAUSED_STATUS_CRON", enablePausedStatusCron)
enablePausedStatusCron = getEnvBool("ENABLE_PAUSED_STATUS_CRON", enablePausedStatusCron)
pausedStatusCron = getEnv("PAUSED_STATUS_CRON", pausedStatusCron)

if fastlyAPIToken == "" {
Expand Down Expand Up @@ -108,14 +108,15 @@ func main() {
true,
)
c := cron.New()
setupLog.Info("setting paused status check cron") // use cron to run a paused status check
// this will check any `Ingress` resources for the paused status
// and attempt to unpause them
if enablePausedStatusCron {
setupLog.Info("setting paused status check cron") // use cron to run a paused status check
c.AddFunc(pausedStatusCron, func() {
resourceCleanup.CheckPausedCertStatus()
})
}
c.Start()

// +kubebuilder:scaffold:builder

Expand Down

0 comments on commit 859d53b

Please sign in to comment.