Skip to content

Commit

Permalink
chore: migrate todos (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek authored May 28, 2024
1 parent 3fe8af0 commit 5d2fa24
Show file tree
Hide file tree
Showing 26 changed files with 41 additions and 46 deletions.
1 change: 0 additions & 1 deletion controller/controlplane/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
}

log.Trace(logger, "validating ControlPlane configuration", cp)
// TODO: complete validation here: https://github.com/Kong/gateway-operator/issues/109
if err := validateControlPlane(cp, r.DevelopmentMode); err != nil {
return ctrl.Result{}, err
}
Expand Down
4 changes: 2 additions & 2 deletions controller/dataplane/bluegreen_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (r *BlueGreenReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
}

// TODO: Perform promotion condition checks to verify we can proceed
// Ref: https://github.com/Kong/gateway-operator/issues/974
// Ref: https://github.com/Kong/gateway-operator/issues/170

if proceedWithPromotion, err := canProceedWithPromotion(dataplane); err != nil {
return ctrl.Result{}, fmt.Errorf("failed checking if DataPlane %s/%s can be promoted: %w", dataplane.Namespace, dataplane.Name, err)
Expand Down Expand Up @@ -502,7 +502,7 @@ func (r *BlueGreenReconciler) ensureDeploymentForDataPlane(
})
}
// TODO: implemented DeleteOnPromotionRecreateOnRollout
// Ref: https://github.com/Kong/gateway-operator/issues/1010
// Ref: https://github.com/Kong/gateway-operator/issues/163
}
deploymentLabels := client.MatchingLabels{
consts.DataPlaneDeploymentStateLabel: consts.DataPlaneStateLabelValuePreview,
Expand Down
2 changes: 1 addition & 1 deletion controller/dataplane/bluegreen_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func init() {
// test writers will be able to rely on the reconciler running against an apiserver
// and just asserting on the actual desired effect.
//
// Ref: https://github.com/Kong/gateway-operator/issues/933
// Ref: https://github.com/Kong/gateway-operator/issues/172
func TestDataPlaneBlueGreenReconciler_Reconcile(t *testing.T) {
ca := helpers.CreateCA(t)
mtlsSecret := &corev1.Secret{
Expand Down
2 changes: 1 addition & 1 deletion controller/dataplane/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func init() {
// test writers will be able to rely on the reconciler running against an apiserver
// and just asserting on the actual desired effect.
//
// Ref: https://github.com/Kong/gateway-operator/issues/933
// Ref: https://github.com/Kong/gateway-operator/issues/172
func TestDataPlaneReconciler_Reconcile(t *testing.T) {
ca := helpers.CreateCA(t)
mtlsSecret := &corev1.Secret{
Expand Down
4 changes: 2 additions & 2 deletions controller/dataplane/controller_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

func generateDataPlaneImage(dataplane *operatorv1beta1.DataPlane, defaultImage string, validators ...versions.VersionValidationOption) (string, error) {
if dataplane.Spec.DataPlaneOptions.Deployment.PodTemplateSpec == nil {
return defaultImage, nil // TODO: https://github.com/Kong/gateway-operator/issues/20
return defaultImage, nil // TODO: https://github.com/Kong/gateway-operator-archive/issues/20
}

container := k8sutils.GetPodContainerByName(&dataplane.Spec.DataPlaneOptions.Deployment.PodTemplateSpec.Spec, consts.DataPlaneProxyContainerName)
Expand All @@ -49,7 +49,7 @@ func generateDataPlaneImage(dataplane *operatorv1beta1.DataPlane, defaultImage s
return relatedKongImage, nil
}

return defaultImage, nil // TODO: https://github.com/Kong/gateway-operator/issues/20
return defaultImage, nil // TODO: https://github.com/Kong/gateway-operator-archive/issues/20
}

// -----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion controller/dataplane/owned_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (d *DeploymentBuilder) BuildAndDeploy(
return nil, op.Noop, fmt.Errorf("after generation callbacks failed")
}

// TODO https://github.com/Kong/gateway-operator/issues/1495
// TODO https://github.com/Kong/gateway-operator/issues/128
// This is a a workaround to avoid patches clobbering the wrong EnvVar. We want to find an improved patch mechanism
// that doesn't clobber EnvVars (and other array fields) it shouldn't.
existingEnvVars := desiredDeployment.Spec.Template.Spec.Containers[0].Env
Expand Down
2 changes: 1 addition & 1 deletion controller/dataplane/owned_finalizer_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (r *DataPlaneOwnedResourceFinalizerReconciler[T, PT]) SetupWithManager(mgr
labels := obj.GetLabels()
managedByDataPlane := labels[consts.GatewayOperatorManagedByLabel] == consts.DataPlaneManagedLabelValue
// TODO: Remove using this label after several versions with the new
// managed-by label were released: https://github.com/Kong/gateway-operator/issues/1101
// managed-by label were released: https://github.com/Kong/gateway-operator/issues/156
managedByDataPlaneLegacyLabel := labels[consts.GatewayOperatorManagedByLabelLegacy] == consts.DataPlaneManagedLabelValue
return managedByDataPlane || managedByDataPlaneLegacyLabel
}
Expand Down
4 changes: 2 additions & 2 deletions controller/dataplane/owned_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func ensureAdminServiceForDataPlane(
additionalServiceLabels client.MatchingLabels,
opts ...k8sresources.ServiceOpt,
) (res op.CreatedUpdatedOrNoop, svc *corev1.Service, err error) {
// TODO: https://github.com/Kong/gateway-operator/pull/1101.
// TODO: https://github.com/Kong/gateway-operator/issues/156.
// Use only new labels after several minor version of soak time.

// Below we list both the Services with the new labels and the legacy labels
Expand Down Expand Up @@ -253,7 +253,7 @@ func ensureIngressServiceForDataPlane(
additionalServiceLabels client.MatchingLabels,
opts ...k8sresources.ServiceOpt,
) (op.CreatedUpdatedOrNoop, *corev1.Service, error) {
// TODO: https://github.com/Kong/gateway-operator/pull/1101.
// TODO: https://github.com/Kong/gateway-operator/issues/156.
// Use only new labels after several minor version of soak time.

// Below we list both the Services with the new labels and the legacy labels
Expand Down
7 changes: 2 additions & 5 deletions controller/pkg/address/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,8 @@ func AddressesFromService(service *corev1.Service) ([]operatorv1beta1.Address, e
)

for _, ingress := range service.Status.LoadBalancer.Ingress {
// TODO Since currently we don't support Gateway listeners spec:
// https://github.com/Kong/gateway-operator/issues/482, we don't take into
// account Ingress.Ports.
// When #482 gets implemented we should take those into account and format
// the addresses accordingly.
// TODO https://github.com/Kong/gateway-operator-archive/issues/482 is now resolved.
// We should take ingress.Ports into account and format the addresses accordingly.

if ingress.IP != "" {
ip, err := netip.ParseAddr(ingress.IP)
Expand Down
2 changes: 1 addition & 1 deletion controller/pkg/controlplane/controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func GenerateImage(opts *operatorv1beta1.ControlPlaneOptions, validators ...vers
return relatedKongControllerImage, nil
}

return consts.DefaultControlPlaneImage, nil // TODO: https://github.com/Kong/gateway-operator/issues/20
return consts.DefaultControlPlaneImage, nil // TODO: https://github.com/Kong/gateway-operator-archive/issues/20
}

// -----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion controller/pkg/secrets/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func EnsureCertificate[
) (op.CreatedUpdatedOrNoop, *corev1.Secret, error) {
setCALogger(ctrlruntimelog.Log)

// TODO: https://github.com/Kong/gateway-operator/pull/1101.
// TODO: https://github.com/Kong/gateway-operator-archive/pull/156.
// Use only new labels after several minor version of soak time.

// Below we list both the Secrets with the new labels and the legacy labels
Expand Down
4 changes: 2 additions & 2 deletions controller/specialized/aigateway_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (r *AIGatewayReconciler) SetupWithManager(mgr ctrl.Manager) error {
).
// TODO watch on Gateways, KongPlugins, e.t.c.
//
// See: https://github.com/Kong/gateway-operator/issues/1368
// See: https://github.com/Kong/gateway-operator/issues/137
Complete(r)
}

Expand Down Expand Up @@ -120,7 +120,7 @@ func (r *AIGatewayReconciler) Reconcile(ctx context.Context, req ctrl.Request) (

// TODO: manage status updates
//
// See: https://github.com/Kong/gateway-operator/issues/1368
// See: https://github.com/Kong/gateway-operator/issues/137

log.Info(logger, "reconciliation complete for aigateway resource", aigateway)
return ctrl.Result{}, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (r *AIGatewayReconciler) createOrUpdateHttpRoute(

// TODO - use GenerateName
//
// See: https://github.com/Kong/gateway-operator/issues/1368
// See: https://github.com/Kong/gateway-operator/issues/137
found := &gatewayv1.HTTPRoute{}
err := r.Client.Get(ctx, types.NamespacedName{
Name: httpRoute.Name,
Expand All @@ -45,7 +45,7 @@ func (r *AIGatewayReconciler) createOrUpdateHttpRoute(

// TODO - implement patching
//
// See: https://github.com/Kong/gateway-operator/issues/1368
// See: https://github.com/Kong/gateway-operator/issues/137

return false, nil
}
Expand All @@ -60,7 +60,7 @@ func (r *AIGatewayReconciler) createOrUpdatePlugin(

// TODO - use GenerateName
//
// See: https://github.com/Kong/gateway-operator/issues/1368
// See: https://github.com/Kong/gateway-operator/issues/137
found := &configurationv1.KongPlugin{}
err := r.Client.Get(ctx, types.NamespacedName{
Name: kongPlugin.Name,
Expand All @@ -76,7 +76,7 @@ func (r *AIGatewayReconciler) createOrUpdatePlugin(

// TODO - implement patching
//
// See: https://github.com/Kong/gateway-operator/issues/1368
// See: https://github.com/Kong/gateway-operator/issues/137

return false, nil
}
Expand All @@ -92,7 +92,7 @@ func (r *AIGatewayReconciler) createOrUpdateGateway(

// TODO - use GenerateName
//
// See: https://github.com/Kong/gateway-operator/issues/1368
// See: https://github.com/Kong/gateway-operator/issues/137
err := r.Client.Get(ctx, types.NamespacedName{
Name: gateway.Name,
Namespace: gateway.Namespace,
Expand All @@ -108,7 +108,7 @@ func (r *AIGatewayReconciler) createOrUpdateGateway(

// TODO - implement patching
//
// See: https://github.com/Kong/gateway-operator/issues/1368
// See: https://github.com/Kong/gateway-operator/issues/137

return false, nil
}
Expand All @@ -123,7 +123,7 @@ func (r *AIGatewayReconciler) createOrUpdateSvc(

// TODO - use GenerateName
//
// See: https://github.com/Kong/gateway-operator/issues/1368
// See: https://github.com/Kong/gateway-operator/issues/137
found := &corev1.Service{}
err := r.Client.Get(ctx, types.NamespacedName{
Name: service.Name,
Expand All @@ -140,7 +140,7 @@ func (r *AIGatewayReconciler) createOrUpdateSvc(

// TODO - implement patching
//
// See: https://github.com/Kong/gateway-operator/issues/1368
// See: https://github.com/Kong/gateway-operator/issues/137

return false, nil
}
Expand Down
1 change: 0 additions & 1 deletion internal/utils/dataplane/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ var KongDefaults = map[string]string{
"KONG_PROXY_LISTEN": fmt.Sprintf("0.0.0.0:%d reuseport backlog=16384, 0.0.0.0:%d http2 ssl reuseport backlog=16384", consts.DataPlaneProxyPort, consts.DataPlaneProxySSLPort),
"KONG_STATUS_LISTEN": fmt.Sprintf("0.0.0.0:%d", consts.DataPlaneStatusPort),

// TODO: reconfigure following https://github.com/Kong/gateway-operator/issues/7
"KONG_ADMIN_LISTEN": fmt.Sprintf("0.0.0.0:%d ssl reuseport backlog=16384", consts.DataPlaneAdminAPIPort),

// MTLS
Expand Down
2 changes: 1 addition & 1 deletion internal/versions/controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

const (
// DefaultControlPlaneVersion is the default version of the ControlPlane to use.
// TODO: automatic PR updates https://github.com/Kong/gateway-operator/issues/210
// TODO: automatically update this via renovate https://github.com/Kong/gateway-operator/issues/121
//
// NOTE: This needs to be a full semver version (i.e. it needs to include
// the minor and the patch version). The reason for this is that it's used in the
Expand Down
2 changes: 1 addition & 1 deletion modules/manager/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ func (m *caManager) Start(ctx context.Context) error {
}

func (m *caManager) maybeCreateCACertificate(ctx context.Context) error {
// TODO https://github.com/Kong/gateway-operator/issues/108 this also needs to check if the CA is expired and
// TODO https://github.com/Kong/gateway-operator/issues/199 this also needs to check if the CA is expired and
// managed, and needs to reissue it (and all issued certificates) if so
ca := &corev1.Secret{}
ctx, cancel := context.WithTimeout(ctx, time.Second*30)
Expand Down
2 changes: 1 addition & 1 deletion pkg/consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const (
// Notice: use GatewayOperatorManagedByLabel instead.
//
// TODO: Remove adding this to managed resources after several versions with
// the new managed-by label were released: https://github.com/Kong/gateway-operator/issues/1101
// the new managed-by label were released: https://github.com/Kong/gateway-operator/issues/156
GatewayOperatorManagedByLabelLegacy = "konghq.com/gateway-operator"

// GatewayManagedLabelValue indicates that the object's lifecycle is managed by
Expand Down
2 changes: 1 addition & 1 deletion pkg/consts/controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ const (
ControlPlaneAdmissionWebhookVolumeMountPath = "/admission-webhook"
)

// TODO: https://github.com/Kong/gateway-operator/issues/1331
// TODO: https://github.com/Kong/gateway-operator/issues/141
// Extract as constants all the Env var Keys used to configure the ControlPlane.
2 changes: 1 addition & 1 deletion pkg/consts/dataplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const (
// DefaultDataPlaneTag is the base container image tag that can be used
// by default for a DataPlane resource if all other attempts to dynamically
// decide an image tag fail.
DefaultDataPlaneTag = "3.6" // TODO: automatic PR updates https://github.com/Kong/gateway-operator/issues/209
DefaultDataPlaneTag = "3.6" // TODO: automatically update this via renovate https://github.com/Kong/gateway-operator/issues/121

// DefaultDataPlaneImage is the default container image that can be used if
// all other attempts to dynamically decide the default image fail.
Expand Down
6 changes: 3 additions & 3 deletions pkg/utils/kubernetes/resources/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func LabelObjectAsDataPlaneManaged(obj metav1.Object) {
}
labels[consts.GatewayOperatorManagedByLabel] = consts.DataPlaneManagedLabelValue
// TODO: Remove adding this to managed resources after several versions with
// the new managed-by label were released: https://github.com/Kong/gateway-operator/issues/1101
// the new managed-by label were released: https://github.com/Kong/gateway-operator/issues/156
labels[consts.GatewayOperatorManagedByLabelLegacy] = consts.DataPlaneManagedLabelValue
obj.SetLabels(labels)
}
Expand All @@ -38,7 +38,7 @@ func LabelObjectAsControlPlaneManaged(obj metav1.Object) {
}
labels[consts.GatewayOperatorManagedByLabel] = consts.ControlPlaneManagedLabelValue
// TODO: Remove adding this to managed resources after several versions with
// the new managed-by label were released: https://github.com/Kong/gateway-operator/issues/1101
// the new managed-by label were released: https://github.com/Kong/gateway-operator/issues/156
labels[consts.GatewayOperatorManagedByLabelLegacy] = consts.ControlPlaneManagedLabelValue
obj.SetLabels(labels)
}
Expand All @@ -62,7 +62,7 @@ func GetManagedLabelForOwner(owner metav1.Object) client.MatchingLabels {
// provided owner.
//
// Deprecated: use getManagedLabelForOwner instead.
// Removed when https://github.com/Kong/gateway-operator/issues/1101 is closed.
// Removed when https://github.com/Kong/gateway-operator/issues/156 is closed.
func GetManagedLabelForOwnerLegacy(owner metav1.Object) client.MatchingLabels {
switch owner.(type) {
case *operatorv1beta1.ControlPlane:
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/kubernetes/resources/strategicmerge.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func SetDefaultsVolume(v *corev1.Volume) {
// This is the only default volume that we include for both ControlPlanes
// and DataPlanes so we're good for now.
//
// TODO: https://github.com/Kong/gateway-operator/issues/1226
// TODO: https://github.com/Kong/gateway-operator/issues/150
if v.Name != consts.ClusterCertificateVolume && v.Name != consts.ControlPlaneAdmissionWebhookVolumeName {
pkgapiscorev1.SetDefaults_Volume(v)
if v.HostPath != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/kubernetes/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func HasSameVolumeSource(baseVolumeSource, comparedVolumeSource *corev1.VolumeSo

// if they are both non-nil, compare the actual content.
// TODO: compare ALL supported volume sources in k8s API:
// https://github.com/Kong/gateway-operator/issues/703
// https://github.com/Kong/gateway-operator/issues/183

// compare for secret volumes.
if baseVolumeSource.Secret != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/vars/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
var (
// _controllerName is a unique identifier which indicates this operator's name.
// This value may be overwritten by ENV vars or via the manager.
_controllerName = DefaultControllerName // TODO: multi-tenancy: https://github.com/Kong/gateway-operator/issues/35
_controllerName = DefaultControllerName // TODO: multi-tenancy: https://github.com/Kong/gateway-operator-archive/issues/35
_controllerNameLock sync.RWMutex
)

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/test_operator_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ var (
)

func TestOperatorLogs(t *testing.T) {
t.Skip() // TODO: https://github.com/kong/gateway-operator/issues/908
t.Skip() // TODO: https://github.com/kong/gateway-operator-archive/issues/908

ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Expand Down
6 changes: 3 additions & 3 deletions test/integration/test_aigateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func TestAIGatewayCreation(t *testing.T) {
Data: map[string][]byte{
// TODO get real credentials from a vault...
//
// See: https://github.com/Kong/gateway-operator/issues/1368
// See: https://github.com/Kong/gateway-operator-archive/issues/137
"openai": []byte("openai-key"),
"cohere": []byte("cohere-key"),
},
Expand Down Expand Up @@ -221,12 +221,12 @@ func TestAIGatewayCreation(t *testing.T) {
// test hit the real cloud provider, we test manually for now after
// at least verifying that all the resources are in place.
//
// See: https://github.com/Kong/gateway-operator/issues/1368
// See: https://github.com/Kong/gateway-operator/issues/137
}

// This is temporary while we work on statuses for AIGateways.
//
// See: https://github.com/Kong/gateway-operator/issues/1368
// See: https://github.com/Kong/gateway-operator/issues/137
func eventuallyDetermineGatewayForAIGateway(
t *testing.T,
aigateway *v1alpha1.AIGateway,
Expand Down
4 changes: 2 additions & 2 deletions test/integration/test_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -761,8 +761,8 @@ func TestGatewayDataPlaneNetworkPolicy(t *testing.T) {
require.Contains(t, networkPolicy.Spec.Ingress, expectAllowMetricsIngress.Rule)

t.Run("verifying DataPlane's NetworkPolicies get updated after customizing kong proxy listen port through GatewayConfiguration", func(t *testing.T) {
// TODO: https://github.com/Kong/gateway-operator/issues/695
t.Skip("re-enable once https://github.com/Kong/gateway-operator/issues/695 is fixed")
// TODO: https://github.com/Kong/gateway-operator/issues/184
t.Skip("re-enable once https://github.com/Kong/gateway-operator/issues/184 is fixed")

gwcClient := GetClients().OperatorClient.ApisV1beta1().GatewayConfigurations(namespace.Name)

Expand Down

0 comments on commit 5d2fa24

Please sign in to comment.