Skip to content

Commit 0948245

Browse files
Mo3m3noktalz
authored andcommitted
MEDIUM: cr: Update global, defaults and backend Custom Resource
Definitions to v1alpha2 This breaks compatibility with v1alpha1 Customs Resources, so users need to update their CR to v1alpha2
1 parent 50bae0c commit 0948245

Some content is hidden

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

44 files changed

+3681
-740
lines changed

crs/api/core/v1alpha1/backend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package v1alpha1
1717

1818
import (
19-
"github.com/haproxytech/client-native/v3/models"
19+
"github.com/haproxytech/client-native/v2/models"
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121
)
2222

crs/api/core/v1alpha1/defaults.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package v1alpha1
1717

1818
import (
19-
"github.com/haproxytech/client-native/v3/models"
19+
"github.com/haproxytech/client-native/v2/models"
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121
)
2222

crs/api/core/v1alpha1/global.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package v1alpha1
1717

1818
import (
19-
"github.com/haproxytech/client-native/v3/models"
19+
"github.com/haproxytech/client-native/v2/models"
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121
)
2222

crs/api/core/v1alpha2/backend.go

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Copyright 2019 HAProxy Technologies
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
package v1alpha2
17+
18+
import (
19+
"github.com/haproxytech/client-native/v3/models"
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
)
22+
23+
// +genclient
24+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
25+
26+
// Backend is a specification for a Backend resource
27+
type Backend struct {
28+
metav1.TypeMeta `json:",inline"`
29+
metav1.ObjectMeta `json:"metadata,omitempty"`
30+
31+
Spec BackendSpec `json:"spec"`
32+
}
33+
34+
// BackendSpec defines the desired state of Backend
35+
type BackendSpec struct {
36+
Config *models.Backend `json:"config"`
37+
}
38+
39+
// DeepCopyInto deepcopying the receiver into out. in must be non-nil.
40+
func (in *BackendSpec) DeepCopyInto(out *BackendSpec) {
41+
*out = *in
42+
if in.Config != nil {
43+
b, _ := in.Config.MarshalBinary()
44+
_ = out.Config.UnmarshalBinary(b)
45+
}
46+
}
47+
48+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
49+
50+
// BackendList is a list of Backend resources
51+
type BackendList struct {
52+
metav1.TypeMeta `json:",inline"`
53+
metav1.ListMeta `json:"metadata"`
54+
55+
Items []Backend `json:"items"`
56+
}

crs/api/core/v1alpha2/defaults.go

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Copyright 2019 HAProxy Technologies
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
package v1alpha2
17+
18+
import (
19+
"github.com/haproxytech/client-native/v3/models"
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
)
22+
23+
// +genclient
24+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
25+
26+
// Defaults is a specification for a Defaults resource
27+
type Defaults struct {
28+
metav1.TypeMeta `json:",inline"`
29+
metav1.ObjectMeta `json:"metadata,omitempty"`
30+
31+
Spec DefaultsSpec `json:"spec"`
32+
}
33+
34+
// DefaultsSpec defines the desired state of Defaults
35+
type DefaultsSpec struct {
36+
Config *models.Defaults `json:"config"`
37+
}
38+
39+
// DeepCopyInto deepcopying the receiver into out. in must be non-nil.
40+
func (in *DefaultsSpec) DeepCopyInto(out *DefaultsSpec) {
41+
*out = *in
42+
if in.Config != nil {
43+
b, _ := in.Config.MarshalBinary()
44+
_ = out.Config.UnmarshalBinary(b)
45+
}
46+
}
47+
48+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
49+
50+
// DefaultsList is a list of Defaults resources
51+
type DefaultsList struct {
52+
metav1.TypeMeta `json:",inline"`
53+
metav1.ListMeta `json:"metadata"`
54+
55+
Items []Defaults `json:"items"`
56+
}

crs/api/core/v1alpha2/doc.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Package v1alpha1 contains the core v1alpha1 API group
2+
//
3+
// +k8s:deepcopy-gen=package
4+
// +groupName=core.haproxy.org
5+
package v1alpha2

crs/api/core/v1alpha2/global.go

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Copyright 2019 HAProxy Technologies
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
package v1alpha2
17+
18+
import (
19+
"github.com/haproxytech/client-native/v3/models"
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
)
22+
23+
// +genclient
24+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
25+
26+
// Global is a specification for a Global resource
27+
type Global struct {
28+
metav1.TypeMeta `json:",inline"`
29+
metav1.ObjectMeta `json:"metadata,omitempty"`
30+
31+
Spec GlobalSpec `json:"spec"`
32+
}
33+
34+
// GlobalSpec defines the desired state of Global
35+
type GlobalSpec struct {
36+
Config *models.Global `json:"config"`
37+
LogTargets models.LogTargets `json:"log_targets"` //nolint:tagliatelle
38+
}
39+
40+
// DeepCopyInto deepcopying the receiver into out. in must be non-nil.
41+
func (in *GlobalSpec) DeepCopyInto(out *GlobalSpec) {
42+
if in.Config != nil {
43+
b, _ := in.Config.MarshalBinary()
44+
_ = out.Config.UnmarshalBinary(b)
45+
}
46+
if in.LogTargets != nil {
47+
out.LogTargets = make([]*models.LogTarget, len(in.LogTargets))
48+
for i, v := range in.LogTargets {
49+
b, _ := v.MarshalBinary()
50+
_ = out.LogTargets[i].UnmarshalBinary(b)
51+
}
52+
}
53+
}
54+
55+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
56+
57+
// GlobalList is a list of Global resources
58+
type GlobalList struct {
59+
metav1.TypeMeta `json:",inline"`
60+
metav1.ListMeta `json:"metadata"`
61+
62+
Items []Global `json:"items"`
63+
}

0 commit comments

Comments
 (0)