Skip to content

Commit

Permalink
feat: allow disabling of grafana deployment
Browse files Browse the repository at this point in the history
Closes #124

Change-Id: I8ade195a73d599834dfe3cc5bb996175da9fc71d
Reviewed-on: https://review.monogon.dev/c/NetMeta/+/1941
Reviewed-by: Leopold Schabel <[email protected]>
  • Loading branch information
fionera committed Jul 18, 2023
1 parent 3ccadb8 commit bf930a0
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 34 deletions.
47 changes: 28 additions & 19 deletions deploy/single-node/config.cue
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,38 @@ _deviceAddressTest: {
}
}

// Grafana specific config parameters
#GrafanaConfig: {
// Deploy a local grafana instance
deployGrafana: bool | *true

// Dashboard display config - these settings only affect rendering of the Grafana dashboards.
dashboardDisplay: #DashboardDisplayConfig

// Initial Grafana admin password
// (after the first deployment, it can only be changed within Grafana)
grafanaInitialAdminPassword: string

// Enable Grafana basic authentication (you might to disable it after setting up third-party auth).
// OAuth auto login will be enabled if you disable basic auth.
//
// Note that the built-in admin user can authenticate even if basic auth is disabled.
grafanaBasicAuth: bool | *true

// Optional: configure GSuite authentication
grafanaGoogleAuth?: #GoogleAuth

// Default org role for new Grafana users
grafanaDefaultRole: string | *"Viewer"
}

#NetMetaConfig: {
// Allow the use of legacy config parameters
#LegacyNetMetaConfig

// Allow the use of grafana config parameters
#GrafanaConfig

// Size of the goflow sFlow/IPFIX ingestion queue. Keeping
// a larger queue allows for backprocessing of longer periods of historical data.
goflowTopicRetention: *1_000_000_000 | int // GB
Expand All @@ -175,9 +203,6 @@ _deviceAddressTest: {
// External ports
ports: #Ports

// Dashboard display config - these settings only affect rendering of the Grafana dashboards.
dashboardDisplay: #DashboardDisplayConfig

// Let's Encrypt Mode
// - off: self-signed certificate (TODO, right now, it just disables certificates altogether)
// - staging: staging Let's Encrypt server (recommended for testing!)
Expand All @@ -193,22 +218,6 @@ _deviceAddressTest: {
// Public hostname
publicHostname: string

// Initial Grafana admin password
// (after the first deployment, it can only be changed within Grafana)
grafanaInitialAdminPassword: string

// Enable Grafana basic authentication (you might to disable it after setting up third-party auth).
// OAuth auto login will be enabled if you disable basic auth.
//
// Note that the built-in admin user can authenticate even if basic auth is disabled.
grafanaBasicAuth: bool | *true

// Optional: configure GSuite authentication
grafanaGoogleAuth?: #GoogleAuth

// Default org role for new Grafana users
grafanaDefaultRole: string | *"Viewer"

// Expose the ClickHouse HTTP query API on the port defined above.
enableClickhouseIngress: bool | *false

Expand Down
32 changes: 17 additions & 15 deletions deploy/single-node/defs.cue
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,23 @@ k8s_list: [
}
}),

(grafana & {
#Config: {
image: netmeta.images.grafana.image
digest: netmeta.images.grafana.digest
publicHostname: netmeta.config.publicHostname
grafanaInitialAdminPassword: netmeta.config.grafanaInitialAdminPassword
grafanaBasicAuth: netmeta.config.grafanaBasicAuth
sessionSecret: netmeta.config.sessionSecret
grafanaDefaultRole: netmeta.config.grafanaDefaultRole
clickhouseReadonlyPassword: netmeta.config.clickhouseReadonlyPassword
fastNetMon: netmeta.config.fastNetMon
grafanaGoogleAuth: netmeta.config.grafanaGoogleAuth
dashboards: netmeta.dashboards
}
}),
if netmeta.config.deployGrafana {
(grafana & {
#Config: {
image: netmeta.images.grafana.image
digest: netmeta.images.grafana.digest
publicHostname: netmeta.config.publicHostname
grafanaInitialAdminPassword: netmeta.config.grafanaInitialAdminPassword
grafanaBasicAuth: netmeta.config.grafanaBasicAuth
sessionSecret: netmeta.config.sessionSecret
grafanaDefaultRole: netmeta.config.grafanaDefaultRole
clickhouseReadonlyPassword: netmeta.config.clickhouseReadonlyPassword
fastNetMon: netmeta.config.fastNetMon
grafanaGoogleAuth: netmeta.config.grafanaGoogleAuth
dashboards: netmeta.dashboards
}
})
},

(reconciler & {
#Config: {
Expand Down

0 comments on commit bf930a0

Please sign in to comment.