Skip to content

Commit

Permalink
K8SPXC-1079: Standardize service exposure (percona#1538)
Browse files Browse the repository at this point in the history
* Update specs.

* Deprecate

* Depracate ServiceExpose.TrafficPolicy

* Add new fields for 1.14.0 version and above.

* Rename ExposeReplica to ExposeReplicas.

* Fix ReplicasServiceEnabled.

* Update default cr.

* Fix tests.

* Fix linter.

* Add linter config.

* Refactor

* Fix PXC labels and annotations and update integration test.

* Fix panic.

* Fix panic

* Fix wrong proxysql check.

* Fix tests and add integration test for 1.13.0.

* Don't focus the test.

* Update test name.

* Fix cr name in tests.
  • Loading branch information
inelpandzic authored Dec 25, 2023
1 parent 065a9d0 commit 4059868
Show file tree
Hide file tree
Showing 17 changed files with 1,037 additions and 199 deletions.
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
linters-settings:
staticcheck:
checks:
- "-SA1019"
91 changes: 91 additions & 0 deletions config/crd/bases/pxc.percona.com_perconaxtradbclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,60 @@ spec:
type: boolean
envVarsSecret:
type: string
exposePrimary:
properties:
annotations:
additionalProperties:
type: string
type: object
enabled:
type: boolean
externalTrafficPolicy:
type: string
internalTrafficPolicy:
type: string
labels:
additionalProperties:
type: string
type: object
loadBalancerIP:
type: string
loadBalancerSourceRanges:
items:
type: string
type: array
trafficPolicy:
type: string
type:
type: string
type: object
exposeReplicas:
properties:
annotations:
additionalProperties:
type: string
type: object
enabled:
type: boolean
externalTrafficPolicy:
type: string
internalTrafficPolicy:
type: string
labels:
additionalProperties:
type: string
type: object
loadBalancerIP:
type: string
loadBalancerSourceRanges:
items:
type: string
type: array
trafficPolicy:
type: string
type:
type: string
type: object
externalTrafficPolicy:
type: string
forceUnsafeBootstrap:
Expand Down Expand Up @@ -4126,6 +4180,33 @@ spec:
type: boolean
envVarsSecret:
type: string
expose:
properties:
annotations:
additionalProperties:
type: string
type: object
enabled:
type: boolean
externalTrafficPolicy:
type: string
internalTrafficPolicy:
type: string
labels:
additionalProperties:
type: string
type: object
loadBalancerIP:
type: string
loadBalancerSourceRanges:
items:
type: string
type: array
trafficPolicy:
type: string
type:
type: string
type: object
externalTrafficPolicy:
type: string
forceUnsafeBootstrap:
Expand Down Expand Up @@ -6590,6 +6671,16 @@ spec:
type: object
enabled:
type: boolean
externalTrafficPolicy:
type: string
internalTrafficPolicy:
type: string
labels:
additionalProperties:
type: string
type: object
loadBalancerIP:
type: string
loadBalancerSourceRanges:
items:
type: string
Expand Down
91 changes: 91 additions & 0 deletions deploy/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2287,6 +2287,60 @@ spec:
type: boolean
envVarsSecret:
type: string
exposePrimary:
properties:
annotations:
additionalProperties:
type: string
type: object
enabled:
type: boolean
externalTrafficPolicy:
type: string
internalTrafficPolicy:
type: string
labels:
additionalProperties:
type: string
type: object
loadBalancerIP:
type: string
loadBalancerSourceRanges:
items:
type: string
type: array
trafficPolicy:
type: string
type:
type: string
type: object
exposeReplicas:
properties:
annotations:
additionalProperties:
type: string
type: object
enabled:
type: boolean
externalTrafficPolicy:
type: string
internalTrafficPolicy:
type: string
labels:
additionalProperties:
type: string
type: object
loadBalancerIP:
type: string
loadBalancerSourceRanges:
items:
type: string
type: array
trafficPolicy:
type: string
type:
type: string
type: object
externalTrafficPolicy:
type: string
forceUnsafeBootstrap:
Expand Down Expand Up @@ -5019,6 +5073,33 @@ spec:
type: boolean
envVarsSecret:
type: string
expose:
properties:
annotations:
additionalProperties:
type: string
type: object
enabled:
type: boolean
externalTrafficPolicy:
type: string
internalTrafficPolicy:
type: string
labels:
additionalProperties:
type: string
type: object
loadBalancerIP:
type: string
loadBalancerSourceRanges:
items:
type: string
type: array
trafficPolicy:
type: string
type:
type: string
type: object
externalTrafficPolicy:
type: string
forceUnsafeBootstrap:
Expand Down Expand Up @@ -7483,6 +7564,16 @@ spec:
type: object
enabled:
type: boolean
externalTrafficPolicy:
type: string
internalTrafficPolicy:
type: string
labels:
additionalProperties:
type: string
type: object
loadBalancerIP:
type: string
loadBalancerSourceRanges:
items:
type: string
Expand Down
66 changes: 41 additions & 25 deletions deploy/cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,15 @@ spec:
# expose:
# enabled: true
# type: LoadBalancer
# trafficPolicy: Local
# externalTrafficPolicy: Local
# internalTrafficPolicy: Local
# loadBalancerSourceRanges:
# - 10.0.0.0/8
# loadBalancerIP: 127.0.01
# annotations:
# networking.gke.io/load-balancer-type: "Internal"
# labels:
# rack: rack-22
# replicationChannels:
# - name: pxc1_to_pxc2
# isSource: true
Expand Down Expand Up @@ -257,25 +261,30 @@ spec:
# periodSeconds: 30
# successThreshold: 1
# failureThreshold: 4
# serviceType: ClusterIP
# externalTrafficPolicy: Cluster
# loadBalancerSourceRanges:
# - 10.0.0.0/8
# loadBalancerIP: 127.0.0.1
# serviceAnnotations:
# service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
# serviceLabels:
# rack: rack-23
# replicasServiceEnabled: false
# replicasLoadBalancerSourceRanges:
# - 10.0.0.0/8
# replicasLoadBalancerIP: 127.0.0.1
# replicasServiceType: ClusterIP
# replicasExternalTrafficPolicy: Cluster
# replicasServiceAnnotations:
# service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
# replicasServiceLabels:
# rack: rack-23
# exposePrimary:
# enabled: false
# type: ClusterIP
# annotations:
# service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
# externalTrafficPolicy: Cluster
# internalTrafficPolicy: Cluster
# labels:
# rack: rack-22
# loadBalancerSourceRanges:
# - 10.0.0.0/8
# loadBalancerIP: 127.0.0.1
# exposeReplicas:
# enabled: false
# type: ClusterIP
# annotations:
# service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
# externalTrafficPolicy: Cluster
# internalTrafficPolicy: Cluster
# labels:
# rack: rack-22
# loadBalancerSourceRanges:
# - 10.0.0.0/8
# loadBalancerIP: 127.0.0.1
# runtimeClassName: image-rc
# sidecars:
# - image: busybox
Expand Down Expand Up @@ -407,11 +416,18 @@ spec:
# iam.amazonaws.com/role: role-arn
# labels:
# rack: rack-22
# serviceType: ClusterIP
# loadBalancerSourceRanges:
# - 10.0.0.0/8
# loadBalancerIP: 127.0.0.1
# externalTrafficPolicy: Cluster
# expose:
# enabled: false
# type: ClusterIP
# annotations:
# service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
# externalTrafficPolicy: Cluster
# internalTrafficPolicy: Cluster
# labels:
# rack: rack-22
# loadBalancerSourceRanges:
# - 10.0.0.0/8
# loadBalancerIP: 127.0.0.1
# runtimeClassName: image-rc
# sidecars:
# - image: busybox
Expand Down
Loading

0 comments on commit 4059868

Please sign in to comment.