Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion documentation/supported-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ const (
GatewayClassConditionStatusAccepted GatewayClassConditionType = "Accepted"
```
-------------------
# Life cycke Gateway API
# Life cycle Gateway API

https://gateway-api.sigs.k8s.io/concepts/versioning/

Expand Down
2 changes: 1 addition & 1 deletion example/http-route/blue-green/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ $ sh test.sh
10 green
```

Note that due to randomness, 9/1 ration might slightly differ
Note that due to randomness, 9/1 ratio might slightly differ
2 changes: 1 addition & 1 deletion hug/configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func (c *HUGConfig) Init(external External) error {
c.CertsDir = filepath.Join(c.HaproxyDirs.CfgDir, config.DefaultCertsDirName)
c.CertListDir = filepath.Join(c.HaproxyDirs.CfgDir, config.DefaultCertFilesDirName)
c.MapsDir = filepath.Join(c.HaproxyDirs.CfgDir, config.DefaultMapsDirName)
c.PatternDir = filepath.Join(c.HaproxyDirs.CfgDir, config.DefaultPattenrDirName)
c.PatternDir = filepath.Join(c.HaproxyDirs.CfgDir, config.DefaultPatternDirName)
c.ErrFileDir = filepath.Join(c.HaproxyDirs.CfgDir, config.DefaultErrFilesDirName)
for _, d := range []string{
c.CertsDir,
Expand Down
6 changes: 3 additions & 3 deletions hug/haproxy/api/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ func (c *clientNative) BackendEdit(backend models.Backend) error {
return err
}

// Check if only Servers were udpated
// Check if only Servers were updated
onlyServersUpdated := false
if cmp.Equal(previousBackend, backend, cmpopts.IgnoreFields(models.Backend{}, "Servers")) {
c.logger.LogAttrs(context.Background(), slog.LevelInfo, "Only Servers are udpated",
c.logger.LogAttrs(context.Background(), slog.LevelInfo, "Only Servers are updated",
slog.String("backend", backend.Name),
)
onlyServersUpdated = true
Expand Down Expand Up @@ -212,7 +212,7 @@ func (c *clientNative) BackendEdit(backend models.Backend) error {
)
}
} else {
// We did not try runtime udpate (server create, for now is NOT done through runtime, it needs a realod)
// We did not try runtime update (server create, for now is NOT done through runtime, it needs a reload)
reload.Instance().SetReload("[onlyServersUpdated] [reload needed] - backend %s", backend.Name)
}
} else {
Expand Down
12 changes: 6 additions & 6 deletions hug/haproxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,16 @@ func (h *AppManagerImpl) processUpdate(updated structured.Structured) error {
var errors utils.Errors

// Frontends
for _, udpatedFE := range updated.Frontends {
if udpatedFE == nil {
for _, updatedFE := range updated.Frontends {
if updatedFE == nil {
// Should not happend
h.logger.LogAttrs(context.Background(), slog.LevelError, "nil frontend")
continue
}
// TODO: need to check if only the Metadata has changed
// If so, no need to reload

err := h.client.FrontendEdit(*udpatedFE)
err := h.client.FrontendEdit(*updatedFE)
if err != nil {
h.logger.LogAttrs(context.Background(), slog.LevelError, "failed to edit frontend",
logging.LogAttrError(err),
Expand All @@ -266,16 +266,16 @@ func (h *AppManagerImpl) processUpdate(updated structured.Structured) error {
}

// Backends
for _, udpatedBE := range updated.Backends {
if udpatedBE == nil {
for _, updatedBE := range updated.Backends {
if updatedBE == nil {
// Should not happend
h.logger.LogAttrs(context.Background(), slog.LevelError, "nil backend")
continue
}
// TODO: need to check if only the Metadata has changed
// If so, no need to reload

err := h.client.BackendEdit(*udpatedBE)
err := h.client.BackendEdit(*updatedBE)
if err != nil {
h.logger.LogAttrs(context.Background(), slog.LevelError, "failed to edit backend",
logging.LogAttrError(err),
Expand Down
4 changes: 2 additions & 2 deletions k8s/gate/config/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const (
DefaultCertFilesDirName = "certlists"
DefaultMapsDirName = "maps"
DefaultErrFilesDirName = "errorfiles"
DefaultPattenrDirName = "patterns"
DefaultPatternDirName = "patterns"
)

func (cfg *Configuration) ApplyDefaults() {
Expand Down Expand Up @@ -91,6 +91,6 @@ func (cfg *Configuration) ApplyDefaults() {
cfg.HaproxyParams.HaproxyDirs.ErrFileDir = DefaultErrFilesDirName
}
if cfg.HaproxyParams.HaproxyDirs.PatternDir == "" {
cfg.HaproxyParams.HaproxyDirs.PatternDir = DefaultPattenrDirName
cfg.HaproxyParams.HaproxyDirs.PatternDir = DefaultPatternDirName
}
}
2 changes: 1 addition & 1 deletion k8s/gate/haproxy/backends.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ func (b *HaproxyConfMgrImpl) mergeWithBackendCRs(backendRef gatewayv1.HTTPBacken
continue
}
// We only accept v3.Backend or MergeType
// Note that MergType is not a real CRD, it's only a way to configure how the merge behaves.
// Note that MergeType is not a real CRD, it's only a way to configure how the merge behaves.
// There is no:
// - Group: gate.v3.haproxy.org
// - Kind: MergeType CRDs
Expand Down
2 changes: 1 addition & 1 deletion k8s/gate/haproxy/certificates.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (b *HaproxyConfMgrImpl) processCertificates() error {
func (b *HaproxyConfMgrImpl) runtimeCertificatesPrechecks() {
crtListUpdates := b.controllerStore.CrtListUpdates
// Crt-list can not be created or deleted through runtime
// So, if there are nay created or deleted crt-lists, we need to reload.
// So, if there are any created or deleted crt-lists, we need to reload.
// No further runtime update needed.
if len(crtListUpdates.Created) > 0 {
buffc := strings.Builder{}
Expand Down
2 changes: 1 addition & 1 deletion k8s/gate/haproxy/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func (c *Configuration) upsertBackendWithServers(logger *slog.Logger, beName str
c.structured.Backends[be.Name] = be

// 2.2- If some servers were deleted, set the server to Maintenance through runtime
// TODO: we also need to check in HUG when we udpate the configuration that if BE differ only by deleted servers...
// TODO: we also need to check in HUG when we update the configuration that if BE differ only by deleted servers...
runtimeServerStateData := make([]RuntimeServerStateData, 0)
for serverName := range deletedServerNames {
runtimeServerStateData = append(runtimeServerStateData, RuntimeServerStateData{
Expand Down
4 changes: 2 additions & 2 deletions k8s/gate/store/cluster-updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ type Update[T client.Object] struct {
NewObject T
Status Status
// Indirect is set to true when the update is not direct from a K8s object but
// from a linked K8s object udpate
// from a linked K8s object update
// For example a GatewayClass referencing a HugGate and the HugGate is updated
Indirect bool
}

// ClusterUpdated contains the udpates that happened to cluster objects during a sync cycle
// ClusterUpdated contains the updates that happened to cluster objects during a sync cycle
type ClusterUpdates struct {
GatewayClasses map[types.NamespacedName]Update[*gatewayv1.GatewayClass]
Gateways map[types.NamespacedName]Update[*gatewayv1.Gateway]
Expand Down
6 changes: 3 additions & 3 deletions test/integration/base/inttest.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (test *IntTest) StartTestEnv(t *testing.T) { //revive:disable:function-leng
g.Expect(err).ToNot(gomega.HaveOccurred())
modifiedCfg = strings.ReplaceAll(modifiedCfg, "/var/run/haproxy/health.sock", path.Join(dir, "health.sock"))
}
err = writeInitalHaproxyCfg(hugConfig.HaproxyDirs.MainCfgFile, modifiedCfg)
err = writeInitialHaproxyCfg(hugConfig.HaproxyDirs.MainCfgFile, modifiedCfg)
g.Expect(err).ToNot(gomega.HaveOccurred())

// Setup Gate lib configuration from HUG binary configuration
Expand Down Expand Up @@ -352,8 +352,8 @@ func WriteKubeconfig(cfg *rest.Config) (string, error) {
return kubeconfigPath, nil
}

// writeInitalHaproxyCfg writes a string to a file at the specified path.
func writeInitalHaproxyCfg(dstFile, content string) error {
// writeInitialHaproxyCfg writes a string to a file at the specified path.
func writeInitialHaproxyCfg(dstFile, content string) error {
// Use os.WriteFile which is a convenience function
// to write a byte slice to a file. It handles opening, writing, and closing.
// We convert the string to a byte slice.
Expand Down
2 changes: 1 addition & 1 deletion test/integration/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func GetIntTestNamespace() (string, error) {
}
dir = filepath.Base(dir)
dir = strings.Map(func(r rune) rune {
if r < 'a' || r > 'z' && r != '-' {
if (r < 'a' || r > 'z') && r != '-' {
return '-'
}
return r
Expand Down