forked from kubernetes-sigs/cluster-api-provider-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
🌱 feat: adds new nodeadm bootstrap type #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
c38276b
ci: adds unit tests
faiq 641b157
Merge pull request #2 from nutanix-cloud-native/faiq/unit-tests-on-pr
faiq 97049ce
feat: starts bootstrapping new type with kubebuilder
faiq 7e42d77
feat: adds fields to nodeadm config
faiq 7e108ee
refactor: use a common file resolver so nodeadmconfig can use it
faiq af310a2
feat: implements nodeadm config controller
faiq 3961c8b
fix: api type issues from copy paste mistakes
faiq 955a172
test: adds reconciler tests for nodeadm
faiq c51c989
fix: runs golangci-lint
faiq 2f2e34d
fix: boundries in userdata
faiq 66a5d18
fix: kubelet logic
faiq 59fbdbc
fix: adds nodeadmconfigtemplate crd
faiq 4e1fa66
fix: nodeadm kubelet config
faiq a961548
fix: handle runtime.Rawextension properly
faiq 3b4537a
e2e: adds test for nodeadm
faiq 4f4db0c
chore: fixes up tests to no longer require TEST_ENV variable
faiq f6d79e2
fix: we don't need to set eks specific labels
faiq 3537aa5
fix: removes local store options which isn't supported by capa
faiq c434fec
fix: use prenodeadm commands name
faiq File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,26 @@ | ||
name: PR run unit and integration tests | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- edited | ||
- labeled | ||
- reopened | ||
- synchronize | ||
|
||
jobs: | ||
approve: | ||
name: runs unit and integration tests | ||
if: contains(github.event.pull_request.labels.*.name, 'ok-to-test') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # tag=v4.2.2 | ||
- name: Calculate go version | ||
id: vars | ||
run: echo "go_version=$(make go-version)" >> $GITHUB_OUTPUT | ||
- name: Set up Go | ||
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # tag=v6.0.0 | ||
with: | ||
go-version: ${{ steps.vars.outputs.go_version }} | ||
- name: Run runs-test | ||
run: make test |
This file contains hidden or 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 |
---|---|---|
|
@@ -15,4 +15,4 @@ resources: | |
- group: bootstrap | ||
kind: EKSConfigTemplate | ||
version: v1beta2 | ||
version: "2" | ||
version: "3" |
This file contains hidden or 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
This file contains hidden or 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,144 @@ | ||
package v1beta2 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
|
||
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" | ||
) | ||
|
||
// NodeadmConfigSpec defines the desired state of NodeadmConfig. | ||
type NodeadmConfigSpec struct { | ||
// Kubelet contains options for kubelet. | ||
// +optional | ||
Kubelet *KubeletOptions `json:"kubelet,omitempty"` | ||
|
||
// Containerd contains options for containerd. | ||
// +optional | ||
Containerd *ContainerdOptions `json:"containerd,omitempty"` | ||
|
||
// FeatureGates holds key-value pairs to enable or disable application features. | ||
// +optional | ||
FeatureGates map[Feature]bool `json:"featureGates,omitempty"` | ||
|
||
// PreNodeadmCommands specifies extra commands to run before bootstrapping nodes. | ||
// +optional | ||
PreNodeadmCommands []string `json:"PreNodeadmCommands,omitempty"` | ||
|
||
// Files specifies extra files to be passed to user_data upon creation. | ||
// +optional | ||
Files []File `json:"files,omitempty"` | ||
|
||
// Users specifies extra users to add. | ||
// +optional | ||
Users []User `json:"users,omitempty"` | ||
|
||
// NTP specifies NTP configuration. | ||
// +optional | ||
NTP *NTP `json:"ntp,omitempty"` | ||
|
||
// DiskSetup specifies options for the creation of partition tables and file systems on devices. | ||
// +optional | ||
DiskSetup *DiskSetup `json:"diskSetup,omitempty"` | ||
|
||
// Mounts specifies a list of mount points to be setup. | ||
// +optional | ||
Mounts []MountPoints `json:"mounts,omitempty"` | ||
} | ||
|
||
// KubeletOptions are additional parameters passed to kubelet. | ||
type KubeletOptions struct { | ||
// Config is a KubeletConfiguration that will be merged with the defaults. | ||
// +optional | ||
// +kubebuilder:pruning:PreserveUnknownFields | ||
Config *runtime.RawExtension `json:"config,omitempty"` | ||
|
||
// Flags are command-line kubelet arguments that will be appended to the defaults. | ||
// +optional | ||
Flags []string `json:"flags,omitempty"` | ||
} | ||
|
||
// ContainerdOptions are additional parameters passed to containerd. | ||
type ContainerdOptions struct { | ||
// Config is an inline containerd configuration TOML that will be merged with the defaults. | ||
dkoshkin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// +optional | ||
Config string `json:"config,omitempty"` | ||
|
||
// BaseRuntimeSpec is the OCI runtime specification upon which all containers will be based. | ||
// +optional | ||
// +kubebuilder:pruning:PreserveUnknownFields | ||
BaseRuntimeSpec *runtime.RawExtension `json:"baseRuntimeSpec,omitempty"` | ||
} | ||
|
||
// Feature specifies which feature gate should be toggled. | ||
// +kubebuilder:validation:Enum=InstanceIdNodeName;FastImagePull | ||
type Feature string | ||
|
||
const ( | ||
// FeatureInstanceIDNodeName will use EC2 instance ID as node name. | ||
FeatureInstanceIDNodeName Feature = "InstanceIdNodeName" | ||
// FeatureFastImagePull enables a parallel image pull for container images. | ||
FeatureFastImagePull Feature = "FastImagePull" | ||
) | ||
|
||
// GetConditions returns the observations of the operational state of the NodeadmConfig resource. | ||
func (r *NodeadmConfig) GetConditions() clusterv1.Conditions { | ||
return r.Status.Conditions | ||
} | ||
|
||
// SetConditions sets the underlying service state of the NodeadmConfig to the predescribed clusterv1.Conditions. | ||
func (r *NodeadmConfig) SetConditions(conditions clusterv1.Conditions) { | ||
r.Status.Conditions = conditions | ||
} | ||
|
||
// NodeadmConfigStatus defines the observed state of NodeadmConfig. | ||
type NodeadmConfigStatus struct { | ||
// Ready indicates the BootstrapData secret is ready to be consumed. | ||
// +optional | ||
Ready bool `json:"ready,omitempty"` | ||
|
||
// DataSecretName is the name of the secret that stores the bootstrap data script. | ||
// +optional | ||
DataSecretName *string `json:"dataSecretName,omitempty"` | ||
|
||
// FailureReason will be set on non-retryable errors. | ||
// +optional | ||
FailureReason string `json:"failureReason,omitempty"` | ||
|
||
// FailureMessage will be set on non-retryable errors. | ||
// +optional | ||
FailureMessage string `json:"failureMessage,omitempty"` | ||
|
||
// ObservedGeneration is the latest generation observed by the controller. | ||
// +optional | ||
ObservedGeneration int64 `json:"observedGeneration,omitempty"` | ||
|
||
// Conditions defines current service state of the NodeadmConfig. | ||
// +optional | ||
Conditions clusterv1.Conditions `json:"conditions,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
faiq marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// NodeadmConfig is the Schema for the nodeadmconfigs API. | ||
type NodeadmConfig struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec NodeadmConfigSpec `json:"spec,omitempty"` | ||
Status NodeadmConfigStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// NodeadmConfigList contains a list of NodeadmConfig. | ||
type NodeadmConfigList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []NodeadmConfig `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&NodeadmConfig{}, &NodeadmConfigList{}) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.