diff --git a/internal/ingress/controller/template/crossplane/crossplane.go b/internal/ingress/controller/template/crossplane/crossplane.go index aab90a752..200e6ec52 100644 --- a/internal/ingress/controller/template/crossplane/crossplane.go +++ b/internal/ingress/controller/template/crossplane/crossplane.go @@ -60,14 +60,12 @@ func NewTemplate() (*Template, error) { ngx_crossplane.MatchHeadersMoreLatest, extramodules.BrotliMatchFn, extramodules.OpentelemetryMatchFn, + extramodules.SetMiscMatchFn, ngx_crossplane.MatchGeoip2Latest, }, LexOptions: ngx_crossplane.LexOptions{ Lexers: []ngx_crossplane.RegisterLexer{lua.RegisterLexer()}, }, - // Modules that needs to be ported: - // // https://github.com/openresty/set-misc-nginx-module?tab=readme-ov-file#set_escape_uri - IgnoreDirectives: []string{"set_escape_uri"}, } return &Template{ diff --git a/internal/ingress/controller/template/crossplane/extramodules/opentelemetry.go b/internal/ingress/controller/template/crossplane/extramodules/opentelemetry.go index f3a9cde9a..a0039d6fd 100644 --- a/internal/ingress/controller/template/crossplane/extramodules/opentelemetry.go +++ b/internal/ingress/controller/template/crossplane/extramodules/opentelemetry.go @@ -14,13 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -/** - * Copyright (c) F5, Inc. - * - * This source code is licensed under the Apache License, Version 2.0 license found in the - * LICENSE file in the root directory of this source tree. - */ - // Code generated by generator; DO NOT EDIT. // All the definitions are extracted from the source code // Each bit mask describes these behaviors: diff --git a/internal/ingress/controller/template/crossplane/extramodules/setmisc.go b/internal/ingress/controller/template/crossplane/extramodules/setmisc.go new file mode 100644 index 000000000..ab39ec5e8 --- /dev/null +++ b/internal/ingress/controller/template/crossplane/extramodules/setmisc.go @@ -0,0 +1,61 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by generator; DO NOT EDIT. +// All the definitions are extracted from the source code +// Each bit mask describes these behaviors: +// - how many arguments the directive can take +// - whether or not it is a block directive +// - whether this is a flag (takes one argument that's either "on" or "off") +// - which contexts it's allowed to be in + +package extramodules + +var setMiscDirectives = map[string][]uint{ + "set_base32_alphabet": { + ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPSifConf | ngxHTTPLocConf | ngxHTTPLifConf | ngxConfTake1, + }, + "set_base32_padding": { + ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPSifConf | ngxHTTPLocConf | ngxHTTPLifConf | ngxConfFlag, + }, + "set_decode_base32": { + ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPSifConf | ngxHTTPLocConf | ngxHTTPLifConf | ngxConfTake12, + }, + "set_encode_base32": { + ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPSifConf | ngxHTTPLocConf | ngxHTTPLifConf | ngxConfTake12, + }, + "set_formatted_gmt_time": { + ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPSifConf | ngxHTTPLocConf | ngxHTTPLifConf | ngxConfTake2, + }, + "set_formatted_local_time": { + ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPSifConf | ngxHTTPLocConf | ngxHTTPLifConf | ngxConfTake2, + }, + "set_hashed_upstream": { + ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPSifConf | ngxHTTPLocConf | ngxHTTPLifConf | ngxConfTake3, + }, + "set_local_today": { + ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPSifConf | ngxHTTPLocConf | ngxHTTPLifConf | ngxConfTake1, + }, + "set_misc_base32_padding": { + ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPSifConf | ngxHTTPLocConf | ngxHTTPLifConf | ngxConfFlag, + }, +} + + +func SetMiscMatchFn(directive string) ([]uint, bool) { + m, ok := setMiscDirectives[directive] + return m, ok +}