kubernetes-sigs / cluster-api-provider-openstack

Cluster API implementation for OpenStack
https://cluster-api-openstack.sigs.k8s.io/
Apache License 2.0
298 stars 257 forks source link

Implement a new API for managing Security Groups #1752

Open EmilienM opened 1 year ago

EmilienM commented 1 year ago

/kind feature

How it works today

Currently, if OpenStackCluster.spec.managedSecurityGroups is True, security groups will be created and added to the Bastion (if it exists), the control plane and the worker nodes respectively.

By default, these groups have rules that allow the following traffic:

Additionally:

Proposed solution

2 options:

Or:

And then:

API Change

// OpenStackClusterSpec defines the desired state of OpenStackCluster.
type OpenStackClusterSpec struct {

[...]

    // LegacyManagedSecurityGroups determines whether OpenStack security groups for the cluster
    // will be managed by the OpenStack provider or whether pre-existing security groups will
    // be specified as part of the configuration.
    // By default, the managed security groups have rules that allow the Kubelet, etcd, the
    // Kubernetes API server and the Calico CNI plugin to function correctly.
        // This is deprecated, `ControlPlaneSecurityGroup` and `WorkerSecurityGroup` should be used instead.
    // +optional
    LegacyManagedSecurityGroups bool `json:"legacyLanagedSecurityGroups"`

    // ControlPlaneSecurityGroup contains all the information about the OpenStack Security
    // Group that needs to be applied to control plane nodes.
    // By default, we will create a security group with rules that allow the Kubelet, etcd and
    // the Kubernetes API server to function correctly.
    // +optional
    ControlPlaneSecurityGroup *SecurityGroup `json:"controlPlaneSecurityGroup,omitempty"`

    // WorkerSecurityGroup contains all the information about the OpenStack Security
    // Group that needs to be applied to worker nodes.
    // By default, we will create a security group with rules that allow the Kubelet to
    // function correctly.
    // +optional
    WorkerSecurityGroup *SecurityGroup `json:"workerSecurityGroup,omitempty"`
}

or a new CRD.

EmilienM commented 1 year ago

/assign EmilienM

jichenjc commented 1 year ago

Keep the option of providing pre-existing security groups in OpenStackMachineTemplate, via its OpenStackMachineSpec and for the Bastion in OpenStackCluster. They'll not be exclusive to the provided rules in the new API, they'll be able to live together and both sets of rules will be applied to the machines.

I think the original idea is to create a json file and describe the security group including its rules ? and by default we will load them into CAPO something like a CR

will the above proposal be same or customer need create a CR by themselves?

Keep the option of providing pre-existing security groups in OpenStackMachineTemplate, via its OpenStackMachineSpec and for the Bastion in OpenStackCluster. They'll not be exclusive to the provided rules in the new API, they'll be able to live together and both sets of rules will be applied to the machines.

to confirm ,we still support pre-created sec group in openstack API layer then use in our template, correct?

wwentland commented 1 year ago

There have been discussions about this in various places, for example:

I really like the way this is addressed in CAPA, which defines a CNIIngressRule resource, which could serve as an inspiration here as well. It might make sense to mirror their API/naming scheme where possible, to make it easier for users who are working with both providers.

EmilienM commented 1 year ago

I really like the way this is addressed in CAPA, which defines a CNIIngressRule resource, which could serve as an inspiration here as well. It might make sense to mirror their API/naming scheme where possible, to make it easier for users who are working with both providers.

Me too, I very often take inspiration from CAPZ or CAPA when I think of new APIs in CAPO. However I also like to look at existing namings in CAPO and I think keeping it consistent with other fields is sometimes more helpful than trying to copy from other providers.

EmilienM commented 1 year ago

I think the original idea is to create a json file and describe the security group including its rules ? and by default we will load them into CAPO something like a CR

Yes exactly.

will the above proposal be same or customer need create a CR by themselves?

I don't understand that question, but the customer provides the rules via the new API and CAPO manages the Security Group rules.

to confirm ,we still support pre-created sec group in openstack API layer then use in our template, correct?

Yes, we should not touch that part and that's what I mean when I say "keep the option of (...)".

EmilienM commented 1 year ago

let's use this KEP to discuss design: https://github.com/kubernetes-sigs/cluster-api-provider-openstack/pull/1756

k8s-triage-robot commented 9 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

EmilienM commented 9 months ago

/remove-lifecycle stale

k8s-triage-robot commented 6 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

EmilienM commented 6 months ago

/remove-lifecycle stale

k8s-triage-robot commented 3 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

EmilienM commented 3 months ago

/remove-lifecycle stale

k8s-triage-robot commented 1 week ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

EmilienM commented 1 week ago

/remove-lifecycle stale