@storm-software/k8s-tools 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +7 -0
  3. package/executors.json +9 -0
  4. package/generators.json +14 -0
  5. package/index.js +4109 -0
  6. package/meta.json +1 -0
  7. package/package.json +71 -0
  8. package/packages/build-tools/src/build/index.d.ts +3 -0
  9. package/packages/build-tools/src/build/rolldown.d.ts +20 -0
  10. package/packages/build-tools/src/build/ts-build.d.ts +20 -0
  11. package/packages/build-tools/src/build/unbuild.d.ts +20 -0
  12. package/packages/build-tools/src/cli/index.d.ts +2 -0
  13. package/packages/build-tools/src/config/browser-config.d.ts +2 -0
  14. package/packages/build-tools/src/config/default-config.d.ts +2 -0
  15. package/packages/build-tools/src/config/get-config.d.ts +2 -0
  16. package/packages/build-tools/src/config/get-rolldown-config.d.ts +6 -0
  17. package/packages/build-tools/src/config/get-unbuild-config.d.ts +6 -0
  18. package/packages/build-tools/src/config/index.d.ts +7 -0
  19. package/packages/build-tools/src/config/neutral-config.d.ts +2 -0
  20. package/packages/build-tools/src/config/node-config.d.ts +3 -0
  21. package/packages/build-tools/src/index.d.ts +6 -0
  22. package/packages/build-tools/src/plugins/analyze-plugin.d.ts +4 -0
  23. package/packages/build-tools/src/plugins/index.d.ts +4 -0
  24. package/packages/build-tools/src/plugins/swc-plugin.d.ts +2 -0
  25. package/packages/build-tools/src/plugins/ts-resolve.d.ts +6 -0
  26. package/packages/build-tools/src/plugins/type-definitions.d.ts +7 -0
  27. package/packages/build-tools/src/types.d.ts +213 -0
  28. package/packages/build-tools/src/utils/apply-default-options.d.ts +6 -0
  29. package/packages/build-tools/src/utils/generate-package-json.d.ts +7 -0
  30. package/packages/build-tools/src/utils/get-entry-points.d.ts +3 -0
  31. package/packages/build-tools/src/utils/get-file-banner.d.ts +8 -0
  32. package/packages/build-tools/src/utils/get-project-deps.d.ts +5 -0
  33. package/packages/build-tools/src/utils/index.d.ts +7 -0
  34. package/packages/build-tools/src/utils/out-extension.d.ts +8 -0
  35. package/packages/build-tools/src/utils/run-tsup-build.d.ts +3 -0
  36. package/packages/build-tools/src/utils/task-graph.d.ts +6 -0
  37. package/packages/config/src/constants.d.ts +3 -0
  38. package/packages/config/src/define-config.d.ts +174 -0
  39. package/packages/config/src/index.d.ts +12 -0
  40. package/packages/config/src/schema.d.ts +1915 -0
  41. package/packages/config/src/types.d.ts +23 -0
  42. package/packages/config-tools/src/config-file/get-config-file.d.ts +16 -0
  43. package/packages/config-tools/src/config-file/index.d.ts +1 -0
  44. package/packages/config-tools/src/create-storm-config.d.ts +26 -0
  45. package/packages/config-tools/src/env/get-env.d.ts +15 -0
  46. package/packages/config-tools/src/env/index.d.ts +2 -0
  47. package/packages/config-tools/src/env/set-env.d.ts +14 -0
  48. package/packages/config-tools/src/index.d.ts +13 -0
  49. package/packages/config-tools/src/types.d.ts +33 -0
  50. package/packages/config-tools/src/utilities/apply-workspace-tokens.d.ts +4 -0
  51. package/packages/config-tools/src/utilities/chalk.d.ts +23 -0
  52. package/packages/config-tools/src/utilities/correct-paths.d.ts +1 -0
  53. package/packages/config-tools/src/utilities/file-path-utils.d.ts +2 -0
  54. package/packages/config-tools/src/utilities/find-up.d.ts +4 -0
  55. package/packages/config-tools/src/utilities/find-workspace-root.d.ts +14 -0
  56. package/packages/config-tools/src/utilities/get-default-config.d.ts +15 -0
  57. package/packages/config-tools/src/utilities/get-log-level.d.ts +15 -0
  58. package/packages/config-tools/src/utilities/index.d.ts +10 -0
  59. package/packages/config-tools/src/utilities/logger.d.ts +74 -0
  60. package/packages/config-tools/src/utilities/process-handler.d.ts +4 -0
  61. package/packages/config-tools/src/utilities/run.d.ts +18 -0
  62. package/packages/k8s-tools/index.d.ts +1 -0
  63. package/packages/k8s-tools/src/executors/helm-package/executor.d.ts +8 -0
  64. package/packages/k8s-tools/src/executors/index.d.ts +1 -0
  65. package/packages/k8s-tools/src/generators/helm-chart/generator.d.ts +5 -0
  66. package/packages/k8s-tools/src/generators/helm-dependency/generator.d.ts +5 -0
  67. package/packages/k8s-tools/src/generators/index.d.ts +2 -0
  68. package/packages/k8s-tools/src/index.d.ts +2 -0
  69. package/packages/k8s-tools/src/types.d.ts +28 -0
  70. package/packages/k8s-tools/src/utils/client.d.ts +26 -0
  71. package/packages/k8s-tools/src/utils/ensure-init.d.ts +9 -0
  72. package/packages/k8s-tools/src/utils/prettier.d.ts +9 -0
  73. package/packages/workspace-tools/index.d.ts +32 -0
  74. package/packages/workspace-tools/src/base/base-executor.d.ts +7 -0
  75. package/packages/workspace-tools/src/base/base-generator.d.ts +4 -0
  76. package/packages/workspace-tools/src/base/index.d.ts +3 -0
  77. package/packages/workspace-tools/src/base/typescript-library-generator.d.ts +8 -0
  78. package/packages/workspace-tools/src/executors/cargo-publish/executor.d.ts +6 -0
  79. package/packages/workspace-tools/src/executors/clean-package/constants.d.ts +4 -0
  80. package/packages/workspace-tools/src/executors/clean-package/executor.d.ts +8 -0
  81. package/packages/workspace-tools/src/executors/clean-package/types.d.ts +8 -0
  82. package/packages/workspace-tools/src/executors/clean-package/utils.d.ts +4 -0
  83. package/packages/workspace-tools/src/executors/npm-publish/executor.d.ts +6 -0
  84. package/packages/workspace-tools/src/executors/rolldown/executor.d.ts +9 -0
  85. package/packages/workspace-tools/src/executors/size-limit/executor.d.ts +8 -0
  86. package/packages/workspace-tools/src/executors/tsup/executor.d.ts +8 -0
  87. package/packages/workspace-tools/src/executors/tsup-browser/executor.d.ts +8 -0
  88. package/packages/workspace-tools/src/executors/tsup-neutral/executor.d.ts +8 -0
  89. package/packages/workspace-tools/src/executors/tsup-node/executor.d.ts +8 -0
  90. package/packages/workspace-tools/src/executors/typia/executor.d.ts +8 -0
  91. package/packages/workspace-tools/src/executors/unbuild/executor.d.ts +9 -0
  92. package/packages/workspace-tools/src/generators/config-schema/generator.d.ts +13 -0
  93. package/packages/workspace-tools/src/generators/init/init.d.ts +4 -0
  94. package/packages/workspace-tools/src/generators/node-library/generator.d.ts +5 -0
  95. package/packages/workspace-tools/src/generators/preset/generator.d.ts +5 -0
  96. package/packages/workspace-tools/src/generators/release-version/generator.d.ts +13 -0
  97. package/packages/workspace-tools/src/utils/apply-workspace-tokens.d.ts +8 -0
  98. package/packages/workspace-tools/src/utils/cargo.d.ts +26 -0
  99. package/packages/workspace-tools/src/utils/create-cli-options.d.ts +1 -0
  100. package/packages/workspace-tools/src/utils/get-project-configurations.d.ts +13 -0
  101. package/packages/workspace-tools/src/utils/index.d.ts +9 -0
  102. package/packages/workspace-tools/src/utils/lock-file.d.ts +23 -0
  103. package/packages/workspace-tools/src/utils/project-tags.d.ts +30 -0
  104. package/packages/workspace-tools/src/utils/toml.d.ts +167 -0
  105. package/packages/workspace-tools/src/utils/typia-transform.d.ts +2 -0
  106. package/packages/workspace-tools/src/utils/versions.d.ts +18 -0
  107. package/src/executors/helm-package/executor.js +1244 -0
  108. package/src/executors/helm-package/schema.d.ts +29 -0
  109. package/src/executors/helm-package/schema.json +112 -0
  110. package/src/generators/helm-chart/files/chart/.helmignore +23 -0
  111. package/src/generators/helm-chart/files/chart/Chart.yaml.template +6 -0
  112. package/src/generators/helm-chart/files/chart/templates/NOTES.txt +22 -0
  113. package/src/generators/helm-chart/files/chart/templates/_helpers.yaml +62 -0
  114. package/src/generators/helm-chart/files/chart/templates/deployment.yaml +68 -0
  115. package/src/generators/helm-chart/files/chart/templates/hpa.yaml +32 -0
  116. package/src/generators/helm-chart/files/chart/templates/ingress.yaml +61 -0
  117. package/src/generators/helm-chart/files/chart/templates/service.yaml +13 -0
  118. package/src/generators/helm-chart/files/chart/templates/serviceaccount.yaml +13 -0
  119. package/src/generators/helm-chart/files/chart/templates/test/test-connection.yaml +15 -0
  120. package/src/generators/helm-chart/files/chart/values.yaml +111 -0
  121. package/src/generators/helm-chart/generator.js +131 -0
  122. package/src/generators/helm-chart/schema.d.ts +11 -0
  123. package/src/generators/helm-chart/schema.json +48 -0
  124. package/src/generators/helm-dependency/generator.js +2805 -0
  125. package/src/generators/helm-dependency/schema.d.ts +15 -0
  126. package/src/generators/helm-dependency/schema.json +71 -0
@@ -0,0 +1,29 @@
1
+ import { BaseExecutorSchema } from "@storm-software/workspace-tools";
2
+
3
+ export interface HelmPackageExecutorSchema extends BaseExecutorSchema {
4
+ /** Folder where the chart is stored */
5
+ chartFolder: string;
6
+ /** Folder to store the packaged chart */
7
+ outputFolder: string;
8
+ /** Push the chart to a remote registry */
9
+ push?: boolean;
10
+ /** Remote registry to publish the chart */
11
+ remote?: string;
12
+ /** Options related to dependencies */
13
+ dependencies?: {
14
+ /** Runs `helm dependency update` before packaging */
15
+ update?: boolean;
16
+ /** Runs `helm dependency build` before packaging */
17
+ build?: boolean;
18
+ /** List of repositories to add with `helm repo add` before packaging */
19
+ repositories?: {
20
+ /** Name of the repository */
21
+ name?: string;
22
+ /** URL of the repository */
23
+ url?: string;
24
+ [k: string]: unknown;
25
+ }[];
26
+ [k: string]: unknown;
27
+ };
28
+ [k: string]: unknown;
29
+ }
@@ -0,0 +1,112 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "version": 2,
4
+ "outputCapture": "direct-nodejs",
5
+ "title": "Helm chart package executor",
6
+ "description": "Package Helm charts associated with a project",
7
+ "type": "object",
8
+ "properties": {
9
+ "chartFolder": {
10
+ "type": "string",
11
+ "description": "Folder where the chart is stored",
12
+ "$default": {
13
+ "$source": "argv",
14
+ "index": 0
15
+ },
16
+ "default": "chart",
17
+ "x-prompt": "Provide the chart folder"
18
+ },
19
+ "outputFolder": {
20
+ "type": "string",
21
+ "description": "Folder to store the packaged chart",
22
+ "$default": {
23
+ "$source": "argv",
24
+ "index": 1
25
+ },
26
+ "default": "package",
27
+ "x-prompt": "Provide the output folder"
28
+ },
29
+ "push": {
30
+ "type": "boolean",
31
+ "description": "Push the chart to a remote registry",
32
+ "$default": {
33
+ "$source": "argv",
34
+ "index": 2
35
+ },
36
+ "x-prompt": "Provide the remote registry"
37
+ },
38
+ "remote": {
39
+ "type": "string",
40
+ "description": "Remote registry to publish the chart",
41
+ "$default": {
42
+ "$source": "argv",
43
+ "index": 3
44
+ },
45
+ "x-prompt": "Provide the remote registry"
46
+ },
47
+ "dependencies": {
48
+ "type": "object",
49
+ "description": "Options related to dependencies",
50
+ "properties": {
51
+ "update": {
52
+ "type": "boolean",
53
+ "description": "Runs `helm dependency update` before packaging",
54
+ "$default": {
55
+ "$source": "argv",
56
+ "index": 4
57
+ },
58
+ "default": false,
59
+ "x-prompt": "Update dependencies before packaging?"
60
+ },
61
+ "build": {
62
+ "type": "boolean",
63
+ "description": "Runs `helm dependency build` before packaging",
64
+ "$default": {
65
+ "$source": "argv",
66
+ "index": 5
67
+ },
68
+ "default": false,
69
+ "x-prompt": "Build dependencies before packaging?"
70
+ },
71
+ "repositories": {
72
+ "type": "array",
73
+ "description": "List of repositories to add with `helm repo add` before packaging",
74
+ "$default": {
75
+ "$source": "argv",
76
+ "index": 6
77
+ },
78
+ "items": {
79
+ "type": "object",
80
+ "description": "Repository to add",
81
+ "$default": {
82
+ "$source": "argv",
83
+ "index": 7
84
+ },
85
+ "properties": {
86
+ "name": {
87
+ "type": "string",
88
+ "description": "Name of the repository",
89
+ "$default": {
90
+ "$source": "argv",
91
+ "index": 8
92
+ },
93
+ "x-prompt": "Provide the repository name"
94
+ },
95
+ "url": {
96
+ "type": "string",
97
+ "description": "URL of the repository",
98
+ "$default": {
99
+ "$source": "argv",
100
+ "index": 9
101
+ },
102
+ "x-prompt": "Provide the repository URL"
103
+ }
104
+ }
105
+ },
106
+ "x-prompt": "Add repositories before packaging?"
107
+ }
108
+ }
109
+ }
110
+ },
111
+ "required": ["chartFolder", "outputFolder"]
112
+ }
@@ -0,0 +1,23 @@
1
+ # Patterns to ignore when building packages.
2
+ # This supports shell glob matching, relative path matching, and
3
+ # negation (prefixed with !). Only one pattern per line.
4
+ .DS_Store
5
+ # Common VCS dirs
6
+ .git/
7
+ .gitignore
8
+ .bzr/
9
+ .bzrignore
10
+ .hg/
11
+ .hgignore
12
+ .svn/
13
+ # Common backup files
14
+ *.swp
15
+ *.bak
16
+ *.tmp
17
+ *.orig
18
+ *~
19
+ # Various IDEs
20
+ .project
21
+ .idea/
22
+ *.tmproj
23
+ .vscode/
@@ -0,0 +1,6 @@
1
+ apiVersion: v2
2
+ name: <%= name %>
3
+ description: A Helm chart for Kubernetes
4
+ type: application
5
+ version: 0.1.0
6
+ appVersion: '1.16.0'
@@ -0,0 +1,22 @@
1
+ 1. Get the application URL by running these commands:
2
+ {{- if .Values.ingress.enabled }}
3
+ {{- range $host := .Values.ingress.hosts }}
4
+ {{- range .paths }}
5
+ http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
6
+ {{- end }}
7
+ {{- end }}
8
+ {{- else if contains "NodePort" .Values.service.type }}
9
+ export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "chart.fullname" . }})
10
+ export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
11
+ echo http://$NODE_IP:$NODE_PORT
12
+ {{- else if contains "LoadBalancer" .Values.service.type }}
13
+ NOTE: It may take a few minutes for the LoadBalancer IP to be available.
14
+ You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "chart.fullname" . }}'
15
+ export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "chart.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
16
+ echo http://$SERVICE_IP:{{ .Values.service.port }}
17
+ {{- else if contains "ClusterIP" .Values.service.type }}
18
+ export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "chart.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
19
+ export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
20
+ echo "Visit http://127.0.0.1:8080 to use your application"
21
+ kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
22
+ {{- end }}
@@ -0,0 +1,62 @@
1
+ {{/*
2
+ Expand the name of the chart.
3
+ */}}
4
+ {{- define "chart.name" -}}
5
+ {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6
+ {{- end }}
7
+
8
+ {{/*
9
+ Create a default fully qualified app name.
10
+ We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11
+ If release name contains chart name it will be used as a full name.
12
+ */}}
13
+ {{- define "chart.fullname" -}}
14
+ {{- if .Values.fullnameOverride }}
15
+ {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16
+ {{- else }}
17
+ {{- $name := default .Chart.Name .Values.nameOverride }}
18
+ {{- if contains $name .Release.Name }}
19
+ {{- .Release.Name | trunc 63 | trimSuffix "-" }}
20
+ {{- else }}
21
+ {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22
+ {{- end }}
23
+ {{- end }}
24
+ {{- end }}
25
+
26
+ {{/*
27
+ Create chart name and version as used by the chart label.
28
+ */}}
29
+ {{- define "chart.chart" -}}
30
+ {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31
+ {{- end }}
32
+
33
+ {{/*
34
+ Common labels
35
+ */}}
36
+ {{- define "chart.labels" -}}
37
+ helm.sh/chart: {{ include "chart.chart" . }}
38
+ {{ include "chart.selectorLabels" . }}
39
+ {{- if .Chart.AppVersion }}
40
+ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41
+ {{- end }}
42
+ app.kubernetes.io/managed-by: {{ .Release.Service }}
43
+ {{- end }}
44
+
45
+ {{/*
46
+ Selector labels
47
+ */}}
48
+ {{- define "chart.selectorLabels" -}}
49
+ app.kubernetes.io/name: {{ include "chart.name" . }}
50
+ app.kubernetes.io/instance: {{ .Release.Name }}
51
+ {{- end }}
52
+
53
+ {{/*
54
+ Create the name of the service account to use
55
+ */}}
56
+ {{- define "chart.serviceAccountName" -}}
57
+ {{- if .Values.serviceAccount.create }}
58
+ {{- default (include "chart.fullname" .) .Values.serviceAccount.name }}
59
+ {{- else }}
60
+ {{- default "default" .Values.serviceAccount.name }}
61
+ {{- end }}
62
+ {{- end }}
@@ -0,0 +1,68 @@
1
+ apiVersion: apps/v1
2
+ kind: Deployment
3
+ metadata:
4
+ name: {{ include "chart.fullname" . }}
5
+ labels:
6
+ {{- include "chart.labels" . | nindent 4 }}
7
+ spec:
8
+ {{- if not .Values.autoscaling.enabled }}
9
+ replicas: {{ .Values.replicaCount }}
10
+ {{- end }}
11
+ selector:
12
+ matchLabels:
13
+ {{- include "chart.selectorLabels" . | nindent 6 }}
14
+ template:
15
+ metadata:
16
+ {{- with .Values.podAnnotations }}
17
+ annotations:
18
+ {{- toYaml . | nindent 8 }}
19
+ {{- end }}
20
+ labels:
21
+ {{- include "chart.labels" . | nindent 8 }}
22
+ {{- with .Values.podLabels }}
23
+ {{- toYaml . | nindent 8 }}
24
+ {{- end }}
25
+ spec:
26
+ {{- with .Values.imagePullSecrets }}
27
+ imagePullSecrets:
28
+ {{- toYaml . | nindent 8 }}
29
+ {{- end }}
30
+ serviceAccountName: {{ include "chart.serviceAccountName" . }}
31
+ securityContext:
32
+ {{- toYaml .Values.podSecurityContext | nindent 8 }}
33
+ containers:
34
+ - name: {{ .Chart.Name }}
35
+ securityContext:
36
+ {{- toYaml .Values.securityContext | nindent 12 }}
37
+ image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
38
+ imagePullPolicy: {{ .Values.image.pullPolicy }}
39
+ ports:
40
+ - name: http
41
+ containerPort: {{ .Values.service.port }}
42
+ protocol: TCP
43
+ livenessProbe:
44
+ {{- toYaml .Values.livenessProbe | nindent 12 }}
45
+ readinessProbe:
46
+ {{- toYaml .Values.readinessProbe | nindent 12 }}
47
+ resources:
48
+ {{- toYaml .Values.resources | nindent 12 }}
49
+ {{- with .Values.volumeMounts }}
50
+ volumeMounts:
51
+ {{- toYaml . | nindent 12 }}
52
+ {{- end }}
53
+ {{- with .Values.volumes }}
54
+ volumes:
55
+ {{- toYaml . | nindent 8 }}
56
+ {{- end }}
57
+ {{- with .Values.nodeSelector }}
58
+ nodeSelector:
59
+ {{- toYaml . | nindent 8 }}
60
+ {{- end }}
61
+ {{- with .Values.affinity }}
62
+ affinity:
63
+ {{- toYaml . | nindent 8 }}
64
+ {{- end }}
65
+ {{- with .Values.tolerations }}
66
+ tolerations:
67
+ {{- toYaml . | nindent 8 }}
68
+ {{- end }}
@@ -0,0 +1,32 @@
1
+ {{- if .Values.autoscaling.enabled }}
2
+ apiVersion: autoscaling/v2
3
+ kind: HorizontalPodAutoscaler
4
+ metadata:
5
+ name: {{ include "chart.fullname" . }}
6
+ labels:
7
+ {{- include "chart.labels" . | nindent 4 }}
8
+ spec:
9
+ scaleTargetRef:
10
+ apiVersion: apps/v1
11
+ kind: Deployment
12
+ name: {{ include "chart.fullname" . }}
13
+ minReplicas: {{ .Values.autoscaling.minReplicas }}
14
+ maxReplicas: {{ .Values.autoscaling.maxReplicas }}
15
+ metrics:
16
+ {{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
17
+ - type: Resource
18
+ resource:
19
+ name: cpu
20
+ target:
21
+ type: Utilization
22
+ averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
23
+ {{- end }}
24
+ {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
25
+ - type: Resource
26
+ resource:
27
+ name: memory
28
+ target:
29
+ type: Utilization
30
+ averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
31
+ {{- end }}
32
+ {{- end }}
@@ -0,0 +1,61 @@
1
+ {{- if .Values.ingress.enabled -}}
2
+ {{- $fullName := include "chart.fullname" . -}}
3
+ {{- $svcPort := .Values.service.port -}}
4
+ {{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
5
+ {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
6
+ {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
7
+ {{- end }}
8
+ {{- end }}
9
+ {{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
10
+ apiVersion: networking.k8s.io/v1
11
+ {{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
12
+ apiVersion: networking.k8s.io/v1beta1
13
+ {{- else -}}
14
+ apiVersion: extensions/v1beta1
15
+ {{- end }}
16
+ kind: Ingress
17
+ metadata:
18
+ name: {{ $fullName }}
19
+ labels:
20
+ {{- include "chart.labels" . | nindent 4 }}
21
+ {{- with .Values.ingress.annotations }}
22
+ annotations:
23
+ {{- toYaml . | nindent 4 }}
24
+ {{- end }}
25
+ spec:
26
+ {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
27
+ ingressClassName: {{ .Values.ingress.className }}
28
+ {{- end }}
29
+ {{- if .Values.ingress.tls }}
30
+ tls:
31
+ {{- range .Values.ingress.tls }}
32
+ - hosts:
33
+ {{- range .hosts }}
34
+ - {{ . | quote }}
35
+ {{- end }}
36
+ secretName: {{ .secretName }}
37
+ {{- end }}
38
+ {{- end }}
39
+ rules:
40
+ {{- range .Values.ingress.hosts }}
41
+ - host: {{ .host | quote }}
42
+ http:
43
+ paths:
44
+ {{- range .paths }}
45
+ - path: {{ .path }}
46
+ {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
47
+ pathType: {{ .pathType }}
48
+ {{- end }}
49
+ backend:
50
+ {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
51
+ service:
52
+ name: {{ $fullName }}
53
+ port:
54
+ number: {{ $svcPort }}
55
+ {{- else }}
56
+ serviceName: {{ $fullName }}
57
+ servicePort: {{ $svcPort }}
58
+ {{- end }}
59
+ {{- end }}
60
+ {{- end }}
61
+ {{- end }}
@@ -0,0 +1,13 @@
1
+ apiVersion: v1
2
+ kind: Service
3
+ metadata:
4
+ name: { { include "chart.fullname" . } }
5
+ labels: { { - include "chart.labels" . | nindent 4 } }
6
+ spec:
7
+ type: { { .Values.service.type } }
8
+ ports:
9
+ - port: { { .Values.service.port } }
10
+ targetPort: http
11
+ protocol: TCP
12
+ name: http
13
+ selector: { { - include "chart.selectorLabels" . | nindent 4 } }
@@ -0,0 +1,13 @@
1
+ {{- if .Values.serviceAccount.create -}}
2
+ apiVersion: v1
3
+ kind: ServiceAccount
4
+ metadata:
5
+ name: {{ include "chart.serviceAccountName" . }}
6
+ labels:
7
+ {{- include "chart.labels" . | nindent 4 }}
8
+ {{- with .Values.serviceAccount.annotations }}
9
+ annotations:
10
+ {{- toYaml . | nindent 4 }}
11
+ {{- end }}
12
+ automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
13
+ {{- end }}
@@ -0,0 +1,15 @@
1
+ apiVersion: v1
2
+ kind: Pod
3
+ metadata:
4
+ name: "{{ include "chart.fullname" . }}-test-connection"
5
+ labels:
6
+ {{- include "chart.labels" . | nindent 4 }}
7
+ annotations:
8
+ "helm.sh/hook": test
9
+ spec:
10
+ containers:
11
+ - name: wget
12
+ image: busybox
13
+ command: ['wget']
14
+ args: ['{{ include "chart.fullname" . }}:{{ .Values.service.port }}']
15
+ restartPolicy: Never
@@ -0,0 +1,111 @@
1
+ # Default values for chart.
2
+ # This is a YAML-formatted file.
3
+ # Declare variables to be passed into your templates.
4
+
5
+ replicaCount: 1
6
+
7
+ image:
8
+ repository: nginx
9
+ pullPolicy: IfNotPresent
10
+ # Overrides the image tag whose default is the chart appVersion.
11
+ tag: ""
12
+
13
+ imagePullSecrets: []
14
+ nameOverride: ""
15
+ fullnameOverride: ""
16
+
17
+ serviceAccount:
18
+ # Specifies whether a service account should be created
19
+ create: true
20
+ # Automatically mount a ServiceAccount's API credentials?
21
+ automount: true
22
+ # Annotations to add to the service account
23
+ annotations: {}
24
+ # The name of the service account to use.
25
+ # If not set and create is true, a name is generated using the fullname template
26
+ name: ""
27
+
28
+ podAnnotations: {}
29
+ podLabels: {}
30
+
31
+ podSecurityContext:
32
+ {}
33
+ # fsGroup: 2000
34
+
35
+ securityContext:
36
+ {}
37
+ # capabilities:
38
+ # drop:
39
+ # - ALL
40
+ # readOnlyRootFilesystem: true
41
+ # runAsNonRoot: true
42
+ # runAsUser: 1000
43
+
44
+ service:
45
+ type: ClusterIP
46
+ port: 80
47
+
48
+ ingress:
49
+ enabled: false
50
+ className: ""
51
+ annotations:
52
+ {}
53
+ # kubernetes.io/ingress.class: nginx
54
+ # kubernetes.io/tls-acme: "true"
55
+ hosts:
56
+ - host: chart-example.local
57
+ paths:
58
+ - path: /
59
+ pathType: ImplementationSpecific
60
+ tls: []
61
+ # - secretName: chart-example-tls
62
+ # hosts:
63
+ # - chart-example.local
64
+
65
+ resources:
66
+ {}
67
+ # We usually recommend not to specify default resources and to leave this as a conscious
68
+ # choice for the user. This also increases chances charts run on environments with little
69
+ # resources, such as Minikube. If you do want to specify resources, uncomment the following
70
+ # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
71
+ # limits:
72
+ # cpu: 100m
73
+ # memory: 128Mi
74
+ # requests:
75
+ # cpu: 100m
76
+ # memory: 128Mi
77
+
78
+ livenessProbe:
79
+ httpGet:
80
+ path: /
81
+ port: http
82
+ readinessProbe:
83
+ httpGet:
84
+ path: /
85
+ port: http
86
+
87
+ autoscaling:
88
+ enabled: false
89
+ minReplicas: 1
90
+ maxReplicas: 100
91
+ targetCPUUtilizationPercentage: 80
92
+ # targetMemoryUtilizationPercentage: 80
93
+
94
+ # Additional volumes on the output Deployment definition.
95
+ volumes: []
96
+ # - name: foo
97
+ # secret:
98
+ # secretName: mysecret
99
+ # optional: false
100
+
101
+ # Additional volumeMounts on the output Deployment definition.
102
+ volumeMounts: []
103
+ # - name: foo
104
+ # mountPath: "/etc/foo"
105
+ # readOnly: true
106
+
107
+ nodeSelector: {}
108
+
109
+ tolerations: []
110
+
111
+ affinity: {}