diff --git a/charts/cinder-csi-plugin/Chart.yaml b/charts/cinder-csi-plugin/Chart.yaml index 8ec0b5a46a..2de431634b 100644 --- a/charts/cinder-csi-plugin/Chart.yaml +++ b/charts/cinder-csi-plugin/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 appVersion: v1.27.1 description: Cinder CSI Chart for OpenStack name: openstack-cinder-csi -version: 2.28.0-alpha.3 +version: 2.28.0-alpha.4 home: https://github.com/kubernetes/cloud-provider-openstack icon: https://github.com/kubernetes/kubernetes/blob/master/logo/logo.png maintainers: diff --git a/charts/cinder-csi-plugin/templates/controllerplugin-deployment.yaml b/charts/cinder-csi-plugin/templates/controllerplugin-deployment.yaml index 4934320d0c..5da321bde8 100644 --- a/charts/cinder-csi-plugin/templates/controllerplugin-deployment.yaml +++ b/charts/cinder-csi-plugin/templates/controllerplugin-deployment.yaml @@ -5,6 +5,10 @@ metadata: namespace: {{ .Release.Namespace }} labels: {{- include "cinder-csi.controllerplugin.labels" . | nindent 4 }} + annotations: + {{- with .Values.commonAnnotations }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: replicas: {{ .Values.csi.plugin.controllerPlugin.replicas }} strategy: @@ -21,6 +25,10 @@ spec: metadata: labels: {{- include "cinder-csi.controllerplugin.labels" . | nindent 8 }} + annotations: + {{- with .Values.commonAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} spec: serviceAccount: csi-cinder-controller-sa containers: @@ -169,11 +177,13 @@ spec: volumes: - name: socket-dir emptyDir: - - name: cloud-config {{- if .Values.secret.enabled }} + - name: cloud-config secret: secretName: {{ .Values.secret.name }} - {{- else }} + {{- end }} + {{- if .Values.secret.hostMount }} + - name: cloud-config hostPath: path: /etc/kubernetes {{- end }} diff --git a/charts/cinder-csi-plugin/templates/nodeplugin-daemonset.yaml b/charts/cinder-csi-plugin/templates/nodeplugin-daemonset.yaml index f2f42a79d9..b9b7091747 100644 --- a/charts/cinder-csi-plugin/templates/nodeplugin-daemonset.yaml +++ b/charts/cinder-csi-plugin/templates/nodeplugin-daemonset.yaml @@ -5,6 +5,10 @@ metadata: namespace: {{ .Release.Namespace }} labels: {{- include "cinder-csi.nodeplugin.labels" . | nindent 4 }} + annotations: + {{- with .Values.commonAnnotations }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: selector: matchLabels: @@ -13,6 +17,10 @@ spec: metadata: labels: {{- include "cinder-csi.nodeplugin.labels" . | nindent 8 }} + annotations: + {{- with .Values.commonAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} spec: serviceAccount: csi-cinder-node-sa hostNetwork: true @@ -127,11 +135,13 @@ spec: hostPath: path: /dev type: Directory - - name: cloud-config {{- if .Values.secret.enabled }} + - name: cloud-config secret: secretName: {{ .Values.secret.name }} - {{- else }} + {{- end }} + {{- if .Values.secret.hostMount }} + - name: cloud-config hostPath: path: /etc/kubernetes {{- end }} diff --git a/charts/cinder-csi-plugin/templates/secret.yaml b/charts/cinder-csi-plugin/templates/secret.yaml index b11ef8567c..597880c0d5 100644 --- a/charts/cinder-csi-plugin/templates/secret.yaml +++ b/charts/cinder-csi-plugin/templates/secret.yaml @@ -1,4 +1,4 @@ -{{- if .Values.secret.create }} +{{- if and (.Values.secret.create) (.Values.secret.enabled) }} apiVersion: v1 kind: Secret metadata: diff --git a/charts/cinder-csi-plugin/values.yaml b/charts/cinder-csi-plugin/values.yaml index 5155e1fa5f..637577f8a7 100644 --- a/charts/cinder-csi-plugin/values.yaml +++ b/charts/cinder-csi-plugin/values.yaml @@ -98,8 +98,15 @@ csi: # for description of individual verbosity levels. logVerbosityLevel: 2 +# the secret should contain the openstack credentials +# there are several options to inject the credentials: +# 1) from kubernetes secret that doesn't exist: set "enabled" and "create" to true, this will create a secret from the values written to "data" down below +# 2) from kubernetes secret that already exists: set "enabled" to true and "create" to false +# 3) from host system path /etc/cloud/cloud.conf: set "enabled" to false and "hostMount" to true +# 4) via agent-injector (e.g. hashicorp vault): set "enabled" and "hostMount" to false, you have to provide credentials on your own by injecting credentials into the pod secret: enabled: false + hostMount: true create: false filename: cloud.conf # name: cinder-csi-cloud-config @@ -149,3 +156,6 @@ priorityClassName: "" imagePullSecrets: [] # - name: my-imagepull-secret + +# add annotations to all pods +commonAnnotations: {} diff --git a/charts/openstack-cloud-controller-manager/Chart.yaml b/charts/openstack-cloud-controller-manager/Chart.yaml index 922d3b24db..d8a7a97973 100644 --- a/charts/openstack-cloud-controller-manager/Chart.yaml +++ b/charts/openstack-cloud-controller-manager/Chart.yaml @@ -4,7 +4,7 @@ description: Openstack Cloud Controller Manager Helm Chart icon: https://object-storage-ca-ymq-1.vexxhost.net/swift/v1/6e4619c416ff4bd19e1c087f27a43eea/www-images-prod/openstack-logo/OpenStack-Logo-Vertical.png home: https://github.com/kubernetes/cloud-provider-openstack name: openstack-cloud-controller-manager -version: 2.28.0-alpha.4 +version: 2.28.0-alpha.6 maintainers: - name: eumel8 email: f.kloeker@telekom.de diff --git a/charts/openstack-cloud-controller-manager/README.md b/charts/openstack-cloud-controller-manager/README.md index 25fb4a91f3..af837af82b 100644 --- a/charts/openstack-cloud-controller-manager/README.md +++ b/charts/openstack-cloud-controller-manager/README.md @@ -13,11 +13,11 @@ You need to configure an `openstack-ccm.yaml` values file with at least: - with password: `cloudConfig.global.username` and `cloudconfig.global.password` - with application credentials: (`cloudConfig.global.application-credential-id` or `cloudConfig.global.application-credential-name`) and `cloudConfig.global.application-credential-secret` - Load balancing - - `cloudConfig.loadbalancer.floating-network-id` **or** - - `cloudConfig.loadbalancer.floating-subnet-id` **or** - - `cloudConfig.loadbalancer.floating-subnet` + - `cloudConfig.loadBalancer.floating-network-id` **or** + - `cloudConfig.loadBalancer.floating-subnet-id` **or** + - `cloudConfig.loadBalancer.floating-subnet` -If you want to enable health checks for your Load Balancers (optional), set `cloudConfig.loadbalancer.create-monitor: true`. +If you want to enable health checks for your Load Balancers (optional), set `cloudConfig.loadBalancer.create-monitor: true`. Then run: diff --git a/charts/openstack-cloud-controller-manager/templates/daemonset.yaml b/charts/openstack-cloud-controller-manager/templates/daemonset.yaml index 702842a488..aad6808177 100644 --- a/charts/openstack-cloud-controller-manager/templates/daemonset.yaml +++ b/charts/openstack-cloud-controller-manager/templates/daemonset.yaml @@ -66,10 +66,14 @@ spec: name: http protocol: TCP {{- end }} + {{- if or (.Values.extraVolumeMounts) (.Values.secret.enabled) }} volumeMounts: + {{- end }} + {{- if .Values.secret.enabled }} - mountPath: /etc/config name: cloud-config-volume readOnly: true + {{- end }} {{- if .Values.extraVolumeMounts }} {{- toYaml .Values.extraVolumeMounts | nindent 12 }} {{- end }} @@ -97,10 +101,15 @@ spec: {{- if .Values.priorityClassName }} priorityClassName: {{ .Values.priorityClassName }} {{- end }} + + {{- if or (.Values.extraVolumes) (.Values.secret.enabled) }} volumes: + {{- end }} + {{- if .Values.secret.enabled }} - name: cloud-config-volume secret: secretName: {{ .Values.secret.name }} + {{- end }} {{- if .Values.extraVolumes }} {{ toYaml .Values.extraVolumes | nindent 6 }} {{- end }} diff --git a/charts/openstack-cloud-controller-manager/templates/secret.yaml b/charts/openstack-cloud-controller-manager/templates/secret.yaml index ea35e01e6f..66c6352ea3 100644 --- a/charts/openstack-cloud-controller-manager/templates/secret.yaml +++ b/charts/openstack-cloud-controller-manager/templates/secret.yaml @@ -1,4 +1,4 @@ -{{- if .Values.secret.create }} +{{- if and (.Values.secret.create) (.Values.secret.enabled) }} apiVersion: v1 kind: Secret metadata: diff --git a/charts/openstack-cloud-controller-manager/values.yaml b/charts/openstack-cloud-controller-manager/values.yaml index 4f628a9f6c..9dfa2b1504 100644 --- a/charts/openstack-cloud-controller-manager/values.yaml +++ b/charts/openstack-cloud-controller-manager/values.yaml @@ -81,7 +81,11 @@ serviceMonitor: {} # Create a secret resource cloud-config (or other name) to store credentials and settings from cloudConfig # You can also provide your own secret (not created by the Helm chart), in this case set create to false # and adjust the name of the secret as necessary +# If you dont want to use a secret (because you are using something like an agent injector to inject the cloud config file) +# you can disable the secret usage by setting enabled to false. +# If you disable the secret, you have to insert the cloud config file into the path /etc/cloud/config. secret: + enabled: true create: true name: cloud-config diff --git a/cmd/barbican-kms-plugin/main.go b/cmd/barbican-kms-plugin/main.go index 52a74a72bf..b3246d08f7 100644 --- a/cmd/barbican-kms-plugin/main.go +++ b/cmd/barbican-kms-plugin/main.go @@ -29,49 +29,36 @@ import ( ) var ( - socketpath string - cloudconfig string + socketPath string + cloudConfig string ) func main() { - // Glog requires this otherwise it complains. - if err := flag.CommandLine.Parse(nil); err != nil { - klog.Fatalf("Unable to parse flags: %v", err) - } + flag.Parse() + // This is a temporary hack to enable proper logging until upstream dependencies // are migrated to fully utilize klog instead of glog. - klogFlags := flag.NewFlagSet("klog", flag.ExitOnError) - klog.InitFlags(klogFlags) - // Sync the glog and klog flags. - flag.CommandLine.VisitAll(func(f1 *flag.Flag) { - f2 := klogFlags.Lookup(f1.Name) - if f2 != nil { - value := f1.Value.String() - _ = f2.Value.Set(value) - } - }) + klog.InitFlags(nil) cmd := &cobra.Command{ Use: "barbican-kms-plugin", - Short: "Barbican KMS plugin for kubernetes", + Short: "Barbican KMS plugin for Kubernetes", RunE: func(cmd *cobra.Command, args []string) error { - sigchan := make(chan os.Signal, 1) - signal.Notify(sigchan, unix.SIGTERM, unix.SIGINT) - err := server.Run(cloudconfig, socketpath, sigchan) + sigChan := make(chan os.Signal, 1) + signal.Notify(sigChan, unix.SIGTERM, unix.SIGINT) + err := server.Run(cloudConfig, socketPath, sigChan) return err }, } - cmd.Flags().AddGoFlagSet(flag.CommandLine) - - cmd.PersistentFlags().StringVar(&socketpath, "socketpath", "", "Barbican KMS Plugin unix socket endpoint") + cmd.PersistentFlags().StringVar(&socketPath, "socketpath", "", "Barbican KMS Plugin unix socket endpoint") if err := cmd.MarkPersistentFlagRequired("socketpath"); err != nil { - klog.Fatalf("Unable to mark flag socketpath to be required: %v", err) + klog.Fatalf("Unable to mark flag socketpath as required: %v", err) } - cmd.PersistentFlags().StringVar(&cloudconfig, "cloud-config", "", "Barbican KMS Plugin cloud config") + cmd.PersistentFlags().StringVar(&cloudConfig, "cloud-config", "", "Barbican KMS Plugin cloud config") if err := cmd.MarkPersistentFlagRequired("cloud-config"); err != nil { - klog.Fatalf("Unable to mark flag cloud-config to be required: %v", err) + klog.Fatalf("Unable to mark flag cloud-config as required: %v", err) } code := cli.Run(cmd) diff --git a/go.mod b/go.mod index 3a47670505..9dcabf6b23 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/container-storage-interface/spec v1.8.0 github.com/go-chi/chi/v5 v5.0.8 - github.com/gophercloud/gophercloud v1.3.0 + github.com/gophercloud/gophercloud v1.4.0 github.com/gophercloud/utils v0.0.0-20230330070308-5bd5e1d608f8 github.com/hashicorp/go-version v1.6.0 github.com/kubernetes-csi/csi-lib-utils v0.13.0 diff --git a/go.sum b/go.sum index aee340951d..6fa610bd52 100644 --- a/go.sum +++ b/go.sum @@ -225,8 +225,9 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/gophercloud/gophercloud v1.3.0 h1:RUKyCMiZoQR3VlVR5E3K7PK1AC3/qppsWYo6dtBiqs8= github.com/gophercloud/gophercloud v1.3.0/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM= +github.com/gophercloud/gophercloud v1.4.0 h1:RqEu43vaX0lb0LanZr5BylK5ICVxjpFFoc0sxivyuHU= +github.com/gophercloud/gophercloud v1.4.0/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM= github.com/gophercloud/utils v0.0.0-20230330070308-5bd5e1d608f8 h1:K9r5WEeAiaEgFZsuOP0OYjE4TtyFcCLG1nI08t9AP6A= github.com/gophercloud/utils v0.0.0-20230330070308-5bd5e1d608f8/go.mod h1:VSalo4adEk+3sNkmVJLnhHoOyOYYS8sTWLG4mv5BKto= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= diff --git a/pkg/openstack/instances.go b/pkg/openstack/instances.go index fbc1c7002b..73995113c5 100644 --- a/pkg/openstack/instances.go +++ b/pkg/openstack/instances.go @@ -27,9 +27,9 @@ import ( "strings" "github.com/gophercloud/gophercloud" - "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/attachinterfaces" "github.com/gophercloud/gophercloud/openstack/compute/v2/flavors" "github.com/gophercloud/gophercloud/openstack/compute/v2/servers" + "github.com/gophercloud/gophercloud/openstack/networking/v2/ports" "github.com/gophercloud/gophercloud/pagination" "github.com/mitchellh/mapstructure" v1 "k8s.io/api/core/v1" @@ -43,11 +43,13 @@ import ( "k8s.io/cloud-provider-openstack/pkg/util" "k8s.io/cloud-provider-openstack/pkg/util/errors" "k8s.io/cloud-provider-openstack/pkg/util/metadata" + "k8s.io/cloud-provider-openstack/pkg/util/openstack" ) // Instances encapsulates an implementation of Instances for OpenStack. type Instances struct { compute *gophercloud.ServiceClient + network *gophercloud.ServiceClient region string regionProviderID bool opts metadata.Opts @@ -148,6 +150,12 @@ func (os *OpenStack) instances() (*Instances, bool) { return nil, false } + network, err := client.NewNetworkV2(os.provider, os.epOpts) + if err != nil { + klog.Errorf("unable to access network v2 API : %v", err) + return nil, false + } + regionalProviderID := false if isRegionalProviderID := sysos.Getenv(RegionalProviderIDEnv); isRegionalProviderID == "true" { regionalProviderID = true @@ -155,6 +163,7 @@ func (os *OpenStack) instances() (*Instances, bool) { return &Instances{ compute: compute, + network: network, region: os.epOpts.Region, regionProviderID: regionalProviderID, opts: os.metadataOpts, @@ -226,12 +235,12 @@ func (i *Instances) NodeAddressesByProviderID(ctx context.Context, providerID st return []v1.NodeAddress{}, err } - interfaces, err := getAttachedInterfacesByID(i.compute, server.ID) + ports, err := getAttachedPorts(i.network, server.ID) if err != nil { return []v1.NodeAddress{}, err } - addresses, err := nodeAddresses(server, interfaces, i.networkingOpts) + addresses, err := nodeAddresses(server, ports, i.networkingOpts) if err != nil { return []v1.NodeAddress{}, err } @@ -332,11 +341,11 @@ func (i *Instances) InstanceMetadata(ctx context.Context, node *v1.Node) (*cloud return nil, err } - interfaces, err := getAttachedInterfacesByID(i.compute, srv.ID) + ports, err := getAttachedPorts(i.network, srv.ID) if err != nil { return nil, err } - addresses, err := nodeAddresses(srv, interfaces, i.networkingOpts) + addresses, err := nodeAddresses(srv, ports, i.networkingOpts) if err != nil { return nil, err } @@ -564,13 +573,13 @@ func getServerByName(client *gophercloud.ServiceClient, name types.NodeName) (*S // * access IPs // * metadata hostname // * server object Addresses (floating type) -func nodeAddresses(srv *servers.Server, interfaces []attachinterfaces.Interface, networkingOpts NetworkingOpts) ([]v1.NodeAddress, error) { +func nodeAddresses(srv *servers.Server, ports []ports.Port, networkingOpts NetworkingOpts) ([]v1.NodeAddress, error) { addrs := []v1.NodeAddress{} // parse private IP addresses first in an ordered manner - for _, iface := range interfaces { - for _, fixedIP := range iface.FixedIPs { - if iface.PortState == "ACTIVE" { + for _, port := range ports { + for _, fixedIP := range port.FixedIPs { + if port.Status == "ACTIVE" { isIPv6 := net.ParseIP(fixedIP.IPAddress).To4() == nil if !(isIPv6 && networkingOpts.IPv6SupportDisabled) { AddToNodeAddresses(&addrs, @@ -683,31 +692,20 @@ func getAddressesByName(client *gophercloud.ServiceClient, name types.NodeName, return nil, err } - interfaces, err := getAttachedInterfacesByID(client, srv.ID) + ports, err := getAttachedPorts(client, srv.ID) if err != nil { return nil, err } - return nodeAddresses(&srv.Server, interfaces, networkingOpts) + return nodeAddresses(&srv.Server, ports, networkingOpts) } -// getAttachedInterfacesByID returns the node interfaces of the specified instance. -func getAttachedInterfacesByID(client *gophercloud.ServiceClient, serviceID string) ([]attachinterfaces.Interface, error) { - var interfaces []attachinterfaces.Interface - - mc := metrics.NewMetricContext("server_os_interface", "list") - pager := attachinterfaces.List(client, serviceID) - err := pager.EachPage(func(page pagination.Page) (bool, error) { - s, err := attachinterfaces.ExtractInterfaces(page) - if err != nil { - return false, err - } - interfaces = append(interfaces, s...) - return true, nil - }) - if mc.ObserveRequest(err) != nil { - return interfaces, err +// getAttachedPorts returns a list of ports attached to a server. +func getAttachedPorts(client *gophercloud.ServiceClient, serverID string) ([]ports.Port, error) { + listOpts := ports.ListOpts{ + DeviceID: serverID, + DeviceOwner: "compute:nova", } - return interfaces, nil + return openstack.GetPorts(client, listOpts) } diff --git a/pkg/openstack/instancesv2.go b/pkg/openstack/instancesv2.go index e1f2c279cf..eea86dcc2b 100644 --- a/pkg/openstack/instancesv2.go +++ b/pkg/openstack/instancesv2.go @@ -34,6 +34,7 @@ import ( // InstancesV2 encapsulates an implementation of InstancesV2 for OpenStack. type InstancesV2 struct { compute *gophercloud.ServiceClient + network *gophercloud.ServiceClient region string regionProviderID bool networkingOpts NetworkingOpts @@ -56,6 +57,12 @@ func (os *OpenStack) instancesv2() (*InstancesV2, bool) { return nil, false } + network, err := client.NewNetworkV2(os.provider, os.epOpts) + if err != nil { + klog.Errorf("unable to access network v2 API : %v", err) + return nil, false + } + regionalProviderID := false if isRegionalProviderID := sysos.Getenv(RegionalProviderIDEnv); isRegionalProviderID == "true" { regionalProviderID = true @@ -63,6 +70,7 @@ func (os *OpenStack) instancesv2() (*InstancesV2, bool) { return &InstancesV2{ compute: compute, + network: network, region: os.epOpts.Region, regionProviderID: regionalProviderID, networkingOpts: os.networkingOpts, @@ -115,12 +123,12 @@ func (i *InstancesV2) InstanceMetadata(ctx context.Context, node *v1.Node) (*clo return nil, err } - interfaces, err := getAttachedInterfacesByID(i.compute, server.ID) + ports, err := getAttachedPorts(i.network, server.ID) if err != nil { return nil, err } - addresses, err := nodeAddresses(&server.Server, interfaces, i.networkingOpts) + addresses, err := nodeAddresses(&server.Server, ports, i.networkingOpts) if err != nil { return nil, err } diff --git a/pkg/openstack/loadbalancer.go b/pkg/openstack/loadbalancer.go index fa44f41a7b..aeb3700666 100644 --- a/pkg/openstack/loadbalancer.go +++ b/pkg/openstack/loadbalancer.go @@ -684,7 +684,7 @@ func getBoolFromServiceAnnotation(service *corev1.Service, annotationKey string, } // getSubnetIDForLB returns subnet-id for a specific node -func getSubnetIDForLB(compute *gophercloud.ServiceClient, node corev1.Node, preferredIPFamily corev1.IPFamily) (string, error) { +func getSubnetIDForLB(network *gophercloud.ServiceClient, node corev1.Node, preferredIPFamily corev1.IPFamily) (string, error) { ipAddress, err := nodeAddressForLB(&node, preferredIPFamily) if err != nil { return "", err @@ -695,13 +695,13 @@ func getSubnetIDForLB(compute *gophercloud.ServiceClient, node corev1.Node, pref instanceID = instanceID[(ind + 1):] } - interfaces, err := getAttachedInterfacesByID(compute, instanceID) + ports, err := getAttachedPorts(network, instanceID) if err != nil { return "", err } - for _, intf := range interfaces { - for _, fixedIP := range intf.FixedIPs { + for _, port := range ports { + for _, fixedIP := range port.FixedIPs { if fixedIP.IPAddress == ipAddress { return fixedIP.SubnetID, nil } @@ -1531,7 +1531,7 @@ func (lbaas *LbaasV2) checkServiceUpdate(service *corev1.Service, nodes []*corev } else { svcConf.lbMemberSubnetID = getStringFromServiceAnnotation(service, ServiceAnnotationLoadBalancerSubnetID, lbaas.opts.SubnetID) if len(svcConf.lbMemberSubnetID) == 0 && len(nodes) > 0 { - subnetID, err := getSubnetIDForLB(lbaas.compute, *nodes[0], svcConf.preferredIPFamily) + subnetID, err := getSubnetIDForLB(lbaas.network, *nodes[0], svcConf.preferredIPFamily) if err != nil { return fmt.Errorf("no subnet-id found for service %s: %v", serviceName, err) } @@ -1645,7 +1645,7 @@ func (lbaas *LbaasV2) checkService(service *corev1.Service, nodes []*corev1.Node svcConf.lbMemberSubnetID = svcConf.lbSubnetID } if len(svcConf.lbNetworkID) == 0 && len(svcConf.lbSubnetID) == 0 { - subnetID, err := getSubnetIDForLB(lbaas.compute, *nodes[0], svcConf.preferredIPFamily) + subnetID, err := getSubnetIDForLB(lbaas.network, *nodes[0], svcConf.preferredIPFamily) if err != nil { return fmt.Errorf("failed to get subnet to create load balancer for service %s: %v", serviceName, err) } diff --git a/pkg/openstack/openstack_test.go b/pkg/openstack/openstack_test.go index f7d98438ee..cd31f80c14 100644 --- a/pkg/openstack/openstack_test.go +++ b/pkg/openstack/openstack_test.go @@ -27,8 +27,8 @@ import ( "time" "github.com/gophercloud/gophercloud" - "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/attachinterfaces" "github.com/gophercloud/gophercloud/openstack/compute/v2/servers" + "github.com/gophercloud/gophercloud/openstack/networking/v2/ports" "github.com/spf13/pflag" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -360,10 +360,10 @@ func TestNodeAddresses(t *testing.T) { PublicNetworkName: []string{"public"}, } - interfaces := []attachinterfaces.Interface{ + ports := []ports.Port{ { - PortState: "ACTIVE", - FixedIPs: []attachinterfaces.FixedIP{ + Status: "ACTIVE", + FixedIPs: []ports.IP{ { IPAddress: "10.0.0.32", }, @@ -374,7 +374,7 @@ func TestNodeAddresses(t *testing.T) { }, } - addrs, err := nodeAddresses(&srv, interfaces, networkingOpts) + addrs, err := nodeAddresses(&srv, ports, networkingOpts) if err != nil { t.Fatalf("nodeAddresses returned error: %v", err) } @@ -439,10 +439,10 @@ func TestNodeAddressesCustomPublicNetwork(t *testing.T) { PublicNetworkName: []string{"pub-net"}, } - interfaces := []attachinterfaces.Interface{ + ports := []ports.Port{ { - PortState: "ACTIVE", - FixedIPs: []attachinterfaces.FixedIP{ + Status: "ACTIVE", + FixedIPs: []ports.IP{ { IPAddress: "10.0.0.32", }, @@ -453,7 +453,7 @@ func TestNodeAddressesCustomPublicNetwork(t *testing.T) { }, } - addrs, err := nodeAddresses(&srv, interfaces, networkingOpts) + addrs, err := nodeAddresses(&srv, ports, networkingOpts) if err != nil { t.Fatalf("nodeAddresses returned error: %v", err) } @@ -512,10 +512,10 @@ func TestNodeAddressesCustomPublicNetworkWithIntersectingFixedIP(t *testing.T) { PublicNetworkName: []string{"pub-net"}, } - interfaces := []attachinterfaces.Interface{ + ports := []ports.Port{ { - PortState: "ACTIVE", - FixedIPs: []attachinterfaces.FixedIP{ + Status: "ACTIVE", + FixedIPs: []ports.IP{ { IPAddress: "10.0.0.32", }, @@ -530,7 +530,7 @@ func TestNodeAddressesCustomPublicNetworkWithIntersectingFixedIP(t *testing.T) { }, } - addrs, err := nodeAddresses(&srv, interfaces, networkingOpts) + addrs, err := nodeAddresses(&srv, ports, networkingOpts) if err != nil { t.Fatalf("nodeAddresses returned error: %v", err) } @@ -600,10 +600,10 @@ func TestNodeAddressesMultipleCustomInternalNetworks(t *testing.T) { InternalNetworkName: []string{"private", "also-private"}, } - interfaces := []attachinterfaces.Interface{ + ports := []ports.Port{ { - PortState: "ACTIVE", - FixedIPs: []attachinterfaces.FixedIP{ + Status: "ACTIVE", + FixedIPs: []ports.IP{ { IPAddress: "10.0.0.32", }, @@ -614,7 +614,7 @@ func TestNodeAddressesMultipleCustomInternalNetworks(t *testing.T) { }, } - addrs, err := nodeAddresses(&srv, interfaces, networkingOpts) + addrs, err := nodeAddresses(&srv, ports, networkingOpts) if err != nil { t.Fatalf("nodeAddresses returned error: %v", err) } @@ -684,10 +684,10 @@ func TestNodeAddressesOneInternalNetwork(t *testing.T) { InternalNetworkName: []string{"also-private"}, } - interfaces := []attachinterfaces.Interface{ + ports := []ports.Port{ { - PortState: "ACTIVE", - FixedIPs: []attachinterfaces.FixedIP{ + Status: "ACTIVE", + FixedIPs: []ports.IP{ { IPAddress: "10.0.0.32", }, @@ -698,7 +698,7 @@ func TestNodeAddressesOneInternalNetwork(t *testing.T) { }, } - addrs, err := nodeAddresses(&srv, interfaces, networkingOpts) + addrs, err := nodeAddresses(&srv, ports, networkingOpts) if err != nil { t.Fatalf("nodeAddresses returned error: %v", err) } @@ -760,10 +760,10 @@ func TestNodeAddressesIPv6Disabled(t *testing.T) { IPv6SupportDisabled: true, } - interfaces := []attachinterfaces.Interface{ + ports := []ports.Port{ { - PortState: "ACTIVE", - FixedIPs: []attachinterfaces.FixedIP{ + Status: "ACTIVE", + FixedIPs: []ports.IP{ { IPAddress: "10.0.0.32", }, @@ -774,7 +774,7 @@ func TestNodeAddressesIPv6Disabled(t *testing.T) { }, } - addrs, err := nodeAddresses(&srv, interfaces, networkingOpts) + addrs, err := nodeAddresses(&srv, ports, networkingOpts) if err != nil { t.Fatalf("nodeAddresses returned error: %v", err) } @@ -841,10 +841,10 @@ func TestNodeAddressesWithAddressSortOrderOptions(t *testing.T) { AddressSortOrder: "10.0.0.0/8, 50.56.176.0/24, 2001:4800::/32", } - interfaces := []attachinterfaces.Interface{ + ports := []ports.Port{ { - PortState: "ACTIVE", - FixedIPs: []attachinterfaces.FixedIP{ + Status: "ACTIVE", + FixedIPs: []ports.IP{ { IPAddress: "10.0.0.32", }, @@ -855,7 +855,7 @@ func TestNodeAddressesWithAddressSortOrderOptions(t *testing.T) { }, } - addrs, err := nodeAddresses(&srv, interfaces, networkingOpts) + addrs, err := nodeAddresses(&srv, ports, networkingOpts) if err != nil { t.Fatalf("nodeAddresses returned error: %v", err) } diff --git a/tests/playbooks/roles/install-docker/defaults/main.yml b/tests/playbooks/roles/install-docker/defaults/main.yml index b2fd8a8db8..2482005ccd 100644 --- a/tests/playbooks/roles/install-docker/defaults/main.yml +++ b/tests/playbooks/roles/install-docker/defaults/main.yml @@ -1,2 +1,2 @@ --- -docker_version: 5:19.03.15~3-0~ubuntu-focal \ No newline at end of file +docker_version: 5:20.10.18~3-0~ubuntu-focal diff --git a/tests/playbooks/roles/install-docker/tasks/main.yml b/tests/playbooks/roles/install-docker/tasks/main.yml index adbc25fea2..70b8e69233 100644 --- a/tests/playbooks/roles/install-docker/tasks/main.yml +++ b/tests/playbooks/roles/install-docker/tasks/main.yml @@ -28,7 +28,7 @@ # apt-get update; apt install -y docker-ce= - name: Install docker-ce apt: - name: docker-ce={{ docker_version }} + name: docker-ce #={{ docker_version }} state: present update_cache: yes diff --git a/vendor/github.com/gophercloud/gophercloud/CHANGELOG.md b/vendor/github.com/gophercloud/gophercloud/CHANGELOG.md index 9e2567b98b..e737082d69 100644 --- a/vendor/github.com/gophercloud/gophercloud/CHANGELOG.md +++ b/vendor/github.com/gophercloud/gophercloud/CHANGELOG.md @@ -1,3 +1,28 @@ +## v1.4.0 (2023-05-25) + +New features and improvements: + +* [GH-2465](https://github.com/gophercloud/gophercloud/pull/2465) keystone: add v3 limits update operation +* [GH-2596](https://github.com/gophercloud/gophercloud/pull/2596) keystone: add v3 limits get operation +* [GH-2618](https://github.com/gophercloud/gophercloud/pull/2618) keystone: add v3 limits delete operation +* [GH-2616](https://github.com/gophercloud/gophercloud/pull/2616) Add CRUD support for register limit APIs +* [GH-2610](https://github.com/gophercloud/gophercloud/pull/2610) Add PUT/HEAD/DELETE for identity/v3/OS-INHERIT +* [GH-2597](https://github.com/gophercloud/gophercloud/pull/2597) Add validation and optimise objects.BulkDelete +* [GH-2602](https://github.com/gophercloud/gophercloud/pull/2602) [swift v1]: introduce a TempURLKey argument for objects.CreateTempURLOpts struct +* [GH-2623](https://github.com/gophercloud/gophercloud/pull/2623) Add the ability to remove ingress/egress policies from fwaas_v2 groups +* [GH-2625](https://github.com/gophercloud/gophercloud/pull/2625) neutron: Support trunk_details extension + +CI changes: + +* [GH-2608](https://github.com/gophercloud/gophercloud/pull/2608) Drop train and ussuri jobs +* [GH-2589](https://github.com/gophercloud/gophercloud/pull/2589) Bump EmilienM/devstack-action from 0.10 to 0.11 +* [GH-2604](https://github.com/gophercloud/gophercloud/pull/2604) Bump mheap/github-action-required-labels from 3 to 4 +* [GH-2620](https://github.com/gophercloud/gophercloud/pull/2620) Pin goimport dep to a version that works with go 1.14 +* [GH-2619](https://github.com/gophercloud/gophercloud/pull/2619) Fix version comparison for acceptance tests +* [GH-2627](https://github.com/gophercloud/gophercloud/pull/2627) Limits: Fix ToDo to create registered limit and use it +* [GH-2629](https://github.com/gophercloud/gophercloud/pull/2629) [manila]: Add share from snapshot restore functional test + + ## v1.3.0 (2023-03-28) * [GH-2464](https://github.com/gophercloud/gophercloud/pull/2464) keystone: add v3 limits create operation diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/attachinterfaces/doc.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/attachinterfaces/doc.go deleted file mode 100644 index 3653122bf3..0000000000 --- a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/attachinterfaces/doc.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Package attachinterfaces provides the ability to retrieve and manage network -interfaces through Nova. - -Example of Listing a Server's Interfaces - - serverID := "b07e7a3b-d951-4efc-a4f9-ac9f001afb7f" - allPages, err := attachinterfaces.List(computeClient, serverID).AllPages() - if err != nil { - panic(err) - } - - allInterfaces, err := attachinterfaces.ExtractInterfaces(allPages) - if err != nil { - panic(err) - } - - for _, interface := range allInterfaces { - fmt.Printf("%+v\n", interface) - } - -Example to Get a Server's Interface - - portID = "0dde1598-b374-474e-986f-5b8dd1df1d4e" - serverID := "b07e7a3b-d951-4efc-a4f9-ac9f001afb7f" - interface, err := attachinterfaces.Get(computeClient, serverID, portID).Extract() - if err != nil { - panic(err) - } - -Example to Create a new Interface attachment on the Server - - networkID := "8a5fe506-7e9f-4091-899b-96336909d93c" - serverID := "b07e7a3b-d951-4efc-a4f9-ac9f001afb7f" - attachOpts := attachinterfaces.CreateOpts{ - NetworkID: networkID, - } - interface, err := attachinterfaces.Create(computeClient, serverID, attachOpts).Extract() - if err != nil { - panic(err) - } - -Example to Delete an Interface attachment from the Server - - portID = "0dde1598-b374-474e-986f-5b8dd1df1d4e" - serverID := "b07e7a3b-d951-4efc-a4f9-ac9f001afb7f" - err := attachinterfaces.Delete(computeClient, serverID, portID).ExtractErr() - if err != nil { - panic(err) - } -*/ -package attachinterfaces diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/attachinterfaces/requests.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/attachinterfaces/requests.go deleted file mode 100644 index 9748ce4ac1..0000000000 --- a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/attachinterfaces/requests.go +++ /dev/null @@ -1,75 +0,0 @@ -package attachinterfaces - -import ( - "github.com/gophercloud/gophercloud" - "github.com/gophercloud/gophercloud/pagination" -) - -// List makes a request against the nova API to list the server's interfaces. -func List(client *gophercloud.ServiceClient, serverID string) pagination.Pager { - return pagination.NewPager(client, listInterfaceURL(client, serverID), func(r pagination.PageResult) pagination.Page { - return InterfacePage{pagination.SinglePageBase(r)} - }) -} - -// Get requests details on a single interface attachment by the server and port IDs. -func Get(client *gophercloud.ServiceClient, serverID, portID string) (r GetResult) { - resp, err := client.Get(getInterfaceURL(client, serverID, portID), &r.Body, &gophercloud.RequestOpts{ - OkCodes: []int{200}, - }) - _, r.Header, r.Err = gophercloud.ParseResponse(resp, err) - return -} - -// CreateOptsBuilder allows extensions to add additional parameters to the -// Create request. -type CreateOptsBuilder interface { - ToAttachInterfacesCreateMap() (map[string]interface{}, error) -} - -// CreateOpts specifies parameters of a new interface attachment. -type CreateOpts struct { - // PortID is the ID of the port for which you want to create an interface. - // The NetworkID and PortID parameters are mutually exclusive. - // If you do not specify the PortID parameter, the OpenStack Networking API - // v2.0 allocates a port and creates an interface for it on the network. - PortID string `json:"port_id,omitempty"` - - // NetworkID is the ID of the network for which you want to create an interface. - // The NetworkID and PortID parameters are mutually exclusive. - // If you do not specify the NetworkID parameter, the OpenStack Networking - // API v2.0 uses the network information cache that is associated with the instance. - NetworkID string `json:"net_id,omitempty"` - - // Slice of FixedIPs. If you request a specific FixedIP address without a - // NetworkID, the request returns a Bad Request (400) response code. - // Note: this uses the FixedIP struct, but only the IPAddress field can be used. - FixedIPs []FixedIP `json:"fixed_ips,omitempty"` -} - -// ToAttachInterfacesCreateMap constructs a request body from CreateOpts. -func (opts CreateOpts) ToAttachInterfacesCreateMap() (map[string]interface{}, error) { - return gophercloud.BuildRequestBody(opts, "interfaceAttachment") -} - -// Create requests the creation of a new interface attachment on the server. -func Create(client *gophercloud.ServiceClient, serverID string, opts CreateOptsBuilder) (r CreateResult) { - b, err := opts.ToAttachInterfacesCreateMap() - if err != nil { - r.Err = err - return - } - resp, err := client.Post(createInterfaceURL(client, serverID), b, &r.Body, &gophercloud.RequestOpts{ - OkCodes: []int{200}, - }) - _, r.Header, r.Err = gophercloud.ParseResponse(resp, err) - return -} - -// Delete makes a request against the nova API to detach a single interface from the server. -// It needs server and port IDs to make a such request. -func Delete(client *gophercloud.ServiceClient, serverID, portID string) (r DeleteResult) { - resp, err := client.Delete(deleteInterfaceURL(client, serverID, portID), nil) - _, r.Header, r.Err = gophercloud.ParseResponse(resp, err) - return -} diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/attachinterfaces/results.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/attachinterfaces/results.go deleted file mode 100644 index e713c34e9b..0000000000 --- a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/attachinterfaces/results.go +++ /dev/null @@ -1,84 +0,0 @@ -package attachinterfaces - -import ( - "github.com/gophercloud/gophercloud" - "github.com/gophercloud/gophercloud/pagination" -) - -type attachInterfaceResult struct { - gophercloud.Result -} - -// Extract interprets any attachInterfaceResult as an Interface, if possible. -func (r attachInterfaceResult) Extract() (*Interface, error) { - var s struct { - Interface *Interface `json:"interfaceAttachment"` - } - err := r.ExtractInto(&s) - return s.Interface, err -} - -// GetResult is the response from a Get operation. Call its Extract -// method to interpret it as an Interface. -type GetResult struct { - attachInterfaceResult -} - -// CreateResult is the response from a Create operation. Call its Extract -// method to interpret it as an Interface. -type CreateResult struct { - attachInterfaceResult -} - -// DeleteResult is the response from a Delete operation. Call its ExtractErr -// method to determine if the call succeeded or failed. -type DeleteResult struct { - gophercloud.ErrResult -} - -// FixedIP represents a Fixed IP Address. -// This struct is also used when creating an attachment, -// but it is not possible to specify a SubnetID. -type FixedIP struct { - SubnetID string `json:"subnet_id,omitempty"` - IPAddress string `json:"ip_address"` -} - -// Interface represents a network interface on a server. -type Interface struct { - PortState string `json:"port_state"` - FixedIPs []FixedIP `json:"fixed_ips"` - PortID string `json:"port_id"` - NetID string `json:"net_id"` - MACAddr string `json:"mac_addr"` -} - -// InterfacePage abstracts the raw results of making a List() request against -// the API. -// -// As OpenStack extensions may freely alter the response bodies of structures -// returned to the client, you may only safely access the data provided through -// the ExtractInterfaces call. -type InterfacePage struct { - pagination.SinglePageBase -} - -// IsEmpty returns true if an InterfacePage contains no interfaces. -func (r InterfacePage) IsEmpty() (bool, error) { - if r.StatusCode == 204 { - return true, nil - } - - interfaces, err := ExtractInterfaces(r) - return len(interfaces) == 0, err -} - -// ExtractInterfaces interprets the results of a single page from a List() call, -// producing a slice of Interface structs. -func ExtractInterfaces(r pagination.Page) ([]Interface, error) { - var s struct { - Interfaces []Interface `json:"interfaceAttachments"` - } - err := (r.(InterfacePage)).ExtractInto(&s) - return s.Interfaces, err -} diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/attachinterfaces/urls.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/attachinterfaces/urls.go deleted file mode 100644 index 50292e8b5a..0000000000 --- a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/attachinterfaces/urls.go +++ /dev/null @@ -1,18 +0,0 @@ -package attachinterfaces - -import "github.com/gophercloud/gophercloud" - -func listInterfaceURL(client *gophercloud.ServiceClient, serverID string) string { - return client.ServiceURL("servers", serverID, "os-interface") -} - -func getInterfaceURL(client *gophercloud.ServiceClient, serverID, portID string) string { - return client.ServiceURL("servers", serverID, "os-interface", portID) -} - -func createInterfaceURL(client *gophercloud.ServiceClient, serverID string) string { - return client.ServiceURL("servers", serverID, "os-interface") -} -func deleteInterfaceURL(client *gophercloud.ServiceClient, serverID, portID string) string { - return client.ServiceURL("servers", serverID, "os-interface", portID) -} diff --git a/vendor/github.com/gophercloud/gophercloud/provider_client.go b/vendor/github.com/gophercloud/gophercloud/provider_client.go index c603d6dbe3..12273d8049 100644 --- a/vendor/github.com/gophercloud/gophercloud/provider_client.go +++ b/vendor/github.com/gophercloud/gophercloud/provider_client.go @@ -14,7 +14,7 @@ import ( // DefaultUserAgent is the default User-Agent string set in the request header. const ( - DefaultUserAgent = "gophercloud/v1.3.0" + DefaultUserAgent = "gophercloud/v1.4.0" DefaultMaxBackoffRetries = 60 ) diff --git a/vendor/modules.txt b/vendor/modules.txt index 90fd7bf7e4..e7ce526d9e 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -143,7 +143,7 @@ github.com/google/pprof/profile # github.com/google/uuid v1.3.0 ## explicit github.com/google/uuid -# github.com/gophercloud/gophercloud v1.3.0 +# github.com/gophercloud/gophercloud v1.4.0 ## explicit; go 1.14 github.com/gophercloud/gophercloud github.com/gophercloud/gophercloud/openstack @@ -153,7 +153,6 @@ github.com/gophercloud/gophercloud/openstack/blockstorage/v3/snapshots github.com/gophercloud/gophercloud/openstack/blockstorage/v3/volumes github.com/gophercloud/gophercloud/openstack/common/extensions github.com/gophercloud/gophercloud/openstack/compute/v2/extensions -github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/attachinterfaces github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/availabilityzones github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/startstop github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/volumeattach