-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feature: support kubeadm.k8s.io/v1beta4 #3675
Open
ls-2018
wants to merge
1
commit into
kubernetes-sigs:main
Choose a base branch
from
translatecn:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 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,89 @@ | ||
/* | ||
Copyright 2019 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 config implements the kubeadm config action | ||
package config | ||
|
||
import ( | ||
"log" | ||
"sigs.k8s.io/kind/pkg/cluster/internal/kubeadm" | ||
internalencoding "sigs.k8s.io/kind/pkg/internal/apis/config/encoding" | ||
"sigs.k8s.io/kind/pkg/internal/patch" | ||
"strings" | ||
"testing" | ||
) | ||
|
||
func TestConfig(t *testing.T) { | ||
cases := []struct { | ||
Name string | ||
Input string | ||
SubString string | ||
}{ | ||
{ | ||
Name: "Check if extraEnvs takes effect", | ||
Input: `kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
nodes: | ||
- role: control-plane | ||
extraPortMappings: | ||
- containerPort: 6443 | ||
hostPort: 6443 | ||
protocol: TCP | ||
- role: worker | ||
kubeadmConfigPatches: | ||
- | | ||
kind: ClusterConfiguration | ||
apiServer: | ||
certSANs: | ||
- localhost | ||
extraEnvs: | ||
- name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT | ||
value: http://10.230.205.190:5080/api/default/traces | ||
`, SubString: "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", | ||
}, | ||
} | ||
|
||
for _, tc := range cases { | ||
tc := tc // capture tc | ||
t.Run(tc.Name, func(t *testing.T) { | ||
t.Parallel() | ||
|
||
cfg, err := internalencoding.Parse([]byte(tc.Input)) | ||
data := kubeadm.ConfigData{ | ||
ClusterName: "test", | ||
KubernetesVersion: "v1.31.0", | ||
} | ||
cf, err := kubeadm.Config(data) | ||
if err != nil { | ||
log.Fatalln(err) | ||
} | ||
clusterPatches, clusterJSONPatches := allPatchesFromConfig(cfg) | ||
// apply cluster-level patches first | ||
patchedConfig, err := patch.KubeYAML(cf, clusterPatches, clusterJSONPatches) | ||
if err != nil { | ||
log.Fatalln(err) | ||
} | ||
// if needed, apply current node's patches | ||
if len(cfg.KubeadmConfigPatches) > 0 || len(cfg.KubeadmConfigPatchesJSON6902) > 0 { | ||
patchedConfig, _ = patch.KubeYAML(patchedConfig, cfg.KubeadmConfigPatches, cfg.KubeadmConfigPatchesJSON6902) | ||
} | ||
if !strings.Contains(patchedConfig, tc.SubString) { | ||
log.Fatalln(tc.Name, "invalid") | ||
} | ||
}) | ||
} | ||
|
||
}g |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any changes we need to be aware of ...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are some of the changes, such as :
v1beta3
v1beta4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no question that we will adopt v1beta4, my question is are there any breaking changes or other changes we should be aware of when adopting it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't find anything else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the above v1beta4 struct is not correct in terms of extra args for v1beta4. in the new versions they are a slice of key-value pairs. breaking changes are enumerated here:
https://groups.google.com/g/kubernetes-sig-cluster-lifecycle/c/9HgtTf0W1hk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing extraArgs like this makes sense but a lot of kind configs will need to start targeting specific kubeadm versions when we roll this out because they've been patching extraArgs portably across versions as a subset of the config patched
@ls-2018 that includes
kind/hack/ci/e2e-k8s.sh
Line 97 in 00d659b
which will be somewhat complicated.