Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/core/v1beta1/site_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,10 @@ type InternalWorkbenchExperimentalFeatures struct {
// ForceAdminUiEnabled forces the configuration manager UI to be enabled even when Workbench has it disabled
// by default when running on Kubernetes
ForceAdminUiEnabled bool `json:"forceAdminUiEnabled,omitempty"`

// AuditDatabaseEnabled provisions Workbench's Audit Database: a second Postgres database,
// distinct from the internal database, that stores historical session and usage data.
AuditDatabaseEnabled bool `json:"auditDatabaseEnabled,omitempty"`
}

type InternalChronicleSpec struct {
Expand Down
13 changes: 13 additions & 0 deletions api/core/v1beta1/workbench_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type WorkbenchSecretConfig struct {

type WorkbenchSecretIniConfig struct {
Database *WorkbenchDatabaseConfig `json:"database.conf,omitempty"`
AuditDatabase *WorkbenchAuditDatabaseConfig `json:"audit-database.conf,omitempty"`
OpenidClientSecret *WorkbenchOpenidClientSecret `json:"openid-client-secret,omitempty"`
Databricks map[string]*WorkbenchDatabricksConfig `json:"databricks.conf,omitempty"`
}
Expand Down Expand Up @@ -909,6 +910,18 @@ type WorkbenchDatabaseConfig struct {
Password string `json:"password,omitempty"`
}

// WorkbenchAuditDatabaseConfig renders /etc/rstudio/audit-database.conf. Password is
// populated directly here rather than via WORKBENCH_POSTGRES_PASSWORD, since that env
// var is shared with database.conf and can't carry two different roles' passwords.
type WorkbenchAuditDatabaseConfig struct {
Provider WorkbenchDatabaseProvider `json:"provider,omitempty"`
Database string `json:"database,omitempty"`
Port string `json:"port,omitempty"`
Host string `json:"host,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
}

type WorkbenchVsCodeConfig struct {
Enabled int `json:"enabled,omitempty"`
Exe string `json:"exe,omitempty"`
Expand Down
16 changes: 15 additions & 1 deletion api/core/v1beta1/workbench_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ func TestWorkbenchSecretConfig_GenerateSecretData(t *testing.T) {
Host: "myhost.com",
Username: "user",
},
AuditDatabase: &WorkbenchAuditDatabaseConfig{
Provider: WorkbenchDatabaseProviderPostgres,
Database: "chicken_audit",
Port: "5432",
Host: "myhost.com",
Username: "chicken_audit",
Password: "audit-secret",
},
OpenidClientSecret: &WorkbenchOpenidClientSecret{
ClientId: "your-client-id-test",
},
Expand All @@ -40,9 +48,15 @@ func TestWorkbenchSecretConfig_GenerateSecretData(t *testing.T) {
require.Contains(t, res["database.conf"], "port=5432")
require.Contains(t, res["database.conf"], "host=myhost.com")
require.Contains(t, res["database.conf"], "username=user")
require.Contains(t, res["audit-database.conf"], "provider=postgresql")
require.Contains(t, res["audit-database.conf"], "database=chicken_audit")
require.Contains(t, res["audit-database.conf"], "port=5432")
require.Contains(t, res["audit-database.conf"], "host=myhost.com")
require.Contains(t, res["audit-database.conf"], "username=chicken_audit")
require.Contains(t, res["audit-database.conf"], "password=audit-secret")
require.Contains(t, res["openid-client-secret"], "client-id=your-client-id-test")
require.Contains(t, res["databricks.conf"], "name=posit-test")
require.Len(t, res, 3)
require.Len(t, res, 4)
}

func TestWorkbenchConfig_GenerateConfigmap(t *testing.T) {
Expand Down
5 changes: 5 additions & 0 deletions api/core/v1beta1/workbench_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ type WorkbenchSpec struct {
// MainDatabaseCredentialSecret configures the secret used for storing the main database credentials
MainDatabaseCredentialSecret SecretConfig `json:"mainDatabaseCredentialSecret,omitempty"`

// AuditDatabaseEnabled provisions a second Postgres database (distinct from the internal
// database) and role, then renders audit-database.conf pointing Workbench at it. Requires
// the Secret referenced by Secret.VaultName to already contain a "dev-audit-db-password" key.
AuditDatabaseEnabled bool `json:"auditDatabaseEnabled,omitempty"`

Replicas int `json:"replicas,omitempty"`

// DsnSecret is the name of the secret that contains the DSN to include with all Workbench sessions
Expand Down
20 changes: 20 additions & 0 deletions api/core/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions client-go/applyconfiguration/core/v1beta1/workbenchspec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions client-go/applyconfiguration/utils.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions config/crd/bases/core.posit.team_sites.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1884,6 +1884,11 @@ spec:
description: ExperimentalFeatures allows enabling miscellaneous
experimental features for workbench
properties:
auditDatabaseEnabled:
description: |-
AuditDatabaseEnabled provisions Workbench's Audit Database: a second Postgres database,
distinct from the internal database, that stores historical session and usage data.
type: boolean
chronicleSidecarProductApiKeyEnabled:
description: |-
ChronicleSidecarProductApiKeyEnabled assumes the api key for this product has been added to a secret and
Expand Down
25 changes: 25 additions & 0 deletions config/crd/bases/core.posit.team_workbenches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ spec:
type: string
type: object
type: array
auditDatabaseEnabled:
description: |-
AuditDatabaseEnabled provisions a second Postgres database (distinct from the internal
database) and role, then renders audit-database.conf pointing Workbench at it. Requires
the Secret referenced by Secret.VaultName to already contain a "dev-audit-db-password" key.
type: boolean
auth:
properties:
administratorRoleMapping:
Expand Down Expand Up @@ -975,6 +981,25 @@ spec:
properties:
workbench-secret-ini-config:
properties:
audit-database.conf:
description: |-
WorkbenchAuditDatabaseConfig renders /etc/rstudio/audit-database.conf. Password is
populated directly here rather than via WORKBENCH_POSTGRES_PASSWORD, since that env
var is shared with database.conf and can't carry two different roles' passwords.
properties:
database:
type: string
host:
type: string
password:
type: string
port:
type: string
provider:
type: string
username:
type: string
type: object
database.conf:
properties:
database:
Expand Down
5 changes: 5 additions & 0 deletions dist/chart/templates/crd/core.posit.team_sites.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1905,6 +1905,11 @@ spec:
description: ExperimentalFeatures allows enabling miscellaneous
experimental features for workbench
properties:
auditDatabaseEnabled:
description: |-
AuditDatabaseEnabled provisions Workbench's Audit Database: a second Postgres database,
distinct from the internal database, that stores historical session and usage data.
type: boolean
chronicleSidecarProductApiKeyEnabled:
description: |-
ChronicleSidecarProductApiKeyEnabled assumes the api key for this product has been added to a secret and
Expand Down
Loading
Loading