Skip to content

Commit

Permalink
Remove FIPSMode for EE
Browse files Browse the repository at this point in the history
  • Loading branch information
rene-dekker committed Aug 9, 2024
1 parent 4116695 commit 3756346
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 45 deletions.
1 change: 1 addition & 0 deletions api/v1/installation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ type InstallationSpec struct {
CalicoNodeWindowsDaemonSet *CalicoNodeWindowsDaemonSet `json:"calicoNodeWindowsDaemonSet,omitempty"`

// FIPSMode uses images and features only that are using FIPS 140-2 validated cryptographic modules and standards.
// Only supported for Variant=Calico.
// Default: Disabled
// +kubebuilder:validation:Enum=Enabled;Disabled
// +optional
Expand Down
6 changes: 3 additions & 3 deletions pkg/render/apiserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ var _ = Describe("API server rendering tests (Calico Enterprise)", func() {
))
Expect(d.Spec.Template.Spec.Containers[1].Args).To(BeEmpty())

Expect(d.Spec.Template.Spec.Containers[1].Env).To(HaveLen(7))
Expect(d.Spec.Template.Spec.Containers[1].Env).To(HaveLen(6))
Expect(d.Spec.Template.Spec.Containers[1].Env[0].Name).To(Equal("LOGLEVEL"))
Expect(d.Spec.Template.Spec.Containers[1].Env[0].Value).To(Equal("info"))
Expect(d.Spec.Template.Spec.Containers[1].Env[0].ValueFrom).To(BeNil())
Expand All @@ -271,8 +271,8 @@ var _ = Describe("API server rendering tests (Calico Enterprise)", func() {
Expect(d.Spec.Template.Spec.Containers[1].Env[4].Name).To(Equal("TLS_KEY"))
Expect(d.Spec.Template.Spec.Containers[1].Env[4].Value).To(Equal("/tigera-apiserver-certs/tls.key"))
Expect(d.Spec.Template.Spec.Containers[1].Env[4].ValueFrom).To(BeNil())
Expect(d.Spec.Template.Spec.Containers[1].Env[6].Name).To(Equal("TRUSTED_BUNDLE_PATH"))
Expect(d.Spec.Template.Spec.Containers[1].Env[6].Value).To(Equal("/etc/pki/tls/certs/tigera-ca-bundle.crt"))
Expect(d.Spec.Template.Spec.Containers[1].Env[5].Name).To(Equal("TRUSTED_BUNDLE_PATH"))
Expect(d.Spec.Template.Spec.Containers[1].Env[5].Value).To(Equal("/etc/pki/tls/certs/tigera-ca-bundle.crt"))

// Expect the SECURITY_GROUP env variables to not be set
Expect(d.Spec.Template.Spec.Containers[1].Env).NotTo(ContainElement(gstruct.MatchFields(gstruct.IgnoreExtras, gstruct.Fields{"Name": Equal("TIGERA_DEFAULT_SECURITY_GROUPS")})))
Expand Down
1 change: 0 additions & 1 deletion pkg/render/intrusion_detection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
. "github.com/onsi/gomega"

appsv1 "k8s.io/api/apps/v1"
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
"k8s.io/apimachinery/pkg/api/resource"
Expand Down
2 changes: 1 addition & 1 deletion pkg/render/logstorage/dashboards/dashboards.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (d *dashboards) ResolveImages(is *operatorv1.ImageSet) error {
}

func (d *dashboards) Objects() (objsToCreate, objsToDelete []client.Object) {
if d.cfg.IsManaged || operatorv1.IsFIPSModeEnabled(d.cfg.Installation.FIPSMode) {
if d.cfg.IsManaged {
return nil, d.resources()
}

Expand Down
21 changes: 0 additions & 21 deletions pkg/render/logstorage/dashboards/dashboards_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,27 +179,6 @@ var _ = Describe("Dashboards rendering tests", func() {
Entry("for management/standalone, openshift-dns", testutils.AllowTigeraScenario{ManagedCluster: false, OpenShift: true}),
)
})

It("should not render when FIPS mode is enabled", func() {
bundle := getBundle(installation)
enabled := operatorv1.FIPSModeEnabled
installation.FIPSMode = &enabled
component := Dashboards(&Config{
Installation: installation,
PullSecrets: []*corev1.Secret{
{ObjectMeta: metav1.ObjectMeta{Name: "tigera-pull-secret"}},
},
TrustedBundle: bundle,
Namespace: render.ElasticsearchNamespace,
KibanaHost: "tigera-secure-kb-http.tigera-kibana.tigera-kibana.svc",
KibanaScheme: "htpps",
KibanaPort: 5601,
})

resources, _ := component.Objects()
_, ok := rtest.GetResource(resources, Name, render.ElasticsearchNamespace, "batch", "v1", "Job").(*batchv1.Job)
Expect(ok).To(BeFalse(), "Jobs not found")
})
})

Context("multi-tenant rendering", func() {
Expand Down
5 changes: 0 additions & 5 deletions pkg/render/logstorage/kibana/kibana.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ var (

// Kibana renders the components necessary for kibana and elasticsearch
func Kibana(cfg *Configuration) render.Component {
if cfg.Enabled && operatorv1.IsFIPSModeEnabled(cfg.Installation.FIPSMode) {
// This branch should only be hit if there is a coding bug in the controller, as Enabled
// should already take into account FIPS.
panic("BUG: Kibana is not supported in FIPS mode")
}
return &kibana{
cfg: cfg,
}
Expand Down
28 changes: 14 additions & 14 deletions pkg/render/logstorage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,20 +495,20 @@ var _ = Describe("Elasticsearch rendering tests", func() {
Expect(nodeSelectors["k2"]).To(Equal("v2"))
})


It("should render SecurityContextConstrains properly when provider is OpenShift", func() {
cfg.Installation.KubernetesProvider = operatorv1.ProviderOpenShift
component := render.LogStorage(cfg)
Expect(component.ResolveImages(nil)).To(BeNil())
resources, _ := component.Objects()

role := rtest.GetResource(resources, "tigera-elasticsearch", "", "rbac.authorization.k8s.io", "v1", "ClusterRole").(*rbacv1.ClusterRole)
Expect(role.Rules).To(ContainElement(rbacv1.PolicyRule{
APIGroups: []string{"security.openshift.io"},
Resources: []string{"securitycontextconstraints"},
Verbs: []string{"use"},
ResourceNames: []string{"privileged"},
}))
It("should render SecurityContextConstrains properly when provider is OpenShift", func() {
cfg.Installation.KubernetesProvider = operatorv1.ProviderOpenShift
component := render.LogStorage(cfg)
Expect(component.ResolveImages(nil)).To(BeNil())
resources, _ := component.Objects()

role := rtest.GetResource(resources, "tigera-elasticsearch", "", "rbac.authorization.k8s.io", "v1", "ClusterRole").(*rbacv1.ClusterRole)
Expect(role.Rules).To(ContainElement(rbacv1.PolicyRule{
APIGroups: []string{"security.openshift.io"},
Resources: []string{"securitycontextconstraints"},
Verbs: []string{"use"},
ResourceNames: []string{"privileged"},
}))
})
})

Context("Managed cluster", func() {
Expand Down
2 changes: 2 additions & 0 deletions pkg/render/typha_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ var _ = Describe("Typha rendering tests", func() {

It("should render the correct env and/or images when FIPS mode is enabled (OSS)", func() {
cfg.Installation.Variant = operatorv1.Calico
fipsEnabled := operatorv1.FIPSModeEnabled
cfg.Installation.FIPSMode = &fipsEnabled
component := render.Typha(&cfg)
Expect(component.ResolveImages(nil)).To(BeNil())
resources, _ := component.Objects()
Expand Down

0 comments on commit 3756346

Please sign in to comment.