1
0
mirror of synced 2026-02-06 10:55:56 +00:00

[RFC-007] Flux cmd support for GitHub provider: This commit includes the following changes -

- Add flux create secret githubapp command that accepts and validates the inputs to create a github app secret with options to export the secret yaml or create the secret directly in the Kubernetes cluster

- Add tests for flux create secret githubapp command

- Add flux create source git command that accepts and validates the inputs to create a gitrepository source with for github provider with options to export the source yaml or create the github gitrepository source directly in the Kubernetes cluster.

- Add tests for flux create source git command for github provider.

Signed-off-by: Dipti Pai <diptipai89@outlook.com>
This commit is contained in:
Dipti Pai
2024-12-09 11:01:18 -08:00
parent 8bedcc46d4
commit c15eb30b0d
12 changed files with 352 additions and 3 deletions

View File

@@ -75,6 +75,12 @@ type Options struct {
VerificationCrts []VerificationCrt
TrustPolicy []byte
Address string
// GitHub App options
GitHubAppID string
GitHubAppInstallationID string
GitHubAppPrivateKey string
GitHubAppBaseURL string
}
type VerificationCrt struct {

View File

@@ -31,6 +31,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/yaml"
"github.com/fluxcd/pkg/auth/github"
"github.com/fluxcd/pkg/ssh"
"github.com/fluxcd/flux2/v2/pkg/manifestgen"
@@ -190,6 +191,22 @@ func buildSecret(keypair *ssh.KeyPair, hostKey, dockerCfg []byte, options Option
secret.StringData[TrustPolicyKey] = string(options.TrustPolicy)
}
if options.GitHubAppID != "" {
secret.StringData[github.AppIDKey] = options.GitHubAppID
}
if options.GitHubAppInstallationID != "" {
secret.StringData[github.AppInstallationIDKey] = options.GitHubAppInstallationID
}
if options.GitHubAppPrivateKey != "" {
secret.StringData[github.AppPrivateKey] = options.GitHubAppPrivateKey
}
if options.GitHubAppBaseURL != "" {
secret.StringData[github.AppBaseUrlKey] = options.GitHubAppBaseURL
}
return
}