Skip to content

Commit

Permalink
Adds external.platform.autoSleep/autoDelete docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zerbitx committed Jul 16, 2024
1 parent ef52cab commit 8e49b25
Show file tree
Hide file tree
Showing 6 changed files with 197 additions and 6 deletions.
55 changes: 54 additions & 1 deletion hack/vcluster/partials/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions vcluster/_partials/config/external/platform/apiKey.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@

## `apiKey` <span className="config-field-required" data-required="false">required</span> <span className="config-field-type">object</span> <span className="config-field-default"></span> <span className="config-field-enum"></span> <span data-pro="false" className="config-field-pro">pro</span> {#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


</summary>

Expand Down
28 changes: 28 additions & 0 deletions vcluster/_partials/config/external/platform/autoDelete.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

<details className="config-field" data-expandable="true">
<summary>

## `autoDelete` <span className="config-field-required" data-required="false">required</span> <span className="config-field-type">object</span> <span className="config-field-default"></span> <span className="config-field-enum"></span> <span data-pro="false" className="config-field-pro">pro</span> {#autoDelete}



</summary>




<details className="config-field" data-expandable="false" open>
<summary>

### `afterInactivity` <span className="config-field-required" data-required="false">required</span> <span className="config-field-type">integer</span> <span className="config-field-default"></span> <span className="config-field-enum"></span> <span data-pro="false" className="config-field-pro">pro</span> {#autoDelete-afterInactivity}



</summary>



</details>


</details>
88 changes: 88 additions & 0 deletions vcluster/_partials/config/external/platform/autoSleep.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@

<details className="config-field" data-expandable="true">
<summary>

## `autoSleep` <span className="config-field-required" data-required="false">required</span> <span className="config-field-type">object</span> <span className="config-field-default"></span> <span className="config-field-enum"></span> <span data-pro="false" className="config-field-pro">pro</span> {#autoSleep}



</summary>




<details className="config-field" data-expandable="false" open>
<summary>

### `afterInactivity` <span className="config-field-required" data-required="false">required</span> <span className="config-field-type">integer</span> <span className="config-field-default"></span> <span className="config-field-enum"></span> <span data-pro="false" className="config-field-pro">pro</span> {#autoSleep-afterInactivity}



</summary>



</details>



<details className="config-field" data-expandable="false" open>
<summary>

### `schedule` <span className="config-field-required" data-required="false">required</span> <span className="config-field-type">string</span> <span className="config-field-default"></span> <span className="config-field-enum"></span> <span data-pro="false" className="config-field-pro">pro</span> {#autoSleep-schedule}



</summary>



</details>



<details className="config-field" data-expandable="false" open>
<summary>

### `timezone` <span className="config-field-required" data-required="false">required</span> <span className="config-field-type">string</span> <span className="config-field-default"></span> <span className="config-field-enum"></span> <span data-pro="false" className="config-field-pro">pro</span> {#autoSleep-timezone}



</summary>



</details>



<details className="config-field" data-expandable="true">
<summary>

### `autoWakeup` <span className="config-field-required" data-required="false">required</span> <span className="config-field-type">object</span> <span className="config-field-default"></span> <span className="config-field-enum"></span> <span data-pro="false" className="config-field-pro">pro</span> {#autoSleep-autoWakeup}



</summary>




<details className="config-field" data-expandable="false" open>
<summary>

#### `schedule` <span className="config-field-required" data-required="false">required</span> <span className="config-field-type">string</span> <span className="config-field-default"></span> <span className="config-field-enum"></span> <span data-pro="false" className="config-field-pro">pro</span> {#autoSleep-autoWakeup-schedule}



</summary>



</details>


</details>


</details>
13 changes: 13 additions & 0 deletions vcluster/configure/vcluster-yaml/external/platform/auto-delete.mdx
Original file line number Diff line number Diff line change
@@ -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'

<External />

## Config reference

<AutoDelete />
13 changes: 13 additions & 0 deletions vcluster/configure/vcluster-yaml/external/platform/auto-sleep.mdx
Original file line number Diff line number Diff line change
@@ -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'

<External />

## Config reference

<AutoSleep />

0 comments on commit 8e49b25

Please sign in to comment.