@Test public void testInit() throws IOException { KubeConfig kubeConfig = new KubeConfig(); kubeConfig.setPollFrequencyInSeconds(10); KubeService poll = new KubeService(kubeConfig); assertEquals(10 * 1000, poll.getPollFrequency()); kubeConfig.setPollFrequencyInSeconds(7200); try { poll = new KubeService(kubeConfig); fail("Must throw an exception when initialized with bad poll frequency"); } catch (IllegalArgumentException e) { } }
private void init(KubeConfig kubeConfig) { if (kubeConfig.getPollFrequencyInSeconds() > MD_MAX_POLL_DELAY) { throw new IllegalArgumentException("Too long kubeMdPollFrequency, should be configured to less than " + MD_MAX_POLL_DELAY + " seconds"); } pollFrequency = kubeConfig.getPollFrequencyInSeconds() * MILLISECONDS_IN_SECONDS; podLogDirectory = kubeConfig.getPodLogDirectory(); kubePollDelay = kubeConfig.getKubePollStartDelaySeconds() * MILLISECONDS_IN_SECONDS; }
KubeService implements Runnable { private void init(KubeConfig kubeConfig) { if (kubeConfig.getPollFrequencyInSeconds() > MD_MAX_POLL_DELAY) { throw new IllegalArgumentException("Too long kubeMdPollFrequency, should be configured to less than " + MD_MAX_POLL_DELAY + " seconds"); } pollFrequency = kubeConfig.getPollFrequencyInSeconds() * MILLISECONDS_IN_SECONDS; podLogDirectory = kubeConfig.getPodLogDirectory(); kubePollDelay = kubeConfig.getKubePollStartDelaySeconds() * MILLISECONDS_IN_SECONDS; } }
KubeService implements Runnable { private void init(KubeConfig kubeConfig) { if (kubeConfig.getPollFrequencyInSeconds() > MD_MAX_POLL_DELAY) { throw new IllegalArgumentException("Too long kubeMdPollFrequency, should be configured to less than " + MD_MAX_POLL_DELAY + " seconds"); } pollFrequency = kubeConfig.getPollFrequencyInSeconds() * MILLISECONDS_IN_SECONDS; podLogDirectory = kubeConfig.getPodLogDirectory(); kubePollDelay = kubeConfig.getKubePollStartDelaySeconds() * MILLISECONDS_IN_SECONDS; } private  KubeService(); @VisibleForTesting protected  KubeService(KubeConfig kubeConfig); }
KubeService implements Runnable { private void init(KubeConfig kubeConfig) { if (kubeConfig.getPollFrequencyInSeconds() > MD_MAX_POLL_DELAY) { throw new IllegalArgumentException("Too long kubeMdPollFrequency, should be configured to less than " + MD_MAX_POLL_DELAY + " seconds"); } pollFrequency = kubeConfig.getPollFrequencyInSeconds() * MILLISECONDS_IN_SECONDS; podLogDirectory = kubeConfig.getPodLogDirectory(); kubePollDelay = kubeConfig.getKubePollStartDelaySeconds() * MILLISECONDS_IN_SECONDS; } private  KubeService(); @VisibleForTesting protected  KubeService(KubeConfig kubeConfig); synchronized static KubeService getInstance(); @Override void run(); void updatePodNames(); void updatePodWatchers(String podName, boolean isDelete); Set<String> fetchPodNamesFromMetadata(); int getPollFrequency(); Set<String> getActivePodSet(); synchronized void addWatcher(PodWatcher watcher); synchronized void removeWatcher(PodWatcher watcher); void start(); void stop(); void checkAndProcessFsEvents(); static void reset(); }
KubeService implements Runnable { private void init(KubeConfig kubeConfig) { if (kubeConfig.getPollFrequencyInSeconds() > MD_MAX_POLL_DELAY) { throw new IllegalArgumentException("Too long kubeMdPollFrequency, should be configured to less than " + MD_MAX_POLL_DELAY + " seconds"); } pollFrequency = kubeConfig.getPollFrequencyInSeconds() * MILLISECONDS_IN_SECONDS; podLogDirectory = kubeConfig.getPodLogDirectory(); kubePollDelay = kubeConfig.getKubePollStartDelaySeconds() * MILLISECONDS_IN_SECONDS; } private  KubeService(); @VisibleForTesting protected  KubeService(KubeConfig kubeConfig); synchronized static KubeService getInstance(); @Override void run(); void updatePodNames(); void updatePodWatchers(String podName, boolean isDelete); Set<String> fetchPodNamesFromMetadata(); int getPollFrequency(); Set<String> getActivePodSet(); synchronized void addWatcher(PodWatcher watcher); synchronized void removeWatcher(PodWatcher watcher); void start(); void stop(); void checkAndProcessFsEvents(); static void reset();  }