Skip to content

Commit

Permalink
[release-1.12] Add localhost registry to the set avoiding tag resolut…
Browse files Browse the repository at this point in the history
…ion as a workaround for #467 (#469)

* Add localhost registry to the set avoiding tag resolution as a workaround for #467

* Update comment per suggestion by rhuss@

---------

Co-authored-by: Evan Anderson <[email protected]>
  • Loading branch information
knative-prow-robot and evankanderson authored Nov 14, 2023
1 parent 7e8cda6 commit c74640b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
13 changes: 11 additions & 2 deletions pkg/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ spec:
fmt.Println(" Kourier service installed...")

domainDns := exec.Command("kubectl", "patch", "configmap", "-n", "knative-serving", "config-domain", "-p", "{\"data\": {\"127.0.0.1.sslip.io\": \"\"}}")
if err := domainDns.Run(); err != nil {
if err := runCommand(domainDns); err != nil {
return fmt.Errorf("domain dns: %w", err)
}
fmt.Println(" Domain DNS set up...")
Expand All @@ -109,7 +109,7 @@ func KourierMinikube() error {
}

// Serving installs Knative Serving from Github YAML files
func Serving() error {
func Serving(registries string) error {
fmt.Println("🍿 Installing Knative Serving v" + ServingVersion + " ...")
baseURL := "https://github.com/knative/serving/releases/download/knative-v" + ServingVersion

Expand All @@ -132,6 +132,15 @@ func Serving() error {

fmt.Println(" Core installed...")

if registries != "" {
configPatch := fmt.Sprintf(`{"data":{"registries-skipping-tag-resolving":"%s"}}`, registries)
ignoreRegistry := exec.Command("kubectl", "patch", "configmap", "-n", "knative-serving", "config-deployment", "-p", configPatch)
if err := runCommand(ignoreRegistry); err != nil {
return fmt.Errorf("tag resolving configuration: %w", err)
}
fmt.Println(" Enabled local registry deployment...")
}

fmt.Println(" Finished installing Knative Serving")

return nil
Expand Down
9 changes: 8 additions & 1 deletion pkg/kind/kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,14 @@ func SetUp(name, kVersion string, installServing, installEventing, installKindRe
}
if installKnative {
if installServing {
if err := install.Serving(); err != nil {
// Disable tag resolution for localhost registry, since there's no
// way to redirect Knative Serving to use the kind-registry name.
// See https://github.com/knative-extensions/kn-plugin-quickstart/issues/467
registries := ""
if installKindRegistry {
registries = fmt.Sprintf("localhost:%s", container_reg_port)
}
if err := install.Serving(registries); err != nil {
return fmt.Errorf("install serving: %w", err)
}
if err := install.Kourier(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/minikube.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func SetUp(name, kVersion string, installServing, installEventing bool) error {
fmt.Scanln()
if installKnative {
if installServing {
if err := install.Serving(); err != nil {
if err := install.Serving(""); err != nil {
return fmt.Errorf("install serving: %w", err)
}
if err := install.Kourier(); err != nil {
Expand Down

0 comments on commit c74640b

Please sign in to comment.