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

Operator doesn't handle OIDCConnectors with max_age set #48165

Closed
hugoShaka opened this issue Oct 30, 2024 · 2 comments
Closed

Operator doesn't handle OIDCConnectors with max_age set #48165

hugoShaka opened this issue Oct 30, 2024 · 2 comments
Assignees
Labels
bug kube-operator Issues related to Kube Operator

Comments

@hugoShaka
Copy link
Contributor

Expected behavior:

I create a teleport_oidc_connector CR with spec.max_age set and the operator reconciles it.

Current behavior:

The operator fails to convert the resource:

Failed to decode Kubernetes CR: strict decoding error: unknown field "spec.max_age"

reason: FailedToDecode
status: 'False'
type: validStructure

Bug details:

  • Teleport version v16.4.6
  • Recreation steps: create a CR with spec.max_age
  • Debug logs
@hugoShaka hugoShaka added bug kube-operator Issues related to Kube Operator labels Oct 30, 2024
@hugoShaka hugoShaka self-assigned this Oct 30, 2024
@hugoShaka
Copy link
Contributor Author

A potential fix would be a custom JSON unmarshaler:

// UnmarshalJSON serializes a JSON string into a spec. This override is required to deal with the
// MaxAge field which is special case because it's an object embedded into the spec.
func (spec TeleportOIDCConnectorSpec) UnmarshalJSON(data []byte) error {
	type Alias TeleportOIDCConnectorSpec
	temp := struct {
		MaxAge types.Duration `json:"max_age"`
		Alias
	}{
		Alias: (Alias)(spec),
	}
	if err := json.Unmarshal(data, &temp); err != nil {
		return trace.Wrap(err, "unmarshalling custom teleport oidc connector spec")
	}
	spec.MaxAge = &types.MaxAge{Value: temp.MaxAge}
	return nil
}

@zmb3
Copy link
Collaborator

zmb3 commented Nov 4, 2024

Fixed by #48316

@zmb3 zmb3 closed this as completed Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug kube-operator Issues related to Kube Operator
Projects
None yet
Development

No branches or pull requests

2 participants