All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.containersolutions.operator.sample.WebServerOperator Maven / Gradle / Ivy

There is a newer version: 1.3.0
Show newest version
package com.github.containersolutions.operator.sample;

import com.github.containersolutions.operator.Operator;
import io.fabric8.kubernetes.client.Config;
import io.fabric8.kubernetes.client.ConfigBuilder;
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.takes.facets.fork.FkRegex;
import org.takes.facets.fork.TkFork;
import org.takes.http.Exit;
import org.takes.http.FtBasic;

import java.io.IOException;

public class WebServerOperator {

    private static final Logger log = LoggerFactory.getLogger(WebServerOperator.class);

    public static void main(String[] args) throws IOException {
        log.info("WebServer Operator starting!");

        Config config = new ConfigBuilder().withNamespace(null).build();
        KubernetesClient client = new DefaultKubernetesClient(config);
        Operator operator = new Operator(client);
        operator.registerControllerForAllNamespaces(new WebServerController(client));

        new FtBasic(
                new TkFork(new FkRegex("/health", "ALL GOOD!")), 8080
        ).start(Exit.NEVER);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy