Skip to content

Commit

Permalink
charts: initinal release for harvester-networkfs-manager
Browse files Browse the repository at this point in the history
Signed-off-by: Vicente Cheng <[email protected]>
  • Loading branch information
Vicente-Cheng committed Sep 4, 2024
1 parent 08dc8da commit 091519d
Show file tree
Hide file tree
Showing 8 changed files with 460 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/harvester-networkfs-manager/.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/
27 changes: 27 additions & 0 deletions charts/harvester-networkfs-manager/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v2
name: harvester-networkfs-manager
description: A Helm chart for Harvester Network Filesystem Manager

# 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.1.0

# 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.1.0"

maintainers:
- name: harvester
1 change: 1 addition & 0 deletions charts/harvester-networkfs-manager/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The harvester-networkfs-manager has been installed into "{{ .Release.Namespace }}" namespace.
62 changes: 62 additions & 0 deletions charts/harvester-networkfs-manager/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "harvester-networkfs-manager.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 "harvester-networkfs-manager.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 "harvester-networkfs-manager.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "harvester-networkfs-manager.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "harvester-networkfs-manager.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
{}
name: networkfilesystems.harvesterhci.io
spec:
group: harvesterhci.io
names:
kind: NetworkFilesystem
listKind: NetworkFilesystemList
plural: networkfilesystems
shortNames:
- netfilesystem
- netfilesystems
singular: networkfilesystem
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .spec.desiredState
name: DesiredState
type: string
- jsonPath: .status.endpoint
name: Endpoint
type: string
- jsonPath: .status.status
name: EndpointStatus
type: string
- jsonPath: .status.state
name: State
type: string
- jsonPath: .status.type
name: Type
type: string
name: v1beta1
schema:
openAPIV3Schema:
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
properties:
desiredState:
description: desired state of the networkFS endpoint, options are
"Disabled", "Enabling", "Enabled", "Disabling", or "Unknown"
type: string
networkFSName:
description: name of the networkFS to which the endpoint is exported
type: string
perferredNodes:
description: perferred nodes to which the networkFS endpoint is exported
type: string
provisioner:
description: the provider of this networkfilesystem
type: string
required:
- desiredState
- networkFSName
type: object
status:
properties:
conditions:
default: []
description: the conditions of the networkFS
items:
properties:
lastTransitionTime:
format: date-time
type: string
message:
type: string
reason:
type: string
status:
type: string
type:
type: string
required:
- lastTransitionTime
- status
- type
type: object
type: array
endpoint:
default: ""
description: the current Endpoint of the networkFS
type: string
mountOpts:
description: the recommend mount options for the networkFS endpoint
type: string
state:
default: Disabled
description: the current state of the networkFS endpoint, options
are "Enabled", "Enabling", "Disabling", "Disabled", or "Unknown"
enum:
- Enabled
- Enabling
- Disabling
- Disabled
- Unknown
type: string
status:
default: NotReady
description: the status of the endpoint
enum:
- Ready
- NotReady
- Reconciling
- Unknown
type: string
type:
default: NFS
description: the type of the networkFS endpoint, options are "NFS",
or "Unknown"
enum:
- NFS
- Unknown
type: string
required:
- endpoint
- state
- status
- type
type: object
required:
- spec
type: object
served: true
storage: true
subresources:
status: {}
113 changes: 113 additions & 0 deletions charts/harvester-networkfs-manager/templates/daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ include "harvester-networkfs-manager.name" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "harvester-networkfs-manager.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "harvester-networkfs-manager.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "harvester-networkfs-manager.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "harvester-networkfs-manager.name" . }}
hostNetwork: true
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- networkfs-manager
{{- if .Values.debug }}
- "--debug"
{{- end }}
env:
{{- with .Values.vendorFilter }}
- name: NDM_VENDOR_FILTER
value: {{ . | join "," | quote }}
{{- end }}
{{- with .Values.pathFilter }}
- name: NDM_PATH_FILTER
value: {{ . | join "," | quote }}
{{- end }}
{{- with .Values.labelFilter }}
- name: NDM_LABEL_FILTER
value: {{ . | join "," | quote }}
{{- end }}
{{- with .Values.autoProvisionFilter }}
- name: NDM_AUTO_PROVISION_FILTER
value: {{ . | join "," | quote }}
{{- end }}
{{- with .Values.maxConcurrentOps }}
- name: NDM_MAX_CONCURRENT_OPS
value: {{ . | quote }}
{{- end }}
{{- with .Values.autoGPTGenerate }}
- name: NDM_AUTO_GPT_GENERATE
value: {{ . | quote }}
{{- end }}
- name: LONGHORN_NAMESPACE
value: {{ .Values.longhornNamespace | default "longhorn-system" }}
- name: NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
securityContext:
privileged: true
volumeMounts:
- mountPath: /host/proc # To access dockerd/containerd mount namespace
name: host-proc
readOnly: true
- mountPath: /run/udev # To receive udev events
name: host-run-udev
readOnly: true
- mountPath: /dev # To get host device info
name: host-dev
readOnly: true
- mountPath: /sys # To get host sysfs info
name: host-sys
readOnly: true
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: host-proc
hostPath:
path: /proc
type: Directory
- name: host-run-udev
hostPath:
path: /run/udev
type: Directory
- name: host-dev
hostPath:
path: /dev
type: Directory
- name: host-sys
hostPath:
path: /sys
type: Directory
Loading

0 comments on commit 091519d

Please sign in to comment.