Skip to content

Commit 90eeaec

Browse files
authored
chore: Add call to agent metadata workflow - step 1 (#3750)
1 parent 44de4df commit 90eeaec

File tree

4 files changed

+183
-0
lines changed

4 files changed

+183
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# original source: https://github.com/newrelic/newrelic-agent-control/blob/main/agent-control/agent-type-registry/newrelic/com.newrelic.apm_node-0.1.0.yaml
2+
namespace: newrelic
3+
name: com.newrelic.apm_node
4+
version: 0.1.0
5+
variables:
6+
k8s:
7+
podLabelSelector:
8+
description: "Pod label selector"
9+
type: yaml
10+
default: { }
11+
required: false
12+
containerSelector:
13+
description: "Container selector"
14+
type: yaml
15+
default: { }
16+
required: false
17+
namespaceLabelSelector:
18+
description: "Namespace label selector"
19+
type: yaml
20+
default: { }
21+
required: false
22+
# All 'agent' side-car related variables are flattened.
23+
version:
24+
description: "NodeJS Agent init container version"
25+
type: string
26+
default: "latest"
27+
required: false
28+
env:
29+
description: "environment variables to pass to nodejs agent"
30+
type: yaml
31+
default: [ ]
32+
required: false
33+
imagePullPolicy:
34+
description: "image pull policy for the NodeJS agent init container"
35+
type: string
36+
default: "Always"
37+
required: false
38+
resourceRequirements:
39+
description: "resource requirements for the NodeJS agent init container"
40+
type: yaml
41+
default: { }
42+
required: false
43+
securityContext:
44+
description: "security context for the NodeJS agent init container"
45+
type: yaml
46+
default: { }
47+
required: false
48+
# All health sidecar related variables are flattened and prefixed with "health_"
49+
health_env:
50+
description: "environment variables to pass to health sidecar"
51+
type: yaml
52+
default: [ ]
53+
required: false
54+
health_version:
55+
description: "health sidecar image version"
56+
type: string
57+
default: "latest"
58+
required: false
59+
health_imagePullPolicy:
60+
description: "image pull policy for the health sidecar"
61+
type: string
62+
default: "Always"
63+
required: false
64+
health_resourceRequirements:
65+
description: "resource requirements for the health sidecar"
66+
type: yaml
67+
default: { }
68+
required: false
69+
health_securityContext:
70+
description: "security context for the health sidecar"
71+
type: yaml
72+
default: { }
73+
required: false
74+
deployment:
75+
k8s:
76+
health:
77+
interval: 30s
78+
initial_delay: 30s
79+
objects:
80+
instrumentation:
81+
apiVersion: newrelic.com/v1beta3
82+
kind: Instrumentation
83+
metadata:
84+
name: ${nr-sub:agent_id}
85+
# APM CRs should be installed in "nr-ac:namespace"
86+
# Due to a limitation in the k8s-agents-operator, Instrumentation CRs must be installed in the same namespace as the operator.
87+
# Hence, the namespace is set to "nr-ac:namespace_agents".
88+
# Reference: https://github.com/newrelic/k8s-agents-operator/blob/92c19208864f051f03f457ee04b772fca5042162/api/v1beta1/instrumentation_webhook.go#L110C27-L110C72
89+
namespace: ${nr-ac:namespace_agents}
90+
spec:
91+
agent:
92+
language: nodejs
93+
image: newrelic/newrelic-node-init:${nr-var:version}
94+
env: ${nr-var:env}
95+
imagePullPolicy: ${nr-var:imagePullPolicy}
96+
resources: ${nr-var:resourceRequirements}
97+
securityContext: ${nr-var:securityContext}
98+
healthAgent:
99+
image: newrelic/k8s-apm-agent-health-sidecar:${nr-var:health_version}
100+
env: ${nr-var:health_env}
101+
imagePullPolicy: ${nr-var:health_imagePullPolicy}
102+
resources: ${nr-var:health_resourceRequirements}
103+
securityContext: ${nr-var:health_securityContext}
104+
podLabelSelector: ${nr-var:podLabelSelector}
105+
namespaceLabelSelector: ${nr-var:namespaceLabelSelector}
106+
containerSelector: ${nr-var:containerSelector}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
agentControlDefinitions:
2+
- platform: KUBERNETESCLUSTER
3+
supportFromAgent: 1.0.0
4+
supportFromAgentControl: 1.0.0
5+
content: ./agentControl/agent-schema-for-agent-control.yml
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
configurationDefinitions:
2+
- platform: KUBERNETESCLUSTER
3+
description: Node agent configuration
4+
type: agent-config
5+
version: 1.0.0
6+
# will add schema information here later
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Agent Metadata
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
# Allows manual triggering with parameters
8+
workflow_dispatch:
9+
inputs:
10+
version:
11+
description: 'Version tag (needs to exactly match the GH tag for the release)'
12+
required: true
13+
type: string
14+
agent-type:
15+
description: 'Agent type'
16+
required: false
17+
default: 'NRNodeAgent'
18+
type: string
19+
use-cache:
20+
description: 'Use cache'
21+
required: false
22+
default: true
23+
type: boolean
24+
25+
# workflow_run:
26+
# workflows: ["Create Release"]
27+
# types:
28+
# - completed
29+
30+
jobs:
31+
get-version:
32+
runs-on: ubuntu-latest
33+
if: |
34+
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') ||
35+
(github.event_name == 'workflow_dispatch')
36+
outputs:
37+
version: ${{ steps.get-version.outputs.version }}
38+
agent-type: ${{ steps.get-version.outputs.agent-type }}
39+
use-cache: ${{ steps.get-version.outputs.use-cache }}
40+
steps:
41+
- uses: actions/checkout@v6
42+
43+
- name: Get version and inputs
44+
id: get-version
45+
run: |
46+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
47+
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
48+
echo "agent-type=${{ inputs.agent-type }}" >> $GITHUB_OUTPUT
49+
echo "use-cache=${{ inputs.use-cache }}" >> $GITHUB_OUTPUT
50+
else
51+
VERSION=$(node -p "require('./package.json').version")
52+
echo "version=$VERSION" >> $GITHUB_OUTPUT
53+
echo "agent-type=NRNodeAgent" >> $GITHUB_OUTPUT
54+
echo "use-cache=true" >> $GITHUB_OUTPUT
55+
fi
56+
57+
send-agent-metadata:
58+
needs: [get-version]
59+
uses: newrelic/newrelic-agent-init-container/.github/workflows/agent-metadata.yml@main
60+
with:
61+
agent-type: ${{ needs.get-version.outputs.agent-type }}
62+
version: ${{ needs.get-version.outputs.version }}
63+
use-cache: ${{ needs.get-version.outputs.use-cache }}
64+
secrets:
65+
FC_SYS_ID_CLIENT_ID: ${{ secrets.FC_SYS_ID_CLIENT_ID }}
66+
FC_SYS_ID_PR_KEY: ${{ secrets.FC_SYS_ID_PR_KEY }}

0 commit comments

Comments
 (0)