Skip to content

Commit 6a30977

Browse files
yevgeny-shnaidmank8s-ci-robot
authored andcommitted
Adding RegistryTLS to the MIC image spec
MIC image spec is being propagated as is to the MBSC image spec. As part of building sign and build pod, one of the inputs is the RegistryTLS configuration used during build/sign process. This PR does the following: 1. Add RegistryTLS field to the ModuleImageSpec 2. module reconciler sets the RegistryTLS in the imageSpec variable 3. changing unit-tests
1 parent 9bfa353 commit 6a30977

6 files changed

+38
-0
lines changed

api/v1beta1/moduleimagesconfig_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ type ModuleImageSpec struct {
4949
// Sign contains sign instructions, in case image needs signing
5050
// +optional
5151
Sign *Sign `json:"sign,omitempty"`
52+
53+
// +optional
54+
// RegistryTLS set the TLS configs for accessing the registry of the image.
55+
RegistryTLS *TLSOptions `json:"registryTLS,omitempty"`
5256
}
5357

5458
// ModuleImagesConfigSpec describes the images of the Module whose status needs to be verified

api/v1beta1/zz_generated.deepcopy.go

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/kmm.sigs.x-k8s.io_modulebuildsignconfigs.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,19 @@ spec:
164164
kernelVersion:
165165
description: kernel version for which this image is targeted
166166
type: string
167+
registryTLS:
168+
description: RegistryTLS set the TLS configs for accessing the
169+
registry of the image.
170+
properties:
171+
insecure:
172+
description: If Insecure is true, the operator will be able
173+
to access a registry in an insecure (plain HTTP) protocol.
174+
type: boolean
175+
insecureSkipTLSVerify:
176+
description: If InsecureSkipTLSVerify, the operator will
177+
accept any certificate provided by the registry.
178+
type: boolean
179+
type: object
167180
sign:
168181
description: Sign contains sign instructions, in case image
169182
needs signing

config/crd/bases/kmm.sigs.x-k8s.io_moduleimagesconfigs.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,19 @@ spec:
159159
kernelVersion:
160160
description: kernel version for which this image is targeted
161161
type: string
162+
registryTLS:
163+
description: RegistryTLS set the TLS configs for accessing the
164+
registry of the image.
165+
properties:
166+
insecure:
167+
description: If Insecure is true, the operator will be able
168+
to access a registry in an insecure (plain HTTP) protocol.
169+
type: boolean
170+
insecureSkipTLSVerify:
171+
description: If InsecureSkipTLSVerify, the operator will
172+
accept any certificate provided by the registry.
173+
type: boolean
174+
type: object
162175
sign:
163176
description: Sign contains sign instructions, in case image
164177
needs signing

internal/controllers/module_reconciler.go

+1
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ func (mrh *moduleReconcilerHelper) handleMIC(ctx context.Context, mod *kmmv1beta
353353
KernelVersion: mld.KernelVersion,
354354
Build: mld.Build,
355355
Sign: mld.Sign,
356+
RegistryTLS: mld.RegistryTLS,
356357
}
357358
images = append(images, mis)
358359
}

internal/controllers/module_reconciler_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -475,12 +475,14 @@ var _ = Describe("handleMIC", func() {
475475
Build: &kmmv1beta1.Build{},
476476
Sign: &kmmv1beta1.Sign{},
477477
KernelVersion: "some version",
478+
RegistryTLS: &kmmv1beta1.TLSOptions{},
478479
}
479480
expectedSpec := kmmv1beta1.ModuleImageSpec{
480481
Image: img,
481482
KernelVersion: "some version",
482483
Build: mld.Build,
483484
Sign: mld.Sign,
485+
RegistryTLS: mld.RegistryTLS,
484486
}
485487
mockKernelMapper.EXPECT().GetModuleLoaderDataForKernel(mod, gomock.Any()).Return(mld, nil)
486488
mockMICAPI.EXPECT().CreateOrPatch(ctx, mod.Name, mod.Namespace, []kmmv1beta1.ModuleImageSpec{expectedSpec}, mod.Spec.ImageRepoSecret, mod).Return(nil)

0 commit comments

Comments
 (0)