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

k8s - Service and Deployment #234

Merged
merged 7 commits into from Jun 21, 2018
Merged

Conversation

rpitonak
Copy link
Collaborator

This PR contains initial work on Service and Deployment k8s primitives.

Changes included:

  • minor refactor of pod.py
    - static method create for creating V1Pod object that we can pass to method creating deployment

  • minor change in requirements, because of incompatible versions of Kubernetes and Kubernetes python client while creating AppsV1Api for deployment

  • new target in Makefile - test-k8s-minikube for verifying Kubernetes tests locally until new CI is setup. Just run on host machine minikube start and make test-k8s-minikube

@psklenar
Copy link
Collaborator

jenkins/superCI comment

  • Status: failure, return code = 1
  • Result url: https://da.gd/Kit6K
  • Comment: See details for logs

Copy link
Member

@jpopelka jpopelka left a comment

Choose a reason for hiding this comment

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

You can get up-to-date .bandit and .pylintrc to get rid of some codacy warnings.

@# use it like this: `make test-in-container TEST_TARGET=tests/integration/test_utils.py`k
docker run --net=host --rm -v /dev:/dev:ro -v /var/lib/docker:/var/lib/docker:ro --security-opt label=disable --cap-add SYS_ADMIN -e KUBECONFIG=/var/lib/origin/openshift.local.config/master/admin.kubeconfig -ti -v /var/run/docker.sock:/var/run/docker.sock -v $(CURDIR):/src -v $(CURDIR)/pytest-container.ini:/src/pytest.ini $(TEST_IMAGE_NAME) /bin/bash -c "oc login 127.0.0.1:8443 -u developer -p developer -n conu --insecure-skip-tls-verify && make exec-test TEST_TARGET=$(TEST_TARGET)"

test-k8s-minikube: build-test-container
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't the test-in-container target also have build-test-container as dependency ?

"""

print(self.get_status().replicas)
print(self.get_status().ready_replicas)
Copy link
Member

Choose a reason for hiding this comment

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

Leftovers ? (there are more)

try:
pod_instance = api.create_namespaced_pod(namespace=namespace, body=pod)
except ApiException as e:
print("Exception when calling CoreV1Api->create_namespaced_pod: %s\n" % e)
Copy link
Member

Choose a reason for hiding this comment

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

print -> logger.exception() ?

requirements.txt Outdated
@@ -2,6 +2,6 @@ enum34>=1.1.6 ; python_version <= '2.7'
requests
six
docker
openshift
kubernetes == 6.0.0
Copy link
Member

Choose a reason for hiding this comment

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

What about kubernetes >= 6.0.0 ?

@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment Jun 13, 2018
@user-cont user-cont deleted a comment from jpopelka Jun 13, 2018
@user-cont user-cont deleted a comment from jpopelka Jun 13, 2018
Copy link
Member

@TomasTomecek TomasTomecek left a comment

Choose a reason for hiding this comment

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

Looks pretty solid, very nice work!

The only nit I have is the .get_status() methods: I would prefer if they returned enum defined in conu and not in kubernetes client.

@psklenar
Copy link
Collaborator

jenkins/superCI comment

  • Status: failure, return code = 1
  • Result url: https://da.gd/kEuUA
  • Comment: See details for logs

Copy link
Member

@jpopelka jpopelka left a comment

Choose a reason for hiding this comment

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

👍 🏅

@user-cont user-cont deleted a comment from centos-ci Jun 19, 2018
@dhodovsk
Copy link
Member

I wasn't able to run it locally - also CI is failing. Can you recognize this error?

================================================ ERRORS =================================================
____________________________ ERROR collecting tests/integration/test_k8s.py _____________________________
tests/integration/test_k8s.py:24: in <module>
    from conu.backend.k8s.deployment import Deployment
conu/backend/k8s/deployment.py:31: in <module>
    api = client.AppsV1Api()
E   AttributeError: 'module' object has no attribute 'AppsV1Api'

Can you add version of kubernetes python library that supports client.AppsV1Api and similar failing?

@dhodovsk dhodovsk merged commit ae669bd into user-cont:master Jun 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants