Skip to content

Commit 7466626

Browse files
cescginaopenshift-merge-bot[bot]
authored andcommitted
Use Override spec field instead of ExternalEndpoints
Use the Override spec field that is used in the other operators, so once we change the code to expose the services to use the same method used by the openstack operator, the spec will go through less changes.
1 parent 2244604 commit 7466626

16 files changed

+696
-210
lines changed

api/bases/watcher.openstack.org_watcherapis.yaml

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -43,47 +43,6 @@ spec:
4343
description: The service specific Container Image URL (will be set
4444
to environmental default if empty)
4545
type: string
46-
externalEndpoints:
47-
description: ExternalEndpoints, expose a VIP via MetalLB on the pre-created
48-
address pool
49-
items:
50-
description: MetalLBConfig to configure the MetalLB loadbalancer
51-
service
52-
properties:
53-
endpoint:
54-
description: Endpoint, OpenStack endpoint this service maps
55-
to
56-
enum:
57-
- internal
58-
- public
59-
type: string
60-
ipAddressPool:
61-
description: IPAddressPool expose VIP via MetalLB on the IPAddressPool
62-
minLength: 1
63-
type: string
64-
loadBalancerIPs:
65-
description: LoadBalancerIPs, request given IPs from the pool
66-
if available. Using a list to allow dual stack (IPv4/IPv6)
67-
support
68-
items:
69-
type: string
70-
type: array
71-
sharedIP:
72-
default: true
73-
description: SharedIP if true, VIP/VIPs get shared with multiple
74-
services
75-
type: boolean
76-
sharedIPKey:
77-
default: ""
78-
description: |-
79-
SharedIPKey specifies the sharing key which gets set as the annotation on the LoadBalancer service.
80-
Services which share the same VIP must have the same SharedIPKey. Defaults to the IPAddressPool if
81-
SharedIP is true, but no SharedIPKey specified.
82-
type: string
83-
required:
84-
- ipAddressPool
85-
type: object
86-
type: array
8746
memcachedInstance:
8847
default: memcached
8948
description: MemcachedInstance is the name of the Memcached CR that
@@ -96,6 +55,51 @@ spec:
9655
NodeSelector to target subset of worker nodes running this component. Setting here overrides
9756
any global NodeSelector settings within the Watcher CR.
9857
type: object
58+
override:
59+
description: |-
60+
Override, provides the ability to override the generated manifest of
61+
several child resources.
62+
properties:
63+
service:
64+
additionalProperties:
65+
description: MetalLBConfig to configure the MetalLB loadbalancer
66+
service
67+
properties:
68+
ipAddressPool:
69+
description: IPAddressPool expose VIP via MetalLB on the
70+
IPAddressPool
71+
minLength: 1
72+
type: string
73+
loadBalancerIPs:
74+
description: LoadBalancerIPs, request given IPs from the
75+
pool if available. Using a list to allow dual stack (IPv4/IPv6)
76+
support
77+
items:
78+
type: string
79+
type: array
80+
sharedIP:
81+
default: true
82+
description: SharedIP if true, VIP/VIPs get shared with
83+
multiple services
84+
type: boolean
85+
sharedIPKey:
86+
default: ""
87+
description: |-
88+
SharedIPKey specifies the sharing key which gets set as the annotation on the LoadBalancer service.
89+
Services which share the same VIP must have the same SharedIPKey. Defaults to the IPAddressPool if
90+
SharedIP is true, but no SharedIPKey specified.
91+
type: string
92+
required:
93+
- ipAddressPool
94+
type: object
95+
description: |-
96+
Override configuration for the Service created to serve traffic to
97+
the cluster.
98+
The key must be the endpoint type (public, internal)
99+
temporarily use MetalLBConfig struct, later we'll switch to
100+
service.RoutedOverrideSpec
101+
type: object
102+
type: object
99103
passwordSelectors:
100104
default:
101105
service: WatcherPassword

api/bases/watcher.openstack.org_watchers.yaml

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -47,55 +47,58 @@ spec:
4747
replicas: 1
4848
description: APIServiceTemplate - define the watcher-api service
4949
properties:
50-
externalEndpoints:
51-
description: ExternalEndpoints, expose a VIP via MetalLB on the
52-
pre-created address pool
53-
items:
54-
description: MetalLBConfig to configure the MetalLB loadbalancer
55-
service
56-
properties:
57-
endpoint:
58-
description: Endpoint, OpenStack endpoint this service maps
59-
to
60-
enum:
61-
- internal
62-
- public
63-
type: string
64-
ipAddressPool:
65-
description: IPAddressPool expose VIP via MetalLB on the
66-
IPAddressPool
67-
minLength: 1
68-
type: string
69-
loadBalancerIPs:
70-
description: LoadBalancerIPs, request given IPs from the
71-
pool if available. Using a list to allow dual stack (IPv4/IPv6)
72-
support
73-
items:
74-
type: string
75-
type: array
76-
sharedIP:
77-
default: true
78-
description: SharedIP if true, VIP/VIPs get shared with
79-
multiple services
80-
type: boolean
81-
sharedIPKey:
82-
default: ""
83-
description: |-
84-
SharedIPKey specifies the sharing key which gets set as the annotation on the LoadBalancer service.
85-
Services which share the same VIP must have the same SharedIPKey. Defaults to the IPAddressPool if
86-
SharedIP is true, but no SharedIPKey specified.
87-
type: string
88-
required:
89-
- ipAddressPool
90-
type: object
91-
type: array
9250
nodeSelector:
9351
additionalProperties:
9452
type: string
9553
description: |-
9654
NodeSelector to target subset of worker nodes running this component. Setting here overrides
9755
any global NodeSelector settings within the Watcher CR.
9856
type: object
57+
override:
58+
description: |-
59+
Override, provides the ability to override the generated manifest of
60+
several child resources.
61+
properties:
62+
service:
63+
additionalProperties:
64+
description: MetalLBConfig to configure the MetalLB loadbalancer
65+
service
66+
properties:
67+
ipAddressPool:
68+
description: IPAddressPool expose VIP via MetalLB on
69+
the IPAddressPool
70+
minLength: 1
71+
type: string
72+
loadBalancerIPs:
73+
description: LoadBalancerIPs, request given IPs from
74+
the pool if available. Using a list to allow dual
75+
stack (IPv4/IPv6) support
76+
items:
77+
type: string
78+
type: array
79+
sharedIP:
80+
default: true
81+
description: SharedIP if true, VIP/VIPs get shared with
82+
multiple services
83+
type: boolean
84+
sharedIPKey:
85+
default: ""
86+
description: |-
87+
SharedIPKey specifies the sharing key which gets set as the annotation on the LoadBalancer service.
88+
Services which share the same VIP must have the same SharedIPKey. Defaults to the IPAddressPool if
89+
SharedIP is true, but no SharedIPKey specified.
90+
type: string
91+
required:
92+
- ipAddressPool
93+
type: object
94+
description: |-
95+
Override configuration for the Service created to serve traffic to
96+
the cluster.
97+
The key must be the endpoint type (public, internal)
98+
temporarily use MetalLBConfig struct, later we'll switch to
99+
service.RoutedOverrideSpec
100+
type: object
101+
type: object
99102
replicas:
100103
default: 1
101104
description: Replicas of Watcher service to run

api/v1beta1/common_types.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package v1beta1
1818

1919
import (
20-
"github.com/openstack-k8s-operators/lib-common/modules/common/service"
2120
"github.com/openstack-k8s-operators/lib-common/modules/common/util"
2221
corev1 "k8s.io/api/core/v1"
2322
)
@@ -146,11 +145,6 @@ type WatcherSubCrsTemplate struct {
146145

147146
// MetalLBConfig to configure the MetalLB loadbalancer service
148147
type MetalLBConfig struct {
149-
// +kubebuilder:validation:Optional
150-
// +kubebuilder:validation:Enum=internal;public
151-
// Endpoint, OpenStack endpoint this service maps to
152-
Endpoint service.Endpoint `json:"endpoint"`
153-
154148
// +kubebuilder:validation:Required
155149
// +kubebuilder:validation:MinLength=1
156150
// IPAddressPool expose VIP via MetalLB on the IPAddressPool

api/v1beta1/watcherapi_types.go

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package v1beta1
1818

1919
import (
2020
"github.com/openstack-k8s-operators/lib-common/modules/common/condition"
21+
"github.com/openstack-k8s-operators/lib-common/modules/common/service"
2122
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2223
)
2324

@@ -35,8 +36,9 @@ type WatcherAPISpec struct {
3536
WatcherSubCrsCommon `json:",inline"`
3637

3738
// +kubebuilder:validation:Optional
38-
// ExternalEndpoints, expose a VIP via MetalLB on the pre-created address pool
39-
ExternalEndpoints []MetalLBConfig `json:"externalEndpoints,omitempty"`
39+
// Override, provides the ability to override the generated manifest of
40+
// several child resources.
41+
Override APIOverrideSpec `json:"override,omitempty"`
4042
}
4143

4244
// WatcherAPIStatus defines the observed state of WatcherAPI
@@ -57,14 +59,26 @@ type WatcherAPIStatus struct {
5759
Hash map[string]string `json:"hash,omitempty"`
5860
}
5961

62+
// APIOverrideSpec to override the generated manifest of several child
63+
// resources.
64+
type APIOverrideSpec struct {
65+
// Override configuration for the Service created to serve traffic to
66+
// the cluster.
67+
// The key must be the endpoint type (public, internal)
68+
// temporarily use MetalLBConfig struct, later we'll switch to
69+
// service.RoutedOverrideSpec
70+
Service map[service.Endpoint]MetalLBConfig `json:"service,omitempty"`
71+
}
72+
6073
// WatcherAPITemplate defines the input parameters specified by the user to
6174
// create a WatcherAPI via higher level CRDs.
6275
type WatcherAPITemplate struct {
6376
WatcherSubCrsTemplate `json:",inline"`
6477

6578
// +kubebuilder:validation:Optional
66-
// ExternalEndpoints, expose a VIP via MetalLB on the pre-created address pool
67-
ExternalEndpoints []MetalLBConfig `json:"externalEndpoints,omitempty"`
79+
// Override, provides the ability to override the generated manifest of
80+
// several child resources.
81+
Override APIOverrideSpec `json:"override,omitempty"`
6882
}
6983

7084
//+kubebuilder:object:root=true

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 25 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)