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: add OCP bundle #57

Merged
merged 1 commit into from
Dec 30, 2024
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
48 changes: 41 additions & 7 deletions .github/workflows/image-push-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ on:
push:
tags:
- v*
env:
REGISTRY: "ghcr.io"
OPERATOR_IMAGE_NAME: "nic-configuration-operator"
DAEMON_IMAGE_NAME: "nic-configuration-operator-daemon"
jobs:
image-build-push:
name: Image build and push
runs-on: ubuntu-latest
steps:
- name: Set repository as lower-case output variable
id: repo_name
run: echo ::set-output name=repository::$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')
- name: Set repository owner as lower-case output variable
id: repo_owner
run: echo REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
Expand All @@ -22,14 +26,14 @@ jobs:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker operator image meta
id: docker_meta_operator
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ steps.repo_name.outputs.repository }}
images: ${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/${{ env.OPERATOR_IMAGE_NAME }}
tags: |
type=ref,event=tag
flavor: |
Expand All @@ -46,7 +50,7 @@ jobs:
id: docker_meta_daemon
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ steps.repo_name.outputs.repository }}-daemon
images: ${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/${{ env.DAEMON_IMAGE_NAME }}
tags: |
type=ref,event=tag
flavor: |
Expand All @@ -60,4 +64,34 @@ jobs:
${{ steps.docker_meta_daemon.outputs.tags }}
labels: ${{ steps.docker_meta_daemon.outputs.labels }}
file: ./Dockerfile.nic-configuration-daemon

- name: Determine version, tag, and base branch
run: |
git_tag=${{ github.ref_name }}
echo VERSION_WITH_PREFIX=$git_tag >> $GITHUB_ENV
echo VERSION_WITHOUT_PREFIX=${git_tag:1} >> $GITHUB_ENV # without the 'v' prefix
if echo $git_tag | grep beta; then
base_branch=$DEFAULT_BRANCH
else
v_major_minor=$(echo $git_tag | grep -Eo '^v[0-9]+\.[0-9]+')
base_branch=$v_major_minor.x
fi
echo BASE_BRANCH=$base_branch >> $GITHUB_ENV
- name: Lookup image digest
run: |
operator_digest=$(skopeo inspect docker://$REGISTRY/$REPO_OWNER/$OPERATOR_IMAGE_NAME:$VERSION_WITH_PREFIX | jq -r .Digest)
echo $operator_digest | wc -w | grep 1 # verifies value not empty
echo OPERATOR_DIGEST=$operator_digest >> $GITHUB_ENV
daemon_digest=$(skopeo inspect docker://$REGISTRY/$REPO_OWNER/$DAEMON_IMAGE_NAME:$VERSION_WITH_PREFIX | jq -r .Digest)
echo $daemon_digest | wc -w | grep 1 # verifies value not empty
echo DAEMON_DIGEST=$daemon_digest >> $GITHUB_ENV
- name: Make bundle
env:
OPERATOR_IMAGE_TAG: ${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/${{ env.OPERATOR_IMAGE_NAME }}@${{ env.OPERATOR_DIGEST }}
CONFIG_DAEMON_IMAGE_TAG: ${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/${{ env.DAEMON_IMAGE_NAME }}@${{ env.DAEMON_DIGEST }}
BUNDLE_IMG: ${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/${{ env.OPERATOR_IMAGE_NAME }}-bundle:${{ github.ref_name }}
VERSION: ${{ env.VERSION_WITHOUT_PREFIX }}
run: |
version_major_minor=$(echo $VERSION_WITH_PREFIX | grep -Eo 'v[0-9]+\.[0-9]+')
export CHANNELS=stable,$version_major_minor
export DEFAULT_CHANNEL=$version_major_minor
make bundle bundle-build bundle-push
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ ifeq ($(USE_IMAGE_DIGESTS), true)
BUNDLE_GEN_FLAGS += --use-image-digests
endif

BUNDLE_OCP_VERSIONS=v4.14-v4.17

# Set the Operator SDK version to use. By default, what is installed on the system is used.
# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
OPERATOR_SDK_VERSION ?= v1.36.0
Expand Down Expand Up @@ -335,7 +337,9 @@ endif
bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metadata, then validate generated files.
$(OPERATOR_SDK) generate kustomize manifests -q
cd config/manager && $(KUSTOMIZE) edit set image controller=$(OPERATOR_IMAGE_TAG)
cd config/daemon && $(KUSTOMIZE) edit set configmap config --from-literal=configDaemonImage=$(CONFIG_DAEMON_IMAGE_TAG) --from-literal=releaseVersion=${VERSION}
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS)
BUNDLE_OCP_VERSIONS=$(BUNDLE_OCP_VERSIONS) OPERATOR_IMAGE_TAG=$(OPERATOR_IMAGE_TAG) CONFIG_DAEMON_IMAGE_TAG=$(CONFIG_DAEMON_IMAGE_TAG) hack/scripts/ocp-bundle-postprocess.sh
$(OPERATOR_SDK) bundle validate ./bundle

.PHONY: bundle-build
Expand All @@ -344,7 +348,7 @@ bundle-build: ## Build the bundle image.

.PHONY: bundle-push
bundle-push: ## Push the bundle image.
$(MAKE) docker-push IMG=$(BUNDLE_IMG)
$(CONTAINER_TOOL) push $(BUNDLE_IMG)

.PHONY: opm
OPM = $(LOCALBIN)/opm
Expand Down
2 changes: 1 addition & 1 deletion PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ layout:
plugins:
manifests.sdk.operatorframework.io/v2: {}
scorecard.sdk.operatorframework.io/v2: {}
projectName: nic-configuration-operator
projectName: nvidia-nic-configuration-operator
repo: github.com/Mellanox/nic-configuration-operator
resources:
- api:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
creationTimestamp: null
name: nicconfigurationtemplates.configuration.net.nvidia.com
spec:
group: configuration.net.nvidia.com
names:
kind: NicConfigurationTemplate
listKind: NicConfigurationTemplateList
plural: nicconfigurationtemplates
singular: nicconfigurationtemplate
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: NicConfigurationTemplate is the Schema for the nicconfigurationtemplates
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: Defines the desired state of NICs
properties:
nicSelector:
description: NIC selector configuration
properties:
nicType:
description: Type of the NIC to be selected, e.g. 101d,1015,a2d6
etc.
type: string
pciAddresses:
description: Array of PCI addresses to be selected, e.g. "0000:03:00.0"
items:
type: string
type: array
serialNumbers:
description: Serial numbers of the NICs to be selected, e.g. MT2116X09299
items:
type: string
type: array
required:
- nicType
type: object
nodeSelector:
additionalProperties:
type: string
description: NodeSelector contains labels required on the node
type: object
resetToDefault:
default: false
description: |-
ResetToDefault specifies whether node agent needs to perform a reset flow
The following operations will be performed:
* Nvconfig reset of all non-volatile configurations
- Mstconfig -d <device> reset for each PF
- Mstconfig -d <device> set ADVANCED_PCI_SETTINGS=1
* Node reboot
- Applies new NIC NV config
- Will undo any runtime configuration previously performed for the device/driver
type: boolean
template:
description: Configuration template to be applied to matching devices
properties:
gpuDirectOptimized:
description: GPU Direct optimization settings
properties:
enabled:
description: Optimize GPU Direct
type: boolean
env:
description: GPU direct environment, e.g. Baremetal
type: string
required:
- enabled
- env
type: object
linkType:
description: LinkType to be configured, Ethernet|Infiniband
enum:
- Ethernet
- Infiniband
type: string
numVfs:
description: Number of VFs to be configured
type: integer
pciPerformanceOptimized:
description: PCI performance optimization settings
properties:
enabled:
description: Specifies whether to enable PCI performance optimization
type: boolean
maxAccOutRead:
description: Specifies the PCIe Max Accumulative Outstanding
read bytes
type: integer
maxReadRequest:
description: Specifies the size of a single PCI read request
in bytes
enum:
- 128
- 256
- 512
- 1024
- 2048
- 4096
type: integer
required:
- enabled
type: object
roceOptimized:
description: RoCE optimization settings
properties:
enabled:
description: Optimize RoCE
type: boolean
qos:
description: Quality of Service settings
properties:
pfc:
description: Priority-based Flow Control configuration,
e.g. "0,0,0,1,0,0,0,0"
pattern: ^([01],){7}[01]$
type: string
trust:
description: Trust mode for QoS settings, e.g. trust-dscp
type: string
required:
- pfc
- trust
type: object
required:
- enabled
type: object
required:
- linkType
- numVfs
type: object
required:
- nicSelector
- template
type: object
status:
description: Defines the observed state of NicConfigurationTemplate
properties:
nicDevices:
description: NicDevice CRs matching this configuration template
items:
type: string
type: array
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: null
storedVersions: null
Loading
Loading