|
|
@ -68,6 +68,7 @@ var (
|
|
|
|
ghHostname string
|
|
|
|
ghHostname string
|
|
|
|
ghPath string
|
|
|
|
ghPath string
|
|
|
|
ghTeams []string
|
|
|
|
ghTeams []string
|
|
|
|
|
|
|
|
ghDelete bool
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
const (
|
|
|
@ -84,6 +85,9 @@ func init() {
|
|
|
|
bootstrapGitHubCmd.Flags().StringVar(&ghHostname, "hostname", git.GitHubDefaultHostname, "GitHub hostname")
|
|
|
|
bootstrapGitHubCmd.Flags().StringVar(&ghHostname, "hostname", git.GitHubDefaultHostname, "GitHub hostname")
|
|
|
|
bootstrapGitHubCmd.Flags().StringVar(&ghPath, "path", "", "repository path, when specified the cluster sync will be scoped to this path")
|
|
|
|
bootstrapGitHubCmd.Flags().StringVar(&ghPath, "path", "", "repository path, when specified the cluster sync will be scoped to this path")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bootstrapGitHubCmd.Flags().BoolVar(&ghDelete, "delete", false, "delete repository (used for testing only)")
|
|
|
|
|
|
|
|
bootstrapGitHubCmd.Flags().MarkHidden("delete")
|
|
|
|
|
|
|
|
|
|
|
|
bootstrapCmd.AddCommand(bootstrapGitHubCmd)
|
|
|
|
bootstrapCmd.AddCommand(bootstrapGitHubCmd)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -107,11 +111,6 @@ func bootstrapGitHubCmdRun(cmd *cobra.Command, args []string) error {
|
|
|
|
IsPersonal: ghPersonal,
|
|
|
|
IsPersonal: ghPersonal,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
kubeClient, err := utils.kubeClient(kubeconfig)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tmpDir, err := ioutil.TempDir("", namespace)
|
|
|
|
tmpDir, err := ioutil.TempDir("", namespace)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
@ -121,6 +120,14 @@ func bootstrapGitHubCmdRun(cmd *cobra.Command, args []string) error {
|
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
|
|
|
defer cancel()
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ghDelete {
|
|
|
|
|
|
|
|
if err := provider.DeleteRepository(ctx, repository); err != nil {
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
logger.Successf("repository deleted")
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// create GitHub repository if doesn't exists
|
|
|
|
// create GitHub repository if doesn't exists
|
|
|
|
logger.Actionf("connecting to %s", ghHostname)
|
|
|
|
logger.Actionf("connecting to %s", ghHostname)
|
|
|
|
changed, err := provider.CreateRepository(ctx, repository)
|
|
|
|
changed, err := provider.CreateRepository(ctx, repository)
|
|
|
@ -173,6 +180,11 @@ func bootstrapGitHubCmdRun(cmd *cobra.Command, args []string) error {
|
|
|
|
logger.Successf("components are up to date")
|
|
|
|
logger.Successf("components are up to date")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
kubeClient, err := utils.kubeClient(kubeconfig)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// determine if repo synchronization is working
|
|
|
|
// determine if repo synchronization is working
|
|
|
|
isInstall := shouldInstallManifests(ctx, kubeClient, namespace)
|
|
|
|
isInstall := shouldInstallManifests(ctx, kubeClient, namespace)
|
|
|
|
|
|
|
|
|
|
|
|