Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes for unsupported partitions field in CRD metadata block #16604

Merged
merged 2 commits into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ spec:
</Tab>

<Tab heading="Consul Enterprise">

For Kubernetes environments, the CRD inherits the partition from the cluster hosting the pods.
trujillo-adam marked this conversation as resolved.
Show resolved Hide resolved

<CodeTabs tabs={[ "HCL", "Kubernetes YAML", "JSON" ]}>

```hcl
Expand Down Expand Up @@ -117,7 +120,6 @@ kind: IngressGateway
metadata:
name: <name for the gateway>
namespace: <namespace containing the gateway>
partition: <partition containing the gateway namespace>

spec:
listeners:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ The following outline shows how to format the service splitter configuration ent
- [`metadata`](#metadata): map | no default
- [`name`](#name): string | no default
- [`namespace`](#namespace): string | no default | <EnterpriseAlert inline />
- [`partition`](#partition): string | no default | <EnterpriseAlert inline />
- [`spec`](#spec): map | no default
- [`protocol`](#protocol): string | default: `tcp`
- [`balanceInboundConnections`](#balanceinboundconnections): string | no default
Expand Down Expand Up @@ -239,7 +238,6 @@ kind: ServiceDefaults
metadata:
name: <name of the service you are configuring>
namespace: <Consul Enterprise namespace>
partition: <Consul Enterprise admin partition>
spec:
protocol: tcp
balanceInboundConnnections: exact_balance
Expand Down Expand Up @@ -802,13 +800,6 @@ Specifies the Consul namespace that the configuration entry applies to. Refer to
- Default: `default`
- Data type: string

### `metadata.partition` <Enterprise/>

Specifies the name of the name of the Consul admin partition that the configuration entry applies to. Refer to [Consul Enterprise](/consul/docs/k8s/crds#consul-enterprise) for information about how Consul Enterprise on Kubernetes. Consul OSS distributions ignore the `metadata.partition` configuration.

- Default: `default`
- Data type: string

### `spec`

Map that contains the details about the `ServiceDefaults` configuration entry. The `apiVersion`, `kind`, and `metadata` fields are siblings of the `spec` field. All other configurations are children.
Expand Down
86 changes: 85 additions & 1 deletion website/content/docs/services/usage/define-services.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ You must tell Consul about the services deployed to your network if you want the

You can define multiple services individually using `service` blocks or group multiple services into the same `services` configuration block. Refer to [Define multiple services in a single file](#define-multiple-services-in-a-single-file) for additional information.

If Consul service mesh is enabled in your network, you can use the `service-defaults` configuration entry to specify default global values for services. The configuraiton entry lets you define common service parameter, such as upstreams, namespaces, and partitions. Refer to [Define service defaults](#define-service-defaults) for additional information.
If Consul service mesh is enabled in your network, you can use the [service defaults configuration entry](/consul/docs/connect/config-entries/service-defaults) to specify default global values for services. The configuration entry lets you define common service parameter, such as upstreams, namespaces, and partitions. Refer to [Define service defaults](#define-service-defaults) for additional information.

## Requirements

Expand Down Expand Up @@ -145,6 +145,9 @@ If Consul service mesh is enabled in your network, you can define default values

Create a file for the configuration entry and specify the required fields. If you are authoring `service-defaults` in HCL or JSON, the `Kind` and `Name` fields are required. On Kubernetes, the `apiVersion`, `kind`, and `metadata.name` fields are required. Refer to [Service Defaults Reference](/consul/docs/connect/config-entries/service-defaults) for details about the configuration options.

If you use Consul Enterprise, you can also specify the `Namespace` and `Partition` fields to apply the configuration to services in specific network areas. In Kubernetes environments, For Kubernetes environments, the CRD inherits the partition from the cluster hosting the pods.
trujillo-adam marked this conversation as resolved.
Show resolved Hide resolved

### Consul OSS example
The following example instructs services named `counting` to send up to `512` concurrent requests to a mesh gateway:

<CodeTabs tabs={[ "HCL", "Kubernetes YAML", "JSON" ]}>
Expand Down Expand Up @@ -222,6 +225,87 @@ spec:
```
</CodeTabs>

### Consul Enterprise example
The following example instructs services named `counting` in the `prod` namespace to send up to `512` concurrent requests to a mesh gateway:

<CodeTabs tabs={[ "HCL", "Kubernetes YAML", "JSON" ]}>

```hcl
Kind = "service-defaults"
Name = "counting"
Namespace = "prod"

UpstreamConfig = {
Defaults = {
MeshGateway = {
Mode = "local"
}
Limits = {
MaxConnections = 512
MaxPendingRequests = 512
MaxConcurrentRequests = 512
}
}

Overrides = [
{
Name = "dashboard"
MeshGateway = {
Mode = "remote"
}
}
]
}
```
```yaml
apiVersion: consul.hashicorp.com/v1alpha1
kind: ServiceDefaults
metadata:
name: counting
namespace: prod
spec:
upstreamConfig:
defaults:
meshGateway:
mode: local
limits:
maxConnections: 512
maxPendingRequests: 512
maxConcurrentRequests: 512
overrides:
- name: dashboard
meshGateway:
mode: remote
```
```json
{
"Kind": "service-defaults",
"Name": "counting",
"Namespace" : "prod",
"UpstreamConfig": {
"Defaults": {
"MeshGateway": {
"Mode": "local"
},
"Limits": {
"MaxConnections": 512,
"MaxPendingRequests": 512,
"MaxConcurrentRequests": 512
}
},
"Overrides": [
{
"Name": "dashboard",
"MeshGateway": {
"Mode": "remote"
}
}
]
}
}
```
</CodeTabs>

### Apply service defaults

You can apply your `service-defaults` configuration entry using the [`consul config` command](/consul/commands/config) or by calling the [`/config` API endpoint](/consul/api-docs/config). In Kubernetes environments, apply the `service-defaults` custom resource definitions (CRD) to implement and manage Consul configuration entries.
Expand Down