Skip to content

Commit

Permalink
fix: forward context in GH client (#934)
Browse files Browse the repository at this point in the history
* fix: forward context in toolchain-common pkg/client

Signed-off-by: Francesco Ilario <filario@redhat.com>

* go.mod add replace to filariow/toolchain-common fork

Signed-off-by: Francesco Ilario <filario@redhat.com>

* Remove replace rule from go.mod

Signed-off-by: Francesco Ilario <filario@redhat.com>

* fix: forward context in GH client

Signed-off-by: Francesco Ilario <filario@redhat.com>

* Add replace rule to filariow/toolchain-common

Signed-off-by: Francesco Ilario <filario@redhat.com>

* Update go.mod after merge in toolchain-common

Signed-off-by: Francesco Ilario <filario@redhat.com>

---------

Signed-off-by: Francesco Ilario <filario@redhat.com>
  • Loading branch information
filariow authored Nov 17, 2023
1 parent ad4c06f commit c46ad62
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions controllers/spacerequest/spacerequest_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ func (r *Reconciler) ensureSecretForProvisionedNamespaces(ctx context.Context, m
switch {
case len(secretList.Items) == 0:
// create the secret for this namespace
clientConfig, err := r.generateKubeConfig(subSpaceTargetCluster, namespace.Name)
clientConfig, err := r.generateKubeConfig(ctx, subSpaceTargetCluster, namespace.Name)
if err != nil {
return err
}
Expand Down Expand Up @@ -500,9 +500,9 @@ func (r *Reconciler) ensureSecretForProvisionedNamespaces(ctx context.Context, m
return nil
}

func (r *Reconciler) generateKubeConfig(subSpaceTargetCluster cluster.Cluster, namespace string) (*api.Config, error) {
func (r *Reconciler) generateKubeConfig(ctx context.Context, subSpaceTargetCluster cluster.Cluster, namespace string) (*api.Config, error) {
// create a token request for the admin service account
token, err := restclient.CreateTokenRequest(subSpaceTargetCluster.RESTClient, types.NamespacedName{
token, err := restclient.CreateTokenRequest(ctx, subSpaceTargetCluster.RESTClient, types.NamespacedName{
Namespace: namespace,
Name: toolchainv1alpha1.AdminServiceAccountName,
}, TokenRequestExpirationSeconds)
Expand Down
4 changes: 2 additions & 2 deletions controllers/toolchainstatus/toolchainstatus_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ func (r *Reconciler) hostOperatorHandleStatus(ctx context.Context, toolchainStat
}

// verify deployment version
versionCondition := r.VersionCheckManager.CheckDeployedVersionIsUpToDate(isProd, toolchainConfig.GitHubSecret().AccessTokenKey(), toolchainStatus.Status.HostOperator.RevisionCheck.Conditions, githubRepo)
versionCondition := r.VersionCheckManager.CheckDeployedVersionIsUpToDate(ctx, isProd, toolchainConfig.GitHubSecret().AccessTokenKey(), toolchainStatus.Status.HostOperator.RevisionCheck.Conditions, githubRepo)
errVersionCheck := status.ValidateComponentConditionReady(*versionCondition)
if errVersionCheck != nil {
// let's set deployment is not up-to-date reason
Expand Down Expand Up @@ -961,7 +961,7 @@ func (s *regServiceSubstatusHandler) addRegistrationServiceHealthAndRevisionChec
Branch: registrationServiceRepoBranchName,
DeployedCommitSHA: healthValues.Revision,
}
versionCondition := s.versionCheckManager.CheckDeployedVersionIsUpToDate(isProd, toolchainConfig.GitHubSecret().AccessTokenKey(), toolchainStatus.Status.RegistrationService.RevisionCheck.Conditions, githubRepo)
versionCondition := s.versionCheckManager.CheckDeployedVersionIsUpToDate(ctx, isProd, toolchainConfig.GitHubSecret().AccessTokenKey(), toolchainStatus.Status.RegistrationService.RevisionCheck.Conditions, githubRepo)
err = status.ValidateComponentConditionReady(*versionCondition)
if err != nil {
// add version is not up-to-date condition
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/codeready-toolchain/host-operator

require (
github.com/codeready-toolchain/api v0.0.0-20231107202930-b028ae440a26
github.com/codeready-toolchain/toolchain-common v0.0.0-20231113200037-9a9f915098e3
github.com/codeready-toolchain/toolchain-common v0.0.0-20231117145902-3e7430ae48bb
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/ghodss/yaml v1.0.0
github.com/go-bindata/go-bindata v3.1.2+incompatible
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoC
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI=
github.com/codeready-toolchain/api v0.0.0-20231107202930-b028ae440a26 h1:7l/9jcykzh/Qq93EnPYQYpaejPkWaaHB6BLCwTKngJE=
github.com/codeready-toolchain/api v0.0.0-20231107202930-b028ae440a26/go.mod h1:bImSKnxrpNmCmW/YEGiiZnZqJm3kAmfP5hW4YndK0hE=
github.com/codeready-toolchain/toolchain-common v0.0.0-20231113200037-9a9f915098e3 h1:sPXhmaRcT7y5rsuXFp3p0dgl6a7SixFVnZLAPRJYClU=
github.com/codeready-toolchain/toolchain-common v0.0.0-20231113200037-9a9f915098e3/go.mod h1:gyyXkpyEXoJJyHLuHBh/fckZ9XqjeP2AKlKkG/r9wpk=
github.com/codeready-toolchain/toolchain-common v0.0.0-20231117145902-3e7430ae48bb h1:TVgy4tO2oy2YwWTZXXYytY9soshylURDzmdkY6ch1+o=
github.com/codeready-toolchain/toolchain-common v0.0.0-20231117145902-3e7430ae48bb/go.mod h1:fmMAvkwt/OfANx8l/BDbuaHkjInlRJ3uYmIjjVmjd9w=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
Expand Down

0 comments on commit c46ad62

Please sign in to comment.