Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add eck-apm-server Helm Chart #7533

Merged
merged 10 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions deploy/eck-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ dependencies:
- name: eck-logstash
condition: eck-logstash.enabled
version: "0.10.0-SNAPSHOT"
- name: eck-apm-server
condition: eck-apm-server.enabled
version: "0.10.0-SNAPSHOT"
2 changes: 2 additions & 0 deletions deploy/eck-stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The following Elastic Stack resources are currently supported.
- Fleet Server
- Beats
- Logstash
- APM Server

Additional resources will be supported in future releases of this Helm Chart.

Expand Down Expand Up @@ -77,6 +78,7 @@ The following table lists the configurable parameters of the eck-stack chart and
| `eck-agent.enabled` | If `true`, create an Elastic Agent resource (using the eck-agent Chart) | `false` |
| `eck-fleet-server.enabled` | If `true`, create a Fleet Server resource (using the eck-fleet-server Chart) | `false` |
| `eck-logstash.enabled` | If `true`, create a Logstash resource (using the eck-logstash Chart) | `false` |
| `eck-apm-server.enabled` | If `true`, create a standalone Elastic APM Server resource (using the eck-apm-server Chart) | `false` |

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.

Expand Down
24 changes: 24 additions & 0 deletions deploy/eck-stack/charts/eck-apm-server/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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/
templates/tests
10 changes: 10 additions & 0 deletions deploy/eck-stack/charts/eck-apm-server/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v2
name: eck-apm-server
description: Elastic APM Server managed by the ECK operator
kubeVersion: ">= 1.21.0-0"
type: application
version: 0.10.0-SNAPSHOT
sources:
- https://github.com/elastic/cloud-on-k8s
- https://github.com/elastic/apm-server
icon: https://helm.elastic.co/icons/apm.png
93 changes: 93 additions & 0 deletions deploy/eck-stack/charts/eck-apm-server/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Elastic License 2.0

URL: https://www.elastic.co/licensing/elastic-license

## Acceptance

By using the software, you agree to all of the terms and conditions below.

## Copyright License

The licensor grants you a non-exclusive, royalty-free, worldwide,
non-sublicensable, non-transferable license to use, copy, distribute, make
available, and prepare derivative works of the software, in each case subject to
the limitations and conditions below.

## Limitations

You may not provide the software to third parties as a hosted or managed
service, where the service provides users with access to any substantial set of
the features or functionality of the software.

You may not move, change, disable, or circumvent the license key functionality
in the software, and you may not remove or obscure any functionality in the
software that is protected by the license key.

You may not alter, remove, or obscure any licensing, copyright, or other notices
of the licensor in the software. Any use of the licensor’s trademarks is subject
to applicable law.

## Patents

The licensor grants you a license, under any patent claims the licensor can
license, or becomes able to license, to make, have made, use, sell, offer for
sale, import and have imported the software, in each case subject to the
limitations and conditions in this license. This license does not cover any
patent claims that you cause to be infringed by modifications or additions to
the software. If you or your company make any written claim that the software
infringes or contributes to infringement of any patent, your patent license for
the software granted under these terms ends immediately. If your company makes
such a claim, your patent license ends immediately for work on behalf of your
company.

## Notices

You must ensure that anyone who gets a copy of any part of the software from you
also gets a copy of these terms.

If you modify the software, you must include in any modified copies of the
software prominent notices stating that you have modified the software.

## No Other Rights

These terms do not imply any licenses other than those expressly granted in
these terms.

## Termination

If you use the software in violation of these terms, such use is not licensed,
and your licenses will automatically terminate. If the licensor provides you
with a notice of your violation, and you cease all violation of this license no
later than 30 days after you receive that notice, your licenses will be
reinstated retroactively. However, if you violate these terms after such
reinstatement, any additional violation of these terms will cause your licenses
to terminate automatically and permanently.

## No Liability

*As far as the law allows, the software comes as is, without any warranty or
condition, and the licensor will not be liable to you for any damages arising
out of these terms or the use or nature of the software, under any kind of
legal claim.*

## Definitions

The **licensor** is the entity offering these terms, and the **software** is the
software the licensor makes available under these terms, including any portion
of it.

**you** refers to the individual or entity agreeing to these terms.

**your company** is any legal entity, sole proprietorship, or other kind of
organization that you work for, plus all organizations that have control over,
are under the control of, or are under common control with that
organization. **control** means ownership of substantially all the assets of an
entity, or the power to direct its management and policies by vote, contract, or
otherwise. Control can be direct or indirect.

**your licenses** are all the licenses granted to you for the software under
these terms.

**use** means anything you do with the software requiring one of your licenses.

**trademark** means trademarks, service marks, and similar rights.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
# Version of APM Server.
#
version: 8.13.0-SNAPSHOT

# Count of APM Server replicas to create.
#
count: 1

config:
name: elastic-apm
apm-server.jaeger.grpc.enabled: true
apm-server.jaeger.grpc.host: "0.0.0.0:14250"

# Reference to ECK-managed Elasticsearch resource.
#
elasticsearchRef:
name: eck-elasticsearch
http:
service:
spec:
ports:
- name: http
port: 8200
targetPort: 8200
- name: grpc
port: 14250
targetPort: 14250

6 changes: 6 additions & 0 deletions deploy/eck-stack/charts/eck-apm-server/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

1. Check APM Server status
$ kubectl get apmserver {{ include "apm-server.fullname" . }} -n {{ .Release.Namespace }}

2. Check APM Server pod status
$ kubectl get pods --namespace={{ .Release.Namespace }} -l apm.k8s.elastic.co/name={{ include "apm-server.fullname" . }}
51 changes: 51 additions & 0 deletions deploy/eck-stack/charts/eck-apm-server/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "apm-server.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 "apm-server.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 "apm-server.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "apm-server.labels" -}}
helm.sh/chart: {{ include "apm-server.chart" . }}
{{ include "apm-server.selectorLabels" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.labels }}
{{ toYaml .Values.labels }}
{{- end }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "apm-server.selectorLabels" -}}
app.kubernetes.io/name: {{ include "apm-server.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
53 changes: 53 additions & 0 deletions deploy/eck-stack/charts/eck-apm-server/templates/apmserver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
apiVersion: apm.k8s.elastic.co/v1
kind: ApmServer
metadata:
name: {{ include "apm-server.fullname" . }}
labels:
{{- include "apm-server.labels" . | nindent 4 }}
annotations:
eck.k8s.elastic.co/license: enterprise
{{- with .Values.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
version: {{ required "An APM Server version is required" .Values.version }}
count: {{ required "A pod count is required" .Values.count }}
{{- with .Values.image }}
image: {{ . }}
{{- end }}
{{- with .Values.serviceAccountName }}
serviceAccountName: {{ . }}
{{- end }}
{{- with .Values.revisionHistoryLimit }}
revisionHistoryLimit: {{ . }}
{{- end }}

{{- with .Values.config }}
config:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.http }}
http:
{{- toYaml . | nindent 4 }}
{{- end }}

{{- with .Values.elasticsearchRef }}
elasticsearchRef:
{{- toYaml . | nindent 4 }}
{{- end }}

{{- with .Values.kibanaRef }}
kibanaRef:
{{- toYaml . | nindent 4 }}
{{- end }}

{{- with .Values.podTemplate }}
podTemplate:
{{- toYaml . | nindent 4 }}
{{- end }}

{{- with .Values.secureSettings }}
secureSettings:
{{- toYaml . | nindent 2 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
suite: test apmserver
templates:
- templates/apmserver.yaml
tests:
- it: should render quickstart properly
set:
elasticsearchRef:
name: eck-elasticsearch
release:
name: quickstart
asserts:
- isKind:
of: ApmServer
- equal:
path: metadata.name
value: quickstart-eck-apm-server
- equal:
path: spec.version
value: 8.13.0-SNAPSHOT
- it: name override should work properly
set:
nameOverride: override
elasticsearchRef:
name: eck-elasticsearch
release:
name: quickstart
asserts:
- isKind:
of: ApmServer
- equal:
path: metadata.name
value: quickstart-override
- it: fullname override should work properly
set:
fullnameOverride: override
elasticsearchRef:
name: eck-elasticsearch
release:
name: quickstart
asserts:
- isKind:
of: ApmServer
- equal:
path: metadata.name
value: override
- it: should render custom labels, and annotations values properly
set:
labels:
test: label
annotations:
test: annotation
elasticsearchRef:
name: eck-elasticsearch
release:
name: quickstart
asserts:
- isKind:
of: ApmServer
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: quickstart
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: eck-apm-server
helm.sh/chart: eck-apm-server-0.10.0-SNAPSHOT
test: label
- equal:
path: metadata.annotations
value:
eck.k8s.elastic.co/license: enterprise
test: annotation
- it: should render http service properly
set:
elasticsearchRef.namespace: default
values:
- ../../examples/jaeger-with-http-configuration.yaml
release:
name: quickstart
asserts:
- isKind:
of: ApmServer
- equal:
path: metadata.name
value: quickstart-eck-apm-server
- equal:
path: spec.version
value: 8.13.0-SNAPSHOT
- equal:
path: spec.count
value: 1
- equal:
path: spec.elasticsearchRef.name
value: eck-elasticsearch
- equal:
path: spec.elasticsearchRef.namespace
value: default
Loading