Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No remote with conf PR #220

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5df1ebb
Some clean up to make code easier to read
SirOibaf Jan 18, 2019
0779fec
experiment clean up leftover
SirOibaf Jan 18, 2019
a50e634
more stuff out
SirOibaf Jan 18, 2019
3bc5c8c
friday evening progresses
SirOibaf Jan 19, 2019
7d70c45
more work
SirOibaf Jan 19, 2019
d70fd12
almost there
SirOibaf Jan 19, 2019
3ec892c
it builds
SirOibaf Jan 20, 2019
dac8037
half working hack
SirOibaf Jan 20, 2019
3937ba2
local by default
SirOibaf Jan 20, 2019
3959a35
progress
SirOibaf Dec 14, 2021
74c18ca
Remove hardcoded 9090 port for the UI (#203)
SirOibaf Jul 2, 2020
f313268
[fix_user_home] Use system property to get user home (#211)
kouzant Aug 31, 2021
3643460
[fix_lets_encrypt_ca] Remove expired Lets Encrypt CA certificate (#212)
kouzant Oct 4, 2021
b5a71b3
[fix_lets_encrypt_ca] Fix quotes (#213)
kouzant Oct 4, 2021
a9e33cf
Use dzdo instead of sudo
SirOibaf Oct 11, 2022
e044cc3
[configurable_chef_solo] Add configuration property and environment v…
kouzant Nov 4, 2022
d23bb81
Replace tee with redirect (#218)
SirOibaf Oct 26, 2022
670b98a
[bumpup_karamel] Bumpup Karamel version (#1)
kouzant Nov 24, 2022
09ae738
[bump_karamel_version] Bumpup Karamel version (#2)
kouzant Nov 24, 2022
2fa6f46
[CLOUD-484_no_remote] Fix special characters in cluster definition at…
kouzant Mar 16, 2023
befc263
[CLOUD-543] Rewrite sshRun method to address connectivity and concurr…
kouzant Apr 21, 2023
1878fbd
[no_remote_conf_sync] Bump version
kouzant May 31, 2023
21502f9
[HWORKS-668] Release Karamel version 0.9 (#5)
kouzant Jul 20, 2023
e778710
[HWORKS-680] In case of parallelism constraints, if a recipe has fai…
kouzant Aug 8, 2023
bab00bd
[HWORKS-726] Delete Chef json cache (#11)
kouzant Sep 6, 2023
eaea94d
[HWORKS-726] Sudo delete directory (#12)
kouzant Sep 6, 2023
5d3f7d4
[HWORKS-726] Delete nodes directory for airgap environments (#13)
kouzant Sep 7, 2023
1a721e7
Bump Karamel version to 0.10
SirOibaf Sep 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,55 @@ Karamel introduces Karamelfile to orchestrate the execution of Chef recipes. Kar

We leverage Berkshelf to transparently download and install transitive cookbook dependencies, so large systems can be defined in a few lines of code. Finally, the Karamel runtime builds and manages the execution of the DAG of Chef recipes by executing them with Chef Solo.

### Configuration
#### Karamel working directory
By default Karamel (local & remote) working directory is `$HOME/.karamel` If you want to override this directory
use the environment variable `KARAMEL_WORKING_DIRECTORY` such as `export
KARAMEL_WORKING_DIRECTORY=/tmp/karamel_directory`

#### Chef file cache
Chef will download files to `/tmp/chef-solo` before using them. To change the staging location use the
environment variable `CHEF_FILE_CACHE_PATH` such as `export CHEF_FILE_CACHE_PATH=/run/chef-solo`

#### Elevated privileges program
Karamel requires to run with elevated privileges. The default program for that is `sudo` but if your
organization uses another program set it with the environment variable `CHEF_SUDO_BINARY` such as
`export CHEF_SUDO_BINARY=dzdo`

#### Airgapped installations
If you are installing Hopsworks on an environment with no internet connectivity set `KARAMEL_AIRGAP=true`

#### Ruby Gems server
To point Chef to a local Ruby gems server instead of https://rubygems.org export
`CHEF_RUBYGEMS_URL=http://IP_ADDRESS:8808`

### Cluster Definition
---
Cluster definition is an expressive DSL based on YAML as you can see in the following sample. Since Karamel can run several clusters simultaneously, name of the cluster must be unique in each Karamel-runtime.

#### Recipes execution parallelism
Karamel will execute recipes in parallel on all machines respecting any dependency stated in Karamelfile. Regardless
of the dependencies, the same recipes will be executed in parallel on all machines. For example if we run recipe
`ndb::ndbd` on three machines, they may be executed in parallel depending on how Karamel will schedule them.

In some cases we want to guarantee only a portion of machines to execute recipes in parallel. For example in case of
a rolling restart/upgrade we want to execute `ndb::ndbd` serially. You can configure recipe parallelism under
`runtimeConfiguration/recipesParallelism` section in the cluster definition in the format `recipe_name: parallelism`.
Multiple recipes can be configured. For example:

```yaml
runtimeConfiguration:
recipesParallelism:
consul::master: 1
ndb::ndbd: 1
ndb::mysqld: 2
ndb::mysqld_tls: 2
onlinefs::default: 1
hops::nn: 1
hops::rm: 1
```

#### Cloud providers
We support five cloud providers: Amazon EC2 (ec2), Google Compute Engine (gce), Openstack Nova (nova), OCCI and bare-metal (baremetal). You can define provider globally or per group. In the group scope, you can overwrite some attributes of the network/machines in the global scope or you can entirely choose another cloud provider, that's how we support multi-cloud deployment. Settings and properties for each provider is introduced in a following separate section.

Cookbooks section introduces github references to the used cookbooks, it is also possible to refer to a specific version or branch for each github repository.
Expand Down
2 changes: 1 addition & 1 deletion karamel-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>se.kth.karamel</groupId>
<artifactId>karamel-parent</artifactId>
<version>0.5</version>
<version>0.10</version>
</parent>
<groupId>se.kth.karamel</groupId>
<artifactId>karamel-common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,15 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package se.kth.karamel.common.clusterdef;

import se.kth.karamel.common.cookbookmeta.CookbookUrls;
import se.kth.karamel.common.exception.CookbookUrlException;

/**
*
* @author kamal
*/
public class Cookbook {

private String github;
private String version;
private String branch;
private String cookbook;

public Cookbook() {
}

public Cookbook(Cookbook cookbook) {
this.github = cookbook.getGithub();
this.version = cookbook.getVersion();
this.branch = cookbook.getBranch();
this.cookbook = cookbook.cookbook;
}

public String getBranch() {
return branch;
}

public void setBranch(String branch) {
public Cookbook(String github, String branch) {
this.github = github;
this.branch = branch;
}

Expand All @@ -45,32 +21,11 @@ public void setGithub(String github) {
this.github = github;
}

public String getVersion() {
return version;
}

public void setVersion(String version) {
this.version = version;
}

public String getCookbook() {
return cookbook;
public String getBranch() {
return branch;
}

public void setCookbook(String cookbook) {
this.cookbook = cookbook;
}

public CookbookUrls getUrls() throws CookbookUrlException {
CookbookUrls.Builder builder = new CookbookUrls.Builder();
builder.url(github);
if (branch != null)
builder.branchOrVersion(branch);
else if (version != null)
builder.branchOrVersion(version);
if (cookbook != null)
builder.cookbookRelPath(cookbook);
CookbookUrls urls = builder.build();
return urls;
public void setBranch(String branch) {
this.branch = branch;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
package se.kth.karamel.common.clusterdef;

import se.kth.karamel.common.clusterdef.yaml.RuntimeConfiguration;
import se.kth.karamel.common.exception.ValidationException;

/**
Expand All @@ -16,6 +17,7 @@ public abstract class Scope {
private Ec2 ec2;
private Vagrant vagrant;
private Baremetal baremetal;
private RuntimeConfiguration runtimeConfiguration = new RuntimeConfiguration();
private Gce gce;
private Nova nova;
private Occi occi;
Expand All @@ -27,6 +29,7 @@ public Scope(Scope scope) {
this.ec2 = scope.getEc2();
this.vagrant = scope.getVagrant();
this.baremetal = scope.getBaremetal();
this.runtimeConfiguration = scope.getRuntimeConfiguration();
this.gce = scope.getGce();
this.nova = scope.getNova();
this.occi = scope.getOcci();
Expand Down Expand Up @@ -81,17 +84,17 @@ public Gce getGce() {
public void setGce(Gce gce) {
this.gce = gce;
}

public Occi getOcci() {
return occi;
}

public void setOcci(Occi occi) {
this.occi = occi;
}

public Nova getNova() {return nova;}

public void setNova(Nova nova) {
this.nova = nova;
}
Expand All @@ -116,5 +119,12 @@ public void validate() throws ValidationException {
occi.validate();
}
}
;

public RuntimeConfiguration getRuntimeConfiguration() {
return runtimeConfiguration;
}

public void setRuntimeConfiguration(RuntimeConfiguration runtimeConfiguration) {
this.runtimeConfiguration = runtimeConfiguration;
}
}
Original file line number Diff line number Diff line change
@@ -1,40 +1,61 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package se.kth.karamel.common.clusterdef.json;

import se.kth.karamel.common.clusterdef.Cookbook;
import se.kth.karamel.common.clusterdef.yaml.YamlCluster;
import se.kth.karamel.common.clusterdef.yaml.YamlGroup;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import se.kth.karamel.common.cookbookmeta.Attribute;
import se.kth.karamel.common.cookbookmeta.KaramelizedCookbook;
import se.kth.karamel.common.exception.KaramelException;

/**
*
* @author kamal
*/
public class JsonCluster extends JsonScope {

private String name;

private Map<String, Cookbook> rootCookbooks = new HashMap<>();
private List<JsonGroup> groups = new ArrayList<>();

public JsonCluster() {
}

public JsonCluster(YamlCluster cluster) throws KaramelException {
super(cluster, cluster);
this.name = cluster.getName();
super(cluster);
name = cluster.getName();
rootCookbooks = cluster.getCookbooks();
attributes = cluster.flattenAttrs();
Set<Attribute> validAttrs = new HashSet<>();

cookbooks.addAll(CACHE.loadAllKaramelizedCookbooks(cluster));

//filtering invalid(not defined in metadata.rb) attributes from yaml model
// Get all the valid attributes, also for transient dependency
for (KaramelizedCookbook kcb : cookbooks) {
validAttrs.addAll(kcb.getMetadataRb().getAttributes());
}

// TODO(Fabio): I think that this map should be <String, Attribute>. But I don't want to see
// what happen if I change it.
Map<String, Object> invalidAttrs = new HashMap<>();

for (String usedAttr: attributes.keySet()) {
if (!validAttrs.contains(new Attribute(usedAttr))) {
invalidAttrs.put(usedAttr, attributes.get(usedAttr));
}
}

if (!invalidAttrs.isEmpty()) {
throw new KaramelException(String.format("Invalid attributes, all used attributes must be defined in metadata.rb "
+ "files: %s", invalidAttrs.keySet().toString()));
}

Set<Map.Entry<String, YamlGroup>> entrySet = cluster.getGroups().entrySet();
for (Map.Entry<String, YamlGroup> entry : entrySet) {
String gName = entry.getKey();
YamlGroup group = entry.getValue();
JsonGroup jsonGroup = new JsonGroup(cluster, group, gName);
this.groups.add(jsonGroup);
groups.add(new JsonGroup(entry.getValue(), entry.getKey(), cookbooks));
}

}
Expand All @@ -55,4 +76,11 @@ public void setGroups(List<JsonGroup> groups) {
this.groups = groups;
}

public Map<String, Cookbook> getRootCookbooks() {
return rootCookbooks;
}

public void setRootCookbooks(Map<String, Cookbook> rootCookbooks) {
this.rootCookbooks = rootCookbooks;
}
}

This file was deleted.

Loading