Skip to content
Snippets Groups Projects
Commit 957f904f authored by Konstantinos Poulakakis's avatar Konstantinos Poulakakis
Browse files

refactor: Remove test exception. Add the correct exception to failure mechanism. Add kubernetes yml

parent 5d996788
No related branches found
No related tags found
2 merge requests!235Release TeraFlowSDN 3.0,!229Feat/148 ubi refactor policy component
...@@ -20,8 +20,6 @@ public class GeneralExceptionHandler implements ExceptionHandlerProvider { ...@@ -20,8 +20,6 @@ public class GeneralExceptionHandler implements ExceptionHandlerProvider {
public Throwable transform(Throwable t) { public Throwable transform(Throwable t) {
if (t instanceof ExternalServiceFailureException) { if (t instanceof ExternalServiceFailureException) {
return new StatusRuntimeException(Status.INTERNAL.withDescription(t.getMessage())); return new StatusRuntimeException(Status.INTERNAL.withDescription(t.getMessage()));
} else if (t instanceof NewException) {
return new StatusRuntimeException(Status.UNIMPLEMENTED.withDescription(t.getMessage()));
} else { } else {
return ExceptionHandlerProvider.toStatusException(t, true); return ExceptionHandlerProvider.toStatusException(t, true);
} }
......
package org.etsi.tfs.policy.exception;
public class NewException extends RuntimeException {
public NewException(String message, Exception e) {
super(message, e);
}
public NewException(String message) {
super(message);
}
}
...@@ -9,7 +9,7 @@ import jakarta.inject.Inject; ...@@ -9,7 +9,7 @@ import jakarta.inject.Inject;
import java.util.List; import java.util.List;
import org.etsi.tfs.policy.context.ContextService; import org.etsi.tfs.policy.context.ContextService;
import org.etsi.tfs.policy.context.model.ServiceId; import org.etsi.tfs.policy.context.model.ServiceId;
import org.etsi.tfs.policy.exception.NewException; import org.etsi.tfs.policy.exception.ExternalServiceFailureException;
import org.etsi.tfs.policy.monitoring.model.AlarmDescriptor; import org.etsi.tfs.policy.monitoring.model.AlarmDescriptor;
import org.etsi.tfs.policy.policy.model.PolicyRule; import org.etsi.tfs.policy.policy.model.PolicyRule;
import org.etsi.tfs.policy.policy.model.PolicyRuleBasic; import org.etsi.tfs.policy.policy.model.PolicyRuleBasic;
...@@ -21,7 +21,6 @@ import org.jboss.logging.Logger; ...@@ -21,7 +21,6 @@ import org.jboss.logging.Logger;
@ApplicationScoped @ApplicationScoped
public class AddPolicyServiceImpl { public class AddPolicyServiceImpl {
private static final Logger LOGGER = Logger.getLogger(AddPolicyServiceImpl.class);
@Inject private CommonPolicyServiceImpl commonPolicyService; @Inject private CommonPolicyServiceImpl commonPolicyService;
@Inject private CommonAlarmService commonAlarmService; @Inject private CommonAlarmService commonAlarmService;
...@@ -65,7 +64,7 @@ public class AddPolicyServiceImpl { ...@@ -65,7 +64,7 @@ public class AddPolicyServiceImpl {
return contextService return contextService
.setPolicyRule(policyRule) .setPolicyRule(policyRule)
.onFailure() .onFailure()
.transform(failure -> new NewException(failure.getMessage())) .transform(failure -> new ExternalServiceFailureException(failure.getMessage()))
.onItem() .onItem()
.transform( .transform(
policyId -> { policyId -> {
......
---
apiVersion: v1
kind: Service
metadata:
annotations:
app.quarkus.io/commit-id: 5d9967880633c624761e6089a8592ec74959d299
app.quarkus.io/build-timestamp: 2024-03-28 - 14:39:32 +0000
prometheus.io/scrape: "true"
prometheus.io/path: /q/metrics
prometheus.io/port: "8080"
prometheus.io/scheme: http
labels:
app.kubernetes.io/name: policyservice
app.kubernetes.io/version: 0.1.0
app: policyservice
app.kubernetes.io/managed-by: quarkus
name: policyservice
spec:
ports:
- name: https
port: 443
protocol: TCP
targetPort: 8443
- name: http
port: 9192
protocol: TCP
targetPort: 8080
- name: grpc
port: 6060
protocol: TCP
targetPort: 6060
selector:
app.kubernetes.io/name: policyservice
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
app.quarkus.io/commit-id: 5d9967880633c624761e6089a8592ec74959d299
app.quarkus.io/build-timestamp: 2024-03-28 - 14:39:32 +0000
prometheus.io/scrape: "true"
prometheus.io/path: /q/metrics
prometheus.io/port: "8080"
prometheus.io/scheme: http
labels:
app: policyservice
app.kubernetes.io/managed-by: quarkus
app.kubernetes.io/name: policyservice
app.kubernetes.io/version: 0.1.0
name: policyservice
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: policyservice
template:
metadata:
annotations:
app.quarkus.io/commit-id: 5d9967880633c624761e6089a8592ec74959d299
app.quarkus.io/build-timestamp: 2024-03-28 - 14:39:32 +0000
prometheus.io/scrape: "true"
prometheus.io/path: /q/metrics
prometheus.io/port: "8080"
prometheus.io/scheme: http
labels:
app: policyservice
app.kubernetes.io/managed-by: quarkus
app.kubernetes.io/name: policyservice
app.kubernetes.io/version: 0.1.0
spec:
containers:
- env:
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: CONTEXT_SERVICE_HOST
value: contextservice
- name: MONITORING_SERVICE_HOST
value: monitoringservice
- name: SERVICE_SERVICE_HOST
value: serviceservice
image: labs.etsi.org:5050/tfs/controller/policy:0.1.0
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
httpGet:
path: /q/health/live
port: 8080
scheme: HTTP
initialDelaySeconds: 2
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 10
name: policyservice
ports:
- containerPort: 8443
name: https
protocol: TCP
- containerPort: 8080
name: http
protocol: TCP
- containerPort: 6060
name: grpc
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /q/health/ready
port: 8080
scheme: HTTP
initialDelaySeconds: 2
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 10
resources:
limits:
cpu: 500m
memory: 2048Mi
requests:
cpu: 50m
memory: 512Mi
startupProbe:
failureThreshold: 3
httpGet:
path: /q/health/started
port: 8080
scheme: HTTP
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 10
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment