Skip to content

Commit 074b420

Browse files
Send the NGTS workspace ID on token requests and uploads
- VenafiConnection mode: bump venafi-connection-lib to pick up spec.ngts.workspaceID. The library sends it on the token request; the agent now adds it to the upload too, using the library's http_client.WithWorkspaceID. - NGTS keypair mode: add an optional --workspace-id flag and a config.workspaceID value in the discovery-agent chart. It is rejected outside --ngts, and the chart fails to render if it is set together with config.venafiConnection.enabled. - Regenerate the VenafiConnection CRD in both charts. - The library bump also raises k8s.io/* to v0.37.0 and controller-runtime to v0.25.0, which venafi-connection-lib requires. NGTS now only finds an OIDC (workload identity) service account that lives in a workspace when the token request names that workspace, so the agent cannot use such an account through a VenafiConnection without this change. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Richard Wall <richard.wall@cyberark.com>
1 parent aafe4a1 commit 074b420

21 files changed

Lines changed: 600 additions & 302 deletions

‎LICENSES‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ github.com/go-openapi/swag,Apache-2.0
5858
github.com/go-openapi/swag/cmdutils,Apache-2.0
5959
github.com/go-openapi/swag/conv,Apache-2.0
6060
github.com/go-openapi/swag/fileutils,Apache-2.0
61-
github.com/go-openapi/swag/jsonname,Apache-2.0
6261
github.com/go-openapi/swag/jsonutils,Apache-2.0
6362
github.com/go-openapi/swag/loading,Apache-2.0
6463
github.com/go-openapi/swag/mangling,Apache-2.0
6564
github.com/go-openapi/swag/netutils,Apache-2.0
65+
github.com/go-openapi/swag/pools,Apache-2.0
6666
github.com/go-openapi/swag/stringutils,Apache-2.0
6767
github.com/go-openapi/swag/typeutils,Apache-2.0
6868
github.com/go-openapi/swag/yamlutils,Apache-2.0
@@ -100,6 +100,8 @@ github.com/sosodev/duration,MIT
100100
github.com/spf13/cobra,Apache-2.0
101101
github.com/spf13/pflag,BSD-3-Clause
102102
github.com/stretchr/testify,MIT
103+
github.com/stretchr/testify/internal/difflib,BSD-3-Clause
104+
github.com/stretchr/testify/internal/spew,ISC
103105
github.com/valyala/fastjson,MIT
104106
github.com/x448/float16,MIT
105107
go.opentelemetry.io/otel,Apache-2.0

‎deploy/charts/discovery-agent/README.md‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ The namespace in which the 'venafi-connection' service account lives. This is th
3030
The TSG (Tenant Service Group) ID to use when connecting to SCM. The production SCM server URL is derived from this value. Required unless config.serverURL is set. Mutually exclusive with config.serverURL. Must not be set when config.venafiConnection.enabled is true (the TSG ID is taken from the VenafiConnection's `spec.ngts` instead).
3131
3232
33+
#### **config.workspaceID** ~ `number,string`
34+
> Default value:
35+
> ```yaml
36+
> ""
37+
> ```
38+
39+
The ID of the SCM workspace that the service account belongs to (optional). Sent as the `workspace_id` query parameter on the token request and on uploads. SCM uses the workspace of the service account that authenticated, so it ignores this value today. Must not be set when config.venafiConnection.enabled is true (set `spec.ngts.workspaceID` in the VenafiConnection instead).
40+
41+
3342
#### **config.clusterName** ~ `string`
3443
> Default value:
3544
> ```yaml
@@ -108,7 +117,7 @@ Must not be set when config.venafiConnection.enabled is true (the credentials Se
108117
> false
109118
> ```
110119
111-
When set to true, config.tsgID, config.serverURL, config.clientID and config.clientId must not be set (the chart will fail to render otherwise), and the Secret named by config.secretName will _not_ be mounted into the Discovery Agent Pod.
120+
When set to true, config.tsgID, config.workspaceID, config.serverURL, config.clientID and config.clientId must not be set (the chart will fail to render otherwise), and the Secret named by config.secretName will _not_ be mounted into the Discovery Agent Pod.
112121
#### **config.venafiConnection.name** ~ `string`
113122
> Default value:
114123
> ```yaml

‎deploy/charts/discovery-agent/crd_bases/jetstack.io_venaficonnections.yaml‎

Lines changed: 52 additions & 41 deletions
Large diffs are not rendered by default.

‎deploy/charts/discovery-agent/templates/deployment.yaml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ spec:
7575
{{- if .Values.config.tsgID }}
7676
{{- fail "config.tsgID must not be set when config.venafiConnection.enabled is true; the TSG ID is read from the VenafiConnection's spec.ngts" }}
7777
{{- end }}
78+
{{- if .Values.config.workspaceID }}
79+
{{- fail "config.workspaceID must not be set when config.venafiConnection.enabled is true; set spec.ngts.workspaceID in the VenafiConnection instead" }}
80+
{{- end }}
7881
{{- if .Values.config.serverURL }}
7982
{{- fail "config.serverURL must not be set when config.venafiConnection.enabled is true; the server URL is read from the VenafiConnection's spec" }}
8083
{{- end }}
@@ -106,6 +109,10 @@ spec:
106109
- --tsg-id
107110
- {{ required "config.tsgID is required when config.serverURL is not set" .Values.config.tsgID | include "discovery-agent.stringOrNumber" | quote }}
108111
{{- end }}
112+
{{- with .Values.config.workspaceID }}
113+
- --workspace-id
114+
- {{ . | include "discovery-agent.stringOrNumber" | quote }}
115+
{{- end }}
109116
{{- if or .Values.config.clientID .Values.config.clientId }}
110117
- --client-id
111118
- {{ .Values.config.clientID | default .Values.config.clientId }}

‎deploy/charts/discovery-agent/templates/venafi-connection-crd.without-validations.yaml‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,20 @@ spec:
709709
The URL to connect to the NGTS Data Plane. If not set, the default
710710
value https://<tsgID>.ngts.paloaltonetworks.com is used.
711711
type: string
712+
workspaceID:
713+
description: |-
714+
The ID of the NGTS workspace that the service account belongs to.
715+
Required when the service account uses OIDC (workload identity) and
716+
belongs to a workspace: without it, NGTS only looks for tenant-level
717+
service accounts, and the token request fails with "Not found". Leave it
718+
unset for a tenant-level service account. It has no effect with
719+
privateKeyJWT, because the client ID identifies the account. NGTS
720+
ignores it on API calls: they are scoped to the workspace of the service
721+
account that authenticated. NGTS does not report an unknown workspace
722+
ID: with OIDC, a wrong ID fails with the same "Not found" error as a
723+
wrong issuer, audience or subject, so check it carefully.
724+
minLength: 1
725+
type: string
712726
required:
713727
- jwt
714728
type: object

0 commit comments

Comments
 (0)