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

fix: Patch KFP Profile Controller service port #318

Merged
merged 2 commits into from
Sep 8, 2023
Merged

Conversation

phoevos
Copy link
Contributor

@phoevos phoevos commented Sep 6, 2023

  • Patch the port specified in the K8s service created by Juju to point to the one the controller pod responsible for running the sync.py script listens to
  • Add an integration test to verify that the sync webhook has applied all desired resources. In order for the test to work (and the metacontroller to be deployed successfully) we also deploy the admission-webhook which is responsible for applying the PodDefault CRD. Until CompositeController is not working when deployed before children CRDS metacontroller-operator#86 is closed, we need to ensure that this completes successfully before the metacontroller is deployed.

Closes #317
Refs #314

@phoevos phoevos requested a review from a team as a code owner September 6, 2023 18:09
@phoevos phoevos force-pushed the kf-4313-set-svc-port branch from 6371964 to acdaae3 Compare September 6, 2023 18:36
@phoevos
Copy link
Contributor Author

phoevos commented Sep 6, 2023

Persistence and API integration tests are expected to fail until this is addressed:

@i-chvets
Copy link
Contributor

i-chvets commented Sep 6, 2023

$ kubectl -n kubeflow get svc kfp-profile-controller -o yaml
apiVersion: v1
kind: Service
metadata:
  annotations:
    controller.juju.is/id: 02e83337-6eaf-458e-857e-c334bf9a82a7
    juju.is/version: 2.9.44
    model.juju.is/id: d1d9e28e-d9f3-4aaa-8cfe-5636e57f914c
  creationTimestamp: "2023-09-06T20:02:24Z"
  labels:
    app.juju.is/created-by: kfp-profile-controller
    app.kubernetes.io/managed-by: juju
    app.kubernetes.io/name: kfp-profile-controller
  name: kfp-profile-controller
  namespace: kubeflow
  resourceVersion: "5710"
  uid: 5341c184-fe8d-4c92-b9b8-94bc6c3509af
spec:
  clusterIP: 10.152.183.40
  clusterIPs:
  - 10.152.183.40
  internalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app.kubernetes.io/name: kfp-profile-controller
  sessionAffinity: None
  type: ClusterIP
status:
  loadBalancer: {}

i-chvets
i-chvets previously approved these changes Sep 6, 2023
Copy link
Contributor

@i-chvets i-chvets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added testing of the fix as part of the review into comments. Port is patched as required.
Approved.

@i-chvets
Copy link
Contributor

i-chvets commented Sep 8, 2023

Verified integration test. Works as expected, all test passed.

Test execution
$ tox -e integration
integration: recreate env because requirements removed: juju==2.9.44.0
integration: remove tox env folder /home/ichvets/cw/dev/kfp-operators/charms/kfp-profile-controller/.tox/integration
integration: install_deps> python -I -m pip install -r requirements-integration.txt
integration: commands[0]> pytest -vv --tb native --asyncio-mode=auto /home/ichvets/cw/dev/kfp-operators/charms/kfp-profile-controller/tests/integration --log-cli-level=INFO -s
====================================================== test session starts ======================================================
platform linux -- Python 3.8.18, pytest-7.4.0, pluggy-1.2.0 -- /home/ichvets/cw/dev/kfp-operators/charms/kfp-profile-controller/.tox/integration/bin/python
cachedir: .tox/integration/.pytest_cache
rootdir: /home/ichvets/cw/dev/kfp-operators/charms/kfp-profile-controller
configfile: pyproject.toml
plugins: anyio-3.7.1, operator-0.28.0, asyncio-0.21.1
asyncio: mode=auto
collected 5 items                                                                                                               

tests/integration/test_charm.py::test_build_and_deploy 
-------------------------------------------------------- live log setup ---------------------------------------------------------
INFO     pytest_operator.plugin:plugin.py:647 Adding model microk8s-localhost:test-charm-5ats on cloud microk8s
--------------------------------------------------------- live log call ---------------------------------------------------------
INFO     pytest_operator.plugin:plugin.py:526 Using tmp_path: /home/ichvets/cw/dev/kfp-operators/charms/kfp-profile-controller/.tox/integration/tmp/pytest/test-charm-5ats0
INFO     pytest_operator.plugin:plugin.py:982 Building charm kfp-profile-controller
INFO     pytest_operator.plugin:plugin.py:987 Built charm kfp-profile-controller in 21.92s
INFO     test_charm:test_charm.py:34 Built charm /home/ichvets/cw/dev/kfp-operators/charms/kfp-profile-controller/.tox/integration/tmp/pytest/test-charm-5ats0/charms/kfp-profile-controller_ubuntu-20.04-amd64.charm
INFO     juju.model:model.py:1984 Deploying ch:amd64/focal/admission-webhook-238
INFO     juju.model:model.py:2621 Waiting for model:
  admission-webhook/0 [allocating] waiting: installing agent
INFO     juju.model:model.py:2621 Waiting for model:
  admission-webhook/0 [allocating] waiting: agent initializing
INFO     juju.model:model.py:1984 Deploying ch:amd64/focal/metacontroller-operator-192
INFO     juju.model:model.py:1984 Deploying local:kfp-profile-controller-0
INFO     juju.model:model.py:1984 Deploying ch:amd64/focal/minio-57
INFO     juju.model:model.py:1984 Deploying ch:amd64/focal/kubeflow-profiles-321
INFO     juju.model:model.py:2621 Waiting for model:
  admission-webhook/0 [idle] active: 
  metacontroller-operator/0 [allocating] waiting: agent initializing
  kfp-profile-controller/0 [allocating] waiting: agent initializing
  minio/0 [allocating] waiting: installing agent
  kubeflow-profiles/0 [allocating] waiting: installing agent
INFO     juju.model:model.py:2621 Waiting for model:
  metacontroller-operator/0 [idle] active: 
  kfp-profile-controller/0 [allocating] waiting: agent initializing
  minio/0 [allocating] waiting: installing agent
  kubeflow-profiles/0 [allocating] waiting: agent initializing
INFO     juju.model:model.py:2621 Waiting for model:
  kfp-profile-controller/0 [idle] waiting: [relation:object_storage] List of <ops.model.Relation object-storage:0> versions not found for apps: minio
  minio/0 [allocating] waiting: agent initializing
  kubeflow-profiles/0 [allocating] waiting: agent initializing
INFO     juju.model:model.py:2621 Waiting for model:
  kfp-profile-controller/0 [idle] active: 
  minio/0 [idle] active: 
  kubeflow-profiles/0 [idle] active: 
PASSED
tests/integration/test_charm.py::test_profile_and_resources_creation 
-------------------------------------------------------- live log setup ---------------------------------------------------------
INFO     httpx:_client.py:1013 HTTP Request: PATCH https://10.1.1.124:16443/apis/kubeflow.org/v1/profiles/profilename?fieldManager=kfp-profile-controller "HTTP/1.1 201 Created"
--------------------------------------------------------- live log call ---------------------------------------------------------
INFO     httpx:_client.py:1013 HTTP Request: GET https://10.1.1.124:16443/api/v1/namespaces/profilename "HTTP/1.1 404 Not Found"
INFO     httpx:_client.py:1013 HTTP Request: GET https://10.1.1.124:16443/api/v1/namespaces/profilename "HTTP/1.1 200 OK"
INFO     httpx:_client.py:1013 HTTP Request: GET https://10.1.1.124:16443/api/v1/namespaces/profilename/serviceaccounts/default-editor "HTTP/1.1 404 Not Found"
INFO     httpx:_client.py:1013 HTTP Request: GET https://10.1.1.124:16443/api/v1/namespaces/profilename "HTTP/1.1 200 OK"
INFO     httpx:_client.py:1013 HTTP Request: GET https://10.1.1.124:16443/api/v1/namespaces/profilename/serviceaccounts/default-editor "HTTP/1.1 404 Not Found"
INFO     httpx:_client.py:1013 HTTP Request: GET https://10.1.1.124:16443/api/v1/namespaces/profilename "HTTP/1.1 200 OK"
INFO     httpx:_client.py:1013 HTTP Request: GET https://10.1.1.124:16443/api/v1/namespaces/profilename/serviceaccounts/default-editor "HTTP/1.1 200 OK"
PASSED
tests/integration/test_charm.py::test_model_resources 
--------------------------------------------------------- live log call ---------------------------------------------------------
INFO     httpx:_client.py:1013 HTTP Request: GET https://10.1.1.124:16443/api/v1/namespaces/test-charm-5ats/secrets/kfp-profile-controller-minio-credentials "HTTP/1.1 200 OK"
PASSED
tests/integration/test_charm.py::test_minio_config_changed 
--------------------------------------------------------- live log call ---------------------------------------------------------
INFO     juju.model:model.py:2621 Waiting for model:
  admission-webhook/0 [idle] active: 
  metacontroller-operator/0 [idle] active: 
  kfp-profile-controller/0 [idle] active: 
  minio/0 [idle] active: 
  kubeflow-profiles/0 [idle] active: 
INFO     httpx:_client.py:1013 HTTP Request: GET https://10.1.1.124:16443/api/v1/namespaces/test-charm-5ats/secrets/kfp-profile-controller-minio-credentials "HTTP/1.1 200 OK"
PASSED
tests/integration/test_charm.py::test_sync_webhook 
--------------------------------------------------------- live log call ---------------------------------------------------------
INFO     httpx:_client.py:1013 HTTP Request: GET https://10.1.1.124:16443/api/v1/namespaces/profilename/configmaps/metadata-grpc-configmap "HTTP/1.1 200 OK"
INFO     httpx:_client.py:1013 HTTP Request: GET https://10.1.1.124:16443/apis/apps/v1/namespaces/profilename/deployments/ml-pipeline-visualizationserver "HTTP/1.1 200 OK"
INFO     httpx:_client.py:1013 HTTP Request: GET https://10.1.1.124:16443/api/v1/namespaces/profilename/services/ml-pipeline-visualizationserver "HTTP/1.1 200 OK"
INFO     httpx:_client.py:1013 HTTP Request: GET https://10.1.1.124:16443/apis/apps/v1/namespaces/profilename/deployments/ml-pipeline-ui-artifact "HTTP/1.1 200 OK"
INFO     httpx:_client.py:1013 HTTP Request: GET https://10.1.1.124:16443/api/v1/namespaces/profilename/services/ml-pipeline-ui-artifact "HTTP/1.1 200 OK"
INFO     httpx:_client.py:1013 HTTP Request: GET https://10.1.1.124:16443/apis/kubeflow.org/v1alpha1/namespaces/profilename/poddefaults/access-ml-pipeline "HTTP/1.1 200 OK"
INFO     httpx:_client.py:1013 HTTP Request: GET https://10.1.1.124:16443/api/v1/namespaces/profilename/secrets/mlpipeline-minio-artifact "HTTP/1.1 200 OK"
PASSED
------------------------------------------------------- live log teardown -------------------------------------------------------
INFO     pytest_operator.plugin:plugin.py:790 Model status:

Model            Controller          Cloud/Region        Version  SLA          Timestamp
test-charm-5ats  microk8s-localhost  microk8s/localhost  2.9.44   unsupported  12:03:49-04:00

App                      Version                Status  Scale  Charm                    Channel        Rev  Address         Exposed  Message
admission-webhook                               active      1  admission-webhook        latest/edge    238  10.152.183.63   no       
kfp-profile-controller                          active      1  kfp-profile-controller                    0  10.152.183.40   no       
kubeflow-profiles                               active      1  kubeflow-profiles        latest/edge    321  10.152.183.91   no       
metacontroller-operator                         active      1  metacontroller-operator  latest/edge    192  10.152.183.172  no       
minio                    res:oci-image@1755999  active      1  minio                    latest/stable   57  10.152.183.106  no       

Unit                        Workload  Agent  Address      Ports     Message
admission-webhook/0*        active    idle   10.1.59.120            
kfp-profile-controller/0*   active    idle   10.1.59.122            
kubeflow-profiles/0*        active    idle   10.1.59.124            
metacontroller-operator/0*  active    idle   10.1.59.121            
minio/0*                    active    idle   10.1.59.75   9000/TCP  


INFO     pytest_operator.plugin:plugin.py:796 Juju error logs:


INFO     pytest_operator.plugin:plugin.py:884 Resetting model test-charm-5ats...
INFO     pytest_operator.plugin:plugin.py:873    Destroying applications admission-webhook
INFO     pytest_operator.plugin:plugin.py:873    Destroying applications metacontroller-operator
INFO     pytest_operator.plugin:plugin.py:873    Destroying applications kfp-profile-controller
INFO     pytest_operator.plugin:plugin.py:873    Destroying applications minio
INFO     pytest_operator.plugin:plugin.py:873    Destroying applications kubeflow-profiles
INFO     pytest_operator.plugin:plugin.py:889 Not waiting on reset to complete.
INFO     pytest_operator.plugin:plugin.py:862 Forgetting main...
INFO     httpx:_client.py:1013 HTTP Request: DELETE https://10.1.1.124:16443/apis/kubeflow.org/v1/profiles/profilename "HTTP/1.1 200 OK"


======================================================= warnings summary ========================================================
tests/integration/test_charm.py::test_build_and_deploy
tests/integration/test_charm.py::test_build_and_deploy
  /home/ichvets/cw/dev/kfp-operators/charms/kfp-profile-controller/.tox/integration/lib/python3.8/site-packages/websockets/protocol.py:218: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
    self._drain_lock = asyncio.Lock(loop=loop)

tests/integration/test_charm.py: 32 warnings
  /home/ichvets/cw/dev/kfp-operators/charms/kfp-profile-controller/.tox/integration/lib/python3.8/site-packages/websockets/protocol.py:977: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
    yield from asyncio.sleep(self.ping_interval, loop=self.loop)

tests/integration/test_charm.py: 1666 warnings
  /home/ichvets/cw/dev/kfp-operators/charms/kfp-profile-controller/.tox/integration/lib/python3.8/site-packages/websockets/protocol.py:911: DeprecationWarning: 'with (yield from lock)' is deprecated use 'async with lock' instead
    with (yield from self._drain_lock):

tests/integration/test_charm.py: 1635 warnings
  /home/ichvets/cw/dev/kfp-operators/charms/kfp-profile-controller/.tox/integration/lib/python3.8/site-packages/websockets/protocol.py:416: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
    yield from asyncio.wait(

tests/integration/test_charm.py: 30 warnings
  /home/ichvets/cw/dev/kfp-operators/charms/kfp-profile-controller/.tox/integration/lib/python3.8/site-packages/websockets/protocol.py:988: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
    yield from asyncio.wait_for(

tests/integration/test_charm.py::test_sync_webhook
tests/integration/test_charm.py::test_sync_webhook
  /home/ichvets/cw/dev/kfp-operators/charms/kfp-profile-controller/.tox/integration/lib/python3.8/site-packages/websockets/protocol.py:532: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
    yield from asyncio.wait_for(

tests/integration/test_charm.py::test_sync_webhook
tests/integration/test_charm.py::test_sync_webhook
  /home/ichvets/cw/dev/kfp-operators/charms/kfp-profile-controller/.tox/integration/lib/python3.8/site-packages/websockets/protocol.py:554: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
    yield from asyncio.wait_for(

tests/integration/test_charm.py::test_sync_webhook
tests/integration/test_charm.py::test_sync_webhook
  /home/ichvets/cw/dev/kfp-operators/charms/kfp-profile-controller/.tox/integration/lib/python3.8/site-packages/websockets/protocol.py:1077: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
    yield from asyncio.wait_for(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================= 5 passed, 3371 warnings in 317.17s (0:05:17) ==========================================
  integration: OK (331.34=setup[13.53]+cmd[317.80] seconds)
  congratulations :) (331.43 seconds)

Copy link
Contributor

@i-chvets i-chvets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added test verification in the comments. Approved.

Patch the port specified in the K8s service created by Juju to point to
the one the controller pod responsible for running the `sync.py` script
listens to.

Signed-off-by: Phoevos Kalemkeris <[email protected]>
Add an integration test to verify that the sync webhook has applied all
desired resources. In order for the test to work (and the metacontroller
to be deployed successfully) we also deploy the admission-webhook which
is responsinble for applying the PodDefault CRD.

Signed-off-by: Phoevos Kalemkeris <[email protected]>
@phoevos phoevos force-pushed the kf-4313-set-svc-port branch from edbe8de to 17f008e Compare September 8, 2023 16:09
@phoevos phoevos merged commit e87bb19 into main Sep 8, 2023
41 checks passed
@phoevos phoevos deleted the kf-4313-set-svc-port branch September 8, 2023 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KFP Profile Controller K8s Service port not specified
3 participants