Scott Baker | 82b2b08 | 2018-04-16 16:02:14 -0700 | [diff] [blame^] | 1 | # Copyright 2017-present Open Networking Foundation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | """ |
| 16 | pull_pods.py |
| 17 | |
| 18 | Implements a syncstep to pull information about pods form Kubernetes. |
| 19 | """ |
| 20 | |
| 21 | from synchronizers.new_base.pullstep import PullStep |
| 22 | from synchronizers.new_base.modelaccessor import KubernetesServiceInstance |
| 23 | |
| 24 | from xosconfig import Config |
| 25 | from multistructlog import create_logger |
| 26 | |
| 27 | from kubernetes import client as kubernetes_client, config as kubernetes_config |
| 28 | |
| 29 | log = create_logger(Config().get('logging')) |
| 30 | |
| 31 | class KubernetesServiceInstancePullStep(PullStep): |
| 32 | """ |
| 33 | KubernetesServiceInstancePullStep |
| 34 | |
| 35 | Pull information from Kubernetes. |
| 36 | """ |
| 37 | |
| 38 | def __init__(self): |
| 39 | super(KubernetesServiceInstancePullStep, self).__init__(observed_model=KubernetesServiceInstance) |
| 40 | |
| 41 | kubernetes_config.load_incluster_config() |
| 42 | self.v1 = kubernetes_client.CoreV1Api() |
| 43 | |
| 44 | def pull_records(self): |
| 45 | # TODO(smbaker): implement pull step here |
| 46 | pass |
| 47 | |