Skip to content

Commit

Permalink
feat: Integration tests for set of Seldon rocks (#150)
Browse files Browse the repository at this point in the history
* feat: integration tests for seldon rocks
#133

Summary of changes:
- Added integration test for Seldon prepackages servers: sklearn v1 and v2, xgboost v1 and
  v2, mlflowserver v1.
- Bump resources for mlflowserver tests.
- Updated integration tests with server names to retrieve proper image
  name for testing.
- Added test for removal of workload deployed configmap.
- Updated workflow to remove pin of Juju agent version and use of
  2.9/stable channel.
- Reverted back to using remove_application() from model instead of
  subprocess.
  • Loading branch information
i-chvets authored Jun 15, 2023
1 parent 58a245b commit 6113f66
Show file tree
Hide file tree
Showing 7 changed files with 262 additions and 33 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ jobs:
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
juju-channel: 2.9/stable
provider: microk8s
channel: 1.24/stable
# Pinned until this bug is resolved: https://bugs.launchpad.net/juju/+bug/1992833
bootstrap-options: "--agent-version=2.9.34"
microk8s-addons: "dns storage rbac metallb:10.64.140.43-10.64.140.49"

- name: Run integration tests
Expand Down
23 changes: 23 additions & 0 deletions examples/mlflowserver-v2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# https://docs.seldon.io/projects/seldon-core/en/latest/servers/mlflow.html
apiVersion: machinelearning.seldon.io/v1
kind: SeldonDeployment
metadata:
name: mlflow
spec:
name: wines
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "250m"
protocol: v2 # Activate the V2 protocol
predictors:
- graph:
children: []
implementation: MLFLOW_SERVER
modelUri: gs://seldon-models/mlflow/elasticnet_wine_1.8.0
name: classifier
name: default
replicas: 1
22 changes: 22 additions & 0 deletions examples/mlflowserver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# https://docs.seldon.io/projects/seldon-core/en/latest/servers/mlflow.html
apiVersion: machinelearning.seldon.io/v1
kind: SeldonDeployment
metadata:
name: mlflow
spec:
name: wines
resources:
requests:
memory: "64Mi"
cpu: "500m"
limits:
memory: "128Mi"
cpu: "500m"
predictors:
- graph:
children: []
implementation: MLFLOW_SERVER
modelUri: gs://seldon-models/mlflow/elasticnet_wine_1.8.0
name: classifier
name: default
replicas: 1
23 changes: 23 additions & 0 deletions examples/xgboost-v2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# https://docs.seldon.io/projects/seldon-core/en/latest/servers/xgboost.html
apiVersion: machinelearning.seldon.io/v1
kind: SeldonDeployment
metadata:
name: xgboost
spec:
name: iris-predict
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "250m"
protocol: v2 # Activate the V2 protocol
predictors:
- graph:
children: []
implementation: XGBOOST_SERVER
modelUri: gs://seldon-models/xgboost/iris
name: classifier
name: default
replicas: 1
22 changes: 22 additions & 0 deletions examples/xgboost.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# https://docs.seldon.io/projects/seldon-core/en/latest/servers/xgboost.html
apiVersion: machinelearning.seldon.io/v1
kind: SeldonDeployment
metadata:
name: xgboost
spec:
name: iris
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "250m"
predictors:
- graph:
children: []
implementation: XGBOOST_SERVER
modelUri: gs://seldon-models/xgboost/iris
name: classifier
name: default
replicas: 1
8 changes: 8 additions & 0 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from lightkube import ApiError
from lightkube.generic_resource import load_in_cluster_generic_resources
from lightkube.models.core_v1 import ServicePort
from lightkube.resources.core_v1 import ConfigMap
from ops.charm import CharmBase
from ops.framework import EventBase, StoredState
from ops.main import main
Expand Down Expand Up @@ -406,6 +407,13 @@ def _on_remove(self, _):
self.configmap_resource_handler.lightkube_client,
configmap_resources_manifests,
)
# remove ConfigMap deployed by workload
self.configmap_resource_handler.lightkube_client.delete(
ConfigMap,
name="a33bd623.machinelearning.seldon.io",
namespace=self._namespace,
grace_period=0,
)
except ApiError as error:
# do not log/report when resources were not found
if error.status.code != 404:
Expand Down
Loading

0 comments on commit 6113f66

Please sign in to comment.