Skip to content

Commit 5be0419

Browse files
committed
AUTOSCALE-283: Annotation logic for controller creation and test additions
Signed-off-by: Fisher Eskew <[email protected]>
1 parent ab1dc95 commit 5be0419

File tree

397 files changed

+227157
-7366
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

397 files changed

+227157
-7366
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ yamllint: ## Run yamllint against manifests.
135135
# TODO(macao): Future task to migrate to using envtest https://sdk.operatorframework.io/docs/building-operators/golang/testing/
136136
.PHONY: test
137137
test: manifests generate fmt vet envtest ## Run tests.
138-
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out
139-
138+
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -v -ginkgo.v -cover -coverprofile=cover.out
139+
140140
.PHONY: lint
141141
lint: golangci-lint ## Run golangci-lint.
142142
$(GOLANGCI_LINT) run
@@ -168,7 +168,7 @@ test-e2e:
168168
e2e-ci: KUBECTL=$(shell which oc) ## Run e2e tests in CI.
169169
e2e-ci: deploy test-e2e
170170

171-
## Run e2e tests locally. Assumes a running Kubernetes cluster (KUBECONFIG set), and the operator is deployed.
171+
## Run e2e tests locally. Assumes a running Kubernetes cluster (KUBECONFIG set). Automatically deploys the operator.
172172
.PHONY: e2e-local
173173
e2e-local: docker-build docker-push
174174
e2e-local: deploy test-e2e

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ Here are the individual checks:
166166

167167
`make test-scorecard` will run Operator SDK's scorecard tests. This requires a Kubernetes or OpenShift cluster to be available and configured in your environment. The tests will be run against the cluster.
168168

169-
`make test-e2e` will run the e2e tests for the operator. These tests assume the presence of a cluster not already running the operator, and that the KUBECONFIG environment variable points to a configuration granting admin rights on said cluster. It assumes the operator is already deployed. If not, the following commands can run the e2e steps in one command:
169+
`make test-e2e` will run the e2e tests for the operator. These tests assume the presence of a cluster already running the operator and that the KUBECONFIG environment variable points to a configuration granting admin rights on said cluster. It assumes the operator is already deployed. If the operator is not deployed, the following commands can deploy the operator and run the e2e steps in one command:
170170

171171
`make e2e-local` - Manually deploys the operator to the cluster, and runs the e2e tests. Requires:
172172

bundle/manifests/vertical-pod-autoscaler.clusterserviceversion.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ metadata:
4141
"apiVersion": "autoscaling.openshift.io/v1",
4242
"kind": "VerticalPodAutoscalerController",
4343
"metadata": {
44-
"name": "default"
44+
"name": "default",
45+
"namespace": "openshift-vertical-pod-autoscaler"
4546
},
4647
"spec": {
4748
"minReplicas": 2,
@@ -55,7 +56,7 @@ metadata:
5556
categories: OpenShift Optional
5657
certifiedLevel: Primed
5758
containerImage: quay.io/openshift/origin-vertical-pod-autoscaler-operator:4.20.0
58-
createdAt: "2025-07-23T17:03:26Z"
59+
createdAt: "2025-07-31T22:23:38Z"
5960
description: An operator to run the OpenShift Vertical Pod Autoscaler. Vertical
6061
Pod Autoscaler (VPA) can be configured to monitor a workload's resource utilization,
6162
and then adjust its CPU and memory limits by updating the pod (future) or restarting
@@ -238,6 +239,14 @@ spec:
238239
- services
239240
verbs:
240241
- '*'
242+
- apiGroups:
243+
- ""
244+
resources:
245+
- namespaces
246+
verbs:
247+
- get
248+
- list
249+
- patch
241250
- apiGroups:
242251
- apps
243252
resources:

config/rbac/role.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ rules:
1414
- services
1515
verbs:
1616
- '*'
17+
- apiGroups:
18+
- ""
19+
resources:
20+
- namespaces
21+
verbs:
22+
- get
23+
- list
24+
- patch
1725
- apiGroups:
1826
- apps
1927
resources:

config/samples/autoscaling_v1_verticalpodautoscalercontroller.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ apiVersion: autoscaling.openshift.io/v1
22
kind: VerticalPodAutoscalerController
33
metadata:
44
name: default
5+
namespace: openshift-vertical-pod-autoscaler
56
spec:
67
safetyMarginFraction: 0.15
78
podMinCPUMillicores: 25

config/testing/vpa_namespace.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: openshift-vertical-pod-autoscaler

go.mod

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@ toolchain go1.23.4
77
require (
88
github.com/blang/semver v3.5.1+incompatible
99
github.com/go-logr/logr v1.4.2
10+
github.com/manifestival/controller-runtime-client v0.4.0
11+
github.com/manifestival/manifestival v0.7.2
12+
github.com/onsi/ginkgo/v2 v2.21.0
13+
github.com/onsi/gomega v1.35.1
1014
github.com/openshift/api v0.0.0-20250108172834-78bd56dba39b
1115
github.com/openshift/client-go v0.0.0-20250106104058-89709a455e2a
1216
github.com/openshift/cluster-version-operator v1.0.1-0.20250106161255-e90705bb5457
13-
github.com/stretchr/testify v1.10.0
17+
go.uber.org/zap v1.27.0
1418
k8s.io/api v0.32.0
1519
k8s.io/apimachinery v0.32.0
1620
k8s.io/client-go v0.32.0
1721
k8s.io/klog v1.0.0
22+
k8s.io/klog/v2 v2.130.1
1823
k8s.io/utils v0.0.0-20241210054802-24370beab758
1924
sigs.k8s.io/controller-runtime v0.19.4
2025
sigs.k8s.io/yaml v1.4.0
@@ -40,12 +45,14 @@ require (
4045
github.com/go-openapi/jsonpointer v0.21.0 // indirect
4146
github.com/go-openapi/jsonreference v0.21.0 // indirect
4247
github.com/go-openapi/swag v0.23.0 // indirect
48+
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
4349
github.com/gogo/protobuf v1.3.2 // indirect
4450
github.com/golang/protobuf v1.5.4 // indirect
4551
github.com/google/cel-go v0.22.0 // indirect
4652
github.com/google/gnostic-models v0.6.9 // indirect
4753
github.com/google/go-cmp v0.6.0 // indirect
4854
github.com/google/gofuzz v1.2.0 // indirect
55+
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db // indirect
4956
github.com/google/uuid v1.6.0 // indirect
5057
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
5158
github.com/inconshreveable/mousetrap v1.1.0 // indirect
@@ -58,7 +65,6 @@ require (
5865
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
5966
github.com/operator-framework/api v0.17.1 // indirect
6067
github.com/pkg/errors v0.9.1 // indirect
61-
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
6268
github.com/prometheus/client_golang v1.20.5 // indirect
6369
github.com/prometheus/client_model v0.6.1 // indirect
6470
github.com/prometheus/common v0.61.0 // indirect
@@ -76,7 +82,6 @@ require (
7682
go.opentelemetry.io/otel/trace v1.28.0 // indirect
7783
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
7884
go.uber.org/multierr v1.11.0 // indirect
79-
go.uber.org/zap v1.27.0 // indirect
8085
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 // indirect
8186
golang.org/x/net v0.34.0 // indirect
8287
golang.org/x/oauth2 v0.25.0 // indirect
@@ -85,6 +90,7 @@ require (
8590
golang.org/x/term v0.28.0 // indirect
8691
golang.org/x/text v0.21.0 // indirect
8792
golang.org/x/time v0.9.0 // indirect
93+
golang.org/x/tools v0.29.0 // indirect
8894
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
8995
google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7 // indirect
9096
google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7 // indirect
@@ -96,7 +102,6 @@ require (
96102
k8s.io/apiextensions-apiserver v0.32.0 // indirect
97103
k8s.io/apiserver v0.32.0 // indirect
98104
k8s.io/component-base v0.32.0 // indirect
99-
k8s.io/klog/v2 v2.130.1 // indirect
100105
k8s.io/kube-openapi v0.0.0-20241212222426-2c72e554b1e7 // indirect
101106
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 // indirect
102107
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect

0 commit comments

Comments
 (0)