blob: 400396da52e979ce4d5894f174e0d003366ed7b2 [file] [log] [blame]
Scott Baker82b2b082018-04-16 16:02:14 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16"""
17 sync_kubernetesserviceinstance.py
18
19 Synchronize KubernetesServiceInstance. See also the related pull_step.
20"""
21
22from synchronizers.new_base.syncstep import SyncStep
23from synchronizers.new_base.modelaccessor import KubernetesServiceInstance
24
25from xosconfig import Config
26from multistructlog import create_logger
27
28from kubernetes import client as kubernetes_client, config as kubernetes_config
29
30log = create_logger(Config().get('logging'))
31
32class SyncKubernetesServiceInstance(SyncStep):
33
34 """
35 SyncKubernetesServiceInstance
36
37 Implements sync step for syncing kubernetes service instances.
38 """
39
40 provides = [KubernetesServiceInstance]
41 observes = KubernetesServiceInstance
42 requested_interval = 0
43
44 def __init__(self, *args, **kwargs):
45 super(SyncKubernetesServiceInstance, self).__init__(*args, **kwargs)
46
47 kubernetes_config.load_incluster_config()
48 self.v1 = kubernetes_client.CoreV1Api()
49
50 def sync_record(self, o):
51 # TODO(smbaker): implement sync step here
52 pass
53
54
55 def delete_record(self, port):
56 # TODO(smbaker): implement delete sync step here
57 pass
58