Skip to content

Commit

Permalink
Merge pull request #26 from NearNodeFlash/release-v0.0.2
Browse files Browse the repository at this point in the history
Release v0.0.2
  • Loading branch information
matthew-richerson authored May 1, 2023
2 parents 04659dc + b782631 commit 9b46f25
Show file tree
Hide file tree
Showing 1,441 changed files with 103,106 additions and 57,152 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: "Build context"
run: |
echo "ref is ${{ github.ref }}"
echo "ref_type is ${{ github.ref_type }}"
- name: "Checkout repository"
id: checkout_repo
uses: actions/checkout@v3
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/verify_tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ on:
tags:
- "v*"

env:
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
verify_tag:
runs-on: ubuntu-latest
steps:
- name: "Verify context"
run: |
echo "ref is ${{ github.ref }}"
echo "ref_type is ${{ github.ref_type }}"
- uses: actions/checkout@v3
# actions/checkout@v3 breaks annotated tags by converting them into
# lightweight tags, so we need to force fetch the tag again
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ IMAGE_TAG_BASE ?= ghcr.io/nearnodeflash/lustre-fs-operator
# Image URL to use all building/pushing image targets

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.25.0
ENVTEST_K8S_VERSION = 1.26.0

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down Expand Up @@ -169,7 +169,7 @@ container-unit-test: .version ## Build docker image with the manager and execute
${DOCKER} run --rm -t --name $@-lustre-fs-operator $(IMAGE_TAG_BASE)-$@:$(VERSION)

test: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path --bin-dir $(LOCALBIN))" go test ./controllers/... ./api/... -coverprofile cover.out -args -ginkgo.v -ginkgo.progress
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path --bin-dir $(LOCALBIN))" go test ./controllers/... ./api/... -coverprofile cover.out -args -ginkgo.v

##@ Build

Expand Down Expand Up @@ -197,15 +197,15 @@ install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~
$(KUSTOMIZE) build config/crd | kubectl apply -f -

uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl delete -f -
$(KUSTOMIZE) build config/crd | kubectl delete --ignore-not-found -f -

deploy: VERSION ?= $(shell cat .version)
deploy: .version kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMAGE_TAG_BASE):$(VERSION)
$(KUSTOMIZE) build config/default | kubectl apply -f -

undeploy: kustomize ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/default | kubectl delete -f -
$(KUSTOMIZE) build config/default | kubectl delete --ignore-not-found -f -

# Let .version be phony so that a git update to the workarea can be reflected
# in it each time it's needed.
Expand All @@ -228,7 +228,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest

## Tool Versions
KUSTOMIZE_VERSION ?= v4.5.7
CONTROLLER_TOOLS_VERSION ?= v0.9.2
CONTROLLER_TOOLS_VERSION ?= v0.11.1

KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
Expand Down
2 changes: 1 addition & 1 deletion PROJECT
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
domain: cray.hpe.com
layout:

- go.kubebuilder.io/v3
plugins:
manifests.sdk.operatorframework.io/v2: {}
Expand All @@ -13,6 +12,7 @@ resources:
namespaced: true
controller: true
domain: cray.hpe.com
group: lus
kind: LustreFileSystem
path: github.com/NearNodeFlash/lustre-fs-operator/api/v1alpha1
version: v1alpha1
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

// Package v1alpha1 contains API Schema definitions for the v1alpha1 API group
// +kubebuilder:object:generate=true
// +groupName=cray.hpe.com
// +groupName=lus.cray.hpe.com
package v1alpha1

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

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "cray.hpe.com", Version: "v1alpha1"}
GroupVersion = schema.GroupVersion{Group: "lus.cray.hpe.com", Version: "v1alpha1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/lustrefilesystem_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (r *LustreFileSystem) SetupWebhookWithManager(mgr ctrl.Manager) error {
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!

// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
//+kubebuilder:webhook:path=/validate-cray-hpe-com-v1alpha1-lustrefilesystem,mutating=false,failurePolicy=fail,sideEffects=None,groups=cray.hpe.com,resources=lustrefilesystems,verbs=create;update,versions=v1alpha1,name=vlustrefilesystem.kb.io,admissionReviewVersions=v1
//+kubebuilder:webhook:path=/validate-lus-cray-hpe-com-v1alpha1-lustrefilesystem,mutating=false,failurePolicy=fail,sideEffects=None,groups=lus.cray.hpe.com,resources=lustrefilesystems,verbs=create;update,versions=v1alpha1,name=vlustrefilesystem.kb.io,admissionReviewVersions=v1

var _ webhook.Validator = &LustreFileSystem{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.2
controller-gen.kubebuilder.io/version: v0.11.1
creationTimestamp: null
name: lustrefilesystems.cray.hpe.com
name: lustrefilesystems.lus.cray.hpe.com
spec:
group: cray.hpe.com
group: lus.cray.hpe.com
names:
kind: LustreFileSystem
listKind: LustreFileSystemList
Expand Down
2 changes: 1 addition & 1 deletion config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# since it depends on service name and namespace that are out of this kustomize package.
# It should be run by config/default
resources:
- bases/cray.hpe.com_lustrefilesystems.yaml
- bases/lus.cray.hpe.com_lustrefilesystems.yaml
#+kubebuilder:scaffold:crdkustomizeresource

patchesStrategicMerge:
Expand Down
2 changes: 1 addition & 1 deletion config/crd/patches/cainjection_in_lustrefilesystems.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
name: lustrefilesystems.cray.hpe.com
name: lustrefilesystems.lus.cray.hpe.com
2 changes: 1 addition & 1 deletion config/crd/patches/webhook_in_lustrefilesystems.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: lustrefilesystems.cray.hpe.com
name: lustrefilesystems.lus.cray.hpe.com
spec:
conversion:
strategy: Webhook
Expand Down
6 changes: 3 additions & 3 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ rules:
- update
- watch
- apiGroups:
- cray.hpe.com
- lus.cray.hpe.com
resources:
- lustrefilesystems
verbs:
Expand All @@ -42,13 +42,13 @@ rules:
- update
- watch
- apiGroups:
- cray.hpe.com
- lus.cray.hpe.com
resources:
- lustrefilesystems/finalizers
verbs:
- update
- apiGroups:
- cray.hpe.com
- lus.cray.hpe.com
resources:
- lustrefilesystems/status
verbs:
Expand Down
12 changes: 10 additions & 2 deletions config/samples/craystack_lustrefilesystem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@ kind: Namespace
metadata:
name: nnf-daffy-lustre
---
apiVersion: cray.hpe.com/v1alpha1
apiVersion: lus.cray.hpe.com/v1alpha1
kind: LustreFileSystem
metadata:
name: w0-lustre-fs
namespace: nnf-daffy-lustre
spec:
name: w0
mgsNid: rabbit-03@tcp
mgsNids: rabbit-03@tcp
mountRoot: /lus/w0
namespaces:
nnf-daffy-lustre:
modes:
- ReadWriteMany




2 changes: 1 addition & 1 deletion config/samples/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Append samples you want in your CSV to this file as resources ##
resources:
- _v1alpha1_lustrefilesystem.yaml
- lus_v1alpha1_lustrefilesystem.yaml
#+kubebuilder:scaffold:manifestskustomizesamples
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
apiVersion: cray.hpe.com/v1alpha1
apiVersion: lus.cray.hpe.com/v1alpha1
kind: LustreFileSystem
metadata:
name: lustrefilesystem-sample-maui
namespace: nnf-lustre-fs-system
spec:
name: maui
mgsNid: 172.0.0.0@tcp
mgsNids: 172.0.0.0@tcp
mountRoot: /lus/maui
namespaces:
default:
modes:
- ReadWriteMany
4 changes: 2 additions & 2 deletions config/webhook/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ webhooks:
service:
name: webhook-service
namespace: system
path: /validate-cray-hpe-com-v1alpha1-lustrefilesystem
path: /validate-lus-cray-hpe-com-v1alpha1-lustrefilesystem
failurePolicy: Fail
name: vlustrefilesystem.kb.io
rules:
- apiGroups:
- cray.hpe.com
- lus.cray.hpe.com
apiVersions:
- v1alpha1
operations:
Expand Down
10 changes: 5 additions & 5 deletions controllers/lustrefilesystem_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import (
)

const (
finalizerLustreFileSystem = "cray.hpe.com/lustre_fs"
finalizerLustreFileSystem = "lus.cray.hpe.com/lustre_fs"
)

var (
Expand All @@ -54,9 +54,9 @@ type LustreFileSystemReconciler struct {
Scheme *runtime.Scheme
}

//+kubebuilder:rbac:groups=cray.hpe.com,resources=lustrefilesystems,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=cray.hpe.com,resources=lustrefilesystems/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=cray.hpe.com,resources=lustrefilesystems/finalizers,verbs=update
//+kubebuilder:rbac:groups=lus.cray.hpe.com,resources=lustrefilesystems,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=lus.cray.hpe.com,resources=lustrefilesystems/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=lus.cray.hpe.com,resources=lustrefilesystems/finalizers,verbs=update
//+kubebuilder:rbac:groups=core,resources=persistentvolumes,verbs=get;list;update;create;patch;delete;watch
//+kubebuilder:rbac:groups=core,resources=persistentvolumeclaims,verbs=get;list;update;create;patch;delete;watch

Expand All @@ -77,7 +77,7 @@ func (r *LustreFileSystemReconciler) Reconcile(ctx context.Context, req ctrl.Req
}

statusUpdater := updater.NewStatusUpdater[*v1alpha1.LustreFileSystemStatus](fs)
defer func() { err = statusUpdater.CloseWithStatusUpdate(ctx, r, err) }()
defer func() { err = statusUpdater.CloseWithStatusUpdate(ctx, r.Client.Status(), err) }()

// Check if the object is being deleted.
if !fs.GetDeletionTimestamp().IsZero() {
Expand Down
7 changes: 4 additions & 3 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ var _ = BeforeSuite(func() {

//+kubebuilder:scaffold:scheme

k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme})
Expect(err).NotTo(HaveOccurred())
Expect(k8sClient).NotTo(BeNil())

// https://book.kubebuilder.io/cronjob-tutorial/writing-tests.html
// One thing that this autogenerated file is missing, however, is a way to actually start your controller.
// The code above will set up a client for interacting with your custom Kind, but will not be able to test
Expand Down Expand Up @@ -105,9 +109,6 @@ var _ = BeforeSuite(func() {
}).SetupWithManager(k8sManager)
Expect(err).ToNot(HaveOccurred())

k8sClient = k8sManager.GetClient()
Expect(k8sClient).NotTo(BeNil())

go func() {
defer GinkgoRecover()
err := k8sManager.Start(ctx)
Expand Down
Loading

0 comments on commit 9b46f25

Please sign in to comment.