@@ -179,37 +179,37 @@ func installCRDs(ctx context.Context, client client.Client, crdPath, mode string
179179 return fmt .Errorf ("failed to read CRD file %s: %w" , path , err )
180180 }
181181
182- // Create a scheme that knows about CRD types
182+ // Create a scheme that knows about CRD types.
183183 scheme := runtime .NewScheme ()
184184 if err := apiextensionsv1 .AddToScheme (scheme ); err != nil {
185185 return fmt .Errorf ("failed to add apiextensions scheme: %w" , err )
186186 }
187187
188- // Create decoder for converting raw bytes to Go types
188+ // Create decoder for converting raw bytes to Go types.
189189 codecFactory := serializer .NewCodecFactory (scheme )
190190 decoder := codecFactory .UniversalDeserializer ()
191191
192- // Decode YAML into a structured CRD object
192+ // Decode YAML into a structured CRD object.
193193 obj , gvk , err := decoder .Decode (crdBytes , nil , nil )
194194 if err != nil {
195195 return fmt .Errorf ("failed to decode CRD from %s: %w" , path , err )
196196 }
197197
198- // Type assertion to make sure we have a CRD
198+ // Type assertion to make sure we have a CRD.
199199 crd , ok := obj .(* apiextensionsv1.CustomResourceDefinition )
200200 if ! ok {
201201 return fmt .Errorf ("unexpected type from %s, expected CustomResourceDefinition but got %s" , path , gvk )
202202 }
203203
204- // Create or update using the typed CRD
204+ // Create or update using the typed CRD.
205205 existingCRD := & apiextensionsv1.CustomResourceDefinition {
206206 ObjectMeta : metav1.ObjectMeta {
207207 Name : crd .Name ,
208208 },
209209 }
210210
211211 createOrUpdateRes , err := controllerutil .CreateOrUpdate (ctx , client , existingCRD , func () error {
212- // Copy spec from our decoded CRD to the object we're creating/updating
212+ // Copy spec from our decoded CRD to the object we're creating/updating.
213213 existingCRD .Spec = crd .Spec
214214 existingCRD .SetLabels (crd .Labels )
215215 existingCRD .SetAnnotations (crd .Annotations )
0 commit comments