Merge pull request #9967 from olemarkus/cilium-hubble-pointer

Cilium hubble pointer
This commit is contained in:
Kubernetes Prow Robot 2020-09-30 12:36:54 -07:00 committed by GitHub
commit 13cbd84886
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 46 additions and 17 deletions

View File

@ -441,7 +441,7 @@ type CiliumNetworkingSpec struct {
// Default: false
EnableRemoteNodeIdentity *bool `json:"enableRemoteNodeIdentity,omitempty"`
// Hubble configures the Hubble service on the Cilium agent.
Hubble HubbleSpec `json:"hubble,omitempty"`
Hubble *HubbleSpec `json:"hubble,omitempty"`
// RemoveCbrBridge is not implemented and may be removed in the future.
// Setting this has no effect.

View File

@ -439,7 +439,7 @@ type CiliumNetworkingSpec struct {
// Default: false
EnableRemoteNodeIdentity *bool `json:"enableRemoteNodeIdentity,omitempty"`
// Hubble configures the Hubble service on the Cilium agent.
Hubble HubbleSpec `json:"hubble,omitempty"`
Hubble *HubbleSpec `json:"hubble,omitempty"`
// RemoveCbrBridge is not implemented and may be removed in the future.
// Setting this has no effect.

View File

@ -1484,8 +1484,14 @@ func autoConvert_v1alpha2_CiliumNetworkingSpec_To_kops_CiliumNetworkingSpec(in *
out.EnableNodePort = in.EnableNodePort
out.EtcdManaged = in.EtcdManaged
out.EnableRemoteNodeIdentity = in.EnableRemoteNodeIdentity
if err := Convert_v1alpha2_HubbleSpec_To_kops_HubbleSpec(&in.Hubble, &out.Hubble, s); err != nil {
return err
if in.Hubble != nil {
in, out := &in.Hubble, &out.Hubble
*out = new(kops.HubbleSpec)
if err := Convert_v1alpha2_HubbleSpec_To_kops_HubbleSpec(*in, *out, s); err != nil {
return err
}
} else {
out.Hubble = nil
}
out.RemoveCbrBridge = in.RemoveCbrBridge
out.RestartPods = in.RestartPods
@ -1570,8 +1576,14 @@ func autoConvert_kops_CiliumNetworkingSpec_To_v1alpha2_CiliumNetworkingSpec(in *
out.EnableNodePort = in.EnableNodePort
out.EtcdManaged = in.EtcdManaged
out.EnableRemoteNodeIdentity = in.EnableRemoteNodeIdentity
if err := Convert_kops_HubbleSpec_To_v1alpha2_HubbleSpec(&in.Hubble, &out.Hubble, s); err != nil {
return err
if in.Hubble != nil {
in, out := &in.Hubble, &out.Hubble
*out = new(HubbleSpec)
if err := Convert_kops_HubbleSpec_To_v1alpha2_HubbleSpec(*in, *out, s); err != nil {
return err
}
} else {
out.Hubble = nil
}
out.RemoveCbrBridge = in.RemoveCbrBridge
out.RestartPods = in.RestartPods

View File

@ -386,7 +386,11 @@ func (in *CiliumNetworkingSpec) DeepCopyInto(out *CiliumNetworkingSpec) {
*out = new(bool)
**out = **in
}
in.Hubble.DeepCopyInto(&out.Hubble)
if in.Hubble != nil {
in, out := &in.Hubble, &out.Hubble
*out = new(HubbleSpec)
(*in).DeepCopyInto(*out)
}
return
}

View File

@ -709,7 +709,7 @@ func validateNetworkingCilium(cluster *kops.Cluster, v *kops.CiliumNetworkingSpe
allErrs = append(allErrs, field.Forbidden(versionFld, "Version 1.8 requires kubernetesVersion 1.12 or newer"))
}
if fi.BoolValue(v.Hubble.Enabled) {
if v.Hubble != nil && fi.BoolValue(v.Hubble.Enabled) {
if version.Minor < 8 {
allErrs = append(allErrs, field.Forbidden(fldPath.Root().Child("hubble", "enabled"), "Hubble requires Cilium 1.8 or newer"))
}

View File

@ -630,7 +630,7 @@ func Test_Validate_Cilium(t *testing.T) {
{
Cilium: kops.CiliumNetworkingSpec{
Version: "v1.7.0",
Hubble: kops.HubbleSpec{
Hubble: &kops.HubbleSpec{
Enabled: fi.Bool(true),
},
},
@ -639,7 +639,7 @@ func Test_Validate_Cilium(t *testing.T) {
{
Cilium: kops.CiliumNetworkingSpec{
Version: "v1.8.0",
Hubble: kops.HubbleSpec{
Hubble: &kops.HubbleSpec{
Enabled: fi.Bool(true),
},
},

View File

@ -486,7 +486,11 @@ func (in *CiliumNetworkingSpec) DeepCopyInto(out *CiliumNetworkingSpec) {
*out = new(bool)
**out = **in
}
in.Hubble.DeepCopyInto(&out.Hubble)
if in.Hubble != nil {
in, out := &in.Hubble, &out.Hubble
*out = new(HubbleSpec)
(*in).DeepCopyInto(*out)
}
return
}

View File

@ -96,6 +96,17 @@ func (b *CiliumOptionsBuilder) BuildOptions(o interface{}) error {
c.EnableRemoteNodeIdentity = fi.Bool(true)
}
hubble := c.Hubble
if hubble != nil {
if hubble.Enabled == nil {
hubble.Enabled = fi.Bool(true)
}
} else {
c.Hubble = &kops.HubbleSpec{
Enabled: fi.Bool(false),
}
}
return nil
}

View File

@ -4553,7 +4553,7 @@ data:
{{ end }}
{{ end }}
{{ if .Hubble.Enabled }}
{{ if WithDefaultBool .Hubble.Enabled false }}
# Enable Hubble gRPC service.
enable-hubble: "true"
# UNIX domain socket for Hubble server to listen to.
@ -5222,7 +5222,7 @@ spec:
{{ end }}
{{ end }}
{{ if .Networking.Cilium.Hubble.Enabled }}
{{ if WithDefaultBool .Networking.Cilium.Hubble.Enabled false }}
---
# Source: cilium/charts/hubble-relay/templates/service.yaml
kind: Service

View File

@ -166,7 +166,7 @@ data:
{{ end }}
{{ end }}
{{ if .Hubble.Enabled }}
{{ if WithDefaultBool .Hubble.Enabled false }}
# Enable Hubble gRPC service.
enable-hubble: "true"
# UNIX domain socket for Hubble server to listen to.
@ -835,7 +835,7 @@ spec:
{{ end }}
{{ end }}
{{ if .Networking.Cilium.Hubble.Enabled }}
{{ if WithDefaultBool .Networking.Cilium.Hubble.Enabled false }}
---
# Source: cilium/charts/hubble-relay/templates/service.yaml
kind: Service

View File

@ -276,7 +276,6 @@ func TestSetupNetworking(t *testing.T) {
Networking: &api.NetworkingSpec{
Cilium: &api.CiliumNetworkingSpec{
EnableNodePort: true,
Hubble: api.HubbleSpec{},
},
},
},
@ -295,7 +294,6 @@ func TestSetupNetworking(t *testing.T) {
Cilium: &api.CiliumNetworkingSpec{
EnableNodePort: true,
EtcdManaged: true,
Hubble: api.HubbleSpec{},
},
},
},