Skip to content

Commit

Permalink
feat: bootstrap config handle cri sock/kind global config
Browse files Browse the repository at this point in the history
  • Loading branch information
carlmontanari committed Dec 9, 2023
1 parent 1293c5d commit e4e84a1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
6 changes: 6 additions & 0 deletions charts/clabernetes/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,10 @@ data:
launcherImage: {{ .Values.globalConfig.deployment.launcherImage }}
launcherImagePullPolicy: {{ .Values.globalConfig.deployment.launcherImagePullPolicy }}
launcherLogLevel: {{ .Values.globalConfig.deployment.launcherLogLevel }}
{{- if .Values.globalConfig.imagePull.criSockOverride }}
criSockOverride: {{ .Values.globalConfig.imagePull.criSockOverride }}
{{- end }}
{{- if .Values.globalConfig.imagePull.criKindOverride }}
criKindOverride: {{ .Values.globalConfig.imagePull.criKindOverride }}
{{- end }}
{{- end }}
22 changes: 22 additions & 0 deletions config/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ type bootstrapConfig struct {
launcherImage string
launcherImagePullPolicy string
launcherLogLevel string
criSockOverride string
criKindOverride string
}

func bootstrapFromConfigMap( //nolint:gocyclo,funlen
Expand Down Expand Up @@ -119,6 +121,16 @@ func bootstrapFromConfigMap( //nolint:gocyclo,funlen
bc.launcherLogLevel = launcherLogLevel
}

criSockOverride, criSockOverrideOk := inMap["criSockOverride"]
if criSockOverrideOk {
bc.criSockOverride = criSockOverride
}

criKindOverride, criKindOverrideOk := inMap["criKindOverride"]
if criKindOverrideOk {
bc.criKindOverride = criKindOverride
}

var err error

if len(outErrors) > 0 {
Expand Down Expand Up @@ -211,6 +223,14 @@ func mergeFromBootstrapConfigMerge(
if config.Spec.Deployment.LauncherLogLevel == "" {
config.Spec.Deployment.LauncherLogLevel = bootstrap.launcherLogLevel
}

if config.Spec.ImagePull.CRISockOverride == "" {
config.Spec.ImagePull.CRISockOverride = bootstrap.criSockOverride
}

if config.Spec.ImagePull.CRIKindOverride == "" {
config.Spec.ImagePull.CRIKindOverride = bootstrap.criKindOverride
}
}

func mergeFromBootstrapConfigReplace(
Expand All @@ -225,6 +245,8 @@ func mergeFromBootstrapConfigReplace(
InClusterDNSSuffix: bootstrap.inClusterDNSSuffix,
ImagePull: clabernetesapisv1alpha1.ConfigImagePull{
PullThroughOverride: bootstrap.imagePullThroughMode,
CRISockOverride: bootstrap.criSockOverride,
CRIKindOverride: bootstrap.criKindOverride,
},
Deployment: clabernetesapisv1alpha1.ConfigDeployment{
ResourcesDefault: bootstrap.resourcesDefault,
Expand Down

0 comments on commit e4e84a1

Please sign in to comment.