Skip to content

Commit

Permalink
OAS-10003 Gateway custom image (#1707)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwierzbo authored Aug 28, 2024
1 parent 88c5df2 commit 8264471
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- (Feature) Integration Service Authentication
- (Improvement) Better panic handling
- (Feature) PongV1 Integration Service
- (Feature) Custom Gateway image

## [1.2.42](https://github.com/arangodb/kube-arangodb/tree/1.2.42) (2024-07-23)
- (Maintenance) Go 1.22.4 & Kubernetes 1.29.6 libraries
Expand Down
16 changes: 15 additions & 1 deletion docs/api/ArangoDeployment.V1.md
Original file line number Diff line number Diff line change
Expand Up @@ -3045,7 +3045,21 @@ Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.

### .spec.gateway.enabled

Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/deployment/v1/deployment_spec_gateway.go#L24)</sup>
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/deployment/v1/deployment_spec_gateway.go#L29)</sup>

Enabled setting enables/disables support for gateway in the cluster.
When enabled, the cluster will contain a number of `gateway` servers.

Default Value: `false`

***

### .spec.gateway.image

Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/deployment/v1/deployment_spec_gateway.go#L33)</sup>

Image is the image to use for the gateway.
By default, the image is determined by the operator.

***

Expand Down
1 change: 0 additions & 1 deletion docs/generated/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,4 @@ spec:
WaitForMemberUp: 30m0s

```

[END_INJECT]: # (actionsModYaml)
16 changes: 16 additions & 0 deletions pkg/apis/deployment/v1/deployment_spec_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,20 @@

package v1

import "github.com/arangodb/kube-arangodb/pkg/util"

type DeploymentSpecGateway struct {
// Enabled setting enables/disables support for gateway in the cluster.
// When enabled, the cluster will contain a number of `gateway` servers.
// +doc/default: false
Enabled *bool `json:"enabled,omitempty"`

// Image is the image to use for the gateway.
// By default, the image is determined by the operator.
Image *string `json:"image"`
}

// IsEnabled returns whether the gateway is enabled.
func (d *DeploymentSpecGateway) IsEnabled() bool {
if d == nil || d.Enabled == nil {
return false
Expand All @@ -32,6 +42,12 @@ func (d *DeploymentSpecGateway) IsEnabled() bool {
return *d.Enabled
}

// Validate the given spec
func (d *DeploymentSpecGateway) Validate() error {
return nil
}

// GetImage returns the image to use for the gateway.
func (d *DeploymentSpecGateway) GetImage() string {
return util.TypeOrDefault[string](d.Image)
}
5 changes: 5 additions & 0 deletions pkg/apis/deployment/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion pkg/apis/deployment/v2alpha1/deployment_spec_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@

package v2alpha1

import "github.com/arangodb/kube-arangodb/pkg/util"

type DeploymentSpecGateway struct {
Enabled *bool `json:"enabled,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Image *string `json:"image"`
}

func (d *DeploymentSpecGateway) IsEnabled() bool {
Expand All @@ -35,3 +38,7 @@ func (d *DeploymentSpecGateway) IsEnabled() bool {
func (d *DeploymentSpecGateway) Validate() error {
return nil
}

func (d *DeploymentSpecGateway) GetImage() string {
return util.TypeOrDefault[string](d.Image)
}
5 changes: 5 additions & 0 deletions pkg/apis/deployment/v2alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions pkg/crd/crds/database-deployment.schema.generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6568,7 +6568,15 @@ v1:
description: Gateway defined main Gateway configuration.
properties:
enabled:
description: |-
Enabled setting enables/disables support for gateway in the cluster.
When enabled, the cluster will contain a number of `gateway` servers.
type: boolean
image:
description: |-
Image is the image to use for the gateway.
By default, the image is determined by the operator.
type: string
type: object
gateways:
description: Gateways contain specification for Gateway pods running in deployment mode `Single` or `Cluster`.
Expand Down Expand Up @@ -22587,7 +22595,15 @@ v1alpha:
description: Gateway defined main Gateway configuration.
properties:
enabled:
description: |-
Enabled setting enables/disables support for gateway in the cluster.
When enabled, the cluster will contain a number of `gateway` servers.
type: boolean
image:
description: |-
Image is the image to use for the gateway.
By default, the image is determined by the operator.
type: string
type: object
gateways:
description: Gateways contain specification for Gateway pods running in deployment mode `Single` or `Cluster`.
Expand Down Expand Up @@ -38607,6 +38623,8 @@ v2alpha1:
properties:
enabled:
type: boolean
image:
type: string
type: object
gateways:
description: Gateways contain specification for Gateway pods running in deployment mode `Single` or `Cluster`.
Expand Down
3 changes: 3 additions & 0 deletions pkg/deployment/resources/pod_creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@ func (r *Resources) RenderPodForMember(ctx context.Context, acs sutil.ACS, spec
}
case api.ServerGroupTypeGateway:
imageInfo.Image = r.context.GetOperatorImage()
if spec.Gateway.GetImage() != "" {
imageInfo.Image = spec.Gateway.GetImage()
}

podCreator = &MemberGatewayPod{
podName: podName,
Expand Down

0 comments on commit 8264471

Please sign in to comment.