Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
[HLS-4187] - independent operator (#7)
Browse files Browse the repository at this point in the history
* update helios repo for deploy images

* set static commit

* revert change for static tag

* make static releases version

* update

* update

* update build and push operator image

* push operator image

* update image prefix

* update image prefix

* collect image name

* fix test

* revert static version change

* update python dep

* remove changelog action

* revert change

---------

Co-authored-by: Ran Nozik <[email protected]>
  • Loading branch information
LironKS and nozik authored Aug 7, 2023
1 parent bb76dbb commit 2d89e69
Show file tree
Hide file tree
Showing 19 changed files with 58 additions and 131 deletions.
88 changes: 0 additions & 88 deletions .github/workflows/changelog.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-apache-httpd
images: gethelios/autoinstrumentation-apache-httpd
tags: |
type=match,pattern=v(.*),group=1,value=v${{ env.VERSION }}
Expand All @@ -48,9 +48,8 @@ jobs:
- name: Login to GitHub Package Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
username: gethelios
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/publish-autoinstrumentation-dotnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-dotnet
images: gethelios/autoinstrumentation-dotnet
tags: |
type=match,pattern=v(.*),group=1,value=v${{ env.VERSION }}
Expand All @@ -48,9 +48,8 @@ jobs:
- name: Login to GitHub Package Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
username: gethelios
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/publish-autoinstrumentation-java.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-java
images: gethelios/autoinstrumentation-java
tags: |
type=match,pattern=v(.*),group=1,value=v${{ env.VERSION }}
Expand All @@ -48,9 +48,8 @@ jobs:
- name: Login to GitHub Package Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
username: gethelios
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/publish-autoinstrumentation-nodejs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-nodejs
images: gethelios/autoinstrumentation-nodejs
tags: |
type=match,pattern=v(.*),group=1,value=v${{ env.VERSION }}
Expand All @@ -48,9 +48,8 @@ jobs:
- name: Login to GitHub Package Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
username: gethelios
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/publish-autoinstrumentation-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-python
images: gethelios/autoinstrumentation-python
tags: |
type=match,pattern=v(.*),group=1,value=v${{ env.VERSION }}
Expand All @@ -48,9 +48,8 @@ jobs:
- name: Login to GitHub Package Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
username: gethelios
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/publish-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
id: docker_meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator
images: gethelios/opentelemetry-operator
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
Expand All @@ -60,21 +60,20 @@ jobs:
- name: Login to GitHub Package Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
username: gethelios
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Operator image
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
build-args: |
VERSION_PKG=github.com/open-telemetry/opentelemetry-operator/internal/version
VERSION_PKG=github.com/helios/opentelemetry-operator/internal/version
VERSION=${{ env.VERSION }}
VERSION_DATE=${{ env.VERSION_DATE }}
OTELCOL_VERSION=${{ env.OTELCOL_VERSION }}
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/publish-target-allocator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/open-telemetry/opentelemetry-operator/target-allocator
images: gethelios/target-allocator
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
Expand All @@ -51,9 +51,8 @@ jobs:
- name: Login to GitHub Package Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
username: gethelios
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: ./hack/install-kustomize.sh

- name: "generate release resources"
run: make release-artifacts IMG_PREFIX="ghcr.io/open-telemetry/opentelemetry-operator"
run: make release-artifacts IMG_PREFIX="gethelios"

- name: "create the release in GitHub"
env:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ The environment variable `CERTMANAGER_VERSION` can be used to override the cert-
CERTMANAGER_VERSION=1.60 make cert-manager
```

When deploying the operator into the cluster using `make deploy`, an image in the format `ghcr.io/${USER}/opentelemetry-operator` is generated. If this format isn't suitable, it can be overridden by:
When deploying the operator into the cluster using `make deploy`, an image in the format `gethelios/` is generated. If this format isn't suitable, it can be overridden by:

* `IMG_PREFIX`, to override the registry, namespace and image name
* `USER`, to override the namespace
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ LD_FLAGS ?= "-X ${VERSION_PKG}.version=${VERSION} -X ${VERSION_PKG}.buildDate=${
ARCH ?= $(shell go env GOARCH)

# Image URL to use all building/pushing image targets
IMG_PREFIX ?= ghcr.io/${USER}/opentelemetry-operator
IMG_PREFIX ?= gethelios
IMG_REPO ?= opentelemetry-operator
IMG ?= ${IMG_PREFIX}/${IMG_REPO}:${VERSION}
BUNDLE_IMG ?= ${IMG_PREFIX}/${IMG_REPO}-bundle:${VERSION}
Expand Down
2 changes: 1 addition & 1 deletion autoinstrumentation/python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
helios-opentelemetry-sdk=v1.0.66
helios-opentelemetry-sdk==v1.0.66
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ metadata:
capabilities: Basic Install
categories: Logging & Tracing
certified: "false"
containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator
containerImage: gethelios/opentelemetry-operator
createdAt: "2020-12-16T13:37:00+00:00"
description: Provides the OpenTelemetry components, including the Collector
operators.operatorframework.io/builder: operator-sdk-v1.23.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
capabilities: Basic Install
categories: Logging & Tracing
certified: "false"
containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator
containerImage: gethelios/opentelemetry-operator
createdAt: "2020-12-16T13:37:00+00:00"
description: Provides the OpenTelemetry components, including the Collector
repository: github.com/open-telemetry/opentelemetry-operator
Expand Down
12 changes: 6 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ func main() {
pflag.BoolVar(&enableLeaderElection, "enable-leader-election", false,
"Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")
pflag.StringVar(&collectorImage, "collector-image", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:%s", v.OpenTelemetryCollector), "The default OpenTelemetry collector image. This image is used when no image is specified in the CustomResource.")
pflag.StringVar(&targetAllocatorImage, "target-allocator-image", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-operator/target-allocator:%s", v.TargetAllocator), "The default OpenTelemetry target allocator image. This image is used when no image is specified in the CustomResource.")
pflag.StringVar(&autoInstrumentationJava, "auto-instrumentation-java-image", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-java:%s", v.AutoInstrumentationJava), "The default OpenTelemetry Java instrumentation image. This image is used when no image is specified in the CustomResource.")
pflag.StringVar(&autoInstrumentationNodeJS, "auto-instrumentation-nodejs-image", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-nodejs:%s", v.AutoInstrumentationNodeJS), "The default OpenTelemetry NodeJS instrumentation image. This image is used when no image is specified in the CustomResource.")
pflag.StringVar(&autoInstrumentationPython, "auto-instrumentation-python-image", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-python:%s", v.AutoInstrumentationPython), "The default OpenTelemetry Python instrumentation image. This image is used when no image is specified in the CustomResource.")
pflag.StringVar(&autoInstrumentationDotNet, "auto-instrumentation-dotnet-image", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-dotnet:%s", v.AutoInstrumentationDotNet), "The default OpenTelemetry DotNet instrumentation image. This image is used when no image is specified in the CustomResource.")
pflag.StringVar(&collectorImage, "collector-image", fmt.Sprintf("gethelios/opentelemetry-collector:%s", v.OpenTelemetryCollector), "The default OpenTelemetry collector image. This image is used when no image is specified in the CustomResource.")
pflag.StringVar(&targetAllocatorImage, "target-allocator-image", fmt.Sprintf("gethelios/target-allocator:%s", v.TargetAllocator), "The default OpenTelemetry target allocator image. This image is used when no image is specified in the CustomResource.")
pflag.StringVar(&autoInstrumentationJava, "auto-instrumentation-java-image", fmt.Sprintf("gethelios/autoinstrumentation-java:%s", v.AutoInstrumentationJava), "The default OpenTelemetry Java instrumentation image. This image is used when no image is specified in the CustomResource.")
pflag.StringVar(&autoInstrumentationNodeJS, "auto-instrumentation-nodejs-image", fmt.Sprintf("gethelios/autoinstrumentation-nodejs:%s", v.AutoInstrumentationNodeJS), "The default OpenTelemetry NodeJS instrumentation image. This image is used when no image is specified in the CustomResource.")
pflag.StringVar(&autoInstrumentationPython, "auto-instrumentation-python-image", fmt.Sprintf("gethelios/autoinstrumentation-python:%s", v.AutoInstrumentationPython), "The default OpenTelemetry Python instrumentation image. This image is used when no image is specified in the CustomResource.")
pflag.StringVar(&autoInstrumentationDotNet, "auto-instrumentation-dotnet-image", fmt.Sprintf("gethelios/autoinstrumentation-dotnet:%s", v.AutoInstrumentationDotNet), "The default OpenTelemetry DotNet instrumentation image. This image is used when no image is specified in the CustomResource.")
pflag.StringArrayVar(&labelsFilter, "labels", []string{}, "Labels to filter away from propagating onto deploys")
pflag.IntVar(&webhookPort, "webhook-port", 9443, "The port the webhook endpoint binds to.")
pflag.StringVar(&tlsOpt.minVersion, "tls-min-version", "VersionTLS12", "Minimum TLS version supported. Value must match version names from https://golang.org/pkg/crypto/tls/#pkg-constants.")
Expand Down
12 changes: 12 additions & 0 deletions pkg/instrumentation/nodejs.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,19 @@ import (
const (
envNodeOptions = "NODE_OPTIONS"
nodeRequireArgument = " --require /otel-auto-instrumentation/autoinstrumentation.js"
envImageName = "HS_IMAGE_NAME"
)

func injectEnvVarIfNotExists(container *corev1.Container, envVarName, envVarValue string) {
idx := getIndexOfEnv(container.Env, envVarName)
if idx == -1 {
container.Env = append(container.Env, corev1.EnvVar{
Name: envVarName,
Value: envVarValue,
})
}
}

func injectNodeJSSDK(nodeJSSpec v1alpha1.NodeJS, pod corev1.Pod, index int) (corev1.Pod, error) {
// caller checks if there is at least one container.
container := &pod.Spec.Containers[index]
Expand All @@ -51,6 +62,7 @@ func injectNodeJSSDK(nodeJSSpec v1alpha1.NodeJS, pod corev1.Pod, index int) (cor
} else if idx > -1 {
container.Env[idx].Value = container.Env[idx].Value + nodeRequireArgument
}
injectEnvVarIfNotExists(container, envImageName, container.Image)

container.VolumeMounts = append(container.VolumeMounts, corev1.VolumeMount{
Name: volumeName,
Expand Down
6 changes: 5 additions & 1 deletion pkg/instrumentation/podmutator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func TestMutatePod(t *testing.T) {
Value: "true",
},
{
Name: "OTEL_INSTRUMENTATION_JDBC_ENABLED",
Name: "OTEL_INSTRUMENTATION_JDBC_ENABLED",
Value: "false",
},
{
Expand Down Expand Up @@ -324,6 +324,10 @@ func TestMutatePod(t *testing.T) {
Name: "NODE_OPTIONS",
Value: nodeRequireArgument,
},
{
Name: "HS_IMAGE_NAME",
Value: "",
},
{
Name: "OTEL_TRACES_EXPORTER",
Value: "otlp",
Expand Down
4 changes: 4 additions & 0 deletions pkg/instrumentation/sdk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,10 @@ func TestInjectNodeJS(t *testing.T) {
Name: "NODE_OPTIONS",
Value: nodeRequireArgument,
},
{
Name: "HS_IMAGE_NAME",
Value: "",
},
{
Name: "OTEL_SERVICE_NAME",
Value: "app",
Expand Down
2 changes: 2 additions & 0 deletions tests/e2e/instrumentation-nodejs/01-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ spec:
value: "true"
- name: NODE_OPTIONS
value: " --require /otel-auto-instrumentation/autoinstrumentation.js"
- name: HS_IMAGE_NAME
value: ""
- name: OTEL_TRACES_EXPORTER
value: otlp
- name: OTEL_EXPORTER_OTLP_ENDPOINT
Expand Down

0 comments on commit 2d89e69

Please sign in to comment.