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

Loosen v1 microservice dependencies #4911

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
"import tensorflow as tf\n",
"\n",
"if __name__ == \"__main__\":\n",
"\n",
" x = tf.placeholder(tf.float32, [None, 784], name=\"x\")\n",
"\n",
" W = tf.Variable(tf.zeros([784, 10]))\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
"import tensorflow as tf\n",
"\n",
"if __name__ == \"__main__\":\n",
"\n",
" x = tf.placeholder(tf.float32, [None, 784], name=\"x\")\n",
"\n",
" W = tf.Variable(tf.zeros([784, 10]))\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
"import tensorflow as tf\n",
"\n",
"if __name__ == \"__main__\":\n",
"\n",
" x = tf.placeholder(tf.float32, [None, 784], name=\"x\")\n",
"\n",
" W = tf.Variable(tf.zeros([784, 10]))\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,6 @@
"import tensorflow as tf\n",
"\n",
"if __name__ == \"__main__\":\n",
"\n",
" x = tf.placeholder(tf.float32, [None, 784], name=\"x\")\n",
"\n",
" W = tf.Variable(tf.zeros([784, 10]))\n",
Expand Down
6 changes: 3 additions & 3 deletions operator/hack/csv_hack.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def update_container_image(csv, version):
][0]["env"]
):
if env["name"] == "EXECUTOR_CONTAINER_IMAGE_AND_VERSION":
csv["spec"]["install"]["spec"]["deployments"][0]["spec"]["template"]["spec"][
"containers"
][0]["env"][n]["value"] = (
csv["spec"]["install"]["spec"]["deployments"][0]["spec"]["template"][
"spec"
]["containers"][0]["env"][n]["value"] = (
"docker.io/seldonio/seldon-core-executor:" + version
)
return csv
Expand Down
84 changes: 45 additions & 39 deletions operator/helm/split_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import yaml

parser = argparse.ArgumentParser()
parser.add_argument("--prefix", default="xx",
help="find files matching prefix")
parser.add_argument("--prefix", default="xx", help="find files matching prefix")
parser.add_argument("--folder", required=True, help="Output folder")
args, _ = parser.parse_known_args()

Expand All @@ -30,11 +29,13 @@
HELM_CREATERESOURCES_RBAC_IF_START = "{{- if .Values.managerCreateResources }}\n"
HELM_K8S_V1_CRD_IF_START = '{{- if or (ge (int (regexFind "[0-9]+" .Capabilities.KubeVersion.Minor)) 18) (.Values.crd.forcev1) }}\n'
HELM_K8S_V1BETA1_CRD_IF_START = '{{- if or (lt (int (regexFind "[0-9]+" .Capabilities.KubeVersion.Minor)) 18) (.Values.crd.forcev1beta1) }}\n'
HELM_CRD_ANNOTATIONS_WITH_START = '{{- with .Values.crd.annotations }}\n'
HELM_ANNOTATIONS_TOYAML4 = '{{- toYaml . | nindent 4}}\n'
HELM_ANNOTATIONS_TOYAML8 = '{{- toYaml . | nindent 8}}\n'
HELM_CONTROLER_DEP_ANNOTATIONS_WITH_START = '{{- with .Values.manager.annotations }}\n'
HELM_CONTROLER_DEP_POD_SEC_CTX_WITH_START = '{{- with .Values.manager.containerSecurityContext }}\n'
HELM_CRD_ANNOTATIONS_WITH_START = "{{- with .Values.crd.annotations }}\n"
HELM_ANNOTATIONS_TOYAML4 = "{{- toYaml . | nindent 4}}\n"
HELM_ANNOTATIONS_TOYAML8 = "{{- toYaml . | nindent 8}}\n"
HELM_CONTROLER_DEP_ANNOTATIONS_WITH_START = "{{- with .Values.manager.annotations }}\n"
HELM_CONTROLER_DEP_POD_SEC_CTX_WITH_START = (
"{{- with .Values.manager.containerSecurityContext }}\n"
)
HELM_IF_END = "{{- end }}\n"

HELM_ENV_SUBST = {
Expand Down Expand Up @@ -71,7 +72,7 @@
"EXECUTOR_REQUEST_LOGGER_WORK_QUEUE_SIZE": "executor.requestLogger.workQueueSize",
"EXECUTOR_REQUEST_LOGGER_WRITE_TIMEOUT_MS": "executor.requestLogger.writeTimeoutMs",
"DEPLOYMENT_NAME_AS_PREFIX": "manager.deploymentNameAsPrefix",
"EXECUTOR_FULL_HEALTH_CHECKS": "executor.fullHealthChecks"
"EXECUTOR_FULL_HEALTH_CHECKS": "executor.fullHealthChecks",
}
HELM_VALUES_IMAGE_PULL_POLICY = "{{ .Values.image.pullPolicy }}"

Expand Down Expand Up @@ -100,8 +101,7 @@ def helm_namespace_override():
webhookData
+ '{{- $altNames := list ( printf "seldon-webhook-service.%s" (include "seldon.namespace" .) ) ( printf "seldon-webhook-service.%s.svc" (include "seldon.namespace" .) ) -}}\n'
)
webhookData = webhookData + \
'{{- $ca := genCA "custom-metrics-ca" 365 -}}\n'
webhookData = webhookData + '{{- $ca := genCA "custom-metrics-ca" 365 -}}\n'
webhookData = (
webhookData
+ '{{- $cert := genSignedCert "seldon-webhook-service" nil $altNames 365 $ca -}}\n'
Expand All @@ -113,8 +113,7 @@ def helm_namespace_override():
kind = res["kind"].lower()
name = res["metadata"]["name"].lower()
version = res["apiVersion"]
filename = args.folder + "/" + \
(kind + "_" + name).lower() + ".yaml"
filename = args.folder + "/" + (kind + "_" + name).lower() + ".yaml"
print(filename)
print(version)
if (
Expand Down Expand Up @@ -173,7 +172,9 @@ def helm_namespace_override():
] = helm_value("managerUserID")

# Priority class name
res["spec"]["template"]["spec"]["priorityClassName"] = helm_value("manager.priorityClassName")
res["spec"]["template"]["spec"]["priorityClassName"] = helm_value(
"manager.priorityClassName"
)

# Resource requests
res["spec"]["template"]["spec"]["containers"][0]["resources"][
Expand Down Expand Up @@ -206,8 +207,7 @@ def helm_namespace_override():
if portSpec["name"] == "webhook-server":
portSpec["containerPort"] = helm_value("webhook.port")
for argIdx in range(
0, len(res["spec"]["template"]["spec"]
["containers"][0]["args"])
0, len(res["spec"]["template"]["spec"]["containers"][0]["args"])
):
if (
res["spec"]["template"]["spec"]["containers"][0]["args"][argIdx]
Expand All @@ -221,16 +221,17 @@ def helm_namespace_override():
)

# Update metrics port
res["spec"]["template"]["metadata"]["annotations"]["prometheus.io/port"] = helm_value("metrics.port")
res["spec"]["template"]["metadata"]["annotations"][
"prometheus.io/port"
] = helm_value("metrics.port")
for portSpec in res["spec"]["template"]["spec"]["containers"][0][
"ports"
]:
if portSpec["name"] == "metrics":
portSpec["containerPort"] = helm_value("metrics.port")

for argIdx in range(
0, len(res["spec"]["template"]["spec"]
["containers"][0]["args"])
0, len(res["spec"]["template"]["spec"]["containers"][0]["args"])
):
if (
res["spec"]["template"]["spec"]["containers"][0]["args"][argIdx]
Expand All @@ -241,12 +242,13 @@ def helm_namespace_override():
] = "--metrics-addr=:" + helm_value("metrics.port")

# Networking
res["spec"]["template"]["spec"]["hostNetwork"] = helm_value("hostNetwork")
res["spec"]["template"]["spec"]["hostNetwork"] = helm_value(
"hostNetwork"
)

if kind == "configmap" and name == "seldon-config":
res["data"]["credentials"] = helm_value_json("credentials")
res["data"]["predictor_servers"] = helm_value_json(
"predictor_servers")
res["data"]["predictor_servers"] = helm_value_json("predictor_servers")
res["data"]["storageInitializer"] = helm_value_json(
"storageInitializer"
)
Expand All @@ -269,8 +271,7 @@ def helm_namespace_override():
res["roleRef"]["name"] + "-" + helm_namespace_override()
)
if name == "seldon-manager-rolebinding":
res["subjects"][0]["name"] = helm_value(
"serviceAccount.name")
res["subjects"][0]["name"] = helm_value("serviceAccount.name")
res["subjects"][0]["namespace"] = helm_namespace_override()
elif name != "seldon-spartakus-volunteer":
res["subjects"][0]["namespace"] = helm_namespace_override()
Expand All @@ -283,8 +284,7 @@ def helm_namespace_override():
or name == "seldon1-manager-sas-rolebinding"
or name == "seldon-leader-election-rolebinding"
):
res["subjects"][0]["name"] = helm_value(
"serviceAccount.name")
res["subjects"][0]["name"] = helm_value("serviceAccount.name")
res["subjects"][0]["namespace"] = helm_namespace_override()

# Update webhook certificates
Expand Down Expand Up @@ -333,8 +333,7 @@ def helm_namespace_override():

# Update webhook service port
if kind == "service" and name == "seldon-webhook-service":
res["spec"]["ports"][0]["targetPort"] = helm_value(
"webhook.port")
res["spec"]["ports"][0]["targetPort"] = helm_value("webhook.port")

fdata = yaml.dump(res, width=1000)

Expand Down Expand Up @@ -427,8 +426,10 @@ def helm_namespace_override():
+ HELM_K8S_V1BETA1_CRD_IF_START
+ re.sub(
r"(.*controller-gen.kubebuilder.io/version.*\n)",
r"\1" + HELM_CRD_ANNOTATIONS_WITH_START +
HELM_ANNOTATIONS_TOYAML4 + HELM_IF_END,
r"\1"
+ HELM_CRD_ANNOTATIONS_WITH_START
+ HELM_ANNOTATIONS_TOYAML4
+ HELM_IF_END,
fdata,
re.M,
)
Expand All @@ -444,8 +445,10 @@ def helm_namespace_override():
+ HELM_K8S_V1_CRD_IF_START
+ re.sub(
r"(.*controller-gen.kubebuilder.io/version.*\n)",
r"\1" + HELM_CRD_ANNOTATIONS_WITH_START +
HELM_ANNOTATIONS_TOYAML4 + HELM_IF_END,
r"\1"
+ HELM_CRD_ANNOTATIONS_WITH_START
+ HELM_ANNOTATIONS_TOYAML4
+ HELM_IF_END,
fdata,
re.M,
)
Expand All @@ -459,8 +462,10 @@ def helm_namespace_override():
elif kind == "deployment" and name == "seldon-controller-manager":
fdata = re.sub(
r"(.*template:\n.*metadata:\n.*annotations:\n)",
r"\1" + HELM_CONTROLER_DEP_ANNOTATIONS_WITH_START +
HELM_ANNOTATIONS_TOYAML8 + HELM_IF_END,
r"\1"
+ HELM_CONTROLER_DEP_ANNOTATIONS_WITH_START
+ HELM_ANNOTATIONS_TOYAML8
+ HELM_IF_END,
fdata,
re.M,
)
Expand All @@ -480,8 +485,10 @@ def helm_namespace_override():

fdata = re.sub(
r"(.*command:\n)",
HELM_CONTROLER_DEP_POD_SEC_CTX_WITH_START +
HELM_ANNOTATIONS_TOYAML8 + HELM_IF_END + r"\1",
HELM_CONTROLER_DEP_POD_SEC_CTX_WITH_START
+ HELM_ANNOTATIONS_TOYAML8
+ HELM_IF_END
+ r"\1",
fdata,
re.M,
)
Expand All @@ -492,7 +499,8 @@ def helm_namespace_override():
)
# make sure metrics.port is not quoted as its an int
fdata = fdata.replace(
"containerPort: '{{ .Values.metrics.port }}'", "containerPort: {{ .Values.metrics.port }}"
"containerPort: '{{ .Values.metrics.port }}'",
"containerPort: {{ .Values.metrics.port }}",
)
# make sure webhook is not quoted as its an int
fdata = fdata.replace(
Expand Down Expand Up @@ -538,9 +546,7 @@ def helm_namespace_override():
)
webhookData = re.sub(
r"(.*caBundle:.*\n)",
HELM_NOT_CERTMANAGER_IF_START
+ r"\1"
+ HELM_IF_END,
HELM_NOT_CERTMANAGER_IF_START + r"\1" + HELM_IF_END,
webhookData,
re.M,
)
Expand Down
11 changes: 6 additions & 5 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

from setuptools import find_packages, setup

# Extra dependencies, with special 'all' key
extras = {"tensorflow": ["tensorflow"]}
# Extra dependencies, with special 'tensorflow' key. TF requires a specific version of
# proto to be installed to use their protos.
extras = {"tensorflow": ["tensorflow", "protobuf>=3.20.2,<4.0.0"]}
all_extra_deps = chain.from_iterable(extras.values())
extras["all"] = list(set(all_extra_deps))

Expand All @@ -26,7 +27,7 @@
"Flask-cors<4.0.0",
"requests<3.0.0",
"numpy<2.0.0",
"protobuf>=3.20.2,<4.0.0",
"protobuf<5.0.0",
"grpcio<2.0.0",
"Flask-OpenTracing >= 1.1.0, < 1.2.0",
"opentracing >= 2.2.0, < 2.5.0",
Expand All @@ -38,13 +39,13 @@
"prometheus_client >= 0.7.1, < 0.9.0",
"werkzeug >= 2.1.1, < 2.3",
# Addresses CVE SNYK-PYTHON-CRYPTOGRAPHY-3315328
"cryptography >= 39.0.1, < 40.1",
"cryptography >= 39.0.1,<41.0",
# Addresses CVE SNYK-PYTHON-PYYAML-590151
"PyYAML >= 5.4, <= 6.0.1",
# Addresses CVE PRISMA-2021-0020
"click >= 8.0.0a1, < 8.1",
# Addresses CVE CVE-2019-11236 and CVE-2020-26137 and SNYK-PYTHON-URLLIB3-1533435
"urllib3 >= 1.26.5, < 1.27",
"urllib3 >= 1.26.5,<3.0.0",
"importlib-metadata<5; python_version < '3.8'",
],
extras_require=extras,
Expand Down
2 changes: 0 additions & 2 deletions python/tests/test_application_exception_microservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def to_dict(self):


class UserObject(SeldonComponent):

model_error_handler = flask.Blueprint("error_handlers", __name__)

@model_error_handler.app_errorhandler(UserCustomException)
Expand All @@ -56,7 +55,6 @@ def predict(self, X, features_names, **kwargs):


class UserObjectLowLevel(SeldonComponent):

model_error_handler = flask.Blueprint("error_handlers", __name__)

@model_error_handler.app_errorhandler(UserCustomException)
Expand Down
1 change: 0 additions & 1 deletion python/tests/test_combiner_microservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def aggregate_rest(self, Xs):
def aggregate_grpc(
self, request: Union[prediction_pb2.SeldonMessage, List, Dict]
) -> Union[prediction_pb2.SeldonMessage, List, Dict]:

is_proto = isinstance(request, prediction_pb2.SeldonMessage)

arr = np.array([9, 9])
Expand Down
1 change: 0 additions & 1 deletion python/tests/test_router_microservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def __init__(self, metrics_ok=True, ret_nparray=False):
def route_raw(
self, request: Union[prediction_pb2.SeldonMessage, List, Dict]
) -> Union[prediction_pb2.SeldonMessage, List, Dict]:

is_proto = isinstance(request, prediction_pb2.SeldonMessage)

arr = np.array([1])
Expand Down
4 changes: 0 additions & 4 deletions python/tests/test_transformer_microservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ def __init__(self, metrics_ok=True, ret_nparray=False):
def transform_input_raw(
self, request: Union[prediction_pb2.SeldonMessage, List, Dict]
) -> Union[prediction_pb2.SeldonMessage, List, Dict]:

is_proto = isinstance(request, prediction_pb2.SeldonMessage)

arr = np.array([9, 9])
Expand All @@ -131,7 +130,6 @@ def transform_input_raw(
def transform_output_raw(
self, request: Union[prediction_pb2.SeldonMessage, List, Dict]
) -> Union[prediction_pb2.SeldonMessage, List, Dict]:

is_proto = isinstance(request, prediction_pb2.SeldonMessage)

arr = np.array([9, 9])
Expand All @@ -155,7 +153,6 @@ def __init__(self, metrics_ok=True, ret_nparray=False):
def transform_input_raw(
self, request: Union[prediction_pb2.SeldonMessage, List, Dict]
) -> Union[prediction_pb2.SeldonMessage, List, Dict]:

is_proto = isinstance(request, prediction_pb2.SeldonMessage)

arr = np.array([9, 9])
Expand All @@ -171,7 +168,6 @@ def transform_input_raw(
def transform_output_raw(
self, request: Union[prediction_pb2.SeldonMessage, List, Dict]
) -> Union[prediction_pb2.SeldonMessage, List, Dict]:

is_proto = isinstance(request, prediction_pb2.SeldonMessage)

arr = np.array([9, 9])
Expand Down
1 change: 0 additions & 1 deletion testing/scripts/e2e_utils/s2i.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
def create_s2i_image(
s2i_folder: str, s2i_image: str, image_name: str, s2i_runtime_image: str = None
) -> str:

logging.info(f"Building {image_name} with s2i...")
if s2i_runtime_image:
s2i.build(s2i_folder, s2i_image, image_name, runtime_image=s2i_runtime_image)
Expand Down
2 changes: 0 additions & 2 deletions testing/scripts/seldon_e2e_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,6 @@ def create_and_run_script(folder, notebook):


def bench_results_from_output_logs(name, namespace="argo", print_results=True):

output = run(
f"argo logs --no-color {name} -n {namespace}",
stdout=subprocess.PIPE,
Expand Down Expand Up @@ -766,7 +765,6 @@ def run_benchmark_and_capture_results(
benchmark_data={"data": {"ndarray": [[1, 2, 3, 4]]}},
benchmark_grpc_data_override="",
):

# Helm chart command requires escaped commas and brackets
data_str = (
json.dumps(benchmark_data)
Expand Down
Loading
Loading