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();
}
}
Aggregations