-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
53a5ab3
commit 6f81072
Showing
3 changed files
with
394 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
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 v1beta1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
type ModuleNodeSpec struct { | ||
Name string `json:"name"` | ||
Namespace string `json:"namespace"` | ||
ContainerImage string `json:"containerImage"` | ||
//+optional | ||
InTreeModuleToRemove string `json:"inTreeModuleToRemove,omitempty"` | ||
Modprobe ModprobeSpec `json:"modprobe"` | ||
KmodLoaded bool `json:"kmodLoaded"` | ||
} | ||
|
||
// NodeModulesStateSpec describes the desired state of modules on the node | ||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status | ||
// +kubebuilder:validation:Required | ||
type NodeModulesStateSpec struct { | ||
// ModuleStateSpec list the spec of all the modules that need to be executed | ||
// on the node | ||
Modules []ModuleNodeSpec `json:"modules,omitempty" patchStrategy:"merge" patchMergeKey:"type"` | ||
} | ||
|
||
type ModuleNodeStatus struct { | ||
Name string `json:"name"` | ||
Namespace string `json:"namespace"` | ||
KmodLoaded bool `json:"kmodLoaded"` | ||
} | ||
|
||
// NodeModuleStateStatus is the most recently observed status of the KMM modules on node. | ||
// It is populated by the system and is read-only. | ||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status | ||
type NodeModulesStateStatus struct { | ||
// Modules contain observations about each Module's node state status | ||
// +patchMergeKey=type | ||
// +patchStrategy=merge | ||
// +optional | ||
Modules []ModuleNodeStatus `json:"modules,omitempty" patchStrategy:"merge" patchMergeKey:"type"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
|
||
// NodeModulesState keeps a KMM state of a node on the current Kubernetes cluster. | ||
// +kubebuilder:resource:path=nodemodulestates,scope=Cluster | ||
// +kubebuilder:resource:path=nodemodulestates,scope=Cluster,shortName=nms | ||
// +operator-sdk:csv:customresourcedefinitions:displayName="Node Modules State" | ||
type NodeModulesState struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec NodeModulesStateSpec `json:"spec,omitempty"` | ||
Status NodeModulesStateStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// NodeModulesStateList is a list of NodeModulesState objects. | ||
type NodeModulesStateList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
|
||
// List of NodeState. More info: | ||
// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md | ||
Items []NodeModulesState `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&NodeModulesState{}, &NodeModulesStateList{}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.