Search in sources :

Example 6 with FlinkConfigManager

use of org.apache.flink.kubernetes.operator.config.FlinkConfigManager in project flink-kubernetes-operator by apache.

the class FlinkOperatorWebhook method main.

public static void main(String[] args) throws Exception {
    EnvUtils.logEnvironmentInfo(LOG, "Flink Kubernetes Webhook", args);
    FlinkConfigManager configManager = new FlinkConfigManager();
    Set<FlinkResourceValidator> validators = ValidatorUtils.discoverValidators(configManager);
    AdmissionHandler endpoint = new AdmissionHandler(new FlinkValidator(validators, configManager));
    ChannelInitializer<SocketChannel> initializer = createChannelInitializer(endpoint);
    NioEventLoopGroup bossGroup = new NioEventLoopGroup(1);
    NioEventLoopGroup workerGroup = new NioEventLoopGroup();
    try {
        ServerBootstrap bootstrap = new ServerBootstrap();
        bootstrap.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class).childHandler(initializer);
        Channel serverChannel = bootstrap.bind(getPort()).sync().channel();
        InetSocketAddress bindAddress = (InetSocketAddress) serverChannel.localAddress();
        InetAddress inetAddress = bindAddress.getAddress();
        LOG.info("Webhook listening at {}" + ':' + "{}", inetAddress.getHostAddress(), bindAddress.getPort());
        serverChannel.closeFuture().sync();
    } finally {
        bossGroup.shutdownGracefully();
        workerGroup.shutdownGracefully();
    }
}
Also used : NioServerSocketChannel(org.apache.flink.shaded.netty4.io.netty.channel.socket.nio.NioServerSocketChannel) SocketChannel(org.apache.flink.shaded.netty4.io.netty.channel.socket.SocketChannel) NioServerSocketChannel(org.apache.flink.shaded.netty4.io.netty.channel.socket.nio.NioServerSocketChannel) InetSocketAddress(java.net.InetSocketAddress) NioServerSocketChannel(org.apache.flink.shaded.netty4.io.netty.channel.socket.nio.NioServerSocketChannel) SocketChannel(org.apache.flink.shaded.netty4.io.netty.channel.socket.SocketChannel) Channel(org.apache.flink.shaded.netty4.io.netty.channel.Channel) FlinkConfigManager(org.apache.flink.kubernetes.operator.config.FlinkConfigManager) FlinkResourceValidator(org.apache.flink.kubernetes.operator.validation.FlinkResourceValidator) ServerBootstrap(org.apache.flink.shaded.netty4.io.netty.bootstrap.ServerBootstrap) InetAddress(java.net.InetAddress) NioEventLoopGroup(org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoopGroup)

Aggregations

FlinkConfigManager (org.apache.flink.kubernetes.operator.config.FlinkConfigManager)6 Configuration (org.apache.flink.configuration.Configuration)5 BeforeEach (org.junit.jupiter.api.BeforeEach)2 Test (org.junit.jupiter.api.Test)2 Ingress (io.fabric8.kubernetes.api.model.networking.v1.Ingress)1 IngressRule (io.fabric8.kubernetes.api.model.networking.v1.IngressRule)1 File (java.io.File)1 InetAddress (java.net.InetAddress)1 InetSocketAddress (java.net.InetSocketAddress)1 HashMap (java.util.HashMap)1 KubernetesHaServicesFactory (org.apache.flink.kubernetes.highavailability.KubernetesHaServicesFactory)1 TestingFlinkService (org.apache.flink.kubernetes.operator.TestingFlinkService)1 FlinkDeployment (org.apache.flink.kubernetes.operator.crd.FlinkDeployment)1 IngressSpec (org.apache.flink.kubernetes.operator.crd.spec.IngressSpec)1 DefaultValidator (org.apache.flink.kubernetes.operator.validation.DefaultValidator)1 FlinkResourceValidator (org.apache.flink.kubernetes.operator.validation.FlinkResourceValidator)1 TestValidator (org.apache.flink.kubernetes.operator.validation.TestValidator)1 ServerBootstrap (org.apache.flink.shaded.netty4.io.netty.bootstrap.ServerBootstrap)1 Channel (org.apache.flink.shaded.netty4.io.netty.channel.Channel)1 NioEventLoopGroup (org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoopGroup)1