Skip to content

Conversation

kfox1111
Copy link
Collaborator

fixes: #229

Comment on lines 114 to 117
// If MissingClassName is set and ClassName is set, any CR without a ClassName
// specified will also be handled by this controller.
// +optional
MissingClassName bool `json:"missingClassName,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a potential for conflict with this configurable? If 1 controller has ClassName empty and other has this set to true, they will both try to process the same CR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. Same thing happens with Ingress Controllers. Or two different controllers with ClassName empty.

// +optional
ClassName string `json:"className,omitempty"`

// If MissingClassName is set and ClassName is set, any CR without a ClassName
Copy link
Member

Choose a reason for hiding this comment

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

Is the presence of and naming of this configurable conventional? What's the use case?

Copy link
Collaborator Author

@kfox1111 kfox1111 Oct 18, 2023

Choose a reason for hiding this comment

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

Not sure how much precedent there is. I can compare against what they did in ingress-nginx.

As for the use case, say you deploy one spire instance. no class name on it. users upload crs with no class name attached.

Then a second spire instance is desired. So, how is it safe to have both? A migration procedure is needed.

First, the existing spire server is updated to have
ClassName: foo
MissingClassName: true

So it will now have a name, and it will still handle all existing CR's without a ClassName.

The new spire server can then be installed with
ClassName: bar
MissingClassName: false

and new CRs of ClassName bar can be added to the cluster.

Copy link
Collaborator Author

@kfox1111 kfox1111 Oct 18, 2023

Choose a reason for hiding this comment

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

ingress-nginx is quite verbose with their flag:
https://github.com/kubernetes/ingress-nginx/blob/a8798294083d4b0d874046648ec20d495849d000/charts/ingress-nginx/templates/_params.tpl#L55C18-L55C18

--watch-ingress-without-class=true

We could do WatchCRsWithoutClassName: true?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is the problem here backwards compatibility? If starting from scratch we would probably have ClassName set to a default value and then the separate "watch without class" bool set to false by default.

Copy link
Member

Choose a reason for hiding this comment

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

I see. How about --watch-classless?

In terms of defaults, we need to preserve the default behavior of "handle everything", which should be the behavior if ClassName is empty. Using WatchClassless to allow a controller to simultaneously handle CR's without a ClassName as well as CRs matching the class name seems like a fine migration behavior.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, the default is to watch all. (className empty)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will rename the missing flag.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

@azdagron azdagron left a comment

Choose a reason for hiding this comment

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

Thanks, @kfox1111 !

@azdagron azdagron merged commit ce7845d into spiffe:main Oct 25, 2023
@kfox1111 kfox1111 deleted the class-name branch October 25, 2023 20:04
@MarcosDY MarcosDY added this to the 0.4.0 milestone Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple class support
4 participants