Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated cherry pick of #3072: CSR Image must be instantiated #3073

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ var _ = Describe("amazoncloudintegration controller tests", func() {
Spec: operatorv1.ImageSetSpec{
Images: []operatorv1.Image{
{Image: "tigera/cloud-controllers", Digest: "sha256:deadbeef0123456789"},
{Image: "tigera/key-cert-provisioner", Digest: "sha256:deadbeef0123456789"},
},
},
})).ToNot(HaveOccurred())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ var _ = Describe("authentication controller tests", func() {
Spec: operatorv1.ImageSetSpec{
Images: []operatorv1.Image{
{Image: "tigera/dex", Digest: "sha256:dexhash"},
{Image: "tigera/key-cert-provisioner", Digest: "sha256:deadbeef0123456789"},
},
},
})).ToNot(HaveOccurred())
Expand Down
19 changes: 13 additions & 6 deletions pkg/controller/certificatemanager/certificatemanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,13 @@ func Create(cli client.Client, installation *operatorv1.InstallationSpec, cluste
caSecretName = certificatemanagement.TenantCASecretName
}

if installation != nil && installation.CertificateManagement != nil {
// Configured to use certificate management. Get the CACert from
// the installation spec.
certificateManagement = installation.CertificateManagement
var certificateManagementEnabled bool
if installation != nil {
imageSet, err := imageset.GetImageSet(context.Background(), cli, installation.Variant)
if err != nil {
return nil, err
}
// We instantiate csrImage regardless of whether certificate management is enabled; it may still be used.
csrImage, err = components.GetReference(
components.ComponentCSRInitContainer,
installation.Registry,
Expand All @@ -186,8 +185,16 @@ func Create(cli client.Client, installation *operatorv1.InstallationSpec, cluste
if err != nil {
return nil, err
}
certificatePEM = certificateManagement.CACert
} else {
if installation.CertificateManagement != nil {
// Configured to use certificate management. Get the CACert from
// the installation spec.
certificateManagement = installation.CertificateManagement
certificatePEM = certificateManagement.CACert
certificateManagementEnabled = true
}
}

if !certificateManagementEnabled {
// Using operator-managed certificates. Check to see if we have already provisioned a CA.
cm.log.V(2).Info("Looking for an existing CA", "secret", fmt.Sprintf("%s/%s", ns, caSecretName))
caSecret := &corev1.Secret{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ var _ = Describe("ManagementClusterConnection controller tests", func() {
Spec: operatorv1.ImageSetSpec{
Images: []operatorv1.Image{
{Image: "tigera/guardian", Digest: "sha256:guardianhash"},
{Image: "tigera/key-cert-provisioner", Digest: "sha256:deadbeef0123456789"},
},
},
})).ToNot(HaveOccurred())
Expand Down
1 change: 1 addition & 0 deletions pkg/controller/compliance/compliance_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ var _ = Describe("Compliance controller tests", func() {
{Image: "tigera/compliance-reporter", Digest: "sha256:reporterhash"},
{Image: "tigera/compliance-server", Digest: "sha256:serverhash"},
{Image: "tigera/compliance-snapshotter", Digest: "sha256:snapshotterhash"},
{Image: "tigera/key-cert-provisioner", Digest: "sha256:deadbeef0123456789"},
},
},
})).ToNot(HaveOccurred())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ var _ = Describe("IntrusionDetection controller tests", func() {
{Image: "tigera/intrusion-detection-controller", Digest: "sha256:intrusiondetectioncontrollerhash"},
{Image: "tigera/deep-packet-inspection", Digest: "sha256:deeppacketinspectionhash"},
{Image: "tigera/webhooks-processor", Digest: "sha256:webhooksprocessorhash"},
{Image: "tigera/key-cert-provisioner", Digest: "sha256:deadbeef0123456789"},
},
},
})).ToNot(HaveOccurred())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ var _ = Describe("LogCollector controller tests", func() {
Images: []operatorv1.Image{
{Image: "tigera/fluentd", Digest: "sha256:fluentdhash"},
{Image: "tigera/fluentd-windows", Digest: "sha256:fluentdwindowshash"},
{Image: "tigera/key-cert-provisioner", Digest: "sha256:deadbeef0123456789"},
},
},
})).ToNot(HaveOccurred())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,7 @@ var _ = Describe("LogStorage controller", func() {
{Image: "tigera/elasticsearch-metrics", Digest: "sha256:esmetricshash"},
{Image: "tigera/es-gateway", Digest: "sha256:esgatewayhash"},
{Image: "tigera/linseed", Digest: "sha256:linseedhash"},
{Image: "tigera/key-cert-provisioner", Digest: "sha256:deadbeef0123456789"},
},
},
})).ToNot(HaveOccurred())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ var _ = Describe("LogStorage ES kube-controllers controller", func() {
{Image: "tigera/elasticsearch-metrics", Digest: "sha256:esmetricshash"},
{Image: "tigera/es-gateway", Digest: "sha256:esgatewayhash"},
{Image: "tigera/linseed", Digest: "sha256:linseedhash"},
{Image: "tigera/key-cert-provisioner", Digest: "sha256:deadbeef0123456789"},
},
},
})).ToNot(HaveOccurred())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ var _ = Describe("LogStorage Linseed controller", func() {
{Image: "tigera/elasticsearch-metrics", Digest: "sha256:esmetricshash"},
{Image: "tigera/es-gateway", Digest: "sha256:esgatewayhash"},
{Image: "tigera/linseed", Digest: "sha256:linseedhash"},
{Image: "tigera/key-cert-provisioner", Digest: "sha256:deadbeef0123456789"},
},
},
})).ToNot(HaveOccurred())
Expand Down Expand Up @@ -432,6 +433,7 @@ var _ = Describe("LogStorage Linseed controller", func() {
{Image: "tigera/elasticsearch-metrics", Digest: "sha256:esmetricshash"},
{Image: "tigera/es-gateway", Digest: "sha256:esgatewayhash"},
{Image: "tigera/linseed", Digest: "sha256:linseedhash"},
{Image: "tigera/key-cert-provisioner", Digest: "sha256:deadbeef0123456789"},
},
},
})).ToNot(HaveOccurred())
Expand Down
1 change: 1 addition & 0 deletions pkg/controller/manager/manager_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ var _ = Describe("Manager controller tests", func() {
{Image: "tigera/cnx-manager", Digest: "sha256:cnxmanagerhash"},
{Image: "tigera/es-proxy", Digest: "sha256:esproxyhash"},
{Image: "tigera/voltron", Digest: "sha256:voltronhash"},
{Image: "tigera/key-cert-provisioner", Digest: "sha256:deadbeef0123456789"},
},
},
})).ToNot(HaveOccurred())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ var _ = Describe("PolicyRecommendation controller tests", func() {
Spec: operatorv1.ImageSetSpec{
Images: []operatorv1.Image{
{Image: "tigera/policy-recommendation", Digest: "sha256:policyrecommendationcontrollerhash"},
{Image: "tigera/key-cert-provisioner", Digest: "sha256:deadbeef0123456789"},
},
},
})).ToNot(HaveOccurred())
Expand Down