Skip to content

Commit 7c2b89e

Browse files
committed
feat: add helm image, new make commands, update docker file
1 parent b62cc41 commit 7c2b89e

36 files changed

+835
-26
lines changed

charts/elasti/.helmignore

+23
Original file line numberDiff line numberDiff line change
@@ -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/

charts/elasti/Chart.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: v2
2+
name: elasti
3+
description: A Helm chart for Elasti tool. Elasti is used for auto-scaling Kubernetes services based on incoming requests.
4+
# A chart can be either an 'application' or a 'library' chart.
5+
#
6+
# Application charts are a collection of templates that can be packaged into versioned archives
7+
# to be deployed.
8+
#
9+
# Library charts provide useful utilities or functions for the chart developer. They're included as
10+
# a dependency of application charts to inject those utilities and functions into the rendering
11+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
12+
type: application
13+
# This is the chart version. This version number should be incremented each time you make changes
14+
# to the chart and its templates, including the app version.
15+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
16+
version: 0.1.0
17+
# This is the version number of the application being deployed. This version number should be
18+
# incremented each time you make changes to the application. Versions are not expected to
19+
# follow Semantic Versioning. They should reflect the version the application is using.
20+
# It is recommended to use it with quotes.
21+
appVersion: "0.1.0"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
name: {{ include "elasti.fullname" . }}-EDS-access-binding
5+
labels:
6+
{{- include "elasti.labels" . | nindent 4 }}
7+
roleRef:
8+
apiGroup: rbac.authorization.k8s.io
9+
kind: ClusterRole
10+
name: '{{ include "elasti.fullname" . }}-EDS-access'
11+
subjects:
12+
- kind: ServiceAccount
13+
name: '{{ include "elasti.fullname" . }}-controller-manager'
14+
namespace: '{{ .Release.Namespace }}'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
name: {{ include "elasti.fullname" . }}-EDS-access
5+
labels:
6+
{{- include "elasti.labels" . | nindent 4 }}
7+
rules:
8+
- apiGroups:
9+
- apps
10+
resources:
11+
- deployments
12+
verbs:
13+
- get
14+
- list
15+
- watch
16+
- apiGroups:
17+
- discovery.k8s.io
18+
resources:
19+
- endpointslices
20+
verbs:
21+
- get
22+
- list
23+
- watch
24+
- update
25+
- patch
26+
- delete
27+
- create
28+
- apiGroups:
29+
- ""
30+
resources:
31+
- services
32+
verbs:
33+
- get
34+
- list
35+
- watch
36+
- update
37+
- patch
38+
- delete
39+
- create

charts/elasti/templates/_helpers.tpl

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "elasti.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 "elasti.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 "elasti.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "elasti.labels" -}}
37+
helm.sh/chart: {{ include "elasti.chart" . }}
38+
{{ include "elasti.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 "elasti.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "elasti.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 "elasti.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "elasti.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
name: {{ include "elasti.fullname" . }}-apiserver-node-access-binding
5+
labels:
6+
{{- include "elasti.labels" . | nindent 4 }}
7+
roleRef:
8+
apiGroup: rbac.authorization.k8s.io
9+
kind: ClusterRole
10+
name: '{{ include "elasti.fullname" . }}-apiserver-node-access'
11+
subjects:
12+
- apiGroup: rbac.authorization.k8s.io
13+
kind: User
14+
name: kube-apiserver-kubelet-client
15+
namespace: '{{ .Release.Namespace }}'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
name: {{ include "elasti.fullname" . }}-apiserver-node-access
5+
labels:
6+
{{- include "elasti.labels" . | nindent 4 }}
7+
rules:
8+
- apiGroups:
9+
- ""
10+
resources:
11+
- nodes
12+
verbs:
13+
- get
14+
- list
15+
- watch
16+
- apiGroups:
17+
- ""
18+
resources:
19+
- nodes/proxy
20+
verbs:
21+
- get
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "elasti.fullname" . }}-controller-service
5+
labels:
6+
control-plane: controller-manager
7+
{{- include "elasti.labels" . | nindent 4 }}
8+
spec:
9+
type: {{ .Values.controllerService.type }}
10+
selector:
11+
control-plane: controller-manager
12+
{{- include "elasti.selectorLabels" . | nindent 4 }}
13+
ports:
14+
{{- .Values.controllerService.ports | toYaml | nindent 2 }}
+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "elasti.fullname" . }}-controller-manager
5+
labels:
6+
control-plane: controller-manager
7+
{{- include "elasti.labels" . | nindent 4 }}
8+
spec:
9+
replicas: {{ .Values.controllerManager.replicas }}
10+
selector:
11+
matchLabels:
12+
control-plane: controller-manager
13+
{{- include "elasti.selectorLabels" . | nindent 6 }}
14+
template:
15+
metadata:
16+
labels:
17+
control-plane: controller-manager
18+
{{- include "elasti.selectorLabels" . | nindent 8 }}
19+
annotations:
20+
kubectl.kubernetes.io/default-container: manager
21+
spec:
22+
containers:
23+
- args: {{- toYaml .Values.controllerManager.manager.args | nindent 8 }}
24+
command:
25+
- /manager
26+
env:
27+
- name: KUBERNETES_CLUSTER_DOMAIN
28+
value: {{ quote .Values.kubernetesClusterDomain }}
29+
image: {{ .Values.controllerManager.manager.image.repository }}:{{ .Values.controllerManager.manager.image.tag
30+
| default .Chart.AppVersion }}
31+
livenessProbe:
32+
httpGet:
33+
path: /healthz
34+
port: 8081
35+
initialDelaySeconds: 15
36+
periodSeconds: 20
37+
name: manager
38+
ports:
39+
- containerPort: 8013
40+
name: metrics
41+
protocol: TCP
42+
readinessProbe:
43+
httpGet:
44+
path: /readyz
45+
port: 8081
46+
initialDelaySeconds: 5
47+
periodSeconds: 10
48+
resources: {{- toYaml .Values.controllerManager.manager.resources | nindent 10
49+
}}
50+
securityContext: {{- toYaml .Values.controllerManager.manager.containerSecurityContext
51+
| nindent 10 }}
52+
securityContext:
53+
runAsNonRoot: true
54+
serviceAccountName: {{ include "elasti.fullname" . }}-controller-manager
55+
terminationGracePeriodSeconds: 10
56+
---
57+
apiVersion: apps/v1
58+
kind: Deployment
59+
metadata:
60+
name: {{ include "elasti.fullname" . }}-resolver
61+
labels:
62+
{{- include "elasti.labels" . | nindent 4 }}
63+
spec:
64+
replicas: {{ .Values.resolver.replicas }}
65+
selector:
66+
matchLabels:
67+
app: resolver
68+
{{- include "elasti.selectorLabels" . | nindent 6 }}
69+
template:
70+
metadata:
71+
labels:
72+
app: resolver
73+
{{- include "elasti.selectorLabels" . | nindent 8 }}
74+
spec:
75+
containers:
76+
- env:
77+
- name: SYSTEM_NAMESPACE
78+
value: {{ quote .Values.resolver.playground.env.systemNamespace }}
79+
- name: KUBERNETES_CLUSTER_DOMAIN
80+
value: {{ quote .Values.kubernetesClusterDomain }}
81+
image: {{ .Values.resolver.playground.image.repository }}:{{ .Values.resolver.playground.image.tag
82+
| default .Chart.AppVersion }}
83+
name: playground
84+
ports:
85+
- containerPort: 8012
86+
resources: {{- toYaml .Values.resolver.playground.resources | nindent 10 }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
name: elastiservices.elasti.truefoundry.io
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.14.0
7+
labels:
8+
{{- include "elasti.labels" . | nindent 4 }}
9+
spec:
10+
group: elasti.truefoundry.io
11+
names:
12+
kind: ElastiService
13+
listKind: ElastiServiceList
14+
plural: elastiservices
15+
singular: elastiservice
16+
scope: Namespaced
17+
versions:
18+
- name: v1alpha1
19+
schema:
20+
openAPIV3Schema:
21+
description: ElastiService is the Schema for the elastiservices API
22+
properties:
23+
apiVersion:
24+
description: |-
25+
APIVersion defines the versioned schema of this representation of an object.
26+
Servers should convert recognized schemas to the latest internal value, and
27+
may reject unrecognized values.
28+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
29+
type: string
30+
kind:
31+
description: |-
32+
Kind is a string value representing the REST resource this object represents.
33+
Servers may infer this from the endpoint the client submits requests to.
34+
Cannot be updated.
35+
In CamelCase.
36+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
37+
type: string
38+
metadata:
39+
type: object
40+
spec:
41+
description: ElastiServiceSpec defines the desired state of ElastiService
42+
properties:
43+
deploymentName:
44+
type: string
45+
idlePeriod:
46+
description: Idle Period is how long should the target VirtualService
47+
be Idle(without requests), before we scale it down to 0.
48+
format: int32
49+
type: integer
50+
queueTimeout:
51+
description: How long do playground hold the request for, before dumping
52+
the queue. Default is 60s.
53+
format: int32
54+
type: integer
55+
service:
56+
type: string
57+
type: object
58+
status:
59+
description: ElastiServiceStatus defines the observed state of ElastiService
60+
properties:
61+
lastReconciledTime:
62+
description: |-
63+
INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
64+
Important: Run "make" to regenerate code after modifying this file
65+
format: date-time
66+
type: string
67+
mode:
68+
type: string
69+
state:
70+
type: string
71+
type: object
72+
type: object
73+
served: true
74+
storage: true
75+
subresources:
76+
status: {}
77+
status:
78+
acceptedNames:
79+
kind: ""
80+
plural: ""
81+
conditions: []
82+
storedVersions: []

0 commit comments

Comments
 (0)