Skip to content
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

Support toggling provisioning checks #290

Merged
merged 4 commits into from
Oct 13, 2024

Conversation

ekarlso
Copy link
Contributor

@ekarlso ekarlso commented Sep 22, 2024

cf #183

Testing performed:
Added / adapted tests

api/v1alpha1/proxmoxmachine_types.go Outdated Show resolved Hide resolved
internal/service/vmservice/vm.go Outdated Show resolved Hide resolved
@wikkyk
Copy link
Collaborator

wikkyk commented Sep 24, 2024

@ekarlso I edited your comment to remove the word 'fixes' as otherwise merging this PR would close the issue prematurely.

Signed-off-by: ekarlso <endre.karlson@gmail.com>
pkg/proxmox/goproxmox/api_client.go Show resolved Hide resolved
internal/service/vmservice/vm.go Outdated Show resolved Hide resolved
internal/service/vmservice/vm.go Outdated Show resolved Hide resolved
internal/service/vmservice/vm.go Show resolved Hide resolved
Signed-off-by: ekarlso <endre.karlson@gmail.com>
Signed-off-by: ekarlso <endre.karlson@gmail.com>
@mcbenjemaa
Copy link
Member

There is still failing tests

Signed-off-by: ekarlso <endre.karlson@gmail.com>
Copy link

@mcbenjemaa mcbenjemaa merged commit 0d011ce into ionos-cloud:main Oct 13, 2024
8 checks passed
@ricottatosta
Copy link

ricottatosta commented Nov 25, 2024

Dear IONOS Team,
I believe this is not the right way to address all the issues around cloud-init and Talos. And the way it will be addressed also involves flatcar support in some way.
Talos image can get qemu-agent via custom image, so it needn't to check it. But if there is any other issue regarding the agent, it can be addressed.
The problem involving cloud-init and Talos is related to cloud-init datasource. Up to date, any os running in a vm must expect network-config to be in cloud-init netplan format and must install cloud-init binary.
On the other hand, Talos expects network-config to be in cloud-init nocloud format and has no cloud-init binary installed.
Flatcar has another config file format, in json if I'm not wrong.
For all this reasons, I think all these issues should be addressed more schematically, maybe using a schema like this in proxmox_machine_type.go:

spec:
  config:
    engine: cloud-init|flatcar
    flatcar: {}
    cloudInit:
      dataSource: netplan|nocloud
  qemuAgent: true|false

With this new arrangement in place, it should be possible to address all the issues around that involve both reconciliation activities and engine config format in general.
I have started forking your project in order to be able to create a Pull Request. If you are interested in my idea, I will try to arrange the code. But be aware, I'm less than a newbie at GoLang. It will need a review.
I hope you will change your mind.

@mcbenjemaa
Copy link
Member

mcbenjemaa commented Nov 25, 2024

Hey,
your Proposal is nice
but we need to keep things in mind,
in debian-based os, we check cloud-init status via the qemuAgent.
so we need a way of skipping such a check.
in flatcar we can run qemuAgent but not cloud-init.

spec:
  config:
    engine: cloud-init|flatcar
    flatcar: {}
    cloudInit:
      dataSource: netplan|nocloud
  qemuAgent: true|false

here is some of my notes:

  • Having qemuAgent field is great
  • config.engine is also nice. however we can also check that based on generated bootstrap data.
  • config.cloudInit.dataSource I don't know why you need such a field, please explain.

However, can you also explain how we can actually implement the cloud-init checks and Qemu and under which conditions?

Finally, a word of advice, please create a new issue and start a discussion around the API additions or changes in the issue, before starting the PR,
you need the API approved, so you don't change it when you start the PR.
we would appreciate your contributions.

@ricottatosta
Copy link

ricottatosta commented Nov 25, 2024

If you want to leave the world as is, the only issue to solve to let Talos do its work with capmox is the value of networkConfigTPl constant in pkg/cloudinit/network.go file.
Netplan expects it to start as follows:

const (
	/* network-config template. */
	networkConfigTPl = `network:
  version: 2
  renderer: networkd

Nocloud expects it to start as follows:

const (
	/* network-config template. */
	networkConfigTPl = `version: 2
renderer: networkd

Routes section should be written as follows:

{{- define "routes" }}
  {{- if or .Gateway .Gateway6 }}
    {{- if .Gateway }}
    gateway4: {{ .Gateway }}
    {{- end }}
    {{- if .Gateway6 }}
    gateway6: {{  .Gateway6  }}
    {{- end }}
  {{- end }}
  {{- if .Routes }}
    routes:
  {{- range $index, $route := .Routes }}
      - {
      {{- if $route.To }} "to": "{{$route.To}}", {{ end -}}
      {{- if $route.Via }} "via": "{{$route.Via}}", {{ end -}}
      {{- if $route.Metric }} "metric": {{$route.Metric}}, {{ end -}}
      {{- if $route.Table }} "table": {{$route.Table}}, {{ end -}} }
  {{- end -}}
{{- end -}}

and the rest of the string should be rearranged accordingly in terms of indentation.
With this in mind, you could rearrange proxmoxmachine spec as follows:

spec:
  checks: {}
  cloudInitFormat: netplan|nocloud

and check for the format before creating NetworkConfigData.

@mcbenjemaa
Copy link
Member

@ekarlso
Is that the case?
I thought the network-config v2 works well in your setup.

@ricottatosta Open new issue, and let's discuss there.

@ricottatosta
Copy link

#51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants