Skip to content

Williamo/v18 fix operator map generation#64597

Open
williamong-tel wants to merge 2 commits intobranch/v18from
williamo/v18-fix-operator-map-generation
Open

Williamo/v18 fix operator map generation#64597
williamong-tel wants to merge 2 commits intobranch/v18from
williamo/v18-fix-operator-map-generation

Conversation

@williamong-tel
Copy link
Contributor

@williamong-tel williamong-tel commented Mar 13, 2026

backport of #64459

Had conflicts in the docs and the go.mod and go.sum.

Ran go mod tidy and make crd

Changelog: fix map generation for teleport resources to k8s

Manual Test Plan

Test Environment

Local k3s environment

Test Cases

  • Applied some resources with the new map format and verified that teleport didn't complain
# Generated by our friend Claude
apiVersion: resources.teleport.dev/v1
kind: TeleportAccessMonitoringRuleV1
metadata:
  name: test-map-amr
  namespace: test
spec:
  subjects:
    - "access_request"
  condition: "access_request.spec.roles.contains(\"admin\")"
  notification:
    name: "slack"
    recipients:
      - "channel-id"
  schedules:
    on_call:
      time:
        timezone: "America/New_York"
        shifts:
          - weekday: "monday"
            start: "09:00"
            end: "17:00"
    after_hours:
      time:
        timezone: "America/New_York"
        shifts:
          - weekday: "saturday"
            start: "00:00"
            end: "23:59"

---
# 2. LoginRule - traits_map: map<string, StringValues>
apiVersion: resources.teleport.dev/v1
kind: TeleportLoginRule
metadata:
  name: test-map-loginrule
  namespace: test
spec:
  priority: 1
  traits_map:
    groups:
      - "external.groups"
    logins:
      - "external.username"

---
# 3. OktaImportRule - add_labels: map<string, string>
apiVersion: resources.teleport.dev/v1
kind: TeleportOktaImportRule
metadata:
  name: test-map-oktarule
  namespace: test
spec:
  priority: 1
  mappings:
    - match:
        - app_ids:
            - "app-123"
      add_labels:
        env: "production"
        team: "platform"

---
# 4. OpenSSHServerV2 - immutable_labels: map<string, string>
apiVersion: resources.teleport.dev/v1
kind: TeleportOpenSSHServerV2
metadata:
  name: test-map-openssh
  namespace: test
spec:
  hostname: "test-server"
  addr: "10.0.0.1:22"
  immutable_labels:
    env: "prod"
    region: "us-east-1"
    ```

* fix mapping gen

make crd

Update schemagen.go

update format

fix docs

update map key

fix

fix formatting

fix formatting

Update format.go

Update format.go

* Update resources-teleport-dev-accesslists.mdx

* add back nullable

fix nullable

* Add schema test

Update schema_test.go

Update schema_test.go
ran make crd and go mod tidy
@github-actions
Copy link
Contributor

github-actions bot commented Mar 13, 2026

Amplify deployment status

Branch Commit Job ID Status Preview Updated (UTC)
williamo/v18-fix-operator-map-generation HEAD 1 ✅SUCCEED williamo-v18-fix-operator-map-generation 2026-03-13 03:14:16

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dc28ecda39

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +83 to +85
require.NotEmpty(t, crd.Spec.Versions)
ver := crd.Spec.Versions[0]
require.NotNil(t, ver.Schema)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Build validators for every CRD version

buildValidators only registers crd.Spec.Versions[0], but this repo contains multi-version CRDs (for example resources.teleport.dev_roles.yaml has several entries under spec.versions), so fixtures targeting any non-first version will not be validated at all (require.NotNil fails) or can be checked against the wrong schema if version ordering changes. This makes the new test miss real schema regressions for versioned resources even though it claims to validate fixtures against CRDs.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant