Skip to content

Commit

Permalink
Merge pull request #444 from luis5tb/double-listeners
Browse files Browse the repository at this point in the history
Bug 1791277: Stop deploying kuryr-admission-controller if double listeners supported
  • Loading branch information
openshift-merge-robot committed Jan 16, 2020
2 parents 632a7f7 + c0a01d0 commit cee4cf9
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 37 deletions.
3 changes: 2 additions & 1 deletion bindata/network/kuryr/006-service.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
{{if .AdmissionController}}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -12,3 +12,4 @@ spec:
targetPort: 6443
selector:
app: kuryr-dns-admission-controller
{{- end}}
3 changes: 2 additions & 1 deletion bindata/network/kuryr/007-admission.secret.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
{{if .AdmissionController}}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -7,3 +7,4 @@ metadata:
data:
ca.crt: {{ .WebhookCA }}
ca.key: {{ .WebhookCAKey }}
{{- end}}
3 changes: 2 additions & 1 deletion bindata/network/kuryr/008-webhook.secret.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
{{if .AdmissionController}}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -7,3 +7,4 @@ metadata:
data:
tls.crt: {{ .WebhookCert }}
tls.key: {{ .WebhookKey }}
{{- end}}
3 changes: 2 additions & 1 deletion bindata/network/kuryr/009-admission-controller.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
{{if .AdmissionController}}
kind: DaemonSet
apiVersion: apps/v1
metadata:
Expand Down Expand Up @@ -60,3 +60,4 @@ spec:
- key: "node.kubernetes.io/not-ready"
operator: Exists
effect: NoSchedule
{{- end}}
3 changes: 2 additions & 1 deletion bindata/network/kuryr/010-webhook.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
{{if .AdmissionController}}
apiVersion: admissionregistration.k8s.io/v1beta1
kind: MutatingWebhookConfiguration
metadata:
Expand All @@ -18,3 +18,4 @@ webhooks:
apiGroups: [""]
apiVersions: ["*"]
resources: ["pods"]
{{- end}}
27 changes: 14 additions & 13 deletions pkg/bootstrap/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@ import (
)

type KuryrBootstrapResult struct {
ServiceSubnet string
PodSubnetpool string
WorkerNodesRouter string
WorkerNodesSubnet string
PodSecurityGroups []string
ExternalNetwork string
ClusterID string
OctaviaProvider string
OpenStackCloud clientconfig.Cloud
WebhookCA string
WebhookCAKey string
WebhookCert string
WebhookKey string
ServiceSubnet string
PodSubnetpool string
WorkerNodesRouter string
WorkerNodesSubnet string
PodSecurityGroups []string
ExternalNetwork string
ClusterID string
OctaviaProvider string
OctaviaMultipleListeners bool
OpenStackCloud clientconfig.Cloud
WebhookCA string
WebhookCAKey string
WebhookCert string
WebhookKey string
}

type OVNBootstrapResult struct {
Expand Down
3 changes: 3 additions & 0 deletions pkg/network/kuryr.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ func renderKuryr(conf *operv1.NetworkSpec, bootstrapResult *bootstrap.BootstrapR
data.Data["PoolMinPorts"] = c.PoolMinPorts
data.Data["PoolBatchPorts"] = c.PoolBatchPorts

// deploy or not kuryr-admission-controller depending on double listeners support
data.Data["AdmissionController"] = !b.OctaviaMultipleListeners

// Octavia config data
data.Data["OctaviaProvider"] = b.OctaviaProvider
if b.OctaviaProvider == OVNProvider {
Expand Down
47 changes: 28 additions & 19 deletions pkg/platform/openstack/kuryr_bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ const (
CloudName = "openstack"
CloudsSecretKey = "clouds.yaml"
// NOTE(dulek): This one is hardcoded in openshift/installer.
InfrastructureCRDName = "cluster"
MinOctaviaVersionWithHTTPSMonitors = "v2.10"
MinOctaviaVersionWithProviders = "v2.6"
MinOctaviaVersionWithTagSupport = "v2.5"
MinOctaviaVersionWithTimeouts = "v2.1"
KuryrNamespace = "openshift-kuryr"
InfrastructureCRDName = "cluster"
MinOctaviaVersionWithMultipleListeners = "v2.11"
MinOctaviaVersionWithHTTPSMonitors = "v2.10"
MinOctaviaVersionWithProviders = "v2.6"
MinOctaviaVersionWithTagSupport = "v2.5"
MinOctaviaVersionWithTimeouts = "v2.1"
KuryrNamespace = "openshift-kuryr"
// NOTE(ltomasbo): Only OVN octavia driver supported on kuryr
OVNProvider = "ovn"
)
Expand Down Expand Up @@ -1087,6 +1088,12 @@ func BootstrapKuryr(conf *operv1.NetworkSpec, kubeClient client.Client) (*bootst
return nil, errors.Wrap(err, "failed to determine if Octavia supports providers")
}

log.Print("Checking Double Listeners Octavia support")
octaviaMultipleListenersSupport, err := IsOctaviaVersionSupported(client, MinOctaviaVersionWithMultipleListeners)
if err != nil {
return nil, errors.Wrap(err, "failed to determine if Octavia supports double listeners")
}

octaviaProvider := "default"
if octaviaProviderSupport {
page, err := providers.List(lbClient, providers.ListOpts{}).AllPages()
Expand All @@ -1101,6 +1108,7 @@ func BootstrapKuryr(conf *operv1.NetworkSpec, kubeClient client.Client) (*bootst
if provider.Name == OVNProvider {
log.Print("OVN Provider is enabled and Kuryr will use it")
octaviaProvider = OVNProvider
octaviaMultipleListenersSupport = false
}
}
}
Expand All @@ -1110,19 +1118,20 @@ func BootstrapKuryr(conf *operv1.NetworkSpec, kubeClient client.Client) (*bootst

res := bootstrap.BootstrapResult{
Kuryr: bootstrap.KuryrBootstrapResult{
ServiceSubnet: svcSubnetId,
PodSubnetpool: podSubnetpoolId,
WorkerNodesRouter: routerId,
WorkerNodesSubnet: workerSubnet.ID,
PodSecurityGroups: []string{podSgId},
ExternalNetwork: externalNetwork,
ClusterID: clusterID,
OctaviaProvider: octaviaProvider,
OpenStackCloud: cloud,
WebhookCA: b64.StdEncoding.EncodeToString(ca),
WebhookCAKey: b64.StdEncoding.EncodeToString(key),
WebhookKey: b64.StdEncoding.EncodeToString(webhookKey),
WebhookCert: b64.StdEncoding.EncodeToString(webhookCert),
ServiceSubnet: svcSubnetId,
PodSubnetpool: podSubnetpoolId,
WorkerNodesRouter: routerId,
WorkerNodesSubnet: workerSubnet.ID,
PodSecurityGroups: []string{podSgId},
ExternalNetwork: externalNetwork,
ClusterID: clusterID,
OctaviaProvider: octaviaProvider,
OctaviaMultipleListeners: octaviaMultipleListenersSupport,
OpenStackCloud: cloud,
WebhookCA: b64.StdEncoding.EncodeToString(ca),
WebhookCAKey: b64.StdEncoding.EncodeToString(key),
WebhookKey: b64.StdEncoding.EncodeToString(webhookKey),
WebhookCert: b64.StdEncoding.EncodeToString(webhookCert),
}}
return &res, nil
}

0 comments on commit cee4cf9

Please sign in to comment.