Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the cluster info for headlamp_info to inlcude originalName #2747

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

vyncent-t
Copy link
Contributor

@vyncent-t vyncent-t commented Jan 13, 2025

Fixes issue #2750

Description

This PR aims to expands the current implementation of the headlamp_info extension that is created to provide additional information about a cluster within the kubeconfig.

Changes

  • the headlamp_info extension is now created at the home view of the app (it used to only be created if we rename a cluster)
  • the headlamp_info extension now includes a field for storing the original name of a cluster originalName
  • for clusters that have been renamed before these changes were introduced, the headlamp_info is now updated to include the originalName field and correct val
  • prepares the headlamp_info field for future cluster renaming by introducing the customName field along with originalName

How to test

⚠️ IMPORTANT ⚠️ : please be aware that this PR changes config data within the kubeconfig, I recommend copying any local kubeconfig files or have the undo button ready with your kubeconfig pulled up in your IDE

  • locate kubeconfig file
  • open headlamp app and navigate to the home view where all clusters are visible
  • in kubeconfig, observe that all existing clusters now have headlamp_info field and originalName field containing the clusters name
  • create a new cluster
  • let app load new cluster to home view
  • view changes for the new cluster

Context notes:

Non dynamic clusters

  • I think its best to keep the changes in the home view where we use getCluster func from the backend (this is called on the home view of the app) since this would then populate the headlamp_info field and append the original name field, this would make it so that we can use the original name field along with the custom name field to delete a cluster from the home view

@vyncent-t vyncent-t self-assigned this Jan 13, 2025
@vyncent-t
Copy link
Contributor Author

progress: able now to have the cluster generate a headlamp_info field when it is created and gathered via the getCluster changes

need to fix:

  • unable to keep the previous name in the custom headlamp_info field after renaming it

@vyncent-t vyncent-t force-pushed the keep-original-name-kubeconfig branch from 2136402 to 6248883 Compare January 14, 2025 17:35
Copy link

Backend Code coverage changed from 63.8% to 64.4%. Change: .6% 😃.

Coverage report
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:92:			ServeHTTP				58.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:141:			fileExists				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:151:			copyReplace				63.6%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:175:			baseURLReplace				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:203:			getOidcCallbackURL			91.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:230:			serveWithNoCacheHeader			33.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:239:			defaultKubeConfigPersistenceDir		61.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:267:			defaultKubeConfigPersistenceFile	75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:280:			addPluginRoutes				50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:334:			createHeadlampHandler			40.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:701:			parseClusterAndToken			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:718:			decodePayload				71.4%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:732:			getExpiryTime				75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:741:			isTokenAboutToExpire			61.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:765:			refreshAndCacheNewToken			0.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:835:			OIDCTokenRefreshMiddleware		30.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:886:			StartHeadlampServer			66.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:900:			getHelmHandler				53.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:928:			checkHeadlampBackendToken		100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:941:			handleClusterHelm			33.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1020:			handleClusterAPI			51.6%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1076:			handleClusterRequests			66.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1084:			getClusters				76.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1133:			parseCustomNameClusters			38.1%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1187:			parseClusterFromKubeConfig		83.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1221:			getConfig				75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1232:			addCluster				57.9%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1267:			decodeClusterRequest			71.4%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1282:			processClusterRequest			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1291:			processKubeConfig			83.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1308:			processManualConfig			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1328:			handleLoadErrors			66.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1343:			writeKubeConfig				70.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1363:			addContextsToStore			80.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1375:			deleteCluster				0.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1424:			getKubeConfigPath			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1433:			handleStatelessClusterRename		50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1447:			originalNameToExtensions		62.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1494:			customNameToExtenstions			26.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1541:			updateCustomContextToCache		50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1574:			getPathAndLoadKubeconfig		77.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1597:			keepOriginalClusterName			84.6%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1628:			renameCluster				53.1%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1691:			addClusterSetupRoute			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1719:			handleNodeDrain				45.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1784:			drainNode				37.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1834:			handleNodeDrainStatus			52.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:120:		NewWSConnLock				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:129:		WriteJSON				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:139:		ReadJSON				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:146:		ReadMessage				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:152:		WriteMessage				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:162:		Close					100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:170:		NewMultiplexer				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:183:		updateStatus				76.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:243:		establishClusterConnection		81.8%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:289:		getClusterConfigWithFallback		100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:306:		createConnection			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:328:		dialWebSocket				87.5%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:356:		monitorConnection			54.5%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:381:		reconnect				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:411:		HandleClientWebSocket			72.7%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:454:		readClientMessage			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:475:		getOrCreateConnection			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:504:		handleConnectionError			75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:526:		writeMessageToCluster			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:544:		handleClusterMessages			85.7%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:562:		processClusterMessage			75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:605:		sendIfNewResourceVersion		75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:648:		sendCompleteMessage			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:679:		sendDataMessage				88.9%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:702:		cleanupConnection			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:719:		createWrapperMessage			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:739:		cleanupConnections			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:756:		getClusterConfig			85.7%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:771:		CloseConnection				81.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:812:		createConnectionKey			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:817:		createWebSocketURL			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/server.go:14:			main					0.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:17:			MarshalCustomObject			60.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:42:			setKeyInCache				50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:71:			handleStatelessReq			51.5%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:143:			parseKubeConfig				75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:182:			websocketConnContextKey			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:232:			getContextKeyForRequest			76.9%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:40:			New					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:52:			Set					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:57:			SetWithTTL				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:75:			Delete					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:85:			Get					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:102:		GetAll					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:122:		cleanUp					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:140:		UpdateTTL				88.9%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:40:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:62:		Parse					74.4%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:149:		flagset					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:174:		defaultPluginDir			61.5%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:207:		GetDefaultKubeConfigPath		66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/charts.go:27:			listCharts				89.5%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/charts.go:77:			ListCharts				72.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:35:		NewActionConfig				87.5%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:54:		NewHandler				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:60:		NewHandlerWithSettings			60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:85:		ToRESTConfig				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:89:		ToRawKubeConfigLoader			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:93:		ToDiscoveryClient			83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:109:		ToRESTMapper				71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:129:		getReleaseStatus			0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:165:		setReleaseStatus			60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:188:		setReleaseStatusSilent			66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:53:		getReleases				57.1%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:112:		ListRelease				68.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:158:		GetRelease				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:217:		GetReleaseHistory			46.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:277:		UninstallRelease			55.6%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:334:		uninstallRelease			71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:357:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:362:		RollbackRelease				51.6%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:421:		rollbackRelease				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:453:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:458:		handleError				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:463:		returnResponse				71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:479:		InstallRelease				72.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:513:		getChart				35.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:565:		installRelease				60.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:625:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:630:		UpgradeRelease				60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:666:		logActionState				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:687:		upgradeRelease				63.6%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:731:		Validate				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:749:		GetActionStatus				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:35:		createFileIfNotThere			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:47:		lockRepositoryFile			87.5%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:68:		addRepository				61.8%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:131:		AddRepo					72.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:176:		createFullPath				66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:184:		listRepositories			69.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:213:		ListRepo				58.3%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:236:		RemoveRepository			64.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:279:		RemoveRepo				66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:291:		UpdateRepository			68.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:333:		UpdateRepository			81.8%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:26:	NewContextStore				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:35:	AddContext				76.9%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:64:	GetContexts				85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:80:	GetContext				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:90:	RemoveContext				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:95:	AddContextWithKeyAndTTL			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:100:	UpdateTTL				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/file.go:14:		WriteToFile				86.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/file.go:48:		RemoveContextFromFile			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:67:	DeepCopyObject				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:72:	DeepCopy				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:92:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:103:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:114:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:125:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:138:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:150:	ClientConfig				80.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:184:	RESTConfig				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:194:	OidcConfig				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:212:	ProxyRequest				83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:226:	ClientSetWithToken			66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:240:	SourceStr				60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:254:	SetupProxy				91.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:279:	AuthType				66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:297:	LoadContextsFromFile			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:312:	LoadContextsFromBase64String		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:324:	LoadContextsFromMultipleFiles		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:347:	loadContextsFromData			92.9%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:381:	UnmarshalKubeconfig			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:393:	GetContextsFromKubeconfig		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:409:	ProcessContext				90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:458:	extractContextInfo			71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:476:	extractClusterAndUserNames		83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:493:	getClusterAndUser			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:514:	createAndValidateConfig			90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:546:	getNameOrUnknown			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:557:	HandleConfigLoadError			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:598:	checkBase64Errors			90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:621:	checkUserBase64Fields			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:641:	checkClusterBase64Fields		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:657:	toStringKeyMap				83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:673:	getCluster				87.5%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:691:	getUser					80.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:712:	createKubeConfig			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:735:	convertToContext			85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:776:	LoadContextsFromAPIConfig		76.5%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:815:	splitKubeConfigPath			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:825:	GetInClusterContext			0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:872:	LoadAndStoreKubeConfigs			83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:897:	makeDNSFriendly				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/watcher.go:17:		LoadAndWatchFiles			62.5%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/watcher.go:69:		addFilesToWatcher			64.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/watcher.go:111:		syncContexts				81.8%
github.com/headlamp-k8s/headlamp/backend/pkg/logger/logger.go:29:		Log					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/logger/logger.go:36:		log					75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/logger/logger.go:80:		SetLogFunc				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:30:		Watch					77.8%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:51:		periodicallyWatchSubfolders		75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:84:		generateSeparatePluginPaths		90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:105:		GeneratePluginPaths			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:120:		ListPlugins				68.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:173:		pluginBasePathListForDir		86.4%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:219:		canSendRefresh				77.8%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:240:		HandlePluginEvents			70.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:266:		PopulatePluginsCache			66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:292:		HandlePluginReload			80.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:328:		Delete					85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:343:		isSubdirectory				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:46:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:80:		getFreePort				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:99:		StartPortForward			50.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:173:	startPortForward			61.4%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:269:	checkIfPodIsRunning			71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:291:	Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:304:	StopOrDeletePortForward			47.1%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:336:	GetPortForwards				45.5%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:358:	GetPortForwardByID			45.5%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:16:		portforwardKeyGenerator			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:33:		portforwardstore			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:46:		stopOrDeletePortForward			69.2%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:74:		getPortForwardList			77.8%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:94:		getPortForwardByID			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/utils/utils.go:4:			Contains				100.0%
total:										(statements)				64.4%

Html coverage report download

@vyncent-t vyncent-t force-pushed the keep-original-name-kubeconfig branch from 6248883 to 776c7c0 Compare January 14, 2025 17:44
@vyncent-t vyncent-t marked this pull request as ready for review January 14, 2025 17:45
@vyncent-t
Copy link
Contributor Author

note:

done

  • non dynamic clusters now have headlamp_info extension created at home view
  • dynamic clusters now have headlamp_info extension created at home view

to do

  • create tests for new functions after reviewed

@vyncent-t vyncent-t requested review from yolossn and knrt10 January 14, 2025 17:47
@vyncent-t
Copy link
Contributor Author

vyncent-t commented Jan 14, 2025

let me know what you guys think for these changes before I move on to create some tests 😎 @knrt10 @yolossn

context

The main issue we are trying to solve is that there is currently no way to preserve the original name that a cluster has been created with, this has lead to issues with renaming / duplicate naming clusters with names that have been used already.

Currently, on main if you create a cluster and rename it and then you console log the clusters that are being rendered at the home page, you will see that the "name" field populates the changed name while the kubeconfig still holds the old name

The goal here is to make sure we create the headlamp_info extension so that we can refer to the headlamp_info.originalName later on in the future

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jan 14, 2025
Copy link

Backend Code coverage changed from 63.8% to 64.2%. Change: .4% 😃.

Coverage report
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:92:			ServeHTTP				58.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:141:			fileExists				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:151:			copyReplace				63.6%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:175:			baseURLReplace				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:203:			getOidcCallbackURL			91.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:230:			serveWithNoCacheHeader			33.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:239:			defaultKubeConfigPersistenceDir		61.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:267:			defaultKubeConfigPersistenceFile	75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:280:			addPluginRoutes				50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:334:			createHeadlampHandler			40.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:701:			parseClusterAndToken			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:718:			decodePayload				71.4%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:732:			getExpiryTime				75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:741:			isTokenAboutToExpire			61.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:765:			refreshAndCacheNewToken			0.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:835:			OIDCTokenRefreshMiddleware		30.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:886:			StartHeadlampServer			66.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:900:			getHelmHandler				53.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:928:			checkHeadlampBackendToken		100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:941:			handleClusterHelm			33.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1020:			handleClusterAPI			51.6%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1076:			handleClusterRequests			66.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1084:			getClusters				76.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1133:			parseCustomNameClusters			38.1%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1187:			parseClusterFromKubeConfig		83.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1221:			getConfig				75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1232:			addCluster				57.9%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1267:			decodeClusterRequest			71.4%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1282:			processClusterRequest			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1291:			processKubeConfig			83.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1308:			processManualConfig			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1328:			handleLoadErrors			66.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1343:			writeKubeConfig				70.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1363:			addContextsToStore			80.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1375:			deleteCluster				0.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1424:			getKubeConfigPath			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1433:			handleStatelessClusterRename		50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1447:			originalNameToExtensions		62.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1494:			customNameToExtenstions			26.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1541:			updateCustomContextToCache		50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1574:			getPathAndLoadKubeconfig		77.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1597:			keepOriginalClusterName			84.6%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1628:			renameCluster				53.1%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1691:			addClusterSetupRoute			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1719:			handleNodeDrain				45.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1784:			drainNode				37.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1834:			handleNodeDrainStatus			52.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:120:		NewWSConnLock				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:129:		WriteJSON				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:139:		ReadJSON				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:146:		ReadMessage				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:152:		WriteMessage				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:162:		Close					100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:170:		NewMultiplexer				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:183:		updateStatus				76.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:243:		establishClusterConnection		81.8%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:289:		getClusterConfigWithFallback		100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:306:		createConnection			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:328:		dialWebSocket				87.5%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:356:		monitorConnection			54.5%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:381:		reconnect				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:411:		HandleClientWebSocket			72.7%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:454:		readClientMessage			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:475:		getOrCreateConnection			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:504:		handleConnectionError			75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:526:		writeMessageToCluster			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:544:		handleClusterMessages			85.7%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:562:		processClusterMessage			75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:605:		sendIfNewResourceVersion		75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:648:		sendCompleteMessage			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:679:		sendDataMessage				88.9%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:702:		cleanupConnection			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:719:		createWrapperMessage			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:739:		cleanupConnections			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:756:		getClusterConfig			85.7%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:771:		CloseConnection				81.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:812:		createConnectionKey			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:817:		createWebSocketURL			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/server.go:14:			main					0.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:17:			MarshalCustomObject			60.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:42:			setKeyInCache				50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:71:			handleStatelessReq			51.5%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:143:			parseKubeConfig				75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:182:			websocketConnContextKey			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:232:			getContextKeyForRequest			76.9%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:40:			New					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:52:			Set					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:57:			SetWithTTL				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:75:			Delete					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:85:			Get					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:102:		GetAll					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:122:		cleanUp					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:140:		UpdateTTL				88.9%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:40:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:62:		Parse					74.4%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:149:		flagset					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:174:		defaultPluginDir			61.5%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:207:		GetDefaultKubeConfigPath		66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/charts.go:27:			listCharts				89.5%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/charts.go:77:			ListCharts				72.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:35:		NewActionConfig				87.5%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:54:		NewHandler				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:60:		NewHandlerWithSettings			60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:85:		ToRESTConfig				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:89:		ToRawKubeConfigLoader			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:93:		ToDiscoveryClient			83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:109:		ToRESTMapper				71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:129:		getReleaseStatus			0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:165:		setReleaseStatus			60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:188:		setReleaseStatusSilent			66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:53:		getReleases				57.1%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:112:		ListRelease				68.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:158:		GetRelease				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:217:		GetReleaseHistory			46.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:277:		UninstallRelease			55.6%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:334:		uninstallRelease			71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:357:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:362:		RollbackRelease				51.6%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:421:		rollbackRelease				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:453:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:458:		handleError				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:463:		returnResponse				71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:479:		InstallRelease				72.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:513:		getChart				35.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:565:		installRelease				60.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:625:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:630:		UpgradeRelease				60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:666:		logActionState				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:687:		upgradeRelease				63.6%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:731:		Validate				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:749:		GetActionStatus				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:35:		createFileIfNotThere			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:47:		lockRepositoryFile			87.5%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:68:		addRepository				61.8%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:131:		AddRepo					72.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:176:		createFullPath				66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:184:		listRepositories			69.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:213:		ListRepo				58.3%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:236:		RemoveRepository			64.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:279:		RemoveRepo				66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:291:		UpdateRepository			68.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:333:		UpdateRepository			81.8%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:26:	NewContextStore				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:35:	AddContext				76.9%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:64:	GetContexts				85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:80:	GetContext				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:90:	RemoveContext				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:95:	AddContextWithKeyAndTTL			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:100:	UpdateTTL				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/file.go:14:		WriteToFile				86.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/file.go:48:		RemoveContextFromFile			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:67:	DeepCopyObject				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:72:	DeepCopy				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:92:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:103:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:114:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:125:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:138:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:150:	ClientConfig				80.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:184:	RESTConfig				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:194:	OidcConfig				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:212:	ProxyRequest				83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:226:	ClientSetWithToken			66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:240:	SourceStr				60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:254:	SetupProxy				91.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:279:	AuthType				66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:297:	LoadContextsFromFile			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:312:	LoadContextsFromBase64String		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:324:	LoadContextsFromMultipleFiles		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:347:	loadContextsFromData			85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:381:	UnmarshalKubeconfig			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:393:	GetContextsFromKubeconfig		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:409:	ProcessContext				90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:458:	extractContextInfo			71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:476:	extractClusterAndUserNames		83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:493:	getClusterAndUser			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:514:	createAndValidateConfig			90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:546:	getNameOrUnknown			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:557:	HandleConfigLoadError			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:598:	checkBase64Errors			90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:621:	checkUserBase64Fields			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:641:	checkClusterBase64Fields		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:657:	toStringKeyMap				83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:673:	getCluster				87.5%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:691:	getUser					80.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:712:	createKubeConfig			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:735:	convertToContext			85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:776:	LoadContextsFromAPIConfig		76.5%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:815:	splitKubeConfigPath			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:825:	GetInClusterContext			0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:872:	LoadAndStoreKubeConfigs			83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:897:	makeDNSFriendly				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/watcher.go:17:		LoadAndWatchFiles			58.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/watcher.go:69:		addFilesToWatcher			64.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/watcher.go:111:		syncContexts				77.3%
github.com/headlamp-k8s/headlamp/backend/pkg/logger/logger.go:29:		Log					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/logger/logger.go:36:		log					75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/logger/logger.go:80:		SetLogFunc				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:30:		Watch					77.8%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:51:		periodicallyWatchSubfolders		75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:84:		generateSeparatePluginPaths		90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:105:		GeneratePluginPaths			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:120:		ListPlugins				68.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:173:		pluginBasePathListForDir		77.3%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:219:		canSendRefresh				77.8%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:240:		HandlePluginEvents			70.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:266:		PopulatePluginsCache			66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:292:		HandlePluginReload			80.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:328:		Delete					85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:343:		isSubdirectory				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:46:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:80:		getFreePort				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:99:		StartPortForward			50.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:173:	startPortForward			61.4%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:269:	checkIfPodIsRunning			71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:291:	Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:304:	StopOrDeletePortForward			47.1%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:336:	GetPortForwards				45.5%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:358:	GetPortForwardByID			45.5%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:16:		portforwardKeyGenerator			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:33:		portforwardstore			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:46:		stopOrDeletePortForward			69.2%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:74:		getPortForwardList			77.8%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:94:		getPortForwardByID			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/utils/utils.go:4:			Contains				100.0%
total:										(statements)				64.2%

Html coverage report download

@vyncent-t vyncent-t force-pushed the keep-original-name-kubeconfig branch from 776c7c0 to 0acb858 Compare January 14, 2025 19:46
@vyncent-t
Copy link
Contributor Author

note: previous push fixes logic for clusters that were renamed already (with the headlamp_info already there) to update the headlamp_info to have their original name saved also

@knrt10
Copy link
Contributor

knrt10 commented Jan 15, 2025

Currently, on main if you create a cluster and rename it and then you console log the clusters that are being rendered at the home page, you will see that the "name" field populates the changed name while the kubeconfig still holds the old name

@vyncent-t Thank you for the PR. I am not sure what this would solve. This was the intended change. Our approach initially was we do want to change the kubeconfig name of user because if user change the name in headlamp does not mean they want to change their kubeconfig. For example if they get their clusters using kubeclt they should still see the same name.

This is the reason we do not change the name field in kubeconfig, rather than we edit the headlmap_info extension in the metadata. So when user renames the cluster only that thing is changed.

Regarding clusters that use the same name. That I think should not be possible because we automatically throw an error if there are same context name. Also, if there are same name in kubeconfig that is automatically rejected by kubectl as well

@vyncent-t
Copy link
Contributor Author

Currently, on main if you create a cluster and rename it and then you console log the clusters that are being rendered at the home page, you will see that the "name" field populates the changed name while the kubeconfig still holds the old name

@vyncent-t Thank you for the PR. I am not sure what this would solve. This was the intended change. Our approach initially was we do want to change the kubeconfig name of user because if user change the name in headlamp does not mean they want to change their kubeconfig. For example if they get their clusters using kubeclt they should still see the same name.

This is the reason we do not change the name field in kubeconfig, rather than we edit the headlmap_info extension in the metadata. So when user renames the cluster only that thing is changed.

Regarding clusters that use the same name. That I think should not be possible because we automatically throw an error if there are same context name. Also, if there are same name in kubeconfig that is automatically rejected by kubectl as well

@knrt10 thanks for getting back to me 😎

allow me to clarify a few things and feel free to let me know if we should sync up to cover this

This PR is a prerequisite for continuing the progress of the delete non dynamic clusters PR that you had reviewed for me earlier (along with two other issues that stem from this that I will explain later).

In the delete non dynamic clusters PR's current state, the delete function needs a name in which to find and delete that cluster, however for clusters that have been renamed, that new customName is what is being being used in the app and thus when we go to delete that cluster on the app the customName is what is being passed into the delete function.

The goal of this PR is to expand the headlamp_info extension so that it will preserve the original name of the cluster, while also having the headlamp_info extension be created up front as opposed to only being created if we rename a cluster.

This PR does not change the existing main data of a kubeconfig context, it only creates the headlamp_info extension and saves the clusters name to it. I have also added logic that would check if a cluster has already been renamed in the app, which means headlamp_info already exists on that cluster, and thus that section is just updated to include originalName: [ognamehere]

I will include more information about what this PR does and how to test it in the description

As for the clusters using the same name and renaming- I am also working on two issues that spawn from the current name handling for clusters. Currently we are able to create a cluster and rename it to the name of another cluster, causing the renamed cluster link to 'consume' the og cluster link. There is also the issue of creating a cluster with the og name of an older renamed cluster causing duplicate links. These were able to be done through renaming use and no errors stop this. I am also working on fixes for both of these but they too require this headlamp_info improvement


TLDR: I have been tasked with expanding the headlamp_info extension to also include the original name of a cluster so that we can access that information and use it readily for both the backend and the UI. It is also needed in PRs that are tied to this one. Currently on main the headlamp_info extension is only created if we rename a cluster, this PR just creates the headlamp_info extension at the home view and stores the original name under originalName

@knrt10
Copy link
Contributor

knrt10 commented Jan 15, 2025

Thank you for explaining. It makes sense now. Will review it now.

Copy link
Contributor

@knrt10 knrt10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions.

backend/cmd/headlamp.go Outdated Show resolved Hide resolved
backend/cmd/headlamp.go Show resolved Hide resolved
backend/cmd/headlamp.go Outdated Show resolved Hide resolved
backend/cmd/headlamp.go Outdated Show resolved Hide resolved
backend/cmd/headlamp.go Outdated Show resolved Hide resolved
backend/cmd/headlamp.go Show resolved Hide resolved
backend/cmd/headlamp.go Outdated Show resolved Hide resolved
backend/cmd/headlamp.go Show resolved Hide resolved
backend/cmd/headlamp.go Outdated Show resolved Hide resolved
backend/cmd/headlamp.go Outdated Show resolved Hide resolved
@vyncent-t vyncent-t force-pushed the keep-original-name-kubeconfig branch from 0acb858 to 24f7a6b Compare January 21, 2025 21:21
Copy link

Backend Code coverage changed from 63.8% to 64.0%. Change: .2% 😃.

Coverage report
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:92:			ServeHTTP				58.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:141:			fileExists				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:151:			copyReplace				63.6%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:175:			baseURLReplace				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:203:			getOidcCallbackURL			91.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:230:			serveWithNoCacheHeader			33.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:239:			defaultKubeConfigPersistenceDir		61.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:267:			defaultKubeConfigPersistenceFile	75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:280:			addPluginRoutes				50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:334:			createHeadlampHandler			40.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:701:			parseClusterAndToken			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:718:			decodePayload				71.4%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:732:			getExpiryTime				75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:741:			isTokenAboutToExpire			61.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:765:			refreshAndCacheNewToken			0.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:835:			OIDCTokenRefreshMiddleware		30.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:886:			StartHeadlampServer			66.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:900:			getHelmHandler				53.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:928:			checkHeadlampBackendToken		100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:941:			handleClusterHelm			33.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1020:			handleClusterAPI			51.6%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1076:			handleClusterRequests			66.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1084:			getClusters				76.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1134:			handleHeadlampInfo			64.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1173:			parseCustomNameClusters			38.1%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1227:			parseClusterFromKubeConfig		83.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1261:			getConfig				75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1272:			addCluster				57.9%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1307:			decodeClusterRequest			71.4%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1322:			processClusterRequest			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1331:			processKubeConfig			83.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1348:			processManualConfig			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1368:			handleLoadErrors			66.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1383:			writeKubeConfig				70.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1403:			addContextsToStore			80.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1415:			deleteCluster				0.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1464:			getKubeConfigPath			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1473:			handleStatelessClusterRename		50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1490:			originalNameToExtensions		39.1%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1548:			customNameToExtenstions			26.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1595:			updateCustomContextToCache		50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1628:			getPathAndLoadKubeconfig		77.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1662:			keepOriginalClusterName			81.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1691:			renameCluster				53.1%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1754:			addClusterSetupRoute			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1782:			handleNodeDrain				45.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1847:			drainNode				37.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1897:			handleNodeDrainStatus			52.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:120:		NewWSConnLock				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:129:		WriteJSON				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:139:		ReadJSON				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:146:		ReadMessage				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:152:		WriteMessage				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:162:		Close					100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:170:		NewMultiplexer				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:183:		updateStatus				76.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:243:		establishClusterConnection		81.8%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:289:		getClusterConfigWithFallback		100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:306:		createConnection			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:328:		dialWebSocket				87.5%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:356:		monitorConnection			54.5%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:381:		reconnect				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:411:		HandleClientWebSocket			72.7%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:454:		readClientMessage			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:475:		getOrCreateConnection			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:504:		handleConnectionError			75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:526:		writeMessageToCluster			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:544:		handleClusterMessages			85.7%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:562:		processClusterMessage			75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:605:		sendIfNewResourceVersion		75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:648:		sendCompleteMessage			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:679:		sendDataMessage				88.9%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:702:		cleanupConnection			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:719:		createWrapperMessage			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:739:		cleanupConnections			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:756:		getClusterConfig			85.7%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:771:		CloseConnection				81.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:812:		createConnectionKey			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:817:		createWebSocketURL			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/server.go:14:			main					0.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:17:			MarshalCustomObject			60.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:42:			setKeyInCache				50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:71:			handleStatelessReq			51.5%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:143:			parseKubeConfig				75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:182:			websocketConnContextKey			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:232:			getContextKeyForRequest			76.9%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:40:			New					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:52:			Set					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:57:			SetWithTTL				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:75:			Delete					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:85:			Get					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:102:		GetAll					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:122:		cleanUp					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:140:		UpdateTTL				88.9%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:40:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:62:		Parse					74.4%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:149:		flagset					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:174:		defaultPluginDir			61.5%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:207:		GetDefaultKubeConfigPath		66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/charts.go:27:			listCharts				89.5%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/charts.go:77:			ListCharts				72.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:35:		NewActionConfig				87.5%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:54:		NewHandler				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:60:		NewHandlerWithSettings			60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:85:		ToRESTConfig				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:89:		ToRawKubeConfigLoader			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:93:		ToDiscoveryClient			83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:109:		ToRESTMapper				71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:129:		getReleaseStatus			0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:165:		setReleaseStatus			60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:188:		setReleaseStatusSilent			66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:53:		getReleases				57.1%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:112:		ListRelease				68.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:158:		GetRelease				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:217:		GetReleaseHistory			46.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:277:		UninstallRelease			55.6%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:334:		uninstallRelease			71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:357:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:362:		RollbackRelease				51.6%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:421:		rollbackRelease				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:453:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:458:		handleError				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:463:		returnResponse				71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:479:		InstallRelease				72.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:513:		getChart				35.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:565:		installRelease				60.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:625:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:630:		UpgradeRelease				60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:666:		logActionState				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:687:		upgradeRelease				63.6%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:731:		Validate				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:749:		GetActionStatus				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:35:		createFileIfNotThere			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:47:		lockRepositoryFile			87.5%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:68:		addRepository				61.8%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:131:		AddRepo					72.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:176:		createFullPath				66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:184:		listRepositories			69.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:213:		ListRepo				58.3%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:236:		RemoveRepository			64.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:279:		RemoveRepo				66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:291:		UpdateRepository			68.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:333:		UpdateRepository			81.8%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:26:	NewContextStore				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:35:	AddContext				76.9%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:64:	GetContexts				85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:80:	GetContext				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:90:	RemoveContext				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:95:	AddContextWithKeyAndTTL			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:100:	UpdateTTL				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/file.go:14:		WriteToFile				86.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/file.go:48:		RemoveContextFromFile			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:67:	DeepCopyObject				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:72:	DeepCopy				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:92:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:103:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:114:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:125:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:138:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:150:	ClientConfig				80.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:184:	RESTConfig				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:194:	OidcConfig				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:212:	ProxyRequest				83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:226:	ClientSetWithToken			66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:240:	SourceStr				60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:254:	SetupProxy				91.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:279:	AuthType				66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:297:	LoadContextsFromFile			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:312:	LoadContextsFromBase64String		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:324:	LoadContextsFromMultipleFiles		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:347:	loadContextsFromData			85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:381:	UnmarshalKubeconfig			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:393:	GetContextsFromKubeconfig		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:409:	ProcessContext				90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:458:	extractContextInfo			71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:476:	extractClusterAndUserNames		83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:493:	getClusterAndUser			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:514:	createAndValidateConfig			90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:546:	getNameOrUnknown			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:557:	HandleConfigLoadError			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:598:	checkBase64Errors			90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:621:	checkUserBase64Fields			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:641:	checkClusterBase64Fields		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:657:	toStringKeyMap				83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:673:	getCluster				87.5%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:691:	getUser					80.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:712:	createKubeConfig			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:735:	convertToContext			85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:776:	LoadContextsFromAPIConfig		76.5%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:815:	splitKubeConfigPath			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:825:	GetInClusterContext			0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:872:	LoadAndStoreKubeConfigs			83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:897:	makeDNSFriendly				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/watcher.go:17:		LoadAndWatchFiles			58.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/watcher.go:69:		addFilesToWatcher			64.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/watcher.go:111:		syncContexts				77.3%
github.com/headlamp-k8s/headlamp/backend/pkg/logger/logger.go:29:		Log					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/logger/logger.go:36:		log					75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/logger/logger.go:80:		SetLogFunc				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:30:		Watch					77.8%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:51:		periodicallyWatchSubfolders		75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:84:		generateSeparatePluginPaths		90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:105:		GeneratePluginPaths			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:120:		ListPlugins				68.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:173:		pluginBasePathListForDir		77.3%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:219:		canSendRefresh				77.8%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:240:		HandlePluginEvents			70.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:266:		PopulatePluginsCache			66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:292:		HandlePluginReload			80.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:328:		Delete					85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:343:		isSubdirectory				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:46:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:80:		getFreePort				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:99:		StartPortForward			50.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:173:	startPortForward			61.4%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:269:	checkIfPodIsRunning			71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:291:	Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:304:	StopOrDeletePortForward			47.1%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:336:	GetPortForwards				45.5%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:358:	GetPortForwardByID			45.5%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:16:		portforwardKeyGenerator			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:33:		portforwardstore			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:46:		stopOrDeletePortForward			69.2%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:74:		getPortForwardList			77.8%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:94:		getPortForwardByID			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/utils/utils.go:4:			Contains				100.0%
total:										(statements)				64.0%

Html coverage report download

@vyncent-t vyncent-t force-pushed the keep-original-name-kubeconfig branch from 24f7a6b to 7c1a4aa Compare January 22, 2025 19:32
Copy link

Backend Code coverage changed from 64.8% to 64.9%. Change: .1% 😃.

Coverage report
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:92:			ServeHTTP				58.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:141:			fileExists				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:151:			copyReplace				63.6%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:175:			baseURLReplace				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:203:			getOidcCallbackURL			91.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:230:			serveWithNoCacheHeader			33.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:239:			defaultKubeConfigPersistenceDir		61.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:267:			defaultKubeConfigPersistenceFile	75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:280:			addPluginRoutes				50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:334:			createHeadlampHandler			40.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:701:			parseClusterAndToken			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:718:			decodePayload				71.4%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:732:			getExpiryTime				75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:741:			isTokenAboutToExpire			61.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:765:			refreshAndCacheNewToken			0.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:835:			OIDCTokenRefreshMiddleware		30.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:886:			StartHeadlampServer			66.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:900:			getHelmHandler				53.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:928:			checkHeadlampBackendToken		100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:941:			handleClusterHelm			33.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1020:			handleClusterAPI			51.6%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1076:			handleClusterRequests			66.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1084:			getClusters				76.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1134:			handleHeadlampInfo			64.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1173:			parseCustomNameClusters			38.1%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1227:			parseClusterFromKubeConfig		83.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1261:			getConfig				75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1272:			addCluster				57.9%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1307:			decodeClusterRequest			71.4%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1322:			processClusterRequest			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1331:			processKubeConfig			83.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1348:			processManualConfig			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1368:			handleLoadErrors			66.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1383:			writeKubeConfig				70.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1403:			addContextsToStore			80.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1415:			deleteCluster				0.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1464:			getKubeConfigPath			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1473:			handleStatelessClusterRename		50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1490:			originalNameToExtensions		39.1%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1548:			customNameToExtenstions			26.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1595:			updateCustomContextToCache		50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1628:			getPathAndLoadKubeconfig		77.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1662:			keepOriginalClusterName			81.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1691:			renameCluster				53.1%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1754:			addClusterSetupRoute			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1782:			handleNodeDrain				45.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1847:			drainNode				37.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1897:			handleNodeDrainStatus			52.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:120:		NewWSConnLock				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:129:		WriteJSON				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:139:		ReadJSON				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:146:		ReadMessage				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:152:		WriteMessage				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:162:		Close					100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:170:		NewMultiplexer				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:183:		updateStatus				76.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:243:		establishClusterConnection		81.8%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:289:		getClusterConfigWithFallback		100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:306:		createConnection			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:328:		dialWebSocket				87.5%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:356:		monitorConnection			54.5%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:381:		reconnect				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:411:		HandleClientWebSocket			72.7%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:454:		readClientMessage			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:475:		getOrCreateConnection			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:504:		handleConnectionError			75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:526:		writeMessageToCluster			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:544:		handleClusterMessages			85.7%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:562:		processClusterMessage			75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:605:		sendIfNewResourceVersion		75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:648:		sendCompleteMessage			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:679:		sendDataMessage				88.9%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:702:		cleanupConnection			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:719:		createWrapperMessage			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:739:		cleanupConnections			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:756:		getClusterConfig			85.7%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:771:		CloseConnection				81.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:812:		createConnectionKey			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:817:		createWebSocketURL			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/server.go:14:			main					0.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:17:			MarshalCustomObject			60.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:42:			setKeyInCache				50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:71:			handleStatelessReq			51.5%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:143:			parseKubeConfig				75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:182:			websocketConnContextKey			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:232:			getContextKeyForRequest			76.9%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:40:			New					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:52:			Set					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:57:			SetWithTTL				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:75:			Delete					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:85:			Get					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:102:		GetAll					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:122:		cleanUp					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:140:		UpdateTTL				88.9%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:40:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:62:		Parse					74.4%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:149:		flagset					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:174:		defaultPluginDir			61.5%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:207:		GetDefaultKubeConfigPath		66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:74:			init					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:89:			newCache				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:93:			cacheKey				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:109:			get					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:118:			put					85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:143:			Do					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:168:			GetAuthenticator			0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:172:			newAuthenticator			86.7%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:224:			isInteractive				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:300:			UpdateTransportConfig			64.3%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:341:			WrappedRoundTripper			0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:345:			RoundTrip				71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:371:			credsExpired				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:378:			cert					75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:386:			getCreds				85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:403:			maybeRefreshCreds			80.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:419:			refreshCredsLocked			92.5%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:531:			wrapCmdRunErrorLocked			90.9%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/syscallattr_other.go:9:	GetSysProcAttr				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/charts.go:27:			listCharts				89.5%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/charts.go:77:			ListCharts				72.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:35:		NewActionConfig				87.5%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:54:		NewHandler				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:60:		NewHandlerWithSettings			60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:85:		ToRESTConfig				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:89:		ToRawKubeConfigLoader			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:93:		ToDiscoveryClient			83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:109:		ToRESTMapper				71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:129:		getReleaseStatus			0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:165:		setReleaseStatus			60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:188:		setReleaseStatusSilent			66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:53:		getReleases				57.1%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:112:		ListRelease				68.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:158:		GetRelease				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:217:		GetReleaseHistory			46.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:277:		UninstallRelease			55.6%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:334:		uninstallRelease			71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:357:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:362:		RollbackRelease				51.6%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:421:		rollbackRelease				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:453:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:458:		handleError				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:463:		returnResponse				71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:479:		InstallRelease				72.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:513:		getChart				35.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:565:		installRelease				60.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:625:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:630:		UpgradeRelease				60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:666:		logActionState				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:687:		upgradeRelease				63.6%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:731:		Validate				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:749:		GetActionStatus				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:35:		createFileIfNotThere			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:47:		lockRepositoryFile			87.5%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:68:		addRepository				61.8%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:131:		AddRepo					72.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:176:		createFullPath				66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:184:		listRepositories			69.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:213:		ListRepo				58.3%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:236:		RemoveRepository			64.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:279:		RemoveRepo				66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:291:		UpdateRepository			68.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:333:		UpdateRepository			81.8%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:26:	NewContextStore				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:35:	AddContext				76.9%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:64:	GetContexts				85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:80:	GetContext				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:90:	RemoveContext				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:95:	AddContextWithKeyAndTTL			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:100:	UpdateTTL				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/file.go:14:		WriteToFile				86.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/file.go:48:		RemoveContextFromFile			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:71:	DeepCopyObject				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:76:	DeepCopy				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:96:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:107:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:118:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:129:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:142:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:154:	ClientConfig				80.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:188:	RESTConfig				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:199:	makeTransportFor			14.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:243:	OidcConfig				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:261:	ProxyRequest				83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:275:	ClientSetWithToken			66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:289:	SourceStr				60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:303:	SetupProxy				91.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:328:	AuthType				66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:346:	LoadContextsFromFile			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:361:	LoadContextsFromBase64String		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:373:	LoadContextsFromMultipleFiles		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:396:	loadContextsFromData			85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:430:	UnmarshalKubeconfig			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:442:	GetContextsFromKubeconfig		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:458:	ProcessContext				90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:507:	extractContextInfo			71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:525:	extractClusterAndUserNames		83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:542:	getClusterAndUser			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:563:	createAndValidateConfig			90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:595:	getNameOrUnknown			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:606:	HandleConfigLoadError			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:647:	checkBase64Errors			90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:670:	checkUserBase64Fields			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:690:	checkClusterBase64Fields		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:706:	toStringKeyMap				83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:722:	getCluster				87.5%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:740:	getUser					80.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:761:	createKubeConfig			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:784:	convertToContext			85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:825:	LoadContextsFromAPIConfig		76.5%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:864:	splitKubeConfigPath			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:874:	GetInClusterContext			0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:921:	LoadAndStoreKubeConfigs			83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:946:	makeDNSFriendly				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/watcher.go:17:		LoadAndWatchFiles			58.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/watcher.go:69:		addFilesToWatcher			64.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/watcher.go:111:		syncContexts				77.3%
github.com/headlamp-k8s/headlamp/backend/pkg/logger/logger.go:29:		Log					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/logger/logger.go:36:		log					75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/logger/logger.go:80:		SetLogFunc				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:30:		Watch					77.8%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:51:		periodicallyWatchSubfolders		75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:84:		generateSeparatePluginPaths		90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:105:		GeneratePluginPaths			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:120:		ListPlugins				68.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:173:		pluginBasePathListForDir		77.3%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:219:		canSendRefresh				77.8%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:240:		HandlePluginEvents			70.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:266:		PopulatePluginsCache			66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:292:		HandlePluginReload			80.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:328:		Delete					85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:343:		isSubdirectory				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:46:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:80:		getFreePort				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:99:		StartPortForward			50.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:173:	startPortForward			61.4%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:269:	checkIfPodIsRunning			71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:291:	Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:304:	StopOrDeletePortForward			47.1%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:336:	GetPortForwards				45.5%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:358:	GetPortForwardByID			45.5%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:16:		portforwardKeyGenerator			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:33:		portforwardstore			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:46:		stopOrDeletePortForward			69.2%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:74:		getPortForwardList			77.8%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:94:		getPortForwardByID			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/utils/utils.go:4:			Contains				100.0%
total:										(statements)				64.9%

Html coverage report download

@vyncent-t vyncent-t force-pushed the keep-original-name-kubeconfig branch from 7c1a4aa to 8724036 Compare January 22, 2025 19:37
@vyncent-t
Copy link
Contributor Author

@knrt10 made some changes from what you suggested and also added a test, I am using a mock env approach that seems to work when its ran at the end of the test, still new to tests so let me know what you think! I was also thinking of maybe using the format that you have for the TestRenameCluster if what I have here isn't the best way

Copy link

Backend Code coverage changed from 64.7% to 64.9%. Change: .2% 😃.

Coverage report
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:92:			ServeHTTP				58.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:141:			fileExists				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:151:			copyReplace				63.6%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:175:			baseURLReplace				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:203:			getOidcCallbackURL			91.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:230:			serveWithNoCacheHeader			33.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:239:			defaultKubeConfigPersistenceDir		61.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:267:			defaultKubeConfigPersistenceFile	75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:280:			addPluginRoutes				50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:334:			createHeadlampHandler			40.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:701:			parseClusterAndToken			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:718:			decodePayload				71.4%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:732:			getExpiryTime				75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:741:			isTokenAboutToExpire			61.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:765:			refreshAndCacheNewToken			0.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:835:			OIDCTokenRefreshMiddleware		30.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:886:			StartHeadlampServer			66.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:900:			getHelmHandler				53.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:928:			checkHeadlampBackendToken		100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:941:			handleClusterHelm			33.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1020:			handleClusterAPI			51.6%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1076:			handleClusterRequests			66.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1084:			getClusters				76.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1134:			handleHeadlampInfo			64.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1173:			parseCustomNameClusters			38.1%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1227:			parseClusterFromKubeConfig		83.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1261:			getConfig				75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1272:			addCluster				57.9%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1307:			decodeClusterRequest			71.4%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1322:			processClusterRequest			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1331:			processKubeConfig			83.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1348:			processManualConfig			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1368:			handleLoadErrors			66.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1383:			writeKubeConfig				70.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1403:			addContextsToStore			80.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1415:			deleteCluster				0.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1464:			getKubeConfigPath			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1473:			handleStatelessClusterRename		50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1490:			originalNameToExtensions		39.1%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1548:			customNameToExtenstions			26.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1595:			updateCustomContextToCache		50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1628:			getPathAndLoadKubeconfig		77.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1662:			keepOriginalClusterName			81.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1691:			renameCluster				53.1%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1754:			addClusterSetupRoute			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1782:			handleNodeDrain				45.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1847:			drainNode				37.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1897:			handleNodeDrainStatus			52.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:120:		NewWSConnLock				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:129:		WriteJSON				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:139:		ReadJSON				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:146:		ReadMessage				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:152:		WriteMessage				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:162:		Close					100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:170:		NewMultiplexer				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:183:		updateStatus				76.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:243:		establishClusterConnection		81.8%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:289:		getClusterConfigWithFallback		100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:306:		createConnection			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:328:		dialWebSocket				87.5%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:356:		monitorConnection			54.5%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:381:		reconnect				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:411:		HandleClientWebSocket			72.7%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:454:		readClientMessage			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:475:		getOrCreateConnection			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:504:		handleConnectionError			75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:526:		writeMessageToCluster			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:544:		handleClusterMessages			85.7%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:562:		processClusterMessage			75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:605:		sendIfNewResourceVersion		75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:648:		sendCompleteMessage			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:679:		sendDataMessage				88.9%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:702:		cleanupConnection			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:719:		createWrapperMessage			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:739:		cleanupConnections			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:756:		getClusterConfig			85.7%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:771:		CloseConnection				81.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:812:		createConnectionKey			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:817:		createWebSocketURL			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/server.go:14:			main					0.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:17:			MarshalCustomObject			60.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:42:			setKeyInCache				50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:71:			handleStatelessReq			51.5%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:143:			parseKubeConfig				75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:182:			websocketConnContextKey			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:232:			getContextKeyForRequest			76.9%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:40:			New					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:52:			Set					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:57:			SetWithTTL				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:75:			Delete					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:85:			Get					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:102:		GetAll					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:122:		cleanUp					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:140:		UpdateTTL				88.9%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:40:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:62:		Parse					74.4%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:149:		flagset					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:174:		defaultPluginDir			61.5%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:207:		GetDefaultKubeConfigPath		66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:74:			init					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:89:			newCache				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:93:			cacheKey				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:109:			get					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:118:			put					85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:143:			Do					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:168:			GetAuthenticator			0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:172:			newAuthenticator			86.7%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:224:			isInteractive				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:300:			UpdateTransportConfig			64.3%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:341:			WrappedRoundTripper			0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:345:			RoundTrip				71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:371:			credsExpired				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:378:			cert					75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:386:			getCreds				85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:403:			maybeRefreshCreds			80.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:419:			refreshCredsLocked			92.5%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:531:			wrapCmdRunErrorLocked			90.9%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/syscallattr_other.go:9:	GetSysProcAttr				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/charts.go:27:			listCharts				89.5%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/charts.go:77:			ListCharts				72.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:35:		NewActionConfig				87.5%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:54:		NewHandler				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:60:		NewHandlerWithSettings			60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:85:		ToRESTConfig				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:89:		ToRawKubeConfigLoader			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:93:		ToDiscoveryClient			83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:109:		ToRESTMapper				71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:129:		getReleaseStatus			0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:165:		setReleaseStatus			60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:188:		setReleaseStatusSilent			66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:53:		getReleases				57.1%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:112:		ListRelease				68.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:158:		GetRelease				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:217:		GetReleaseHistory			46.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:277:		UninstallRelease			55.6%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:334:		uninstallRelease			71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:357:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:362:		RollbackRelease				51.6%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:421:		rollbackRelease				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:453:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:458:		handleError				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:463:		returnResponse				71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:479:		InstallRelease				72.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:513:		getChart				35.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:565:		installRelease				60.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:625:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:630:		UpgradeRelease				60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:666:		logActionState				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:687:		upgradeRelease				63.6%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:731:		Validate				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:749:		GetActionStatus				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:35:		createFileIfNotThere			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:47:		lockRepositoryFile			87.5%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:68:		addRepository				61.8%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:131:		AddRepo					72.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:176:		createFullPath				66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:184:		listRepositories			69.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:213:		ListRepo				58.3%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:236:		RemoveRepository			64.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:279:		RemoveRepo				66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:291:		UpdateRepository			68.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:333:		UpdateRepository			81.8%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:26:	NewContextStore				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:35:	AddContext				76.9%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:64:	GetContexts				85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:80:	GetContext				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:90:	RemoveContext				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:95:	AddContextWithKeyAndTTL			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:100:	UpdateTTL				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/file.go:14:		WriteToFile				86.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/file.go:48:		RemoveContextFromFile			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:71:	DeepCopyObject				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:76:	DeepCopy				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:96:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:107:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:118:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:129:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:142:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:154:	ClientConfig				80.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:188:	RESTConfig				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:199:	makeTransportFor			14.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:243:	OidcConfig				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:261:	ProxyRequest				83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:275:	ClientSetWithToken			66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:289:	SourceStr				60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:303:	SetupProxy				91.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:328:	AuthType				66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:346:	LoadContextsFromFile			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:361:	LoadContextsFromBase64String		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:373:	LoadContextsFromMultipleFiles		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:396:	loadContextsFromData			85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:430:	UnmarshalKubeconfig			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:442:	GetContextsFromKubeconfig		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:458:	ProcessContext				90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:507:	extractContextInfo			71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:525:	extractClusterAndUserNames		83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:542:	getClusterAndUser			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:563:	createAndValidateConfig			90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:595:	getNameOrUnknown			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:606:	HandleConfigLoadError			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:647:	checkBase64Errors			90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:670:	checkUserBase64Fields			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:690:	checkClusterBase64Fields		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:706:	toStringKeyMap				83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:722:	getCluster				87.5%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:740:	getUser					80.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:761:	createKubeConfig			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:784:	convertToContext			85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:825:	LoadContextsFromAPIConfig		76.5%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:864:	splitKubeConfigPath			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:874:	GetInClusterContext			0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:921:	LoadAndStoreKubeConfigs			83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:946:	makeDNSFriendly				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/watcher.go:17:		LoadAndWatchFiles			58.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/watcher.go:69:		addFilesToWatcher			64.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/watcher.go:111:		syncContexts				77.3%
github.com/headlamp-k8s/headlamp/backend/pkg/logger/logger.go:29:		Log					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/logger/logger.go:36:		log					75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/logger/logger.go:80:		SetLogFunc				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:30:		Watch					77.8%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:51:		periodicallyWatchSubfolders		75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:84:		generateSeparatePluginPaths		90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:105:		GeneratePluginPaths			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:120:		ListPlugins				68.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:173:		pluginBasePathListForDir		77.3%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:219:		canSendRefresh				77.8%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:240:		HandlePluginEvents			70.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:266:		PopulatePluginsCache			66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:292:		HandlePluginReload			80.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:328:		Delete					85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:343:		isSubdirectory				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:46:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:80:		getFreePort				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:99:		StartPortForward			50.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:173:	startPortForward			61.4%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:269:	checkIfPodIsRunning			71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:291:	Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:304:	StopOrDeletePortForward			47.1%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:336:	GetPortForwards				45.5%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:358:	GetPortForwardByID			45.5%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:16:		portforwardKeyGenerator			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:33:		portforwardstore			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:46:		stopOrDeletePortForward			69.2%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:74:		getPortForwardList			77.8%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:94:		getPortForwardByID			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/utils/utils.go:4:			Contains				100.0%
total:										(statements)				64.9%

Html coverage report download

Copy link
Contributor

@knrt10 knrt10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes, added some suggestions

backend/cmd/headlamp.go Outdated Show resolved Hide resolved
backend/cmd/headlamp.go Outdated Show resolved Hide resolved
}

// this handles the clusters that have been renamed before the headlamp_info was introduced with original name
if headlampInfo != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, this is not removed. Can you please remove it?

backend/cmd/headlamp.go Outdated Show resolved Hide resolved
backend/cmd/headlamp.go Outdated Show resolved Hide resolved
@@ -56,9 +57,14 @@ type OidcConfig struct {

// CustomObject represents the custom object that holds the HeadlampInfo regarding custom name.
type CustomObject struct {
// ???
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?? hehe, nice comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! I forgot about these, I meant to ask if you could provide context here on what these params are/do?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// ???
type CustomObject struct {
// TypeMeta describes the type of the object and its API schema version.
// It should have "Kind" set to "HeadlampInfo" and "APIVersion" set to "v1".
// +k8s:deepcopy-gen=false
metav1.TypeMeta
// ObjectMeta contains metadata about the custom object, such as name and labels.
// This is used to store additional metadata about the headlamp_info extension.
// +optional

@@ -1025,3 +1028,58 @@ func TestHandleClusterHelm(t *testing.T) {
})
}
}

// test for handleHeadlampInfo, currently checks for headlamp_info field and headlamp_info.originalName field.
func (c *HeadlampConfig) TestHandleHeadlampInfo(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function should call the existing function to check the functionality. This is the reason the test coverage does not increase. Can you please rewrite this? Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test requires a bit of set up for it to work, mainly creating a temp mock env and then creating mock data within that env

I then convert the mock data from a api.Config structure into a kubeconfig.Context structure since that what handleHeadlampInfo test requires

I think this is necessary due to the placement/use of handleHeadlampInfo being within the getClusters function which I have mocked its functionality here (see the code leading up to handleHeadlampInfo at the top of getClusters)

I call the handleHeadlampInfo function, have it change the mock data, then check if the mock data has the headlamp_info fields and if the originalName is populated within headlamp_info

I will tag you where it's called

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test function declaration is not correct. In Go, test functions should not be methods on a type. They should be standalone functions in the test file.

Suggested change
func (c *HeadlampConfig) TestHandleHeadlampInfo(t *testing.T) {
func TestHandleHeadlampInfo(t *testing.T) {
// Create config instance for testing
config := &HeadlampConfig{
// initialize necessary fields for testing
}
// Rest of the test code using 'config' instead of 'c'
...
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently it is lacking 3 main things

  • Test Cases Organization: The test lacks clear separation of test cases. It should test different scenarios:
tests := []struct {
        name           string
        configFile     string
        expectedError  bool
        validateFunc   func(*testing.T, *kubeconfig.Context)
    }{
        {
            name:       "new headlamp_info creation",
            configFile: "kubeconfig_headlampinfo_empty",
            validateFunc: func(t *testing.T, ctx *kubeconfig.Context) {
                info := ctx.KubeContext.Extensions["headlamp_info"]
                require.NotNil(t, info, "headlamp_info should be created")
                customObj, err := ParseHeadlampInfo(info)
                require.NoError(t, err)
                assert.Equal(t, ctx.Name, customObj.OriginalName)
            },
        },
        {
            name:       "update legacy headlamp_info",
            configFile: "kubeconfig_headlampinfo_legacy",
            validateFunc: func(t *testing.T, ctx *kubeconfig.Context) {
                info := ctx.KubeContext.Extensions["headlamp_info"]
                require.NotNil(t, info, "headlamp_info should exist")
                customObj, err := ParseHeadlampInfo(info)
                require.NoError(t, err)
                assert.NotEmpty(t, customObj.OriginalName, "originalName should be set")
                assert.NotEmpty(t, customObj.CustomName, "customName should be preserved")
            },
        },
    }
  • Type Safety Improvements: Instead of using type assertion for map[string]interface{}, use the CustomObject type:
  • Helper Functions: Extract common setup code. Just sample name are below
func TestHandleHeadlampInfo(t *testing.T) {
    // IMPROVEMENT: Consider creating a newTestConfig() helper function instead
    // of inline configuration for better reusability across tests
    config := &HeadlampConfig{
        kubeConfigStore: kubeconfig.NewContextStore(),
    }

    // IMPROVEMENT: Add more fields to the test struct:
    // - description string: for detailed test documentation
    // - setupFunc: for test-specific setup if needed
    tests := []struct {
        name          string
        configFile    string
        expectedError bool
        validateFunc  func(*testing.T, *kubeconfig.Context)
    }{
        // MISSING TEST CASES:
        // 1. Empty headlamp_info
        // 2. Existing valid headlamp_info
        // 3. Invalid/malformed headlamp_info
        // 4. Missing required fields
    }

    for _, tt := range tests {
        t.Run(tt.name, func(t *testing.T) {
            // GOOD: Setup is separated into helper functions
            // SUGGESTION: Add cleanup in defer if needed
            mockConfigFile, config := setupTestKubeconfig(t, tt.configFile)
            contexts := contextFromConfig(config)

            // IMPROVEMENT: Consider combining Execute and Validate loops
            // to reduce iterations over contexts
            for _, ctx := range contexts {
                // MAIN TEST: This is where handleHeadlampInfo is called
                // It tests:
                // 1. Creation of new headlamp_info for empty extensions
                // 2. Update of existing headlamp_info for legacy contexts
                // 3. Error handling for invalid configurations
                err := config.handleHeadlampInfo(ctx)
                
                // ERROR CHECK: Verify expected error behavior
                // If expectedError is true, we should get an error
                // If false, we should not get an error
                if tt.expectedError {
                    require.Error(t, err)
                    return
                }
                require.NoError(t, err)

                // VALIDATION: Run the test-case specific validation
                // This checks the actual content and structure
                // of the headlamp_info extension
                tt.validateFunc(t, ctx)
            }
            
            // IMPROVEMENT: Add timeout context for long-running tests

            // PERSISTENCE CHECK: Verify changes were actually saved
            // SUGGESTION: Add more specific checks for the content
            // of headlamp_info, not just its presence
            persistedConfig, err := clientcmd.LoadFromFile(mockConfigFile)
            require.NoError(t, err)
            
            // FINAL VALIDATION: Ensure changes persisted to disk
            // Verify each context has the expected headlamp_info
            for name, ctx := range persistedConfig.Contexts {
                info := ctx.Extensions["headlamp_info"]
                require.NotNil(t, info, "headlamp_info should be persisted for context %s", name)
            }
        })
    }
}

backend/cmd/headlamp.go Show resolved Hide resolved
// use the kubeContexts slice for further processing
for _, ctx := range kubeContexts {
// Call handleHeadlampInfo
err = c.handleHeadlampInfo(ctx)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@knrt10 I call the func here but for it to be ran I first have to create a mock env and then take the test data and turn it into kubeconfig.Context since I can't use config directly (its type is api.Config and the handleHeadlampInfo takes kubeconfig.Context)

In the two for loops under it I check if the headlamp_info field exists on all the contexts and I also check if all the originalName field exists within headlamp_info in each context with another loop

@vyncent-t vyncent-t force-pushed the keep-original-name-kubeconfig branch from 8724036 to 5b62830 Compare January 24, 2025 17:00
Copy link

Backend Code coverage changed from 64.7% to 64.9%. Change: .2% 😃.

Coverage report
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:92:			ServeHTTP				58.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:141:			fileExists				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:151:			copyReplace				63.6%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:175:			baseURLReplace				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:203:			getOidcCallbackURL			91.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:230:			serveWithNoCacheHeader			33.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:239:			defaultKubeConfigPersistenceDir		61.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:267:			defaultKubeConfigPersistenceFile	75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:280:			addPluginRoutes				50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:334:			createHeadlampHandler			40.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:701:			parseClusterAndToken			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:718:			decodePayload				71.4%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:732:			getExpiryTime				75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:741:			isTokenAboutToExpire			61.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:765:			refreshAndCacheNewToken			0.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:835:			OIDCTokenRefreshMiddleware		30.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:886:			StartHeadlampServer			66.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:900:			getHelmHandler				53.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:928:			checkHeadlampBackendToken		100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:941:			handleClusterHelm			33.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1020:			handleClusterAPI			51.6%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1076:			handleClusterRequests			66.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1084:			getClusters				75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1133:			handleHeadlampInfo			64.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1171:			parseCustomNameClusters			38.1%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1225:			parseClusterFromKubeConfig		83.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1259:			getConfig				75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1270:			addCluster				57.9%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1305:			decodeClusterRequest			71.4%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1320:			processClusterRequest			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1329:			processKubeConfig			83.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1346:			processManualConfig			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1366:			handleLoadErrors			66.7%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1381:			writeKubeConfig				70.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1401:			addContextsToStore			80.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1413:			deleteCluster				0.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1462:			getKubeConfigPath			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1471:			handleStatelessClusterRename		50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1487:			nameToExtensions			39.1%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1545:			customNameToExtenstions			26.3%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1592:			updateCustomContextToCache		50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1625:			getPathAndLoadKubeconfig		77.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1659:			keepOriginalClusterName			81.8%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1688:			renameCluster				53.1%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1751:			addClusterSetupRoute			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1779:			handleNodeDrain				45.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1844:			drainNode				37.5%
github.com/headlamp-k8s/headlamp/backend/cmd/headlamp.go:1894:			handleNodeDrainStatus			52.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:120:		NewWSConnLock				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:129:		WriteJSON				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:139:		ReadJSON				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:146:		ReadMessage				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:152:		WriteMessage				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:162:		Close					100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:170:		NewMultiplexer				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:183:		updateStatus				76.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:243:		establishClusterConnection		81.8%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:289:		getClusterConfigWithFallback		100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:306:		createConnection			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:328:		dialWebSocket				87.5%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:356:		monitorConnection			54.5%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:381:		reconnect				100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:411:		HandleClientWebSocket			72.7%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:454:		readClientMessage			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:475:		getOrCreateConnection			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:504:		handleConnectionError			75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:526:		writeMessageToCluster			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:544:		handleClusterMessages			85.7%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:562:		processClusterMessage			75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:605:		sendIfNewResourceVersion		75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:648:		sendCompleteMessage			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:679:		sendDataMessage				88.9%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:702:		cleanupConnection			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:719:		createWrapperMessage			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:739:		cleanupConnections			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:756:		getClusterConfig			85.7%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:771:		CloseConnection				81.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:812:		createConnectionKey			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/multiplexer.go:817:		createWebSocketURL			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/server.go:14:			main					0.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:17:			MarshalCustomObject			60.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:42:			setKeyInCache				50.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:71:			handleStatelessReq			51.5%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:143:			parseKubeConfig				75.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:182:			websocketConnContextKey			100.0%
github.com/headlamp-k8s/headlamp/backend/cmd/stateless.go:232:			getContextKeyForRequest			76.9%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:40:			New					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:52:			Set					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:57:			SetWithTTL				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:75:			Delete					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:85:			Get					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:102:		GetAll					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:122:		cleanUp					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/cache/cache.go:140:		UpdateTTL				88.9%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:40:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:62:		Parse					74.4%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:149:		flagset					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:174:		defaultPluginDir			61.5%
github.com/headlamp-k8s/headlamp/backend/pkg/config/config.go:207:		GetDefaultKubeConfigPath		66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:74:			init					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:89:			newCache				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:93:			cacheKey				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:109:			get					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:118:			put					85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:143:			Do					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:168:			GetAuthenticator			0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:172:			newAuthenticator			86.7%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:224:			isInteractive				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:300:			UpdateTransportConfig			64.3%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:341:			WrappedRoundTripper			0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:345:			RoundTrip				71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:371:			credsExpired				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:378:			cert					75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:386:			getCreds				85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:403:			maybeRefreshCreds			80.0%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:419:			refreshCredsLocked			92.5%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/exec.go:531:			wrapCmdRunErrorLocked			90.9%
github.com/headlamp-k8s/headlamp/backend/pkg/exec/syscallattr_other.go:9:	GetSysProcAttr				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/charts.go:27:			listCharts				89.5%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/charts.go:77:			ListCharts				72.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:35:		NewActionConfig				87.5%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:54:		NewHandler				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:60:		NewHandlerWithSettings			60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:85:		ToRESTConfig				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:89:		ToRawKubeConfigLoader			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:93:		ToDiscoveryClient			83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:109:		ToRESTMapper				71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:129:		getReleaseStatus			0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:165:		setReleaseStatus			60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/handler.go:188:		setReleaseStatusSilent			66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:53:		getReleases				57.1%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:112:		ListRelease				68.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:158:		GetRelease				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:217:		GetReleaseHistory			46.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:277:		UninstallRelease			55.6%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:334:		uninstallRelease			71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:357:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:362:		RollbackRelease				51.6%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:421:		rollbackRelease				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:453:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:458:		handleError				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:463:		returnResponse				71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:479:		InstallRelease				72.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:513:		getChart				35.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:565:		installRelease				60.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:625:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:630:		UpgradeRelease				60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:666:		logActionState				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:687:		upgradeRelease				63.6%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:731:		Validate				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/release.go:749:		GetActionStatus				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:35:		createFileIfNotThere			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:47:		lockRepositoryFile			87.5%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:68:		addRepository				61.8%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:131:		AddRepo					72.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:176:		createFullPath				66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:184:		listRepositories			69.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:213:		ListRepo				58.3%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:236:		RemoveRepository			64.0%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:279:		RemoveRepo				66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:291:		UpdateRepository			68.2%
github.com/headlamp-k8s/headlamp/backend/pkg/helm/repository.go:333:		UpdateRepository			81.8%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:26:	NewContextStore				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:35:	AddContext				76.9%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:64:	GetContexts				85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:80:	GetContext				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:90:	RemoveContext				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:95:	AddContextWithKeyAndTTL			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/contextStore.go:100:	UpdateTTL				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/file.go:14:		WriteToFile				86.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/file.go:48:		RemoveContextFromFile			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:71:	DeepCopyObject				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:76:	DeepCopy				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:96:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:107:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:118:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:129:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:142:	Error					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:154:	ClientConfig				80.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:188:	RESTConfig				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:199:	makeTransportFor			14.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:243:	OidcConfig				0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:261:	ProxyRequest				83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:275:	ClientSetWithToken			66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:289:	SourceStr				60.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:303:	SetupProxy				91.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:328:	AuthType				66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:346:	LoadContextsFromFile			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:361:	LoadContextsFromBase64String		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:373:	LoadContextsFromMultipleFiles		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:396:	loadContextsFromData			85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:430:	UnmarshalKubeconfig			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:442:	GetContextsFromKubeconfig		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:458:	ProcessContext				90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:507:	extractContextInfo			71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:525:	extractClusterAndUserNames		83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:542:	getClusterAndUser			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:563:	createAndValidateConfig			90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:595:	getNameOrUnknown			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:606:	HandleConfigLoadError			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:647:	checkBase64Errors			90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:670:	checkUserBase64Fields			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:690:	checkClusterBase64Fields		100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:706:	toStringKeyMap				83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:722:	getCluster				87.5%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:740:	getUser					80.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:761:	createKubeConfig			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:784:	convertToContext			85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:825:	LoadContextsFromAPIConfig		76.5%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:864:	splitKubeConfigPath			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:874:	GetInClusterContext			0.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:921:	LoadAndStoreKubeConfigs			83.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/kubeconfig.go:946:	makeDNSFriendly				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/watcher.go:17:		LoadAndWatchFiles			58.3%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/watcher.go:69:		addFilesToWatcher			64.7%
github.com/headlamp-k8s/headlamp/backend/pkg/kubeconfig/watcher.go:111:		syncContexts				77.3%
github.com/headlamp-k8s/headlamp/backend/pkg/logger/logger.go:29:		Log					100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/logger/logger.go:36:		log					75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/logger/logger.go:80:		SetLogFunc				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:30:		Watch					77.8%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:51:		periodicallyWatchSubfolders		75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:84:		generateSeparatePluginPaths		90.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:105:		GeneratePluginPaths			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:120:		ListPlugins				68.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:173:		pluginBasePathListForDir		77.3%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:219:		canSendRefresh				77.8%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:240:		HandlePluginEvents			70.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:266:		PopulatePluginsCache			66.7%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:292:		HandlePluginReload			80.0%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:328:		Delete					85.7%
github.com/headlamp-k8s/headlamp/backend/pkg/plugins/plugins.go:343:		isSubdirectory				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:46:		Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:80:		getFreePort				75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:99:		StartPortForward			50.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:173:	startPortForward			61.4%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:269:	checkIfPodIsRunning			71.4%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:291:	Validate				100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:304:	StopOrDeletePortForward			47.1%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:336:	GetPortForwards				45.5%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/handler.go:358:	GetPortForwardByID			45.5%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:16:		portforwardKeyGenerator			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:33:		portforwardstore			75.0%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:46:		stopOrDeletePortForward			69.2%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:74:		getPortForwardList			77.8%
github.com/headlamp-k8s/headlamp/backend/pkg/portforward/store.go:94:		getPortForwardByID			100.0%
github.com/headlamp-k8s/headlamp/backend/pkg/utils/utils.go:4:			Contains				100.0%
total:										(statements)				64.9%

Html coverage report download

@vyncent-t vyncent-t requested a review from illume January 29, 2025 15:07
@vyncent-t vyncent-t changed the title WIP: fix the cluster info for headlamp_info to inlcude originalName fix the cluster info for headlamp_info to inlcude originalName Jan 29, 2025
@vyncent-t vyncent-t requested a review from knrt10 January 29, 2025 20:58
Copy link
Contributor

@knrt10 knrt10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants