refactor: use enum to represent authentication type
This commit is contained in:
1 parent
75eeb99a42
commit
25ad302ed2
2 files changed
+14
-1
No files matched your search
@@ -515,11 +515,12 @@ func getAutoscaling(input GetAutoscalingInput) (ProcessAutoscaling, error) {
|
|||||||
if auth, ok := input.KedaValues.Authentications[trigger.Type]; ok {
|
if auth, ok := input.KedaValues.Authentications[trigger.Type]; ok {
|
||||||
trigger.AuthenticationRef = &ProcessAutoscalingTriggerAuthenticationRef{
|
trigger.AuthenticationRef = &ProcessAutoscalingTriggerAuthenticationRef{
|
||||||
Name: auth.Name,
|
Name: auth.Name,
|
||||||
|
Kind: string(auth.Kind),
|
||||||
}
|
}
|
||||||
} else if auth, ok := input.KedaValues.GlobalAuthentications[trigger.Type]; ok {
|
} else if auth, ok := input.KedaValues.GlobalAuthentications[trigger.Type]; ok {
|
||||||
trigger.AuthenticationRef = &ProcessAutoscalingTriggerAuthenticationRef{
|
trigger.AuthenticationRef = &ProcessAutoscalingTriggerAuthenticationRef{
|
||||||
Name: auth.Name,
|
Name: auth.Name,
|
||||||
Kind: "ClusterTriggerAuthentication",
|
Kind: string(auth.Kind),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -563,6 +564,7 @@ func getKedaValues(ctx context.Context, clientset KubernetesClient, appName stri
|
|||||||
auths[authType] = KedaAuthentication{
|
auths[authType] = KedaAuthentication{
|
||||||
Name: fmt.Sprintf("%s-%s", appName, authType),
|
Name: fmt.Sprintf("%s-%s", appName, authType),
|
||||||
Type: authType,
|
Type: authType,
|
||||||
|
Kind: KedaAuthenticationKind_TriggerAuthentication,
|
||||||
Secrets: make(map[string]string),
|
Secrets: make(map[string]string),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -584,6 +586,7 @@ func getKedaValues(ctx context.Context, clientset KubernetesClient, appName stri
|
|||||||
authType := strings.TrimPrefix(item.Name, "global-auth-")
|
authType := strings.TrimPrefix(item.Name, "global-auth-")
|
||||||
globalAuths[authType] = KedaAuthentication{
|
globalAuths[authType] = KedaAuthentication{
|
||||||
Name: item.Name,
|
Name: item.Name,
|
||||||
|
Kind: KedaAuthenticationKind_ClusterTriggerAuthentication,
|
||||||
Type: authType,
|
Type: authType,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ type KedaAuthentication struct {
|
|||||||
// Name is the name of the authentication object
|
// Name is the name of the authentication object
|
||||||
Name string `yaml:"name"`
|
Name string `yaml:"name"`
|
||||||
|
|
||||||
|
// Kind is the kind of authentication object
|
||||||
|
Kind KedaAuthenticationKind `yaml:"kind,omitempty"`
|
||||||
|
|
||||||
// Type is the type of authentication to use
|
// Type is the type of authentication to use
|
||||||
Type string `yaml:"type"`
|
Type string `yaml:"type"`
|
||||||
|
|
||||||
@@ -78,6 +81,13 @@ type KedaAuthentication struct {
|
|||||||
Secrets map[string]string `yaml:"secrets,omitempty"`
|
Secrets map[string]string `yaml:"secrets,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type KedaAuthenticationKind string
|
||||||
|
|
||||||
|
const (
|
||||||
|
KedaAuthenticationKind_ClusterTriggerAuthentication KedaAuthenticationKind = "ClusterTriggerAuthentication"
|
||||||
|
KedaAuthenticationKind_TriggerAuthentication KedaAuthenticationKind = "TriggerAuthentication"
|
||||||
|
)
|
||||||
|
|
||||||
type ProcessValues struct {
|
type ProcessValues struct {
|
||||||
Annotations ProcessAnnotations `yaml:"annotations,omitempty"`
|
Annotations ProcessAnnotations `yaml:"annotations,omitempty"`
|
||||||
Args []string `yaml:"args,omitempty"`
|
Args []string `yaml:"args,omitempty"`
|
||||||
|
|||||||
Reference in new issue
Block a user