Skip to content
Closed
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 @@ -12,12 +12,17 @@ data:
chainingMode: portmap
exclusive: false
hubble:
enabled: true
tls:
auto:
enabled: true # enable automatic TLS certificate generation
method: cronJob # auto generate certificates using cronJob method
certValidityDuration: 60 # certificates validity duration in days (default 2 months)
schedule: "0 0 1 * *" # schedule on the 1st day regeneration of each month
relay:
enabled: true
image:
useDigest: false
ipam:
mode: kubernetes
image:
Expand Down
2 changes: 2 additions & 0 deletions hack/addons/kustomize/cilium/helm-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ cni:
exclusive: false
hubble:
enabled: false
relay:
enabled: false
ipam:
mode: kubernetes
image:
Expand Down
3 changes: 2 additions & 1 deletion pkg/handlers/generic/lifecycle/ccm/aws/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/go-logr/logr"
"github.com/spf13/pflag"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
ctrlclient "sigs.k8s.io/controller-runtime/pkg/client"
Expand All @@ -23,7 +24,7 @@ import (
const (
awsCCMPrefix = "aws-ccm-"

defaultHelmReleaseNamespace = "kube-system"
defaultHelmReleaseNamespace = metav1.NamespaceSystem
defaultHelmReleaseName = "aws-cloud-controller-manager"
)

Expand Down
3 changes: 2 additions & 1 deletion pkg/handlers/generic/lifecycle/ccm/nutanix/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/go-logr/logr"
"github.com/spf13/pflag"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
ctrlclient "sigs.k8s.io/controller-runtime/pkg/client"

Expand All @@ -25,7 +26,7 @@ import (

const (
defaultHelmReleaseName = "nutanix-ccm"
defaultHelmReleaseNamespace = "kube-system"
defaultHelmReleaseNamespace = metav1.NamespaceSystem

// This is the name of the Secret on the remote cluster that should match what is defined in Helm values.
//nolint:gosec // Does not contain hard coded credentials.
Expand Down
3 changes: 2 additions & 1 deletion pkg/handlers/generic/lifecycle/cni/cilium/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"

"github.com/spf13/pflag"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1"
Expand All @@ -32,7 +33,7 @@ type CNIConfig struct {

const (
defaultCiliumReleaseName = "cilium"
defaultCiliumNamespace = "kube-system"
defaultCiliumNamespace = metav1.NamespaceSystem
)

type helmAddonConfig struct {
Expand Down
3 changes: 2 additions & 1 deletion pkg/handlers/generic/lifecycle/csi/awsebs/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/go-logr/logr"
"github.com/spf13/pflag"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
ctrlclient "sigs.k8s.io/controller-runtime/pkg/client"
Expand All @@ -22,7 +23,7 @@ import (

const (
defaultHelmReleaseName = "aws-ebs-csi-driver"
defaultHelmReleaseNamespace = "kube-system"
defaultHelmReleaseNamespace = metav1.NamespaceSystem
)

var DefaultStorageClassParameters = map[string]string{
Expand Down
3 changes: 2 additions & 1 deletion pkg/handlers/generic/lifecycle/csi/localpath/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/go-logr/logr"
"github.com/spf13/pflag"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
ctrlclient "sigs.k8s.io/controller-runtime/pkg/client"
Expand All @@ -22,7 +23,7 @@ import (

const (
defaultHelmReleaseName = "local-path-provisioner-csi"
defaultHelmReleaseNamespace = "kube-system"
defaultHelmReleaseNamespace = metav1.NamespaceSystem
)

type Config struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"

"github.com/spf13/pflag"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1"
Expand All @@ -25,7 +26,7 @@ import (

const (
defaultHelmReleaseName = "snapshot-controller"
defaultHelmReleaseNamespace = "kube-system"
defaultHelmReleaseNamespace = metav1.NamespaceSystem
)

type Config struct {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/clusterautoscaler_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func WaitForClusterAutoscalerToBeReadyForWorkloadCluster(

statusConfigMap := &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Namespace: "kube-system",
Namespace: metav1.NamespaceSystem,
Name: "cluster-autoscaler-status",
},
}
Expand Down
35 changes: 24 additions & 11 deletions test/e2e/cni_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,13 @@ func waitForCiliumToBeReadyInWorkloadCluster(
ctx context.Context,
input waitForCiliumToBeReadyInWorkloadClusterInput, //nolint:gocritic // This hugeParam is OK in tests.
) {
expectedDeployments := []*appsv1.Deployment{{
ObjectMeta: metav1.ObjectMeta{
Name: "cilium-operator",
Namespace: metav1.NamespaceSystem,
},
}}

switch input.strategy {
case v1alpha1.AddonStrategyClusterResourceSet:
crs := &addonsv1.ClusterResourceSet{}
Expand Down Expand Up @@ -236,6 +243,15 @@ func waitForCiliumToBeReadyInWorkloadCluster(
},
input.helmReleaseIntervals...,
)

// Hubble relay is also deployed as part of the Cilium Helm chart when deplying via
// CAAPH.
expectedDeployments = append(expectedDeployments, &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: "hubble-relay",
Namespace: metav1.NamespaceSystem,
},
})
default:
Fail(
fmt.Sprintf(
Expand All @@ -249,23 +265,20 @@ func waitForCiliumToBeReadyInWorkloadCluster(
ctx, input.workloadCluster.Namespace, input.workloadCluster.Name,
).GetClient()

WaitForDeploymentsAvailable(ctx, framework.WaitForDeploymentsAvailableInput{
Getter: workloadClusterClient,
Deployment: &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: "cilium-operator",
Namespace: "kube-system",
},
},
}, input.deploymentIntervals...)

WaitForDaemonSetsAvailable(ctx, WaitForDaemonSetsAvailableInput{
Getter: workloadClusterClient,
DaemonSet: &appsv1.DaemonSet{
ObjectMeta: metav1.ObjectMeta{
Name: "cilium",
Namespace: "kube-system",
Namespace: metav1.NamespaceSystem,
},
},
}, input.daemonSetIntervals...)

for _, deployment := range expectedDeployments {
WaitForDeploymentsAvailable(ctx, framework.WaitForDeploymentsAvailableInput{
Getter: workloadClusterClient,
Deployment: deployment,
}, input.deploymentIntervals...)
}
}
9 changes: 5 additions & 4 deletions test/e2e/framework/self_hosted.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/klog/v2"
"k8s.io/utils/ptr"
Expand Down Expand Up @@ -286,12 +287,12 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput)
Consistently(func() error {
kubeSystem := &corev1.Namespace{}
return input.BootstrapClusterProxy.GetClient().
Get(ctx, client.ObjectKey{Name: "kube-system"}, kubeSystem)
Get(ctx, client.ObjectKey{Name: metav1.NamespaceSystem}, kubeSystem)
}, "5s", "100ms").Should(BeNil(), "Failed to assert bootstrap API server stability")
Consistently(func() error {
kubeSystem := &corev1.Namespace{}
return selfHostedClusterProxy.GetClient().
Get(ctx, client.ObjectKey{Name: "kube-system"}, kubeSystem)
Get(ctx, client.ObjectKey{Name: metav1.NamespaceSystem}, kubeSystem)
}, "5s", "100ms").Should(BeNil(), "Failed to assert self-hosted API server stability")

By("Moving the cluster to self hosted")
Expand Down Expand Up @@ -343,12 +344,12 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput)
Consistently(func() error {
kubeSystem := &corev1.Namespace{}
return input.BootstrapClusterProxy.GetClient().
Get(ctx, client.ObjectKey{Name: "kube-system"}, kubeSystem)
Get(ctx, client.ObjectKey{Name: metav1.NamespaceSystem}, kubeSystem)
}, "5s", "100ms").Should(BeNil(), "Failed to assert bootstrap API server stability")
Consistently(func() error {
kubeSystem := &corev1.Namespace{}
return selfHostedClusterProxy.GetClient().
Get(ctx, client.ObjectKey{Name: "kube-system"}, kubeSystem)
Get(ctx, client.ObjectKey{Name: metav1.NamespaceSystem}, kubeSystem)
}, "5s", "100ms").Should(BeNil(), "Failed to assert self-hosted API server stability")

By("Moving the cluster back to bootstrap")
Expand Down
Loading