Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build:

.PHONY: setup
setup:
@(printf "Project is: "; read PROJECT; printf "Shoot is: "; read SHOOT; ./bin/dev setup -project $$PROJECT -shoot $$SHOOT);
@(printf "Project is: "; read PROJECT; printf "Shoot is: "; read SHOOT; ./bin/dev setup -project $$PROJECT -shoot $$SHOOT -skip-download true);

.PHONY: start
start:
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ Usage of setup:
Gardener Shoot Name - fallback to env SHOOT
-skip-build
Skips building binaries if already present
-skip-download
Skips downloading cluster data if already present
```


Expand Down
27 changes: 16 additions & 11 deletions cmd/dev/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,11 @@ func main() {

type SetupOpts struct {
du.ClusterCoordinate
KVCLDir string
MCMDir string
CADir string
SkipBuild bool
KVCLDir string
MCMDir string
CADir string
SkipBuild bool
SkipDownload bool
// Mode string
}

Expand Down Expand Up @@ -246,6 +247,7 @@ func Setup(ctx context.Context) (exitCode int, err error) {
setupCmd.StringVar(&so.MCMDir, "mcm-dir", defaultMCMDir, "MCM Project Dir - fallback to env MCM_DIR")
setupCmd.StringVar(&so.CADir, "ca-dir", defaultCADir, "CA Project Dir - fallback to env CA_DIR")
setupCmd.BoolVar(&so.SkipBuild, "skip-build", false, "Skips building binaries if already present")
setupCmd.BoolVar(&so.SkipDownload, "skip-download", false, "Skips downloading cluster data if already present")
// setupCmd.StringVar(&so.Mode, "mode", "local", "Development Mode")
err = setupCmd.Parse(os.Args[2:])
if err != nil {
Expand Down Expand Up @@ -290,17 +292,16 @@ func Setup(ctx context.Context) (exitCode int, err error) {
exitCode = ExitBuildMCMCABinaries
return
}
err = CopyCRDs(so)
_, err = DownloadClusterData(ctx, so.ClusterCoordinate, so.SkipDownload)
if err != nil {
exitCode = ExitCopyCRDs
exitCode = ExitDownloadClusterData
return
}
_, err = DownloadClusterData(ctx, so.ClusterCoordinate)
err = CopyCRDs(so)
if err != nil {
exitCode = ExitDownloadClusterData
exitCode = ExitCopyCRDs
return
}

err = GenerateStartConfig()
if err != nil {
exitCode = ExitGenerateStartConfig
Expand Down Expand Up @@ -561,8 +562,12 @@ func Status(ctx context.Context) (exitCode int, err error) {
return
}

func DownloadClusterData(ctx context.Context, coord du.ClusterCoordinate) (clusterInfo du.ClusterInfo, err error) {
func DownloadClusterData(ctx context.Context, coord du.ClusterCoordinate, skipDownload bool) (clusterInfo du.ClusterInfo, err error) {
clusterInfo, ok := ReadClusterInfo()
if skipDownload && clusterInfo.ClusterCoordinate == coord && du.Exists(Dirs.Gen) {
klog.Infof("Skipping download of the cluster data!")
return
}
if ok {
if clusterInfo.ClusterCoordinate != coord {
klog.Warningf("DownloadClusterData deleting all downloaded files detected change in cluster coordinate from %v->%v",
Expand Down Expand Up @@ -655,7 +660,7 @@ func DownloadClusterData(ctx context.Context, coord du.ClusterCoordinate) (clust
klog.Infof("NO CA Priority Expander (%q) configured for %s", "cluster-autoscaler-priority-expander", coord)
}
} else {
klog.Infof("CA Priority Expandder YAML already present at %q - skipping download.", Specs.CAPriorityExpander)
klog.Infof("CA Priority Expander YAML already present at %q - skipping download.", Specs.CAPriorityExpander)
}

shootNamespace, err := gctl.GetShootNamespace(ctx)
Expand Down