mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-15 17:50:49 +00:00
Merge pull request #351 from ArangoGutierrez/image_make
Fix Makefile to take vaules from ENV VAR values
This commit is contained in:
commit
535dd0bb3a
2 changed files with 38 additions and 12 deletions
22
Makefile
22
Makefile
|
@ -1,23 +1,23 @@
|
||||||
.PHONY: all test yamls
|
.PHONY: all test yamls
|
||||||
.FORCE:
|
.FORCE:
|
||||||
|
|
||||||
GO_CMD := go
|
GO_CMD ?= go
|
||||||
GO_FMT := gofmt
|
GO_FMT ?= gofmt
|
||||||
|
|
||||||
IMAGE_BUILD_CMD := docker build
|
IMAGE_BUILD_CMD ?= docker build
|
||||||
IMAGE_BUILD_EXTRA_OPTS :=
|
IMAGE_BUILD_EXTRA_OPTS ?=
|
||||||
IMAGE_PUSH_CMD := docker push
|
IMAGE_PUSH_CMD ?= docker push
|
||||||
|
|
||||||
VERSION := $(shell git describe --tags --dirty --always)
|
VERSION := $(shell git describe --tags --dirty --always)
|
||||||
|
|
||||||
IMAGE_REGISTRY := k8s.gcr.io/nfd
|
IMAGE_REGISTRY ?= k8s.gcr.io/nfd
|
||||||
IMAGE_NAME := node-feature-discovery
|
IMAGE_NAME ?= node-feature-discovery
|
||||||
IMAGE_TAG_NAME := $(VERSION)
|
IMAGE_TAG_NAME ?= $(VERSION)
|
||||||
IMAGE_EXTRA_TAG_NAMES :=
|
IMAGE_EXTRA_TAG_NAMES ?=
|
||||||
IMAGE_REPO := $(IMAGE_REGISTRY)/$(IMAGE_NAME)
|
IMAGE_REPO := $(IMAGE_REGISTRY)/$(IMAGE_NAME)
|
||||||
IMAGE_TAG := $(IMAGE_REPO):$(IMAGE_TAG_NAME)
|
IMAGE_TAG := $(IMAGE_REPO):$(IMAGE_TAG_NAME)
|
||||||
IMAGE_EXTRA_TAGS := $(foreach tag,$(IMAGE_EXTRA_TAG_NAMES),$(IMAGE_REPO):$(tag))
|
IMAGE_EXTRA_TAGS := $(foreach tag,$(IMAGE_EXTRA_TAG_NAMES),$(IMAGE_REPO):$(tag))
|
||||||
K8S_NAMESPACE := kube-system
|
K8S_NAMESPACE ?= kube-system
|
||||||
|
|
||||||
# We use different mount prefix for local and container builds.
|
# We use different mount prefix for local and container builds.
|
||||||
# Take CONTAINER_HOSTMOUNT_PREFIX from HOSTMOUNT_PREFIX if only the latter is specified
|
# Take CONTAINER_HOSTMOUNT_PREFIX from HOSTMOUNT_PREFIX if only the latter is specified
|
||||||
|
@ -26,7 +26,7 @@ ifdef HOSTMOUNT_PREFIX
|
||||||
else
|
else
|
||||||
CONTAINER_HOSTMOUNT_PREFIX := /host-
|
CONTAINER_HOSTMOUNT_PREFIX := /host-
|
||||||
endif
|
endif
|
||||||
HOSTMOUNT_PREFIX := /
|
HOSTMOUNT_PREFIX ?= /
|
||||||
|
|
||||||
KUBECONFIG :=
|
KUBECONFIG :=
|
||||||
E2E_TEST_CONFIG :=
|
E2E_TEST_CONFIG :=
|
||||||
|
|
28
README.md
28
README.md
|
@ -286,6 +286,7 @@ capability might be supported but not enabled.
|
||||||
| DCPOP | Persistent Memory Support
|
| DCPOP | Persistent Memory Support
|
||||||
|
|
||||||
### Custom Features
|
### Custom Features
|
||||||
|
|
||||||
The Custom feature source allows the user to define features based on a mix of predefined rules.
|
The Custom feature source allows the user to define features based on a mix of predefined rules.
|
||||||
A rule is provided input witch affects its process of matching for a defined feature.
|
A rule is provided input witch affects its process of matching for a defined feature.
|
||||||
|
|
||||||
|
@ -293,6 +294,7 @@ To aid in making Custom Features clearer, we define a general and a per rule nom
|
||||||
consistent as possible.
|
consistent as possible.
|
||||||
|
|
||||||
#### General Nomenclature & Definitions
|
#### General Nomenclature & Definitions
|
||||||
|
|
||||||
```
|
```
|
||||||
Rule :Represents a matching logic that is used to match on a feature.
|
Rule :Represents a matching logic that is used to match on a feature.
|
||||||
Rule Input :The input a Rule is provided. This determines how a Rule performs the match operation.
|
Rule Input :The input a Rule is provided. This determines how a Rule performs the match operation.
|
||||||
|
@ -300,6 +302,7 @@ Matcher :A composition of Rules, each Matcher may be composed of at most one
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Custom Features Format (using the Nomenclature defined above)
|
#### Custom Features Format (using the Nomenclature defined above)
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: <feature name>
|
- name: <feature name>
|
||||||
matchOn:
|
matchOn:
|
||||||
|
@ -316,6 +319,7 @@ Matcher :A composition of Rules, each Matcher may be composed of at most one
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Matching process
|
#### Matching process
|
||||||
|
|
||||||
Specifying Rules to match on a feature is done by providing a list of Matchers.
|
Specifying Rules to match on a feature is done by providing a list of Matchers.
|
||||||
Each Matcher contains one or more Rules.
|
Each Matcher contains one or more Rules.
|
||||||
|
|
||||||
|
@ -325,6 +329,7 @@ of a given Matcher.
|
||||||
#### Rules
|
#### Rules
|
||||||
##### PciId Rule
|
##### PciId Rule
|
||||||
###### Nomenclature
|
###### Nomenclature
|
||||||
|
|
||||||
```
|
```
|
||||||
Attribute :A PCI attribute.
|
Attribute :A PCI attribute.
|
||||||
Element :An identifier of the PCI attribute.
|
Element :An identifier of the PCI attribute.
|
||||||
|
@ -334,6 +339,7 @@ The PciId Rule allows matching the PCI devices in the system on the following At
|
||||||
`device`. A list of Elements is provided for each Attribute.
|
`device`. A list of Elements is provided for each Attribute.
|
||||||
|
|
||||||
###### Format
|
###### Format
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
pciId :
|
pciId :
|
||||||
class: [<class id>, ...]
|
class: [<class id>, ...]
|
||||||
|
@ -347,6 +353,7 @@ At least one Attribute must be specified. Missing attributes will not partake in
|
||||||
|
|
||||||
##### UsbId Rule
|
##### UsbId Rule
|
||||||
###### Nomenclature
|
###### Nomenclature
|
||||||
|
|
||||||
```
|
```
|
||||||
Attribute :A USB attribute.
|
Attribute :A USB attribute.
|
||||||
Element :An identifier of the USB attribute.
|
Element :An identifier of the USB attribute.
|
||||||
|
@ -356,6 +363,7 @@ The UsbId Rule allows matching the USB devices in the system on the following At
|
||||||
`device`. A list of Elements is provided for each Attribute.
|
`device`. A list of Elements is provided for each Attribute.
|
||||||
|
|
||||||
###### Format
|
###### Format
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
usbId :
|
usbId :
|
||||||
class: [<class id>, ...]
|
class: [<class id>, ...]
|
||||||
|
@ -369,6 +377,7 @@ At least one Attribute must be specified. Missing attributes will not partake in
|
||||||
|
|
||||||
##### LoadedKMod Rule
|
##### LoadedKMod Rule
|
||||||
###### Nomenclature
|
###### Nomenclature
|
||||||
|
|
||||||
```
|
```
|
||||||
Element :A kernel module
|
Element :A kernel module
|
||||||
```
|
```
|
||||||
|
@ -376,6 +385,7 @@ Element :A kernel module
|
||||||
The LoadedKMod Rule allows matching the loaded kernel modules in the system against a provided list of Elements.
|
The LoadedKMod Rule allows matching the loaded kernel modules in the system against a provided list of Elements.
|
||||||
|
|
||||||
###### Format
|
###### Format
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
loadedKMod : [<kernel module>, ...]
|
loadedKMod : [<kernel module>, ...]
|
||||||
```
|
```
|
||||||
|
@ -383,6 +393,7 @@ loadedKMod : [<kernel module>, ...]
|
||||||
in the system.
|
in the system.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
custom:
|
custom:
|
||||||
- name: "my.kernel.feature"
|
- name: "my.kernel.feature"
|
||||||
|
@ -427,6 +438,7 @@ if `some_kmod1` _AND_ `some_kmod2` kernel modules are loaded __OR__ the node con
|
||||||
with a PCI vendor ID of `15b3` _AND_ PCI device ID of `1014` _OR_ `1017`.
|
with a PCI vendor ID of `15b3` _AND_ PCI device ID of `1014` _OR_ `1017`.
|
||||||
|
|
||||||
#### Statically defined features
|
#### Statically defined features
|
||||||
|
|
||||||
Some feature labels which are common and generic are defined statically in the `custom` feature source.
|
Some feature labels which are common and generic are defined statically in the `custom` feature source.
|
||||||
A user may add additional Matchers to these feature labels by defining them in the `nfd-worker` configuration file.
|
A user may add additional Matchers to these feature labels by defining them in the `nfd-worker` configuration file.
|
||||||
|
|
||||||
|
@ -585,6 +597,7 @@ created a shared area for delivering hooks and feature files to NFD.
|
||||||
|
|
||||||
|
|
||||||
#### A Hook Example
|
#### A Hook Example
|
||||||
|
|
||||||
User has a shell script
|
User has a shell script
|
||||||
`/etc/kubernetes/node-feature-discovery/source.d/my-source` which has the
|
`/etc/kubernetes/node-feature-discovery/source.d/my-source` which has the
|
||||||
following `stdout` output:
|
following `stdout` output:
|
||||||
|
@ -605,6 +618,7 @@ override.namespace/value=456
|
||||||
```
|
```
|
||||||
|
|
||||||
#### A File Example
|
#### A File Example
|
||||||
|
|
||||||
User has a file
|
User has a file
|
||||||
`/etc/kubernetes/node-feature-discovery/features.d/my-source` which contains the
|
`/etc/kubernetes/node-feature-discovery/features.d/my-source` which contains the
|
||||||
following lines:
|
following lines:
|
||||||
|
@ -878,6 +892,7 @@ attribute in the spec template(s) to the new location
|
||||||
(`<registry-name>/<image-name>[:<version>]`).
|
(`<registry-name>/<image-name>[:<version>]`).
|
||||||
|
|
||||||
### Customizing the Build
|
### Customizing the Build
|
||||||
|
|
||||||
There are several Makefile variables that control the build process and the
|
There are several Makefile variables that control the build process and the
|
||||||
name of the resulting container image.
|
name of the resulting container image.
|
||||||
|
|
||||||
|
@ -899,13 +914,24 @@ name of the resulting container image.
|
||||||
| E2E_TEST_CONFIG | Parameterization file of e2e-tests (see [example](test/e2e/e2e-test-config.exapmle.yaml)) | *empty*
|
| E2E_TEST_CONFIG | Parameterization file of e2e-tests (see [example](test/e2e/e2e-test-config.exapmle.yaml)) | *empty*
|
||||||
|
|
||||||
For example, to use a custom registry:
|
For example, to use a custom registry:
|
||||||
|
|
||||||
```
|
```
|
||||||
make IMAGE_REGISTRY=<my custom registry uri>
|
make IMAGE_REGISTRY=<my custom registry uri>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Or to specify a build tool different from Docker:
|
Or to specify a build tool different from Docker:
|
||||||
|
|
||||||
|
It can be done in 2 ways, by pre-defining the variable
|
||||||
|
|
||||||
```
|
```
|
||||||
make IMAGE_BUILD_CMD="buildah bud"
|
IMAGE_BUILD_CMD="buildah bud" make
|
||||||
|
```
|
||||||
|
|
||||||
|
Or By overriding the variable value
|
||||||
|
|
||||||
|
```
|
||||||
|
make IMAGE_BUILD_CMD="buildah bud"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
|
Loading…
Reference in a new issue