Skip to content

Commit

Permalink
rename Operator API to ClusterExtension API (#568)
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Lanford <joe.lanford@gmail.com>
  • Loading branch information
joelanford committed Dec 14, 2023
1 parent 8d428a5 commit 9316012
Show file tree
Hide file tree
Showing 49 changed files with 1,147 additions and 1,159 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
run: |
make kind-cluster
make deploy
kubectl get crds operators.operators.operatorframework.io
kubectl get crds clusterextensions.olm.operatorframework.io
kubectl get ns operator-controller-system
make undeploy
! kubectl get ns operator-controller-system
! kubectl get crds operators.operators.operatorframework.io
! kubectl get crds clusterextensions.olm.operatorframework.io
6 changes: 3 additions & 3 deletions .github/workflows/operator-developer-e2e.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: operator-developer-e2e
name: extension-developer-e2e

on:
workflow_dispatch:
Expand All @@ -18,6 +18,6 @@ jobs:
with:
go-version-file: go.mod

- name: Run the operator framework e2e test
- name: Run the extension developer e2e test
run: |
make operator-developer-e2e
make extension-developer-e2e
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ e2e: $(SETUP_ENVTEST) #EXHELP Run the e2e tests.
export REG_PKG_NAME=registry-operator
export PLAIN_PKG_NAME=plain-operator
export CATALOG_IMG=${E2E_REGISTRY_NAME}.${E2E_REGISTRY_NAMESPACE}.svc:5000/test-catalog:e2e
.PHONY: test-op-dev-e2e
test-op-dev-e2e: $(SETUP_ENVTEST) $(OPERATOR_SDK) $(KUSTOMIZE) $(KIND) #HELP Run operator create, upgrade and delete tests.
test/operator-framework-e2e/setup.sh $(OPERATOR_SDK) $(CONTAINER_RUNTIME) $(KUSTOMIZE) $(KIND) $(KIND_CLUSTER_NAME) ${E2E_REGISTRY_NAMESPACE}
eval $$($(SETUP_ENVTEST) use -p env $(ENVTEST_VERSION)) && go test -tags $(GO_BUILD_TAGS) -v ./test/operator-framework-e2e/...
.PHONY: test-ext-dev-e2e
test-ext-dev-e2e: $(SETUP_ENVTEST) $(OPERATOR_SDK) $(KUSTOMIZE) $(KIND) #HELP Run extension create, upgrade and delete tests.
test/extension-developer-e2e/setup.sh $(OPERATOR_SDK) $(CONTAINER_RUNTIME) $(KUSTOMIZE) $(KIND) $(KIND_CLUSTER_NAME) ${E2E_REGISTRY_NAMESPACE}
eval $$($(SETUP_ENVTEST) use -p env $(ENVTEST_VERSION)) && go test -tags $(GO_BUILD_TAGS) -v ./test/extension-developer-e2e/...

.PHONY: test-unit
ENVTEST_VERSION = $(shell go list -m k8s.io/client-go | cut -d" " -f2 | sed 's/^v0\.\([[:digit:]]\{1,\}\)\.[[:digit:]]\{1,\}$$/1.\1.x/')
Expand All @@ -136,9 +136,9 @@ test-e2e: KUSTOMIZE_BUILD_DIR=config/e2e
test-e2e: GO_BUILD_FLAGS=-cover
test-e2e: run image-registry build-push-e2e-catalog kind-load-test-artifacts e2e e2e-coverage undeploy kind-clean #HELP Run e2e test suite on local kind cluster

.PHONY: operator-developer-e2e
operator-developer-e2e: KIND_CLUSTER_NAME=operator-controller-op-dev-e2e #EXHELP Run operator-developer e2e on local kind cluster
operator-developer-e2e: run image-registry test-op-dev-e2e kind-clean
.PHONY: extension-developer-e2e
extension-developer-e2e: KIND_CLUSTER_NAME=operator-controller-ext-dev-e2e #EXHELP Run extension-developer e2e on local kind cluster
extension-developer-e2e: run image-registry test-ext-dev-e2e kind-clean

.PHONY: e2e-coverage
e2e-coverage:
Expand Down
4 changes: 2 additions & 2 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ resources:
namespaced: true
controller: true
domain: operatorframework.io
group: operators
kind: Operator
group: olm
kind: ClusterExtension
path: github.com/operator-framework/operator-controller/api/v1alpha1
version: v1alpha1
version: "3"
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# operator-controller
The operator-controller is the central component of Operator Lifecycle Manager (OLM) v1. It extends Kubernetes with an API through which users can install Operators.
The operator-controller is the central component of Operator Lifecycle Manager (OLM) v1. It extends Kubernetes with an API through which users can install extensions.

## Description
OLM v1 is the follow-up to OLM v0, located [here](https://github.com/operator-framework/operator-lifecycle-manager). It consists of four different components, including this one, which are as follows:
Expand Down Expand Up @@ -90,4 +90,3 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ import (
type UpgradeConstraintPolicy string

const (
// The operator will only upgrade if the new version satisfies
// The extension will only upgrade if the new version satisfies
// the upgrade constraints set by the package author.
UpgradeConstraintPolicyEnforce UpgradeConstraintPolicy = "Enforce"

// Unsafe option which allows an operator to be
// Unsafe option which allows an extension to be
// upgraded or downgraded to any available version of the package and
// ignore the upgrade path designed by package authors.
// This assumes that users independently verify the outcome of the changes.
Expand All @@ -38,8 +38,8 @@ const (
UpgradeConstraintPolicyIgnore UpgradeConstraintPolicy = "Ignore"
)

// OperatorSpec defines the desired state of Operator
type OperatorSpec struct {
// ClusterExtensionSpec defines the desired state of ClusterExtension
type ClusterExtensionSpec struct {
//+kubebuilder:validation:MaxLength:=48
//+kubebuilder:validation:Pattern:=^[a-z0-9]+(-[a-z0-9]+)*$
PackageName string `json:"packageName"`
Expand Down Expand Up @@ -101,8 +101,8 @@ func init() {
)
}

// OperatorStatus defines the observed state of Operator
type OperatorStatus struct {
// ClusterExtensionStatus defines the observed state of ClusterExtension
type ClusterExtensionStatus struct {
// +optional
InstalledBundleResource string `json:"installedBundleResource,omitempty"`
// +optional
Expand All @@ -119,24 +119,24 @@ type OperatorStatus struct {
//+kubebuilder:resource:scope=Cluster
//+kubebuilder:subresource:status

// Operator is the Schema for the operators API
type Operator struct {
// ClusterExtension is the Schema for the clusterextensions API
type ClusterExtension struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec OperatorSpec `json:"spec,omitempty"`
Status OperatorStatus `json:"status,omitempty"`
Spec ClusterExtensionSpec `json:"spec,omitempty"`
Status ClusterExtensionStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

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

func init() {
SchemeBuilder.Register(&Operator{}, &OperatorList{})
SchemeBuilder.Register(&ClusterExtension{}, &ClusterExtensionList{})
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"golang.org/x/exp/slices" // replace with "slices" in go 1.21
)

func TestOperatorTypeRegistration(t *testing.T) {
func TestClusterExtensionTypeRegistration(t *testing.T) {
types, err := parseConstants("Type")
if err != nil {
t.Fatalf("unable to parse Type constants %v", err)
Expand All @@ -34,7 +34,7 @@ func TestOperatorTypeRegistration(t *testing.T) {
}
}

func TestOperatorReasonRegistration(t *testing.T) {
func TestClusterExtensionReasonRegistration(t *testing.T) {
reasons, err := parseConstants("Reason")
if err != nil {
t.Fatalf("unable to parse Reason constants %v", err)
Expand Down
6 changes: 3 additions & 3 deletions api/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// Package v1alpha1 contains API Schema definitions for the operators v1alpha1 API group
// Package v1alpha1 contains API Schema definitions for the olm v1alpha1 API group
// +kubebuilder:object:generate=true
// +groupName=operators.operatorframework.io
// +groupName=olm.operatorframework.io
package v1alpha1

import (
Expand All @@ -26,7 +26,7 @@ import (

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "operators.operatorframework.io", Version: "v1alpha1"}
GroupVersion = schema.GroupVersion{Group: "olm.operatorframework.io", Version: "v1alpha1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
Expand Down
38 changes: 19 additions & 19 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
"github.com/operator-framework/deppy/pkg/deppy/solver"
rukpakv1alpha1 "github.com/operator-framework/rukpak/api/v1alpha1"

operatorsv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1"
ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1"
"github.com/operator-framework/operator-controller/internal/catalogmetadata/cache"
catalogclient "github.com/operator-framework/operator-controller/internal/catalogmetadata/client"
"github.com/operator-framework/operator-controller/internal/controllers"
Expand All @@ -51,7 +51,7 @@ var (
func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))

utilruntime.Must(operatorsv1alpha1.AddToScheme(scheme))
utilruntime.Must(ocv1alpha1.AddToScheme(scheme))
utilruntime.Must(rukpakv1alpha1.AddToScheme(scheme))
utilruntime.Must(catalogd.AddToScheme(scheme))

Expand Down Expand Up @@ -115,13 +115,13 @@ func main() {
os.Exit(1)
}

if err = (&controllers.OperatorReconciler{
if err = (&controllers.ClusterExtensionReconciler{
Client: cl,
BundleProvider: catalogClient,
Scheme: mgr.GetScheme(),
Resolver: resolver,
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Operator")
setupLog.Error(err, "unable to create controller", "controller", "ClusterExtension")
os.Exit(1)
}
//+kubebuilder:scaffold:builder
Expand Down
Loading

0 comments on commit 9316012

Please sign in to comment.