Skip to content

Commit a077a03

Browse files
Making CA cert configmap non mandatory for proxy on NIMCache and NIMService
Signed-off-by: Vishesh Tanksale <[email protected]>
1 parent 112458f commit a077a03

File tree

4 files changed

+391
-9
lines changed

4 files changed

+391
-9
lines changed

api/apps/v1alpha1/nimcache_types.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,14 @@ func (n *NIMCache) GetProxySpec() *ProxySpec {
358358
return n.Spec.Proxy
359359
}
360360

361+
// GetProxyCertConfigMap returns the cert config map for the NIMCache.
362+
func (n *NIMCache) GetProxyCertConfigMap() string {
363+
if n.GetProxySpec() != nil && n.GetProxySpec().CertConfigMap != "" {
364+
return n.GetProxySpec().CertConfigMap
365+
}
366+
return ""
367+
}
368+
361369
func (n *NIMCache) GetEnvWithProxy() []corev1.EnvVar {
362370
envVars := []corev1.EnvVar{
363371
{

api/apps/v1alpha1/nimservice_types.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ func (n *NIMService) GetStandardAnnotations() map[string]string {
497497
"openshift.io/required-scc": "nonroot",
498498
utils.NvidiaAnnotationParentSpecHashKey: utils.DeepHashObject(n.Spec),
499499
}
500-
if n.GetProxySpec() != nil {
500+
if n.GetProxyCertConfigMap() != "" {
501501
standardAnnotations["openshift.io/required-scc"] = "anyuid"
502502
}
503503
return standardAnnotations
@@ -730,8 +730,8 @@ func (n *NIMService) GetVolumes(modelPVC *PersistentVolumeClaim) []corev1.Volume
730730
})
731731
}
732732

733-
if n.GetProxySpec() != nil {
734-
volumes = append(volumes, k8sutil.GetVolumesForUpdatingCaCert(n.Spec.Proxy.CertConfigMap)...)
733+
if n.GetProxyCertConfigMap() != "" {
734+
volumes = append(volumes, k8sutil.GetVolumesForUpdatingCaCert(n.GetProxySpec().CertConfigMap)...)
735735
}
736736
return volumes
737737
}
@@ -838,7 +838,7 @@ func (n *NIMService) GetVolumeMounts(modelPVC *PersistentVolumeClaim) []corev1.V
838838
},
839839
}
840840

841-
if n.GetProxySpec() != nil {
841+
if n.GetProxyCertConfigMap() != "" {
842842
volumeMounts = append(volumeMounts, k8sutil.GetVolumesMountsForUpdatingCaCert()...)
843843
}
844844
return volumeMounts
@@ -945,7 +945,7 @@ func (n *NIMService) GetDeploymentKind() string {
945945

946946
// GetInitContainers returns the init containers for the NIMService deployment.
947947
func (n *NIMService) GetInitContainers() []corev1.Container {
948-
if n.Spec.Proxy != nil {
948+
if n.GetProxyCertConfigMap() != "" {
949949
return []corev1.Container{
950950
{
951951
Name: "update-ca-certificates",
@@ -1583,6 +1583,14 @@ func (n *NIMService) GetProxySpec() *ProxySpec {
15831583
return n.Spec.Proxy
15841584
}
15851585

1586+
// GetProxyCertConfigMap returns the cert config map for the NIMService deployment.
1587+
func (n *NIMService) GetProxyCertConfigMap() string {
1588+
if n.GetProxySpec() != nil && n.GetProxySpec().CertConfigMap != "" {
1589+
return n.GetProxySpec().CertConfigMap
1590+
}
1591+
return ""
1592+
}
1593+
15861594
// GetInferenceServiceParams returns params to render InferenceService from templates.
15871595
func (n *NIMService) GetInferenceServiceParams(
15881596
deploymentMode kserveconstants.DeploymentModeType) *rendertypes.InferenceServiceParams {

0 commit comments

Comments
 (0)