use of io.kubernetes.client.extended.kubectl.exception.KubectlException in project java by kubernetes-client.
the class KubernetesKubectlApplyProcessor method postProcessAfterInitialization.
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
if (!(bean instanceof KubernetesObject)) {
// no-op
return bean;
}
KubectlApply apply = beanFactory.findAnnotationOnBean(beanName, KubectlApply.class);
if (apply == null) {
return bean;
}
Class<? extends KubernetesObject> apiTypeClass = (Class<? extends KubernetesObject>) bean.getClass();
try {
log.info("@KubectlApply ensuring resource upon bean {}", beanName);
return apply(apiTypeClass, bean);
} catch (KubectlException e) {
log.error("Failed ensuring resource from @KubectlApply", e);
throw new BeanCreationException("Failed ensuring resource from @KubectlApply", e);
}
}
Aggregations