Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update Operator SDK version strategy #1250

Closed
Show file tree
Hide file tree
Changes from 2 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
7 changes: 6 additions & 1 deletion .dockerignore
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of creating new Makefile, we could just add our commands to end of the file, like this. This should avoid patching problems

Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Ignore build and test binaries.
bin/
testbin/

# OADP specific
*.md
blogs
bin
.vscode
.github
.devcontainer
Expand Down
36 changes: 29 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
bin/
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
bin
testbin/*
Dockerfile.cross

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Kubernetes Generated files - skip generated files, except for vendored files

!vendor/**/zz_generated.*

# editor and IDE paraphernalia
.idea
*.swp
*.swo
*~

# OADP specific
.vscode/
.idea/
tests/e2e/e2e.test
cover.out
.DS_Store
tests/e2e/templates/*.yaml
cache/ # `operator-sdk run bundle` caches files in this directory
*.test
# `operator-sdk run bundle` caches files in this directory
cache/
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Build the manager binary
FROM quay.io/konveyor/builder as builder
ARG TARGETOS
ARG TARGETARCH
# more changes needed, did not change afraid of breaks

WORKDIR /go/src/github.com/openshift/oadp-operator
# Copy the Go Modules manifests
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ operator-sdk:
# Download operator-sdk locally if does not exist
if [ ! -f $(OPERATOR_SDK) ]; then \
mkdir -p bin ;\
curl -Lo $(OPERATOR_SDK) https://github.com/operator-framework/operator-sdk/releases/download/v1.23.0/operator-sdk_$(shell go env GOOS)_$(shell go env GOARCH) ; \
curl -Lo $(OPERATOR_SDK) https://github.com/operator-framework/operator-sdk/releases/download/v1.32.0/operator-sdk_$(shell go env GOOS)_$(shell go env GOARCH) ; \
chmod +x $(OPERATOR_SDK); \
fi

Expand Down
27 changes: 25 additions & 2 deletions PROJECT
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
domain: quay.io
# Code generated by tool. DO NOT EDIT.
# This file is used to track the info used to scaffold your project
# and allow the plugins properly work.
# More info: https://book.kubebuilder.io/reference/project-config.html
domain: openshift.io
layout:
- go.kubebuilder.io/v3
plugins:
manifests.sdk.operatorframework.io/v2: {}
scorecard.sdk.operatorframework.io/v2: {}
projectName: oadp-operator
repo: github.com/openshift/oadp-operator
version: "3"
resources:
- api:
crdVersion: v1
namespaced: true
controller: true
domain: openshift.io
group: oadp
kind: DataProtectionApplication
path: github.com/openshift/oadp-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: openshift.io
group: oadp
kind: CloudStorage
path: github.com/openshift/oadp-operator/api/v1alpha1
version: v1alpha1
version: "3"
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
// TODO license header

package v1alpha1

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// CloudStorage types are APIs for automatic bucket creation at cloud providers if defined name do not exists.

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

type CloudStorage struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec CloudStorageSpec `json:"spec,omitempty"`
Status CloudStorageStatus `json:"status,omitempty"`
}

type CloudStorageProvider string

const (
Expand All @@ -26,6 +15,7 @@ const (
GCPBucketProvider CloudStorageProvider = CloudStorageProvider(DefaultPluginGCP)
)

// CloudStorageSpec defines the desired state of CloudStorage
type CloudStorageSpec struct {
// name is the name requested for the bucket (aws, gcp) or container (azure)
Name string `json:"name"`
Expand All @@ -48,18 +38,35 @@ type CloudStorageSpec struct {
// need storage account name and key to create azure container
// az storage container create -n <container-name> --account-name <storage-account-name> --account-key <storage-account-key>
// azure account key will use CreationSecret to store key and account name

}

// CloudStorageStatus defines the observed state of CloudStorage
type CloudStorageStatus struct {
Name string `json:"name"`
LastSynced *metav1.Time `json:"lastSyncTimestamp,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// CloudStorage types are APIs for automatic bucket creation at cloud providers if defined name do not exists.
type CloudStorage struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec CloudStorageSpec `json:"spec,omitempty"`
Status CloudStorageStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// CloudStorageList contains a list of CloudStorage
type CloudStorageList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []CloudStorage `json:"items"`
}

func init() {
SchemeBuilder.Register(&CloudStorage{}, &CloudStorageList{})
}
Original file line number Diff line number Diff line change
Expand Up @@ -288,16 +288,15 @@ type DataProtectionApplication struct {

//+kubebuilder:object:root=true

// DataProtectionApplicationList contains a list of Velero
// DataProtectionApplicationList contains a list of DataProtectionApplication
type DataProtectionApplicationList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []DataProtectionApplication `json:"items"`
}

// Default BackupImages behavior when nil to true
func (dpa *DataProtectionApplication) BackupImages() bool {
return dpa.Spec.BackupImages == nil || *dpa.Spec.BackupImages
func init() {
SchemeBuilder.Register(&DataProtectionApplication{}, &DataProtectionApplicationList{})
}

func (veleroConfig *VeleroConfig) HasFeatureFlag(flag string) bool {
Expand All @@ -309,8 +308,9 @@ func (veleroConfig *VeleroConfig) HasFeatureFlag(flag string) bool {
return false
}

func init() {
SchemeBuilder.Register(&DataProtectionApplication{}, &DataProtectionApplicationList{}, &CloudStorage{}, &CloudStorageList{})
// Default BackupImages behavior when nil to true
func (dpa *DataProtectionApplication) BackupImages() bool {
return dpa.Spec.BackupImages == nil || *dpa.Spec.BackupImages
}

// AutoCorrect is a collection of auto-correction functions for the DPA CR
Expand Down
2 changes: 0 additions & 2 deletions api/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "oadp.openshift.io", Version: "v1alpha1"}

Kind = "DataProtectionApplication"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we wanna add kind back and add to schemebuilder line 32?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think not, I believe this was used only as a constant here

if gvk.Group == oadpv1alpha1.GroupVersion.Group && gvk.Version == oadpv1alpha1.GroupVersion.Version && gvk.Kind == oadpv1alpha1.Kind {

I believe the kind is get from theses structs name https://github.com/openshift/oadp-operator/blob/master/api/v1alpha1/oadp_types.go#L281, in each file


// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

Expand Down
2 changes: 1 addition & 1 deletion build/Dockerfile.bundle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=oadp-operator
LABEL operators.operatorframework.io.bundle.channels.v1=stable
LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.23.0
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.32.0
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3

Expand Down
2 changes: 1 addition & 1 deletion bundle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=oadp-operator
LABEL operators.operatorframework.io.bundle.channels.v1=stable
LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.23.0
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.32.0
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3

Expand Down
35 changes: 13 additions & 22 deletions bundle/manifests/oadp-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ metadata:
categories: OpenShift Optional
certified: "false"
containerImage: quay.io/konveyor/oadp-operator:latest
createdAt: "2020-09-08T12:21:00Z"
createdAt: "2023-12-04T12:14:27Z"
description: OADP (OpenShift API for Data Protection) operator sets up and installs
Data Protection Applications on the OpenShift platform.
features.operators.openshift.io/cnf: "false"
Expand All @@ -170,7 +170,7 @@ metadata:
operators.openshift.io/infrastructure-features: '["Disconnected"]'
operators.openshift.io/valid-subscription: '["OpenShift Container Platform", "OpenShift
Platform Plus"]'
operators.operatorframework.io/builder: operator-sdk-v1.23.0
operators.operatorframework.io/builder: operator-sdk-v1.32.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/openshift/oadp-operator
support: Red Hat
Expand Down Expand Up @@ -272,20 +272,11 @@ spec:
displayName: LastValidationTime
path: lastValidationTime
version: v1
- description: The CloudStorage API automates the creation of a bucket for object
storage.
displayName: CloudStorage
- description: CloudStorage types are APIs for automatic bucket creation at cloud
providers if defined name do not exists.
displayName: Cloud Storage
kind: CloudStorage
name: cloudstorages.oadp.openshift.io
statusDescriptors:
- description: LastSyncTimestamp is the last time the contents of the CloudStorage
was synced
displayName: LastSyncTimestamp
path: lastSyncTimestamp
- description: Name is the name requested for the bucket (aws, gcp) or container
(azure)
displayName: Name
path: name
version: v1alpha1
- description: DataDownload represents a data download of a volume snapshot. There
is one DataDownload created per volume to be restored.
Expand Down Expand Up @@ -317,16 +308,10 @@ spec:
displayName: StartTimestamp
path: startTimestamp
version: v2alpha1
- description: DataProtectionApplication represents configuration to install a
data protection application to safely backup and restore, perform disaster
recovery and migrate Kubernetes cluster resources and persistent volumes.
displayName: DataProtectionApplication
- description: DataProtectionApplication is the Schema for the dpa API
displayName: Data Protection Application
kind: DataProtectionApplication
name: dataprotectionapplications.oadp.openshift.io
statusDescriptors:
- description: Conditions defines the observed state of DataProtectionApplication
displayName: Conditions
path: conditions
mateusoliveira43 marked this conversation as resolved.
Show resolved Hide resolved
version: v1alpha1
- description: DataUpload acts as the protocol between data mover plugins and
data mover controller for the datamover backup operation
Expand Down Expand Up @@ -813,6 +798,12 @@ spec:
serviceAccountName: velero
deployments:
- label:
app.kubernetes.io/component: manager
app.kubernetes.io/created-by: oadp-operator
app.kubernetes.io/instance: controller-manager
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: deployment
app.kubernetes.io/part-of: oadp-operator
control-plane: controller-manager
name: openshift-adp-controller-manager
spec:
Expand Down
4 changes: 4 additions & 0 deletions bundle/manifests/oadp.openshift.io_cloudstorages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ spec:
- name: v1alpha1
schema:
openAPIV3Schema:
description: CloudStorage types are APIs for automatic bucket creation at
cloud providers if defined name do not exists.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand All @@ -31,6 +33,7 @@ spec:
metadata:
type: object
spec:
description: CloudStorageSpec defines the desired state of CloudStorage
properties:
creationSecret:
description: creationSecret is the secret that is needed to be used
Expand Down Expand Up @@ -78,6 +81,7 @@ spec:
- provider
type: object
status:
description: CloudStorageStatus defines the observed state of CloudStorage
properties:
lastSyncTimestamp:
format: date-time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ kind: Service
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/component: kube-rbac-proxy
app.kubernetes.io/created-by: oadp-operator
app.kubernetes.io/instance: controller-manager-metrics-service
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: service
app.kubernetes.io/part-of: oadp-operator
control-plane: controller-manager
name: openshift-adp-controller-manager-metrics-service
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/component: kube-rbac-proxy
app.kubernetes.io/created-by: oadp-operator
app.kubernetes.io/instance: metrics-reader
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: clusterrole
app.kubernetes.io/part-of: oadp-operator
name: openshift-adp-metrics-reader
rules:
- nonResourceURLs:
Expand Down
2 changes: 1 addition & 1 deletion bundle/metadata/annotations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ annotations:
operators.operatorframework.io.bundle.package.v1: oadp-operator
operators.operatorframework.io.bundle.channels.v1: stable
operators.operatorframework.io.bundle.channel.default.v1: stable
operators.operatorframework.io.metrics.builder: operator-sdk-v1.23.0
operators.operatorframework.io.metrics.builder: operator-sdk-v1.32.0
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3

Expand Down
Loading