From 990abf4d26657366d0627574ea23f48a7af10c35 Mon Sep 17 00:00:00 2001 From: Marius Ensrud Date: Wed, 19 Aug 2020 13:06:04 +0200 Subject: [PATCH] add airprint --- charts/cups-airprint-0.1.0.tgz | Bin 0 -> 3590 bytes charts/cups-airprint/.helmignore | 23 +++++ charts/cups-airprint/Chart.yaml | 23 +++++ charts/cups-airprint/templates/NOTES.txt | 21 +++++ charts/cups-airprint/templates/_helpers.tpl | 62 ++++++++++++++ .../cups-airprint/templates/deployment.yaml | 61 +++++++++++++ charts/cups-airprint/templates/hpa.yaml | 28 ++++++ charts/cups-airprint/templates/ingress.yaml | 41 +++++++++ charts/cups-airprint/templates/service.yaml | 15 ++++ .../templates/serviceaccount.yaml | 12 +++ .../templates/tests/test-connection.yaml | 15 ++++ charts/cups-airprint/values.yaml | 80 ++++++++++++++++++ charts/index.yaml | 14 +++ 13 files changed, 395 insertions(+) create mode 100644 charts/cups-airprint-0.1.0.tgz create mode 100644 charts/cups-airprint/.helmignore create mode 100644 charts/cups-airprint/Chart.yaml create mode 100644 charts/cups-airprint/templates/NOTES.txt create mode 100644 charts/cups-airprint/templates/_helpers.tpl create mode 100644 charts/cups-airprint/templates/deployment.yaml create mode 100644 charts/cups-airprint/templates/hpa.yaml create mode 100644 charts/cups-airprint/templates/ingress.yaml create mode 100644 charts/cups-airprint/templates/service.yaml create mode 100644 charts/cups-airprint/templates/serviceaccount.yaml create mode 100644 charts/cups-airprint/templates/tests/test-connection.yaml create mode 100644 charts/cups-airprint/values.yaml create mode 100644 charts/index.yaml diff --git a/charts/cups-airprint-0.1.0.tgz b/charts/cups-airprint-0.1.0.tgz new file mode 100644 index 0000000000000000000000000000000000000000..35e6a32edde855c999f38630d403253537d58ba1 GIT binary patch literal 3590 zcmV+h4*BsPiwG0|00000|0w_~VMtOiV@ORlOnEsqVl!4SWK%V1T2nbTPgYhoO;>Dc zVQyr3R8em|NM&qo0PH;dZ`-(%{aJs-oYIGWTrJB+`92_4XJb>^niC8ysrH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?RS3vvp?A1)&K8jtW@ivNLJ{wzpeA{b&idHCpx{PqJG(mHWlL1kHD^~@;Em4 z^D=tqmR`#$;?)Fovlbn}C|C25xUNdJ_P0(E{PM_vKKiw+Ov#BdFSnJ&EkAUyI3=3% zr^^EAInGetry*(Ue_%vPCtOIp!!xFA;4`tTuqU~ zD5or;d;%GXFUbT|^&df~JhKrus3|fA6DCHkXNL00GmyxLrZcp;jmCSz6K@YVPTVgH zA7>KB^coZAsQ=?h0Pi@PgWz_iAqg^+_D9Wu7reUoe4&LzZx4#r)la7vkWi_-U_y1@ z{_Dv1g3%wcZ~rY{OecNwPx(>Jc)vz8BJpLO+5gHyc~1j%m3dEt5xMl920As*Leh!% z^#8m)_(UWXxq`D-uay^MQv8Oo_5zw9={s;Ke)EEvibaC`zhywM8@sU^|2E_Q0{{U3 M|EQULQ~*u@06LuSvj6}9 literal 0 HcmV?d00001 diff --git a/charts/cups-airprint/.helmignore b/charts/cups-airprint/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/cups-airprint/.helmignore @@ -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/ diff --git a/charts/cups-airprint/Chart.yaml b/charts/cups-airprint/Chart.yaml new file mode 100644 index 0000000..43cf05e --- /dev/null +++ b/charts/cups-airprint/Chart.yaml @@ -0,0 +1,23 @@ +apiVersion: v2 +name: cups-airprint +description: Airprint using CUPS + +# 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. +appVersion: 1.16.0 diff --git a/charts/cups-airprint/templates/NOTES.txt b/charts/cups-airprint/templates/NOTES.txt new file mode 100644 index 0000000..3469451 --- /dev/null +++ b/charts/cups-airprint/templates/NOTES.txt @@ -0,0 +1,21 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "cups-airprint.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "cups-airprint.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "cups-airprint.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "cups-airprint.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/charts/cups-airprint/templates/_helpers.tpl b/charts/cups-airprint/templates/_helpers.tpl new file mode 100644 index 0000000..a03289e --- /dev/null +++ b/charts/cups-airprint/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "cups-airprint.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 "cups-airprint.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 "cups-airprint.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "cups-airprint.labels" -}} +helm.sh/chart: {{ include "cups-airprint.chart" . }} +{{ include "cups-airprint.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "cups-airprint.selectorLabels" -}} +app.kubernetes.io/name: {{ include "cups-airprint.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "cups-airprint.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "cups-airprint.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/cups-airprint/templates/deployment.yaml b/charts/cups-airprint/templates/deployment.yaml new file mode 100644 index 0000000..da44057 --- /dev/null +++ b/charts/cups-airprint/templates/deployment.yaml @@ -0,0 +1,61 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "cups-airprint.fullname" . }} + labels: + {{- include "cups-airprint.labels" . | nindent 4 }} +spec: +{{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} +{{- end }} + selector: + matchLabels: + {{- include "cups-airprint.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "cups-airprint.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "cups-airprint.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 631 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + 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 }} diff --git a/charts/cups-airprint/templates/hpa.yaml b/charts/cups-airprint/templates/hpa.yaml new file mode 100644 index 0000000..8d756a1 --- /dev/null +++ b/charts/cups-airprint/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "cups-airprint.fullname" . }} + labels: + {{- include "cups-airprint.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "cups-airprint.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/cups-airprint/templates/ingress.yaml b/charts/cups-airprint/templates/ingress.yaml new file mode 100644 index 0000000..d1534fe --- /dev/null +++ b/charts/cups-airprint/templates/ingress.yaml @@ -0,0 +1,41 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "cups-airprint.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "cups-airprint.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ . }} + backend: + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} diff --git a/charts/cups-airprint/templates/service.yaml b/charts/cups-airprint/templates/service.yaml new file mode 100644 index 0000000..45ae4c4 --- /dev/null +++ b/charts/cups-airprint/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "cups-airprint.fullname" . }} + labels: + {{- include "cups-airprint.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "cups-airprint.selectorLabels" . | nindent 4 }} diff --git a/charts/cups-airprint/templates/serviceaccount.yaml b/charts/cups-airprint/templates/serviceaccount.yaml new file mode 100644 index 0000000..b50c038 --- /dev/null +++ b/charts/cups-airprint/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "cups-airprint.serviceAccountName" . }} + labels: + {{- include "cups-airprint.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/cups-airprint/templates/tests/test-connection.yaml b/charts/cups-airprint/templates/tests/test-connection.yaml new file mode 100644 index 0000000..e93396e --- /dev/null +++ b/charts/cups-airprint/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "cups-airprint.fullname" . }}-test-connection" + labels: + {{- include "cups-airprint.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test-success +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "cups-airprint.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/charts/cups-airprint/values.yaml b/charts/cups-airprint/values.yaml new file mode 100644 index 0000000..e48108b --- /dev/null +++ b/charts/cups-airprint/values.yaml @@ -0,0 +1,80 @@ +# Default values for cups-airprint. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + registry: registry.bassengvegen.com + repository: cups-airprint + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: latest + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: false + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 631 + +ingress: + enabled: false + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: [] + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/index.yaml b/charts/index.yaml new file mode 100644 index 0000000..1ab4e84 --- /dev/null +++ b/charts/index.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +entries: + cups-airprint: + - apiVersion: v2 + appVersion: 1.16.0 + created: "2020-08-19T12:40:59.637841+02:00" + description: Airprint using CUPS + digest: 048ed7deacc28c566a9e3f45cd7d72c23b1f98ea50656ebdd1f1cb491e7f6ed9 + name: cups-airprint + type: application + urls: + - https://helm.dyn.bassengvegen.com/cups-airprint-0.1.0.tgz + version: 0.1.0 +generated: "2020-08-19T12:40:59.637143+02:00"