public static List<Integer> getPorts(V1Service service) {
	if (service == null || service.getSpec() == null) {
	    return Collections.emptyList();
	}
	List<V1ServicePort> v1ServicePorts = service.getSpec().getPorts();
	if (v1ServicePorts == null || v1ServicePorts.isEmpty()) {
	    return Collections.emptyList();
	}
	List<Integer> portsList = new ArrayList<>();

	v1ServicePorts.forEach(each -> {
	    if (each != null && each.getPort() != null) {
		portsList.add(each.getPort());
	    }
	});
	return portsList;
    }
Utility to process information from {@link V1Service}
deployer/deployer-services/src/main/java/io/hyscale/deployer/services/util/K8sServiceUtil.java