File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,16 @@ func validateIDs(names []string) error {
6161 return ErrInvalidNames
6262}
6363
64+ // K8sNameUUIDUnsafe works like K8sNameUUID, but panics instead of returning an error.
65+ // This should only be used in places where the input is guaranteed to be valid.
66+ func K8sNameUUIDUnsafe (names ... string ) string {
67+ uuid , err := K8sNameUUID (names ... )
68+ if err != nil {
69+ panic (err )
70+ }
71+ return uuid
72+ }
73+
6474// K8sObjectUUID takes a client object and computes a hash out of the namespace and name, which is then formatted as a version 8 UUID.
6575// An empty namespace will be replaced by "default".
6676func K8sObjectUUID (obj client.Object ) (string , error ) {
@@ -70,3 +80,13 @@ func K8sObjectUUID(obj client.Object) (string, error) {
7080 }
7181 return K8sNameUUID (namespace , name )
7282}
83+
84+ // K8sObjectUUIDUnsafe works like K8sObjectUUID, but panics instead of returning an error.
85+ // This should only be used in places where the input is guaranteed to be valid.
86+ func K8sObjectUUIDUnsafe (obj client.Object ) string {
87+ uuid , err := K8sObjectUUID (obj )
88+ if err != nil {
89+ panic (err )
90+ }
91+ return uuid
92+ }
You can’t perform that action at this time.
0 commit comments