Skip to content

Commit 8c279d4

Browse files
Merge pull request #57 from almaslennikov/ocp
2 parents e336ed9 + c5d8e86 commit 8c279d4

37 files changed

+1232
-374
lines changed

.github/workflows/image-push-release.yml

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@ on:
33
push:
44
tags:
55
- v*
6+
env:
7+
REGISTRY: "ghcr.io"
8+
OPERATOR_IMAGE_NAME: "nic-configuration-operator"
9+
DAEMON_IMAGE_NAME: "nic-configuration-operator-daemon"
610
jobs:
711
image-build-push:
812
name: Image build and push
913
runs-on: ubuntu-latest
1014
steps:
11-
- name: Set repository as lower-case output variable
12-
id: repo_name
13-
run: echo ::set-output name=repository::$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')
15+
- name: Set repository owner as lower-case output variable
16+
id: repo_owner
17+
run: echo REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
1418
- name: Check out code into the Go module directory
1519
uses: actions/checkout@v4
1620
with:
@@ -22,14 +26,14 @@ jobs:
2226
- name: Login to GitHub Container Registry
2327
uses: docker/login-action@v3
2428
with:
25-
registry: ghcr.io
29+
registry: ${{ env.REGISTRY }}
2630
username: ${{ github.repository_owner }}
2731
password: ${{ secrets.GITHUB_TOKEN }}
2832
- name: Docker operator image meta
2933
id: docker_meta_operator
3034
uses: docker/metadata-action@v5
3135
with:
32-
images: ghcr.io/${{ steps.repo_name.outputs.repository }}
36+
images: ${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/${{ env.OPERATOR_IMAGE_NAME }}
3337
tags: |
3438
type=ref,event=tag
3539
flavor: |
@@ -46,7 +50,7 @@ jobs:
4650
id: docker_meta_daemon
4751
uses: docker/metadata-action@v5
4852
with:
49-
images: ghcr.io/${{ steps.repo_name.outputs.repository }}-daemon
53+
images: ${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/${{ env.DAEMON_IMAGE_NAME }}
5054
tags: |
5155
type=ref,event=tag
5256
flavor: |
@@ -60,4 +64,34 @@ jobs:
6064
${{ steps.docker_meta_daemon.outputs.tags }}
6165
labels: ${{ steps.docker_meta_daemon.outputs.labels }}
6266
file: ./Dockerfile.nic-configuration-daemon
63-
67+
- name: Determine version, tag, and base branch
68+
run: |
69+
git_tag=${{ github.ref_name }}
70+
echo VERSION_WITH_PREFIX=$git_tag >> $GITHUB_ENV
71+
echo VERSION_WITHOUT_PREFIX=${git_tag:1} >> $GITHUB_ENV # without the 'v' prefix
72+
if echo $git_tag | grep beta; then
73+
base_branch=$DEFAULT_BRANCH
74+
else
75+
v_major_minor=$(echo $git_tag | grep -Eo '^v[0-9]+\.[0-9]+')
76+
base_branch=$v_major_minor.x
77+
fi
78+
echo BASE_BRANCH=$base_branch >> $GITHUB_ENV
79+
- name: Lookup image digest
80+
run: |
81+
operator_digest=$(skopeo inspect docker://$REGISTRY/$REPO_OWNER/$OPERATOR_IMAGE_NAME:$VERSION_WITH_PREFIX | jq -r .Digest)
82+
echo $operator_digest | wc -w | grep 1 # verifies value not empty
83+
echo OPERATOR_DIGEST=$operator_digest >> $GITHUB_ENV
84+
daemon_digest=$(skopeo inspect docker://$REGISTRY/$REPO_OWNER/$DAEMON_IMAGE_NAME:$VERSION_WITH_PREFIX | jq -r .Digest)
85+
echo $daemon_digest | wc -w | grep 1 # verifies value not empty
86+
echo DAEMON_DIGEST=$daemon_digest >> $GITHUB_ENV
87+
- name: Make bundle
88+
env:
89+
OPERATOR_IMAGE_TAG: ${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/${{ env.OPERATOR_IMAGE_NAME }}@${{ env.OPERATOR_DIGEST }}
90+
CONFIG_DAEMON_IMAGE_TAG: ${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/${{ env.DAEMON_IMAGE_NAME }}@${{ env.DAEMON_DIGEST }}
91+
BUNDLE_IMG: ${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/${{ env.OPERATOR_IMAGE_NAME }}-bundle:${{ github.ref_name }}
92+
VERSION: ${{ env.VERSION_WITHOUT_PREFIX }}
93+
run: |
94+
version_major_minor=$(echo $VERSION_WITH_PREFIX | grep -Eo 'v[0-9]+\.[0-9]+')
95+
export CHANNELS=stable,$version_major_minor
96+
export DEFAULT_CHANNEL=$version_major_minor
97+
make bundle bundle-build bundle-push

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ ifeq ($(USE_IMAGE_DIGESTS), true)
4242
BUNDLE_GEN_FLAGS += --use-image-digests
4343
endif
4444

45+
BUNDLE_OCP_VERSIONS=v4.14-v4.17
46+
4547
# Set the Operator SDK version to use. By default, what is installed on the system is used.
4648
# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
4749
OPERATOR_SDK_VERSION ?= v1.36.0
@@ -335,7 +337,9 @@ endif
335337
bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metadata, then validate generated files.
336338
$(OPERATOR_SDK) generate kustomize manifests -q
337339
cd config/manager && $(KUSTOMIZE) edit set image controller=$(OPERATOR_IMAGE_TAG)
340+
cd config/daemon && $(KUSTOMIZE) edit set configmap config --from-literal=configDaemonImage=$(CONFIG_DAEMON_IMAGE_TAG) --from-literal=releaseVersion=${VERSION}
338341
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS)
342+
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
339343
$(OPERATOR_SDK) bundle validate ./bundle
340344

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

345349
.PHONY: bundle-push
346350
bundle-push: ## Push the bundle image.
347-
$(MAKE) docker-push IMG=$(BUNDLE_IMG)
351+
$(CONTAINER_TOOL) push $(BUNDLE_IMG)
348352

349353
.PHONY: opm
350354
OPM = $(LOCALBIN)/opm

PROJECT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ layout:
88
plugins:
99
manifests.sdk.operatorframework.io/v2: {}
1010
scorecard.sdk.operatorframework.io/v2: {}
11-
projectName: nic-configuration-operator
11+
projectName: nvidia-nic-configuration-operator
1212
repo: github.com/Mellanox/nic-configuration-operator
1313
resources:
1414
- api:
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
annotations:
5+
controller-gen.kubebuilder.io/version: v0.14.0
6+
creationTimestamp: null
7+
name: nicconfigurationtemplates.configuration.net.nvidia.com
8+
spec:
9+
group: configuration.net.nvidia.com
10+
names:
11+
kind: NicConfigurationTemplate
12+
listKind: NicConfigurationTemplateList
13+
plural: nicconfigurationtemplates
14+
singular: nicconfigurationtemplate
15+
scope: Namespaced
16+
versions:
17+
- name: v1alpha1
18+
schema:
19+
openAPIV3Schema:
20+
description: NicConfigurationTemplate is the Schema for the nicconfigurationtemplates
21+
API
22+
properties:
23+
apiVersion:
24+
description: |-
25+
APIVersion defines the versioned schema of this representation of an object.
26+
Servers should convert recognized schemas to the latest internal value, and
27+
may reject unrecognized values.
28+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
29+
type: string
30+
kind:
31+
description: |-
32+
Kind is a string value representing the REST resource this object represents.
33+
Servers may infer this from the endpoint the client submits requests to.
34+
Cannot be updated.
35+
In CamelCase.
36+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
37+
type: string
38+
metadata:
39+
type: object
40+
spec:
41+
description: Defines the desired state of NICs
42+
properties:
43+
nicSelector:
44+
description: NIC selector configuration
45+
properties:
46+
nicType:
47+
description: Type of the NIC to be selected, e.g. 101d,1015,a2d6
48+
etc.
49+
type: string
50+
pciAddresses:
51+
description: Array of PCI addresses to be selected, e.g. "0000:03:00.0"
52+
items:
53+
type: string
54+
type: array
55+
serialNumbers:
56+
description: Serial numbers of the NICs to be selected, e.g. MT2116X09299
57+
items:
58+
type: string
59+
type: array
60+
required:
61+
- nicType
62+
type: object
63+
nodeSelector:
64+
additionalProperties:
65+
type: string
66+
description: NodeSelector contains labels required on the node
67+
type: object
68+
resetToDefault:
69+
default: false
70+
description: |-
71+
ResetToDefault specifies whether node agent needs to perform a reset flow
72+
The following operations will be performed:
73+
* Nvconfig reset of all non-volatile configurations
74+
- Mstconfig -d <device> reset for each PF
75+
- Mstconfig -d <device> set ADVANCED_PCI_SETTINGS=1
76+
* Node reboot
77+
- Applies new NIC NV config
78+
- Will undo any runtime configuration previously performed for the device/driver
79+
type: boolean
80+
template:
81+
description: Configuration template to be applied to matching devices
82+
properties:
83+
gpuDirectOptimized:
84+
description: GPU Direct optimization settings
85+
properties:
86+
enabled:
87+
description: Optimize GPU Direct
88+
type: boolean
89+
env:
90+
description: GPU direct environment, e.g. Baremetal
91+
type: string
92+
required:
93+
- enabled
94+
- env
95+
type: object
96+
linkType:
97+
description: LinkType to be configured, Ethernet|Infiniband
98+
enum:
99+
- Ethernet
100+
- Infiniband
101+
type: string
102+
numVfs:
103+
description: Number of VFs to be configured
104+
type: integer
105+
pciPerformanceOptimized:
106+
description: PCI performance optimization settings
107+
properties:
108+
enabled:
109+
description: Specifies whether to enable PCI performance optimization
110+
type: boolean
111+
maxAccOutRead:
112+
description: Specifies the PCIe Max Accumulative Outstanding
113+
read bytes
114+
type: integer
115+
maxReadRequest:
116+
description: Specifies the size of a single PCI read request
117+
in bytes
118+
enum:
119+
- 128
120+
- 256
121+
- 512
122+
- 1024
123+
- 2048
124+
- 4096
125+
type: integer
126+
required:
127+
- enabled
128+
type: object
129+
roceOptimized:
130+
description: RoCE optimization settings
131+
properties:
132+
enabled:
133+
description: Optimize RoCE
134+
type: boolean
135+
qos:
136+
description: Quality of Service settings
137+
properties:
138+
pfc:
139+
description: Priority-based Flow Control configuration,
140+
e.g. "0,0,0,1,0,0,0,0"
141+
pattern: ^([01],){7}[01]$
142+
type: string
143+
trust:
144+
description: Trust mode for QoS settings, e.g. trust-dscp
145+
type: string
146+
required:
147+
- pfc
148+
- trust
149+
type: object
150+
required:
151+
- enabled
152+
type: object
153+
required:
154+
- linkType
155+
- numVfs
156+
type: object
157+
required:
158+
- nicSelector
159+
- template
160+
type: object
161+
status:
162+
description: Defines the observed state of NicConfigurationTemplate
163+
properties:
164+
nicDevices:
165+
description: NicDevice CRs matching this configuration template
166+
items:
167+
type: string
168+
type: array
169+
type: object
170+
type: object
171+
served: true
172+
storage: true
173+
subresources:
174+
status: {}
175+
status:
176+
acceptedNames:
177+
kind: ""
178+
plural: ""
179+
conditions: null
180+
storedVersions: null

0 commit comments

Comments
 (0)