Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/dev_build_precache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ env:
MODULES_MODULE_SOURCE: ${{ vars.DEV_MODULE_SOURCE }}
MODULES_REGISTRY_LOGIN: ${{ vars.DEV_MODULES_REGISTRY_LOGIN }}
MODULES_REGISTRY_PASSWORD: ${{ secrets.DEV_MODULES_REGISTRY_PASSWORD }}
MODULE_BUILD_PROFILE: "dev"
SOURCE_REPO: "${{secrets.SOURCE_REPO}}"
SOURCE_REPO_GIT: "${{secrets.SOURCE_REPO_GIT}}"

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/dev_build_svace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ env:
MODULES_MODULE_SOURCE: ${{ vars.DEV_MODULE_SOURCE }}
MODULES_REGISTRY_LOGIN: ${{ vars.DEV_MODULES_REGISTRY_LOGIN }}
MODULES_REGISTRY_PASSWORD: ${{ secrets.DEV_MODULES_REGISTRY_PASSWORD }}
MODULE_BUILD_PROFILE: "dev"
SOURCE_REPO: "${{secrets.SOURCE_REPO}}"
SOURCE_REPO_GIT: "${{secrets.SOURCE_REPO_GIT}}"

Expand Down Expand Up @@ -92,6 +93,7 @@ jobs:
echo MODULES_MODULE_NAME=$MODULES_MODULE_NAME
echo MODULES_MODULE_SOURCE=$MODULES_MODULE_SOURCE
echo MODULE_EDITION=$MODULE_EDITION
echo MODULE_BUILD_PROFILE=$MODULE_BUILD_PROFILE
echo MODULES_MODULE_TAG=$MODULES_MODULE_TAG
echo DOCKER_CONFIG=$DOCKER_CONFIG

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/dev_module_build-and-registration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ env:
MODULES_MODULE_SOURCE: ${{ vars.DEV_MODULE_SOURCE }}
MODULES_REGISTRY_LOGIN: ${{ vars.DEV_MODULES_REGISTRY_LOGIN }}
MODULES_REGISTRY_PASSWORD: ${{ secrets.DEV_MODULES_REGISTRY_PASSWORD }}
MODULE_BUILD_PROFILE: "dev"
RELEASE_CHANNEL: ${{ github.event.inputs.channel }}
MODULES_MODULE_TAG: ${{ github.event.inputs.tag }}
SOURCE_REPO: "${{secrets.SOURCE_REPO}}"
Expand Down Expand Up @@ -72,6 +73,7 @@ jobs:
echo MODULES_MODULE_NAME=$MODULES_MODULE_NAME
echo RELEASE_CHANNEL=$RELEASE_CHANNEL
echo MODULE_EDITION=$MODULE_EDITION
echo MODULE_BUILD_PROFILE=$MODULE_BUILD_PROFILE
echo DOCKER_CONFIG=$DOCKER_CONFIG
shell: bash
- name: Validation and set MODULES_MODULE_TAG
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/dev_module_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ env:
MODULES_MODULE_SOURCE: ${{ vars.DEV_MODULE_SOURCE }}
MODULES_REGISTRY_LOGIN: ${{ vars.DEV_MODULES_REGISTRY_LOGIN }}
MODULES_REGISTRY_PASSWORD: ${{ secrets.DEV_MODULES_REGISTRY_PASSWORD }}
MODULE_BUILD_PROFILE: "dev"
GO_VERSION: "1.25.9"
GOLANGCI_LINT_VERSION: "2.11.1"
SOURCE_REPO: "${{secrets.SOURCE_REPO}}"
Expand Down Expand Up @@ -346,6 +347,7 @@ jobs:
echo MODULES_MODULE_SOURCE=$MODULES_MODULE_SOURCE
echo MODULES_MODULE_TAG=$MODULES_MODULE_TAG
echo MODULE_EDITION=$MODULE_EDITION
echo MODULE_BUILD_PROFILE=$MODULE_BUILD_PROFILE
echo DEBUG_COMPONENT=$DEBUG_COMPONENT
echo DOCKER_CONFIG=$DOCKER_CONFIG

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release_module_build-and-registration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ env:
MODULE_SOURCE_NAME: ${{ vars.PROD_MODULE_SOURCE_NAME }}
MODULES_REGISTRY_LOGIN: ${{ vars.PROD_MODULES_REGISTRY_LOGIN }}
MODULES_REGISTRY_PASSWORD: ${{ secrets.PROD_MODULES_REGISTRY_PASSWORD }}
MODULE_BUILD_PROFILE: "release"
MODULES_MODULE_TAG: ${{ github.ref_name }}
SOURCE_REPO: "${{ secrets.SOURCE_REPO }}"
SOURCE_REPO_GIT: "${{secrets.SOURCE_REPO_GIT}}"
Expand Down Expand Up @@ -60,6 +61,7 @@ jobs:
echo $MODULES_MODULE_NAME
echo $MODULES_MODULE_SOURCE
echo $MODULES_MODULE_TAG
echo $MODULE_BUILD_PROFILE
shell: bash
name: Show vars

Expand Down Expand Up @@ -113,6 +115,7 @@ jobs:
echo $MODULES_MODULE_NAME
echo $MODULES_MODULE_SOURCE
echo $MODULES_MODULE_TAG
echo $MODULE_BUILD_PROFILE
shell: bash
name: Show vars

Expand Down Expand Up @@ -167,6 +170,7 @@ jobs:
echo $MODULES_MODULE_NAME
echo $MODULES_MODULE_SOURCE
echo $MODULES_MODULE_TAG
echo $MODULE_BUILD_PROFILE
shell: bash
name: Show vars

Expand Down Expand Up @@ -221,6 +225,7 @@ jobs:
echo $MODULES_MODULE_NAME
echo $MODULES_MODULE_SOURCE
echo $MODULES_MODULE_TAG
echo $MODULE_BUILD_PROFILE
shell: bash
name: Show vars

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/release_module_release-channels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ env:
RELEASE_CHANNEL: ${{ github.event.inputs.channel }}
MODULES_REGISTRY_LOGIN: ${{ vars.PROD_MODULES_REGISTRY_LOGIN }}
MODULES_REGISTRY_PASSWORD: ${{ secrets.PROD_MODULES_REGISTRY_PASSWORD }}
MODULE_BUILD_PROFILE: "release"
MODULES_MODULE_TAG: ${{ github.event.inputs.tag }}
SOURCE_REPO: ${{ secrets.SOURCE_REPO }}
SOURCE_REPO_GIT: ${{secrets.SOURCE_REPO_GIT}}
Expand Down Expand Up @@ -93,6 +94,7 @@ jobs:
echo MODULES_MODULE_NAME=$MODULES_MODULE_NAME
echo RELEASE_CHANNEL=$RELEASE_CHANNEL
echo MODULE_EDITION=$MODULE_EDITION
echo MODULE_BUILD_PROFILE=$MODULE_BUILD_PROFILE
echo DOCKER_CONFIG=$DOCKER_CONFIG
shell: bash

Expand Down Expand Up @@ -180,6 +182,7 @@ jobs:
- name: ECHO VAR
run: |
echo $MODULES_MODULE_SOURCE
echo $MODULE_BUILD_PROFILE
- uses: actions/checkout@v4
with:
fetch-depth: 0
Expand Down Expand Up @@ -240,6 +243,7 @@ jobs:
- name: ECHO VAR
run: |
echo $MODULES_MODULE_SOURCE
echo $MODULE_BUILD_PROFILE
- uses: actions/checkout@v4
with:
fetch-depth: 0
Expand Down Expand Up @@ -305,6 +309,7 @@ jobs:
- name: ECHO VAR
run: |
echo $MODULES_MODULE_SOURCE
echo $MODULE_BUILD_PROFILE
- uses: actions/checkout@v4
with:
fetch-depth: 0
Expand Down Expand Up @@ -364,6 +369,7 @@ jobs:
- name: ECHO VAR
run: |
echo $MODULES_MODULE_SOURCE
echo $MODULE_BUILD_PROFILE
- name: Validation for tag
run: |
echo ${{ github.event.inputs.tag }} | grep -P '^v\d+\.\d+\.\d+'
Expand Down
1 change: 1 addition & 0 deletions .werf/consts.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Edition module settings
{{- $_ := set . "MODULE_EDITION" (env "MODULE_EDITION" "EE") }}
{{- $_ := set . "MODULE_BUILD_PROFILE" (env "MODULE_BUILD_PROFILE" "release") }}

# Component versions
{{- $_ := set . "Firmware" dict -}}
Expand Down
1 change: 1 addition & 0 deletions .werf/images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dockerfile: Dockerfile
{{- $_ := set $ctx "SOURCE_REPO" $Root.SOURCE_REPO }}
{{- $_ := set $ctx "SOURCE_REPO_GIT" $Root.SOURCE_REPO_GIT }}
{{- $_ := set $ctx "MODULE_EDITION" $Root.MODULE_EDITION }}
{{- $_ := set $ctx "MODULE_BUILD_PROFILE" $Root.MODULE_BUILD_PROFILE }}
{{- $_ := set $ctx "DEBUG_COMPONENT" $Root.DEBUG_COMPONENT }}
{{- $_ := set $ctx "Firmware" $Root.Firmware }}
{{- $_ := set $ctx "Package" $Root.Package }}
Expand Down
1 change: 0 additions & 1 deletion api/core/v1alpha2/virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ const (
// +kubebuilder:subresource:status
// +kubebuilder:resource:categories={all,virtualization},scope=Namespaced,shortName={vm},singular=virtualmachine
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="The phase of the virtual machine."
// +kubebuilder:printcolumn:name="PhaseAge",type="date",JSONPath=".status.stats.phasesTransitions[-1].timestamp",description="Time since the virtual machine entered the current phase."
// +kubebuilder:printcolumn:name="Cores",priority=1,type="string",JSONPath=".spec.cpu.cores",description="The number of cores of the virtual machine."
// +kubebuilder:printcolumn:name="CoreFraction",priority=1,type="string",JSONPath=".spec.cpu.coreFraction",description="Virtual machine core fraction. The range of available values is set in the `sizePolicy` parameter of the VirtualMachineClass; if it is not set, use values within the 1–100% range."
// +kubebuilder:printcolumn:name="Memory",priority=1,type="string",JSONPath=".spec.memory.size",description="The amount of memory of the virtual machine."
Expand Down
8 changes: 0 additions & 8 deletions crds/doc-ru-virtualmachines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -687,14 +687,6 @@ spec:
stats:
description: Статистика по виртуальной машине.
properties:
phasesTransitions:
description: История по фазам.
items:
properties:
phase:
description: Фаза виртуальной машины.
timestamp:
description: Время перехода в данную фазу.
launchTimeDuration:
description: Информация о запуске.
properties:
Expand Down
9 changes: 9 additions & 0 deletions crds/patches/doc-ru-virtualmachines-dev-phaseage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
statsProperties:
phasesTransitions:
description: История по фазам.
items:
properties:
phase:
description: Фаза виртуальной машины.
timestamp:
description: Время перехода в данную фазу.
30 changes: 30 additions & 0 deletions crds/patches/virtualmachines-dev-phaseage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
phaseAgeColumn:
description: Time since the virtual machine entered the current phase.
jsonPath: .status.stats.phasesTransitions[-1].timestamp
name: PhaseAge
type: date
statsProperties:
phasesTransitions:
description: Phase history.
type: array
items:
type: object
properties:
phase:
description: Virtual machine phase.
type: string
enum:
- "Pending"
- "Running"
- "Degraded"
- "Terminating"
- "Stopped"
- "Stopping"
- "Starting"
- "Migrating"
- "Pause"
timestamp:
description: Time of transition to this phase.
format: date-time
nullable: true
type: string
28 changes: 0 additions & 28 deletions crds/virtualmachines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1157,30 +1157,6 @@ spec:
type: object
description: Virtual machine statistics.
properties:
phasesTransitions:
description: Phase history.
type: array
items:
type: object
properties:
phase:
description: Virtual machine phase.
type: string
enum:
- "Pending"
- "Running"
- "Degraded"
- "Terminating"
- "Stopped"
- "Stopping"
- "Starting"
- "Migrating"
- "Pause"
timestamp:
description: Time of transition to this phase.
format: date-time
nullable: true
type: string
launchTimeDuration:
description: Details on the launch.
type: object
Expand Down Expand Up @@ -1422,10 +1398,6 @@ spec:
jsonPath: .status.phase
name: Phase
type: string
- description: Time since the virtual machine entered the current phase.
jsonPath: .status.stats.phasesTransitions[-1].timestamp
name: PhaseAge
type: date
- description: Real number of the virtual machine cores.
jsonPath: .status.resources.cpu.cores
name: Cores
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//go:build dev

package internal

import (
"time"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/deckhouse/virtualization/api/core/v1alpha2"
)

func NewPhaseTransitions(phaseTransitions []v1alpha2.VirtualMachinePhaseTransitionTimestamp, oldPhase, newPhase v1alpha2.MachinePhase) []v1alpha2.VirtualMachinePhaseTransitionTimestamp {
now := metav1.NewTime(time.Now().Truncate(time.Second))

if oldPhase != newPhase {
phaseTransitions = append(phaseTransitions, v1alpha2.VirtualMachinePhaseTransitionTimestamp{
Phase: newPhase,
Timestamp: now,
})
}
if len(phaseTransitions) > 5 {
return phaseTransitions[len(phaseTransitions)-5:]
}
return phaseTransitions
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//go:build dev

package internal

import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/deckhouse/virtualization/api/core/v1alpha2"
)

var _ = Describe("Phase transitions in dev build", func() {
It("appends and keeps the latest five transitions", func() {
transitions := []v1alpha2.VirtualMachinePhaseTransitionTimestamp{
{Phase: v1alpha2.MachinePending, Timestamp: metav1.Now()},
{Phase: v1alpha2.MachineStarting, Timestamp: metav1.Now()},
{Phase: v1alpha2.MachineRunning, Timestamp: metav1.Now()},
{Phase: v1alpha2.MachineStopping, Timestamp: metav1.Now()},
{Phase: v1alpha2.MachineStopped, Timestamp: metav1.Now()},
}

updated := NewPhaseTransitions(transitions, v1alpha2.MachineStopped, v1alpha2.MachinePending)

Expect(updated).To(HaveLen(5))
Expect(updated[0].Phase).To(Equal(v1alpha2.MachineStarting))
Expect(updated[4].Phase).To(Equal(v1alpha2.MachinePending))
Expect(updated[4].Timestamp.IsZero()).To(BeFalse())
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//go:build !dev

package internal

import "github.com/deckhouse/virtualization/api/core/v1alpha2"

func NewPhaseTransitions([]v1alpha2.VirtualMachinePhaseTransitionTimestamp, v1alpha2.MachinePhase, v1alpha2.MachinePhase) []v1alpha2.VirtualMachinePhaseTransitionTimestamp {
return nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//go:build !dev

package internal

import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/deckhouse/virtualization/api/core/v1alpha2"
)

var _ = Describe("Phase transitions in release build", func() {
It("drops transition history", func() {
transitions := []v1alpha2.VirtualMachinePhaseTransitionTimestamp{
{Phase: v1alpha2.MachinePending, Timestamp: metav1.Now()},
}

Expect(NewPhaseTransitions(transitions, v1alpha2.MachinePending, v1alpha2.MachineRunning)).To(BeNil())
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -374,17 +374,3 @@ func osInfoIsEmpty(info virtv1.VirtualMachineInstanceGuestOSInfo) bool {
return emptyOSInfo == info
}

func NewPhaseTransitions(phaseTransitions []v1alpha2.VirtualMachinePhaseTransitionTimestamp, oldPhase, newPhase v1alpha2.MachinePhase) []v1alpha2.VirtualMachinePhaseTransitionTimestamp {
now := metav1.NewTime(time.Now().Truncate(time.Second))

if oldPhase != newPhase {
phaseTransitions = append(phaseTransitions, v1alpha2.VirtualMachinePhaseTransitionTimestamp{
Phase: newPhase,
Timestamp: now,
})
}
if len(phaseTransitions) > 5 {
return phaseTransitions[len(phaseTransitions)-5:]
}
return phaseTransitions
}
8 changes: 6 additions & 2 deletions images/virtualization-artifact/werf.inc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,15 @@ shell:
- |
echo "Build virtualization-controller binary"
{{- $_ := set $ "ProjectName" (list $.ImageName "virtualization-controller" | join "/") }}
{{- $controllerBuildTags := .MODULE_EDITION -}}
{{- if eq .MODULE_BUILD_PROFILE "dev" -}}
{{- $controllerBuildTags = printf "%s,dev" .MODULE_EDITION -}}
{{- end }}

{{- if eq $.DEBUG_COMPONENT "delve/virtualization-controller" }}
go build -tags {{ .MODULE_EDITION }} -v -a -o /out/virtualization-controller ./cmd/virtualization-controller
go build -tags {{ $controllerBuildTags }} -v -a -o /out/virtualization-controller ./cmd/virtualization-controller
{{- else }}
{{- $buildCommand := printf "go build -ldflags=\"-s -w\" -tags %s -v -a -o /out/virtualization-controller ./cmd/virtualization-controller" .MODULE_EDITION -}}
{{- $buildCommand := printf "go build -ldflags=\"-s -w\" -tags %s -v -a -o /out/virtualization-controller ./cmd/virtualization-controller" $controllerBuildTags -}}
{{- include "image-build.build" (set $ "BuildCommand" $buildCommand) | nindent 4 }}
{{- end }}

Expand Down
1 change: 1 addition & 0 deletions werf-giterminism.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ config:
- SOURCE_REPO
- SOURCE_REPO_GIT
- MODULE_EDITION
- MODULE_BUILD_PROFILE
- DISTRO_PACKAGES_PROXY
- SVACE_ENABLED
- SVACE_ANALYZE_HOST
Expand Down
Loading
Loading