(hasClusterFlags bool)
| 90 | } |
| 91 | |
| 92 | func getClusterAccessConfigWithCache(hasClusterFlags bool) (*clusterconfig.AccessConfig, error) { |
| 93 | accessConfig := &clusterconfig.AccessConfig{ |
| 94 | ImageManager: consts.DefaultRegistry() + "/manager:" + consts.CortexVersion, |
| 95 | } |
| 96 | |
| 97 | cachedPaths := existingCachedClusterConfigPaths() |
| 98 | if len(cachedPaths) == 1 { |
| 99 | cachedAccessConfig := &clusterconfig.AccessConfig{} |
| 100 | cr.ParseYAMLFile(cachedAccessConfig, clusterconfig.AccessValidation, cachedPaths[0]) |
| 101 | accessConfig.ClusterName = cachedAccessConfig.ClusterName |
| 102 | accessConfig.Region = cachedAccessConfig.Region |
| 103 | } |
| 104 | |
| 105 | if _flagClusterConfig != "" { |
| 106 | errs := cr.ParseYAMLFile(accessConfig, clusterconfig.AccessValidation, _flagClusterConfig) |
| 107 | if errors.HasError(errs) { |
| 108 | return nil, errors.Append(errors.FirstError(errs...), fmt.Sprintf("\n\ncluster configuration schema can be found at https://docs.cortex.dev/v/%s/", consts.CortexVersionMinor)) |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | if _flagClusterName != "" { |
| 113 | accessConfig.ClusterName = _flagClusterName |
| 114 | } |
| 115 | if _flagClusterRegion != "" { |
| 116 | accessConfig.Region = _flagClusterRegion |
| 117 | } |
| 118 | |
| 119 | if accessConfig.ClusterName == "" || accessConfig.Region == "" { |
| 120 | return nil, ErrorClusterAccessConfigRequired(hasClusterFlags) |
| 121 | } |
| 122 | return accessConfig, nil |
| 123 | } |
| 124 | |
| 125 | func getInstallClusterConfig(awsClient *aws.Client, clusterConfigFile string) (*clusterconfig.Config, error) { |
| 126 | clusterConfig := &clusterconfig.Config{} |
no test coverage detected