k8c.io/api/v3@v3.0.0-20230904060738-b0a93889c0b6/pkg/apis/kubermatic/v1/dashboard_configuration.go (about) 1 /* 2 Copyright 2023 The Kubermatic Kubernetes Platform contributors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package v1 18 19 import ( 20 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 21 ) 22 23 const GlobalSettingsName = "globalsettings" 24 25 // +genclient 26 // +kubebuilder:resource:scope=Cluster 27 // +kubebuilder:object:generate=true 28 // +kubebuilder:object:root=true 29 // +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name="Age",type="date" 30 31 // DashboardConfiguration is the type representing a DashboardConfiguration. 32 type DashboardConfiguration struct { 33 metav1.TypeMeta `json:",inline"` 34 metav1.ObjectMeta `json:"metadata,omitempty"` 35 36 Spec DashboardConfigurationSpec `json:"spec,omitempty"` 37 } 38 39 type DashboardConfigurationSpec struct { 40 // CustomLinks are additional links that can be shown the dashboard's footer. 41 CustomLinks CustomLinks `json:"customLinks"` 42 // DefaultNodeCount is the default number of replicas for the initial MachineDeployment. 43 DefaultNodeCount int8 `json:"defaultNodeCount"` 44 // DisplayDemoInfo controls whether a "Demo System" hint is shown in the footer. 45 DisplayDemoInfo bool `json:"displayDemoInfo"` 46 // DisplayDemoInfo controls whether a a link to the KKP API documentation is shown in the footer. 47 DisplayAPIDocs bool `json:"displayAPIDocs"` 48 // DisplayDemoInfo controls whether a a link to TOS is shown in the footer. 49 DisplayTermsOfService bool `json:"displayTermsOfService"` 50 // EnableDashboard enables the link to the Kubernetes dashboard for a user cluster. 51 EnableDashboard bool `json:"enableDashboard"` 52 53 // +kubebuilder:default=false 54 55 // EnableWebTerminal enables the Web Terminal feature for the user clusters. 56 EnableWebTerminal bool `json:"enableWebTerminal,omitempty"` 57 58 // +kubebuilder:default=true 59 60 // EnableShareCluster enables the Share Cluster feature for the user clusters. 61 EnableShareCluster bool `json:"enableShareCluster,omitempty"` 62 63 EnableOIDCKubeconfig bool `json:"enableOIDCKubeconfig"` //nolint:tagliatelle 64 // UserProjectsLimit is the maximum number of projects a user can create. 65 UserProjectsLimit int64 `json:"userProjectsLimit"` 66 RestrictProjectCreation bool `json:"restrictProjectCreation"` 67 RestrictProjectDeletion bool `json:"restrictProjectDeletion"` 68 69 EnableExternalClusterImport bool `json:"enableExternalClusterImport"` 70 71 // CleanupOptions control what happens when a cluster is deleted via the dashboard. 72 // +optional 73 CleanupOptions *CleanupOptions `json:"cleanupOptions,omitempty"` 74 // +optional 75 OpaOptions *OpaOptions `json:"opaOptions,omitempty"` 76 // +optional 77 MlaOptions *MlaOptions `json:"mlaOptions,omitempty"` 78 79 MlaAlertmanagerPrefix string `json:"mlaAlertmanagerPrefix"` 80 MlaGrafanaPrefix string `json:"mlaGrafanaPrefix"` 81 82 // Notifications are the configuration for notifications on dashboard. 83 // +optional 84 Notifications *NotificationsOptions `json:"notifications,omitempty"` 85 86 // ProviderConfiguration are the cloud provider specific configurations on dashboard. 87 // +optional 88 ProviderConfiguration *ProviderConfiguration `json:"providerConfiguration,omitempty"` 89 90 // MachineDeploymentVMResourceQuota is used to filter out allowed machine flavors based on the specified resource limits like CPU, Memory, and GPU etc. 91 MachineDeploymentVMResourceQuota *MachineFlavorFilter `json:"machineDeploymentVMResourceQuota,omitempty"` 92 93 // AllowedOperatingSystems controls if a given operating system is allowed to be used in a MachineDeployment. 94 AllowedOperatingSystems map[OperatingSystem]bool `json:"allowedOperatingSystems,omitempty"` 95 96 // DefaultProjectResourceQuota allows to configure a default project resource quota which 97 // will be set for all projects that do not have a custom quota already set. EE-version only. 98 // +optional 99 DefaultProjectResourceQuota *DefaultProjectResourceQuota `json:"defaultQuota,omitempty"` 100 101 // +optional 102 MachineDeploymentOptions MachineDeploymentOptions `json:"machineDeploymentOptions,omitempty"` 103 104 // DisableChangelogPopup disables the changelog popup in KKP dashboard. 105 DisableChangelogPopup bool `json:"disableChangelogPopup,omitempty"` 106 107 // TODO: Datacenters, presets, user management, Google Analytics and default addons. 108 } 109 110 func (s DashboardConfigurationSpec) HasDefaultProjectResourceQuota() bool { 111 return s.DefaultProjectResourceQuota != nil && !s.DefaultProjectResourceQuota.Quota.IsEmpty() 112 } 113 114 type CustomLinks []CustomLink 115 116 type CustomLink struct { 117 Label string `json:"label"` 118 URL string `json:"url"` 119 Icon string `json:"icon"` 120 Location string `json:"location"` 121 } 122 123 type CleanupOptions struct { 124 // Enable checkboxes that allow the user to ask for LoadBalancers and PVCs 125 // to be deleted in order to not leave potentially expensive resources behind. 126 Enabled bool `json:"enabled,omitempty"` 127 // If enforced is set to true, the cleanup of LoadBalancers and PVCs is 128 // enforced. 129 Enforced bool `json:"enforced,omitempty"` 130 } 131 132 type OpaOptions struct { 133 Enabled bool `json:"enabled,omitempty"` 134 Enforced bool `json:"enforced,omitempty"` 135 } 136 137 type MlaOptions struct { 138 LoggingEnabled bool `json:"loggingEnabled,omitempty"` 139 LoggingEnforced bool `json:"loggingEnforced,omitempty"` 140 MonitoringEnabled bool `json:"monitoringEnabled,omitempty"` 141 MonitoringEnforced bool `json:"monitoringEnforced,omitempty"` 142 } 143 144 type NotificationsOptions struct { 145 // HideErrors will silence error notifications for the dashboard. 146 HideErrors bool `json:"hideErrors,omitempty"` 147 // HideErrorEvents will silence error events for the dashboard. 148 HideErrorEvents bool `json:"hideErrorEvents,omitempty"` 149 } 150 151 type ProviderConfiguration struct { 152 // OpenStack are the configurations for OpenStack provider. 153 OpenStack *OpenStack `json:"openStack,omitempty"` 154 } 155 156 type OpenStack struct { 157 // EnforceCustomDisk will enforce the custom disk option for machines for the dashboard. 158 EnforceCustomDisk bool `json:"enforceCustomDisk,omitempty"` 159 } 160 161 type MachineDeploymentOptions struct { 162 // AutoUpdatesEnabled enables the auto updates option for machine deployments on the dashboard. 163 // In case of flatcar linux, this will enable automatic updates through update engine and for other operating systems, 164 // this will enable package updates on boot for the machines. 165 AutoUpdatesEnabled bool `json:"autoUpdatesEnabled,omitempty"` 166 // AutoUpdatesEnforced enforces the auto updates option for machine deployments on the dashboard. 167 // In case of flatcar linux, this will enable automatic updates through update engine and for other operating systems, 168 // this will enable package updates on boot for the machines. 169 AutoUpdatesEnforced bool `json:"autoUpdatesEnforced,omitempty"` 170 } 171 172 // DefaultProjectResourceQuota contains the default resource quota which will be set for all 173 // projects that do not have a custom quota already set. 174 type DefaultProjectResourceQuota struct { 175 Quota *ResourceDetails `json:"quota,omitempty"` 176 } 177 178 // +kubebuilder:object:generate=true 179 // +kubebuilder:object:root=true 180 181 // DashboardConfigurationList is a list of settings. 182 type DashboardConfigurationList struct { 183 metav1.TypeMeta `json:",inline"` 184 metav1.ListMeta `json:"metadata,omitempty"` 185 186 Items []DashboardConfiguration `json:"items"` 187 }