This repository was archived by the owner on Jun 26, 2026. It is now read-only.
Repository navigation
Set KUBECONFIG GitHub secret during function creation - #18
Merged
Merged
Conversation
matejvasek
force-pushed
the
018-feat-create-secret
branch
2 times, most recently
from
April 30, 2026 14:44
d53a8f5 to
a5e431c
Compare
matejvasek
marked this pull request as ready for review
April 30, 2026 14:56
matejvasek
force-pushed
the
018-feat-create-secret
branch
from
April 30, 2026 17:03
3dafaa5 to
0afd410
Compare
Create a dedicated service account with RBAC permissions and store its kubeconfig as a GitHub Actions secret so the generated CI workflow can authenticate to the cluster and deploy functions. - Add ClusterCredentialService that creates a ServiceAccount, Role, RoleBinding, and image-builder binding, then generates a kubeconfig from a TokenRequest and cluster info - Add createSecret to SourceControlService/GithubService using libsodium sealed box encryption - Wire getKubeconfig and createSecret into the create flow, running before push so the secret is available when the workflow triggers - Handle 409 Conflict (resource already exists) for both K8s Status objects and standard HTTP error formats Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Matej Vašek <matejvasek@gmail.com>
twoGiants
force-pushed
the
018-feat-create-secret
branch
from
May 3, 2026 12:46
0afd410 to
31768a2
Compare
Created OcpClusterService with generateKubeconfig and exposed it through useClusterService. The create flow called createSecret before the repo existed, which GitHub rejects. Added createRepoWithSecret to GithubService so the repo is created first, then the secret is set before the file push triggers the workflow. Also converted all private members in GithubService and OcpClusterService to native # private fields, and updated README PAT permissions to include secret scope. Signed-off-by: Stanislav Jakuschevskij <sjakusch@redhat.com>
twoGiants
reviewed
May 4, 2026
twoGiants
reviewed
May 4, 2026
twoGiants
reviewed
May 4, 2026
Address PR review feedback and simplify TLS handling: - Extract RepoSecret type for the secret parameter - Remove duplicate createRepo, keep only createRepoWithSecret - Make createSecret private (#createSecret) - Use insecure-skip-tls-verify in kubeconfig instead of embedding the cluster CA certificate, removing the need to fetch kube-root-ca.crt configmap - Merge createSecret tests into createRepoWithSecret describe block Signed-off-by: Matej Vašek <matejvasek@gmail.com> Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Matej Vašek <matejvasek@gmail.com>
Collaborator
Author
|
PTAL @twoGiants |
Signed-off-by: Matej Vašek <matejvasek@gmail.com> Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Matej Vašek <matejvasek@gmail.com> Co-Authored-By: Claude <noreply@anthropic.com>
twoGiants
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
func-githubServiceAccount with RBAC permissions(pods, services, deployments, imagestreams, Knative serving resources)
and a
system:image-builderClusterRole binding so CI can build anddeploy functions
CA/API server info, then encrypt and store it as a GitHub Actions
KUBECONFIGsecret using libsodium sealed-box encryptionensuring the workflow has cluster credentials on its first run
objects and standard HTTP error shapes)
New files
ClusterCredentialServiceinterface +OcpClusterCredentialServiceimplementationuseClusterCredentialServicehookClusterCredentialService.test.ts(4 tests: happy path, two 409 shapes, error propagation)Changed files
GithubService--createSecret+encryptForGithub(libsodium sealed box)SourceControlServiceinterface -- addedcreateSecretFunctionCreatePage-- wired getKubeconfig + createSecret before pushSourceControlService.test.ts-- createSecret tests (encrypt + error)FunctionCreatePage.test.ts-- updated to verify ordering (secret before push)package.json/yarn.lock-- addedlibsodium-wrappers+@types/libsodium-wrappersTest plan
yarn test)yarn lint)that has
repoandadmin:repo_hookscopesKUBECONFIGsecret appears under the repo'sSettings > Secrets and variables > Actions
function to the cluster
(SA/Role/RoleBinding already exist)
🤖 Generated with Claude Code