Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
23 changes: 17 additions & 6 deletions template/Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,22 @@
meta = read_json('nix/meta.json')
operator_name = meta['operator']['name']

# If tilt_options.json exists read it and load the default_registry and default_repository value from it
# If tilt_options.json exists read it and load the default_registry, default_operator_repository,
# and default_product_repository value from it
settings = read_json('tilt_options.json', default={})
registry = settings.get('default_registry', 'oci.stackable.tech')
repository = settings.get('default_repository', registry + '/' + 'sdp')
operator_image_name = repository + '/' + operator_name

# Configure default registry either read from config file above, or with default value of "oci.stackable.tech"
# Construct the operator image repository. It uses the "sandbox" instead of the "sdp" namespace to
# separate "testing/local" images from official (published) images.
operator_repository = settings.get('default_operator_repository', registry + '/' + 'sandbox')
operator_image_name = operator_repository + '/' + operator_name

# For the product image, we wanna use the images in the "sdp" namespace, because "sandbox" doesn't
# contain those images (by default).
product_repository = settings.get('default_product_repository', registry + '/' + 'sdp')

# Configure default registry either read from config file above, or with default value of
# "oci.stackable.tech"
default_registry(registry)

custom_build(
Expand All @@ -31,14 +40,16 @@ k8s_kind('DaemonSet', image_json_path='{.spec.template.metadata.annotations.inte
# supported by helm(set).
helm_values = settings.get('helm_values', None)

helm_override_image_repository = 'image.repository=' + repository
helm_override_operator_image_repository = 'image.repository=' + operator_repository
helm_override_product_image_repository = 'image.productRepository=' + product_repository

k8s_yaml(helm(
'deploy/helm/' + operator_name,
name=operator_name,
namespace="stackable-operators",
set=[
helm_override_image_repository,
helm_override_operator_image_repository,
helm_override_product_image_repository,
],
values=helm_values,
))
2 changes: 1 addition & 1 deletion template/deploy/helm/[[operator]]/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ helm.sh/test: {{ include "operator.chart" . }}
{{- end }}

{{/*
Build the full container image reference.
Build the full operator container image reference.
*/}}
{{- define "operator.image" -}}
{{- printf "%s/%s:%s" .Values.image.repository .Chart.Name (.Values.image.tag | default .Chart.AppVersion) -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ spec:
- name: OPERATOR_SERVICE_NAME
value: {{ include "operator.fullname" . }}

# The image repository, like "oci.stackable.tech/sdp"
# The product image repository, like "oci.stackable.tech/sdp".
- name: IMAGE_REPOSITORY
value: {{ .Values.image.repository }}
value: {{ .Values.image.productRepository | default .Values.image.repository }}

# Operators need to know the node name they are running on, to e.g. discover the
# Kubernetes domain name from the kubelet API.
Expand Down