mirror of https://github.com/kubernetes/kops.git
Use enum for cilium encryption types
This commit is contained in:
parent
0e8d189aee
commit
7534890b3a
|
@ -266,6 +266,11 @@ type AmazonVPCNetworkingSpec struct {
|
||||||
|
|
||||||
const CiliumIpamEni = "eni"
|
const CiliumIpamEni = "eni"
|
||||||
|
|
||||||
|
type CiliumEncryptionType string
|
||||||
|
|
||||||
|
const CiliumEncryptionTypeIPSec CiliumEncryptionType = "ipsec"
|
||||||
|
const CiliumEncryptionTypeWireguard CiliumEncryptionType = "wireguard"
|
||||||
|
|
||||||
// CiliumNetworkingSpec declares that we want Cilium networking
|
// CiliumNetworkingSpec declares that we want Cilium networking
|
||||||
type CiliumNetworkingSpec struct {
|
type CiliumNetworkingSpec struct {
|
||||||
// Version is the version of the Cilium agent and the Cilium Operator.
|
// Version is the version of the Cilium agent and the Cilium Operator.
|
||||||
|
@ -345,7 +350,7 @@ type CiliumNetworkingSpec struct {
|
||||||
EnableEncryption bool `json:"enableEncryption,omitempty"`
|
EnableEncryption bool `json:"enableEncryption,omitempty"`
|
||||||
// EncryptionType specifies Cilium Encryption method ("ipsec", "wireguard").
|
// EncryptionType specifies Cilium Encryption method ("ipsec", "wireguard").
|
||||||
// Default: ipsec
|
// Default: ipsec
|
||||||
EncryptionType string `json:"encryptionType,omitempty"`
|
EncryptionType CiliumEncryptionType `json:"encryptionType,omitempty"`
|
||||||
// EnvoyLog is not implemented and may be removed in the future.
|
// EnvoyLog is not implemented and may be removed in the future.
|
||||||
// Setting this has no effect.
|
// Setting this has no effect.
|
||||||
EnvoyLog string `json:"envoyLog,omitempty"`
|
EnvoyLog string `json:"envoyLog,omitempty"`
|
||||||
|
|
|
@ -266,6 +266,11 @@ type AmazonVPCNetworkingSpec struct {
|
||||||
|
|
||||||
const CiliumIpamEni = "eni"
|
const CiliumIpamEni = "eni"
|
||||||
|
|
||||||
|
type CiliumEncryptionType string
|
||||||
|
|
||||||
|
const CiliumEncryptionTypeIPSec CiliumEncryptionType = "ipsec"
|
||||||
|
const CiliumEncryptionTypeWireguard CiliumEncryptionType = "wireguard"
|
||||||
|
|
||||||
// CiliumNetworkingSpec declares that we want Cilium networking
|
// CiliumNetworkingSpec declares that we want Cilium networking
|
||||||
type CiliumNetworkingSpec struct {
|
type CiliumNetworkingSpec struct {
|
||||||
// Version is the version of the Cilium agent and the Cilium Operator.
|
// Version is the version of the Cilium agent and the Cilium Operator.
|
||||||
|
@ -345,7 +350,7 @@ type CiliumNetworkingSpec struct {
|
||||||
EnableEncryption bool `json:"enableEncryption,omitempty"`
|
EnableEncryption bool `json:"enableEncryption,omitempty"`
|
||||||
// EncryptionType specifies Cilium Encryption method ("ipsec", "wireguard").
|
// EncryptionType specifies Cilium Encryption method ("ipsec", "wireguard").
|
||||||
// Default: ipsec
|
// Default: ipsec
|
||||||
EncryptionType string `json:"encryptionType,omitempty"`
|
EncryptionType CiliumEncryptionType `json:"encryptionType,omitempty"`
|
||||||
// EnvoyLog is not implemented and may be removed in the future.
|
// EnvoyLog is not implemented and may be removed in the future.
|
||||||
// Setting this has no effect.
|
// Setting this has no effect.
|
||||||
EnvoyLog string `json:"envoyLog,omitempty"`
|
EnvoyLog string `json:"envoyLog,omitempty"`
|
||||||
|
|
|
@ -1774,7 +1774,7 @@ func autoConvert_v1alpha2_CiliumNetworkingSpec_To_kops_CiliumNetworkingSpec(in *
|
||||||
out.EnableTracing = in.EnableTracing
|
out.EnableTracing = in.EnableTracing
|
||||||
out.EnablePrometheusMetrics = in.EnablePrometheusMetrics
|
out.EnablePrometheusMetrics = in.EnablePrometheusMetrics
|
||||||
out.EnableEncryption = in.EnableEncryption
|
out.EnableEncryption = in.EnableEncryption
|
||||||
out.EncryptionType = in.EncryptionType
|
out.EncryptionType = kops.CiliumEncryptionType(in.EncryptionType)
|
||||||
out.EnvoyLog = in.EnvoyLog
|
out.EnvoyLog = in.EnvoyLog
|
||||||
out.IdentityAllocationMode = in.IdentityAllocationMode
|
out.IdentityAllocationMode = in.IdentityAllocationMode
|
||||||
out.IdentityChangeGracePeriod = in.IdentityChangeGracePeriod
|
out.IdentityChangeGracePeriod = in.IdentityChangeGracePeriod
|
||||||
|
@ -1882,7 +1882,7 @@ func autoConvert_kops_CiliumNetworkingSpec_To_v1alpha2_CiliumNetworkingSpec(in *
|
||||||
out.EnableTracing = in.EnableTracing
|
out.EnableTracing = in.EnableTracing
|
||||||
out.EnablePrometheusMetrics = in.EnablePrometheusMetrics
|
out.EnablePrometheusMetrics = in.EnablePrometheusMetrics
|
||||||
out.EnableEncryption = in.EnableEncryption
|
out.EnableEncryption = in.EnableEncryption
|
||||||
out.EncryptionType = in.EncryptionType
|
out.EncryptionType = CiliumEncryptionType(in.EncryptionType)
|
||||||
out.EnvoyLog = in.EnvoyLog
|
out.EnvoyLog = in.EnvoyLog
|
||||||
out.IdentityAllocationMode = in.IdentityAllocationMode
|
out.IdentityAllocationMode = in.IdentityAllocationMode
|
||||||
out.IdentityChangeGracePeriod = in.IdentityChangeGracePeriod
|
out.IdentityChangeGracePeriod = in.IdentityChangeGracePeriod
|
||||||
|
|
|
@ -887,7 +887,8 @@ func validateNetworkingCilium(cluster *kops.Cluster, v *kops.CiliumNetworkingSpe
|
||||||
}
|
}
|
||||||
|
|
||||||
if v.EncryptionType != "" {
|
if v.EncryptionType != "" {
|
||||||
allErrs = append(allErrs, IsValidValue(fldPath.Child("encryptionType"), &v.EncryptionType, []string{"ipsec", "wireguard"})...)
|
encryptionType := string(v.EncryptionType)
|
||||||
|
allErrs = append(allErrs, IsValidValue(fldPath.Child("encryptionType"), &encryptionType, []string{"ipsec", "wireguard"})...)
|
||||||
|
|
||||||
version, _ := semver.Parse(v.Version)
|
version, _ := semver.Parse(v.Version)
|
||||||
if v.EncryptionType == "wireguard" && version.Minor < 10 {
|
if v.EncryptionType == "wireguard" && version.Minor < 10 {
|
||||||
|
|
|
@ -150,7 +150,7 @@ func (b *CiliumOptionsBuilder) BuildOptions(o interface{}) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.EncryptionType == "" {
|
if c.EncryptionType == "" {
|
||||||
c.EncryptionType = "ipsec"
|
c.EncryptionType = kops.CiliumEncryptionTypeIPSec
|
||||||
}
|
}
|
||||||
|
|
||||||
hubble := c.Hubble
|
hubble := c.Hubble
|
||||||
|
|
Loading…
Reference in New Issue