File tree 9 files changed +37
-2
lines changed
9 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -1178,6 +1178,13 @@ func (c *HeadlampConfig) getClusters() []Cluster {
1178
1178
"source" : context .SourceStr (),
1179
1179
"namespace" : context .KubeContext .Namespace ,
1180
1180
"extensions" : context .KubeContext .Extensions ,
1181
+ "origin" : map [string ]interface {}{
1182
+ "kubeconfig" : func () string {
1183
+ path , _ := c .getKubeConfigPath (context .SourceStr ())
1184
+ return path
1185
+ }(),
1186
+ },
1187
+ "originalName" : context .Name ,
1181
1188
},
1182
1189
})
1183
1190
}
Original file line number Diff line number Diff line change @@ -246,7 +246,8 @@ function HomeComponent(props: HomeComponentProps) {
246
246
*/
247
247
function getOrigin ( cluster : Cluster ) : string {
248
248
if ( cluster . meta_data ?. source === 'kubeconfig' ) {
249
- const kubeconfigPath = process . env . KUBECONFIG ?? '~/.kube/config' ;
249
+ const sourcePath = cluster . meta_data ?. origin ?. kubeconfig ;
250
+ const kubeconfigPath = process . env . KUBECONFIG ?? sourcePath ;
250
251
return `Kubeconfig: ${ kubeconfigPath } ` ;
251
252
} else if ( cluster . meta_data ?. source === 'dynamic_cluster' ) {
252
253
return t ( 'translation|Plugin' ) ;
Original file line number Diff line number Diff line change @@ -314,6 +314,27 @@ export default function SettingsCluster() {
314
314
) ;
315
315
}
316
316
317
+ // Display the original name of the cluster if it was loaded from a kubeconfig file.
318
+ function ClusterName ( ) {
319
+ const originalName = clusterInfo ?. meta_data ?. originalName ;
320
+ const source = clusterInfo ?. meta_data ?. source ;
321
+ // Note: display original name is currently only supported for kubeconfig sources.
322
+ const displayOriginalName = source === 'kubeconfig' && originalName ;
323
+
324
+ return (
325
+ < >
326
+ < Typography > { t ( 'translation|Name' ) } </ Typography >
327
+ { displayOriginalName && (
328
+ < Typography variant = "body2" color = "textSecondary" >
329
+ { t ( 'translation|Original name of cluster: {{ originalName }}' , {
330
+ originalName : originalName ,
331
+ } ) }
332
+ </ Typography >
333
+ ) }
334
+ </ >
335
+ ) ;
336
+ }
337
+
317
338
return (
318
339
< >
319
340
< SectionBox
@@ -336,7 +357,7 @@ export default function SettingsCluster() {
336
357
< NameValueTable
337
358
rows = { [
338
359
{
339
- name : t ( 'translation|Name' ) ,
360
+ name : < ClusterName /> ,
340
361
value : (
341
362
< TextField
342
363
onChange = { event => {
Original file line number Diff line number Diff line change 73
73
"Cluster Settings" : " " ,
74
74
"There seem to be no clusters configured…" : " " ,
75
75
"Cluster {{ clusterName }} does not exist. Please select a valid cluster:" : " " ,
76
+ "Original name of cluster: {{ originalName }}" : " " ,
76
77
"Cluster Settings ({{ clusterName }})" : " Cluster-Einstellungen ({{ clusterName }})" ,
77
78
"Go to cluster" : " " ,
78
79
"The current name of cluster. You can define custom modified name." : " " ,
Original file line number Diff line number Diff line change 73
73
"Cluster Settings" : " Cluster Settings" ,
74
74
"There seem to be no clusters configured…" : " There seem to be no clusters configured…" ,
75
75
"Cluster {{ clusterName }} does not exist. Please select a valid cluster:" : " Cluster {{ clusterName }} does not exist. Please select a valid cluster:" ,
76
+ "Original name of cluster: {{ originalName }}" : " Original name of cluster: {{ originalName }}" ,
76
77
"Cluster Settings ({{ clusterName }})" : " Cluster Settings ({{ clusterName }})" ,
77
78
"Go to cluster" : " Go to cluster" ,
78
79
"The current name of cluster. You can define custom modified name." : " The current name of cluster. You can define custom modified name." ,
Original file line number Diff line number Diff line change 73
73
"Cluster Settings" : " " ,
74
74
"There seem to be no clusters configured…" : " " ,
75
75
"Cluster {{ clusterName }} does not exist. Please select a valid cluster:" : " " ,
76
+ "Original name of cluster: {{ originalName }}" : " " ,
76
77
"Cluster Settings ({{ clusterName }})" : " Configuración del cluster ({{ clusterName }})" ,
77
78
"Go to cluster" : " " ,
78
79
"The current name of cluster. You can define custom modified name." : " " ,
Original file line number Diff line number Diff line change 73
73
"Cluster Settings" : " " ,
74
74
"There seem to be no clusters configured…" : " " ,
75
75
"Cluster {{ clusterName }} does not exist. Please select a valid cluster:" : " " ,
76
+ "Original name of cluster: {{ originalName }}" : " " ,
76
77
"Cluster Settings ({{ clusterName }})" : " Paramètres du cluster ({{ clusterName }})" ,
77
78
"Go to cluster" : " " ,
78
79
"The current name of cluster. You can define custom modified name." : " " ,
Original file line number Diff line number Diff line change 73
73
"Cluster Settings" : " " ,
74
74
"There seem to be no clusters configured…" : " " ,
75
75
"Cluster {{ clusterName }} does not exist. Please select a valid cluster:" : " " ,
76
+ "Original name of cluster: {{ originalName }}" : " " ,
76
77
"Cluster Settings ({{ clusterName }})" : " Definições do cluster ({{ clusterName }})" ,
77
78
"Go to cluster" : " " ,
78
79
"The current name of cluster. You can define custom modified name." : " " ,
Original file line number Diff line number Diff line change 73
73
"Cluster Settings" : " 叢集設置" ,
74
74
"There seem to be no clusters configured…" : " 似乎沒有配置任何叢集…" ,
75
75
"Cluster {{ clusterName }} does not exist. Please select a valid cluster:" : " 叢集 {{ clusterName }} 不存在。請選擇一個有效的叢集:" ,
76
+ "Original name of cluster: {{ originalName }}" : " " ,
76
77
"Cluster Settings ({{ clusterName }})" : " 叢集設置 ({{ clusterName }})" ,
77
78
"Go to cluster" : " 前往叢集" ,
78
79
"The current name of cluster. You can define custom modified name." : " 叢集的當前名稱。您可以定義自定義修改名稱。" ,
You can’t perform that action at this time.
0 commit comments