Skip to content

Commit

Permalink
Merge pull request #35 from media-streaming-mesh/crds
Browse files Browse the repository at this point in the history
Crds
  • Loading branch information
cnguyen44 authored Jul 12, 2023
2 parents aaebbf7 + 60df054 commit 5b7e511
Show file tree
Hide file tree
Showing 18 changed files with 664 additions and 4 deletions.
23 changes: 23 additions & 0 deletions deployments/crds/.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/
21 changes: 21 additions & 0 deletions deployments/crds/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v2
name: crds
description: A Helm chart for msm-crd
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.0.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.0.1"
80 changes: 80 additions & 0 deletions deployments/crds/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# crds

![version: 0.0.1](https://img.shields.io/badge/version-0.0.1-informational?style=flat-square) ![type: application](https://img.shields.io/badge/type-application-informational?style=flat-square) ![app version: 0.0.1](https://img.shields.io/badge/app%20version-0.0.1-informational?style=flat-square) [![artifact hub](https://img.shields.io/badge/artifact%20hub-crds-informational?style=flat-square)](https://artifacthub.io/packages/helm/media-streaming-mesh/crds)

A Helm chart for msm-crd

## TL;DR;

```bash
helm repo add msm https://charts.mediastreamingmesh.dev
helm install --generate-name --wait msm/crds
```

## Prerequisites

Before deploying the crds app on the node, ensure that you have the following prerequisites:

* You will need to have access to a Kubernetes cluster<br>
* [Helm](https://helm.sh) must be installed to use these charts<br>

## Manual Install

To get started, clone the msm-deployments repository and navigate to the ```crds``` directory.

```sh
git clone https://github.com/media-streaming-mesh/msm-deployments.git
cd msm-deployments/deployments/crds
```

Before installing the crds app onto the node, make sure to change the value ```kubernetesDistro``` under ```values.yaml``` file as per your needs. <br>
e.g. <br>
```kubernetesDistro: "K8S"```

```helm install <YOUR_APP_NAME> ./ --values ./values.yaml```

## Usage
Verify everything is in Running state on your Kubernetes Cluster

```kubectl get pods -A```

or

```kubectl get all```

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| controllerManager.kubeRbacProxy.args[0] | string | `"--secure-listen-address=0.0.0.0:8443"` | |
| controllerManager.kubeRbacProxy.args[1] | string | `"--upstream=http://127.0.0.1:8080/"` | |
| controllerManager.kubeRbacProxy.args[2] | string | `"--logtostderr=true"` | |
| controllerManager.kubeRbacProxy.args[3] | string | `"--v=0"` | |
| controllerManager.kubeRbacProxy.containerSecurityContext.allowPrivilegeEscalation | bool | `false` | |
| controllerManager.kubeRbacProxy.containerSecurityContext.capabilities.drop[0] | string | `"ALL"` | |
| controllerManager.kubeRbacProxy.image.repository | string | `"gcr.io/kubebuilder/kube-rbac-proxy"` | |
| controllerManager.kubeRbacProxy.image.tag | string | `"v0.14.1"` | |
| controllerManager.kubeRbacProxy.resources.limits.cpu | string | `"500m"` | |
| controllerManager.kubeRbacProxy.resources.limits.memory | string | `"128Mi"` | |
| controllerManager.kubeRbacProxy.resources.requests.cpu | string | `"5m"` | |
| controllerManager.kubeRbacProxy.resources.requests.memory | string | `"64Mi"` | |
| controllerManager.manager.args[0] | string | `"--health-probe-bind-address=:8081"` | |
| controllerManager.manager.args[1] | string | `"--metrics-bind-address=127.0.0.1:8080"` | |
| controllerManager.manager.args[2] | string | `"--leader-elect"` | |
| controllerManager.manager.containerSecurityContext.allowPrivilegeEscalation | bool | `false` | |
| controllerManager.manager.containerSecurityContext.capabilities.drop[0] | string | `"ALL"` | |
| controllerManager.manager.image.repository | string | `"ciscolabs/msm-nc"` | |
| controllerManager.manager.image.tag | string | `"07102023"` | |
| controllerManager.manager.imagePullPolicy | string | `"IfNotPresent"` | |
| controllerManager.manager.resources.limits.cpu | string | `"500m"` | |
| controllerManager.manager.resources.limits.memory | string | `"128Mi"` | |
| controllerManager.manager.resources.requests.cpu | string | `"10m"` | |
| controllerManager.manager.resources.requests.memory | string | `"64Mi"` | |
| controllerManager.replicas | int | `1` | |
| controllerManager.serviceAccount.annotations | object | `{}` | |
| kubernetesClusterDomain | string | `"cluster.local"` | |
| metricsService.ports[0].name | string | `"https"` | |
| metricsService.ports[0].port | int | `8443` | |
| metricsService.ports[0].protocol | string | `"TCP"` | |
| metricsService.ports[0].targetPort | string | `"https"` | |
| metricsService.type | string | `"ClusterIP"` | |
1 change: 1 addition & 0 deletions deployments/crds/README.md.gotmpl
55 changes: 55 additions & 0 deletions deployments/crds/gbear/appmetadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
displayName: MSM-crds
description: Media Streaming Mesh CRDs
# The following optional fields provide a more detailed properties to describe your GBAP.
# Uncomment as required and modify field values specifically for your application.

# Specify whether the application should be deployed once per great bear site (defaults to false if not explicitly defined)
singleton: true

# A dictionary (key-values) to label applications to handle specially like kind: EXAMPLE These should be explicit attributes.
#labels:
# kind: EXAMPLE

# A list of tags used by the Great Bear application store to present applications such as e.g the private attribute.
#tags:
# - example-apps
# - blog

# A list of architectures supported like [amd64, arm64v8]
#architectures:
# - amd64

# A path/URL of icon to use in the app store
icon: https://www.mediastreamingmesh.io/assets/shared/logos/logo-dark-horizontal-svg.svg

# A list of configuration fields that are provided as run-time values of the Helm deployment.
#configuration:
# - name: outputMessage # The name of the field.
# key: application.message # A dot-separated name where the value of this field will be added to the Helm values. Like postgres.image.tag. Defaults to config.{name} (current behavior).
# title: Output message # The label of the parameter to be displayed on the Great Bear dashboard when deploying the application.
# description: Message sent to the user # The description of the parameter to be displayed on the Great Bear dashboard when deploying the application.
# value: Hello World # The default value of the parameter
# type: String # A simple string, rendered as a textbox
# - name: password
# key: application.password
# title: Initial password
# type: Secret # A string, rendered as a password input.
# - nodeport
# key: service.nodePorts.https
# type: NodePort # A port number in the 30000-32767 range.
# title: Node port to serve HTTPS on
# value: 37777
# - name: sitename
# key: application.mySite
# type: Runtime # An injected variable via Go Templating performed on the value of this field. Field is not shown on the UI.
# value: This application is running in {{.GB_SITE_ID}} # This value will be substituted by GB when the application is deployed to the edge
# - name: forceLoginToggle
# key: application.forceLogin
# choices: [yes, no] # UI renders the parameter as a toggle switch, the UI will recognise the [yes, no] options as a toggle switch.
# value: yes # Dashboard will display a toggle switch in the enabled position
# - name: applicationTextColor
# key: application.textColor
# choices: [black, red, blue] # UI renders the parameter as a dropdown list, containing the specified values.
# value: red # Dashboard will display a dropdown list with specified value 'red' as the default


62 changes: 62 additions & 0 deletions deployments/crds/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "msm.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 "msm.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 "msm.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "msm.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "msm.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
70 changes: 70 additions & 0 deletions deployments/crds/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "msm.fullname" . }}-controller-manager
labels:
app.kubernetes.io/component: manager
app.kubernetes.io/created-by: msm-nc
app.kubernetes.io/part-of: msm-nc
control-plane: controller-manager
{{- include "msm.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.controllerManager.replicas }}
selector:
matchLabels:
control-plane: controller-manager
{{- include "msm.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
control-plane: controller-manager
{{- include "msm.selectorLabels" . | nindent 8 }}
annotations:
kubectl.kubernetes.io/default-container: manager
spec:
containers:
- args: {{- toYaml .Values.controllerManager.kubeRbacProxy.args | nindent 8 }}
env:
- name: KUBERNETES_CLUSTER_DOMAIN
value: {{ quote .Values.kubernetesClusterDomain }}
image: {{ .Values.controllerManager.kubeRbacProxy.image.repository }}:{{ .Values.controllerManager.kubeRbacProxy.image.tag
| default .Chart.AppVersion }}
name: kube-rbac-proxy
ports:
- containerPort: 8443
name: https
protocol: TCP
resources: {{- toYaml .Values.controllerManager.kubeRbacProxy.resources | nindent
10 }}
securityContext: {{- toYaml .Values.controllerManager.kubeRbacProxy.containerSecurityContext
| nindent 10 }}
- args: {{- toYaml .Values.controllerManager.manager.args | nindent 8 }}
command:
- /manager
env:
- name: KUBERNETES_CLUSTER_DOMAIN
value: {{ quote .Values.kubernetesClusterDomain }}
image: {{ .Values.controllerManager.manager.image.repository }}:{{ .Values.controllerManager.manager.image.tag
| default .Chart.AppVersion }}
imagePullPolicy: {{ .Values.controllerManager.manager.imagePullPolicy }}
livenessProbe:
httpGet:
path: /healthz
port: 8081
initialDelaySeconds: 15
periodSeconds: 20
name: manager
readinessProbe:
httpGet:
path: /readyz
port: 8081
initialDelaySeconds: 5
periodSeconds: 10
resources: {{- toYaml .Values.controllerManager.manager.resources | nindent 10
}}
securityContext: {{- toYaml .Values.controllerManager.manager.containerSecurityContext
| nindent 10 }}
securityContext:
runAsNonRoot: false
serviceAccountName: {{ include "msm.fullname" . }}-controller-manager
terminationGracePeriodSeconds: 10
59 changes: 59 additions & 0 deletions deployments/crds/templates/leader-election-rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "msm.fullname" . }}-leader-election-role
labels:
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: msm-nc
app.kubernetes.io/part-of: msm-nc
{{- include "msm.labels" . | nindent 4 }}
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "msm.fullname" . }}-leader-election-rolebinding
labels:
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: msm-nc
app.kubernetes.io/part-of: msm-nc
{{- include "msm.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: '{{ include "msm.fullname" . }}-leader-election-role'
subjects:
- kind: ServiceAccount
name: '{{ include "msm.fullname" . }}-controller-manager'
namespace: '{{ .Release.Namespace }}'
Loading

0 comments on commit 5b7e511

Please sign in to comment.