Add new customizations folder for kustomize 57/857/1
authorYolanda Robla <yroblamo@redhat.com>
Mon, 27 May 2019 14:50:18 +0000 (16:50 +0200)
committerYolanda Robla <yroblamo@redhat.com>
Mon, 27 May 2019 14:50:18 +0000 (16:50 +0200)
Change-Id: I34a27c51741862a76fae11c7ec8f33332b440ea7

Makefile
cmd/workloads.go

index aff892a..fb822fb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -57,7 +57,8 @@ deploy: dependencies
        $(MAKE) workloads
 
 workloads:
-       @./bin/$(GONAME) workloads --site_repository $(SITE_REPO) --cluster_credentials $(CLUSTER_CREDENTIALS)
+       @./bin/$(GONAME) workloads --site_repository $(SITE_REPO) --cluster_credentials $(CLUSTER_CREDENTIALS) --workload_type customizations
+       @./bin/$(GONAME) workloads --site_repository $(SITE_REPO) --cluster_credentials $(CLUSTER_CREDENTIALS) --workload_type workloads
 
 images:
        @echo "Launching image generation"
index 18266d8..41ba470 100644 (file)
@@ -26,7 +26,7 @@ import (
 )
 
 // generateWorkloads will run kustomize and apply the generated workloads on the cluster
-func generateWorkloads(siteRepository string, buildPath string, clusterCredentials string) {
+func generateWorkloads(siteRepository string, buildPath string, clusterCredentials string, workloadType string) {
        // Clone the site repository
        log.Println("Cloning the site repository")
        siteBuildPath := fmt.Sprintf("%s/site", buildPath)
@@ -37,8 +37,8 @@ func generateWorkloads(siteRepository string, buildPath string, clusterCredentia
        }
 
        // apply kustomize on the given path
-       log.Println("Generating workloads")
-       workloadsPath := fmt.Sprintf("%s/workloads", siteBuildPath)
+       log.Println(fmt.Sprintf("Generating %s", workloadType))
+       workloadsPath := fmt.Sprintf("%s/%s", siteBuildPath, workloadType)
        cmd := exec.Command("kustomize", "build", workloadsPath)
        out, err := cmd.CombinedOutput()
        if err != nil {
@@ -91,9 +91,10 @@ var workloadsCmd = &cobra.Command{
                }
 
                clusterCredentials, _ := cmd.Flags().GetString("cluster_credentials")
+               workloadType, _ := cmd.Flags().GetString("workload_type")
 
                // start generation process
-               generateWorkloads(siteRepository, buildPath, clusterCredentials)
+               generateWorkloads(siteRepository, buildPath, clusterCredentials, workloadType)
        },
 }
 
@@ -104,5 +105,7 @@ func init() {
        workloadsCmd.MarkFlagRequired("site_repository")
        workloadsCmd.Flags().StringP("cluster_credentials", "", "", "The credentials to use to access the cluster")
        workloadsCmd.MarkFlagRequired("cluster_credentials")
+       workloadsCmd.Flags().StringP("workload_type", "", "", "The type of workloads to execute")
+       workloadsCmd.MarkFlagRequired("workload_type")
 
 }