Skip to content

Commit 2336956

Browse files
committed
pull main
2 parents 9da3048 + 9e6226a commit 2336956

30 files changed

+365
-107
lines changed

helm/polaris/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ A Helm chart for Apache Polaris (incubating).
4848

4949
### Optional
5050

51-
When using EclipseLink backed metastore a custom `persistence.xml` is required, a Kubernetes Secret must be created for it. Below is a sample command:
51+
When using a custom `persistence.xml`, a Kubernetes Secret must be created for it. Below is a sample command:
5252
```bash
5353
kubectl create secret generic polaris-secret -n polaris --from-file=persistence.xml
5454
```
@@ -67,7 +67,7 @@ helm unittest helm/polaris
6767
The below instructions assume Kind and Helm are installed.
6868

6969
Simply run the `run.sh` script from the Polaris repo root, making sure to specify the
70-
`--eclipse-link-deps` if using EclipseLink backed metastore, option:
70+
`--eclipse-link-deps` option:
7171

7272
```bash
7373
./run.sh
@@ -186,8 +186,8 @@ kubectl delete namespace polaris
186186

187187
## Values
188188

189-
Key | Type | Default | Description |
190-
|-----|------|-----|-------------|
189+
| Key | Type | Default | Description |
190+
|-----|------|---------|-------------|
191191
| advancedConfig | object | `{}` | Advanced configuration. You can pass here any valid Polaris or Quarkus configuration property. Any property that is defined here takes precedence over all the other configuration values generated by this chart. Properties can be passed "flattened" or as nested YAML objects (see examples below). Note: values should be strings; avoid using numbers, booleans, or other types. |
192192
| affinity | object | `{}` | Affinity and anti-affinity for polaris pods. See https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity. |
193193
| authentication | object | `{"authenticator":{"type":"default"},"tokenBroker":{"maxTokenGeneration":"PT1H","secret":{"name":null,"privateKey":"private.pem","publicKey":"public.pem","secretKey":"secret"},"type":"rsa-key-pair"},"tokenService":{"type":"default"}}` | Polaris authentication configuration. |
@@ -343,4 +343,4 @@ kubectl delete namespace polaris
343343
| tracing.attributes | object | `{}` | Resource attributes to identify the polaris service among other tracing sources. See https://opentelemetry.io/docs/reference/specification/resource/semantic_conventions/#service. If left empty, traces will be attached to a service named "Apache Polaris"; to change this, provide a service.name attribute here. |
344344
| tracing.enabled | bool | `false` | Specifies whether tracing for the polaris server should be enabled. |
345345
| tracing.endpoint | string | `"http://otlp-collector:4317"` | The collector endpoint URL to connect to (required). The endpoint URL must have either the http:// or the https:// scheme. The collector must talk the OpenTelemetry protocol (OTLP) and the port must be its gRPC port (by default 4317). See https://quarkus.io/guides/opentelemetry for more information. |
346-
| tracing.sample | string | `"1.0d"` | Which requests should be sampled. Valid values are: "all", "none", or a ratio between 0.0 and "1.0d" (inclusive). E.g. "0.5d" means that 50% of the requests will be sampled. Note: avoid entering numbers here, always prefer a string representation of the ratio. |
346+
| tracing.sample | string | `"1.0d"` | Which requests should be sampled. Valid values are: "all", "none", or a ratio between 0.0 and "1.0d" (inclusive). E.g. "0.5d" means that 50% of the requests will be sampled. Note: avoid entering numbers here, always prefer a string representation of the ratio. |

helm/polaris/templates/configmap.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ data:
3636
{{- $_ = set $map "polaris.realm-context.realms" (join "," .Values.realmContext.realms) -}}
3737
3838
{{- /* Features */ -}}
39-
{{- range $k, $v := .Values.features.defaults -}}
40-
{{- $_ = set $map (printf "polaris.features.defaults.\"%s\"" $k) (toJson $v) -}}
39+
{{- range $k, $v := .Values.features -}}
40+
{{- $_ = set $map (printf "polaris.features.\"%s\"" $k) (toJson $v) -}}
4141
{{- end -}}
4242
{{- range $realm, $overrides := .Values.features.realmOverrides -}}
4343
{{- range $k, $v := $overrides -}}
44-
{{- $_ = set $map (printf "polaris.config.realm-overrides.\"%s\".\"%s\"" $realm $k) (toJson $v) -}}
44+
{{- $_ = set $map (printf "polaris.features.realm-overrides.\"%s\".\"%s\"" $realm $k) (toJson $v) -}}
4545
{{- end -}}
4646
{{- end -}}
4747

helm/polaris/tests/configmap_test.yaml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,18 @@ tests:
8989
- it: should configure features
9090
set:
9191
features:
92-
defaults:
93-
feature1: true
94-
feature2: 42
92+
feature1: true
93+
feature2: 42
9594
realmOverrides:
9695
realm1:
9796
feature1: false
9897
realm2:
9998
feature2: 43
10099
asserts:
101-
- matchRegex: { path: 'data["application.properties"]', pattern: "polaris.features.defaults.\"feature1\"=true" }
102-
- matchRegex: { path: 'data["application.properties"]', pattern: "polaris.features.defaults.\"feature2\"=42" }
103-
- matchRegex: { path: 'data["application.properties"]', pattern: "polaris.config.realm-overrides.\"realm1\".\"feature1\"=false" }
104-
- matchRegex: { path: 'data["application.properties"]', pattern: "polaris.config.realm-overrides.\"realm2\".\"feature2\"=43" }
100+
- matchRegex: { path: 'data["application.properties"]', pattern: "polaris.features.\"feature1\"=true" }
101+
- matchRegex: { path: 'data["application.properties"]', pattern: "polaris.features.\"feature2\"=42" }
102+
- matchRegex: { path: 'data["application.properties"]', pattern: "polaris.features.realm-overrides.\"realm1\".\"feature1\"=false" }
103+
- matchRegex: { path: 'data["application.properties"]', pattern: "polaris.features.realm-overrides.\"realm2\".\"feature2\"=43" }
105104

106105
- it: should configure persistence
107106
set:

polaris-core/src/main/java/org/apache/polaris/core/config/PolarisConfiguration.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,17 @@ public Builder<T> catalogConfigUnsafe(String catalogConfig) {
177177
return this;
178178
}
179179

180-
public FeatureConfiguration<T> buildFeatureConfiguration() {
180+
private void validateOrThrow() {
181181
if (key == null || description == null || defaultValue == null) {
182182
throw new IllegalArgumentException("key, description, and defaultValue are required");
183183
}
184+
if (key.contains(".")) {
185+
throw new IllegalArgumentException("key cannot contain `.`");
186+
}
187+
}
188+
189+
public FeatureConfiguration<T> buildFeatureConfiguration() {
190+
validateOrThrow();
184191
FeatureConfiguration<T> config =
185192
new FeatureConfiguration<>(
186193
key, description, defaultValue, catalogConfig, catalogConfigUnsafe);
@@ -189,9 +196,7 @@ public FeatureConfiguration<T> buildFeatureConfiguration() {
189196
}
190197

191198
public BehaviorChangeConfiguration<T> buildBehaviorChangeConfiguration() {
192-
if (key == null || description == null || defaultValue == null) {
193-
throw new IllegalArgumentException("key, description, and defaultValue are required");
194-
}
199+
validateOrThrow();
195200
if (catalogConfig.isPresent() || catalogConfigUnsafe.isPresent()) {
196201
throw new IllegalArgumentException(
197202
"catalog configs are not valid for behavior change configs");

polaris-core/src/main/java/org/apache/polaris/core/persistence/BasePersistence.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,6 @@ Page<EntityNameLookupRecord> listEntities(
311311
* @param catalogId catalog id for that entity, NULL_ID if the entity is top-level
312312
* @param parentId id of the parent, can be the special 0 value representing the root entity
313313
* @param entityType type of entities to list
314-
* @param limit the max number of items to return
315314
* @param entityFilter the filter to be applied to each entity. Only entities where the predicate
316315
* returns true are returned in the list
317316
* @param transformer the transformation function applied to the {@link PolarisBaseEntity} before

quarkus/defaults/src/main/resources/application-it.properties

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ polaris.persistence.type=in-memory
3131

3232
polaris.secrets-manager.type=in-memory
3333

34-
polaris.features.defaults."ALLOW_EXTERNAL_CATALOG_CREDENTIAL_VENDING"=false
35-
polaris.features.defaults."ALLOW_EXTERNAL_METADATA_FILE_LOCATION"=false
36-
polaris.features.defaults."ALLOW_OVERLAPPING_CATALOG_URLS"=true
37-
polaris.features.defaults."ALLOW_SPECIFYING_FILE_IO_IMPL"=true
38-
polaris.features.defaults."ALLOW_WILDCARD_LOCATION"=true
39-
polaris.features.defaults."ENFORCE_PRINCIPAL_CREDENTIAL_ROTATION_REQUIRED_CHECKING"=true
40-
polaris.features.defaults."INITIALIZE_DEFAULT_CATALOG_FILEIO_FOR_it"=true
41-
polaris.features.defaults."SKIP_CREDENTIAL_SUBSCOPING_INDIRECTION"=true
42-
polaris.features.defaults."SUPPORTED_CATALOG_STORAGE_TYPES"=["FILE","S3","GCS","AZURE"]
43-
polaris.features.defaults."ENABLE_CATALOG_FEDERATION"=true
34+
polaris.features."ALLOW_EXTERNAL_CATALOG_CREDENTIAL_VENDING"=false
35+
polaris.features."ALLOW_EXTERNAL_METADATA_FILE_LOCATION"=false
36+
polaris.features."ALLOW_OVERLAPPING_CATALOG_URLS"=true
37+
polaris.features."ALLOW_SPECIFYING_FILE_IO_IMPL"=true
38+
polaris.features."ALLOW_WILDCARD_LOCATION"=true
39+
polaris.features."ENFORCE_PRINCIPAL_CREDENTIAL_ROTATION_REQUIRED_CHECKING"=true
40+
polaris.features."INITIALIZE_DEFAULT_CATALOG_FILEIO_FOR_it"=true
41+
polaris.features."SKIP_CREDENTIAL_SUBSCOPING_INDIRECTION"=true
42+
polaris.features."SUPPORTED_CATALOG_STORAGE_TYPES"=["FILE","S3","GCS","AZURE"]
43+
polaris.features."ENABLE_CATALOG_FEDERATION"=true
4444

4545
polaris.realm-context.realms=POLARIS,OTHER
4646

quarkus/defaults/src/main/resources/application.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ polaris.realm-context.realms=POLARIS
108108
polaris.realm-context.header-name=Polaris-Realm
109109
polaris.realm-context.require-header=false
110110

111-
polaris.features.defaults."ENFORCE_PRINCIPAL_CREDENTIAL_ROTATION_REQUIRED_CHECKING"=false
112-
polaris.features.defaults."SUPPORTED_CATALOG_STORAGE_TYPES"=["S3","GCS","AZURE"]
113-
# polaris.features.defaults."ENABLE_CATALOG_FEDERATION"=true
114-
polaris.features.defaults."SUPPORTED_CATALOG_CONNECTION_TYPES"=["ICEBERG_REST"]
111+
polaris.features."ENFORCE_PRINCIPAL_CREDENTIAL_ROTATION_REQUIRED_CHECKING"=false
112+
polaris.features."SUPPORTED_CATALOG_STORAGE_TYPES"=["S3","GCS","AZURE"]
113+
# polaris.features."ENABLE_CATALOG_FEDERATION"=true
114+
polaris.features."SUPPORTED_CATALOG_CONNECTION_TYPES"=["ICEBERG_REST"]
115115

116116
# realm overrides
117117
# polaris.features.realm-overrides."my-realm"."INITIALIZE_DEFAULT_CATALOG_FILEIO_FOR_TEST"=true

quarkus/service/src/main/java/org/apache/polaris/service/quarkus/config/QuarkusBehaviorChangesConfiguration.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.fasterxml.jackson.databind.JsonNode;
2323
import com.fasterxml.jackson.databind.ObjectMapper;
2424
import io.smallrye.config.ConfigMapping;
25+
import io.smallrye.config.WithParentName;
2526
import java.util.ArrayList;
2627
import java.util.HashMap;
2728
import java.util.List;
@@ -33,9 +34,16 @@
3334
// QuarkusFeaturesConfiguration
3435
public interface QuarkusBehaviorChangesConfiguration {
3536

37+
@WithParentName
3638
Map<String, String> defaults();
3739

38-
Map<String, ? extends FeaturesConfiguration.RealmOverrides> realmOverrides();
40+
Map<String, ? extends QuarkusRealmOverrides> realmOverrides();
41+
42+
interface QuarkusRealmOverrides extends FeaturesConfiguration.RealmOverrides {
43+
@WithParentName
44+
@Override
45+
Map<String, String> overrides();
46+
}
3947

4048
default Map<String, Object> parseDefaults(ObjectMapper objectMapper) {
4149
return convertMap(objectMapper, defaults());

quarkus/service/src/main/java/org/apache/polaris/service/quarkus/config/QuarkusFeaturesConfiguration.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,23 @@
1919
package org.apache.polaris.service.quarkus.config;
2020

2121
import io.smallrye.config.ConfigMapping;
22+
import io.smallrye.config.WithParentName;
2223
import java.util.Map;
2324
import org.apache.polaris.service.config.FeaturesConfiguration;
2425

2526
@ConfigMapping(prefix = "polaris.features")
2627
public interface QuarkusFeaturesConfiguration extends FeaturesConfiguration {
2728

29+
@WithParentName
2830
@Override
2931
Map<String, String> defaults();
3032

3133
@Override
32-
Map<String, FeaturesConfiguration.RealmOverrides> realmOverrides();
34+
Map<String, QuarkusRealmOverrides> realmOverrides();
35+
36+
interface QuarkusRealmOverrides extends RealmOverrides {
37+
@WithParentName
38+
@Override
39+
Map<String, String> overrides();
40+
}
3341
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.polaris.service.quarkus.config;
20+
21+
import jakarta.annotation.Priority;
22+
import jakarta.enterprise.context.ApplicationScoped;
23+
import jakarta.enterprise.inject.Alternative;
24+
import java.util.Map;
25+
import java.util.stream.Collectors;
26+
27+
/**
28+
* Wraps around {@link QuarkusBehaviorChangesConfiguration} but removes properties from `defaults`
29+
* that shouldn't be there
30+
*/
31+
@ApplicationScoped
32+
@Alternative
33+
@Priority(1)
34+
public class QuarkusResolvedBehaviorChangesConfiguration
35+
implements QuarkusBehaviorChangesConfiguration {
36+
37+
private final Map<String, String> cleanedDefaults;
38+
private final Map<String, ? extends QuarkusBehaviorChangesConfiguration.QuarkusRealmOverrides>
39+
realmOverrides;
40+
41+
public QuarkusResolvedBehaviorChangesConfiguration(QuarkusBehaviorChangesConfiguration raw) {
42+
this.realmOverrides = raw.realmOverrides();
43+
44+
// Filter out any keys that look like realm overrides
45+
this.cleanedDefaults =
46+
raw.defaults().entrySet().stream()
47+
.filter(e -> e.getKey().split("\\.").length == 1)
48+
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
49+
}
50+
51+
@Override
52+
public Map<String, String> defaults() {
53+
return cleanedDefaults;
54+
}
55+
56+
@Override
57+
public Map<String, ? extends QuarkusBehaviorChangesConfiguration.QuarkusRealmOverrides>
58+
realmOverrides() {
59+
return realmOverrides;
60+
}
61+
}

0 commit comments

Comments
 (0)