diff --git a/README.md b/README.md index f3aa814..712697f 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,8 @@ Kusk currently supports (click for configuration options) - [Ambassador 2.0](https://kubeshop.github.io/kusk/ambassador2/) - **Warning** This is a developer preview and should be treated as unstable - [Linkerd](https://kubeshop.github.io/kusk/linkerd/) -- [Nginx-Ingress](https://kubeshop.github.io/kusk/nginx-ingress/) +- [Ingress-Nginx](https://kubeshop.github.io/kusk/ingress-nginx/) + - This generator refers to the community ingress from [Kubernetes ingress-nginx](https://github.com/kubernetes/ingress-nginx/) - [Traefik V2 (v2.x)](https://kubeshop.github.io/kusk/traefik/) Some of the upcoming tools we'd like to support are Kong and Contour. Please don't hesitate to diff --git a/cluster/cluster.go b/cluster/cluster.go index 74e6618..15307ff 100644 --- a/cluster/cluster.go +++ b/cluster/cluster.go @@ -111,7 +111,7 @@ func (c *Client) DetectNginxIngress() (bool, error) { } if !errors.IsNotFound(err) { - return false, fmt.Errorf("error fetching nginx-ingress deployments: %w", err) + return false, fmt.Errorf("error fetching ingress-nginx deployments: %w", err) } return false, nil diff --git a/docs/getting-started.md b/docs/getting-started.md index d746ab2..111fec0 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -32,7 +32,7 @@ Available Commands: completion generate the autocompletion script for the specified shell help Help about any command linkerd Generates Linkerd Service Profiles for your service - nginx-ingress Generates nginx-ingress resources + ingress-nginx Generates ingress-nginx resources traefik Generates Traefik resources wizard Connects to current Kubernetes cluster and lists available generators diff --git a/docs/nginx-ingress.md b/docs/ingress-nginx.md similarity index 95% rename from docs/nginx-ingress.md rename to docs/ingress-nginx.md index e96d65b..b622a47 100644 --- a/docs/nginx-ingress.md +++ b/docs/ingress-nginx.md @@ -1,10 +1,12 @@ # Nginx Ingress +**Note** This generator refers to the community ingress from [Kubernetes ingress-nginx](https://github.com/kubernetes/ingress-nginx/) + ```bash -kusk nginx-ingress +kusk ingress-nginx Usage: - kusk nginx-ingress [flags] + kusk ingress-nginx [flags] Flags: -i, --in string file path to api spec file to generate mappings from. e.g. --in apispec.yaml @@ -17,10 +19,10 @@ Flags: --nginx_ingress.rewrite_target string a custom NGINX rewrite target --path.base string a base path for Service endpoints (default "/") --path.trim_prefix string a prefix to trim from the URL before forwarding to the upstream Service - -h, --help help for nginx-ingress + -h, --help help for ingress-nginx ``` -The nginx-ingress generator generates [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/#the-ingress-resource) +The ingress-nginx generator generates [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/#the-ingress-resource) resources for exposing HTTP and HTTPS routes from outside the cluster to services within the cluster. All options that can be set via flags can also be set using our `x-kusk` OpenAPI extension in your specification. @@ -55,7 +57,7 @@ To override settings on the path or HTTP method level, you are required to use t ## Basic Usage ### CLI Flags ```shell -kusk nginx-ingress -i examples/booksapp/booksapp.yaml \ +kusk ingress-nginx -i examples/booksapp/booksapp.yaml \ --namespace my-namespace \ --service.name webapp \ --service.port 7000 \ @@ -108,7 +110,7 @@ provided OpenAPI specification ### CLI Flags ```shell -kusk nginx-ingress -i examples/booksapp/booksapp.yaml \ +kusk ingress-nginx -i examples/booksapp/booksapp.yaml \ --namespace my-namespace \ --service.name booksapp \ --service.port 7000 \ @@ -191,7 +193,7 @@ request onto the service. ### CLI Flags ```shell -kusk nginx-ingress -i examples/booksapp/booksapp.yaml \ +kusk ingress-nginx -i examples/booksapp/booksapp.yaml \ --namespace my-namespace \ --service.name webapp \ --service.port 7000 \ @@ -249,7 +251,7 @@ status: ## Setting the rewrite target ### CLI Flags ```shell -kusk nginx-ingress -i examples/booksapp/booksapp.yaml \ +kusk ingress-nginx -i examples/booksapp/booksapp.yaml \ --namespace my-namespace \ --service.name webapp \ --service.port 7000 \ @@ -304,7 +306,7 @@ status: ## Setting the Host ### CLI Flags ```shell -kusk nginx-ingress -i examples/booksapp/booksapp.yaml \ +kusk ingress-nginx -i examples/booksapp/booksapp.yaml \ --namespace my-namespace \ --service.name webapp \ --service.port 7000 \ @@ -357,13 +359,13 @@ status: ## Setting timeouts kusk allows for setting a request timeout via flags or the x-kusk OpenAPI extension -The nginx-ingress generator will spread the total request time over the following settings, diving it by 2 +The ingress-nginx generator will spread the total request time over the following settings, diving it by 2 - `nginx.ingress.kubernetes.io/proxy-send-timeout` - `nginx.ingress.kubernetes.io/proxy-read-timeout` ### CLI Flags ```shell -kusk nginx-ingress -i examples/booksapp/booksapp.yaml \ +kusk ingress-nginx -i examples/booksapp/booksapp.yaml \ --namespace my-namespace \ --service.name webapp \ --service.port 7000 \ @@ -420,7 +422,7 @@ status: ## CORS Via the x-kusk extension, you can set cors policies on your resources. -Due to a limitation of the nginx-ingress controller, we can only choose a single origin (the first one) +Due to a limitation of the ingress-nginx controller, we can only choose a single origin (the first one) from `cors.origins`. Kusk logs a warning informing you of this. ### OpenAPI Specification diff --git a/docs/openapi-extension.md b/docs/openapi-extension.md index b09c220..ba82073 100644 --- a/docs/openapi-extension.md +++ b/docs/openapi-extension.md @@ -8,7 +8,7 @@ within the `x-kusk` extension. The extension can be specified at the root, path The following top-level properties are available: -| property | root | path | operation | [Amb 1.X](ambassador.md) | [Amb 2.X](ambassador2.md) | [LinkerD](linkerd.md) | [Nginx-Ing](nginx-ingress.md) | [Traefik](traefik.md) +| property | root | path | operation | [Amb 1.X](ambassador.md) | [Amb 2.X](ambassador2.md) | [LinkerD](linkerd.md) | [Ing-Nginx](ingress-nginx.md) | [Traefik](traefik.md) | --- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | [`disabled`](#disabled) | X | X | X | X | X | X | X | X | [`host`](#host) | X | X | X | X | X | X | X | X @@ -20,7 +20,7 @@ The following top-level properties are available: | [`path`](#path) | X | | | X | X | X | X | X | [`cluster`](#cluster) | X | | | | | X | | | [`host`](#host) | X | | | | X | | X | X -| [`nginx_ingress`](#nginx-ingress) | X | | | | | | X | +| [`nginx_ingress`](#ingress-nginx) | X | | | | | | X | ### Property Overriding/inheritance @@ -124,9 +124,9 @@ Please see the documentation for each individual generator to see which of these A string specifying an Ingress host rule - see https://kubernetes.io/docs/concepts/services-networking/ingress/#ingress-rules for additional documentation. -### Nginx Ingress +### Ingress Nginx -Options specific to the [Nginx-Ingress controller](nginx-ingress.md) +Options specific to the [ingress-nginx controller](ingress-nginx.md) | Name | Description | | :---: | :--- | diff --git a/examples/petstore/README.md b/examples/petstore/README.md index c00a43b..a23e1d7 100644 --- a/examples/petstore/README.md +++ b/examples/petstore/README.md @@ -74,7 +74,7 @@ EOF kubectl patch deployment ingress-nginx-controller -n ingress-nginx --patch "$(cat ingress.yaml)" # Generate the ingress resource from the specification -go run main.go nginx-ingress -i examples/petstore/petstore.yaml --path.base="/" --service.name "petstore" | kubectl apply -f - +go run main.go ingress-nginx -i examples/petstore/petstore.yaml --path.base="/" --service.name "petstore" | kubectl apply -f - # cURL an api endpoint curl -kLi 'http://localhost:8080/api/v3/pet/findByStatus?status=available' diff --git a/generators/nginx_ingress/annotations.go b/generators/nginx_ingress/annotations.go index 1a452dd..2163655 100644 --- a/generators/nginx_ingress/annotations.go +++ b/generators/nginx_ingress/annotations.go @@ -78,7 +78,7 @@ func (g *Generator) generateAnnotations( if burst := rateLimits.Burst; burst != 0 { // https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#rate-limiting - // nginx-ingress uses a burst multiplier to configure burst for a rate limited path, + // ingress-nginx uses a burst multiplier to configure burst for a rate limited path, // i.e. burst = rps * burstMultiplier var burstMultiplier = burst / rps if burstMultiplier < 1 { diff --git a/generators/nginx_ingress/nginx_ingress.go b/generators/nginx_ingress/nginx_ingress.go index b6d3b1b..76ab1cf 100644 --- a/generators/nginx_ingress/nginx_ingress.go +++ b/generators/nginx_ingress/nginx_ingress.go @@ -33,17 +33,17 @@ var ( ) func init() { - generators.Registry["nginx-ingress"] = &Generator{} + generators.Registry["ingress-nginx"] = &Generator{} } type Generator struct{} func (g *Generator) Cmd() string { - return "nginx-ingress" + return "ingress-nginx" } func (g *Generator) Flags() *pflag.FlagSet { - fs := pflag.NewFlagSet("nginx-ingress", pflag.ExitOnError) + fs := pflag.NewFlagSet("ingress-nginx", pflag.ExitOnError) fs.String( "path.base", @@ -97,7 +97,7 @@ func (g *Generator) Flags() *pflag.FlagSet { } func (g *Generator) ShortDescription() string { - return "Generates nginx-ingress resources" + return "Generates ingress-nginx resources" } func (g *Generator) LongDescription() string { @@ -292,7 +292,7 @@ func (g *Generator) shouldSplit(opts *options.Options, spec *openapi3.T) bool { if ro.Group != "" { log.New(os.Stderr, "WARN", log.Lmsgprefix). - Printf("nginx-ingress does not support rate limit groups. These will be ignored") + Printf("ingress-nginx does not support rate limit groups. These will be ignored") groupUnsupportedWarned = true } @@ -339,7 +339,7 @@ func (g *Generator) shouldSplit(opts *options.Options, spec *openapi3.T) bool { for method := range pathItem.Operations() { if _, ok := opts.OperationSubOptions[method+path]; ok { log.New(os.Stderr, "WARN", log.Lmsgprefix). - Printf("HTTP Method level options detected which nginx-ingress doesn't support. These will be ignored") + Printf("HTTP Method level options detected which ingress-nginx doesn't support. These will be ignored") break // Only need to warn users once } diff --git a/mkdocs.yml b/mkdocs.yml index f98025c..7bd75e4 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -25,7 +25,7 @@ nav: - Ambassador 1.X: ambassador.md - Ambassador 2.X: ambassador2.md - Linkerd: linkerd.md - - Nginx-Ingress: nginx-ingress.md + - Ingress-Nginx: ingress-nginx.md - Traefik: traefik.md - For Developers: development.md diff --git a/wizard/flow/flow.go b/wizard/flow/flow.go index 72d4e67..b0a4bb0 100644 --- a/wizard/flow/flow.go +++ b/wizard/flow/flow.go @@ -70,7 +70,7 @@ func New(args *Args) (Interface, error) { }, nil case "linkerd": return linkerdFlow{baseFlow}, nil - case "nginx-ingress": + case "ingress-nginx": return nginxIngressFlow{baseFlow}, nil case "traefik": return traefikFlow{baseFlow}, nil diff --git a/wizard/wizard.go b/wizard/wizard.go index be2af38..153dc01 100644 --- a/wizard/wizard.go +++ b/wizard/wizard.go @@ -7,11 +7,12 @@ import ( "path/filepath" "github.com/getkin/kin-openapi/openapi3" + "k8s.io/client-go/util/homedir" + "github.com/kubeshop/kusk/cluster" "github.com/kubeshop/kusk/spec" "github.com/kubeshop/kusk/wizard/flow" "github.com/kubeshop/kusk/wizard/prompt" - "k8s.io/client-go/util/homedir" ) func Start(apiSpecPath string, apiSpec *openapi3.T, prompt prompt.Prompter) { @@ -107,8 +108,8 @@ func flowWithCluster(args *flow.Args, kubeConfigPath string) (string, error) { } if nginxIngressFound { - servicesToSuggest = append(servicesToSuggest, "nginx-ingress") - fmt.Fprintln(os.Stderr, "✔ Nginx Ingress installation found") + servicesToSuggest = append(servicesToSuggest, "ingress-nginx") + fmt.Fprintln(os.Stderr, "✔ Ingress Nginx installation found") } if traefikFound { @@ -153,7 +154,7 @@ func flowWithoutCluster(args *flow.Args) (string, error) { []string{ "ambassador", "linkerd", - "nginx-ingress", + "ingress-nginx", "traefik", }, false,