-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RHCLOUD-21235] Code Refactor (#108)
* Refactor code
- Loading branch information
Showing
12 changed files
with
295 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package helpers | ||
|
||
const ( | ||
ANNOTATION_ENV_STATUS = "env-status" | ||
ANNOTATION_RESERVED = "reserved" | ||
|
||
COMPLETION_TIME = "completion-time" | ||
|
||
ENV_STATUS_CREATING = "creating" | ||
ENV_STATUS_DELETING = "deleting" | ||
ENV_STATUS_ERROR = "error" | ||
ENV_STATUS_READY = "ready" | ||
|
||
KIND_NAMESPACEPOOL = "NamespacePool" | ||
|
||
LABEL_OPERATOR_NS = "operator-ns" | ||
LABEL_POOL = "pool" | ||
|
||
NAMESPACE_EPHEMERAL_BASE = "ephemeral-base" | ||
|
||
BONFIRE_IGNORE_SECRET = "bonfire.ignore" | ||
OPENSHIFT_VAULT_SECRETS_SECRET = "openshift-vault-secrets" | ||
QONTRACT_INTEGRATION_SECRET = "qontract.integration" | ||
|
||
TRUE_VALUE = "true" | ||
FALSE_VALUE = "false" | ||
) |
2 changes: 1 addition & 1 deletion
2
controllers/cloud.redhat.com/frontends.go → ...ers/cloud.redhat.com/helpers/frontends.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package controllers | ||
package helpers | ||
|
||
import ( | ||
"context" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package helpers | ||
|
||
type CustomAnnotation struct { | ||
Annotation string | ||
Value string | ||
} | ||
|
||
type CustomLabel struct { | ||
Label string | ||
Value string | ||
} | ||
|
||
func CreateInitialAnnotations() map[string]string { | ||
return map[string]string{ | ||
ANNOTATION_ENV_STATUS: ENV_STATUS_CREATING, | ||
ANNOTATION_RESERVED: FALSE_VALUE, | ||
} | ||
} | ||
|
||
func CreateInitialLabels(poolName string) map[string]string { | ||
return map[string]string{ | ||
LABEL_OPERATOR_NS: TRUE_VALUE, | ||
LABEL_POOL: poolName, | ||
} | ||
} | ||
|
||
func (a *CustomAnnotation) ToMap() map[string]string { | ||
return map[string]string{a.Annotation: a.Value} | ||
} | ||
|
||
func (l *CustomLabel) ToMap() map[string]string { | ||
return map[string]string{l.Label: l.Value} | ||
} | ||
|
||
var AnnotationEnvReady = CustomAnnotation{Annotation: ANNOTATION_ENV_STATUS, Value: ENV_STATUS_READY} | ||
var AnnotationEnvCreating = CustomAnnotation{Annotation: ANNOTATION_ENV_STATUS, Value: ENV_STATUS_CREATING} | ||
var AnnotationEnvError = CustomAnnotation{Annotation: ANNOTATION_ENV_STATUS, Value: ENV_STATUS_ERROR} | ||
var AnnotationEnvDeleting = CustomAnnotation{Annotation: ANNOTATION_ENV_STATUS, Value: ENV_STATUS_DELETING} | ||
|
||
var AnnotationReservedTrue = CustomAnnotation{Annotation: ANNOTATION_RESERVED, Value: TRUE_VALUE} | ||
var AnnotationReservedFalse = CustomAnnotation{Annotation: ANNOTATION_RESERVED, Value: FALSE_VALUE} | ||
|
||
var LabelOperatorNamespaceTrue = CustomLabel{Label: LABEL_OPERATOR_NS, Value: TRUE_VALUE} |
Oops, something went wrong.