Skip to content

Commit e491d07

Browse files
committed
manual prep for move
1 parent 9d41cbe commit e491d07

File tree

41 files changed

+544
-793
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+544
-793
lines changed

pkg/api/latest/latest.go

+4-13
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,6 @@ func IsOriginAPIGroup(groupName string) bool {
6565
return false
6666
}
6767

68-
// IsKindInAnyOriginGroup returns true if OpenShift owns the kind described in any apiVersion.
69-
// TODO: this may not work once we divide builds/deployments/images into their own API groups
70-
func IsKindInAnyOriginGroup(kind string) bool {
71-
for _, version := range Versions {
72-
if OriginKind(version.WithKind(kind)) {
73-
return true
74-
}
75-
}
76-
77-
return false
78-
}
79-
8068
func getOrCreateOriginKinds() map[schema.GroupVersionKind]bool {
8169
if originTypes == nil {
8270
originTypesLock.Do(func() {
@@ -90,9 +78,12 @@ func getOrCreateOriginKinds() map[schema.GroupVersionKind]bool {
9078
if kind == "SecurityContextConstraints" {
9179
continue
9280
}
93-
if !strings.Contains(t.PkgPath(), "github.com/openshift/origin") || strings.Contains(t.PkgPath(), "github.com/openshift/origin/vendor/") {
81+
isExternal := strings.Contains(t.PkgPath(), "github.com/openshift/api")
82+
isVendored := strings.Contains(t.PkgPath(), "github.com/openshift/origin/vendor/")
83+
if isVendored && !isExternal {
9484
continue
9585
}
86+
9687
gvk := version.WithKind(kind)
9788
newOriginTypes[gvk] = true
9889
}

pkg/apps/apis/apps/v1/conversion.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ import (
77
"k8s.io/apimachinery/pkg/runtime"
88
"k8s.io/apimachinery/pkg/util/intstr"
99

10+
"github.com/openshift/api/apps/v1"
1011
newer "github.com/openshift/origin/pkg/apps/apis/apps"
1112
imageapi "github.com/openshift/origin/pkg/image/apis/image"
1213
)
1314

14-
func Convert_v1_DeploymentTriggerImageChangeParams_To_apps_DeploymentTriggerImageChangeParams(in *DeploymentTriggerImageChangeParams, out *newer.DeploymentTriggerImageChangeParams, s conversion.Scope) error {
15+
func Convert_v1_DeploymentTriggerImageChangeParams_To_apps_DeploymentTriggerImageChangeParams(in *v1.DeploymentTriggerImageChangeParams, out *newer.DeploymentTriggerImageChangeParams, s conversion.Scope) error {
1516
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
1617
return err
1718
}
@@ -28,7 +29,7 @@ func Convert_v1_DeploymentTriggerImageChangeParams_To_apps_DeploymentTriggerImag
2829
return nil
2930
}
3031

31-
func Convert_apps_DeploymentTriggerImageChangeParams_To_v1_DeploymentTriggerImageChangeParams(in *newer.DeploymentTriggerImageChangeParams, out *DeploymentTriggerImageChangeParams, s conversion.Scope) error {
32+
func Convert_apps_DeploymentTriggerImageChangeParams_To_v1_DeploymentTriggerImageChangeParams(in *newer.DeploymentTriggerImageChangeParams, out *v1.DeploymentTriggerImageChangeParams, s conversion.Scope) error {
3233
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
3334
return err
3435
}
@@ -45,7 +46,7 @@ func Convert_apps_DeploymentTriggerImageChangeParams_To_v1_DeploymentTriggerImag
4546
return nil
4647
}
4748

48-
func Convert_v1_RollingDeploymentStrategyParams_To_apps_RollingDeploymentStrategyParams(in *RollingDeploymentStrategyParams, out *newer.RollingDeploymentStrategyParams, s conversion.Scope) error {
49+
func Convert_v1_RollingDeploymentStrategyParams_To_apps_RollingDeploymentStrategyParams(in *v1.RollingDeploymentStrategyParams, out *newer.RollingDeploymentStrategyParams, s conversion.Scope) error {
4950
SetDefaults_RollingDeploymentStrategyParams(in)
5051

5152
out.UpdatePeriodSeconds = in.UpdatePeriodSeconds
@@ -75,7 +76,7 @@ func Convert_v1_RollingDeploymentStrategyParams_To_apps_RollingDeploymentStrateg
7576
return nil
7677
}
7778

78-
func Convert_apps_RollingDeploymentStrategyParams_To_v1_RollingDeploymentStrategyParams(in *newer.RollingDeploymentStrategyParams, out *RollingDeploymentStrategyParams, s conversion.Scope) error {
79+
func Convert_apps_RollingDeploymentStrategyParams_To_v1_RollingDeploymentStrategyParams(in *newer.RollingDeploymentStrategyParams, out *v1.RollingDeploymentStrategyParams, s conversion.Scope) error {
7980
out.UpdatePeriodSeconds = in.UpdatePeriodSeconds
8081
out.IntervalSeconds = in.IntervalSeconds
8182
out.TimeoutSeconds = in.TimeoutSeconds

pkg/apps/apis/apps/v1/conversion_test.go

+16-15
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"k8s.io/apimachinery/pkg/util/intstr"
1212
kapi "k8s.io/kubernetes/pkg/api"
1313

14+
"github.com/openshift/api/apps/v1"
1415
newer "github.com/openshift/origin/pkg/apps/apis/apps"
1516
)
1617

@@ -49,7 +50,7 @@ func TestTriggerRoundTrip(t *testing.T) {
4950
}
5051

5152
for _, test := range tests {
52-
p := DeploymentTriggerImageChangeParams{
53+
p := v1.DeploymentTriggerImageChangeParams{
5354
From: kapiv1.ObjectReference{
5455
Kind: test.kind,
5556
Name: test.name,
@@ -70,20 +71,20 @@ func TestTriggerRoundTrip(t *testing.T) {
7071

7172
func Test_convert_v1_RollingDeploymentStrategyParams_To_apps_RollingDeploymentStrategyParams(t *testing.T) {
7273
tests := []struct {
73-
in *RollingDeploymentStrategyParams
74+
in *v1.RollingDeploymentStrategyParams
7475
out *newer.RollingDeploymentStrategyParams
7576
}{
7677
{
77-
in: &RollingDeploymentStrategyParams{
78+
in: &v1.RollingDeploymentStrategyParams{
7879
UpdatePeriodSeconds: newInt64(5),
7980
IntervalSeconds: newInt64(6),
8081
TimeoutSeconds: newInt64(7),
8182
MaxUnavailable: newIntOrString(intstr.FromString("25%")),
82-
Pre: &LifecycleHook{
83-
FailurePolicy: LifecycleHookFailurePolicyIgnore,
83+
Pre: &v1.LifecycleHook{
84+
FailurePolicy: v1.LifecycleHookFailurePolicyIgnore,
8485
},
85-
Post: &LifecycleHook{
86-
FailurePolicy: LifecycleHookFailurePolicyAbort,
86+
Post: &v1.LifecycleHook{
87+
FailurePolicy: v1.LifecycleHookFailurePolicyAbort,
8788
},
8889
},
8990
out: &newer.RollingDeploymentStrategyParams{
@@ -101,7 +102,7 @@ func Test_convert_v1_RollingDeploymentStrategyParams_To_apps_RollingDeploymentSt
101102
},
102103
},
103104
{
104-
in: &RollingDeploymentStrategyParams{
105+
in: &v1.RollingDeploymentStrategyParams{
105106
UpdatePeriodSeconds: newInt64(5),
106107
IntervalSeconds: newInt64(6),
107108
TimeoutSeconds: newInt64(7),
@@ -116,7 +117,7 @@ func Test_convert_v1_RollingDeploymentStrategyParams_To_apps_RollingDeploymentSt
116117
},
117118
},
118119
{
119-
in: &RollingDeploymentStrategyParams{
120+
in: &v1.RollingDeploymentStrategyParams{
120121
UpdatePeriodSeconds: newInt64(5),
121122
IntervalSeconds: newInt64(6),
122123
TimeoutSeconds: newInt64(7),
@@ -132,7 +133,7 @@ func Test_convert_v1_RollingDeploymentStrategyParams_To_apps_RollingDeploymentSt
132133
},
133134
},
134135
{
135-
in: &RollingDeploymentStrategyParams{
136+
in: &v1.RollingDeploymentStrategyParams{
136137
UpdatePeriodSeconds: newInt64(5),
137138
IntervalSeconds: newInt64(6),
138139
TimeoutSeconds: newInt64(7),
@@ -162,7 +163,7 @@ func Test_convert_v1_RollingDeploymentStrategyParams_To_apps_RollingDeploymentSt
162163
func Test_convert_api_RollingDeploymentStrategyParams_To_v1_RollingDeploymentStrategyParams(t *testing.T) {
163164
tests := []struct {
164165
in *newer.RollingDeploymentStrategyParams
165-
out *RollingDeploymentStrategyParams
166+
out *v1.RollingDeploymentStrategyParams
166167
}{
167168
{
168169
in: &newer.RollingDeploymentStrategyParams{
@@ -172,7 +173,7 @@ func Test_convert_api_RollingDeploymentStrategyParams_To_v1_RollingDeploymentStr
172173
MaxSurge: intstr.FromInt(0),
173174
MaxUnavailable: intstr.FromString("25%"),
174175
},
175-
out: &RollingDeploymentStrategyParams{
176+
out: &v1.RollingDeploymentStrategyParams{
176177
UpdatePeriodSeconds: newInt64(5),
177178
IntervalSeconds: newInt64(6),
178179
TimeoutSeconds: newInt64(7),
@@ -188,7 +189,7 @@ func Test_convert_api_RollingDeploymentStrategyParams_To_v1_RollingDeploymentStr
188189
MaxSurge: intstr.FromString("25%"),
189190
MaxUnavailable: intstr.FromInt(0),
190191
},
191-
out: &RollingDeploymentStrategyParams{
192+
out: &v1.RollingDeploymentStrategyParams{
192193
UpdatePeriodSeconds: newInt64(5),
193194
IntervalSeconds: newInt64(6),
194195
TimeoutSeconds: newInt64(7),
@@ -204,7 +205,7 @@ func Test_convert_api_RollingDeploymentStrategyParams_To_v1_RollingDeploymentStr
204205
MaxSurge: intstr.FromInt(10),
205206
MaxUnavailable: intstr.FromInt(20),
206207
},
207-
out: &RollingDeploymentStrategyParams{
208+
out: &v1.RollingDeploymentStrategyParams{
208209
UpdatePeriodSeconds: newInt64(5),
209210
IntervalSeconds: newInt64(6),
210211
TimeoutSeconds: newInt64(7),
@@ -215,7 +216,7 @@ func Test_convert_api_RollingDeploymentStrategyParams_To_v1_RollingDeploymentStr
215216
}
216217

217218
for _, test := range tests {
218-
out := &RollingDeploymentStrategyParams{}
219+
out := &v1.RollingDeploymentStrategyParams{}
219220
if err := scheme.Convert(test.in, out, nil); err != nil {
220221
t.Errorf("unexpected error: %v", err)
221222
}

pkg/apps/apis/apps/v1/defaults.go

+14-13
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package v1
33
import (
44
"k8s.io/apimachinery/pkg/util/intstr"
55

6+
"github.com/openshift/api/apps/v1"
67
deployapi "github.com/openshift/origin/pkg/apps/apis/apps"
78
)
89

@@ -18,7 +19,7 @@ func AppsV1DeploymentConfigLayeredDefaults(dc *deployapi.DeploymentConfig) {
1819
}
1920

2021
// Keep this in sync with pkg/api/serialization_test.go#defaultHookContainerName
21-
func defaultHookContainerName(hook *LifecycleHook, containerName string) {
22+
func defaultHookContainerName(hook *v1.LifecycleHook, containerName string) {
2223
if hook == nil {
2324
return
2425
}
@@ -34,10 +35,10 @@ func defaultHookContainerName(hook *LifecycleHook, containerName string) {
3435
}
3536
}
3637

37-
func SetDefaults_DeploymentConfigSpec(obj *DeploymentConfigSpec) {
38+
func SetDefaults_DeploymentConfigSpec(obj *v1.DeploymentConfigSpec) {
3839
if obj.Triggers == nil {
39-
obj.Triggers = []DeploymentTriggerPolicy{
40-
{Type: DeploymentTriggerOnConfigChange},
40+
obj.Triggers = []v1.DeploymentTriggerPolicy{
41+
{Type: v1.DeploymentTriggerOnConfigChange},
4142
}
4243
}
4344
if len(obj.Selector) == 0 && obj.Template != nil {
@@ -59,34 +60,34 @@ func SetDefaults_DeploymentConfigSpec(obj *DeploymentConfigSpec) {
5960
}
6061
}
6162

62-
func SetDefaults_DeploymentStrategy(obj *DeploymentStrategy) {
63+
func SetDefaults_DeploymentStrategy(obj *v1.DeploymentStrategy) {
6364
if len(obj.Type) == 0 {
64-
obj.Type = DeploymentStrategyTypeRolling
65+
obj.Type = v1.DeploymentStrategyTypeRolling
6566
}
6667

67-
if obj.Type == DeploymentStrategyTypeRolling && obj.RollingParams == nil {
68-
obj.RollingParams = &RollingDeploymentStrategyParams{
68+
if obj.Type == v1.DeploymentStrategyTypeRolling && obj.RollingParams == nil {
69+
obj.RollingParams = &v1.RollingDeploymentStrategyParams{
6970
IntervalSeconds: mkintp(deployapi.DefaultRollingIntervalSeconds),
7071
UpdatePeriodSeconds: mkintp(deployapi.DefaultRollingUpdatePeriodSeconds),
7172
TimeoutSeconds: mkintp(deployapi.DefaultRollingTimeoutSeconds),
7273
}
7374
}
74-
if obj.Type == DeploymentStrategyTypeRecreate && obj.RecreateParams == nil {
75-
obj.RecreateParams = &RecreateDeploymentStrategyParams{}
75+
if obj.Type == v1.DeploymentStrategyTypeRecreate && obj.RecreateParams == nil {
76+
obj.RecreateParams = &v1.RecreateDeploymentStrategyParams{}
7677
}
7778

7879
if obj.ActiveDeadlineSeconds == nil {
7980
obj.ActiveDeadlineSeconds = mkintp(deployapi.MaxDeploymentDurationSeconds)
8081
}
8182
}
8283

83-
func SetDefaults_RecreateDeploymentStrategyParams(obj *RecreateDeploymentStrategyParams) {
84+
func SetDefaults_RecreateDeploymentStrategyParams(obj *v1.RecreateDeploymentStrategyParams) {
8485
if obj.TimeoutSeconds == nil {
8586
obj.TimeoutSeconds = mkintp(deployapi.DefaultRecreateTimeoutSeconds)
8687
}
8788
}
8889

89-
func SetDefaults_RollingDeploymentStrategyParams(obj *RollingDeploymentStrategyParams) {
90+
func SetDefaults_RollingDeploymentStrategyParams(obj *v1.RollingDeploymentStrategyParams) {
9091
if obj.IntervalSeconds == nil {
9192
obj.IntervalSeconds = mkintp(deployapi.DefaultRollingIntervalSeconds)
9293
}
@@ -120,7 +121,7 @@ func SetDefaults_RollingDeploymentStrategyParams(obj *RollingDeploymentStrategyP
120121
}
121122
}
122123

123-
func SetDefaults_DeploymentConfig(obj *DeploymentConfig) {
124+
func SetDefaults_DeploymentConfig(obj *v1.DeploymentConfig) {
124125
for _, t := range obj.Spec.Triggers {
125126
if t.ImageChangeParams != nil {
126127
if len(t.ImageChangeParams.From.Kind) == 0 {

0 commit comments

Comments
 (0)