Skip to content

Commit

Permalink
Add experimental note and fix subcmds flags naming
Browse files Browse the repository at this point in the history
Signed-off-by: Marcin Franczyk <marcin0franczyk@gmail.com>
  • Loading branch information
mfranczy committed Dec 18, 2024
1 parent 5b57312 commit 0b7661b
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 14 deletions.
9 changes: 0 additions & 9 deletions api/nfd/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ limitations under the License.
package v1alpha1

import (
"fmt"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down Expand Up @@ -300,13 +298,6 @@ type MatchExpression struct {
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
// MatchExpression.
// +kubebuilder:validation:Enum="In";"NotIn";"InRegexp";"Exists";"DoesNotExist";"Gt";"Lt";"GtLt";"IsTrue";"IsFalse"
Expand Down
29 changes: 29 additions & 0 deletions api/nfd/v1alpha1/utils.go
Original file line number Diff line number Diff line change
@@ -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)
}
8 changes: 4 additions & 4 deletions cmd/nfd/subcmd/compat/validate-node.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var validateNodeCmd = &cobra.Command{
}

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 {
accessToken, err = readStdin()
if err != nil {
Expand Down Expand Up @@ -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().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().StringVar(&username, "reg-username", "", "registry username")
validateNodeCmd.Flags().BoolVar(&readPassword, "reg-password-stdin", false, "read registry password from stdin")
validateNodeCmd.Flags().BoolVar(&readAccessToken, "reg-token-stdin", false, "read registry access token from stdin")
validateNodeCmd.Flags().StringVar(&username, "registry-username", "", "registry username")
validateNodeCmd.Flags().BoolVar(&readPassword, "registry-password-stdin", false, "read registry password from stdin")
validateNodeCmd.Flags().BoolVar(&readAccessToken, "registry-token-stdin", false, "read registry access token from stdin")

if err := validateNodeCmd.MarkFlagRequired("image"); err != nil {
panic(err)
Expand Down
1 change: 1 addition & 0 deletions docs/reference/node-feature-client-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ sort: 9
{:toc}

---
**The client is in the experimental `v1alpha1` version.**

To quickly view available command line flags execute `nfd --help`.

Expand Down
4 changes: 3 additions & 1 deletion docs/usage/image-compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 requirements using [Node Feature Rules](./custom-resources.md#nodefeaturerule).
Expand Down

0 comments on commit 0b7661b

Please # to comment.