@@ -40,7 +40,7 @@ func (r *MaaSModelRefsRepository) CreateMaaSModelRef(ctx context.Context, reques
4040
4141 kubeClient := client .GetDynamicClient ()
4242
43- obj := buildModelRefUnstructured (request .Name , request .Namespace , request .ModelRef , request .EndpointOverride , request .Uid )
43+ obj := buildModelRefUnstructured (request .Name , request .Namespace , request .ModelRef , request .EndpointOverride , request .Uid , request . DisplayName , request . Description )
4444 created , err := kubeClient .Resource (constants .MaaSModelRefGvr ).Namespace (request .Namespace ).Create (ctx , obj , metav1.CreateOptions {})
4545 if err != nil {
4646 if k8sErrors .IsAlreadyExists (err ) {
@@ -82,6 +82,22 @@ func (r *MaaSModelRefsRepository) UpdateMaaSModelRef(ctx context.Context, namesp
8282 if request .EndpointOverride != "" {
8383 existingSpec ["endpointOverride" ] = request .EndpointOverride
8484 }
85+
86+ annotations := existing .GetAnnotations ()
87+ if annotations == nil {
88+ annotations = map [string ]string {}
89+ }
90+ if request .DisplayName != "" {
91+ annotations [displayNameAnnotation ] = request .DisplayName
92+ } else {
93+ delete (annotations , displayNameAnnotation )
94+ }
95+ if request .Description != "" {
96+ annotations [descriptionAnnotation ] = request .Description
97+ } else {
98+ delete (annotations , descriptionAnnotation )
99+ }
100+ existing .SetAnnotations (annotations )
85101 existing .Object ["spec" ] = existingSpec
86102
87103 updated , err := kubeClient .Resource (constants .MaaSModelRefGvr ).Namespace (namespace ).Update (ctx , existing , metav1.UpdateOptions {})
@@ -113,7 +129,7 @@ func (r *MaaSModelRefsRepository) DeleteMaaSModelRef(ctx context.Context, namesp
113129 return nil
114130}
115131
116- func buildModelRefUnstructured (name , namespace string , modelRef models.ModelReference , endpointOverride string , uid string ) * unstructured.Unstructured {
132+ func buildModelRefUnstructured (name , namespace string , modelRef models.ModelReference , endpointOverride string , uid string , displayName string , description string ) * unstructured.Unstructured {
117133 obj := & unstructured.Unstructured {}
118134 obj .SetAPIVersion ("maas.opendatahub.io/v1alpha1" )
119135 obj .SetKind ("MaaSModelRef" )
@@ -128,6 +144,10 @@ func buildModelRefUnstructured(name, namespace string, modelRef models.ModelRefe
128144 BlockOwnerDeletion : & []bool {false }[0 ],
129145 },
130146 })
147+ obj .SetAnnotations (map [string ]string {
148+ "openshift.io/display-name" : displayName ,
149+ "openshift.io/description" : description ,
150+ })
131151
132152 spec := map [string ]interface {}{
133153 "modelRef" : map [string ]interface {}{
0 commit comments