Skip to content

Commit

Permalink
Pass the KubeImageName to domainmgr
Browse files Browse the repository at this point in the history
If in the app manifest HV is set to NOHYPER and the eve flavor is kubevirt
we set the KubeImageName in the domainconfig to the volumereference name

domainmgr will use that to start pods (native containers)

Signed-off-by: Pramodh Pallapothu <pramodh@zededa.com>
  • Loading branch information
Pramodh Pallapothu authored and eriknordmark committed Apr 13, 2024
1 parent 1cd7a32 commit c5c28dc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pkg/pillar/cmd/zedmanager/handledomainmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ func MaybeAddDomainConfig(ctx *zedmanagerContext,
continue
}
location := vrs.ActiveFileLocation
if location == "" {
// Volumes in kubevirt eve are of PVC type and managed by kubernetes.
// There is no specific filelocation
if location == "" && !ctx.hvTypeKube {
errStr := fmt.Sprintf("No ActiveFileLocation for %s", vrs.DisplayName)
log.Error(errStr)
return nil, errors.New(errStr)
Expand All @@ -77,6 +79,12 @@ func MaybeAddDomainConfig(ctx *zedmanagerContext,
disk.Target = vrs.Target
disk.CustomMeta = vrs.CustomMeta
dc.DiskConfigList = append(dc.DiskConfigList, disk)
// For kubevirt eve native containers (NOHYPER) we need set the KubeImageName in domainconfig
// pods will be launched using that KubeImageName
if aiConfig.FixedResources.VirtualizationMode == types.NOHYPER && ctx.hvTypeKube {
dc.VirtualizationMode = types.NOHYPER
dc.KubeImageName = vrs.ReferenceName
}
}
// let's fill some of the default values (arguably we may want controller
// to do this for us and give us complete config, but it is easier to
Expand Down Expand Up @@ -150,12 +158,12 @@ func lookupDomainStatus(ctx *zedmanagerContext, key string) *types.DomainStatus
}

func publishDomainConfig(ctx *zedmanagerContext,
status *types.DomainConfig) {
config *types.DomainConfig) {

key := status.Key()
key := config.Key()
log.Tracef("publishDomainConfig(%s)", key)
pub := ctx.pubDomainConfig
pub.Publish(key, *status)
pub.Publish(key, *config)
}

func unpublishDomainConfig(ctx *zedmanagerContext, uuidStr string) {
Expand Down
3 changes: 3 additions & 0 deletions pkg/pillar/cmd/zedmanager/zedmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ type zedmanagerContext struct {
// hypervisorPtr is the name of the hypervisor to use
hypervisorPtr *string
assignableAdapters *types.AssignableAdapters
// Is it kubevirt eve
hvTypeKube bool
}

// AddAgentSpecificCLIFlags adds CLI options
Expand All @@ -93,6 +95,7 @@ func Run(ps *pubsub.PubSub, loggerArg *logrus.Logger, logArg *base.LogObject, ar
// Any state needed by handler functions
ctx := zedmanagerContext{
globalConfig: types.DefaultConfigItemValueMap(),
hvTypeKube: base.IsHVTypeKube(),
}
agentbase.Init(&ctx, logger, log, agentName,
agentbase.WithArguments(arguments))
Expand Down
3 changes: 3 additions & 0 deletions pkg/pillar/types/domainmgrtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ type DomainConfig struct {
DiskConfigList []DiskConfig
VifList []VifConfig
IoAdapterList []IoAdapter
// KubeImageName is the container image reference we pass to domainmgr to launch a native container
// in kubevirt eve
KubeImageName string

// XXX: to be deprecated, use CipherBlockStatus instead
CloudInitUserData *string `json:"pubsub-large-CloudInitUserData"` // base64-encoded
Expand Down

0 comments on commit c5c28dc

Please sign in to comment.