Skip to content

Inabilility to create token for remote cluster #54

@jpraychev

Description

@jpraychev

When configuring RemoteClusterAccess to collect metrics from remote clusters using the remoteClusterConfig field of the CRD I am not able to generate token request and 401 HTTP error is being returned to the operator.

Looking at the code, the k8s client used to create the token request need to somehow authenticate to the remote cluster which I am not able to see how is done.

func queryConfigFromClusterAccessConfig(ctx context.Context, cac *v1alpha1.ClusterAccessConfig, inClient client.Client, externalScheme *runtime.Scheme) (*orchestrator.QueryConfig, error) {
	clsData, errData := getCusterDataFromSecret(ctx, cac, inClient)
	if errData != nil {
		return nil, errData
	}

	saName := cac.ServiceAccountName
	saNamespace := cac.ServiceAccountNamespace

	token, errToken := getTokenWithAPI(ctx, inClient, saName, saNamespace, clsData.audience)
	if errToken != nil {
		return nil, errToken
	}
....

The k8s client from the above snippet seems to be authenticated to the local cluster where the metrics operator resides, thus is unable to generate a temporary token to the remote cluster.

Metadata

Metadata

Assignees

Labels

area/providerAll Provider related issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions