From 8e49b2583dbe34a86d9fb9bcb2fb62972ab44c19 Mon Sep 17 00:00:00 2001 From: RyanSwanson Date: Tue, 16 Jul 2024 06:23:35 -0600 Subject: [PATCH] Adds external.platform.autoSleep/autoDelete docs --- hack/vcluster/partials/main.go | 55 +++++++++++- .../config/external/platform/apiKey.mdx | 6 +- .../config/external/platform/autoDelete.mdx | 28 ++++++ .../config/external/platform/autoSleep.mdx | 88 +++++++++++++++++++ .../external/platform/auto-delete.mdx | 13 +++ .../external/platform/auto-sleep.mdx | 13 +++ 6 files changed, 197 insertions(+), 6 deletions(-) create mode 100755 vcluster/_partials/config/external/platform/autoDelete.mdx create mode 100755 vcluster/_partials/config/external/platform/autoSleep.mdx create mode 100644 vcluster/configure/vcluster-yaml/external/platform/auto-delete.mdx create mode 100644 vcluster/configure/vcluster-yaml/external/platform/auto-sleep.mdx diff --git a/hack/vcluster/partials/main.go b/hack/vcluster/partials/main.go index 403ee9b97..2785106d9 100644 --- a/hack/vcluster/partials/main.go +++ b/hack/vcluster/partials/main.go @@ -88,14 +88,67 @@ var configPaths = []string{ var platformConfigPaths = []string{ "external/platform/apiKey", + "external/platform/autoSleep", + "external/platform/autoDelete", } type Config struct { External struct { - *config.PlatformConfig `json:"platform"` + Platform struct { + // APIKey defines where to find the platform access key and host. By default, vCluster will search in the following locations in this precedence: + // * platform.api.accessKey + // * environment variable called LICENSE + // * secret specified under external.platform.apiKey.secretName + // * secret called "vcluster-platform-api-key" in the vCluster namespace + APIKey config.PlatformAPIKey `json:"apiKey,omitempty"` + + // AutoSleep holds configuration for automatic sleep and wakeup + // +optional + AutoSleep *AutoSleep `json:"autoSleep,omitempty"` + + // AutoDelete holds configuration for automatic delete + // +optional + AutoDelete *AutoDelete `json:"autoDelete,omitempty"` + } `json:"platform"` + //*config.PlatformConfig `json:"platform"` } `json:"external"` } +type AutoSleep struct { + // AfterInactivity specifies after how many seconds of inactivity the virtual cluster should sleep + // +optional + AfterInactivity int64 `json:"afterInactivity,omitempty"` + + // Schedule specifies scheduled virtual cluster sleep in Cron format, see https://en.wikipedia.org/wiki/Cron. + // Note: timezone defined in the schedule string will be ignored. Use ".Timezone" field instead. + // +optional + Schedule string `json:"schedule,omitempty"` + + // Timezone specifies time zone used for scheduled virtual cluster operations. Defaults to UTC. + // Accepts the same format as time.LoadLocation() in Go (https://pkg.go.dev/time#LoadLocation). + // The value should be a location name corresponding to a file in the IANA Time Zone database, such as "America/New_York". + // +optional + Timezone string `json:"timezone,omitempty"` + + // AutoSleep holds configuration for automatic wakeup + // +optional + AutoWakeup *AutoWakeup `json:"autoWakeup,omitempty"` +} + +type AutoWakeup struct { + // Schedule specifies scheduled wakeup from sleep in Cron format, see https://en.wikipedia.org/wiki/Cron. + // Note: timezone defined in the schedule string will be ignored. The timezone for the autoSleep schedule will be + // used + // +optional + Schedule string `json:"schedule,omitempty"` +} + +type AutoDelete struct { + // AfterInactivity specifies after how many seconds of inactivity the virtual cluster be deleted + // +optional + AfterInactivity int64 `json:"afterInactivity,omitempty"` +} + func main() { _ = os.RemoveAll(OutDir) util.DefaultRequire = false diff --git a/vcluster/_partials/config/external/platform/apiKey.mdx b/vcluster/_partials/config/external/platform/apiKey.mdx index 451be6208..b7e6c770a 100755 --- a/vcluster/_partials/config/external/platform/apiKey.mdx +++ b/vcluster/_partials/config/external/platform/apiKey.mdx @@ -4,11 +4,7 @@ ## `apiKey` required object pro {#apiKey} -APIKey defines where to find the platform access key and host. By default, vCluster will search in the following locations in this precedence: -* platform.api.accessKey -* environment variable called LICENSE -* secret specified under external.platform.apiKey.secretName -* secret called "vcluster-platform-api-key" in the vCluster namespace + diff --git a/vcluster/_partials/config/external/platform/autoDelete.mdx b/vcluster/_partials/config/external/platform/autoDelete.mdx new file mode 100755 index 000000000..942749f30 --- /dev/null +++ b/vcluster/_partials/config/external/platform/autoDelete.mdx @@ -0,0 +1,28 @@ + +
+ + +## `autoDelete` required object pro {#autoDelete} + + + + + + + + +
+ + +### `afterInactivity` required integer pro {#autoDelete-afterInactivity} + + + + + + + +
+ + +
diff --git a/vcluster/_partials/config/external/platform/autoSleep.mdx b/vcluster/_partials/config/external/platform/autoSleep.mdx new file mode 100755 index 000000000..26876c6b7 --- /dev/null +++ b/vcluster/_partials/config/external/platform/autoSleep.mdx @@ -0,0 +1,88 @@ + +
+ + +## `autoSleep` required object pro {#autoSleep} + + + + + + + + +
+ + +### `afterInactivity` required integer pro {#autoSleep-afterInactivity} + + + + + + + +
+ + + +
+ + +### `schedule` required string pro {#autoSleep-schedule} + + + + + + + +
+ + + +
+ + +### `timezone` required string pro {#autoSleep-timezone} + + + + + + + +
+ + + +
+ + +### `autoWakeup` required object pro {#autoSleep-autoWakeup} + + + + + + + + +
+ + +#### `schedule` required string pro {#autoSleep-autoWakeup-schedule} + + + + + + + +
+ + +
+ + +
diff --git a/vcluster/configure/vcluster-yaml/external/platform/auto-delete.mdx b/vcluster/configure/vcluster-yaml/external/platform/auto-delete.mdx new file mode 100644 index 000000000..bd74f2b4d --- /dev/null +++ b/vcluster/configure/vcluster-yaml/external/platform/auto-delete.mdx @@ -0,0 +1,13 @@ +--- +title: autoDelete +sidebar_label: autoDelete +--- + +import AutoDelete from '@site/vcluster/_partials/config/external/platform/autoDelete.mdx' +import External from '@site/vcluster/_partials/config/external.mdx' + + + +## Config reference + + diff --git a/vcluster/configure/vcluster-yaml/external/platform/auto-sleep.mdx b/vcluster/configure/vcluster-yaml/external/platform/auto-sleep.mdx new file mode 100644 index 000000000..311867850 --- /dev/null +++ b/vcluster/configure/vcluster-yaml/external/platform/auto-sleep.mdx @@ -0,0 +1,13 @@ +--- +title: autoSleep +sidebar_label: autoSleep +--- + +import AutoSleep from '@site/vcluster/_partials/config/external/platform/autoSleep.mdx' +import External from '@site/vcluster/_partials/config/external.mdx' + + + +## Config reference + +