Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
23 changes: 0 additions & 23 deletions .github/workflows/lint.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/test-e2e.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/test.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ linters:
default: none
enable:
- copyloopvar
- depguard
- dupl
- errcheck
- ginkgolinter
Expand All @@ -13,6 +14,7 @@ linters:
- govet
- ineffassign
- lll
- modernize
Comment thread
ciaranRoche marked this conversation as resolved.
- misspell
- nakedret
- prealloc
Expand All @@ -22,10 +24,20 @@ linters:
- unparam
- unused
settings:
depguard:
rules:
forbid-sort-pkg:
deny:
- pkg: sort
desc: Should be replaced with slices package
revive:
rules:
- name: comment-spacings
- name: import-shadowing
modernize:
disable:
- omitzero
- newexpr
exclusions:
generated: lax
rules:
Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,18 @@ vet: ## Run go vet against code.
ENVTEST_K8S_VERSION ?= $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d", $$3}')
KIND_CLUSTER ?= hyperfleet-operator-test-e2e


# TODO(user): To use a different vendor for e2e tests, modify the setup under 'tests/e2e'.
# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally.
# CertManager is installed by default; skip with:
# - CERT_MANAGER_INSTALL_SKIP=true

.PHONY: setup-envtest
setup-envtest: $(LOCALBIN) ## Download the envtest binaries (etcd, kube-apiserver) into the local bin directory.
$(SETUP_ENVTEST) use '$(ENVTEST_K8S_VERSION)' --bin-dir $(LOCALBIN) -p path

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

.PHONY: setup-test-e2e
setup-test-e2e: ## Set up a Kind cluster for e2e tests if it does not exist
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# hyperfleet-operator
// TODO(user): Add simple overview of use/purpose

A Kubernetes operator for HyperFleet cluster lifecycle management.

## Description
// TODO(user): An in-depth paragraph about your project and overview of use

hyperfleet-operator packages and delivers HyperFleet as a standard Kubernetes operator, installed and managed through OLM. It exposes a single cluster-scoped custom resource, `HyperFleetConfig`, as the entire partner-facing surface: install, configure, and observe HyperFleet through that one CR and its status conditions, with everything else the operator manages kept internal.

## Getting Started

### Prerequisites
- go version v1.24.0+
- go version v1.26.0+
- docker version 17.03+.
- kubectl version v1.11.3+.
- Access to a Kubernetes v1.11.3+ cluster.
Expand Down
54 changes: 54 additions & 0 deletions config/crd/bases/hyperfleet.redhat.com_hyperfleetconfigs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.21.0
name: hyperfleetconfigs.hyperfleet.redhat.com
spec:
group: hyperfleet.redhat.com
names:
kind: HyperFleetConfig
listKind: HyperFleetConfigList
plural: hyperfleetconfigs
singular: hyperfleetconfig
scope: Namespaced
versions:
- name: v1alpha
schema:
openAPIV3Schema:
description: HyperFleetConfig is the Schema for the hyperfleetconfigs API.
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: HyperFleetConfigSpec defines the desired state of HyperFleetConfig.
properties:
foo:
description: Foo is an example field of HyperFleetConfig. Edit hyperfleetconfig_types.go
to remove/update
type: string
type: object
status:
description: HyperFleetConfigStatus defines the observed state of HyperFleetConfig.
type: object
type: object
served: true
storage: true
subresources:
status: {}
33 changes: 27 additions & 6 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: hyperfleet-operator
app.kubernetes.io/managed-by: kustomize
name: manager-role
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "watch"]
- apiGroups:
- hyperfleet.redhat.com
resources:
- hyperfleetconfigs
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- hyperfleet.redhat.com
resources:
- hyperfleetconfigs/finalizers
verbs:
- update
- apiGroups:
- hyperfleet.redhat.com
resources:
- hyperfleetconfigs/status
verbs:
- get
- patch
- update
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/openshift-hyperfleet/hyperfleet-operator

go 1.24.0
go 1.26.0

require (
github.com/onsi/ginkgo/v2 v2.22.0
Expand Down
3 changes: 1 addition & 2 deletions test/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ func LoadImageToKindClusterWithName(name string) error {
// according to line breakers, and ignores the empty elements in it.
func GetNonEmptyLines(output string) []string {
var res []string
elements := strings.Split(output, "\n")
for _, element := range elements {
for element := range strings.SplitSeq(output, "\n") {
if element != "" {
res = append(res, element)
}
Expand Down