Skip to content

Commit

Permalink
Merge pull request #284 from fmount/defAPITimeout
Browse files Browse the repository at this point in the history
Set APIDefaultTimeout default value through webhooks
  • Loading branch information
openshift-merge-bot[bot] authored Jun 10, 2024
2 parents 84eee55 + c0b9aa1 commit bb987b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/v1beta1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const (
DBPurgeDefaultAge = 30
//DBPurgeDefaultSchedule is in crontab format, and the default runs the job once every day
DBPurgeDefaultSchedule = "1 0 * * *"
// APIDefaultTimeout indicates the default APITimeout for HAProxy and Apache, defaults to 60 seconds
APIDefaultTimeout = 60
)

// ManilaTemplate defines common input parameters used by all Manila services
Expand Down
6 changes: 6 additions & 0 deletions api/v1beta1/manila_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type ManilaDefaults struct {
ShareContainerImageURL string
DBPurgeAge int
DBPurgeSchedule string
APITimeout int
}

var manilaDefaults ManilaDefaults
Expand All @@ -61,6 +62,7 @@ func SetupDefaults() {
ShareContainerImageURL: util.GetEnvVar("RELATED_IMAGE_MANILA_SHARE_IMAGE_URL_DEFAULT", ManilaShareContainerImage),
DBPurgeAge: DBPurgeDefaultAge,
DBPurgeSchedule: DBPurgeDefaultSchedule,
APITimeout: APIDefaultTimeout,
}

manilalog.Info("Manila defaults initialized", "defaults", manilaDefaults)
Expand Down Expand Up @@ -109,6 +111,10 @@ func (spec *ManilaSpec) Default() {
// Default - set defaults for this Manila spec base
func (spec *ManilaSpecBase) Default() {

if spec.APITimeout == 0 {
spec.APITimeout = manilaDefaults.APITimeout
}

if spec.DBPurge.Age == 0 {
spec.DBPurge.Age = manilaDefaults.DBPurgeAge
}
Expand Down

0 comments on commit bb987b2

Please sign in to comment.