Skip to content

Commit a5998f8

Browse files
committed
Changes
1 parent 11198dc commit a5998f8

File tree

4 files changed

+104
-138
lines changed

4 files changed

+104
-138
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ test-polaris-setup: install ## Start Docker services for Polaris integration tes
129129
docker compose -f dev/docker-compose-polaris.yml kill
130130
docker compose -f dev/docker-compose-polaris.yml rm -f
131131
docker compose -f dev/docker-compose-polaris.yml up -d --build --wait
132-
uv run $(PYTHON_ARG) python dev/provision_polaris.py > dev/polaris_creds.env
132+
./dev/provision_polaris.sh > dev/polaris_creds.env
133133

134134
test-polaris-exec: ## Run Polaris integration tests
135135
@eval $$(cat dev/polaris_creds.env) && \

dev/polaris-bootstrap.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
principals:
19+
pyiceberg_principal:
20+
roles:
21+
- service_admin
22+
- pyiceberg_role
23+
24+
principal_roles:
25+
- pyiceberg_role
26+
27+
catalogs:
28+
- name: "polaris"
29+
storage_type: "s3"
30+
default_base_location: "s3://warehouse/polaris/"
31+
allowed_locations:
32+
- "s3://warehouse/polaris/"
33+
properties:
34+
polaris.config.drop-with-purge.enabled: "true"
35+
region: "us-east-1"
36+
endpoint: "http://minio:9000"
37+
roles:
38+
catalog_admin:
39+
assign_to:
40+
- pyiceberg_role
41+
privileges:
42+
catalog:
43+
- CATALOG_MANAGE_CONTENT
44+
- CATALOG_MANAGE_METADATA
45+
- TABLE_CREATE
46+
- TABLE_WRITE_DATA
47+
- TABLE_LIST
48+
- NAMESPACE_CREATE
49+
- NAMESPACE_LIST

dev/provision_polaris.py

Lines changed: 0 additions & 137 deletions
This file was deleted.

dev/provision_polaris.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
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+
set -e
20+
21+
CONTAINER_NAME="pyiceberg-polaris"
22+
BOOTSTRAP_FILE="dev/polaris-bootstrap.yaml"
23+
# Map local bootstrap file into the container
24+
# Actually, it's easier to just pipe it or use docker cp if needed,
25+
# but we can also just run the command from outside if the CLI is available locally.
26+
# The user said "don't need to uv pip install polaris... that's what the docker stuff is for"
27+
# This implies we should run the polaris command INSIDE the docker container.
28+
29+
echo "Applying Polaris bootstrap configuration..."
30+
# We need to get the file into the container or use a command that can read from stdin if supported.
31+
# Assuming we can cat it to the container.
32+
docker cp $BOOTSTRAP_FILE $CONTAINER_NAME:/tmp/polaris-bootstrap.yaml
33+
34+
docker exec $CONTAINER_NAME polaris \
35+
--host localhost \
36+
--port 8181 \
37+
--client-id root \
38+
--client-secret s3cr3t \
39+
setup apply /tmp/polaris-bootstrap.yaml
40+
41+
echo "Rotating credentials for pyiceberg_principal..."
42+
CREDS_JSON=$(docker exec $CONTAINER_NAME polaris \
43+
--host localhost \
44+
--port 8181 \
45+
--client-id root \
46+
--client-secret s3cr3t \
47+
principals rotate-credentials pyiceberg_principal)
48+
49+
# Extract CLIENT_ID and CLIENT_SECRET using python (since it's already a dependency)
50+
CLIENT_ID=$(echo $CREDS_JSON | python3 -c "import sys, json; print(json.load(sys.stdin)['clientId'])")
51+
CLIENT_SECRET=$(echo $CREDS_JSON | python3 -c "import sys, json; print(json.load(sys.stdin)['clientSecret'])")
52+
53+
echo "CLIENT_ID=$CLIENT_ID"
54+
echo "CLIENT_SECRET=$CLIENT_SECRET"

0 commit comments

Comments
 (0)