Skip to content

Commit 4328d77

Browse files
committed
align pao api and crd generation
1 parent 26d01e3 commit 4328d77

12 files changed

+491
-767
lines changed

Makefile

+10-7
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ TUNED_COMMIT:=682c47c0a9eb5596c2d396b6d0dae4e297414c50
1818
TUNED_DIR:=daemon
1919

2020
# API-related variables
21-
API_TYPES_DIR:=./pkg/apis/tuned/v1
22-
API_TYPES:=$(wildcard $(API_TYPES_DIR)/*_types.go)
21+
API_TYPES_DIR:=pkg/apis
2322
API_ZZ_GENERATED:=zz_generated.deepcopy
24-
API_TYPES_GENERATED:=$(API_TYPES_DIR)/$(API_ZZ_GENERATED).go
2523
API_GO_HEADER_FILE:=pkg/apis/header.go.txt
2624

2725
# Container image-related variables
@@ -35,6 +33,7 @@ IMAGE=$(REGISTRY)/$(ORG)/origin-cluster-node-tuning-operator:$(TAG)
3533

3634
# PAO variables
3735
CLUSTER ?= "ci"
36+
PAO_CRD_APIS :=$(addprefix ./pkg/apis/pao/,v2 v1 v1alpha1)
3837

3938
all: build
4039

@@ -52,21 +51,24 @@ clone-tuned:
5251
cd $(TUNED_DIR) && git checkout $(TUNED_COMMIT) && cd .. && \
5352
rm -rf $(TUNED_DIR)/.git)
5453

55-
build: $(BINDATA) pkg/generated
54+
build: $(BINDATA) generate-deepcopy pkg/generated
5655
$(GO_BUILD_RECIPE)
5756
ln -sf $(PACKAGE_BIN) $(OUT_DIR)/openshift-tuned
5857

5958
$(BINDATA): $(GOBINDATA_BIN) $(ASSETS)
6059
$(GOBINDATA_BIN) -mode 420 -modtime 1 -pkg manifests -o $(BINDATA) assets/...
6160
gofmt -s -w $(BINDATA)
6261

63-
pkg/generated: $(API_TYPES)
62+
generate-deepcopy:
6463
$(GO) run k8s.io/code-generator/cmd/deepcopy-gen \
65-
--input-dirs $(PACKAGE)/pkg/apis/tuned/v1 \
64+
--input-dirs $(PACKAGE)/$(API_TYPES_DIR)/tuned/v1,$(PACKAGE)/$(API_TYPES_DIR)/pao/v1alpha1,$(PACKAGE)/$(API_TYPES_DIR)/pao/v1,$(PACKAGE)/$(API_TYPES_DIR)/pao/v2 \
6665
-O $(API_ZZ_GENERATED) \
6766
--go-header-file $(API_GO_HEADER_FILE) \
6867
--bounding-dirs $(PACKAGE)/pkg/apis \
6968
--output-base tmp
69+
tar c tmp | tar x --strip-components=4
70+
71+
pkg/generated:
7072
$(GO) run k8s.io/code-generator/cmd/client-gen \
7173
--clientset-name versioned \
7274
--input-base '' \
@@ -133,7 +135,8 @@ local-image-push:
133135
# $2 - apis
134136
# $3 - manifests
135137
# $4 - output
136-
$(call add-crd-gen,tuned,$(API_TYPES_DIR),./manifests,./manifests)
138+
$(call add-crd-gen,tuned,./$(API_TYPES_DIR)/tuned/v1,./manifests,./manifests)
139+
$(call add-crd-gen,pao,$(PAO_CRD_APIS),./manifests,./manifests)
137140

138141
# This will include additional actions on the update and verify targets to ensure that profile patches are applied
139142
# to manifest files

cmd/cluster-node-tuning-operator/main.go

+8
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
"runtime"
88

99
apiconfigv1 "github.com/openshift/api/config/v1"
10+
performancev1 "github.com/openshift/cluster-node-tuning-operator/pkg/apis/pao/v1"
11+
performancev1alpha1 "github.com/openshift/cluster-node-tuning-operator/pkg/apis/pao/v1alpha1"
1012
performancev2 "github.com/openshift/cluster-node-tuning-operator/pkg/apis/pao/v2"
1113
paocontroller "github.com/openshift/cluster-node-tuning-operator/pkg/pao/controller"
1214
mcov1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
@@ -48,6 +50,8 @@ func init() {
4850
utilruntime.Must(tunedv1.AddToScheme(scheme))
4951
utilruntime.Must(mcov1.AddToScheme(scheme))
5052
utilruntime.Must(apiconfigv1.Install(scheme))
53+
utilruntime.Must(performancev1alpha1.AddToScheme(scheme))
54+
utilruntime.Must(performancev1.AddToScheme(scheme))
5155
utilruntime.Must(performancev2.AddToScheme(scheme))
5256
utilruntime.Must(olmv1alpha1.AddToScheme(scheme))
5357
utilruntime.Must(olmv1.AddToScheme(scheme))
@@ -137,6 +141,10 @@ func main() {
137141
webHookServer.CertName = webhookCertName
138142
webHookServer.KeyName = webhookKeyName
139143

144+
if err = (&performancev1.PerformanceProfile{}).SetupWebhookWithManager(mgr); err != nil {
145+
klog.Exitf("unable to create PerformanceProfile v1 webhook : %v", err)
146+
}
147+
140148
if err = (&performancev2.PerformanceProfile{}).SetupWebhookWithManager(mgr); err != nil {
141149
klog.Exitf("unable to create PerformanceProfile v2 webhook: %v", err)
142150
}

go.mod

-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module github.com/openshift/cluster-node-tuning-operator
33
go 1.17
44

55
require (
6-
//PAO
76
github.com/RHsyseng/operator-utils v0.0.0-20200213165520-1a022eb07a43
87
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f
98
github.com/coreos/ignition v0.35.0
@@ -17,11 +16,9 @@ require (
1716
github.com/openshift/api v0.0.0-20220110171111-997c316db5e1
1817
github.com/openshift/build-machinery-go v0.0.0-20211213093930-7e33a7eb4ce3
1918
github.com/openshift/client-go v0.0.0-20211209144617-7385dd6338e3
20-
//github.com/openshift/api v3.9.1-0.20191111211345-a27ff30ebf09+incompatible
2119
github.com/openshift/custom-resource-status v0.0.0-20200602122900-c002fd1547ca
2220
github.com/openshift/library-go v0.0.0-20211220195323-eca2c467c492
2321
github.com/openshift/machine-config-operator v0.0.1-0.20210514234214-c415ce6aed25
24-
//github.com/openshift/machine-config-operator v4.2.0-alpha.0.0.20190917115525-033375cbe820+incompatible
2522
github.com/operator-framework/api v0.10.7
2623
github.com/operator-framework/operator-lifecycle-manager v3.11.0+incompatible
2724
github.com/pkg/errors v0.9.1
@@ -41,7 +38,6 @@ require (
4138
k8s.io/kubelet v0.23.3
4239
k8s.io/kubernetes v0.23.3
4340
k8s.io/utils v0.0.0-20211116205334-6203023598ed
44-
//k8s.io/utils v0.0.0-20211116205334-6203023598ed
4541
kubevirt.io/qe-tools v0.1.6
4642
sigs.k8s.io/controller-runtime v0.11.0
4743
sigs.k8s.io/controller-tools v0.6.2
@@ -158,7 +154,6 @@ replace (
158154
k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.23.3
159155
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.23.3
160156
sigs.k8s.io/controller-runtime => sigs.k8s.io/controller-runtime v0.11.1
161-
//sigs.k8s.io/controller-tools => sigs.k8s.io/controller-tools v0.6.2
162157
sigs.k8s.io/controller-tools => sigs.k8s.io/controller-tools v0.7.0
163158
)
164159

@@ -167,11 +162,7 @@ replace (
167162
github.com/Azure/go-autorest => github.com/Azure/go-autorest v14.2.0+incompatible
168163
github.com/coreos/prometheus-operator => github.com/coreos/prometheus-operator v0.40.0
169164
github.com/mtrmac/gpgme => github.com/mtrmac/gpgme v0.1.1
170-
github.com/openshift/api => github.com/openshift/api v0.0.0-20220203140920-bfe251c51d2d // release-4.11
171-
github.com/openshift/client-go => github.com/openshift/client-go v0.0.0-20211209144617-7385dd6338e3 // release-4.11
172-
//github.com/openshift/library-go => github.com/openshift/library-go v0.0.0-20211208213416-9b73bdcf5d00 // release-4.8
173165
github.com/openshift/machine-config-operator => github.com/openshift/machine-config-operator v0.0.1-0.20220203091316-d3010b34d344 // release-4.11
174-
//golang.org/x/tools => golang.org/x/tools v0.0.0-20191206213732-070c9d21b343
175166
)
176167

177168
replace vbom.ml/util => github.com/fvbommel/util v0.0.0-20180919145318-efcd4e0f9787

go.sum

+4-2
Original file line numberDiff line numberDiff line change
@@ -602,8 +602,10 @@ github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/
602602
github.com/opencontainers/runtime-spec v1.0.3-0.20200929063507-e6143ca7d51d/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
603603
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
604604
github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8=
605-
github.com/openshift/api v0.0.0-20220203140920-bfe251c51d2d h1:WuD14VS4SFKKH5hKeYiHTswlEByICzMNvaZrDXUjZiY=
606-
github.com/openshift/api v0.0.0-20220203140920-bfe251c51d2d/go.mod h1:F/eU6jgr6Q2VhMu1mSpMmygxAELd7+BUxs3NHZ25jV4=
605+
github.com/openshift/api v0.0.0-20211209135129-c58d9f695577/go.mod h1:DoslCwtqUpr3d/gsbq4ZlkaMEdYqKxuypsDjorcHhME=
606+
github.com/openshift/api v0.0.0-20220110171111-997c316db5e1 h1:gvAPP+X17EZwlyim5d/KCmNng6zp+4fRxul0X2Z068A=
607+
github.com/openshift/api v0.0.0-20220110171111-997c316db5e1/go.mod h1:F/eU6jgr6Q2VhMu1mSpMmygxAELd7+BUxs3NHZ25jV4=
608+
github.com/openshift/build-machinery-go v0.0.0-20210712174854-1bb7fd1518d3/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE=
607609
github.com/openshift/build-machinery-go v0.0.0-20211213093930-7e33a7eb4ce3 h1:65oBhJYHzYK5VL0gF1eiYY37lLzyLZ47b9y5Kib1nf8=
608610
github.com/openshift/build-machinery-go v0.0.0-20211213093930-7e33a7eb4ce3/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE=
609611
github.com/openshift/client-go v0.0.0-20211209144617-7385dd6338e3 h1:SG1aqwleU6bGD0X4mhkTNupjVnByMYYuW4XbnCPavQU=

0 commit comments

Comments
 (0)