Conversation
rrati
left a comment
There was a problem hiding this comment.
Make all files through gofmt and fix formatting and remove commented out code in addition to changes.
| } | ||
|
|
||
| // convertSecretType converts from a kubernetes SecretType | ||
| func convertSecretType(secret v1.SecretType) (SecretType, error) { |
There was a problem hiding this comment.
Rename this in the same vain as other conversion functions (ie fromKubeSecreTypetV1). Name them after the Kubernetes object name and not the mantle one (if there's a difference). Keep in mind that there will likely be multiple conversion functions for multiple API versions, so name functions with that in mind.
| v1 "k8s.io/api/core/v1" | ||
| ) | ||
|
|
||
| type SecretWrapper struct { |
There was a problem hiding this comment.
REmove this. Wrappers aren't needed in mantle
| SecretType SecretType `json:"type,omitempty"` | ||
| } | ||
|
|
||
| type SecretType string |
There was a problem hiding this comment.
Make this an int and all definitions of it using iota
| return string(s) | ||
| } | ||
|
|
||
| func CompareSecretTypes(secret1, secret2 interface{}) (bool, error) { |
There was a problem hiding this comment.
This function shouldn't be needed anymore or if it is, modified to work with secret type being an int. Also seems more like a test function, so move into test file and don't export
| SecretTypeTLS SecretType = "kubernetes.io/tls" | ||
| ) | ||
|
|
||
| func (s SecretType) ToString() string { |
| SecretTypeDockerConfigJson SecretType = "kubernetes.io/dockerconfigjson" | ||
| SecretTypeBasicAuth SecretType = "kubernetes.io/basic-auth" | ||
| SecretTypeSSHAuth SecretType = "kubernetes.io/ssh-auth" | ||
| SecretTypeTLS SecretType = "kubernetes.io/tls" |
There was a problem hiding this comment.
Missing the full set of types from kubernetes. SecretTypeBootstrapToken is missing
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| ) | ||
|
|
||
| // map[SecretName]V1SecretName |
| kubeType := reflect.TypeOf(kubeObj) | ||
| expectedType := reflect.TypeOf(tc.expectedObj) | ||
| if kubeType != expectedType { | ||
| t.Errorf("wrong api version, got %s expected %s", kubeType, expectedType) |
There was a problem hiding this comment.
Put the tc description at the head of the error message (ie "%s: ...)
| expectedObj := reflect.TypeOf(&Secret{}) | ||
| objType := reflect.TypeOf(obj) | ||
| if expectedObj != objType { | ||
| t.Errorf("expected %s got %s", expectedObj, objType) |
There was a problem hiding this comment.
Put tc description at head of error message (ie "%s: ...")
| } | ||
|
|
||
| // revertSecretType converts to a kubernetes SecretType | ||
| func revertSecretType(secret SecretType) (v1.SecretType, error) { |
No description provided.