Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (h *testHandler) Mutate(

func machineVars() map[string]apiextensionsv1.JSON {
return map[string]apiextensionsv1.JSON{
"builtin": {Raw: []byte(`{"machineDeployment": {"class": "a-worker"}}`)},
runtimehooksv1.BuiltinsName: {Raw: []byte(`{"machineDeployment": {"class": "a-worker"}}`)},
}
}

Expand Down
18 changes: 9 additions & 9 deletions common/pkg/capi/clustertopology/patches/matchers/match_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func TestMatchesSelector(t *testing.T) {
FieldPath: "spec.template.spec.bootstrap.configRef",
},
templateVariables: map[string]apiextensionsv1.JSON{
"builtin": {Raw: []byte(`{"machineDeployment":{"class":"classA"}}`)},
runtimehooksv1.BuiltinsName: {Raw: []byte(`{"machineDeployment":{"class":"classA"}}`)},
},
selector: clusterv1.PatchSelector{
APIVersion: "bootstrap.cluster.x-k8s.io/v1beta1",
Expand Down Expand Up @@ -253,7 +253,7 @@ func TestMatchesSelector(t *testing.T) {
FieldPath: "spec.template.spec.bootstrap.configRef",
},
templateVariables: map[string]apiextensionsv1.JSON{
"builtin": {Raw: []byte(`{"machineDeployment":{"class":"classA"}}`)},
runtimehooksv1.BuiltinsName: {Raw: []byte(`{"machineDeployment":{"class":"classA"}}`)},
},
selector: clusterv1.PatchSelector{
APIVersion: "bootstrap.cluster.x-k8s.io/v1beta1",
Expand Down Expand Up @@ -281,7 +281,7 @@ func TestMatchesSelector(t *testing.T) {
FieldPath: "spec.template.spec.bootstrap.configRef",
},
templateVariables: map[string]apiextensionsv1.JSON{
"builtin": {Raw: []byte(`{"machineDeployment":{"class":"class-A"}}`)},
runtimehooksv1.BuiltinsName: {Raw: []byte(`{"machineDeployment":{"class":"class-A"}}`)},
},
selector: clusterv1.PatchSelector{
APIVersion: "bootstrap.cluster.x-k8s.io/v1beta1",
Expand Down Expand Up @@ -309,7 +309,7 @@ func TestMatchesSelector(t *testing.T) {
FieldPath: "spec.template.spec.bootstrap.configRef",
},
templateVariables: map[string]apiextensionsv1.JSON{
"builtin": {Raw: []byte(`{"machineDeployment":{"class":"class-A"}}`)},
runtimehooksv1.BuiltinsName: {Raw: []byte(`{"machineDeployment":{"class":"class-A"}}`)},
},
selector: clusterv1.PatchSelector{
APIVersion: "bootstrap.cluster.x-k8s.io/v1beta1",
Expand Down Expand Up @@ -337,7 +337,7 @@ func TestMatchesSelector(t *testing.T) {
FieldPath: "spec.template.spec.bootstrap.configRef",
},
templateVariables: map[string]apiextensionsv1.JSON{
"builtin": {Raw: []byte(`{"machineDeployment":{"class":"classA"}}`)},
runtimehooksv1.BuiltinsName: {Raw: []byte(`{"machineDeployment":{"class":"classA"}}`)},
},
selector: clusterv1.PatchSelector{
APIVersion: "bootstrap.cluster.x-k8s.io/v1beta1",
Expand Down Expand Up @@ -365,7 +365,7 @@ func TestMatchesSelector(t *testing.T) {
FieldPath: "spec.template.spec.bootstrap.configRef",
},
templateVariables: map[string]apiextensionsv1.JSON{
"builtin": {Raw: []byte(`{"machineDeployment":{"class":"classA"}}`)},
runtimehooksv1.BuiltinsName: {Raw: []byte(`{"machineDeployment":{"class":"classA"}}`)},
},
selector: clusterv1.PatchSelector{
APIVersion: "bootstrap.cluster.x-k8s.io/v1beta1",
Expand All @@ -391,7 +391,7 @@ func TestMatchesSelector(t *testing.T) {
FieldPath: "spec.template.spec.bootstrap.configRef",
},
templateVariables: map[string]apiextensionsv1.JSON{
"builtin": {Raw: []byte(`{"machineDeployment":{"class":"classA"}}`)},
runtimehooksv1.BuiltinsName: {Raw: []byte(`{"machineDeployment":{"class":"classA"}}`)},
},
selector: clusterv1.PatchSelector{
APIVersion: "bootstrap.cluster.x-k8s.io/v1beta1",
Expand All @@ -415,7 +415,7 @@ func TestMatchesSelector(t *testing.T) {
FieldPath: "spec.template.spec.bootstrap.configRef",
},
templateVariables: map[string]apiextensionsv1.JSON{
"builtin": {Raw: []byte(`{"machineDeployment":{"class":"classA"}}`)},
runtimehooksv1.BuiltinsName: {Raw: []byte(`{"machineDeployment":{"class":"classA"}}`)},
},
selector: clusterv1.PatchSelector{
APIVersion: "bootstrap.cluster.x-k8s.io/v1beta1",
Expand Down Expand Up @@ -443,7 +443,7 @@ func TestMatchesSelector(t *testing.T) {
FieldPath: "spec.template.spec.infrastructureRef",
},
templateVariables: map[string]apiextensionsv1.JSON{
"builtin": {Raw: []byte(`{"machineDeployment":{"class":"classA"}}`)},
runtimehooksv1.BuiltinsName: {Raw: []byte(`{"machineDeployment":{"class":"classA"}}`)},
},
selector: clusterv1.PatchSelector{
APIVersion: "infrastructure.cluster.x-k8s.io/v1beta1",
Expand Down
4 changes: 2 additions & 2 deletions pkg/handlers/aws/mutation/ami/inject_worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var _ = Describe("Generate AMI patches for Worker", func() {
VariableName,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
apiextensionsv1.JSON{
Raw: []byte(`{"machineDeployment": {"class": "a-worker"}}`),
},
Expand Down Expand Up @@ -63,7 +63,7 @@ var _ = Describe("Generate AMI patches for Worker", func() {
VariableName,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
apiextensionsv1.JSON{
Raw: []byte(`{"machineDeployment": {"class": "a-worker"}}`),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var _ = Describe("Generate IAMInstanceProfile patches for Worker", func() {
VariableName,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
apiextensionsv1.JSON{
Raw: []byte(`{"machineDeployment": {"class": "a-worker"}}`),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var _ = Describe("Generate InstanceType patches for Worker", func() {
VariableName,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
apiextensionsv1.JSON{
Raw: []byte(`{"machineDeployment": {"class": "a-worker"}}`),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var _ = Describe("Generate PlacementGroup patches for Worker", func() {
VariableName,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
apiextensionsv1.JSON{
Raw: []byte(`{"machineDeployment": {"class": "a-worker"}}`),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var _ = Describe("Generate AWS SecurityGroups patches for Worker", func() {
VariableName,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
apiextensionsv1.JSON{
Raw: []byte(`{"machineDeployment": {"class": "a-worker"}}`),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (h *customImageControlPlanePatchHandler) Mutate(
),
log,
func(obj *capdv1.DockerMachineTemplate) error {
variablePath := []string{"builtin", "controlPlane", "version"}
variablePath := []string{runtimehooksv1.BuiltinsName, "controlPlane", "version"}

if customImageVar == "" {
kubernetesVersion, err := variables.Get[string](
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var _ = Describe("Docker CustomImage patches for ControlPlane", func() {
Name: "image unset for control plane",
Vars: []runtimehooksv1.Variable{
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
apiextensionsv1.JSON{Raw: []byte(`{"controlPlane": {"version": "v1.2.3"}}`)},
),
},
Expand All @@ -51,7 +51,7 @@ var _ = Describe("Docker CustomImage patches for ControlPlane", func() {
VariableName,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
apiextensionsv1.JSON{
Raw: []byte(`{"machineDeployment": {"class": "a-worker"}}`),
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/handlers/docker/mutation/customimage/inject_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (h *customImageWorkerPatchHandler) Mutate(
),
log,
func(obj *capdv1.DockerMachineTemplate) error {
fieldPath := []string{"builtin", "machineDeployment", "version"}
fieldPath := []string{runtimehooksv1.BuiltinsName, "machineDeployment", "version"}

if customImageVar == "" {
kubernetesVersion, err := variables.Get[string](
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var _ = Describe("Docker CustomImage patches for workers", func() {
Name: "image unset for workers",
Vars: []runtimehooksv1.Variable{
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
apiextensionsv1.JSON{
Raw: []byte(
`{"machineDeployment": {"class": "a-worker", "version": "v1.2.3"}}`,
Expand All @@ -51,7 +51,7 @@ var _ = Describe("Docker CustomImage patches for workers", func() {
VariableName,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
apiextensionsv1.JSON{
Raw: []byte(`{"machineDeployment": {"class": "a-worker"}}`),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ var _ = Describe("Generate Containerd apply patches and restart patches", func()
Name: "restart script and command added to worker node kubeadm config template",
Vars: []runtimehooksv1.Variable{
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
map[string]any{
"machineDeployment": map[string]any{
"class": "*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var _ = Describe("Generate containerd metrics patches", func() {
Name: "containerd metrics config added to worker node kubeadm config template",
Vars: []runtimehooksv1.Variable{
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
map[string]any{
"machineDeployment": map[string]any{
"class": "*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var _ = Describe("Generate containerd unprivileged ports patches", func() {
Name: "containerd unprivileged ports config added to worker node kubeadm config template",
Vars: []runtimehooksv1.Variable{
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
map[string]any{
"machineDeployment": map[string]any{
"class": "*",
Expand Down
2 changes: 1 addition & 1 deletion pkg/handlers/generic/mutation/httpproxy/inject_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var _ = Describe("Generate HTTPProxy Patches", func() {
VariableName,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
map[string]any{
"machineDeployment": map[string]any{
"class": names.SimpleNameGenerator.GenerateName("worker-"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ var _ = Describe("Generate Image registry patches", func() {
v1alpha1.ImageRegistriesVariableName,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
map[string]any{
"machineDeployment": map[string]any{
"class": names.SimpleNameGenerator.GenerateName("worker-"),
Expand Down Expand Up @@ -400,7 +400,7 @@ var _ = Describe("Generate Image registry patches", func() {
v1alpha1.ImageRegistriesVariableName,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
map[string]any{
"machineDeployment": map[string]any{
"class": names.SimpleNameGenerator.GenerateName("worker-"),
Expand Down
10 changes: 5 additions & 5 deletions pkg/handlers/generic/mutation/mirrors/inject_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ var _ = Describe("Generate Global mirror patches", func() {
v1alpha1.GlobalMirrorVariableName,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
map[string]any{
"machineDeployment": map[string]any{
"class": names.SimpleNameGenerator.GenerateName("worker-"),
Expand Down Expand Up @@ -238,7 +238,7 @@ var _ = Describe("Generate Global mirror patches", func() {
v1alpha1.GlobalMirrorVariableName,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
map[string]any{
"machineDeployment": map[string]any{
"class": names.SimpleNameGenerator.GenerateName("worker-"),
Expand Down Expand Up @@ -281,7 +281,7 @@ var _ = Describe("Generate Global mirror patches", func() {
v1alpha1.GlobalMirrorVariableName,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
map[string]any{
"machineDeployment": map[string]any{
"class": names.SimpleNameGenerator.GenerateName("worker-"),
Expand Down Expand Up @@ -321,7 +321,7 @@ var _ = Describe("Generate Global mirror patches", func() {
v1alpha1.ImageRegistriesVariableName,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
map[string]any{
"machineDeployment": map[string]any{
"class": names.SimpleNameGenerator.GenerateName("worker-"),
Expand Down Expand Up @@ -382,7 +382,7 @@ var _ = Describe("Generate Global mirror patches", func() {
[]string{"addons", v1alpha1.RegistryAddonVariableName}...,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
map[string]any{
"machineDeployment": map[string]any{
"class": names.SimpleNameGenerator.GenerateName("worker-"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var _ = Describe("Generate NodeRegistration patches for Worker", func() {
VariableName,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
apiextensionsv1.JSON{
Raw: []byte(`{"machineDeployment": {"class": "a-worker"}}`),
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/handlers/generic/mutation/ntp/inject_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ var _ = Describe("Generate NTP patches", func() {
VariableName,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
map[string]any{
"machineDeployment": map[string]any{
"class": "worker-class",
Expand Down Expand Up @@ -130,7 +130,7 @@ var _ = Describe("Generate NTP patches", func() {
VariableName,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
map[string]any{
"machineDeployment": map[string]any{
"class": "worker-class",
Expand Down
2 changes: 1 addition & 1 deletion pkg/handlers/generic/mutation/taints/inject_worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var _ = Describe("Generate taints patches for Worker", func() {
VariableName,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
apiextensionsv1.JSON{
Raw: []byte(`{"machineDeployment": {"class": "a-worker"}}`),
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/handlers/generic/mutation/users/inject_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ var _ = Describe("Generate Users patches", func() {
VariableName,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
map[string]any{
"machineDeployment": map[string]any{
"class": names.SimpleNameGenerator.GenerateName("worker-"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var _ = Describe("Generate Nutanix Machine Details patches for Worker", func() {
VariableName,
),
capitest.VariableWithValue(
"builtin",
runtimehooksv1.BuiltinsName,
apiextensionsv1.JSON{
Raw: []byte(`{"machineDeployment": {"class": "a-worker"}}`),
},
Expand Down