From aee09765995ff4cb6167d873c8a3633747df36dc Mon Sep 17 00:00:00 2001 From: Christos Tranoris Date: Tue, 28 Nov 2023 16:41:38 +0200 Subject: [PATCH 01/29] initial commit --- .classpath | 38 +++ .project | 23 ++ .settings/org.eclipse.core.resources.prefs | 6 + .settings/org.eclipse.jdt.core.prefs | 8 + .settings/org.eclipse.m2e.core.prefs | 4 + pom.xml | 36 +++ .../kubernetes/KubernetesCRDProperty.java | 35 +++ .../model/kubernetes/KubernetesCRDV1.java | 244 ++++++++++++++++++ .../model/kubernetes/KubernetesCRV1.java | 219 ++++++++++++++++ .../KubernetesContextDefinition.java | 155 +++++++++++ .../model/kubernetes/KubernetesSecret.java | 213 +++++++++++++++ target/.gitignore | 1 + 12 files changed, 982 insertions(+) create mode 100644 .classpath create mode 100644 .project create mode 100644 .settings/org.eclipse.core.resources.prefs create mode 100644 .settings/org.eclipse.jdt.core.prefs create mode 100644 .settings/org.eclipse.m2e.core.prefs create mode 100644 pom.xml create mode 100644 src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDProperty.java create mode 100644 src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDV1.java create mode 100644 src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRV1.java create mode 100644 src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesContextDefinition.java create mode 100644 src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesSecret.java create mode 100644 target/.gitignore diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..3bc452e --- /dev/null +++ b/.classpath @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..a6e6159 --- /dev/null +++ b/.project @@ -0,0 +1,23 @@ + + + org.etsi.osl.model.k8s + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..18308de --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=utf-8 +encoding//src/main/resources=utf-8 +encoding//src/test/java=utf-8 +encoding//src/test/resources=utf-8 +encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..cf2cd45 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=17 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..4ebdae8 --- /dev/null +++ b/pom.xml @@ -0,0 +1,36 @@ + + 4.0.0 + + org.etsi.osl + org.etsi.osl.main + 1.2.0-SNAPSHOT + ../org.etsi.osl.main + + + + org.etsi.osl.model.k8s + + + + UTF-8 + UTF-8 + 1.18.28 + + + + + + org.projectlombok + lombok + provided + ${lombok-version} + + + org.etsi.osl + org.etsi.osl.model.tmf + ${project.version} + + + \ No newline at end of file diff --git a/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDProperty.java b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDProperty.java new file mode 100644 index 0000000..f67d484 --- /dev/null +++ b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDProperty.java @@ -0,0 +1,35 @@ +package org.etsi.osl.domain.model.kubernetes; + +import java.util.HashMap; +import java.util.Map; + +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; + +/** + * @author ctranoris + */ +@Getter +@Setter +@Builder +public class KubernetesCRDProperty { + + String name; + String valueType; + String defaultValue; + String description; + Map properties; + + public Map getProperties() { + if ( properties == null) { + this.properties = new HashMap<>(); + } + return properties; + } + + + + + +} diff --git a/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDV1.java b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDV1.java new file mode 100644 index 0000000..07c17ac --- /dev/null +++ b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDV1.java @@ -0,0 +1,244 @@ +package org.etsi.osl.domain.model.kubernetes; + +import java.util.HashMap; +import java.util.Map; +import org.etsi.osl.domain.model.DomainModelDefinition; +import org.etsi.osl.domain.model.ITMFRCM634_ModelTransformer; +import org.etsi.osl.domain.model.ITMFRI639_ModelTransformer; +import org.etsi.osl.tmf.common.model.ELifecycle; +import org.etsi.osl.tmf.common.model.EValueType; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecification; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationCreate; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationRef; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationUpdate; +import org.etsi.osl.tmf.ri639.model.ResourceCreate; +import org.etsi.osl.tmf.ri639.model.ResourceOperationalStateType; +import org.etsi.osl.tmf.ri639.model.ResourceStatusType; +import org.etsi.osl.tmf.ri639.model.ResourceUpdate; +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; + +/** + * @author ctranoris + */ +@Getter +@Setter +public class KubernetesCRDV1 extends DomainModelDefinition + implements ITMFRCM634_ModelTransformer, ITMFRI639_ModelTransformer { + + public static final String OSL_KUBCRD_RSPEC_NAME = "kubernetes-crd.openslice.io"; + public static final String OSL_KUBCRD_RSPEC_VERSION = "0.0.3"; + public static final String OSL_KUBCRD_RSPEC_CATEGORY = "KubernetesCRD-apiextensions.k8s.io/v1"; + public static final String OSL_KUBCRD_RESOURCE_CATEGORY = "KubernetesCRD-apiextensions.k8s.io/v1"; + public static final String OSL_KUBCRD_RSPEC_TYPE = "LogicalResourceSpecification"; + public static final String OSL_KUBCRD_RSPEC_DESCRIPTION = "This Specification is used to describe a generic KubernetesCRD"; + + private String osl_KUBCRD_RSPEC_UUID = null; //this is assigned by the system through the DB for a specific instance + + private String clusterMasterURL; + private String currentContextCluster; + private String fullResourceName; + private String kind; + private String apiGroup; + private String UID; + private String metadata; + private String yaml; + private String json; + private Map properties; + private Map additionalProperties; + private String cr_spec; + private String statusCheckFieldName; + private String statusCheckValueStandby; + private String statusCheckValueAlarm; + private String statusCheckValueAvailable; + private String statusCheckValueReserved; + private String statusCheckValueUnknown; + private String statusCheckValueSuspended; + + + @Builder + public KubernetesCRDV1(String osl_KUBCRD_RSPEC_UUID, String uuid, String name, String version, String description, String category, + String clusterMasterURL, String currentContextCluster, String fullResourceName, + String kind, String apiGroup, String uID, + String metadata, + String yaml, + String json) { + super(uuid, name, version, description, category); + this.osl_KUBCRD_RSPEC_UUID = osl_KUBCRD_RSPEC_UUID; + this.clusterMasterURL = clusterMasterURL; + this.currentContextCluster = currentContextCluster; + this.fullResourceName = fullResourceName; + this.kind = kind; + this.apiGroup = apiGroup; + this.UID = uID; + this.metadata = metadata; + this.yaml = yaml; + this.json = json; + this.properties = new HashMap<>(); + this.additionalProperties = new HashMap<>(); + } + + + + @Override + public ResourceSpecificationCreate toRSpecCreate_InitRepo() { + + ResourceSpecificationCreate rsc = this.toRSpecCreate(); + rsc.setName( OSL_KUBCRD_RSPEC_NAME ); + rsc.setCategory( OSL_KUBCRD_RSPEC_CATEGORY ); + rsc.setVersion(OSL_KUBCRD_RSPEC_VERSION); + rsc.setDescription( OSL_KUBCRD_RSPEC_DESCRIPTION ); + rsc.setType( OSL_KUBCRD_RSPEC_TYPE ); + + + + return rsc; + } + + @Override + public ResourceSpecificationCreate toRSpecCreate() { + + ResourceSpecificationCreate rsc = new ResourceSpecificationCreate(); + rsc.setName( this.name ); + rsc.setCategory( OSL_KUBCRD_RSPEC_CATEGORY ); + rsc.setVersion( this.version ); + rsc.setDescription( this.version ); + rsc.setType( OSL_KUBCRD_RSPEC_TYPE ); + + rsc.setLifecycleStatus( ELifecycle.ACTIVE.getValue() ); + rsc.addResourceSpecificationCharacteristicItemShort("clusterMasterURL", this.clusterMasterURL, EValueType.TEXT.getValue(), "URL of cluster", false); + rsc.addResourceSpecificationCharacteristicItemShort("currentContextCluster", this.currentContextCluster, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("fullResourceName", this.fullResourceName, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("Kind", this.kind, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("apiGroup", this.apiGroup, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("UID", this.UID, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("metadata", this.metadata, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("yaml", this.yaml, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("json", this.json, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_SPEC", "", EValueType.TEXT.getValue(), "Used for providing the json Custom Resource description to apply", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECK_FIELD", "", EValueType.TEXT.getValue(), "Used for providing the field that need to be checked for the resource status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_STANDBY", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the standby status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_ALARM", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the alarm status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_AVAILABLE", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the available status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_RESERVED", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the reserved status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_UNKNOWN", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the unknown status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_SUSPENDED", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the suspended status", false); + +// rsc.addResourceSpecificationCharacteristicItemShort( "properties", "", EValueType.SET.getValue()); +// rsc.addResourceSpecificationCharacteristicItemShort( "additionalProperties", "", EValueType.SET.getValue()); + if (this.properties != null) + this.properties.forEach((kPropName, vProVal) -> { + + EValueType etype; + if ( vProVal.getValueType().equalsIgnoreCase("boolean")) { + etype = EValueType.BOOLEAN; + } else if ( vProVal.getValueType().equalsIgnoreCase("integer")) { + etype = EValueType.INTEGER; + } else if ( vProVal.getValueType().equalsIgnoreCase("object")) { + etype = EValueType.OBJECT; + } else + etype = EValueType.TEXT; + + rsc.addResourceSpecificationCharacteristicItemShort(kPropName , vProVal.getDefaultValue(), etype.getValue(), vProVal.getDescription(), false); + + }); + + if (this.additionalProperties != null ) { + this.additionalProperties.forEach((kPropName, vProVal) -> { + rsc.addResourceSpecificationCharacteristicItemShort("additionalProperty." + kPropName, vProVal.getDefaultValue(), EValueType.TEXT.getValue(), vProVal.getDescription(), false); + + }); + } + + return rsc; + } + + @Override + public ResourceSpecificationUpdate toRSpecUpdate() { + return this.toRSpecCreate(); + } + + @Override + public KubernetesCRDV1 fromRSpec(ResourceSpecification rSpec) { + this.osl_KUBCRD_RSPEC_UUID = rSpec.getUuid(); + return this; + } + + @Override + public ResourceCreate toResourceCreate() { + + if (osl_KUBCRD_RSPEC_UUID == null) { + return null; + } + + ResourceSpecificationRef rSpecRef = new ResourceSpecificationRef(); + rSpecRef.setId( osl_KUBCRD_RSPEC_UUID ); + rSpecRef.setName( OSL_KUBCRD_RSPEC_NAME ); + rSpecRef.setVersion( OSL_KUBCRD_RSPEC_VERSION ); + + ResourceCreate rs = new ResourceCreate(); + rs.name( this.name ) + .category( OSL_KUBCRD_RESOURCE_CATEGORY ) + .description( this.description ) + .resourceStatus( ResourceStatusType.AVAILABLE ) + .operationalState( ResourceOperationalStateType.ENABLE ) + .resourceSpecification( rSpecRef ) + .resourceVersion( this.version); + + rs.addResourceCharacteristicItemShort("clusterMasterURL", this.clusterMasterURL, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("currentContextCluster", this.currentContextCluster, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("fullResourceName", this.fullResourceName, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("Kind", this.kind, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("apiGroup", this.apiGroup, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("UID", this.UID, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("metadata", this.metadata, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("yaml", this.yaml, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("json", this.json, EValueType.TEXT.getValue()); + + rs.addResourceCharacteristicItemShort("_CR_SPEC", this.cr_spec, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECK_FIELD", this.statusCheckFieldName, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_STANDBY", this.statusCheckValueStandby, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_ALARM", this.statusCheckValueAlarm, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_AVAILABLE", this.statusCheckValueAvailable, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_RESERVED", this.statusCheckValueReserved, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_UNKNOWN", this.statusCheckValueUnknown, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_SUSPENDED", this.statusCheckValueSuspended, EValueType.TEXT.getValue()); + + + + if (this.properties != null) + this.properties.forEach((kPropName, vProVal) -> { + + EValueType etype; + if ( vProVal.getValueType().equalsIgnoreCase("boolean")) { + etype = EValueType.BOOLEAN; + } else if ( vProVal.getValueType().equalsIgnoreCase("integer")) { + etype = EValueType.INTEGER; + } else if ( vProVal.getValueType().equalsIgnoreCase("object")) { + etype = EValueType.OBJECT; + } else + etype = EValueType.TEXT; + + rs.addResourceCharacteristicItemShort(kPropName , "", etype.getValue()); + + }); + + if (this.additionalProperties != null ) { + this.additionalProperties.forEach((kPropName, vProVal) -> { + rs.addResourceCharacteristicItemShort("additionalProperty." + kPropName, "", EValueType.TEXT.getValue()); + + }); + } + + + return rs; + } + + @Override + public ResourceUpdate toResourceUpdate() { + + return this.toResourceCreate(); + } + +} diff --git a/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRV1.java b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRV1.java new file mode 100644 index 0000000..ec06b71 --- /dev/null +++ b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRV1.java @@ -0,0 +1,219 @@ +package org.etsi.osl.domain.model.kubernetes; + +import java.util.HashMap; +import java.util.Map; +import org.etsi.osl.domain.model.DomainModelDefinition; +import org.etsi.osl.domain.model.ITMFRCM634_ModelTransformer; +import org.etsi.osl.domain.model.ITMFRI639_ModelTransformer; +import org.etsi.osl.tmf.common.model.ELifecycle; +import org.etsi.osl.tmf.common.model.EValueType; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecification; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationCreate; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationRef; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationUpdate; +import org.etsi.osl.tmf.ri639.model.ResourceCreate; +import org.etsi.osl.tmf.ri639.model.ResourceOperationalStateType; +import org.etsi.osl.tmf.ri639.model.ResourceStatusType; +import org.etsi.osl.tmf.ri639.model.ResourceUpdate; +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; + +/** + * @author ctranoris + */ +@Getter +@Setter +public class KubernetesCRV1 extends DomainModelDefinition + implements ITMFRCM634_ModelTransformer, ITMFRI639_ModelTransformer { + + public static final String OSL_KUBCRV1_RSPEC_NAME = "kubernetes-cr-v1.openslice.io"; + public static final String OSL_KUBCRV1_RSPEC_VERSION = "0.0.4"; + public static final String OSL_KUBCRV1_RSPEC_CATEGORY = "KubernetesCRV1-apiextensions.k8s.io/v1"; + public static final String OSL_KUBCRV1_RSPEC_TYPE = "LogicalResourceSpecification"; + public static final String OSL_KUBCRV1_RSPEC_DESCRIPTION = "This Specification is used to describe a generic KubernetesCRV1"; + + private String osl_KUBCRV1_RSPEC_UUID = null; //this is assigned by the system through the DB for a specific instance + + private String clusterMasterURL; + private String currentContextCluster; + private String fullResourceName; + private String kind; + private String apiGroup; + private String namespace; + private String UID; + private String metadata; + private String yaml; + private String json; + private Map properties; + private Map additionalProperties; + private String cr_spec_applied; + private String statusCheckFieldName; + private String statusCheckValueStandby; + private String statusCheckValueAlarm; + private String statusCheckValueAvailable; + private String statusCheckValueReserved; + private String statusCheckValueUnknown; + private String statusCheckValueSuspended; + private ResourceStatusType statusValue; + + @Builder + public KubernetesCRV1(String osl_KUBCRV1_RSPEC_UUID, String uuid, String name, String version, String description, String category, + String clusterMasterURL, String currentContextCluster, String fullResourceName, String namespace, + String kind, String apiGroup, String uID, String metadata, ResourceStatusType statusValue, + String yaml, + String json) { + super(uuid, name, version, description, category); + this.osl_KUBCRV1_RSPEC_UUID = osl_KUBCRV1_RSPEC_UUID; + this.clusterMasterURL = clusterMasterURL; + this.currentContextCluster = currentContextCluster; + this.fullResourceName = fullResourceName; + this.kind = kind; + this.apiGroup = apiGroup; + this.namespace = namespace; + this.UID = uID; + this.metadata = metadata; + this.yaml = yaml; + this.json = json; + this.statusValue = statusValue; + this.properties = new HashMap<>(); + this.additionalProperties = new HashMap<>(); + } + + + + @Override + public ResourceSpecificationCreate toRSpecCreate_InitRepo() { + + ResourceSpecificationCreate rsc = toRSpecCreate(); + rsc.setName( OSL_KUBCRV1_RSPEC_NAME ); + rsc.setCategory( OSL_KUBCRV1_RSPEC_CATEGORY ); + rsc.setVersion(OSL_KUBCRV1_RSPEC_VERSION); + rsc.setDescription( OSL_KUBCRV1_RSPEC_DESCRIPTION ); + rsc.setType( OSL_KUBCRV1_RSPEC_TYPE ); + + return rsc; + } + + + @Override + public ResourceSpecificationCreate toRSpecCreate() { + + ResourceSpecificationCreate rsc = new ResourceSpecificationCreate(); + rsc.setName( this.name ); + rsc.setCategory( OSL_KUBCRV1_RSPEC_CATEGORY ); + rsc.setVersion(this.version); + rsc.setDescription( this.description ); + rsc.setType( OSL_KUBCRV1_RSPEC_TYPE ); + + rsc.setLifecycleStatus( ELifecycle.ACTIVE.getValue() ); + rsc.addResourceSpecificationCharacteristicItemShort( "clusterMasterURL", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "currentContextCluster", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "fullResourceName", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "Kind", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "apiGroup", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "UID", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "namespace", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "metadata", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "yaml", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "json", "", EValueType.TEXT.getValue(), "", false); + + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_SPEC", "", EValueType.TEXT.getValue(), "Used for providing the json Custom Resource description to apply", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_SPEC_APPLIED", "", EValueType.TEXT.getValue(), "Used for providing the json Custom Resource description as applied", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECK_FIELD", "", EValueType.TEXT.getValue(), "Used for providing the field that need to be checked for the resource status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_STANDBY", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the standby status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_ALARM", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the alarm status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_AVAILABLE", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the available status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_RESERVED", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the reserved status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_UNKNOWN", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the unknown status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_SUSPENDED", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the suspended status", false); + +// rsc.addResourceSpecificationCharacteristicItemShort( "properties", "", EValueType.SET.getValue()); +// rsc.addResourceSpecificationCharacteristicItemShort( "additionalProperties", "", EValueType.SET.getValue()); + + + return rsc; + } + + @Override + public ResourceSpecificationUpdate toRSpecUpdate() { + return this.toRSpecCreate(); + } + + @Override + public KubernetesCRV1 fromRSpec(ResourceSpecification rSpec) { + osl_KUBCRV1_RSPEC_UUID = rSpec.getUuid(); + return this; + } + + @Override + public ResourceCreate toResourceCreate() { + + if (osl_KUBCRV1_RSPEC_UUID == null) { + return null; + } + + ResourceSpecificationRef rSpecRef = new ResourceSpecificationRef(); + rSpecRef.setId( osl_KUBCRV1_RSPEC_UUID ); + rSpecRef.setName( OSL_KUBCRV1_RSPEC_NAME ); + rSpecRef.setVersion( OSL_KUBCRV1_RSPEC_VERSION ); + + ResourceCreate rs = new ResourceCreate(); + rs.name( this.name ) + .category( this.category ) + .description( this.description ) + + .resourceStatus( ResourceStatusType.RESERVED ) + + .operationalState( ResourceOperationalStateType.ENABLE ) + .resourceSpecification( rSpecRef ) + .resourceVersion( this.version); + + rs.addResourceCharacteristicItemShort("clusterMasterURL", this.clusterMasterURL, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("currentContextCluster", this.currentContextCluster, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("fullResourceName", this.fullResourceName, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("Kind", this.kind, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("apiGroup", this.apiGroup, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("apiVersion", this.version , EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("UID", this.UID, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("namespace", this.namespace, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("metadata", this.metadata, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("yaml", this.yaml, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("json", this.json, EValueType.TEXT.getValue()); + + + rs.addResourceCharacteristicItemShort("_CR_SPEC_APPLIED", this.cr_spec_applied, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECK_FIELD", this.statusCheckFieldName, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_STANDBY", this.statusCheckValueStandby, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_ALARM", this.statusCheckValueAlarm, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_AVAILABLE", this.statusCheckValueAvailable, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_RESERVED", this.statusCheckValueReserved, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_UNKNOWN", this.statusCheckValueUnknown, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_SUSPENDED", this.statusCheckValueSuspended, EValueType.TEXT.getValue()); + + rs.resourceStatus( this.statusValue ); + + if (this.properties != null) + this.properties.forEach((kPropName, vProVal) -> { + rs.addResourceCharacteristicItemShort(kPropName , vProVal, EValueType.TEXT.getValue()); + + }); + + if (this.additionalProperties != null ) { + this.additionalProperties.forEach((kPropName, vProVal) -> { + rs.addResourceCharacteristicItemShort(kPropName, vProVal, EValueType.TEXT.getValue()); + + }); + } + + + return rs; + } + + @Override + public ResourceUpdate toResourceUpdate() { + + return this.toResourceCreate(); + } + +} diff --git a/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesContextDefinition.java b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesContextDefinition.java new file mode 100644 index 0000000..c4f6a01 --- /dev/null +++ b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesContextDefinition.java @@ -0,0 +1,155 @@ +package org.etsi.osl.domain.model.kubernetes; + +import org.etsi.osl.domain.model.DomainModelDefinition; +import org.etsi.osl.domain.model.ITMFRCM634_ModelTransformer; +import org.etsi.osl.domain.model.ITMFRI639_ModelTransformer; +import org.etsi.osl.tmf.common.model.ELifecycle; +import org.etsi.osl.tmf.common.model.EValueType; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecification; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationCreate; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationRef; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationUpdate; +import org.etsi.osl.tmf.ri639.model.ResourceCreate; +import org.etsi.osl.tmf.ri639.model.ResourceOperationalStateType; +import org.etsi.osl.tmf.ri639.model.ResourceStatusType; +import org.etsi.osl.tmf.ri639.model.ResourceUpdate; +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; + +/** + * @author ctranoris + */ +@Getter +@Setter +public class KubernetesContextDefinition + extends DomainModelDefinition + implements ITMFRCM634_ModelTransformer, ITMFRI639_ModelTransformer { + + + public static final String OSL_KUBD_RSPEC_NAME = "kubernetes-context-definition.openslice.io"; + public static final String OSL_KUBD_RSPEC_VERSION = "0.0.1"; + public static final String OSL_KUBD_RSPEC_CATEGORY = "KubernetesContextDefinition"; + public static final String OSL_KUBD_RESOURCE_CATEGORY = "KubernetesContextDefinition"; + public static final String OSL_KUBD_RSPEC_TYPE = "LogicalResourceSpecification"; + public static final String OSL_KUBD_RSPEC_DESCRIPTION = "This Specification is used to describe a KubernetesClient"; + + private String osl_KUBD_SPEC_UUID = null; //this is assigned by the system through the DB for a specific instance + + //properties of an instance + private String masterURL; + private String currentContextName; + private String currentContextCluster; + private String currentContextUser; + private String clusterVersion; + + + @Builder + public KubernetesContextDefinition(String osl_KUBD_SPEC_UUID, String uuid, String name, String version, String description, String category, + String masterURL, String currentContextName, String currentContextCluster, String currentContextUser, + String clusterVersion) { + super(uuid, name, version, description, category); + this.osl_KUBD_SPEC_UUID = osl_KUBD_SPEC_UUID; + this.masterURL = masterURL; + this.currentContextName = currentContextName; + this.currentContextCluster = currentContextCluster; + this.currentContextUser = currentContextUser; + this.clusterVersion = clusterVersion; + } + + + @Override + public ResourceSpecificationCreate toRSpecCreate_InitRepo() { + ResourceSpecificationCreate rsc = this.toRSpecCreate(); + rsc.setName( OSL_KUBD_RSPEC_NAME ); + rsc.setVersion( OSL_KUBD_RSPEC_VERSION ); + rsc.setCategory( OSL_KUBD_RSPEC_CATEGORY ); + rsc.setDescription( OSL_KUBD_RSPEC_DESCRIPTION ); + rsc.setType( OSL_KUBD_RSPEC_TYPE ); + rsc.setLifecycleStatus( ELifecycle.ACTIVE.getValue() ); + + return rsc; + + } + + @Override + public ResourceSpecificationCreate toRSpecCreate() { + ResourceSpecificationCreate rsc = new ResourceSpecificationCreate(); + rsc.setName( this.name ); + rsc.setVersion( this.version ); + rsc.setCategory( OSL_KUBD_RSPEC_CATEGORY ); + rsc.setDescription( this.description ); + rsc.setType( OSL_KUBD_RSPEC_TYPE ); + rsc.setLifecycleStatus( ELifecycle.ACTIVE.getValue() ); + rsc.addResourceSpecificationCharacteristicItemShort( "masterURL", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "resourceVersion", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "currentContextName", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "currentContextCluster", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "currentContextUser", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "clusterVersion", "", EValueType.TEXT.getValue(), "", false); + return rsc; + + } + + @Override + public ResourceSpecificationUpdate toRSpecUpdate() { + return this.toRSpecCreate(); + } + + /* we care only for the ID of the specification from the stored model. The definition will be static + * (non-Javadoc) + * @see org.etsi.osl.domain.model.ITMFRCM634_ModelTransformer#fromRSpec(org.etsi.osl.tmf.rcm634.model.ResourceSpecification) + */ + @Override + public KubernetesContextDefinition fromRSpec(ResourceSpecification rSpec) { + osl_KUBD_SPEC_UUID = rSpec.getUuid(); + return this; + } + + + /* + * returns Null if OSL_KUBD_RSPEC_UUID is not initialized + * (non-Javadoc) + * @see org.etsi.osl.domain.model.ITMFRI639_ModelTransformer#toResourceCreate() + */ + @Override + public ResourceCreate toResourceCreate() throws Exception { + if (this.osl_KUBD_SPEC_UUID == null) { + throw new Exception( "osl_UUID is null. Resource cannot be created without referring a Resource specification" ); + + } + + ResourceSpecificationRef rSpecRef = new ResourceSpecificationRef(); + rSpecRef.setId( this.osl_KUBD_SPEC_UUID ); + rSpecRef.setName( OSL_KUBD_RSPEC_NAME ); + rSpecRef.setVersion( OSL_KUBD_RSPEC_VERSION ); + + ResourceCreate rs = new ResourceCreate(); + rs.setName( this.name ); + rs.setResourceStatus( ResourceStatusType.AVAILABLE ); + rs.setOperationalState( ResourceOperationalStateType.ENABLE); + rs.setCategory( OSL_KUBD_RESOURCE_CATEGORY ); + rs.setResourceSpecification(rSpecRef); + rs.resourceVersion( this.clusterVersion ); + + rs.addResourceCharacteristicItemShort("masterUrl", this.masterURL, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("currentContextName", this.currentContextName , EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("currentContextCluster", this.currentContextCluster , EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("currentContextUser", this.currentContextUser , EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("clusterVersion", this.clusterVersion , EValueType.TEXT.getValue()); + + + + + return rs; + } + + @Override + public ResourceUpdate toResourceUpdate() throws Exception { + return this.toResourceCreate(); + } + + + + +} diff --git a/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesSecret.java b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesSecret.java new file mode 100644 index 0000000..820c777 --- /dev/null +++ b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesSecret.java @@ -0,0 +1,213 @@ +package org.etsi.osl.domain.model.kubernetes; + +import java.util.HashMap; +import java.util.Map; +import org.etsi.osl.domain.model.DomainModelDefinition; +import org.etsi.osl.domain.model.ITMFRCM634_ModelTransformer; +import org.etsi.osl.domain.model.ITMFRI639_ModelTransformer; +import org.etsi.osl.tmf.common.model.ELifecycle; +import org.etsi.osl.tmf.common.model.EValueType; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecification; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationCreate; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationRef; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationUpdate; +import org.etsi.osl.tmf.ri639.model.ResourceCreate; +import org.etsi.osl.tmf.ri639.model.ResourceOperationalStateType; +import org.etsi.osl.tmf.ri639.model.ResourceStatusType; +import org.etsi.osl.tmf.ri639.model.ResourceUpdate; +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; + +/** + * @author ctranoris + */ +@Getter +@Setter +public class KubernetesSecret extends DomainModelDefinition + implements ITMFRCM634_ModelTransformer, ITMFRI639_ModelTransformer { + + public static final String OSL_KUBSECRET_RSPEC_NAME = "kubernetes-secret.openslice.io"; + public static final String OSL_KUBSECRET_RSPEC_VERSION = "0.0.3"; + public static final String OSL_KUBSECRET_RSPEC_CATEGORY = "Secret/Kubernetes/v1"; + public static final String OSL_KUBSECRET_RESOURCE_CATEGORY = "Secret/Kubernetes/v1"; + public static final String OSL_KUBSECRET_RSPEC_TYPE = "LogicalResourceSpecification"; + public static final String OSL_KUBSECRET_RSPEC_DESCRIPTION = "This Specification is used to describe a generic Kubernetes Secret"; + + private String osl_KUBCRD_RSPEC_UUID = null; //this is assigned by the system through the DB for a specific instance + + private String clusterMasterURL; + private String currentContextCluster; + private String fullResourceName; + private String kind; + private String apiGroup; + private String UID; + private String metadata; + private String yaml; + private String json; + private String namespace; + + + private Map data; + private String dataObj; + private Map properties; + + + @Builder + public KubernetesSecret(String osl_KUBCRD_RSPEC_UUID, String uuid, String name, String version, String description, String category, + String clusterMasterURL, String currentContextCluster, String fullResourceName, String namespace, + String kind, String apiGroup, String uID, + String metadata, + String yaml, + String json) { + super(uuid, name, version, description, category); + this.osl_KUBCRD_RSPEC_UUID = osl_KUBCRD_RSPEC_UUID; + this.clusterMasterURL = clusterMasterURL; + this.currentContextCluster = currentContextCluster; + this.fullResourceName = fullResourceName; + this.kind = kind; + this.apiGroup = apiGroup; + this.namespace = namespace; + this.UID = uID; + this.metadata = metadata; + this.yaml = yaml; + this.json = json; + this.properties = new HashMap<>(); + this.data = new HashMap<>(); + this.category = OSL_KUBSECRET_RSPEC_CATEGORY; + } + + + + @Override + public ResourceSpecificationCreate toRSpecCreate_InitRepo() { + + ResourceSpecificationCreate rsc = this.toRSpecCreate(); + rsc.setName( OSL_KUBSECRET_RSPEC_NAME ); + rsc.setCategory( OSL_KUBSECRET_RSPEC_CATEGORY ); + rsc.setVersion(OSL_KUBSECRET_RSPEC_VERSION); + rsc.setDescription( OSL_KUBSECRET_RSPEC_DESCRIPTION ); + rsc.setType( OSL_KUBSECRET_RSPEC_TYPE ); + + + + return rsc; + } + + @Override + public ResourceSpecificationCreate toRSpecCreate() { + + ResourceSpecificationCreate rsc = new ResourceSpecificationCreate(); + rsc.setName( this.name ); + rsc.setCategory( OSL_KUBSECRET_RSPEC_CATEGORY ); + rsc.setVersion( this.version ); + rsc.setDescription( this.version ); + rsc.setType( OSL_KUBSECRET_RSPEC_TYPE ); + + rsc.setLifecycleStatus( ELifecycle.ACTIVE.getValue() ); + rsc.addResourceSpecificationCharacteristicItemShort("clusterMasterURL", this.clusterMasterURL, EValueType.TEXT.getValue(), "URL of cluster", false); + rsc.addResourceSpecificationCharacteristicItemShort("currentContextCluster", this.currentContextCluster, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("fullResourceName", this.fullResourceName, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("Kind", this.kind, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("apiGroup", this.apiGroup, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("UID", this.UID, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("metadata", this.metadata, EValueType.OBJECT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("yaml", this.yaml, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("json", this.json, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("data", this.dataObj, EValueType.OBJECT.getValue(), "", false); + + if (this.properties != null) + this.properties.forEach((kPropName, vProVal) -> { + EValueType etype; + etype = EValueType.TEXT; + rsc.addResourceSpecificationCharacteristicItemShort(kPropName , vProVal, etype.getValue(), "", false); + + }); + if (this.data != null) + this.data.forEach((kPropName, vProVal) -> { + EValueType etype; + etype = EValueType.TEXT; + rsc.addResourceSpecificationCharacteristicItemShort(kPropName , vProVal, etype.getValue(), "", false); + + }); + + + + return rsc; + } + + @Override + public ResourceSpecificationUpdate toRSpecUpdate() { + return this.toRSpecCreate(); + } + + @Override + public KubernetesSecret fromRSpec(ResourceSpecification rSpec) { + this.osl_KUBCRD_RSPEC_UUID = rSpec.getUuid(); + return this; + } + + @Override + public ResourceCreate toResourceCreate() { + + if (osl_KUBCRD_RSPEC_UUID == null) { + return null; + } + + ResourceSpecificationRef rSpecRef = new ResourceSpecificationRef(); + rSpecRef.setId( osl_KUBCRD_RSPEC_UUID ); + rSpecRef.setName( OSL_KUBSECRET_RSPEC_NAME ); + rSpecRef.setVersion( OSL_KUBSECRET_RSPEC_VERSION ); + + ResourceCreate rs = new ResourceCreate(); + rs.name( this.name ) + .category( OSL_KUBSECRET_RESOURCE_CATEGORY ) + .description( this.description ) + .resourceStatus( ResourceStatusType.AVAILABLE ) + .operationalState( ResourceOperationalStateType.ENABLE ) + .resourceSpecification( rSpecRef ) + .resourceVersion( this.version); + + rs.addResourceCharacteristicItemShort("clusterMasterURL", this.clusterMasterURL, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("currentContextCluster", this.currentContextCluster, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("fullResourceName", this.fullResourceName, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("Kind", this.kind, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("apiGroup", this.apiGroup, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("UID", this.UID, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("metadata", this.metadata, EValueType.OBJECT.getValue()); + rs.addResourceCharacteristicItemShort("yaml", this.yaml, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("json", this.json, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("data", this.dataObj, EValueType.OBJECT.getValue()); + + + + + if (this.properties != null) + this.properties.forEach((kPropName, vProVal) -> { + EValueType etype; + etype = EValueType.TEXT; + + rs.addResourceCharacteristicItemShort(kPropName , vProVal, etype.getValue()); + + }); + if (this.data != null) + this.data.forEach((kPropName, vProVal) -> { + EValueType etype; + etype = EValueType.TEXT; + rs.addResourceCharacteristicItemShort(kPropName , vProVal, etype.getValue()); + + }); + + + + + return rs; + } + + @Override + public ResourceUpdate toResourceUpdate() { + + return this.toResourceCreate(); + } + +} diff --git a/target/.gitignore b/target/.gitignore new file mode 100644 index 0000000..840e7d3 --- /dev/null +++ b/target/.gitignore @@ -0,0 +1 @@ +/classes/ -- GitLab From 09ce81e220ac2272fcb773da3e2345c05c30b506 Mon Sep 17 00:00:00 2001 From: Christos Tranoris Date: Tue, 5 Dec 2023 14:37:15 +0200 Subject: [PATCH 02/29] model enhancement This is under https://labs.etsi.org/rep/osl/code/org.etsi.osl.cridge/-/issues/2 --- .../org/etsi/osl/domain/model/kubernetes/KubernetesCRDV1.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDV1.java b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDV1.java index 07c17ac..bfdf907 100644 --- a/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDV1.java +++ b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDV1.java @@ -117,6 +117,7 @@ public class KubernetesCRDV1 extends DomainModelDefinition rsc.addResourceSpecificationCharacteristicItemShort("yaml", this.yaml, EValueType.TEXT.getValue(), "", false); rsc.addResourceSpecificationCharacteristicItemShort("json", this.json, EValueType.TEXT.getValue(), "", false); rsc.addResourceSpecificationCharacteristicItemShort( "_CR_SPEC", "", EValueType.TEXT.getValue(), "Used for providing the json Custom Resource description to apply", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_SPEC_APPLIED", "", EValueType.TEXT.getValue(), "Used for providing the json Custom Resource description as applied", false); rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECK_FIELD", "", EValueType.TEXT.getValue(), "Used for providing the field that need to be checked for the resource status", false); rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_STANDBY", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the standby status", false); rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_ALARM", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the alarm status", false); @@ -197,6 +198,7 @@ public class KubernetesCRDV1 extends DomainModelDefinition rs.addResourceCharacteristicItemShort("json", this.json, EValueType.TEXT.getValue()); rs.addResourceCharacteristicItemShort("_CR_SPEC", this.cr_spec, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_SPEC_APPLIED", "", EValueType.TEXT.getValue()); rs.addResourceCharacteristicItemShort("_CR_CHECK_FIELD", this.statusCheckFieldName, EValueType.TEXT.getValue()); rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_STANDBY", this.statusCheckValueStandby, EValueType.TEXT.getValue()); rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_ALARM", this.statusCheckValueAlarm, EValueType.TEXT.getValue()); -- GitLab From 3ab93a918742a1cb751d418a13ad643c41472b4d Mon Sep 17 00:00:00 2001 From: Christos Tranoris Date: Thu, 7 Dec 2023 00:41:29 +0200 Subject: [PATCH 03/29] fix for #2 --- .../etsi/osl/domain/model/kubernetes/KubernetesCRDV1.java | 6 ++++-- .../etsi/osl/domain/model/kubernetes/KubernetesCRV1.java | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDV1.java b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDV1.java index bfdf907..35d6392 100644 --- a/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDV1.java +++ b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDV1.java @@ -117,7 +117,8 @@ public class KubernetesCRDV1 extends DomainModelDefinition rsc.addResourceSpecificationCharacteristicItemShort("yaml", this.yaml, EValueType.TEXT.getValue(), "", false); rsc.addResourceSpecificationCharacteristicItemShort("json", this.json, EValueType.TEXT.getValue(), "", false); rsc.addResourceSpecificationCharacteristicItemShort( "_CR_SPEC", "", EValueType.TEXT.getValue(), "Used for providing the json Custom Resource description to apply", false); - rsc.addResourceSpecificationCharacteristicItemShort( "_CR_SPEC_APPLIED", "", EValueType.TEXT.getValue(), "Used for providing the json Custom Resource description as applied", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_SPEC_LASTSEND", "", EValueType.TEXT.getValue(), "Used for providing the last description send", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_SPEC_APPLIED", "", EValueType.TEXT.getValue(), "Used for providing the json Custom Resource description as applied by Kubernetes", false); rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECK_FIELD", "", EValueType.TEXT.getValue(), "Used for providing the field that need to be checked for the resource status", false); rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_STANDBY", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the standby status", false); rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_ALARM", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the alarm status", false); @@ -196,8 +197,9 @@ public class KubernetesCRDV1 extends DomainModelDefinition rs.addResourceCharacteristicItemShort("metadata", this.metadata, EValueType.TEXT.getValue()); rs.addResourceCharacteristicItemShort("yaml", this.yaml, EValueType.TEXT.getValue()); rs.addResourceCharacteristicItemShort("json", this.json, EValueType.TEXT.getValue()); - + rs.addResourceCharacteristicItemShort("_CR_SPEC", this.cr_spec, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_SPEC_LASTSEND", this.cr_spec, EValueType.TEXT.getValue()); rs.addResourceCharacteristicItemShort("_CR_SPEC_APPLIED", "", EValueType.TEXT.getValue()); rs.addResourceCharacteristicItemShort("_CR_CHECK_FIELD", this.statusCheckFieldName, EValueType.TEXT.getValue()); rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_STANDBY", this.statusCheckValueStandby, EValueType.TEXT.getValue()); diff --git a/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRV1.java b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRV1.java index ec06b71..c550be8 100644 --- a/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRV1.java +++ b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRV1.java @@ -119,7 +119,8 @@ public class KubernetesCRV1 extends DomainModelDefinition rsc.addResourceSpecificationCharacteristicItemShort( "json", "", EValueType.TEXT.getValue(), "", false); rsc.addResourceSpecificationCharacteristicItemShort( "_CR_SPEC", "", EValueType.TEXT.getValue(), "Used for providing the json Custom Resource description to apply", false); - rsc.addResourceSpecificationCharacteristicItemShort( "_CR_SPEC_APPLIED", "", EValueType.TEXT.getValue(), "Used for providing the json Custom Resource description as applied", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_SPEC_LASTSEND", "", EValueType.TEXT.getValue(), "Used for providing the last description send", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_SPEC_APPLIED", "", EValueType.TEXT.getValue(), "Used for providing the json Custom Resource description as applied by Kubernetes", false); rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECK_FIELD", "", EValueType.TEXT.getValue(), "Used for providing the field that need to be checked for the resource status", false); rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_STANDBY", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the standby status", false); rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_ALARM", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the alarm status", false); -- GitLab From cb38c509a70e23f3a56d6659db9da590a95162a5 Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Thu, 7 Dec 2023 14:26:34 +0000 Subject: [PATCH 04/29] added artifact build automation --- .gitlab-ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..f1ae4ab --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,8 @@ +stages: + - deploy + +deploy: + stage: deploy + image: maven:3.9.5-ibm-semeru-17-focal + script: + - 'mvn deploy -s ci_settings.xml' -- GitLab From 73ac9c924c944c45cd6a1e0143214522cf6085f4 Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Thu, 7 Dec 2023 14:41:01 +0000 Subject: [PATCH 05/29] added config for maven registry --- ci_settings.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 ci_settings.xml diff --git a/ci_settings.xml b/ci_settings.xml new file mode 100644 index 0000000..69ad06e --- /dev/null +++ b/ci_settings.xml @@ -0,0 +1,16 @@ + + + + gitlab-maven + + + + Job-Token + ${CI_JOB_TOKEN} + + + + + + -- GitLab From 8d7af82f440c457930a737d25d96a607ef176308 Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Fri, 8 Dec 2023 13:49:32 +0000 Subject: [PATCH 06/29] added mvn registry related config --- pom.xml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4ebdae8..868722c 100644 --- a/pom.xml +++ b/pom.xml @@ -19,8 +19,25 @@ 1.18.28 - + + + gitlab-maven + ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven + + + + + gitlab-maven + ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven + + + gitlab-maven + ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven + + + + org.projectlombok lombok -- GitLab From 626e03d90772cc38dc19239db83ca32b7ab5ef29 Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Fri, 8 Dec 2023 14:03:57 +0000 Subject: [PATCH 07/29] fetch artifact from main project --- pom.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 868722c..c3724e9 100644 --- a/pom.xml +++ b/pom.xml @@ -17,22 +17,23 @@ UTF-8 UTF-8 1.18.28 + 276 gitlab-maven - ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven + ${CI_API_V4_URL}/projects/${main.project.id}/packages/maven gitlab-maven - ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven + ${CI_API_V4_URL}/projects/${main.project.id}/packages/maven gitlab-maven - ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven + ${CI_API_V4_URL}/projects/${main.project.id}/packages/maven -- GitLab From efd51dfc18bc9c782e61294cf70ca46194b675be Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Fri, 8 Dec 2023 14:10:40 +0000 Subject: [PATCH 08/29] testing with hardcoded project ID --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index c3724e9..205cab0 100644 --- a/pom.xml +++ b/pom.xml @@ -23,17 +23,17 @@ gitlab-maven - ${CI_API_V4_URL}/projects/${main.project.id}/packages/maven + ${CI_API_V4_URL}/projects/276/packages/maven gitlab-maven - ${CI_API_V4_URL}/projects/${main.project.id}/packages/maven + ${CI_API_V4_URL}/projects/276/packages/maven gitlab-maven - ${CI_API_V4_URL}/projects/${main.project.id}/packages/maven + ${CI_API_V4_URL}/projects/276/packages/maven -- GitLab From 0458e36cffddbae4b1a2064e59a3fe311c94acf2 Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Fri, 8 Dec 2023 14:12:12 +0000 Subject: [PATCH 09/29] debugging command --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f1ae4ab..0aefe0e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,5 +4,7 @@ stages: deploy: stage: deploy image: maven:3.9.5-ibm-semeru-17-focal + before_script: + - echo $CI_API_V4_URL script: - 'mvn deploy -s ci_settings.xml' -- GitLab From e493959ebef546d638578880727c1eecff90c86e Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Fri, 8 Dec 2023 14:14:39 +0000 Subject: [PATCH 10/29] used direct URL in ci --- .gitlab-ci.yml | 4 +--- pom.xml | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0aefe0e..d651bdf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,5 @@ stages: deploy: stage: deploy image: maven:3.9.5-ibm-semeru-17-focal - before_script: - - echo $CI_API_V4_URL script: - - 'mvn deploy -s ci_settings.xml' + - mvn deploy -s ci_settings.xml -Drepo.url=${CI_API_V4_URL}/projects/276/packages/maven diff --git a/pom.xml b/pom.xml index 205cab0..efc30ee 100644 --- a/pom.xml +++ b/pom.xml @@ -23,17 +23,17 @@ gitlab-maven - ${CI_API_V4_URL}/projects/276/packages/maven + ${repo.url} gitlab-maven - ${CI_API_V4_URL}/projects/276/packages/maven + ${repo.url} gitlab-maven - ${CI_API_V4_URL}/projects/276/packages/maven + ${repo.url} -- GitLab From 4273d71eea973f4cb6dd11e933abc6efdd47d9aa Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Fri, 8 Dec 2023 14:18:46 +0000 Subject: [PATCH 11/29] debug commands --- .gitlab-ci.yml | 4 +++- pom.xml | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d651bdf..3ee3fd5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,4 +5,6 @@ deploy: stage: deploy image: maven:3.9.5-ibm-semeru-17-focal script: - - mvn deploy -s ci_settings.xml -Drepo.url=${CI_API_V4_URL}/projects/276/packages/maven + - echo "CI_API_V4_URL: $CI_API_V4_URL" + - echo "CI_PROJECT_ID: $CI_PROJECT_ID" + - mvn deploy -s ci_settings.xml diff --git a/pom.xml b/pom.xml index efc30ee..205cab0 100644 --- a/pom.xml +++ b/pom.xml @@ -23,17 +23,17 @@ gitlab-maven - ${repo.url} + ${CI_API_V4_URL}/projects/276/packages/maven gitlab-maven - ${repo.url} + ${CI_API_V4_URL}/projects/276/packages/maven gitlab-maven - ${repo.url} + ${CI_API_V4_URL}/projects/276/packages/maven -- GitLab From 8c03d167b02338cdd162c30bb434b265d3986d67 Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Fri, 8 Dec 2023 14:19:53 +0000 Subject: [PATCH 12/29] debug commands --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3ee3fd5..66ccca6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,6 +5,6 @@ deploy: stage: deploy image: maven:3.9.5-ibm-semeru-17-focal script: - - echo "CI_API_V4_URL: $CI_API_V4_URL" - - echo "CI_PROJECT_ID: $CI_PROJECT_ID" + - echo $CI_API_V4_URL + - echo $CI_PROJECT_ID - mvn deploy -s ci_settings.xml -- GitLab From d2914bdd427f93d6ca1e910ed29399e9998fe5d2 Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Fri, 8 Dec 2023 14:34:49 +0000 Subject: [PATCH 13/29] skip tests --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 66ccca6..f4506fc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,4 +7,4 @@ deploy: script: - echo $CI_API_V4_URL - echo $CI_PROJECT_ID - - mvn deploy -s ci_settings.xml + - mvn deploy -s ci_settings.xml -DskipTests -- GitLab From 4adc7546c97a0d994977375eea2a9104d300c694 Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Fri, 8 Dec 2023 14:36:07 +0000 Subject: [PATCH 14/29] removed debug commands --- .gitlab-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f4506fc..db0ad64 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,6 +5,4 @@ deploy: stage: deploy image: maven:3.9.5-ibm-semeru-17-focal script: - - echo $CI_API_V4_URL - - echo $CI_PROJECT_ID - mvn deploy -s ci_settings.xml -DskipTests -- GitLab From 56f5f8782e81997cb85e8e737295c3568154b285 Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Fri, 8 Dec 2023 14:37:27 +0000 Subject: [PATCH 15/29] added group level URL --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 205cab0..b55da3d 100644 --- a/pom.xml +++ b/pom.xml @@ -23,17 +23,17 @@ gitlab-maven - ${CI_API_V4_URL}/projects/276/packages/maven + https://labs.etsi.org/rep/api/v4/groups/260/-/packages/maven gitlab-maven - ${CI_API_V4_URL}/projects/276/packages/maven + https://labs.etsi.org/rep/api/v4/groups/260/-/packages/maven gitlab-maven - ${CI_API_V4_URL}/projects/276/packages/maven + https://labs.etsi.org/rep/api/v4/groups/260/-/packages/maven -- GitLab From 8a7dba8c72287c698eef8634818b8b6c5c1da8ff Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Fri, 8 Dec 2023 14:45:15 +0000 Subject: [PATCH 16/29] point to group for artifact dependency --- pom.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index b55da3d..de09083 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,6 @@ UTF-8 UTF-8 1.18.28 - 276 @@ -29,11 +28,11 @@ gitlab-maven - https://labs.etsi.org/rep/api/v4/groups/260/-/packages/maven + ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven gitlab-maven - https://labs.etsi.org/rep/api/v4/groups/260/-/packages/maven + ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven -- GitLab From 742eeac66b1ffb3b631304b1ef710d868ec3223a Mon Sep 17 00:00:00 2001 From: Christos Tranoris Date: Sun, 10 Dec 2023 23:54:23 +0200 Subject: [PATCH 17/29] removed relativepath --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index de09083..dc406cb 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,6 @@ org.etsi.osl org.etsi.osl.main 1.2.0-SNAPSHOT - ../org.etsi.osl.main -- GitLab From cb18887221e7c1f887d6d3b7ae1637edcd409efa Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Mon, 11 Dec 2023 14:13:03 +0000 Subject: [PATCH 18/29] used absoute URLs --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index dc406cb..4a2cc7b 100644 --- a/pom.xml +++ b/pom.xml @@ -27,11 +27,11 @@ gitlab-maven - ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven + https://labs.etsi.org/rep/api/v4/groups/260/-/packages/maven gitlab-maven - ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven + https://labs.etsi.org/rep/api/v4/groups/260/-/packages/maven -- GitLab From 23f4f0b360221ab4de5ca1a62247da9dd1e81e26 Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Mon, 11 Dec 2023 14:15:56 +0000 Subject: [PATCH 19/29] used absolute path on project level --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 4a2cc7b..80ba1a8 100644 --- a/pom.xml +++ b/pom.xml @@ -27,11 +27,11 @@ gitlab-maven - https://labs.etsi.org/rep/api/v4/groups/260/-/packages/maven + https://labs.etsi.org/rep/api/v4/projects/292/packages/maven gitlab-maven - https://labs.etsi.org/rep/api/v4/groups/260/-/packages/maven + https://labs.etsi.org/rep/api/v4/projects/292/packages/maven -- GitLab From c09072b57f18170a2b5a18ec4801e522d6cdb2bc Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Wed, 13 Dec 2023 12:07:56 +0000 Subject: [PATCH 20/29] Revert "used absolute path on project level" This reverts commit 23f4f0b360221ab4de5ca1a62247da9dd1e81e26 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 80ba1a8..4a2cc7b 100644 --- a/pom.xml +++ b/pom.xml @@ -27,11 +27,11 @@ gitlab-maven - https://labs.etsi.org/rep/api/v4/projects/292/packages/maven + https://labs.etsi.org/rep/api/v4/groups/260/-/packages/maven gitlab-maven - https://labs.etsi.org/rep/api/v4/projects/292/packages/maven + https://labs.etsi.org/rep/api/v4/groups/260/-/packages/maven -- GitLab From 0a4a1acfa076951b96326aaa2cb7b9700927af9b Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Wed, 13 Dec 2023 12:08:10 +0000 Subject: [PATCH 21/29] Revert "used absoute URLs" This reverts commit cb18887221e7c1f887d6d3b7ae1637edcd409efa --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 4a2cc7b..dc406cb 100644 --- a/pom.xml +++ b/pom.xml @@ -27,11 +27,11 @@ gitlab-maven - https://labs.etsi.org/rep/api/v4/groups/260/-/packages/maven + ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven gitlab-maven - https://labs.etsi.org/rep/api/v4/groups/260/-/packages/maven + ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven -- GitLab From 6f769312feef77870414a722dec78a6a4730bc5d Mon Sep 17 00:00:00 2001 From: George Tziavas Date: Mon, 18 Dec 2023 12:49:45 +0200 Subject: [PATCH 22/29] Created .gitignore and added /classes, /target, /.settings, .project, .classpath to it. --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c4dfa58 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +/classes/ +/target +/.settings + +.project +.classpath + -- GitLab From 5c793f5ff764f5814c5c84adbd5f1f011a9a2d04 Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Tue, 19 Dec 2023 12:38:56 +0000 Subject: [PATCH 23/29] refactored ci to use inheritance --- .gitlab-ci.yml | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index db0ad64..d400fd1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,21 @@ -stages: - - deploy +include: + - project: osl/code/org.etsi.osl.main + ref: 12-update-gitlab-ci-file-to-use-inherited-jobs-from-main + file: + - ci-templates/default.yml + - ci-templates/build.yml + only: + - main + - develop -deploy: - stage: deploy - image: maven:3.9.5-ibm-semeru-17-focal - script: - - mvn deploy -s ci_settings.xml -DskipTests + - project: osl/code/org.etsi.osl.main + ref: 12-update-gitlab-ci-file-to-use-inherited-jobs-from-main + file: + - ci-templates/default.yml + - ci-templates/build_unprotected.yml + except: + - main + - develop + +maven_build: + extends: .maven_build -- GitLab From cb22801a634da890ff0cebc34b5a5635e0967cb6 Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Tue, 19 Dec 2023 13:51:09 +0000 Subject: [PATCH 24/29] used dynamic ref in inheritance --- .gitlab-ci.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d400fd1..49a3cd4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,21 +1,27 @@ include: - project: osl/code/org.etsi.osl.main - ref: 12-update-gitlab-ci-file-to-use-inherited-jobs-from-main + ref: main file: - ci-templates/default.yml - ci-templates/build.yml - only: - - main - - develop + rules: + - if: '$CI_COMMIT_REF_NAME == "main"' + + - project: osl/code/org.etsi.osl.main + ref: develop + file: + - ci-templates/default.yml + - ci-templates/build.yml + rules: + - if: '$CI_COMMIT_REF_NAME == "develop"' - project: osl/code/org.etsi.osl.main - ref: 12-update-gitlab-ci-file-to-use-inherited-jobs-from-main + ref: develop file: - ci-templates/default.yml - ci-templates/build_unprotected.yml - except: - - main - - develop + rules: + - if: '$CI_COMMIT_REF_NAME != "main" && $CI_COMMIT_REF_NAME != "develop"' maven_build: extends: .maven_build -- GitLab From ebe2cca5ccac608ac2a059a3d843e012293b1d0f Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Thu, 18 Jan 2024 11:09:33 +0000 Subject: [PATCH 25/29] version per osl component from parent --- pom.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index dc406cb..6a07c27 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,8 @@ org.etsi.osl org.etsi.osl.main - 1.2.0-SNAPSHOT + 1.0.0-SNAPSHOT + ../org.etsi.osl.main @@ -46,7 +47,7 @@ org.etsi.osl org.etsi.osl.model.tmf - ${project.version} + ${org.etsi.osl.model.tmf.version} \ No newline at end of file -- GitLab From 7e916d158af939dfa2a70cdb751002d93d5b1310 Mon Sep 17 00:00:00 2001 From: trantzas Date: Mon, 22 Jan 2024 11:47:01 +0000 Subject: [PATCH 26/29] Upload license file --- LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. -- GitLab From 7e872e850f510d8f470f815278233393a39decde Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Thu, 13 Jun 2024 12:51:24 +0000 Subject: [PATCH 27/29] feat: version 1.0.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6a07c27..6e5f80a 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.etsi.osl org.etsi.osl.main - 1.0.0-SNAPSHOT + 1.0.0 ../org.etsi.osl.main -- GitLab From 61206846e39bc25a4720bede2e20a3de27e23049 Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Fri, 14 Jun 2024 11:42:53 +0000 Subject: [PATCH 28/29] fix: add protected run --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 49a3cd4..1e7d6e7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,7 +13,7 @@ include: - ci-templates/default.yml - ci-templates/build.yml rules: - - if: '$CI_COMMIT_REF_NAME == "develop"' + - if: '$CI_COMMIT_REF_NAME == "develop" || $CI_COMMIT_REF_PROTECTED' - project: osl/code/org.etsi.osl.main ref: develop @@ -21,7 +21,7 @@ include: - ci-templates/default.yml - ci-templates/build_unprotected.yml rules: - - if: '$CI_COMMIT_REF_NAME != "main" && $CI_COMMIT_REF_NAME != "develop"' + - if: '$CI_COMMIT_REF_NAME != "main" && $CI_COMMIT_REF_NAME != "develop" && !$CI_COMMIT_REF_PROTECTED' maven_build: extends: .maven_build -- GitLab From 83b82897fba02890f1541e6d9dce045715573218 Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos Date: Fri, 14 Jun 2024 13:03:35 +0000 Subject: [PATCH 29/29] fix: side branch references main's side branch --- .gitlab-ci.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1e7d6e7..3d872f6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,7 +13,15 @@ include: - ci-templates/default.yml - ci-templates/build.yml rules: - - if: '$CI_COMMIT_REF_NAME == "develop" || $CI_COMMIT_REF_PROTECTED' + - if: '$CI_COMMIT_REF_NAME == "develop"' + + - project: osl/code/org.etsi.osl.main + ref: $CI_COMMIT_REF_NAME + file: + - ci-templates/default.yml + - ci-templates/build.yml + rules: + - if: '$CI_COMMIT_REF_PROTECTED && $CI_COMMIT_REF_NAME != "main" && $CI_COMMIT_REF_NAME != "develop"' - project: osl/code/org.etsi.osl.main ref: develop -- GitLab