Skip to content
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
6 changes: 3 additions & 3 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ jobs:
-a run_id=${{ github.run_id }} \
-a run_attempt=${{ github.run_attempt }}

- name: Publish and sign example-backend image
- name: Publish and sign backend image
env:
KO_DOCKER_REPO: ghcr.io/${{ github.repository_owner }}/example-backend
KO_DOCKER_REPO: ghcr.io/${{ github.repository_owner }}/backend
COSIGN_EXPERIMENTAL: 'true'
run: |
echo "${{ github.token }}" | ko login ghcr.io --username "${{ github.actor }}" --password-stdin
img=$(ko build --bare --platform=all -t latest -t ${{ github.sha }} -t ${{github.ref_name}} ./cmd/example-backend)
img=$(ko build --bare --platform=all -t latest -t ${{ github.sha }} -t ${{github.ref_name}} ./cmd/backend)
echo "built ${img}"
cosign sign ${img} \
--yes \
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -384,20 +384,20 @@ image-local:
-t $(REV) \
./cmd/konnector

@echo "Building example-backend image locally..."
@echo "Building backend image locally..."
KO_DOCKER_REPO=$(KO_DOCKER_REPO) ko build \
--local \
-B \
-t $(REV) \
./cmd/example-backend
./cmd/backend

@echo "Successfully built local images with tag $(REV)"

.PHONY: kind-load
kind-load:
@echo "Loading images into kind cluster '$(KIND_CLUSTER)'"
kind load docker-image $(KO_DOCKER_REPO)/konnector:$(REV) --name $(KIND_CLUSTER)
kind load docker-image $(KO_DOCKER_REPO)/example-backend:$(REV) --name $(KIND_CLUSTER)
kind load docker-image $(KO_DOCKER_REPO)/backend:$(REV) --name $(KIND_CLUSTER)
Comment thread
mjudeikis marked this conversation as resolved.
@echo "Successfully loaded images into kind cluster '$(KIND_CLUSTER)'"

include Makefile.venv
7 changes: 5 additions & 2 deletions backend/http/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,17 @@ func (h *handler) handleServiceExport(w http.ResponseWriter, r *http.Request) {
logger.Error(err, "failed to parse version %q", componentbaseversion.Get().GitVersion)
ver = "v0.0.0"
}

prettyName := h.providerPrettyName
if prettyName == "" {
prettyName = "backend"
}
provider := &kubebindv1alpha2.BindingProvider{
TypeMeta: metav1.TypeMeta{
APIVersion: kubebindv1alpha2.GroupVersion,
Kind: "BindingProvider",
},
Version: ver,
ProviderPrettyName: "example-backend",
ProviderPrettyName: prettyName,
AuthenticationMethods: []kubebindv1alpha2.AuthenticationMethod{
Comment on lines 155 to 157

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Do not hard-code ProviderPrettyName; honor the configured flag.

This ignores NewHandler’s providerPrettyName (and the CLI flag like --pretty-name), reducing configurability.

Apply this to use the configured value with a sane default:

@@
-   provider := &kubebindv1alpha2.BindingProvider{
+   // prefer configured pretty name; default to "backend"
+   prettyName := h.providerPrettyName
+   if prettyName == "" {
+     prettyName = "backend"
+   }
+   provider := &kubebindv1alpha2.BindingProvider{
@@
-     ProviderPrettyName: "backend",
+     ProviderPrettyName: prettyName,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Version: ver,
ProviderPrettyName: "example-backend",
ProviderPrettyName: "backend",
AuthenticationMethods: []kubebindv1alpha2.AuthenticationMethod{
// prefer configured pretty name; default to "backend"
prettyName := h.providerPrettyName
if prettyName == "" {
prettyName = "backend"
}
provider := &kubebindv1alpha2.BindingProvider{
Version: ver,
ProviderPrettyName: prettyName,
AuthenticationMethods: []kubebindv1alpha2.AuthenticationMethod{
// …
},
}
🤖 Prompt for AI Agents
In backend/http/handler.go around lines 152-154, the ProviderPrettyName is
hard-coded to "backend"; replace that literal with the configured
providerPrettyName value from the handler (or the NewHandler parameter) and fall
back to a sensible default if empty (e.g., use the existing Provider or ver
value). Ensure the struct uses something like ProviderPrettyName:
h.providerPrettyName (or providerPrettyName) with a conditional default when
constructing the object so the CLI flag --pretty-name is honored.

{
Method: "OAuth2CodeGrant",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,31 @@ kube-bind has 3 go modules, and a unique tag is needed for each module every tim

```shell
REF=upstream/main
TAG=v0.5.0
TAG=v0.5.0-rc2
git tag --sign --message "$TAG" "$TAG" "$REF"
```

3. Tag the `sdk` module, following the same logic as above for `REF` and `TAG`

```shell
REF=upstream/main
TAG=v0.5.0
TAG=v0.5.0-rc2
git tag --sign --message "sdk/$TAG" "sdk/$TAG" "$REF"
```

4. Tag the `cli` module, following the same logic as above for `REF` and `TAG`

```shell
REF=upstream/main
TAG=v0.5.0
TAG=v0.5.0-rc2
git tag --sign --message "cli/$TAG" "cli/$TAG" "$REF"
```

### Push the Tags

```shell
REMOTE=upstream
TAG=v0.5.0
TAG=v0.5.0-rc2
git push "$REMOTE" "$TAG" "sdk/$TAG" "cli/$TAG"
```

Expand Down
6 changes: 3 additions & 3 deletions docs/content/setup/local-setup-with-kind.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This guide will walk you through setting up kube-bind between two Kubernetes clusters, where

* **Backend cluster**:
* Deploys dex, cert-manager and kube-bind/example-backend
* Deploys dex, cert-manager and kube-bind/backend
* Provides kube-bind compatible backend for MangoDB resources
* **App cluster**:
* Provides an application consuming MangoDBs
Expand Down Expand Up @@ -161,9 +161,9 @@ kubectl create clusterrolebinding backend-admin --clusterrole cluster-admin --se
# Create a new Deployment for the MangoDB backend.
kubectl --namespace backend \
create deployment mangodb \
--image ghcr.io/kube-bind/example-backend:v0.4.6 \
--image ghcr.io/kube-bind/backend:v0.5.0 \
--port 8080 \
-- /ko-app/example-backend \
-- /ko-app/backend \
--listen-address 0.0.0.0:8080 \
--external-address "${BACKEND_KUBE_API_EXTERNAL_ADDRESS}" \
--oidc-issuer-client-secret=ZXhhbXBsZS1hcHAtc2VjcmV0 \
Expand Down
4 changes: 2 additions & 2 deletions hack/kind-example-setup/backend-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set -o errexit
set -o nounset
set -o pipefail

DEFAULT_EXAMPLE_BACKEND_IMAGE="ghcr.io/kube-bind/example-backend:v0.4.6"
DEFAULT_EXAMPLE_BACKEND_IMAGE="ghcr.io/kube-bind/backend:v0.5.0"

if [[ -z "${HOST_IP:-}" ]]; then
source "$(dirname "$0")/host-ip.sh"
Expand Down Expand Up @@ -130,7 +130,7 @@ kubectl --namespace backend \
create deployment mangodb \
--image ${example_backend_image} \
--port 8080 \
-- /ko-app/example-backend \
-- /ko-app/backend \
--listen-address 0.0.0.0:8080 \
--external-address "${BACKEND_KUBE_API_EXTERNAL_ADDRESS}" \
--oidc-issuer-client-secret=ZXhhbXBsZS1hcHAtc2VjcmV0 \
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/framework/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func StartBackendWithoutDefaultArgs(t *testing.T, clientConfig *rest.Config, arg
)
require.NoError(t, err)

fs := pflag.NewFlagSet("example-backend", pflag.ContinueOnError)
fs := pflag.NewFlagSet("backend", pflag.ContinueOnError)
opts := options.NewOptions()
opts.AddFlags(fs)
err = fs.Parse(args)
Expand Down