| 140 | } |
| 141 | |
| 142 | func (s *sync) processConfiguration(cfg *specv1.Configuration) error { |
| 143 | err := DownloadConfig(s.download, s.cfg.Sync.Download.Path, cfg) |
| 144 | if err != nil { |
| 145 | return errors.Trace(err) |
| 146 | } |
| 147 | key := makeKey(specv1.KindConfiguration, cfg.Name, cfg.Version) |
| 148 | if key == "" { |
| 149 | return errors.Errorf("configuration does not have name or version") |
| 150 | } |
| 151 | if err := s.store.Get(key, &specv1.Configuration{}); err == nil { |
| 152 | s.log.Info("configuration resource already exists", log.Any("key", key)) |
| 153 | return nil |
| 154 | } |
| 155 | return errors.Trace(s.store.Upsert(key, cfg)) |
| 156 | } |
| 157 | |
| 158 | func (s *sync) storeApplication(app *specv1.Application) error { |
| 159 | key := makeKey(specv1.KindApplication, app.Name, app.Version) |