Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e84510b

Browse files
Map builder command options (itayankri#97)
* adjust map-builder script * adjust job resource builder * fix * fix * adjust built-in map-builder workload
1 parent 4e8079b commit e84510b

File tree

7 files changed

+68
-28
lines changed

7 files changed

+68
-28
lines changed

‎api/v1alpha1/osrmcluster_types.go‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,11 @@ func (spec *ProfileSpec) GetInternalEndpoint() string {
141141
}
142142

143143
type MapBuilderSpec struct {
144-
Image *string `json:"image,omitempty"`
145-
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
144+
Image *string `json:"image,omitempty"`
145+
ExtractOptions *string `json:"extractOptions,omitempty"`
146+
PartitionOptions *string `json:"partitionOptions,omitempty"`
147+
CustomizeOptions *string `json:"customizeOptions,omitempty"`
148+
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
146149
}
147150

148151
func (spec *MapBuilderSpec) GetImage() string {

‎config/crd/bases/osrm.itayankri_osrmclusters.yaml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,14 @@ spec:
4343
type: string
4444
mapBuilder:
4545
properties:
46+
customizeOptions:
47+
type: string
48+
extractOptions:
49+
type: string
4650
image:
4751
type: string
52+
partitionOptions:
53+
type: string
4854
resources:
4955
description: ResourceRequirements describes the compute resource
5056
requirements.

‎config/manager/kustomization.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ kind: Kustomization
1313
images:
1414
- name: controller
1515
newName: itayankri/osrm-operator
16-
newTag: v1.6.0
16+
newTag: "0696442"

‎docker/map-builder/Dockerfile‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
FROM ghcr.io/project-osrm/osrm-backend:v5.27.1
22

33
RUN apt update
4+
45
RUN apt --assume-yes install curl
56

7+
COPY timezone-file.json timezone-file.json
8+
69
COPY run.sh run.sh
10+
711
RUN chmod +x run.sh
812

913
CMD ["./run.sh"]

‎docker/map-builder/run.sh‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ echo "Downloading PBF file from $PBF_URL"
3939
curl -O $PBF_URL
4040

4141
echo "Extracting PBF"
42-
osrm-extract -p /opt/$PROFILE.lua $PBF_FILE_NAME && \
42+
osrm-extract -p /opt/$PROFILE.lua $PBF_FILE_NAME $EXTRACT_OPTIONS&& \
4343

4444
echo "Partitioning map data"
45-
osrm-partition $OSRM_FILE_NAME
45+
osrm-partition $OSRM_FILE_NAME$PARTITION_OPTIONS
4646

4747
cp * ../$CUSTOMIZED_DATA_DIR
4848
cd ../$CUSTOMIZED_DATA_DIR
4949

5050
echo "Customizing map data"
51-
osrm-customize $OSRM_FILE_NAME
51+
osrm-customize $OSRM_FILE_NAME$CUSTOMIZE_OPTIONS --time-zone-file /opt/timezone-file.json

‎examples/single_profile_osrm_cluster.yaml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ kind: OSRMCluster
33
metadata:
44
name: single-profile-example
55
spec:
6+
mapBuilder:
7+
image: itayankri/osrm-builder:test-timezone-file-6
8+
extractOptions: "--parse-conditional-restrictions"
9+
customizeOptions: "--parse-conditionals-from-now 1727194872"
610
pbfUrl: https://download.geofabrik.de/australia-oceania/marshall-islands-latest.osm.pbf
711
profiles:
812
- name: foot

‎internal/resource/job.go‎

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,50 @@ func (builder *JobBuilder) Update(object client.Object, siblings []runtime.Objec
4040

4141
job.ObjectMeta.Labels = metadata.GetLabels(builder.Instance, metadata.ComponentLabelProfile)
4242

43+
env := []corev1.EnvVar{
44+
{
45+
Name: "ROOT_DIR",
46+
Value: osrmDataPath,
47+
},
48+
{
49+
Name: "PARTITIONED_DATA_DIR",
50+
Value: osrmPartitionedData,
51+
},
52+
{
53+
Name: "CUSTOMIZED_DATA_DIR",
54+
Value: osrmCustomizedData,
55+
},
56+
{
57+
Name: "PBF_URL",
58+
Value: builder.Instance.Spec.PBFURL,
59+
},
60+
{
61+
Name: "PROFILE",
62+
Value: builder.profile.GetProfile(),
63+
},
64+
}
65+
66+
if builder.Instance.Spec.MapBuilder.ExtractOptions != nil {
67+
env = append(env, corev1.EnvVar{
68+
Name: "EXTRACT_OPTIONS",
69+
Value: *builder.Instance.Spec.MapBuilder.ExtractOptions,
70+
})
71+
}
72+
73+
if builder.Instance.Spec.MapBuilder.PartitionOptions != nil {
74+
env = append(env, corev1.EnvVar{
75+
Name: "PARTITION_OPTIONS",
76+
Value: *builder.Instance.Spec.MapBuilder.PartitionOptions,
77+
})
78+
}
79+
80+
if builder.Instance.Spec.MapBuilder.CustomizeOptions != nil {
81+
env = append(env, corev1.EnvVar{
82+
Name: "CUSTOMIZE_OPTIONS",
83+
Value: *builder.Instance.Spec.MapBuilder.CustomizeOptions,
84+
})
85+
}
86+
4387
job.Spec = batchv1.JobSpec{
4488
Selector: job.Spec.Selector,
4589
Template: corev1.PodTemplateSpec{
@@ -53,28 +97,7 @@ func (builder *JobBuilder) Update(object client.Object, siblings []runtime.Objec
5397
Name: builder.Instance.ChildResourceName(builder.profile.Name, JobSuffix),
5498
Image: builder.Instance.Spec.MapBuilder.GetImage(),
5599
Resources: *builder.Instance.Spec.MapBuilder.GetResources(),
56-
Env: []corev1.EnvVar{
57-
{
58-
Name: "ROOT_DIR",
59-
Value: osrmDataPath,
60-
},
61-
{
62-
Name: "PARTITIONED_DATA_DIR",
63-
Value: osrmPartitionedData,
64-
},
65-
{
66-
Name: "CUSTOMIZED_DATA_DIR",
67-
Value: osrmCustomizedData,
68-
},
69-
{
70-
Name: "PBF_URL",
71-
Value: builder.Instance.Spec.PBFURL,
72-
},
73-
{
74-
Name: "PROFILE",
75-
Value: builder.profile.GetProfile(),
76-
},
77-
},
100+
Env: env,
78101
VolumeMounts: []corev1.VolumeMount{
79102
{
80103
Name: osrmDataVolumeName,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /