Skip to content

Commit e6bf195

Browse files
authored
Merge pull request #62 from sp-yduck/feature/owner-reference
set ownerref to secret
2 parents 18f3786 + 2f094e4 commit e6bf195

File tree

8 files changed

+202
-173
lines changed

8 files changed

+202
-173
lines changed

.github/workflows/golangci-lint.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: golangci-lint
22

33
on:
44
pull_request:
5-
types: [opened, edited, synchronize, reopened]
5+
types: [opened, synchronize, reopened]
66

77
# Remove all permissions from GITHUB_TOKEN except metadata.
88
permissions: {}
@@ -15,10 +15,10 @@ jobs:
1515
- uses: actions/checkout@v3
1616
- uses: actions/setup-go@v4
1717
with:
18-
go-version: 1.19
18+
go-version: 1.20.5
1919
check-latest: true
2020
- name: golangci-lint
2121
uses: golangci/golangci-lint-action@v3.4.0
2222
with:
23-
version: v1.52.2
23+
version: v1.53.3
2424
args: --timeout 5m

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ fmt: ## Run go fmt against code.
5757
vet: ## Run go vet against code.
5858
go vet ./...
5959

60+
.PHONY: lint
61+
lint: ## Run golangci-lint
62+
$(GOLANGCI_LINT) run
63+
6064
CLUSTER_NAME := cappx-test
6165

6266
.PHONY: create-workload-cluster
@@ -180,6 +184,7 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
180184
ENVTEST ?= $(LOCALBIN)/setup-envtest
181185
ENVSUBST ?= $(LOCALBIN)/envsubst
182186
KUBECTL ?= $(LOCALBIN)/kubectl
187+
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint
183188

184189
## Tool Versions
185190
KUSTOMIZE_VERSION ?= v5.0.0
@@ -222,4 +227,9 @@ $(KUBECTL): $(LOCALBIN)
222227
.PHONY: setup-envtest
223228
setup-envtest: $(SETUP_ENVTEST)
224229
$(SETUP_ENVTEST): go.mod # Build setup-envtest from tools folder.
225-
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@$(SETUP_ENVTEST_VER)
230+
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@$(SETUP_ENVTEST_VER)
231+
232+
.PHONY: golangci-lint
233+
golangci-lint: $(GOLANGCI_LINT)
234+
$(GOLANGCI_LINT): $(LOCALBIN)
235+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(LOCALBIN) v1.54.0

api/v1beta1/options_types.go

Lines changed: 165 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -1,165 +1,165 @@
1-
package v1beta1
2-
3-
import "strconv"
4-
5-
// import "encoding/json"
6-
7-
// +kubebuilder:validation:Enum:=x86_64;aarch64
8-
type Arch string
9-
10-
// +kubebuilder:validation:Enum:=seabios;ovmf
11-
type BIOS string
12-
13-
// +kubebuilder:validation:Enum:=0;2;1024
14-
type HugePages int
15-
16-
// +kubebuilder:validation:Enum:=backup;clone;create;migrate;rollback;snapshot;snapshot-delete;suspending;suspended
17-
type Lock string
18-
19-
// +kubebuilder:validation:Enum:=other;wxp;w2k;w2k3;w2k8;wvista;win7;win8;win10;win11;l24;l26;solaris
20-
type OSType string
21-
22-
// +kubebuilder:validation:Pattern:="[a-zA-Z0-9-_.;]+"
23-
type Tag string
24-
25-
type Tags []Tag
26-
27-
func (h *HugePages) String() string {
28-
if h == nil {
29-
return ""
30-
} else if *h == 0 {
31-
return "any"
32-
}
33-
return strconv.Itoa(int(*h))
34-
}
35-
36-
func (t *Tags) String() string {
37-
var tags string
38-
for _, tag := range *t {
39-
tags += string(tag) + ";"
40-
}
41-
return tags
42-
}
43-
44-
// Options
45-
type Options struct {
46-
// Enable/Disable ACPI. Defaults to true.
47-
ACPI bool `json:"acpi,omitempty"`
48-
49-
// Virtual processor architecture. Defaults to the host. x86_64 or aarch64.
50-
Arch Arch `json:"arch,omitempty"`
51-
52-
// +kubebuilder:validation:Minimum:=0
53-
// Amount of target RAM for the VM in MiB. Using zero disables the ballon driver.
54-
Balloon int `json:"balloon,omitempty"`
55-
56-
// Description for the VM. Shown in the web-interface VM's summary.
57-
// This is saved as comment inside the configuration file.
58-
Description string `json:"description,omitempty"`
59-
60-
// Script that will be executed during various steps in the vms lifetime.
61-
// HookScripts []Hookscript `json:"hookScripts,omitempty"`
62-
63-
// enable hotplug feature. list og devices.
64-
// network, disk, cpu, memory, usb. Defaults to [network, disk, usb].
65-
// HotPlug []HotPlugDevice `json:"hotPlug,omitempty"`
66-
67-
// enable/disable hugepages memory. 0 or 2 or 1024. 0 indicated 'any'
68-
HugePages *HugePages `json:"hugePages,omitempty"`
69-
70-
// Use together with hugepages. If enabled, hugepages will not not be deleted
71-
// after VM shutdown and can be used for subsequent starts. Defaults to false.
72-
KeepHugePages bool `json:"keepHugePages,omitempty"`
73-
74-
// Enable/disable KVM hardware virtualization. Defaults to true.
75-
KVM bool `json:"kvm,omitempty"`
76-
77-
// Set the real time clock (RTC) to local time.
78-
// This is enabled by default if the `ostype` indicates a Microsoft Windows OS.
79-
LocalTime bool `json:"localTime,omitempty"`
80-
81-
// Lock/unlock the VM.
82-
Lock Lock `json:"lock,omitempty"`
83-
84-
// Set maximum tolerated downtime (in seconds) for migrations.
85-
// MigrateDowntime json.Number `json:"migrateDowntime,omitempty"`
86-
87-
// Set maximum speed (in MB/s) for migrations. Value 0 is no limit.
88-
// MigrateSpeed `json:"migrateSpeed,omitempty"`
89-
90-
// Enable/disable NUMA.
91-
NUMA bool `json:"numa,omitempty"`
92-
93-
// Specifies whether a VM will be started during system bootup.
94-
OnBoot bool `json:"onBoot,omitempty"`
95-
96-
// Specify guest operating system. This is used to enable special
97-
// optimization/features for specific operating systems.
98-
OSType OSType `json:"osType,omitempty"`
99-
100-
// Sets the protection flag of the VM.
101-
// This will disable the remove VM and remove disk operations.
102-
// Defaults to false.
103-
Protection bool `json:"protection,omitempty"`
104-
105-
// Allow reboot. If set to 'false' the VM exit on reboot.
106-
// Defaults to true.
107-
Reboot bool `json:"reboot,omitempty"`
108-
109-
// +kubebuilder:validation:Minimum:=0
110-
// +kubebuilder:validation:Maximum:=5000
111-
// Amount of memory shares for auto-ballooning. The larger the number is, the more memory this VM gets.
112-
// Number is relative to weights of all other running VMs. Using zero disables auto-ballooning.
113-
// Auto-ballooning is done by pvestatd. 0 ~ 5000. Defaults to 1000.
114-
Shares int `json:"shares,omitempty"`
115-
116-
// Set the initial date of the real time clock.
117-
// Valid format for date are:'now' or '2006-06-17T16:01:21' or '2006-06-17'.
118-
// Defaults to 'now'.
119-
// StartDate string `json:"startDate,omitempty"`
120-
121-
// StartUp string `json:"startUp,omitempty`
122-
123-
// Enable/disable the USB tablet device. This device is usually needed to allow
124-
// absolute mouse positioning with VNC. Else the mouse runs out of sync with normal VNC clients.
125-
// If you're running lots of console-only guests on one host,
126-
// you may consider disabling this to save some context switches.
127-
// This is turned off by default if you use spice (`qm set <vmid> --vga qxl`).
128-
// Defaults to true.
129-
Tablet bool `json:"tablet,omitempty"`
130-
131-
// Tags of the VM. This is only meta information.
132-
Tags Tags `json:"tags,omitempty"`
133-
134-
// Enable/disable time drift fix. Defaults to false.
135-
TimeDriftFix bool `json:"timeDriftFix,omitempty"`
136-
137-
// Enable/disable Template. Defaults to false.
138-
Template bool `json:"template,omitempty"`
139-
140-
// TPMState string `json:"tpmState,omitempty"`
141-
142-
// +kubebuilder:validation:Minimum:=0
143-
// Number of hotplugged vcpus. Defaults to 0.
144-
VCPUs int `json:"vcpus,omitempty"`
145-
146-
// VGA string `json:"vga,omitempty"`
147-
148-
// +kubebuilder:validation:Pattern:="(?:[a-fA-F0-9]{8}(?:-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}|[01])"
149-
// The VM generation ID (vmgenid) device exposes a 128-bit integer value identifier to the guest OS.
150-
// This allows to notify the guest operating system when the virtual machine is executed with a different configuration
151-
// (e.g. snapshot execution or creation from a template).
152-
// The guest operating system notices the change, and is then able to react as appropriate by marking its copies of distributed databases as dirty,
153-
// re-initializing its random number generator, etc.
154-
// Note that auto-creation only works when done through API/CLI create or update methods, but not when manually editing the config file.
155-
// regex: (?:[a-fA-F0-9]{8}(?:-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}|[01]). Defaults to 1 (autogenerated)
156-
VMGenerationID string `json:"vmGenerationID,omitempty"`
157-
158-
// Default storage for VM state volumes/files.
159-
// VMStateStorage string `json:"vmStateStorage,omitempty"`
160-
161-
// Create a virtual hardware watchdog device. Once enabled (by a guest action),
162-
// the watchdog must be periodically polled by an agent inside the guest or else
163-
// the watchdog will reset the guest (or execute the respective action specified)
164-
// WatchDog string `json:"watchDog,omitempty"`
165-
}
1+
package v1beta1
2+
3+
import "strconv"
4+
5+
// import "encoding/json"
6+
7+
// +kubebuilder:validation:Enum:=x86_64;aarch64
8+
type Arch string
9+
10+
// +kubebuilder:validation:Enum:=seabios;ovmf
11+
type BIOS string
12+
13+
// +kubebuilder:validation:Enum:=0;2;1024
14+
type HugePages int
15+
16+
// +kubebuilder:validation:Enum:=backup;clone;create;migrate;rollback;snapshot;snapshot-delete;suspending;suspended
17+
type Lock string
18+
19+
// +kubebuilder:validation:Enum:=other;wxp;w2k;w2k3;w2k8;wvista;win7;win8;win10;win11;l24;l26;solaris
20+
type OSType string
21+
22+
// +kubebuilder:validation:Pattern:="[a-zA-Z0-9-_.;]+"
23+
type Tag string
24+
25+
type Tags []Tag
26+
27+
func (h *HugePages) String() string {
28+
if h == nil {
29+
return ""
30+
} else if *h == 0 {
31+
return "any"
32+
}
33+
return strconv.Itoa(int(*h))
34+
}
35+
36+
func (t *Tags) String() string {
37+
var tags string
38+
for _, tag := range *t {
39+
tags += string(tag) + ";"
40+
}
41+
return tags
42+
}
43+
44+
// Options
45+
type Options struct {
46+
// Enable/Disable ACPI. Defaults to true.
47+
ACPI bool `json:"acpi,omitempty"`
48+
49+
// Virtual processor architecture. Defaults to the host. x86_64 or aarch64.
50+
Arch Arch `json:"arch,omitempty"`
51+
52+
// +kubebuilder:validation:Minimum:=0
53+
// Amount of target RAM for the VM in MiB. Using zero disables the ballon driver.
54+
Balloon int `json:"balloon,omitempty"`
55+
56+
// Description for the VM. Shown in the web-interface VM's summary.
57+
// This is saved as comment inside the configuration file.
58+
Description string `json:"description,omitempty"`
59+
60+
// Script that will be executed during various steps in the vms lifetime.
61+
// HookScripts []Hookscript `json:"hookScripts,omitempty"`
62+
63+
// enable hotplug feature. list og devices.
64+
// network, disk, cpu, memory, usb. Defaults to [network, disk, usb].
65+
// HotPlug []HotPlugDevice `json:"hotPlug,omitempty"`
66+
67+
// enable/disable hugepages memory. 0 or 2 or 1024. 0 indicated 'any'
68+
HugePages *HugePages `json:"hugePages,omitempty"`
69+
70+
// Use together with hugepages. If enabled, hugepages will not not be deleted
71+
// after VM shutdown and can be used for subsequent starts. Defaults to false.
72+
KeepHugePages bool `json:"keepHugePages,omitempty"`
73+
74+
// Enable/disable KVM hardware virtualization. Defaults to true.
75+
KVM bool `json:"kvm,omitempty"`
76+
77+
// Set the real time clock (RTC) to local time.
78+
// This is enabled by default if the `ostype` indicates a Microsoft Windows OS.
79+
LocalTime bool `json:"localTime,omitempty"`
80+
81+
// Lock/unlock the VM.
82+
Lock Lock `json:"lock,omitempty"`
83+
84+
// Set maximum tolerated downtime (in seconds) for migrations.
85+
// MigrateDowntime json.Number `json:"migrateDowntime,omitempty"`
86+
87+
// Set maximum speed (in MB/s) for migrations. Value 0 is no limit.
88+
// MigrateSpeed `json:"migrateSpeed,omitempty"`
89+
90+
// Enable/disable NUMA.
91+
NUMA bool `json:"numa,omitempty"`
92+
93+
// Specifies whether a VM will be started during system bootup.
94+
OnBoot bool `json:"onBoot,omitempty"`
95+
96+
// Specify guest operating system. This is used to enable special
97+
// optimization/features for specific operating systems.
98+
OSType OSType `json:"osType,omitempty"`
99+
100+
// Sets the protection flag of the VM.
101+
// This will disable the remove VM and remove disk operations.
102+
// Defaults to false.
103+
Protection bool `json:"protection,omitempty"`
104+
105+
// Allow reboot. If set to 'false' the VM exit on reboot.
106+
// Defaults to true.
107+
Reboot bool `json:"reboot,omitempty"`
108+
109+
// +kubebuilder:validation:Minimum:=0
110+
// +kubebuilder:validation:Maximum:=5000
111+
// Amount of memory shares for auto-ballooning. The larger the number is, the more memory this VM gets.
112+
// Number is relative to weights of all other running VMs. Using zero disables auto-ballooning.
113+
// Auto-ballooning is done by pvestatd. 0 ~ 5000. Defaults to 1000.
114+
Shares int `json:"shares,omitempty"`
115+
116+
// Set the initial date of the real time clock.
117+
// Valid format for date are:'now' or '2006-06-17T16:01:21' or '2006-06-17'.
118+
// Defaults to 'now'.
119+
// StartDate string `json:"startDate,omitempty"`
120+
121+
// StartUp string `json:"startUp,omitempty`
122+
123+
// Enable/disable the USB tablet device. This device is usually needed to allow
124+
// absolute mouse positioning with VNC. Else the mouse runs out of sync with normal VNC clients.
125+
// If you're running lots of console-only guests on one host,
126+
// you may consider disabling this to save some context switches.
127+
// This is turned off by default if you use spice (`qm set <vmid> --vga qxl`).
128+
// Defaults to true.
129+
Tablet bool `json:"tablet,omitempty"`
130+
131+
// Tags of the VM. This is only meta information.
132+
Tags Tags `json:"tags,omitempty"`
133+
134+
// Enable/disable time drift fix. Defaults to false.
135+
TimeDriftFix bool `json:"timeDriftFix,omitempty"`
136+
137+
// Enable/disable Template. Defaults to false.
138+
Template bool `json:"template,omitempty"`
139+
140+
// TPMState string `json:"tpmState,omitempty"`
141+
142+
// +kubebuilder:validation:Minimum:=0
143+
// Number of hotplugged vcpus. Defaults to 0.
144+
VCPUs int `json:"vcpus,omitempty"`
145+
146+
// VGA string `json:"vga,omitempty"`
147+
148+
// +kubebuilder:validation:Pattern:="(?:[a-fA-F0-9]{8}(?:-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}|[01])"
149+
// The VM generation ID (vmgenid) device exposes a 128-bit integer value identifier to the guest OS.
150+
// This allows to notify the guest operating system when the virtual machine is executed with a different configuration
151+
// (e.g. snapshot execution or creation from a template).
152+
// The guest operating system notices the change, and is then able to react as appropriate by marking its copies of distributed databases as dirty,
153+
// re-initializing its random number generator, etc.
154+
// Note that auto-creation only works when done through API/CLI create or update methods, but not when manually editing the config file.
155+
// regex: (?:[a-fA-F0-9]{8}(?:-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}|[01]). Defaults to 1 (autogenerated)
156+
VMGenerationID string `json:"vmGenerationID,omitempty"`
157+
158+
// Default storage for VM state volumes/files.
159+
// VMStateStorage string `json:"vmStateStorage,omitempty"`
160+
161+
// Create a virtual hardware watchdog device. Once enabled (by a guest action),
162+
// the watchdog must be periodically polled by an agent inside the guest or else
163+
// the watchdog will reset the guest (or execute the respective action specified)
164+
// WatchDog string `json:"watchDog,omitempty"`
165+
}

0 commit comments

Comments
 (0)