Search in sources :

Example 1 with KubernetesModelGenerator

use of com.github.isdream.jointware.kubernetes.KubernetesModelGenerator in project jointware by isdream.

the class KubernetesExecutor method doCreateOrReplace.

@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
protected Object doCreateOrReplace(Object client, String kind, Map<String, Map<String, Object>> params) throws Exception {
    CreateOrReplaceable instance = (CreateOrReplaceable) getKindModel(client, kind);
    KubernetesModelGenerator generator = new KubernetesModelGenerator(getObjectRef());
    Object param = generator.toObject(params, kind);
    return instance.createOrReplace(param);
}
Also used : KubernetesModelGenerator(com.github.isdream.jointware.kubernetes.KubernetesModelGenerator) CreateOrReplaceable(io.fabric8.kubernetes.client.dsl.CreateOrReplaceable)

Example 2 with KubernetesModelGenerator

use of com.github.isdream.jointware.kubernetes.KubernetesModelGenerator in project jointware by isdream.

the class KubernetesExecutor method doCreate.

/**
 **********************************************************************************
 *
 ***********************************************************************************
 */
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
protected Object doCreate(Object client, String kind, Map<String, Map<String, Object>> params) throws Exception {
    Createable instance = (Createable) getKindModel(client, kind);
    KubernetesModelGenerator generator = new KubernetesModelGenerator(getObjectRef());
    Object param = generator.toObject(params, kind);
    return instance.create(param);
}
Also used : Createable(io.fabric8.kubernetes.client.dsl.Createable) KubernetesModelGenerator(com.github.isdream.jointware.kubernetes.KubernetesModelGenerator)

Example 3 with KubernetesModelGenerator

use of com.github.isdream.jointware.kubernetes.KubernetesModelGenerator in project jointware by isdream.

the class JSONToExecutorSampleTest method main.

/**
 ********************************************
 *
 *                Main
 *
 *********************************************
 */
public static void main(String[] args) throws Exception {
    // JsonToMap
    Map<String, Map<String, Object>> originRequest = getClientRequest();
    // getClient
    DefaultKubernetesClient client = (DefaultKubernetesClient) createClient(originRequest.get("target"));
    // toTartgetMap
    Map<String, Map<String, Object>> targetRequest = toTargetMap(originRequest, "jointwareRef");
    // option : test
    ModelGenerator mg = new KubernetesModelGenerator();
    System.out.println(mg.toObject(targetRequest, Deployment.class.getSimpleName()));
    // getExcutor
    ConatinerExecutor executor = (ConatinerExecutor) createExecutor(originRequest.get("target"));
// impl
// executor.create(client, getKind(originRequest.remove("target")), targetRequest);
}
Also used : KubernetesModelGenerator(com.github.isdream.jointware.kubernetes.KubernetesModelGenerator) KubernetesModelGenerator(com.github.isdream.jointware.kubernetes.KubernetesModelGenerator) ModelGenerator(com.github.isdream.jointware.core.ModelGenerator) DefaultKubernetesClient(io.fabric8.kubernetes.client.DefaultKubernetesClient) Map(java.util.Map)

Example 4 with KubernetesModelGenerator

use of com.github.isdream.jointware.kubernetes.KubernetesModelGenerator in project jointware by isdream.

the class SimpleSampleTest method main.

/**
 * @param args
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
    ConatinerExecutor dp = new KubernetesExecutor();
    // dp.create(createClient(), Namespace.class.getSimpleName(), getParams(NAMESPACE));
    // System.out.println(dp.query(createClient(), Namespace.class.getSimpleName(), "development"));
    // dp.create(createClient(), Deployment.class.getSimpleName(), getParams(DEPLOYMENT));
    // System.out.println( getParams(DEPLOYMENT));
    KubernetesModelGenerator gr = new KubernetesModelGenerator();
    // System.out.println(gr.toObject(getParams(NAMESPACE), Namespace.class.getSimpleName()));
    System.out.println(gr.toObject(getParams(DEPLOYMENT), Deployment.class.getSimpleName()));
}
Also used : KubernetesModelGenerator(com.github.isdream.jointware.kubernetes.KubernetesModelGenerator) KubernetesExecutor(com.github.isdream.jointware.containers.impl.KubernetesExecutor)

Aggregations

KubernetesModelGenerator (com.github.isdream.jointware.kubernetes.KubernetesModelGenerator)4 KubernetesExecutor (com.github.isdream.jointware.containers.impl.KubernetesExecutor)1 ModelGenerator (com.github.isdream.jointware.core.ModelGenerator)1 DefaultKubernetesClient (io.fabric8.kubernetes.client.DefaultKubernetesClient)1 CreateOrReplaceable (io.fabric8.kubernetes.client.dsl.CreateOrReplaceable)1 Createable (io.fabric8.kubernetes.client.dsl.Createable)1 Map (java.util.Map)1