Skip to content

Commit 00e208e

Browse files
author
Matt Bargenquast
authored
Migrate aws-account-operator to OSDKv1 (#725)
* OSD-11799 OperatorSDKv1 Migration pre-boilerplate * OSD-11799 OperatorSDKv1 Migration post-boilerplate * OSD-11799 OperatorSDKv1 Migration test-case fixes * OSD-11799 OperatorSDKv1 migration regenerate API * OSD-11799 Fix fakeclient deprecation warnings * OSD-11799 OperatorSDKv1 Migration set max reconciles * OSD-11799 Use ControllerWithMetrics reconcilers * OSD-11799 Further OperatorSDKv1 migration changes * Correct issue in initializing validation controller
1 parent 666f6cd commit 00e208e

File tree

94 files changed

+3326
-2393
lines changed

Some content is hidden

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

94 files changed

+3326
-2393
lines changed

Diff for: .dockerignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
2+
# Ignore build and test binaries.
3+
bin/
4+
testbin/

Diff for: Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ predeploy: predeploy-aws-account-operator deploy-aws-account-operator-credential
286286

287287
.PHONY: deploy-local
288288
deploy-local: ## Deploy Operator locally
289-
@FORCE_DEV_MODE=local ${OPERATOR_SDK} run --local --watch-namespace=$(OPERATOR_NAMESPACE) --operator-flags "--zap-devel"
289+
@FORCE_DEV_MODE=local OPERATOR_NAMESPACE="$(OPERATOR_NAMESPACE)" WATCH_NAMESPACE="$(OPERATOR_NAMESPACE)" go run ./main.go --zap-devel
290290

291291
.PHONY: deploy-local-debug
292292
deploy-local-debug: ## Deploy Operator locally with Delve enabled
@@ -439,7 +439,7 @@ test-fake-accountclaim: create-fake-accountclaim-namespace create-fake-accountcl
439439

440440
.PHONY: test-apis
441441
test-apis:
442-
@pushd pkg/apis; \
442+
@pushd api; \
443443
go test ./... ; \
444444
popd
445445

Diff for: PROJECT

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
domain: managed.openshift.io
2+
layout:
3+
- go.kubebuilder.io/v3
4+
plugins:
5+
manifests.sdk.operatorframework.io/v2: {}
6+
scorecard.sdk.operatorframework.io/v2: {}
7+
projectName: aws-account-migrate
8+
repo: github.com/openshift/aws-account-operator
9+
resources:
10+
- api:
11+
crdVersion: v1
12+
namespaced: true
13+
controller: true
14+
domain: managed.openshift.io
15+
group: aws
16+
kind: AWSFederatedAccountAccess
17+
path: github.com/openshift/aws-account-operator/api/v1alpha1
18+
version: v1alpha1
19+
- api:
20+
crdVersion: v1
21+
namespaced: true
22+
controller: true
23+
domain: managed.openshift.io
24+
group: aws
25+
kind: AccountClaim
26+
path: github.com/openshift/aws-account-operator/api/v1alpha1
27+
version: v1alpha1
28+
- api:
29+
crdVersion: v1
30+
namespaced: true
31+
controller: true
32+
domain: managed.openshift.io
33+
group: aws
34+
kind: AWSFederatedRole
35+
path: github.com/openshift/aws-account-operator/api/v1alpha1
36+
version: v1alpha1
37+
- api:
38+
crdVersion: v1
39+
namespaced: true
40+
controller: true
41+
domain: managed.openshift.io
42+
group: aws
43+
kind: AccountPool
44+
path: github.com/openshift/aws-account-operator/api/v1alpha1
45+
version: v1alpha1
46+
- api:
47+
crdVersion: v1
48+
namespaced: true
49+
controller: true
50+
domain: managed.openshift.io
51+
group: aws
52+
kind: Account
53+
path: github.com/openshift/aws-account-operator/api/v1alpha1
54+
version: v1alpha1
55+
version: "3"

Diff for: pkg/apis/addtoscheme_aws_v1alpha1.go renamed to api/addtoscheme_aws_v1alpha1.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package apis
1+
package api
22

33
import (
4-
"github.com/openshift/aws-account-operator/pkg/apis/aws/v1alpha1"
4+
"github.com/openshift/aws-account-operator/api/v1alpha1"
55
)
66

77
func init() {

Diff for: pkg/apis/apis.go renamed to api/apis.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package apis
1+
package api
22

33
import (
44
"k8s.io/apimachinery/pkg/runtime"

Diff for: api/go.mod

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
module github.com/openshift/aws-account-operator/api
2+
3+
go 1.17
4+
5+
require (
6+
k8s.io/api v0.24.0
7+
k8s.io/apimachinery v0.24.0
8+
k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42
9+
sigs.k8s.io/controller-runtime v0.12.1
10+
)
11+
12+
require (
13+
github.com/PuerkitoBio/purell v1.1.1 // indirect
14+
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
15+
github.com/emicklei/go-restful v2.9.5+incompatible // indirect
16+
github.com/go-logr/logr v1.2.0 // indirect
17+
github.com/go-openapi/jsonpointer v0.19.5 // indirect
18+
github.com/go-openapi/jsonreference v0.19.5 // indirect
19+
github.com/go-openapi/swag v0.19.14 // indirect
20+
github.com/gogo/protobuf v1.3.2 // indirect
21+
github.com/google/gofuzz v1.1.0 // indirect
22+
github.com/josharian/intern v1.0.0 // indirect
23+
github.com/json-iterator/go v1.1.12 // indirect
24+
github.com/mailru/easyjson v0.7.6 // indirect
25+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
26+
github.com/modern-go/reflect2 v1.0.2 // indirect
27+
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
28+
golang.org/x/text v0.3.7 // indirect
29+
gopkg.in/inf.v0 v0.9.1 // indirect
30+
gopkg.in/yaml.v2 v2.4.0 // indirect
31+
k8s.io/klog/v2 v2.60.1 // indirect
32+
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
33+
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
34+
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
35+
)

Diff for: api/go.sum

+935
Large diffs are not rendered by default.

Diff for: pkg/apis/aws/v1alpha1/account_types.go renamed to api/v1alpha1/account_types.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ type AccountStatus struct {
5454
}
5555

5656
// AccountCondition contains details for the current condition of a AWS account
57+
// +k8s:openapi-gen=true
5758
type AccountCondition struct {
5859
// Type is the type of the condition.
5960
// +optional
@@ -113,7 +114,7 @@ const (
113114
)
114115

115116
// +genclient
116-
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
117+
// +kubebuilder:object:root=true
117118

118119
// Account is the Schema for the accounts API
119120
// +k8s:openapi-gen=true
@@ -131,7 +132,7 @@ type Account struct {
131132
Status AccountStatus `json:"status,omitempty"`
132133
}
133134

134-
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
135+
// +kubebuilder:object:root=true
135136

136137
// AccountList contains a list of Account
137138
type AccountList struct {
File renamed without changes.

Diff for: pkg/apis/aws/v1alpha1/accountclaim_types.go renamed to api/v1alpha1/accountclaim_types.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const (
9494
)
9595

9696
// +genclient
97-
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
97+
// +kubebuilder:object:root=true
9898

9999
// AccountClaim is the Schema for the accountclaims API
100100
// +k8s:openapi-gen=true
@@ -111,7 +111,7 @@ type AccountClaim struct {
111111
Status AccountClaimStatus `json:"status,omitempty"`
112112
}
113113

114-
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
114+
// +kubebuilder:object:root=true
115115

116116
// AccountClaimList contains a list of AccountClaim
117117
type AccountClaimList struct {

Diff for: pkg/apis/aws/v1alpha1/accountpool_types.go renamed to api/v1alpha1/accountpool_types.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type AccountPoolStatus struct {
3535
}
3636

3737
// +genclient
38-
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
38+
// +kubebuilder:object:root=true
3939

4040
// AccountPool is the Schema for the accountpools API
4141
// +k8s:openapi-gen=true
@@ -55,7 +55,7 @@ type AccountPool struct {
5555
Status AccountPoolStatus `json:"status,omitempty"`
5656
}
5757

58-
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
58+
// +kubebuilder:object:root=true
5959

6060
// AccountPoolList contains a list of AccountPool
6161
type AccountPoolList struct {

Diff for: pkg/apis/aws/v1alpha1/awsfederatedaccountaccess_types.go renamed to api/v1alpha1/awsfederatedaccountaccess_types.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ type AWSFederatedRoleRef struct {
8585
Namespace string `json:"namespace"`
8686
}
8787

88-
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
88+
// +kubebuilder:object:root=true
8989

9090
// AWSFederatedAccountAccess is the Schema for the awsfederatedaccountaccesses API
9191
// +k8s:openapi-gen=true
@@ -101,7 +101,7 @@ type AWSFederatedAccountAccess struct {
101101
Status AWSFederatedAccountAccessStatus `json:"status,omitempty"`
102102
}
103103

104-
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
104+
// +kubebuilder:object:root=true
105105

106106
// AWSFederatedAccountAccessList contains a list of AWSFederatedAccountAccess
107107
type AWSFederatedAccountAccessList struct {

Diff for: pkg/apis/aws/v1alpha1/awsfederatedrole_types.go renamed to api/v1alpha1/awsfederatedrole_types.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ const (
103103
AWSFederatedRoleInvalid AWSFederatedRoleConditionType = "Invalid"
104104
)
105105

106-
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
106+
// +kubebuilder:object:root=true
107107

108108
// AWSFederatedRole is the Schema for the awsfederatedroles API
109109
// +k8s:openapi-gen=true
@@ -119,7 +119,7 @@ type AWSFederatedRole struct {
119119
Status AWSFederatedRoleStatus `json:"status,omitempty"`
120120
}
121121

122-
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
122+
// +kubebuilder:object:root=true
123123

124124
// AWSFederatedRoleList contains a list of AWSFederatedRole
125125
type AWSFederatedRoleList struct {

Diff for: api/v1alpha1/groupversion_info.go

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Package v1alpha1 contains API Schema definitions for the aws v1alpha1 API group
2+
//+kubebuilder:object:generate=true
3+
//+groupName=aws.managed.openshift.io
4+
package v1alpha1
5+
6+
import (
7+
"k8s.io/apimachinery/pkg/runtime/schema"
8+
"sigs.k8s.io/controller-runtime/pkg/scheme"
9+
)
10+
11+
var (
12+
// GroupVersion is group version used to register these objects
13+
GroupVersion = schema.GroupVersion{Group: "aws.managed.openshift.io", Version: "v1alpha1"}
14+
15+
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
16+
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
17+
18+
// AddToScheme adds the types in this group-version to the given scheme.
19+
AddToScheme = SchemeBuilder.AddToScheme
20+
)
File renamed without changes.

0 commit comments

Comments
 (0)