Skip to content

Commit

Permalink
added helm chart (#5)
Browse files Browse the repository at this point in the history
* added helm chart

* added folder to indicate this is a helm chart

---------

Co-authored-by: REDMOND\lleizerovich <[email protected]>
  • Loading branch information
lleizerovich and REDMOND\lleizerovich authored Oct 9, 2024
1 parent 795c154 commit 1ee30ac
Show file tree
Hide file tree
Showing 10 changed files with 177 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/mdc-simulation/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
8 changes: 8 additions & 0 deletions charts/mdc-simulation/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v2
name: mdc-simulation
description: alert simulation tool for Defender for Cloud

type: application

version: 0.1.0

62 changes: 62 additions & 0 deletions charts/mdc-simulation/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "mdc-simulation.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "mdc-simulation.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "mdc-simulation.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "mdc-simulation.labels" -}}
helm.sh/chart: {{ include "mdc-simulation.chart" . }}
{{ include "mdc-simulation.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "mdc-simulation.selectorLabels" -}}
app.kubernetes.io/name: {{ include "mdc-simulation.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "mdc-simulation.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "mdc-simulation.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
17 changes: 17 additions & 0 deletions charts/mdc-simulation/templates/attacker-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Pod
metadata:
name: mdc-simulation-attacker
namespace: {{ .Values.env.name }}
labels:
name: mdc-simulation-attacker
spec:
hostname: attacker
subdomain: mdc-simulation-attacker
containers:
- name: mdc-simulation-attacker
image: ghcr.io/microsoft/defender-for-cloud/attacksimulation/attacker:latest
env:
- name: SCENARIO
value: {{ .Values.scenario }}
restartPolicy: Never
9 changes: 9 additions & 0 deletions charts/mdc-simulation/templates/attacker-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: Service
metadata:
name: mdc-simulation-attacker
namespace: {{ .Values.env.name }}
spec:
selector:
name: mdc-simulation-attacker
clusterIP: None
8 changes: 8 additions & 0 deletions charts/mdc-simulation/templates/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Namespace
metadata:
name: {{ .Values.env.name }}
labels:
name: {{ .Values.env.name }}
annotations:
"helm.sh/hook": pre-install
14 changes: 14 additions & 0 deletions charts/mdc-simulation/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: mdc-simulation-victim
namespace: {{ .Values.env.name }}
labels:
{{- include "mdc-simulation.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
{{- end }}
14 changes: 14 additions & 0 deletions charts/mdc-simulation/templates/victim-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Pod
metadata:
name: mdc-simulation-victim
namespace: {{ .Values.env.name }}
labels:
name: mdc-simulation-victim
spec:
hostname: victim
subdomain: mdc-simulation-victim
serviceAccountName: mdc-simulation-victim
containers:
- name: mdc-simulation-victim
image: ghcr.io/microsoft/defender-for-cloud/attacksimulation/victim:latest
9 changes: 9 additions & 0 deletions charts/mdc-simulation/templates/victim-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: Service
metadata:
name: mdc-simulation-victim
namespace: {{ .Values.env.name }}
spec:
selector:
name: mdc-simulation-victim
clusterIP: None
13 changes: 13 additions & 0 deletions charts/mdc-simulation/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

serviceAccount:
create: true
automount: true
annotations: {}

env:
name: mdc-simulation

scenario: all

0 comments on commit 1ee30ac

Please sign in to comment.