Skip to content

Commit

Permalink
update gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
cmendesce committed Dec 26, 2023
1 parent 2d700df commit a7a4b99
Show file tree
Hide file tree
Showing 11 changed files with 411 additions and 14 deletions.
179 changes: 165 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,170 @@
# Ignorar arquivos de compilação do Maven
target/
# Created by https://www.toptal.com/developers/gitignore/api/java,intellij+all,maven,macos
# Edit at https://www.toptal.com/developers/gitignore?templates=java,intellij+all,maven,macos

# Ignorar arquivos de configuração do Eclipse
.classpath
.project
.settings/
### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

# Ignorar arquivos de log do Maven
log/
### Intellij+all Patch ###
# Ignore everything but code style settings and run configurations
# that are supposed to be shared within teams.

.idea/*

!.idea/codeStyles
!.idea/runConfigurations

### Java ###
# Compiled class file
*.class

# Log file
*.log

# Ignorar arquivos de dependência do Maven
# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### Maven ###
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
# Ignorar arquivos do IntelliJ IDEA
.idea/
*.iml
*.iws
*.ipr
buildNumber.properties
.mvn/timing.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar

# Eclipse m2e generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath

# End of https://www.toptal.com/developers/gitignore/api/java,intellij+all,maven,macos
Empty file added model-class.mermaid
Empty file.
86 changes: 86 additions & 0 deletions src/main/java/br/unifor/ppgia/resiliencebench/K6TestRunner.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package br.unifor.ppgia.resiliencebench;

import br.unifor.ppgia.resiliencebench.resources.workload.Workload;
import io.fabric8.kubernetes.api.model.HasMetadata;
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.kubernetes.client.utils.Serialization;

import java.util.HashMap;
import java.util.Map;

public class K6Runner {

public void createCustomResource(String namespace, String crInstanceName, Map<String, Object> customResourceSpec) {
try (KubernetesClient client = new DefaultKubernetesClient()) {
// Define the Custom Resource instance as a generic Kubernetes resource
Map<String, Object> crMap = new HashMap<>();
crMap.put("apiVersion", "k6.io/v1alpha1"); // Replace with actual API version
crMap.put("kind", "K6");
crMap.put("metadata", Map.of("name", crInstanceName, "namespace", namespace));

// Add the spec if provided
if (customResourceSpec != null && !customResourceSpec.isEmpty()) {
crMap.put("spec", customResourceSpec);
}

// Convert the map to a generic Kubernetes resource
HasMetadata customResource = Serialization.unmarshal(Serialization.asJson(crMap), HasMetadata.class);

// Apply the Custom Resource instance to the Kubernetes cluster
Resource<HasMetadata> resource = client.resource(customResource);
resource.create();
System.out.println("Custom Resource created or updated successfully");
} catch (Exception e) {
e.printStackTrace();
System.err.println("Error creating Custom Resource: " + e.getMessage());
}
}

public HasMetadata createResource(Workload workload) {
var spec = Map.of(
"parallelism", 1,
"arguments", "--tag workloadName=" + workload.getMetadata().getName(),
"script", Map.of(
"config", Map.of(
"name", workload.getSpec().getScript().getConfigMap().getName(),
"file", workload.getSpec().getScript().getConfigMap().getFile()
)
)
);

var customResource = Map.of(
"apiVersion", "k6.io/v1alpha1",
"kind", "K6",
"metadata", Map.of("name", workload.getMetadata().getName(), "namespace", workload.getMetadata().getNamespace()),
"spec", spec
);

return Serialization.unmarshal(Serialization.asJson(customResource), HasMetadata.class);
}



// public void run(ScenarioWorkload scenarioWorkload) {
// CustomResourceRepository<Workload> workloadRepository = new CustomResourceRepository(null, Workload.class);
// var workload = workloadRepository.get("default", scenarioWorkload.getWorkloadName());
//
// var meta = Map.of(
// "apiVersion", "k6.io/v1alpha1",
// "kind", "K6",
// "metadata", Map.of("name", crInstanceName, "namespace", namespace)
// );
//
// var spec = Map.of(
// "parallelism", 1,
// "arguments", "--tag workloadName=" + scenarioWorkload.getWorkloadName(),
// "script", Map.of(
// "config", Map.of(
// "name", workload.getSpec().getScript().getConfigMap().getName(),
// "file", workload.getSpec().getScript().getConfigMap().getFile()
// )
// )
// );
// }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package br.unifor.ppgia.resiliencebench;public class ObjectMetaFactory {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package br.unifor.ppgia.resiliencebench;public class ScenarioRunner {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
@startuml

/' diagram meta data start
config=StructureConfiguration;
{
"projectClassification": {
"searchMode": "OpenProject", // OpenProject, AllProjects
"includedProjects": "",
"pathEndKeywords": "*.impl",
"isClientPath": "",
"isClientName": "",
"isTestPath": "",
"isTestName": "",
"isMappingPath": "",
"isMappingName": "",
"isDataAccessPath": "",
"isDataAccessName": "",
"isDataStructurePath": "",
"isDataStructureName": "",
"isInterfaceStructuresPath": "",
"isInterfaceStructuresName": "",
"isEntryPointPath": "",
"isEntryPointName": "",
"treatFinalFieldsAsMandatory": false
},
"graphRestriction": {
"classPackageExcludeFilter": "",
"classPackageIncludeFilter": "br.unifor.ppgia.resiliencebench.resources",
"classNameExcludeFilter": "",
"classNameIncludeFilter": "",
"methodNameExcludeFilter": "",
"methodNameIncludeFilter": "",
"removeByInheritance": "", // inheritance/annotation based filtering is done in a second step
"removeByAnnotation": "",
"removeByClassPackage": "", // cleanup the graph after inheritance/annotation based filtering is done
"removeByClassName": "",
"cutMappings": false,
"cutEnum": true,
"cutTests": true,
"cutClient": true,
"cutDataAccess": true,
"cutInterfaceStructures": true,
"cutDataStructures": true,
"cutGetterAndSetter": true,
"cutConstructors": true
},
"graphTraversal": {
"forwardDepth": 3,
"backwardDepth": 3,
"classPackageExcludeFilter": "",
"classPackageIncludeFilter": "",
"classNameExcludeFilter": "",
"classNameIncludeFilter": "",
"methodNameExcludeFilter": "",
"methodNameIncludeFilter": "",
"hideMappings": false,
"hideDataStructures": false,
"hidePrivateMethods": true,
"hideInterfaceCalls": true, // indirection: implementation -> interface (is hidden) -> implementation
"onlyShowApplicationEntryPoints": false, // root node is included
"useMethodCallsForStructureDiagram": "ForwardOnly" // ForwardOnly, BothDirections, No
},
"details": {
"aggregation": "GroupByClass", // ByClass, GroupByClass, None
"showClassGenericTypes": true,
"showMethods": true,
"showMethodParameterNames": true,
"showMethodParameterTypes": true,
"showMethodReturnType": true,
"showPackageLevels": 2,
"showDetailedClassStructure": true
},
"rootClass": "br.unifor.ppgia.resiliencebench.resources.scenario.ScenarioWorkload",
"extensionCallbackMethod": "" // qualified.class.name#methodName - signature: public static String method(String)
}
diagram meta data end '/



digraph g {
rankdir="TB"
splines=polyline


'nodes
subgraph cluster_840539687 {
label=unifor
labeljust=l
fillcolor="#ececec"
style=filled

subgraph cluster_1310750358 {
label=ppgia
labeljust=l
fillcolor="#d8d8d8"
style=filled

ScenarioWorkload1013600530[
label=<<TABLE BORDER="1" CELLBORDER="0" CELLPADDING="4" CELLSPACING="0">
<TR><TD ALIGN="LEFT" >(C)ScenarioWorkload</TD></TR>
<HR/>
<TR><TD ALIGN="LEFT" >- users: int [1]</TD></TR>
<TR><TD ALIGN="LEFT" >- workloadName: String [0..1]</TD></TR>
</TABLE>>
style=filled
margin=0
shape=plaintext
fillcolor="#FFFFFF"
];
}
}

'edges


}
@enduml
Empty file.
Loading

0 comments on commit a7a4b99

Please sign in to comment.