server_params_runtime

command
v5.1.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

README

HAProxy

Generator for: models/server_params_prepare_for_runtime.go

This genetator generates a file that will contains the needed functions to prepare a ServerParams to use in combination with add server command on the runtime socket.

This file will contain 3 functions:

func (p *ServerParams) prepareForRuntimeDoNotSendDisabledFields()
func (p *ServerParams) prepareForRuntimeDoNotSendEnabledFields()
func (p *ServerParams) PrepareFieldsForRuntimeAddServer()

They are used for example in Ingress Controller the following way:

params.PrepareFieldsForRuntimeAddServer()
serverParams := configuration.SerializeServerParams(defaultServer.ServerParams)
res := cp_params.ServerOptionsString(serverParams)
func (p *ServerParams) prepareForRuntimeDoNotSendDisabledFields()

For example for Check that has the values [enabled disabled].

  • if the value is enabled we must send add server check
  • if the value is disabled we must not send add server no-check as no-check is not allowed on a dynamic server

no-check is the default value.

The purpose is to set Check to "" when the value was disabled so the commands sent are:

  • add server check if value is enabled
  • add server if value is disabled
func (p *ServerParams) prepareForRuntimeDoNotSendEnabledFields()

It's just the opposite.

For example for NoSslv3

  • if enabled we must send no-sslv3
  • if disabled we must not sent an option
func (p *ServerParams) PrepareFieldsForRuntimeAddServer()`

is just calling both PrepareForRuntimeDoNotSendDisabledFields and PrepareForRuntimeDoNotSendEnabledFields

WHAT TO DO

Just fill in server_params_prepare_for_runtime.go the map:

  • ServerParamsPrepareForRuntimeMap

for each field that has an // Enum: [enabled disabled]" with the correct function to use

Ensure that the map is always filled in a field is added into ServerParams: CI check

The generator checks all fields in ServerParams that have // Enum: [enabled disabled]" have an entry in the ServerParamsPrepareForRuntimeMap.

If a new field is added and not declared in ServerParamsPrepareForRuntimeMap, the generator fails with an error and this will make the CI fail.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL