File tree Expand file tree Collapse file tree 3 files changed +32
-11
lines changed
internal/plugins/golang/v2 Expand file tree Collapse file tree 3 files changed +32
-11
lines changed Original file line number Diff line number Diff line change 1+ entries :
2+ - description : >
3+ Changed the `go.operator-sdk.io` plugin to only write a `plugins` PROJECT field and
4+ run the OLM integration plugin if the project version is "3-alpha" or above.
5+ kind: change
6+ breaking: true
7+ migration:
8+ header: Upgrade your project from version "2" to "3-alpha"
9+ body: >
10+ The SDK's default Go plugin no longer supports OLM-related project files
11+ nor writes a `plugins` PROJECT field for projects scaffolded previously with
12+ `operator-sdk init --project-version=2`, Please migrate to project version "3-alpha"
13+ for support of these features by adding the following to your `PROJECT` file:
14+
15+ ```yaml
16+ version: "3-alpha" # Updated from "2"
17+ layout: go.kubebuilder.io/v2
18+ plugins:
19+ go.sdk.operatorframework.io/v2-alpha: {}
20+ ```
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ type Config struct{}
2121
2222// hasPluginConfig returns true if cfg.Plugins contains an exact match for this plugin's key.
2323func hasPluginConfig (cfg * config.Config ) bool {
24- if len (cfg .Plugins ) == 0 {
24+ if ! cfg . IsV3 () || len (cfg .Plugins ) == 0 {
2525 return false
2626 }
2727 _ , hasKey := cfg .Plugins [pluginConfigKey ]
Original file line number Diff line number Diff line change @@ -44,16 +44,17 @@ func (p *initPlugin) Run() error {
4444 return err
4545 }
4646
47- // Update the scaffolded Makefile with operator-sdk recipes.
48- // TODO: rewrite this when plugins phase 2 is implemented.
49- if err := initUpdateMakefile ("Makefile" ); err != nil {
50- return fmt .Errorf ("error updating Makefile: %v" , err )
51- }
52-
53- // Update plugin config section with this plugin's configuration.
54- cfg := Config {}
55- if err := p .config .EncodePluginConfig (pluginConfigKey , cfg ); err != nil {
56- return fmt .Errorf ("error writing plugin config for %s: %v" , pluginConfigKey , err )
47+ // Run the Makefile updater and update plugin config section with this plugin's configuration for v3 projects.
48+ if p .config .IsV3 () {
49+ // TODO: rewrite this when plugins phase 2 is implemented.
50+ if err := initUpdateMakefile ("Makefile" ); err != nil {
51+ return fmt .Errorf ("error updating Makefile: %v" , err )
52+ }
53+
54+ cfg := Config {}
55+ if err := p .config .EncodePluginConfig (pluginConfigKey , cfg ); err != nil {
56+ return fmt .Errorf ("error writing plugin config for %s: %v" , pluginConfigKey , err )
57+ }
5758 }
5859
5960 return nil
You can’t perform that action at this time.
0 commit comments