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

Add kubernetes python client to operator image; #10963

Merged
merged 1 commit into from Nov 28, 2019

Conversation

ycliuhw
Copy link
Member

@ycliuhw ycliuhw commented Nov 28, 2019

Please provide the following details to expedite Pull Request review:

Checklist

  • Checked if it requires a pylibjuju change?
  • Added integration tests for the PR?
  • Added or updated doc.go related to packages changed?
  • Do comments answer the question of why design decisions were made?

Description of change

Add kubernetes python client to operator image;

QA steps

# bootstrap to k8s;
$ juju bootstrap microk8s k1

# deploy mariadb;
$ juju add-model t1 microk8s && juju deploy cs:~kelvin.liu/mariadb-k8s-3 --debug -m k1:t1

# exec into operator pod;
$ kubectl exec pod/mariadb-k8s-operator-0  -n controller-k1 -it -- bash

# test in python;
$ python
In [1]: from kubernetes import client, config
In [2]: config.load_incluster_config()
In [3]: v1 = client.CoreV1Api()
In [4]: v1.list_namespace()
Out[4]:
{'api_version': 'v1',
 'items': [{'api_version': None,
            'kind': None,
            'metadata': {'annotations': {'juju.io/controller': '170db7ac-d09e-4f39-88a6-ec62f618bcff',
                                         'juju.io/is-controller': 'true',
                                         'juju.io/model': '388dc4ae-72ce-483a-86e4-a16cac88a9a0'},
                         'cluster_name': None,
                         'creation_timestamp': datetime.datetime(2019, 11, 28, 2, 36, 28, tzinfo=tzlocal()),
                         'deletion_grace_period_seconds': None,
                         'deletion_timestamp': None,
                         'finalizers': None,
                         'generate_name': None,
                         'generation': None,
                         'initializers': None,
                         'labels': None,
                         'managed_fields': None,
                         'name': 'controller-k1',
                         'namespace': None,
                         'owner_references': None,
                         'resource_version': '327462',
                         'self_link': '/api/v1/namespaces/controller-k1',
                         'uid': 'ed3e7f82-1a76-4609-8efa-5a2601a49734'},
            'spec': {'finalizers': ['kubernetes']},
            'status': {'phase': 'Active'}},
           {'api_version': None,
            'kind': None,
            'metadata': {'annotations': None,
                         'cluster_name': None,
                         'creation_timestamp': datetime.datetime(2019, 11, 19, 11, 52, tzinfo=tzlocal()),
                         'deletion_grace_period_seconds': None,
                         'deletion_timestamp': None,
                         'finalizers': None,
                         'generate_name': None,
                         'generation': None,
                         'initializers': None,
                         'labels': None,
                         'managed_fields': None,
                         'name': 'default',
                         'namespace': None,
                         'owner_references': None,
                         'resource_version': '47',
                         'self_link': '/api/v1/namespaces/default',
                         'uid': 'dd7ac1f6-7197-4d7b-934f-d4874e8bb14d'},
            'spec': {'finalizers': ['kubernetes']},
            'status': {'phase': 'Active'}},
           {'api_version': None,
            'kind': None,
            'metadata': {'annotations': {'kubectl.kubernetes.io/last-applied-configuration': '{"apiVersion":"v1","kind":"Namespace","metadata":{"annotations":{},"name":"ingress"}}\n'},
                         'cluster_name': None,
                         'creation_timestamp': datetime.datetime(2019, 11, 25, 5, 52, 28, tzinfo=tzlocal()),
                         'deletion_grace_period_seconds': None,
                         'deletion_timestamp': None,
                         'finalizers': None,
                         'generate_name': None,
                         'generation': None,
                         'initializers': None,
                         'labels': None,
                         'managed_fields': None,
                         'name': 'ingress',
                         'namespace': None,
                         'owner_references': None,
                         'resource_version': '186846',
                         'self_link': '/api/v1/namespaces/ingress',
                         'uid': 'af15a587-23e1-45d8-a6ad-bb50505aeed2'},
            'spec': {'finalizers': ['kubernetes']},
            'status': {'phase': 'Active'}},
           {'api_version': None,
            'kind': None,
            'metadata': {'annotations': None,
                         'cluster_name': None,
                         'creation_timestamp': datetime.datetime(2019, 11, 19, 11, 51, 59, tzinfo=tzlocal()),
                         'deletion_grace_period_seconds': None,
                         'deletion_timestamp': None,
                         'finalizers': None,
                         'generate_name': None,
                         'generation': None,
                         'initializers': None,
                         'labels': None,
                         'managed_fields': None,
                         'name': 'kube-node-lease',
                         'namespace': None,
                         'owner_references': None,
                         'resource_version': '6',
                         'self_link': '/api/v1/namespaces/kube-node-lease',
                         'uid': 'b7ebc3dd-3658-45cd-8621-26ffe849f35a'},
            'spec': {'finalizers': ['kubernetes']},
            'status': {'phase': 'Active'}},
           {'api_version': None,
            'kind': None,
            'metadata': {'annotations': None,
                         'cluster_name': None,
                         'creation_timestamp': datetime.datetime(2019, 11, 19, 11, 51, 59, tzinfo=tzlocal()),
                         'deletion_grace_period_seconds': None,
                         'deletion_timestamp': None,
                         'finalizers': None,
                         'generate_name': None,
                         'generation': None,
                         'initializers': None,
                         'labels': None,
                         'managed_fields': None,
                         'name': 'kube-public',
                         'namespace': None,
                         'owner_references': None,
                         'resource_version': '5',
                         'self_link': '/api/v1/namespaces/kube-public',
                         'uid': '3296d2c5-42f6-4398-8583-e2fdc43032f5'},
            'spec': {'finalizers': ['kubernetes']},
            'status': {'phase': 'Active'}},
           {'api_version': None,
            'kind': None,
            'metadata': {'annotations': None,
                         'cluster_name': None,
                         'creation_timestamp': datetime.datetime(2019, 11, 19, 11, 51, 59, tzinfo=tzlocal()),
                         'deletion_grace_period_seconds': None,
                         'deletion_timestamp': None,
                         'finalizers': None,
                         'generate_name': None,
                         'generation': None,
                         'initializers': None,
                         'labels': None,
                         'managed_fields': None,
                         'name': 'kube-system',
                         'namespace': None,
                         'owner_references': None,
                         'resource_version': '4',
                         'self_link': '/api/v1/namespaces/kube-system',
                         'uid': '6b32af7a-7296-4a60-8e96-cd0eacbb77e5'},
            'spec': {'finalizers': ['kubernetes']},
            'status': {'phase': 'Active'}},
           {'api_version': None,
            'kind': None,
            'metadata': {'annotations': {'juju.io/controller': '170db7ac-d09e-4f39-88a6-ec62f618bcff',
                                         'juju.io/model': '835f028c-0e75-4285-88ac-17b2f1aec6cf'},
                         'cluster_name': None,
                         'creation_timestamp': datetime.datetime(2019, 11, 28, 2, 36, 50, tzinfo=tzlocal()),
                         'deletion_grace_period_seconds': None,
                         'deletion_timestamp': None,
                         'finalizers': None,
                         'generate_name': None,
                         'generation': None,
                         'initializers': None,
                         'labels': None,
                         'managed_fields': None,
                         'name': 't1',
                         'namespace': None,
                         'owner_references': None,
                         'resource_version': '327544',
                         'self_link': '/api/v1/namespaces/t1',
                         'uid': 'c22aab77-6d4b-42d0-abb3-ab4827efd4cd'},
            'spec': {'finalizers': ['kubernetes']},
            'status': {'phase': 'Active'}}],
 'kind': 'NamespaceList',
 'metadata': {'_continue': None,
              'resource_version': '328972',
              'self_link': '/api/v1/namespaces'}}

Documentation changes

Yes

Bug reference

None

@wallyworld
Copy link
Member

Merge into devel not 2.7

@ycliuhw ycliuhw changed the base branch from 2.7 to develop November 28, 2019 03:04
@ycliuhw ycliuhw force-pushed the feature/add-k8s-py-to-operator branch from 2102550 to 4fdbebb Compare November 28, 2019 03:07
@ycliuhw
Copy link
Member Author

ycliuhw commented Nov 28, 2019

$$merge$$

@ycliuhw
Copy link
Member Author

ycliuhw commented Nov 28, 2019

non related test failure:

unit_test.go:546:
c.Assert(err, gc.ErrorMatches, "unit's charm URL must be set before retrieving config")
... error string = "unit "wordpress/0" not found"
... regex string = "unit's charm URL must be set before retrieving config"

$$merge$$

@jujubot jujubot merged commit 76be4d2 into juju:develop Nov 28, 2019
@ycliuhw ycliuhw deleted the feature/add-k8s-py-to-operator branch November 28, 2019 05:53
@ycliuhw
Copy link
Member Author

ycliuhw commented Nov 28, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants