1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-06 08:47:04 +00:00

Add experimental note and fix subcmds flags naming

Signed-off-by: Marcin Franczyk <marcin0franczyk@gmail.com>
This commit is contained in:
Marcin Franczyk 2024-12-18 15:39:18 +01:00
parent 5b57312d74
commit 0b7661bf17
No known key found for this signature in database
GPG key ID: F9AC05762F39A284
5 changed files with 37 additions and 14 deletions

View file

@ -17,8 +17,6 @@ limitations under the License.
package v1alpha1 package v1alpha1
import ( import (
"fmt"
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
) )
@ -300,13 +298,6 @@ type MatchExpression struct {
Value MatchValue `json:"value,omitempty"` Value MatchValue `json:"value,omitempty"`
} }
func (m MatchExpression) String() string {
if len(m.Value) < 1 {
return fmt.Sprintf("{op: %q}", m.Op)
}
return fmt.Sprintf("{op: %q, value: %q}", m.Op, m.Value)
}
// MatchOp is the match operator that is applied on values when evaluating a // MatchOp is the match operator that is applied on values when evaluating a
// MatchExpression. // MatchExpression.
// +kubebuilder:validation:Enum="In";"NotIn";"InRegexp";"Exists";"DoesNotExist";"Gt";"Lt";"GtLt";"IsTrue";"IsFalse" // +kubebuilder:validation:Enum="In";"NotIn";"InRegexp";"Exists";"DoesNotExist";"Gt";"Lt";"GtLt";"IsTrue";"IsFalse"

29
api/nfd/v1alpha1/utils.go Normal file
View file

@ -0,0 +1,29 @@
/*
Copyright 2024 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
"fmt"
)
// String represents the match expression as a string type.
func (m MatchExpression) String() string {
if len(m.Value) < 1 {
return fmt.Sprintf("{op: %q}", m.Op)
}
return fmt.Sprintf("{op: %q, value: %q}", m.Op, m.Value)
}

View file

@ -62,7 +62,7 @@ var validateNodeCmd = &cobra.Command{
} }
if readAccessToken && readPassword { if readAccessToken && readPassword {
return fmt.Errorf("cannot use --read-access-token and --read-password at the same time") return fmt.Errorf("cannot use --registry-token-stdin and --registry-password-stdin at the same time")
} else if readAccessToken { } else if readAccessToken {
accessToken, err = readStdin() accessToken, err = readStdin()
if err != nil { if err != nil {
@ -214,9 +214,9 @@ func init() {
validateNodeCmd.Flags().StringVar(&platform.PlatformStr, "platform", "", "the artifact platform in the format os[/arch][/variant][:os_version]") validateNodeCmd.Flags().StringVar(&platform.PlatformStr, "platform", "", "the artifact platform in the format os[/arch][/variant][:os_version]")
validateNodeCmd.Flags().BoolVar(&plainHTTP, "plain-http", false, "use of HTTP protocol for all registry communications") validateNodeCmd.Flags().BoolVar(&plainHTTP, "plain-http", false, "use of HTTP protocol for all registry communications")
validateNodeCmd.Flags().BoolVar(&outputJSON, "output-json", false, "print a JSON object") validateNodeCmd.Flags().BoolVar(&outputJSON, "output-json", false, "print a JSON object")
validateNodeCmd.Flags().StringVar(&username, "reg-username", "", "registry username") validateNodeCmd.Flags().StringVar(&username, "registry-username", "", "registry username")
validateNodeCmd.Flags().BoolVar(&readPassword, "reg-password-stdin", false, "read registry password from stdin") validateNodeCmd.Flags().BoolVar(&readPassword, "registry-password-stdin", false, "read registry password from stdin")
validateNodeCmd.Flags().BoolVar(&readAccessToken, "reg-token-stdin", false, "read registry access token from stdin") validateNodeCmd.Flags().BoolVar(&readAccessToken, "registry-token-stdin", false, "read registry access token from stdin")
if err := validateNodeCmd.MarkFlagRequired("image"); err != nil { if err := validateNodeCmd.MarkFlagRequired("image"); err != nil {
panic(err) panic(err)

View file

@ -14,6 +14,7 @@ sort: 9
{:toc} {:toc}
--- ---
**The client is in the experimental `v1alpha1` version.**
To quickly view available command line flags execute `nfd --help`. To quickly view available command line flags execute `nfd --help`.

View file

@ -15,7 +15,9 @@ sort: 11
--- ---
## Image Compatibility (experimental: v1alpha1 version) ## Image Compatibility
**Image Compatibility is in the experimental `v1alpha1` version.**
Image compatibility metadata enables container image authors to define their Image compatibility metadata enables container image authors to define their
image requirements using [Node Feature Rules](./custom-resources.md#nodefeaturerule). image requirements using [Node Feature Rules](./custom-resources.md#nodefeaturerule).