-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
183 additions
and
654 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 5 additions & 36 deletions
41
pkg/build/controller/build/apis/defaults/install/install.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,14 @@ | ||
package install | ||
|
||
import ( | ||
"github.com/golang/glog" | ||
|
||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
utilruntime "k8s.io/apimachinery/pkg/util/runtime" | ||
|
||
"github.com/openshift/origin/pkg/build/controller/build/apis/defaults" | ||
"github.com/openshift/origin/pkg/build/controller/build/apis/defaults/v1" | ||
configapi "github.com/openshift/origin/pkg/cmd/server/apis/config" | ||
) | ||
|
||
// availableVersions lists all known external versions for this group from most preferred to least preferred | ||
var availableVersions = []schema.GroupVersion{v1.SchemeGroupVersion} | ||
|
||
func init() { | ||
if err := enableVersions(availableVersions); err != nil { | ||
panic(err) | ||
} | ||
} | ||
|
||
// TODO: enableVersions should be centralized rather than spread in each API | ||
// group. | ||
// We can combine registered.RegisterVersions, registered.EnableVersions and | ||
// registered.RegisterGroup once we have moved enableVersions there. | ||
func enableVersions(externalVersions []schema.GroupVersion) error { | ||
addVersionsToScheme(externalVersions...) | ||
return nil | ||
} | ||
|
||
func addVersionsToScheme(externalVersions ...schema.GroupVersion) { | ||
// add the internal version to Scheme | ||
defaults.AddToScheme(configapi.Scheme) | ||
// add the enabled external versions to Scheme | ||
for _, v := range externalVersions { | ||
switch v { | ||
case v1.SchemeGroupVersion: | ||
v1.AddToScheme(configapi.Scheme) | ||
|
||
default: | ||
glog.Errorf("Version %s is not known, so it will not be added to the Scheme.", v) | ||
continue | ||
} | ||
} | ||
func InstallLegacyInternal(scheme *runtime.Scheme) { | ||
utilruntime.Must(defaults.InstallLegacy(scheme)) | ||
utilruntime.Must(v1.InstallLegacy(scheme)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 5 additions & 36 deletions
41
pkg/build/controller/build/apis/overrides/install/install.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,14 @@ | ||
package install | ||
|
||
import ( | ||
"github.com/golang/glog" | ||
|
||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
utilruntime "k8s.io/apimachinery/pkg/util/runtime" | ||
|
||
"github.com/openshift/origin/pkg/build/controller/build/apis/overrides" | ||
"github.com/openshift/origin/pkg/build/controller/build/apis/overrides/v1" | ||
configapi "github.com/openshift/origin/pkg/cmd/server/apis/config" | ||
) | ||
|
||
// availableVersions lists all known external versions for this group from most preferred to least preferred | ||
var availableVersions = []schema.GroupVersion{v1.SchemeGroupVersion} | ||
|
||
func init() { | ||
if err := enableVersions(availableVersions); err != nil { | ||
panic(err) | ||
} | ||
} | ||
|
||
// TODO: enableVersions should be centralized rather than spread in each API | ||
// group. | ||
// We can combine registered.RegisterVersions, registered.EnableVersions and | ||
// registered.RegisterGroup once we have moved enableVersions there. | ||
func enableVersions(externalVersions []schema.GroupVersion) error { | ||
addVersionsToScheme(externalVersions...) | ||
return nil | ||
} | ||
|
||
func addVersionsToScheme(externalVersions ...schema.GroupVersion) { | ||
// add the internal version to Scheme | ||
overrides.AddToScheme(configapi.Scheme) | ||
// add the enabled external versions to Scheme | ||
for _, v := range externalVersions { | ||
switch v { | ||
case v1.SchemeGroupVersion: | ||
v1.AddToScheme(configapi.Scheme) | ||
|
||
default: | ||
glog.Errorf("Version %s is not known, so it will not be added to the Scheme.", v) | ||
continue | ||
} | ||
} | ||
func InstallLegacyInternal(scheme *runtime.Scheme) { | ||
utilruntime.Must(overrides.InstallLegacy(scheme)) | ||
utilruntime.Must(v1.InstallLegacy(scheme)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.