http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/UserConfigurationCompare.java ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/UserConfigurationCompare.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/UserConfigurationCompare.java deleted file mode 100644 index a04c900..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/UserConfigurationCompare.java +++ /dev/null @@ -1,201 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.fabric8.kubernetes.api; - -import io.fabric8.kubernetes.api.model.ObjectMeta; -import io.fabric8.kubernetes.api.support.KindToClassMapping; -import io.fabric8.utils.Objects; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.validation.constraints.NotNull; -import java.beans.BeanInfo; -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * Helper methods to compare the user configuration on entities - */ -public class UserConfigurationCompare { - private static final transient Logger LOG = LoggerFactory.getLogger(UserConfigurationCompare.class); - - protected static final Set<String> ignoredProperties = new HashSet<>(Arrays.asList("status")); - - - /** - * This method detects if the user has changed the configuration of an entity. - * <p/> - * It compares the <b>user</b> configuration of 2 object trees ignoring any - * runtime status or timestamp information. - * - * @return true if the configurations are equal. - */ - public static boolean configEqual(Object entity1, Object entity2) { - if (entity1 == entity2) { - return true; - } else if (entity1 == null || entity2 == null) { - return false; - } else if (entity1 instanceof Map) { - return configEqualMap((Map) entity1, castTo(Map.class, entity2)); - } else if (entity2 instanceof Map) { - return configEqualMap((Map) entity1, castTo(Map.class, entity2)); - } else if (entity2 instanceof ObjectMeta) { - return configEqualObjectMeta((ObjectMeta) entity1, castTo(ObjectMeta.class, entity2)); - } else { - Set<Class<?>> classes = new HashSet<>(KindToClassMapping.getKindToClassMap().values()); - Class<?> aClass = entity1.getClass(); - if (classes.contains(aClass)) { - Object castEntity2 = castTo(aClass, entity2); - if (castEntity2 == null) { - return false; - } else { - return configEqualKubernetesDTO(entity1, entity2, aClass); - } - } else { - return Objects.equal(entity1, entity2); - } - } - } - - - /** - * Compares 2 instances of the given Kubernetes DTO class to see if the user has changed their configuration. - * <p/> - * This method will ignore properties {@link #ignoredProperties} such as status or timestamp properties - */ - protected static boolean configEqualKubernetesDTO(@NotNull Object entity1, @NotNull Object entity2, @NotNull Class<?> clazz) { - // lets iterate through the objects making sure we've not - BeanInfo beanInfo = null; - try { - beanInfo = Introspector.getBeanInfo(clazz); - } catch (IntrospectionException e) { - LOG.warn("Failed to get beanInfo for " + clazz.getName() + ". " + e, e); - return false; - } - try { - PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); - for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { - String name = propertyDescriptor.getName(); - if (ignoredProperties.contains(name)) { - continue; - } - Method readMethod = propertyDescriptor.getReadMethod(); - if (readMethod != null) { - Object value1 = invokeMethod(entity1, readMethod); - Object value2 = invokeMethod(entity2, readMethod); - if (!configEqual(value1, value2)) { - return false; - } - } - } - return true; - } catch (Exception e) { - return false; - } - } - - protected static Object invokeMethod(@NotNull Object entity, Method readMethod) throws InvocationTargetException, IllegalAccessException { - try { - return readMethod.invoke(entity); - } catch (Exception e) { - LOG.warn("Failed to invoke method " + readMethod + " on " + entity + ". " + e, e); - throw e; - } - } - - protected static boolean configEqualObjectMeta(ObjectMeta entity1, ObjectMeta entity2) { - if (entity1 == entity2) { - return true; - } else if (entity1 == null || entity2 == null) { - return false; - } - // TODO should we ignore annotations? - return Objects.equal(entity1.getName(), entity2.getName()) && - Objects.equal(entity1.getNamespace(), entity2.getNamespace()) && - configEqualMap(entity1.getLabels(), entity2.getLabels()) && - configEqualMap(entity1.getAnnotations(), entity2.getAnnotations()); - } - - protected static <T> T castTo(Class<T> clazz, Object entity) { - if (clazz.isInstance(entity)) { - return clazz.cast(entity); - } else { - if (entity != null) { - LOG.warn("Invalid class " + entity.getClass().getName() + " when expecting " + clazz.getName() + " for instance: " + entity); - } - return null; - } - } - - protected static boolean configEqualMap(Map entity1, Map entity2) { - if (entity1 == entity2) { - return true; - } else if (entity1 == null || entity2 == null) { - return false; - } - int size1 = size(entity1); - int size2 = size(entity2); - if (size1 != size2) { - return false; - } - Set<Map.Entry> entries = entity1.entrySet(); - for (Map.Entry entry : entries) { - Object key = entry.getKey(); - Object value = entry.getValue(); - Object value2 = entity2.get(key); - if (!configEqual(value, value2)) { - return false; - } - } - return true; - } - - protected static boolean configEqualList(List v1, List v2) { - int size1 = size(v1); - int size2 = size(v2); - if (size1 != size2) { - return false; - } - int idx = 0; - for (Object value : v1) { - Object value2 = v2.get(idx++); - if (!configEqual(value, value2)) { - return false; - } - } - return true; - } - - - protected static int size(Map map) { - return (map == null) ? 0 : map.size(); - } - - protected static int size(Collection coll) { - return (coll == null) ? 0 : coll.size(); - } - -}
http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/Watcher.java ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/Watcher.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/Watcher.java deleted file mode 100644 index 1bf7d2d..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/Watcher.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package io.fabric8.kubernetes.api; - -import io.fabric8.kubernetes.api.model.HasMetadata; - -public interface Watcher<T extends HasMetadata> { - - enum Action { - ADDED, MODIFIED, DELETED, ERROR - } - - void eventReceived(Action action, T object); - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builders/ListEnvVarBuilder.java ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builders/ListEnvVarBuilder.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builders/ListEnvVarBuilder.java deleted file mode 100644 index e97ec01..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builders/ListEnvVarBuilder.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.fabric8.kubernetes.api.builders; - -import io.fabric8.kubernetes.api.model.EnvVar; -import io.fabric8.utils.Strings; - -import java.util.ArrayList; -import java.util.List; - -/** - * A little helper class to build a <code>List<EnvVar></code> object - */ -public class ListEnvVarBuilder { - private List<EnvVar> envVars = new ArrayList<>(); - - public void withEnvVar(String name, String value) { - if (Strings.isNotBlank(name) && value != null) { - EnvVar envVar = new EnvVar(); - envVar.setName(name); - envVar.setValue(value); - envVars.add(envVar); - } - } - - public List<EnvVar> build() { - return envVars; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildFinishedEvent.java ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildFinishedEvent.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildFinishedEvent.java deleted file mode 100644 index 071979c..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildFinishedEvent.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.fabric8.kubernetes.api.builds; - -import io.fabric8.openshift.api.model.Build; - -/** - */ -public class BuildFinishedEvent { - private final String uid; - private final Build build; - private final boolean loading; - private final String buildLink; - - public BuildFinishedEvent(String uid, Build build, boolean loading, String buildLink) { - this.uid = uid; - this.build = build; - this.loading = loading; - this.buildLink = buildLink; - } - - public String getUid() { - return uid; - } - - public Build getBuild() { - return build; - } - - public String getBuildLink() { - return buildLink; - } - - public boolean isLoading() { - return loading; - } - - public String getStatus() { - return build.getStatus().getPhase(); - } - - public String getConfigName() { - return Builds.getBuildConfigName(build); - } - - public String getNamespace() { - return Builds.getNamespace(build); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildListener.java ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildListener.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildListener.java deleted file mode 100644 index 3edf170..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildListener.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.fabric8.kubernetes.api.builds; - -/** - * A strategy for processing completed builds - */ -public interface BuildListener { - /** - * The build that has completed (successfully or not) and the flag indicating whether or not - * this is the first time the watcher is being started up (so you should check if you've already - * received and processed this event before). - */ - void onBuildFinished(BuildFinishedEvent event); -} http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildWatcher.java ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildWatcher.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildWatcher.java deleted file mode 100644 index 5fb1cf4..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildWatcher.java +++ /dev/null @@ -1,121 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.fabric8.kubernetes.api.builds; - -import io.fabric8.kubernetes.api.KubernetesClient; -import io.fabric8.openshift.api.model.Build; -import io.fabric8.openshift.api.model.BuildList; -import io.fabric8.utils.Strings; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.Timer; -import java.util.TimerTask; - -/** - */ -public class BuildWatcher { - private static final transient Logger LOG = LoggerFactory.getLogger(BuildWatcher.class); - - private final KubernetesClient kubernetes; - private final BuildListener buildListener; - private final String namespace; - private final String fabric8ConsoleLink; - private boolean loading = true; - private Set<String> seenBuildIds = Collections.<String>synchronizedSet(new HashSet<String>()); - - public BuildWatcher(KubernetesClient kubernetes, BuildListener buildListener, String namespace, String fabric8ConsoleLink) { - this.kubernetes = kubernetes; - this.buildListener = buildListener; - this.namespace = namespace; - this.fabric8ConsoleLink = fabric8ConsoleLink; - } - - - public TimerTask schedule(long delay) { - Timer timer = new Timer(); - return schedule(timer, delay); - } - - public TimerTask schedule(Timer timer, long delay) { - TimerTask task = new TimerTask() { - @Override - public void run() { - poll(); - } - }; - timer.schedule(task, delay, delay); - return task; - } - - public void poll() { - boolean foundBuild = false; - BuildList buildList = kubernetes.getBuilds(namespace); - if (buildList != null) { - List<Build> items = buildList.getItems(); - if (items != null) { - for (Build build : items) { - buildPolled(build); - foundBuild = true; - } - } - } - if (foundBuild) { - loading = false; - } - } - - protected void buildPolled(Build build) { - String status = build.getStatus().getPhase(); - if (status != null) { - if (Builds.isFinished(status)) { - String uid = Builds.getUid(build); - if (Strings.isNullOrBlank(uid)) { - LOG.warn("Ignoring bad build which has no UID: " + build); - } else { - if (seenBuildIds.add(uid)) { - String name = Builds.getName(build); - String buildLink = Builds.createConsoleBuildLink(this.fabric8ConsoleLink, name); - BuildFinishedEvent event = new BuildFinishedEvent(uid, build, loading, buildLink); - buildListener.onBuildFinished(event); - } - } - } - } - } - - /** - * Waits until this watcher is finished (which by default is forever) - */ - public void join() { - Object lock = new Object(); - while (true) { - synchronized(lock) { - try { - lock.wait(); - } catch (InterruptedException e) { - // ignore - } - } - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/Builds.java ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/Builds.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/Builds.java deleted file mode 100644 index 61f7330..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/Builds.java +++ /dev/null @@ -1,199 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.fabric8.kubernetes.api.builds; - -import io.fabric8.kubernetes.api.KubernetesHelper; -import io.fabric8.openshift.api.model.Build; -import io.fabric8.openshift.api.model.BuildConfig; -import io.fabric8.utils.Objects; -import io.fabric8.utils.Strings; -import io.fabric8.utils.URLUtils; - -import java.util.Collections; -import java.util.Date; -import java.util.Map; - -/** - */ -public class Builds { - - public static class Status { - public static final String COMPLETE = "Complete"; - public static final String FAIL = "Fail"; - public static final String ERROR = "Error"; - public static final String CANCELLED = "Cancelled"; - } - - public static boolean isCompleted(String status) { - return Objects.equal(Status.COMPLETE, status); - } - - public static boolean isCancelled(String status) { - return Objects.equal(Status.CANCELLED, status); - } - - public static boolean isFailed(String status) { - if (status != null) { - return status.startsWith(Status.FAIL) || status.startsWith(Status.ERROR); - } - return false; - } - - public static boolean isFinished(String status) { - return isCompleted(status) || isFailed(status) || isCancelled(status); - } - - /** - * Returns a unique UUID for a build - */ - public static String getUid(Build build) { - String answer = null; - if (build != null) { - answer = build.getMetadata().getUid(); - if (Strings.isNullOrBlank(answer)) { - Map<String, Object> metadata = getMetadata(build); - answer = getString(metadata, "uid"); - if (Strings.isNullOrBlank(answer)) { - answer = getString(metadata, "id"); - } - if (Strings.isNullOrBlank(answer)) { - answer = getString(metadata, "name"); - } - } - if (Strings.isNullOrBlank(answer)) { - answer = build.getMetadata().getName(); - } - } - return answer; - } - - protected static String getString(Map<String, Object> metadata, String name) { - Object answer = metadata.get(name); - if (answer != null) { - return answer.toString(); - } - return null; - } - - public static Map<String, Object> getMetadata(Build build) { - if (build != null) { - Map<String, Object> additionalProperties = build.getAdditionalProperties(); - if (additionalProperties != null) { - Object metadata = additionalProperties.get("metadata"); - if (metadata instanceof Map) { - return (Map<String, Object>) metadata; - } - } - } - return Collections.EMPTY_MAP; - - } - - public static Map<String, Object> getMetadata(BuildConfig build) { - if (build != null) { - Map<String, Object> additionalProperties = build.getAdditionalProperties(); - if (additionalProperties != null) { - Object metadata = additionalProperties.get("metadata"); - if (metadata instanceof Map) { - return (Map<String, Object>) metadata; - } - } - } - return Collections.EMPTY_MAP; - - } - - public static String getName(BuildConfig build) { - String answer = null; - if (build != null) { - Map<String, Object> metadata = getMetadata(build); - answer = getString(metadata, "name"); - if (Strings.isNullOrBlank(answer)) { - answer = build.getMetadata().getName(); - } - } - return answer; - } - - public static String getName(Build build) { - String answer = null; - if (build != null) { - Map<String, Object> metadata = getMetadata(build); - answer = getString(metadata, "name"); - if (Strings.isNullOrBlank(answer)) { - answer = build.getMetadata().getName(); - } - } - return answer; - } - - public static String getNamespace(Build build) { - String answer = null; - if (build != null) { - Map<String, Object> metadata = getMetadata(build); - answer = getString(metadata, "namespace"); - if (Strings.isNullOrBlank(answer)) { - answer = build.getMetadata().getNamespace(); - } - } - return answer; - } - - - public static String getCreationTimestamp(Build build) { - String answer = null; - if (build != null) { - Map<String, Object> metadata = getMetadata(build); - answer = getString(metadata, "creationTimestamp"); - if (Strings.isNullOrBlank(answer)) { - answer = build.getMetadata().getCreationTimestamp(); - } - } - return answer; - } - - public static Date getCreationTimestampDate(Build build) { - String text = getCreationTimestamp(build); - if (Strings.isNullOrBlank(text)) { - return null; - } else { - return KubernetesHelper.parseDate(text); - } - } - - - public static String getBuildConfigName(Build build) { - if (build != null) { - Map<String, Object> metadata = getMetadata(build); - Object labels = metadata.get("labels"); - if (labels instanceof Map) { - Map<String,Object> labelMap = (Map<String,Object>) labels; - return getString(labelMap, "buildconfig"); - } - } - return null; - } - - /** - * Returns the link to the build page in the console for the given build UUID - */ - public static String createConsoleBuildLink(String fabricConsoleExternalUrl, String buildName) { - return URLUtils.pathJoin(fabricConsoleExternalUrl, "kubernetes/builds", buildName); - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/Links.java ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/Links.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/Links.java deleted file mode 100644 index b7b544d..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/Links.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.fabric8.kubernetes.api.builds; - -import io.fabric8.utils.Strings; - -/** - */ -public class Links { - - private static final String DEFAULT_FABRIC8_CONSOLE = "http://fabric8.local/"; - - public static String getFabric8ConsoleLink() { - String answer = System.getenv("FABRIC8_CONSOLE"); - if (Strings.isNullOrBlank(answer)) { - answer = DEFAULT_FABRIC8_CONSOLE; - } - return answer; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/extensions/Configs.java ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/extensions/Configs.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/extensions/Configs.java deleted file mode 100644 index 11ce41c..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/extensions/Configs.java +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.fabric8.kubernetes.api.extensions; - -import io.fabric8.kubernetes.api.model.config.AuthInfo; -import io.fabric8.kubernetes.api.model.config.Config; -import io.fabric8.kubernetes.api.KubernetesHelper; -import io.fabric8.kubernetes.api.model.config.Context; -import io.fabric8.kubernetes.api.model.config.NamedAuthInfo; -import io.fabric8.kubernetes.api.model.config.NamedContext; -import io.fabric8.utils.Objects; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.io.IOException; -import java.util.List; - -/** - * Helper class for working with the YAML config file thats located in - * <code>~/.config/openshift/config</code> which is updated when you use commands - * like <code>osc login</code> and <code>osc project myproject</code> - */ -public class Configs { - public static final String OPENSHIFT_CONFIG_FILE_PROPERTY = "openshift.config.file"; - public static final String OPENSHIFT_CONFIG_FILE_ENV_VAR = "OPENSHIFTCONFIG"; - private static final transient Logger LOG = LoggerFactory.getLogger(Configs.class); - - public static Config parseConfigs() { - File file = getOpenShiftConfigFile(); - if (file.exists() && file.isFile()) { - try { - return KubernetesHelper.loadYaml(file, Config.class); - } catch (IOException e) { - e.printStackTrace(); - } - } - return null; - } - - /** - * Returns the current context in the given config - */ - public static Context getCurrentContext(Config config) { - String contextName = config.getCurrentContext(); - if (contextName != null) { - List<NamedContext> contexts = config.getContexts(); - if (contexts != null) { - for (NamedContext context : contexts) { - if (Objects.equal(contextName, context.getName())) { - return context.getContext(); - } - } - } - } - return null; - } - - /** - * Returns the current user token for the config and current context - */ - public static String getUserToken(Config config, Context context) { - AuthInfo authInfo = getUserAuthInfo(config, context); - if (authInfo != null) { - return authInfo.getToken(); - } - return null; - } - - /** - * Returns the current {@link AuthInfo} for the current context and user - */ - public static AuthInfo getUserAuthInfo(Config config, Context context) { - AuthInfo authInfo = null; - if (config != null && context != null) { - String user = context.getUser(); - if (user != null) { - List<NamedAuthInfo> users = config.getUsers(); - if (users != null) { - for (NamedAuthInfo namedAuthInfo : users) { - if (Objects.equal(user, namedAuthInfo.getName())) { - authInfo = namedAuthInfo.getUser(); - } - } - } - } - } - return authInfo; - } - - public static File getOpenShiftConfigFile() { - String file = System.getProperty(OPENSHIFT_CONFIG_FILE_PROPERTY); - if (file != null) { - return new File(file); - } - file = System.getenv(OPENSHIFT_CONFIG_FILE_ENV_VAR); - if (file != null) { - return new File(file); - } - String homeDir = System.getProperty("user.home", "."); - return new File(homeDir, ".config/openshift/config"); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/extensions/Templates.java ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/extensions/Templates.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/extensions/Templates.java deleted file mode 100644 index 7ecce66..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/extensions/Templates.java +++ /dev/null @@ -1,225 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.fabric8.kubernetes.api.extensions; - -import io.fabric8.kubernetes.api.KubernetesHelper; -import io.fabric8.kubernetes.api.model.HasMetadata; -import io.fabric8.kubernetes.api.model.KubernetesList; -import io.fabric8.openshift.api.model.template.Parameter; -import io.fabric8.openshift.api.model.template.Template; -import io.fabric8.utils.Strings; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -import static io.fabric8.kubernetes.api.KubernetesFactory.createObjectMapper; - -/** - * Helper class for working with OpenShift Templates - */ -public class Templates { - private static final transient Logger LOG = LoggerFactory.getLogger(Templates.class); - - /** - * Allows a list of resources to be combined into a single Template if one or more templates are contained inside the list - * or just return the unchanged list if no templates are present. - */ - public static Object combineTemplates(KubernetesList kubernetesList) { - Template firstTemplate = null; - List<HasMetadata> items = kubernetesList.getItems(); - for (HasMetadata item : items) { - if (item instanceof Template) { - Template template = (Template) item; - if (firstTemplate == null) { - firstTemplate = template; - } else { - firstTemplate = combineTemplates(firstTemplate, template); - } - } - } - if (firstTemplate != null) { - for (HasMetadata object : items) { - if (!(object instanceof Template)) { - addTemplateObject(firstTemplate, object); - } - } - } - return firstTemplate != null ? firstTemplate : kubernetesList; - } - - public static Template combineTemplates(Template firstTemplate, Template template) { - List<HasMetadata> objects = template.getObjects(); - if (objects != null) { - for (HasMetadata object : objects) { - addTemplateObject(firstTemplate, object); - } - } - List<Parameter> parameters = firstTemplate.getParameters(); - if (parameters == null) { - parameters = new ArrayList<>(); - firstTemplate.setParameters(parameters); - } - combineParameters(parameters, template.getParameters()); - String name = KubernetesHelper.getName(template); - if (Strings.isNotBlank(name)) { - // lets merge all the fabric8 annotations using the template id qualifier as a postfix - Map<String, String> annotations = KubernetesHelper.getOrCreateAnnotations(firstTemplate); - Map<String, String> otherAnnotations = KubernetesHelper.getOrCreateAnnotations(template); - Set<Map.Entry<String, String>> entries = otherAnnotations.entrySet(); - for (Map.Entry<String, String> entry : entries) { - String key = entry.getKey(); - String value = entry.getValue(); - if (!annotations.containsKey(key)) { - annotations.put(key, value); - } - } - } - return firstTemplate; - } - - protected static void combineParameters(List<Parameter> parameters, List<Parameter> otherParameters) { - if (otherParameters != null && otherParameters.size() > 0) { - Map<String, Parameter> map = new HashMap<>(); - for (Parameter parameter : parameters) { - map.put(parameter.getName(), parameter); - } - for (Parameter otherParameter : otherParameters) { - String name = otherParameter.getName(); - Parameter original = map.get(name); - if (original == null) { - parameters.add(otherParameter); - } else { - if (Strings.isNotBlank(original.getValue())) { - original.setValue(otherParameter.getValue()); - } - } - } - } - } - - public static void addTemplateObject(Template template, HasMetadata object) { - List<HasMetadata> objects = template.getObjects(); - objects.add(object); - template.setObjects(objects); - } - - - /** - * If we have any templates inside the items then lets unpack them and combine any parameters - * @param kubernetesList - * @param items - */ - public static Object combineTemplates(KubernetesList kubernetesList, List<HasMetadata> items) { - Template template = null; - for (HasMetadata item : items) { - if (item instanceof Template) { - Template aTemplate = (Template) item; - if (template == null) { - template = aTemplate; - } else { - template = combineTemplates(template, aTemplate); - } - } - } - if (template != null) { - // lets move all the content into the template - for (HasMetadata item : items) { - if (!(item instanceof Template)) { - addTemplateObject(template, item); - } - } - List<HasMetadata> objects = template.getObjects(); - return template; - } else { - return kubernetesList; - } - } - - - /** - * Lets allow template parameters to be overridden with a Properties object - */ - public static void overrideTemplateParameters(Template template, Map<String, String> properties, String propertyNamePrefix) { - List<io.fabric8.openshift.api.model.template.Parameter> parameters = template.getParameters(); - if (parameters != null && properties != null) { - boolean missingProperty = false; - for (io.fabric8.openshift.api.model.template.Parameter parameter : parameters) { - String parameterName = parameter.getName(); - String name = propertyNamePrefix + parameterName; - String propertyValue = properties.get(name); - if (Strings.isNotBlank(propertyValue)) { - LOG.info("Overriding template parameter " + name + " with value: " + propertyValue); - parameter.setValue(propertyValue); - } else { - missingProperty = true; - LOG.info("No property defined for template parameter: " + name); - } - } - if (missingProperty) { - LOG.debug("current properties " + new TreeSet<>(properties.keySet())); - } - } - } - - /** - * Lets locally process the templates so that we can process templates on any kubernetes environment - */ - public static KubernetesList processTemplatesLocally(Template entity) throws IOException { - List<HasMetadata> objects = null; - if (entity != null) { - objects = entity.getObjects(); - if (objects == null || objects.isEmpty()) { - return null; - } - } - List<Parameter> parameters = entity.getParameters(); - if (parameters != null && !parameters.isEmpty()) { - String json = "{\"kind\": \"List\", \"apiVersion\": \"" + - KubernetesHelper.defaultApiVersion + "\",\n" + - " \"items\": " + - KubernetesHelper.toJson(objects) + - " }"; - - // lets make a few passes in case there's expressions in values - for (int i = 0; i < 5; i++) { - for (Parameter parameter : parameters) { - String name = parameter.getName(); - String regex = "\\$\\{" + name + "\\}"; - String value = parameter.getValue(); - - // TODO generate random strings for passwords etc! - if (Strings.isNullOrBlank(value)) { - throw new IllegalArgumentException("No value available for parameter name: " + name); - } - json = Strings.replaceAllWithoutRegex(json, regex, value); - } - } - return createObjectMapper().reader(KubernetesList.class).readValue(json); - } else { - KubernetesList answer = new KubernetesList(); - answer.setItems(objects); - return answer; - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/support/KindToClassMapping.java ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/support/KindToClassMapping.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/support/KindToClassMapping.java deleted file mode 100644 index f729942..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/support/KindToClassMapping.java +++ /dev/null @@ -1,264 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.fabric8.kubernetes.api.support; - - -import io.fabric8.kubernetes.api.model.*; -import io.fabric8.kubernetes.api.model.base.ListMeta; -import io.fabric8.kubernetes.api.model.base.Status; -import io.fabric8.kubernetes.api.model.base.StatusCause; -import io.fabric8.kubernetes.api.model.base.StatusDetails; -import io.fabric8.kubernetes.api.model.config.AuthInfo; -import io.fabric8.kubernetes.api.model.config.Cluster; -import io.fabric8.kubernetes.api.model.config.Config; -import io.fabric8.kubernetes.api.model.config.Context; -import io.fabric8.kubernetes.api.model.config.NamedAuthInfo; -import io.fabric8.kubernetes.api.model.config.NamedCluster; -import io.fabric8.kubernetes.api.model.config.NamedContext; -import io.fabric8.kubernetes.api.model.config.NamedExtension; -import io.fabric8.kubernetes.api.model.config.Preferences; -import io.fabric8.kubernetes.api.model.errors.StatusError; -import io.fabric8.kubernetes.api.model.resource.Quantity; -import io.fabric8.kubernetes.api.model.util.IntOrString; -import io.fabric8.openshift.api.model.Build; -import io.fabric8.openshift.api.model.BuildConfig; -import io.fabric8.openshift.api.model.BuildConfigList; -import io.fabric8.openshift.api.model.BuildConfigSpec; -import io.fabric8.openshift.api.model.BuildConfigStatus; -import io.fabric8.openshift.api.model.BuildList; -import io.fabric8.openshift.api.model.BuildOutput; -import io.fabric8.openshift.api.model.BuildSource; -import io.fabric8.openshift.api.model.BuildSpec; -import io.fabric8.openshift.api.model.BuildStatus; -import io.fabric8.openshift.api.model.BuildStrategy; -import io.fabric8.openshift.api.model.BuildTriggerPolicy; -import io.fabric8.openshift.api.model.CustomBuildStrategy; -import io.fabric8.openshift.api.model.CustomDeploymentStrategyParams; -import io.fabric8.openshift.api.model.DeploymentCause; -import io.fabric8.openshift.api.model.DeploymentCauseImageTrigger; -import io.fabric8.openshift.api.model.DeploymentConfig; -import io.fabric8.openshift.api.model.DeploymentConfigList; -import io.fabric8.openshift.api.model.DeploymentConfigSpec; -import io.fabric8.openshift.api.model.DeploymentConfigStatus; -import io.fabric8.openshift.api.model.DeploymentDetails; -import io.fabric8.openshift.api.model.DeploymentStrategy; -import io.fabric8.openshift.api.model.DeploymentTriggerImageChangeParams; -import io.fabric8.openshift.api.model.DeploymentTriggerPolicy; -import io.fabric8.openshift.api.model.DockerBuildStrategy; -import io.fabric8.openshift.api.model.ExecNewPodHook; -import io.fabric8.openshift.api.model.GitBuildSource; -import io.fabric8.openshift.api.model.GitSourceRevision; -import io.fabric8.openshift.api.model.Image; -import io.fabric8.openshift.api.model.ImageChangeTrigger; -import io.fabric8.openshift.api.model.ImageList; -import io.fabric8.openshift.api.model.ImageStream; -import io.fabric8.openshift.api.model.ImageStreamList; -import io.fabric8.openshift.api.model.ImageStreamSpec; -import io.fabric8.openshift.api.model.ImageStreamStatus; -import io.fabric8.openshift.api.model.LifecycleHook; -import io.fabric8.openshift.api.model.NamedTagEventList; -import io.fabric8.openshift.api.model.NamedTagReference; -import io.fabric8.openshift.api.model.OAuthAccessToken; -import io.fabric8.openshift.api.model.OAuthAccessTokenList; -import io.fabric8.openshift.api.model.OAuthAuthorizeToken; -import io.fabric8.openshift.api.model.OAuthAuthorizeTokenList; -import io.fabric8.openshift.api.model.OAuthClient; -import io.fabric8.openshift.api.model.OAuthClientAuthorization; -import io.fabric8.openshift.api.model.OAuthClientAuthorizationList; -import io.fabric8.openshift.api.model.OAuthClientList; -import io.fabric8.openshift.api.model.RecreateDeploymentStrategyParams; -import io.fabric8.openshift.api.model.RollingDeploymentStrategyParams; -import io.fabric8.openshift.api.model.Route; -import io.fabric8.openshift.api.model.RouteList; -import io.fabric8.openshift.api.model.RouteSpec; -import io.fabric8.openshift.api.model.RouteStatus; -import io.fabric8.openshift.api.model.SourceBuildStrategy; -import io.fabric8.openshift.api.model.SourceControlUser; -import io.fabric8.openshift.api.model.SourceRevision; -import io.fabric8.openshift.api.model.TLSConfig; -import io.fabric8.openshift.api.model.TagEvent; -import io.fabric8.openshift.api.model.WebHookTrigger; -import io.fabric8.openshift.api.model.template.Parameter; -import io.fabric8.openshift.api.model.template.Template; - -import java.util.HashMap; -import java.util.Map; - -/** - * Maps the Kubernetes kinds to the Jackson DTO classes - */ -public class KindToClassMapping { - private static Map<String,Class<?>> map = new HashMap<>(); - - static { - map.put("AWSElasticBlockStoreVolumeSource", AWSElasticBlockStoreVolumeSource.class); - map.put("AuthInfo", AuthInfo.class); - map.put("BaseKubernetesList", BaseKubernetesList.class); - map.put("Build", Build.class); - map.put("BuildConfig", BuildConfig.class); - map.put("BuildConfigList", BuildConfigList.class); - map.put("BuildConfigSpec", BuildConfigSpec.class); - map.put("BuildConfigStatus", BuildConfigStatus.class); - map.put("BuildList", BuildList.class); - map.put("BuildOutput", BuildOutput.class); - map.put("BuildSource", BuildSource.class); - map.put("BuildSpec", BuildSpec.class); - map.put("BuildStatus", BuildStatus.class); - map.put("BuildStrategy", BuildStrategy.class); - map.put("BuildTriggerPolicy", BuildTriggerPolicy.class); - map.put("Capabilities", Capabilities.class); - map.put("Cluster", Cluster.class); - map.put("Config", Config.class); - map.put("Container", Container.class); - map.put("ContainerPort", ContainerPort.class); - map.put("ContainerState", ContainerState.class); - map.put("ContainerStateRunning", ContainerStateRunning.class); - map.put("ContainerStateTerminated", ContainerStateTerminated.class); - map.put("ContainerStateWaiting", ContainerStateWaiting.class); - map.put("ContainerStatus", ContainerStatus.class); - map.put("Context", Context.class); - map.put("CustomBuildStrategy", CustomBuildStrategy.class); - map.put("CustomDeploymentStrategyParams", CustomDeploymentStrategyParams.class); - map.put("DeploymentCause", DeploymentCause.class); - map.put("DeploymentCauseImageTrigger", DeploymentCauseImageTrigger.class); - map.put("DeploymentConfig", DeploymentConfig.class); - map.put("DeploymentConfigList", DeploymentConfigList.class); - map.put("DeploymentConfigSpec", DeploymentConfigSpec.class); - map.put("DeploymentConfigStatus", DeploymentConfigStatus.class); - map.put("DeploymentDetails", DeploymentDetails.class); - map.put("DeploymentStrategy", DeploymentStrategy.class); - map.put("DeploymentTriggerImageChangeParams", DeploymentTriggerImageChangeParams.class); - map.put("DeploymentTriggerPolicy", DeploymentTriggerPolicy.class); - map.put("DockerBuildStrategy", DockerBuildStrategy.class); - map.put("EmptyDirVolumeSource", EmptyDirVolumeSource.class); - map.put("EndpointAddress", EndpointAddress.class); - map.put("EndpointPort", EndpointPort.class); - map.put("EndpointSubset", EndpointSubset.class); - map.put("Endpoints", Endpoints.class); - map.put("EndpointsList", EndpointsList.class); - map.put("EnvVar", EnvVar.class); - map.put("EnvVarSource", EnvVarSource.class); - map.put("ExecAction", ExecAction.class); - map.put("ExecNewPodHook", ExecNewPodHook.class); - map.put("GCEPersistentDiskVolumeSource", GCEPersistentDiskVolumeSource.class); - map.put("GitBuildSource", GitBuildSource.class); - map.put("GitRepoVolumeSource", GitRepoVolumeSource.class); - map.put("GitSourceRevision", GitSourceRevision.class); - map.put("GlusterfsVolumeSource", GlusterfsVolumeSource.class); - map.put("HTTPGetAction", HTTPGetAction.class); - map.put("Handler", Handler.class); - map.put("HasMetadata", HasMetadata.class); - map.put("HostPathVolumeSource", HostPathVolumeSource.class); - map.put("ISCSIVolumeSource", ISCSIVolumeSource.class); - map.put("Image", Image.class); - map.put("ImageChangeTrigger", ImageChangeTrigger.class); - map.put("ImageList", ImageList.class); - map.put("ImageStream", ImageStream.class); - map.put("ImageStreamList", ImageStreamList.class); - map.put("ImageStreamSpec", ImageStreamSpec.class); - map.put("ImageStreamStatus", ImageStreamStatus.class); - map.put("IntOrString", IntOrString.class); - map.put("KubeSchema", KubeSchema.class); - map.put("KubernetesList", KubernetesList.class); - map.put("Lifecycle", Lifecycle.class); - map.put("LifecycleHook", LifecycleHook.class); - map.put("ListMeta", ListMeta.class); - map.put("NFSVolumeSource", NFSVolumeSource.class); - map.put("NamedAuthInfo", NamedAuthInfo.class); - map.put("NamedCluster", NamedCluster.class); - map.put("NamedContext", NamedContext.class); - map.put("NamedExtension", NamedExtension.class); - map.put("NamedTagEventList", NamedTagEventList.class); - map.put("NamedTagReference", NamedTagReference.class); - map.put("Namespace", Namespace.class); - map.put("NamespaceList", NamespaceList.class); - map.put("NamespaceSpec", NamespaceSpec.class); - map.put("NamespaceStatus", NamespaceStatus.class); - map.put("Node", Node.class); - map.put("NodeAddress", NodeAddress.class); - map.put("NodeCondition", NodeCondition.class); - map.put("NodeList", NodeList.class); - map.put("NodeSpec", NodeSpec.class); - map.put("NodeStatus", NodeStatus.class); - map.put("NodeSystemInfo", NodeSystemInfo.class); - map.put("OAuthAccessToken", OAuthAccessToken.class); - map.put("OAuthAccessTokenList", OAuthAccessTokenList.class); - map.put("OAuthAuthorizeToken", OAuthAuthorizeToken.class); - map.put("OAuthAuthorizeTokenList", OAuthAuthorizeTokenList.class); - map.put("OAuthClient", OAuthClient.class); - map.put("OAuthClientAuthorization", OAuthClientAuthorization.class); - map.put("OAuthClientAuthorizationList", OAuthClientAuthorizationList.class); - map.put("OAuthClientList", OAuthClientList.class); - map.put("ObjectFieldSelector", ObjectFieldSelector.class); - map.put("ObjectMeta", ObjectMeta.class); - map.put("ObjectReference", ObjectReference.class); - map.put("Parameter", Parameter.class); - map.put("PersistentVolumeClaimVolumeSource", PersistentVolumeClaimVolumeSource.class); - map.put("Pod", Pod.class); - map.put("PodCondition", PodCondition.class); - map.put("PodList", PodList.class); - map.put("PodSpec", PodSpec.class); - map.put("PodStatus", PodStatus.class); - map.put("PodTemplateSpec", PodTemplateSpec.class); - map.put("Preferences", Preferences.class); - map.put("Probe", Probe.class); - map.put("Quantity", Quantity.class); - map.put("RecreateDeploymentStrategyParams", RecreateDeploymentStrategyParams.class); - map.put("ReplicationController", ReplicationController.class); - map.put("ReplicationControllerList", ReplicationControllerList.class); - map.put("ReplicationControllerSpec", ReplicationControllerSpec.class); - map.put("ReplicationControllerStatus", ReplicationControllerStatus.class); - map.put("ResourceRequirements", ResourceRequirements.class); - map.put("RollingDeploymentStrategyParams", RollingDeploymentStrategyParams.class); - map.put("Route", Route.class); - map.put("RouteList", RouteList.class); - map.put("SourceBuildStrategy", SourceBuildStrategy.class); - map.put("RouteSpec", RouteSpec.class); - map.put("RouteStatus", RouteStatus.class); - map.put("SELinuxOptions", SELinuxOptions.class); - map.put("Secret", Secret.class); - map.put("SecretList", SecretList.class); - map.put("SecretVolumeSource", SecretVolumeSource.class); - map.put("SecurityContext", SecurityContext.class); - map.put("Service", Service.class); - map.put("ServiceAccount", ServiceAccount.class); - map.put("ServiceAccountList", ServiceAccountList.class); - map.put("ServiceList", ServiceList.class); - map.put("ServicePort", ServicePort.class); - map.put("ServiceSpec", ServiceSpec.class); - map.put("ServiceStatus", ServiceStatus.class); - map.put("SourceBuildStrategy", SourceBuildStrategy.class); - map.put("SourceControlUser", SourceControlUser.class); - map.put("SourceRevision", SourceRevision.class); - map.put("Status", Status.class); - map.put("StatusCause", StatusCause.class); - map.put("StatusDetails", StatusDetails.class); - map.put("StatusError", StatusError.class); - map.put("TCPSocketAction", TCPSocketAction.class); - map.put("TLSConfig", TLSConfig.class); - map.put("TagEvent", TagEvent.class); - map.put("Template", Template.class); - map.put("Volume", Volume.class); - map.put("VolumeMount", VolumeMount.class); - map.put("WebHookTrigger", WebHookTrigger.class); - } - - public static Map<String,Class<?>> getKindToClassMap() { - return map; - } -} - http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/Dockerfile ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/Dockerfile b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/Dockerfile deleted file mode 100644 index ace984d..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -FROM google/nodejs -RUN npm i -g raml2html -ADD . /data -CMD ["-i", "/data/kubernetes.raml", "-o", "/data/kubernetes.html"] -ENTRYPOINT ["raml2html"] http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/controller-list.json ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/controller-list.json b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/controller-list.json deleted file mode 100644 index 2977476..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/controller-list.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "kind": "ReplicationControllerList", - "apiVersion": "v1beta1", - "items": [ - { - "id": "testRun", - "desiredState": { - "replicas": 2, - "replicaSelector": { - "name": "testRun" - }, - "podTemplate": { - "desiredState": { - "manifest": { - "version": "v1beta1", - "image": "dockerfile/nginx", - "networkPorts": [ - { - "hostPort": 8080, - "containerPort": 80 - } - ] - } - }, - "labels": { - "name": "testRun" - } - } - }, - "labels": { - "name": "testRun" - } - } - ] -} http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/controller.json ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/controller.json b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/controller.json deleted file mode 100644 index 6697ce1..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/controller.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "kind": "ReplicationController", - "apiVersion": "v1beta3", - "metadata": { - "name": "nginx-controller", - "labels": {"name": "nginx"} - }, - "spec": { - "replicas": 2, - "selector": {"name": "nginx"}, - "template": { - "metadata": { - "labels": {"name": "nginx"} - }, - "spec": { - "containers": [{ - "name": "nginx", - "image": "dockerfile/nginx", - "ports": [{"containerPort": 80}] - }] - } - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/external-service.json ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/external-service.json b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/external-service.json deleted file mode 100644 index 00dfa13..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/external-service.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "id": "example", - "kind": "Service", - "apiVersion": "v1beta1", - "port": 8000, - "labels": { - "name": "nginx" - }, - "selector": { - "name": "nginx" - }, - "createExternalLoadBalancer": true -} http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/list.json ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/list.json b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/list.json deleted file mode 100644 index 3c2566f..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/list.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "kind" : "List", - "apiVersion" : "v1beta3", - "items" : [ { - "kind": "Service", - "apiVersion": "v1beta3", - "metadata": { - "name": "fabric8-console-service", - "namespace": "default", - "selfLink": "/api/v1beta1/services/fabric8-console-service?namespace=default", - "uid": "a2dac9a2-f22a-11e4-b882-fa163ee36154", - "resourceVersion": "61428", - "creationTimestamp": "2015-05-04T06:56:06Z", - "labels": { - "component": "console", - "provider": "fabric8" - } - }, - "spec": { - "ports": [ - { - "name": "", - "protocol": "TCP", - "port": 80, - "targetPort": 9090 - } - ], - "selector": { - "component": "console", - "provider": "fabric8" - }, - "portalIP": "172.30.129.192", - "sessionAffinity": "None" - }, - "status": {} - }, { - "kind": "ReplicationController", - "apiVersion": "v1beta3", - "metadata": { - "name": "fabric8-console-controller", - "namespace": "default", - "selfLink": "/api/v1beta1/replicationControllers/fabric8-console-controller?namespace=default", - "uid": "d4253743-f22a-11e4-b882-fa163ee36154", - "resourceVersion": "61718", - "creationTimestamp": "2015-05-04T06:57:28Z", - "labels": { - "component": "console", - "provider": "fabric8" - } - }, - "spec": { - "replicas": 1, - "selector": { - "component": "console", - "provider": "fabric8" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "component": "console", - "provider": "fabric8" - } - }, - "spec": { - "volumes": [], - "containers": [ - { - "name": "fabric8-console-container", - "image": "fabric8/hawtio-kubernetes", - "ports": [ - { - "name": "http", - "containerPort": 9090, - "protocol": "TCP" - }, - { - "name": "jolokia", - "containerPort": 8778, - "protocol": "TCP" - } - ], - "resources": {}, - "terminationMessagePath": "/dev/termination-log", - "imagePullPolicy": "Always", - "capabilities": {} - } - ], - "restartPolicy": "Always", - "dnsPolicy": "ClusterFirst" - } - } - }, - "status": { - "replicas": 1 - } - }] -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod-list-empty-results.json ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod-list-empty-results.json b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod-list-empty-results.json deleted file mode 100644 index 2793f49..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod-list-empty-results.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "kind": "PodList", - "selfLink": "/api/v1beta1/pods", - "resourceVersion": 56138, - "apiVersion": "v1beta3", - "items": [ - { - "kind": "Pod", - "apiVersion": "v1beta3", - "metadata": { - }, - "status": { - "phase": "Running", - "hostIP": "127.0.0.1", - "podIP": "172.17.0.180" - } - } - ] -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod-list.json ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod-list.json b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod-list.json deleted file mode 100644 index 261a052..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod-list.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1beta3", - "items": [ - { - "kind": "Pod", - "apiVersion": "v1beta3", - "metadata": { - "name": "my-pod-1", - "generateName": "nexus-controller-", - "namespace": "default", - "selfLink": "/api/v1beta1/pods/nexus-controller-qq4p9?namespace=default", - "uid": "2cf18435-f310-11e4-b882-fa163ee36154", - "resourceVersion": "89638", - "creationTimestamp": "2015-05-05T10:19:12Z", - "labels": { - "component": "nexus", - "provider": "fabric8" - } - }, - "spec": { - "volumes": [ - { - "name": "nexus-storage", - "hostPath": null, - "emptyDir": { - "medium": "" - }, - "gcePersistentDisk": null, - "gitRepo": null, - "secret": null, - "nfs": null, - "iscsi": null, - "glusterfs": null - } - ], - "containers": [ - { - "name": "nginx", - "image": "dockerfile/nginx", - "ports": [ - { - "name": "http", - "containerPort": 8081, - "protocol": "TCP" - } - ], - "resources": {}, - "volumeMounts": [ - { - "name": "nexus-storage", - "mountPath": "/sonatype-work/storage" - } - ], - "terminationMessagePath": "/dev/termination-log", - "imagePullPolicy": "IfNotPresent", - "capabilities": {} - } - ], - "restartPolicy": "Always", - "dnsPolicy": "ClusterFirst", - "host": "jimmi-docker-2.osop.rhcloud.com" - }, - "status": { - "phase": "Running", - "Condition": [ - { - "type": "Ready", - "status": "True" - } - ], - "hostIP": "fe80::f816:3eff:fee3:6154", - "podIP": "172.17.0.180", - "containerStatuses": [ - { - "name": "nexus-container", - "state": { - "running": { - "startedAt": "2015-05-05T10:19:51Z" - } - }, - "lastState": {}, - "ready": true, - "restartCount": 0, - "image": "fabric8/nexus", - "imageID": "docker://0723d5f32ce06d8a72b6c2c3b3df84e4f8369e4ca6b836e312899118f2fe6575", - "containerID": "docker://65dce1c091f9fac1679ed0c555df58b2f60a17cc5f85922358b28a1fd6b3f1f4" - } - ] - } - } - ] -} http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod.json ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod.json b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod.json deleted file mode 100644 index 72d2f40..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "kind": "Pod", - "apiVersion": "v1beta3", - "metadata": { - "name": "php", - "labels": { - "name": "foo" - } - }, - "spec": { - "containers": [ - { - "name": "nginx", - "image": "dockerfile/nginx", - "ports": [ - { - "hostPort": 8080, - "containerPort": 80, - "protocol": "TCP" - } - ], - "livenessProbe": { - "httpGet": { - "path": "/index.html", - "port": 8080 - }, - "initialDelaySeconds": 30, - "timeoutSeconds": 1 - }, - "imagePullPolicy": "IfNotPresent" - } - ] - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/service-list.json ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/service-list.json b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/service-list.json deleted file mode 100644 index 9f95f67..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/service-list.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "kind": "ServiceList", - "apiVersion": "v1beta1", - "items": [ - { - "id": "example1", - "port": 8000, - "labels": { - "name": "nginx" - }, - "selector": { - "name": "nginx" - } - }, - { - "id": "example2", - "port": 8080, - "labels": { - "env": "prod", - "name": "jetty" - }, - "selector": { - "env": "prod", - "name": "jetty" - } - } - ] -} http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/service.json ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/service.json b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/service.json deleted file mode 100644 index 42388e7..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/service.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "kind": "Service", - "apiVersion": "v1beta3", - "metadata": { - "name": "fabric8-console-service", - "namespace": "default", - "selfLink": "/api/v1beta1/services/fabric8-console-service?namespace=default", - "uid": "a2dac9a2-f22a-11e4-b882-fa163ee36154", - "resourceVersion": "61428", - "creationTimestamp": "2015-05-04T06:56:06Z", - "labels": { - "component": "console", - "provider": "fabric8" - } - }, - "spec": { - "ports": [ - { - "name": "", - "protocol": "TCP", - "port": 80, - "targetPort": 9090 - } - ], - "selector": { - "component": "console", - "provider": "fabric8" - }, - "portalIP": "172.30.129.192", - "sessionAffinity": "None" - }, - "status": {} -} http://git-wip-us.apache.org/repos/asf/stratos/blob/de610a67/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/template.json ---------------------------------------------------------------------- diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/template.json b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/template.json deleted file mode 100644 index 5e40e67..0000000 --- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/template.json +++ /dev/null @@ -1,146 +0,0 @@ -{ - "kind": "Template", - "apiVersion": "v1beta3", - "metadata": { - "name": "jenkins", - "namespace": "default", - "selfLink": "/osapi/v1beta1/templates/jenkins?namespace=default", - "uid": "420dc894-f24f-11e4-b882-fa163ee36154", - "resourceVersion": "66310", - "creationTimestamp": "2015-05-04T11:18:15Z" - }, - "objects": [ - { - "kind": "Service", - "apiVersion": "v1beta3", - "metadata": { - "name": "jenkins", - "creationTimestamp": null, - "labels": { - "component": "jenkins", - "provider": "fabric8" - } - }, - "spec": { - "ports": [ - { - "name": "", - "protocol": "TCP", - "port": 80, - "targetPort": 8080 - } - ], - "selector": { - "component": "jenkins", - "provider": "fabric8" - }, - "portalIP": "", - "sessionAffinity": "None" - }, - "status": {} - }, - { - "kind": "ReplicationController", - "apiVersion": "v1beta3", - "metadata": { - "name": "jenkins-controller", - "creationTimestamp": null, - "labels": { - "component": "jenkins", - "provider": "fabric8" - } - }, - "spec": { - "replicas": 1, - "selector": { - "component": "jenkins", - "provider": "fabric8" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "component": "jenkins", - "provider": "fabric8" - } - }, - "spec": { - "volumes": [ - { - "name": "docker-socket", - "hostPath": { - "path": "/var/run/docker.sock" - }, - "emptyDir": null, - "gcePersistentDisk": null, - "gitRepo": null, - "secret": null, - "nfs": null, - "iscsi": null, - "glusterfs": null - }, - { - "name": "jenkins-workspace", - "hostPath": null, - "emptyDir": { - "medium": "" - }, - "gcePersistentDisk": null, - "gitRepo": null, - "secret": null, - "nfs": null, - "iscsi": null, - "glusterfs": null - } - ], - "containers": [ - { - "name": "jenkins-container", - "image": "fabric8/jenkins", - "ports": [ - { - "name": "http", - "containerPort": 8080, - "protocol": "TCP" - } - ], - "env": [ - { - "name": "SEED_GIT_URL", - "value": "${SEED_GIT_URL}" - } - ], - "resources": {}, - "volumeMounts": [ - { - "name": "jenkins-workspace", - "mountPath": "/var/jenkins_home/workspace" - }, - { - "name": "docker-socket", - "mountPath": "/var/run/docker.sock" - } - ], - "terminationMessagePath": "/dev/termination-log", - "imagePullPolicy": "IfNotPresent", - "capabilities": {} - } - ], - "restartPolicy": "Always", - "dnsPolicy": "ClusterFirst" - } - } - }, - "status": { - "replicas": 0 - } - } - ], - "parameters": [ - { - "name": "SEED_GIT_URL", - "description": "The git URL of the seed build used to generate builds", - "value": "https://github.com/fabric8io/jenkins-pipeline-dsl.git" - } - ] -}
