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

Operator Redesign #216

Merged
merged 27 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1810542
Embed MCAD and InstaScale controllers
astefanutti Aug 8, 2023
b05e88f
Increase golangci-lint timeout
astefanutti Aug 10, 2023
a2d9747
fix duplicated kubeconfig CLI option
astefanutti Aug 11, 2023
9126bcf
Add MCAD APIs to runtime scheme
astefanutti Aug 11, 2023
3ee7ff0
Add InstaScale ConfigMap
astefanutti Aug 11, 2023
f04bd06
Update e2e setup
astefanutti Aug 11, 2023
6ed8ec9
Remove MCAD logs retrieval
astefanutti Aug 11, 2023
7982c90
Work-around conflict with MCAD custom metrics adapter port
astefanutti Aug 11, 2023
b3e5183
Fix InstaScale ConfigMap configuration
astefanutti Aug 11, 2023
01d0d43
Fix RayCluster RBAC
astefanutti Aug 11, 2023
40678f0
Remove deployment controllers
astefanutti Aug 11, 2023
a147984
Remove client package
astefanutti Aug 11, 2023
145d1f3
Update go.mod
astefanutti Aug 11, 2023
f82ecf4
Fix OLM upgrade workflow
astefanutti Aug 24, 2023
e23f092
Remove MCAD and InstaScale internal templates
astefanutti Aug 24, 2023
848a302
Remove MCAD and InstaScale CRDs
astefanutti Sep 5, 2023
5108c99
Update OLM ClusterServiceVersion
astefanutti Sep 5, 2023
4f44a83
Remove MCAD and InstaScale APIs
astefanutti Sep 8, 2023
92ef140
Remove MCAD and InstaScale APIs RBAC and samples
astefanutti Sep 8, 2023
46200fb
Remove code generation verify workflow
astefanutti Sep 8, 2023
d823875
Clean up operator roles
astefanutti Sep 8, 2023
d9ca65f
Use structured configuration
astefanutti Sep 13, 2023
21472df
Add quota API types to runtime scheme
astefanutti Sep 13, 2023
d22e2d1
Add controller manager structured config
astefanutti Sep 18, 2023
4f9b9ef
Init and load operator ConfigMap
astefanutti Sep 18, 2023
7069157
Remove openshift-goimports from tools.go
astefanutti Sep 19, 2023
a243e58
Update Go modules target in Makefile
astefanutti Sep 19, 2023
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
6 changes: 0 additions & 6 deletions .github/workflows/e2e_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,6 @@ jobs:
echo "Printing CodeFlare operator logs"
kubectl logs -n openshift-operators --tail -1 -l app.kubernetes.io/name=codeflare-operator | tee ${CODEFLARE_TEST_OUTPUT_DIR}/codeflare-operator.log

- name: Print MCAD controller logs
if: always() && steps.deploy.outcome == 'success'
run: |
echo "Printing MCAD controller logs"
kubectl logs -n codeflare-system --tail -1 -l component=multi-cluster-application-dispatcher | tee ${CODEFLARE_TEST_OUTPUT_DIR}/mcad.log

- name: Print KubeRay operator logs
if: always() && steps.deploy.outcome == 'success'
run: |
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/olm_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
CSV_VERSION=$(kubectl get ClusterServiceVersion -l operators.coreos.com/codeflare-operator.openshift-operators='' -n openshift-operators -o json | jq -r .items[].spec.version)
echo "PREVIOUS_VERSION=v$CSV_VERSION" >> $GITHUB_ENV

- name: Deploy CodeFlare stack (MCAD, KubeRay)
- name: Deploy CodeFlare stack
run: |
make setup-e2e

Expand Down Expand Up @@ -177,12 +177,6 @@ jobs:
echo "Printing CodeFlare operator logs"
kubectl logs -n openshift-operators --tail -1 -l app.kubernetes.io/name=codeflare-operator | tee ${CODEFLARE_TEST_OUTPUT_DIR}/codeflare-operator.log

- name: Print MCAD controller logs
if: always() && steps.deploy.outcome == 'success'
run: |
echo "Printing MCAD controller logs"
kubectl logs -n codeflare-system --tail -1 -l component=multi-cluster-application-dispatcher | tee ${CODEFLARE_TEST_OUTPUT_DIR}/mcad.log

- name: Print KubeRay operator logs
if: always() && steps.deploy.outcome == 'success'
run: |
Expand Down
22 changes: 0 additions & 22 deletions .github/workflows/verify_generated_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,6 @@ on:
- '**go.mod'
- '**go.sum'
jobs:
verify-generated-functions:
sutaakar marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set Go
uses: actions/setup-go@v3
with:
go-version: v1.19
- name: Verify that the DeepCopy, DeepCopyInto, and DeepCopyObject method implementations have been generated
run: make generate && git diff --exit-code

verify-generate-client:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set Go
uses: actions/setup-go@v3
with:
go-version: v1.19
- name: Verify that the latest client has been generated
run: make generate-client && git diff --exit-code

verify-imports:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
run:
timeout: 5m
timeout: 10m
linters:
enable:
- errcheck
Expand Down
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ COPY go.mod go.mod
COPY go.sum go.sum
RUN go mod download

# Copy the go source
# Copy the Go sources
COPY main.go main.go
COPY api/ api/
COPY controllers/ controllers/
COPY pkg/ pkg/

# Build
USER root
Expand All @@ -19,7 +18,6 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7
WORKDIR /
COPY --from=builder /workspace/manager .
COPY config/internal config/internal

USER 65532:65532
ENTRYPOINT ["/manager"]
112 changes: 12 additions & 100 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ VERSION ?= v0.0.0-dev
BUNDLE_VERSION ?= $(VERSION:v%=%)

# INSTASCALE_VERSION defines the default version of the InstaScale controller
INSTASCALE_VERSION ?= v0.0.8
INSTASCALE_VERSION ?= main
INSTASCALE_REPO ?= github.com/project-codeflare/instascale

# MCAD_VERSION defines the default version of the MCAD controller
MCAD_VERSION ?= v1.34.1
# MCAD_REF, MCAD_REPO and MCAD_CRD define the reference to MCAD CRD resources
MCAD_REF ?= release-${MCAD_VERSION}
MCAD_VERSION ?= main
MCAD_REPO ?= github.com/project-codeflare/multi-cluster-app-dispatcher
# Upstream MCAD is currently only creating release tags of the form `vX.Y.Z` (i.e the version)
# The image is still published using the MCAD_REF format (i.e release-vX.Y.Z)
MCAD_CRD ?= ${MCAD_REPO}/config/crd?ref=${MCAD_VERSION}

# KUBERAY_VERSION defines the default version of the KubeRay operator (used for testing)
Expand Down Expand Up @@ -66,12 +64,6 @@ IMAGE_ORG_BASE ?= quay.io/project-codeflare
# codeflare.dev/codeflare-operator-bundle:$VERSION and codeflare.dev/codeflare-operator-catalog:$VERSION.
IMAGE_TAG_BASE ?= $(IMAGE_ORG_BASE)/codeflare-operator

# MCAD_IMAGE defines the default container image for the MCAD controller
MCAD_IMAGE ?= $(IMAGE_ORG_BASE)/mcad-controller:$(MCAD_REF)

# INSTASCALE_IMAGE defines the default container image for the InstaScale controller
INSTASCALE_IMAGE ?= $(IMAGE_ORG_BASE)/instascale-controller:$(INSTASCALE_VERSION)

# RAY_IMAGE defines the default container image for Ray (used for testing)
RAY_IMAGE ?= rayproject/ray:$(RAY_VERSION)

Expand Down Expand Up @@ -129,25 +121,10 @@ help: ## Display this help.

##@ Development

DEFAULTS_FILE := controllers/defaults.go
DEFAULTS_TEST_FILE := test/support/defaults.go

.PHONY: defaults
defaults:
$(info Regenerating $(DEFAULTS_FILE))
@echo "package controllers" > $(DEFAULTS_FILE)
@echo "" >> $(DEFAULTS_FILE)
@echo "// ***********************" >> $(DEFAULTS_FILE)
@echo "// DO NOT EDIT THIS FILE" >> $(DEFAULTS_FILE)
@echo "// ***********************" >> $(DEFAULTS_FILE)
@echo "" >> $(DEFAULTS_FILE)
@echo "const (" >> $(DEFAULTS_FILE)
@echo " MCADImage = \"$(MCAD_IMAGE)\"" >> $(DEFAULTS_FILE)
@echo " InstaScaleImage = \"$(INSTASCALE_IMAGE)\"" >> $(DEFAULTS_FILE)
@echo "" >> $(DEFAULTS_FILE)
@echo ")" >> $(DEFAULTS_FILE)
@echo "" >> $(DEFAULTS_FILE)

$(info Regenerating $(DEFAULTS_TEST_FILE))
@echo "package support" > $(DEFAULTS_TEST_FILE)
@echo "" >> $(DEFAULTS_TEST_FILE)
Expand All @@ -163,51 +140,11 @@ defaults:
@echo ")" >> $(DEFAULTS_TEST_FILE)
@echo "" >> $(DEFAULTS_TEST_FILE)

gofmt -w $(DEFAULTS_FILE) $(DEFAULTS_TEST_FILE)
gofmt -w $(DEFAULTS_TEST_FILE)

.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

.PHONY: generate-client ## Generate client packages and organize the goimports
generate-client: generate-client-files imports

.PHONY: generate-client-files
generate-client-files: code-generator
rm -rf client
$(APPLYCONFIGURATION_GEN) \
--input-dirs="github.com/project-codeflare/codeflare-operator/api/codeflare/v1alpha1" \
--go-header-file="hack/boilerplate.go.txt" \
--output-package="github.com/project-codeflare/codeflare-operator/client/applyconfiguration" \
--output-base="." \
--trim-path-prefix "github.com/project-codeflare/codeflare-operator"
$(CLIENT_GEN) \
--input="codeflare/v1alpha1" \
--input-base="github.com/project-codeflare/codeflare-operator/api" \
--apply-configuration-package="github.com/project-codeflare/codeflare-operator/client/applyconfiguration" \
--go-header-file="hack/boilerplate.go.txt" \
--clientset-name "versioned" \
--output-package="github.com/project-codeflare/codeflare-operator/client/clientset" \
--output-base="." \
--trim-path-prefix "github.com/project-codeflare/codeflare-operator"
$(LISTER_GEN) \
--input-dirs="github.com/project-codeflare/codeflare-operator/api/codeflare/v1alpha1" \
--go-header-file="hack/boilerplate.go.txt" \
--output-base="." \
--output-package="github.com/project-codeflare/codeflare-operator/client/listers" \
--trim-path-prefix "github.com/project-codeflare/codeflare-operator"
$(INFORMER_GEN) \
--input-dirs="github.com/project-codeflare/codeflare-operator/api/codeflare/v1alpha1" \
--versioned-clientset-package="github.com/project-codeflare/codeflare-operator/client/clientset/versioned" \
--listers-package="github.com/project-codeflare/codeflare-operator/client/listers" \
--go-header-file="hack/boilerplate.go.txt" \
--output-base="." \
--output-package="github.com/project-codeflare/codeflare-operator/client/informer" \
--trim-path-prefix "github.com/project-codeflare/codeflare-operator"
manifests: controller-gen ## Generate RBAC objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role webhook paths="./..."

.PHONY: fmt
fmt: ## Run go fmt against code.
Expand All @@ -223,14 +160,16 @@ vet: ## Run go vet against code.
.PHONY: modules
modules: ## Update Go dependencies.
go get $(MCAD_REPO)@$(MCAD_VERSION)
go get $(INSTASCALE_REPO)@$(INSTASCALE_VERSION)
go get github.com/ray-project/kuberay/ray-operator
go mod tidy

.PHONY: build
build: modules defaults generate fmt vet ## Build manager binary.
build: modules defaults fmt vet ## Build manager binary.
go build -o bin/manager main.go

.PHONY: run
run: modules defaults manifests generate fmt vet ## Run a controller from your host.
run: modules defaults manifests fmt vet ## Run a controller from your host.
go run ./main.go

.PHONY: image-build
Expand Down Expand Up @@ -281,10 +220,6 @@ $(LOCALBIN):

## Tool Binaries
KUSTOMIZE ?= $(LOCALBIN)/kustomize
APPLYCONFIGURATION_GEN ?= $(LOCALBIN)/applyconfiguration-gen
CLIENT_GEN ?= $(LOCALBIN)/client-gen
LISTER_GEN ?= $(LOCALBIN)/lister-gen
INFORMER_GEN ?= $(LOCALBIN)/informer-gen
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
ENVTEST ?= $(LOCALBIN)/setup-envtest
OPENSHIFT-GOIMPORTS ?= $(LOCALBIN)/openshift-goimports
Expand Down Expand Up @@ -315,29 +250,6 @@ $(GH_CLI): $(LOCALBIN)
rm -rf $(GH_CLI_DL_FILENAME)
rm $(GH_CLI_DL_FILENAME).tar.gz

.PHONY: code-generator
code-generator: $(APPLYCONFIGURATION_GEN) $(CLIENT_GEN) $(LISTER_GEN) $(INFORMER_GEN)

.PHONY: applyconfiguration-gen
applyconfiguration-gen: $(APPLYCONFIGURATION_GEN)
$(APPLYCONFIGURATION_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/applyconfiguration-gen || GOBIN=$(LOCALBIN) go install k8s.io/code-generator/cmd/applyconfiguration-gen@$(CODEGEN_VERSION)

.PHONY: client-gen
client-gen: $(CLIENT_GEN)
$(CLIENT_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/client-gen || GOBIN=$(LOCALBIN) go install k8s.io/code-generator/cmd/client-gen@$(CODEGEN_VERSION)

.PHONY: lister-gen
lister-gen: $(LISTER_GEN)
$(LISTER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/lister-gen || GOBIN=$(LOCALBIN) go install k8s.io/code-generator/cmd/lister-gen@$(CODEGEN_VERSION)

.PHONY: informer-gen
informer-gen: $(INFORMER_GEN)
$(INFORMER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/informer-gen || GOBIN=$(LOCALBIN) go install k8s.io/code-generator/cmd/informer-gen@$(CODEGEN_VERSION)

.PHONY: controller-gen
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
$(CONTROLLER_GEN): $(LOCALBIN)
Expand Down Expand Up @@ -445,11 +357,11 @@ catalog-push: ## Push a catalog image.
podman push $(CATALOG_IMG) $(CATALOG_PUSH_OPT)

.PHONY: test-unit
test-unit: defaults manifests generate fmt vet envtest ## Run unit tests.
test-unit: defaults manifests fmt vet envtest ## Run unit tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $(go list ./... | grep -v /test/) -coverprofile cover.out

.PHONY: test-e2e
test-e2e: defaults manifests generate fmt vet ## Run e2e tests.
test-e2e: defaults manifests fmt vet ## Run e2e tests.
go test -timeout 30m -v ./test/e2e

.PHONY: kind-e2e
Expand Down
19 changes: 0 additions & 19 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,4 @@ plugins:
scorecard.sdk.operatorframework.io/v2: {}
projectName: codeflare-operator
repo: github.com/project-codeflare/codeflare-operator
resources:
- api:
crdVersion: v1
namespaced: true
controller: true
domain: codeflare.dev
group: codeflare
kind: MCAD
path: github.com/project-codeflare/codeflare-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: codeflare.dev
group: codeflare
kind: InstaScale
path: github.com/project-codeflare/codeflare-operator/api/v1alpha1
version: v1alpha1
version: "3"
21 changes: 0 additions & 21 deletions api/codeflare/v1alpha1/doc.go

This file was deleted.

Loading
Loading