Skip to content

Commit

Permalink
Rename helm chart to marblerun (edgelesssys#254)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Weiße <[email protected]>

Co-authored-by: Daniel Weiße <[email protected]>
  • Loading branch information
m1ghtym0 and daniel-weisse authored Sep 17, 2021
1 parent fdacd9a commit abcadab
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 52 deletions.
4 changes: 2 additions & 2 deletions charts/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ keywords:
- service-mesh
- confidential-computing
kubeVersion: ">=1.13.0-0"
name: marblerun-coordinator
name: marblerun
sources:
- https://github.com/edgelesssys/marblerun
version: 0.5.0
Expand All @@ -18,4 +18,4 @@ icon: https://raw.githubusercontent.com/edgelesssys/helm/main/marblerun_icon.svg
annotations:
"artifacthub.io/links": |
- name: Chart Source
url: https://github.com/edgelesssys/helm
url: https://github.com/edgelesssys/marblerun/tree/master/charts
10 changes: 5 additions & 5 deletions charts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ helm repo update
* If you are deploying on a cluster with nodes that support SGX1+FLC (e.g. AKS or minikube + Azure Standard_DC*s)

```bash
helm install marblerun-coordinator edgeless/marblerun-coordinator --create-namespace --namespace marblerun
helm install marblerun edgeless/marblerun --create-namespace --namespace marblerun
```

* Otherwise

```bash
helm install marblerun-coordinator edgeless/marblerun-coordinator --create-namespace --namespace marblerun --set coordinator.resources=null --set coordinator.simulation=1 --set tolerations=null
helm install marblerun edgeless/marblerun --create-namespace --namespace marblerun --set coordinator.resources=null --set coordinator.simulation=1 --set tolerations=null
```

## Configuration

The following table lists the configurable parameters of the marblerun-coordinator chart and
The following table lists the configurable parameters of the marblerun chart and
their default values.

| Parameter | Type | Description | Default |
Expand All @@ -41,7 +41,7 @@ their default values.
| `coordinator.meshServerPort` | int | Port of the mesh-api server configuration | `2001` |
| `coordinator.replicas` | int | Number of replicas for each control plane pod | `1` |
| `coordinator.sealDir` | string | Path to the directory used for sealing data. Needs to be consistent with the persisten storage setup | `"/coordinator/data/"` |
| `coordinator.simulation` | string | SGX simulation settings, set to 1 if your not running on an SGX capable cluster | `"0"` |
| `coordinator.simulation` | bool | SGX simulation settings, set to `true` if your not running on an SGX capable cluster | `false` |
| `global.coordinatorComponentLabel` | string | Control plane label. Do not edit | `"edgeless.systems/control-plane-component"` |
| `global.coordinatorNamespaceLabel` | string | Control plane label. Do not edit | `"edgeless.systems/control-plane-ns"` |
| `global.image` | object | Image configuration for all components | `{"pullPolicy":"IfNotPresent","version":" v0.5.0","repository":"ghcr.io/edgelesssys"}` |
Expand All @@ -59,7 +59,7 @@ their default values.
```bash
cd <marblerun-repo>
helm package charts
mv marblerun-coordinator-x.x.x.tgz <helm-repo>/stable
mv marblerun-x.x.x.tgz <helm-repo>/stable
cd <helm-repo>
helm repo index stable --url https://helm.edgeless.systems/stable
```
2 changes: 1 addition & 1 deletion charts/templates/coordinator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ spec:
- name: EDG_COORDINATOR_SEAL_DIR
value: "{{ .Values.coordinator.sealDir }}"
- name: OE_SIMULATION
value: "{{ .Values.coordinator.simulation }}"
value: {{ if .Values.coordinator.simulation }}"1"{{ else }}"0"{{ end }}
- name: DCAP_LIBRARY
value: "{{ .Values.coordinator.dcapQpl }}"
name: coordinator
Expand Down
2 changes: 1 addition & 1 deletion charts/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ coordinator:
# SEAL_DIR needs to be set according to persistent storage
sealDir: "/coordinator/data/"
# OE_SIMULATION needs be set to "1" when running on systems without SGX1+FLC capabilities
simulation: "0"
simulation: false
# DCAP_LIBRARY needs to be "intel" if the libsgx-dcap-default-qpl is to be used, otherwise az-dcap-client is used by default
dcapQpl: "azure"

Expand Down
4 changes: 2 additions & 2 deletions cli/cmd/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ func newCheckCmd() *cobra.Command {

// cliCheck if marblerun control-plane deployments are ready to use
func cliCheck(kubeClient kubernetes.Interface, timeout uint) error {
if err := checkDeploymentStatus(kubeClient, "marble-injector", "marblerun", timeout); err != nil {
if err := checkDeploymentStatus(kubeClient, helmInjectorDeployment, helmNamespace, timeout); err != nil {
return err
}

if err := checkDeploymentStatus(kubeClient, "marblerun-coordinator", "marblerun", timeout); err != nil {
if err := checkDeploymentStatus(kubeClient, helmCoordinatorDeployment, helmNamespace, timeout); err != nil {
return err
}

Expand Down
36 changes: 15 additions & 21 deletions cli/cmd/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,35 @@ func TestDeploymentIsReady(t *testing.T) {
assert := assert.New(t)
testClient := fake.NewSimpleClientset()

deploymentName := "marblerun-coordinator"
namespace := "marblerun"

_, _, err := deploymentIsReady(testClient, deploymentName, namespace)
_, _, err := deploymentIsReady(testClient, helmCoordinatorDeployment, helmNamespace)
require.Error(err)

// create fake deployment with one non ready replica
// create a fake deployment with 1/1 available replicas
testDeployment := &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: deploymentName,
Name: helmCoordinatorDeployment,
},
Status: appsv1.DeploymentStatus{
Replicas: 1,
UnavailableReplicas: 1,
},
}

_, err = testClient.AppsV1().Deployments(namespace).Create(context.TODO(), testDeployment, metav1.CreateOptions{})
_, err = testClient.AppsV1().Deployments(helmNamespace).Create(context.TODO(), testDeployment, metav1.CreateOptions{})
require.NoError(err)

ready, status, err := deploymentIsReady(testClient, deploymentName, namespace)
ready, status, err := deploymentIsReady(testClient, helmCoordinatorDeployment, helmNamespace)
require.NoError(err)
assert.False(ready, "function returned true when deployment was not ready")
assert.Equal("0/1", status, fmt.Sprintf("expected 0/1 ready pods but got %s", status))

testDeployment.Status.UnavailableReplicas = 0
testDeployment.Status.AvailableReplicas = 1
_, err = testClient.AppsV1().Deployments(namespace).UpdateStatus(context.TODO(), testDeployment, metav1.UpdateOptions{})
_, err = testClient.AppsV1().Deployments(helmNamespace).UpdateStatus(context.TODO(), testDeployment, metav1.UpdateOptions{})
require.NoError(err)

ready, status, err = deploymentIsReady(testClient, deploymentName, namespace)
ready, status, err = deploymentIsReady(testClient, helmCoordinatorDeployment, helmNamespace)
require.NoError(err)
assert.True(ready, "function returned false when deployment was ready")
assert.Equal("1/1", status, fmt.Sprintf("expected 1/1 ready pods but got %s", status))
Expand All @@ -59,27 +56,24 @@ func TestCheckDeploymentStatus(t *testing.T) {
require := require.New(t)
testClient := fake.NewSimpleClientset()

deploymentName := "marblerun-coordinator"
namespace := "marblerun"

// try without any deployments
err := checkDeploymentStatus(testClient, deploymentName, namespace, 10)
err := checkDeploymentStatus(testClient, helmCoordinatorDeployment, helmNamespace, 10)
assert.NoError(err)

// create a fake deployment with 1/1 available replicas
testDeployment := &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: deploymentName,
Name: helmCoordinatorDeployment,
},
Status: appsv1.DeploymentStatus{
Replicas: 1,
AvailableReplicas: 1,
},
}
_, err = testClient.AppsV1().Deployments(namespace).Create(context.TODO(), testDeployment, metav1.CreateOptions{})
_, err = testClient.AppsV1().Deployments(helmNamespace).Create(context.TODO(), testDeployment, metav1.CreateOptions{})
require.NoError(err)

err = checkDeploymentStatus(testClient, deploymentName, namespace, 10)
err = checkDeploymentStatus(testClient, helmCoordinatorDeployment, helmNamespace, 10)
assert.NoError(err)
}

Expand All @@ -95,32 +89,32 @@ func TestCliCheck(t *testing.T) {
// create a fake deployment with 1/1 available replicas
testDeployment := &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: "marblerun-coordinator",
Name: helmCoordinatorDeployment,
},
Status: appsv1.DeploymentStatus{
Replicas: 1,
AvailableReplicas: 1,
},
}
_, err = testClient.AppsV1().Deployments("marblerun").Create(context.TODO(), testDeployment, metav1.CreateOptions{})
_, err = testClient.AppsV1().Deployments(helmNamespace).Create(context.TODO(), testDeployment, metav1.CreateOptions{})
require.NoError(err)

err = cliCheck(testClient, 10)
assert.NoError(err)

err = testClient.AppsV1().Deployments("marblerun").Delete(context.TODO(), "marblerun-coordinator", metav1.DeleteOptions{})
err = testClient.AppsV1().Deployments(helmNamespace).Delete(context.TODO(), helmCoordinatorDeployment, metav1.DeleteOptions{})
require.NoError(err)

timeoutDeployment := &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: "marblerun-coordinator",
Name: helmCoordinatorDeployment,
},
Status: appsv1.DeploymentStatus{
Replicas: 1,
UnavailableReplicas: 0,
},
}
_, err = testClient.AppsV1().Deployments("marblerun").Create(context.TODO(), timeoutDeployment, metav1.CreateOptions{})
_, err = testClient.AppsV1().Deployments(helmNamespace).Create(context.TODO(), timeoutDeployment, metav1.CreateOptions{})
require.NoError(err)

err = cliCheck(testClient, 2)
Expand Down
20 changes: 10 additions & 10 deletions cli/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,24 +85,24 @@ func newInstallCmd() *cobra.Command {
// cliInstall installs marblerun on the cluster
func cliInstall(options *installOptions) error {
actionConfig := new(action.Configuration)
if err := actionConfig.Init(options.settings.RESTClientGetter(), "marblerun", os.Getenv("HELM_DRIVER"), debug); err != nil {
if err := actionConfig.Init(options.settings.RESTClientGetter(), helmNamespace, os.Getenv("HELM_DRIVER"), debug); err != nil {
return err
}

// create helm installer
installer := action.NewInstall(actionConfig)
installer.CreateNamespace = true
installer.Namespace = "marblerun"
installer.ReleaseName = "marblerun-coordinator"
installer.Namespace = helmNamespace
installer.ReleaseName = helmRelease
installer.ChartPathOptions.Version = options.version

if options.chartPath == "" {
// No chart was specified -> add or update edgeless helm repo
err := getRepo("edgeless", "https://helm.edgeless.systems/stable", options.settings)
err := getRepo(helmRepoName, helmRepoURI, options.settings)
if err != nil {
return err
}
options.chartPath, err = installer.ChartPathOptions.LocateChart("edgeless/marblerun-coordinator", options.settings)
options.chartPath, err = installer.ChartPathOptions.LocateChart(helmChartName, options.settings)
if err != nil {
return err
}
Expand Down Expand Up @@ -130,10 +130,10 @@ func cliInstall(options *installOptions) error {
stringValues = append(stringValues, fmt.Sprintf("coordinator.clientServerPort=%d", options.clientPort))

if options.simulation {
// simulation mode, disable tolerations and resources, set simulation to 1
// simulation mode, disable tolerations and resources, set simulation to true
stringValues = append(stringValues,
fmt.Sprintf("tolerations=%s", "null"),
fmt.Sprintf("coordinator.simulation=%d", 1),
fmt.Sprintf("coordinator.simulation=%t", options.simulation),
fmt.Sprintf("coordinator.resources.limits=%s", "null"),
fmt.Sprintf("coordinator.hostname=%s", options.hostname),
fmt.Sprintf("dcap=%s", "null"),
Expand Down Expand Up @@ -270,7 +270,7 @@ func getRepo(name string, url string, settings *cli.EnvSettings) error {
// installWebhook enables a mutating admission webhook to allow automatic injection of values into pods
func installWebhook(kubeClient kubernetes.Interface) ([]string, error) {
// verify marblerun namespace exists, if not create it
if err := verifyNamespace("marblerun", kubeClient); err != nil {
if err := verifyNamespace(helmNamespace, kubeClient); err != nil {
return nil, err
}

Expand Down Expand Up @@ -316,15 +316,15 @@ func createSecret(privKey *rsa.PrivateKey, crt []byte, kubeClient kubernetes.Int
newSecret := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "marble-injector-webhook-certs",
Namespace: "marblerun",
Namespace: helmNamespace,
},
Data: map[string][]byte{
"cert.pem": crt,
"key.pem": rsaPEM,
},
}

_, err := kubeClient.CoreV1().Secrets("marblerun").Create(context.TODO(), newSecret, metav1.CreateOptions{})
_, err := kubeClient.CoreV1().Secrets(helmNamespace).Create(context.TODO(), newSecret, metav1.CreateOptions{})
return err
}

Expand Down
4 changes: 2 additions & 2 deletions cli/cmd/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ func TestCreateSecret(t *testing.T) {

newNamespace1 := &corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: "marblerun",
Name: helmNamespace,
},
}
_, err = testClient.CoreV1().Namespaces().Create(context.TODO(), newNamespace1, metav1.CreateOptions{})
require.NoError(err)

err = createSecret(testKey, crt, testClient)
require.NoError(err)
_, err = testClient.CoreV1().Secrets("marblerun").Get(context.TODO(), "marble-injector-webhook-certs", metav1.GetOptions{})
_, err = testClient.CoreV1().Secrets(helmNamespace).Get(context.TODO(), "marble-injector-webhook-certs", metav1.GetOptions{})
require.NoError(err)

// we should get an error since the secret was already created in the previous step
Expand Down
6 changes: 3 additions & 3 deletions cli/cmd/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ func cliUninstall(settings *cli.EnvSettings, kubeClient kubernetes.Interface) er
// removeHelmRelease removes kubernetes resources installed using helm
func removeHelmRelease(settings *cli.EnvSettings) error {
actionConfig := new(action.Configuration)
if err := actionConfig.Init(settings.RESTClientGetter(), "marblerun", os.Getenv("HELM_DRIVER"), debug); err != nil {
if err := actionConfig.Init(settings.RESTClientGetter(), helmNamespace, os.Getenv("HELM_DRIVER"), debug); err != nil {
return err
}

uninstallAction := action.NewUninstall(actionConfig)
_, err := uninstallAction.Run("marblerun-coordinator")
_, err := uninstallAction.Run(helmRelease)

return err
}

// cleanupSecrets removes secretes set for the Admission Controller
func cleanupSecrets(kubeClient kubernetes.Interface) error {
return kubeClient.CoreV1().Secrets("marblerun").Delete(context.TODO(), "marble-injector-webhook-certs", metav1.DeleteOptions{})
return kubeClient.CoreV1().Secrets(helmNamespace).Delete(context.TODO(), "marble-injector-webhook-certs", metav1.DeleteOptions{})
}

// cleanupCSR removes a potentially leftover CSR from the Admission Controller
Expand Down
8 changes: 4 additions & 4 deletions cli/cmd/uninstall_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestCleanupWebhook(t *testing.T) {
require.NoError(err)

// Try to remove non existant Secret using function
_, err = testClient.CoreV1().Secrets("marblerun").Get(context.TODO(), "marble-injector-webhook-certs", metav1.GetOptions{})
_, err = testClient.CoreV1().Secrets(helmNamespace).Get(context.TODO(), "marble-injector-webhook-certs", metav1.GetOptions{})
require.Error(err)

err = cleanupSecrets(testClient)
Expand All @@ -79,18 +79,18 @@ func TestCleanupWebhook(t *testing.T) {
secret := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "marble-injector-webhook-certs",
Namespace: "marblerun",
Namespace: helmNamespace,
},
Data: map[string][]byte{
"cert.pem": {0xAA, 0xAA, 0xAA},
"key.pem": {0xBB, 0xBB, 0xBB},
},
}

_, err = testClient.CoreV1().Secrets("marblerun").Create(context.TODO(), secret, metav1.CreateOptions{})
_, err = testClient.CoreV1().Secrets(helmNamespace).Create(context.TODO(), secret, metav1.CreateOptions{})
require.NoError(err)

_, err = testClient.CoreV1().Secrets("marblerun").Get(context.TODO(), "marble-injector-webhook-certs", metav1.GetOptions{})
_, err = testClient.CoreV1().Secrets(helmNamespace).Get(context.TODO(), "marble-injector-webhook-certs", metav1.GetOptions{})
require.NoError(err)

err = cleanupSecrets(testClient)
Expand Down
11 changes: 11 additions & 0 deletions cli/cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ import (

const webhookName = "marble-injector.marblerun"

// helm constants
const (
helmChartName = "edgeless/marblerun"
helmCoordinatorDeployment = "marblerun-coordinator"
helmInjectorDeployment = "marble-injector"
helmNamespace = "marblerun"
helmRelease = "marblerun"
helmRepoURI = "https://helm.edgeless.systems/stable"
helmRepoName = "edgeless"
)

const promptForChanges = "Do you want to automatically apply the suggested changes [y/n]? "

var eraConfig string
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func getCoordinatorVersion() (string, error) {
return "", err
}

coordinatorDeployment, err := kubeClient.AppsV1().Deployments("marblerun").Get(context.TODO(), "marblerun-coordinator", metav1.GetOptions{})
coordinatorDeployment, err := kubeClient.AppsV1().Deployments(helmNamespace).Get(context.TODO(), helmCoordinatorDeployment, metav1.GetOptions{})
if err != nil {
return "", err
}
Expand Down

0 comments on commit abcadab

Please sign in to comment.