-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
We use two different sets of constants to define operator types:
One set is used for parsing command line options, which necessarily need to be strings:
operator-sdk/commands/operator-sdk/cmd/new.go
Lines 80 to 81 in 04f1a67
goOperatorType = "go" | |
ansibleOperatorType = "ansible" |
The other set is used when we detect the type of operator on disk, e.g. for operator-sdk up local
:
operator-sdk/commands/operator-sdk/cmd/cmdutil/util.go
Lines 31 to 36 in 04f1a67
const ( | |
// OperatorTypeGo - golang type of operator. | |
OperatorTypeGo OperatorType = iota | |
// OperatorTypeAnsible - ansible type of operator. | |
OperatorTypeAnsible | |
) |
As we add more operator types (e.g. helm), we'll have to be careful to add new types to both sets of constants, and keep track what each set is used for.
Does it make sense to consolidate these to the iota-based consts in the cmdutil
package and add a helper function to the cmdutil package to convert a type string to the constant?