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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/ingress-operator
/pkg/manifests/manifests

tmp/
_output/
Expand Down
24 changes: 12 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ GO_BUILD_RECIPE=CGO_ENABLED=1 $(GO) build -o $(BIN) $(GO_GCFLAGS) $(MAIN_PACKAGE
TEST ?= TestAll

.PHONY: build
build:
build: generate
$(GO_BUILD_RECIPE)

.PHONY: buildconfig
Expand All @@ -28,48 +28,48 @@ cluster-build:

# TODO: Add deepcopy generation script/target
.PHONY: generate
generate: update

.PHONY: bindata
bindata:
hack/update-generated-bindata.sh
generate: manifests

.PHONY: update
update: crd bindata
update: crd

# Generate CRDs from vendored and internal API specs.
.PHONY: crd
crd:
hack/update-generated-crd.sh
hack/update-profile-manifests.sh

.PHONY: manifests
manifests:
go generate ./pkg/manifests

.PHONY: test
test:
test: generate
CGO_ENABLED=1 $(GO) test ./...

.PHONY: release-local
release-local:
MANIFESTS=$(shell mktemp -d) hack/release-local.sh

.PHONY: test-e2e
test-e2e:
test-e2e: generate
CGO_ENABLED=1 $(GO) test -timeout 1h -count 1 -v -tags e2e -run "$(TEST)" ./test/e2e

.PHONY: test-e2e-list
test-e2e-list:
test-e2e-list: generate
@(cd ./test/e2e; E2E_TEST_MAIN_SKIP_SETUP=1 $(GO) test -list . -tags e2e | grep ^Test | sort)

.PHONY: clean
clean:
$(GO) clean
rm -f $(BIN)
rm -rf pkg/manifests/manifests

.PHONY: verify
verify:
verify: generate
hack/verify-gofmt.sh
hack/verify-generated-crd.sh
hack/verify-profile-manifests.sh
hack/verify-generated-bindata.sh
hack/verify-deps.sh
hack/verify-e2e-test-all-presence.sh

Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ require (
github.com/go-logr/zapr v1.2.4
github.com/google/go-cmp v0.5.9
github.com/jongio/azidext/go/azidext v0.4.0
github.com/kevinburke/go-bindata v3.11.0+incompatible
github.com/maistra/istio-operator v0.0.0-20230322122339-793794762e67
github.com/openshift/api v3.9.1-0.20190924102528-32369d4db2ad+incompatible
github.com/openshift/client-go v0.0.0-20230120202327-72f107311084
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -783,8 +783,6 @@ github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.1.0/go.m
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4=
github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA=
github.com/kevinburke/go-bindata v3.11.0+incompatible h1:RcC+GJNmrBHbGaOpQ9MBD8z22rdzlIm0esDRDkyxd4s=
github.com/kevinburke/go-bindata v3.11.0+incompatible/go.mod h1:/pEEZ72flUW2p0yi30bslSp9YqD9pysLxunQDdb2CPM=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
Expand Down
10 changes: 0 additions & 10 deletions hack/update-generated-bindata.sh

This file was deleted.

17 changes: 0 additions & 17 deletions hack/verify-generated-bindata.sh

This file was deleted.

File renamed without changes.
File renamed without changes.
1,173 changes: 0 additions & 1,173 deletions pkg/manifests/bindata.go

This file was deleted.

38 changes: 37 additions & 1 deletion pkg/manifests/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package manifests

import (
"bytes"
"embed"
"encoding/base64"
"fmt"
"io"
Expand Down Expand Up @@ -74,10 +75,45 @@ const (
// ClusterIngressConfigName is the name of the cluster Ingress Config
ClusterIngressConfigName = "cluster"

NamespaceManifest = "manifests/00-namespace.yaml"
// NamespaceManifest is the asset for the operator namespace manifest.
// This manifest is usually installed by CVO, but it is also used by the
// "ingress-operator render" command to write out manifests that are
// required in order to customize ingress at installation time, before
// CVO installs the manifests.
NamespaceManifest = "manifests/00-namespace.yaml"
// CustomResourceDefinitionManifest is the asset for the
// ingresscontrollers CRD. This manifest is usually installed by CVO,
// but it is also used by the "ingress-operator render" command to write
// out manifests that are required in order to customize ingress at
// installation time, before CVO installs the manifests.
CustomResourceDefinitionManifest = "manifests/00-custom-resource-definition.yaml"
)

// Copy needed files from the manifests/ directory. This is necessary in order
// to embed these files here because manifests/ is a top-level directory in the
// source tree, and go:embed does not allow paths containing "../".
//
//go:generate mkdir -p manifests
//go:generate cp ../../manifests/00-namespace.yaml manifests/
//go:generate cp ../../manifests/00-custom-resource-definition.yaml manifests/
Comment on lines +97 to +98
Copy link
Contributor

Choose a reason for hiding this comment

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

A couple of questions. Why are these two files the only ones needed from the manifests/ directory? And why not permanently move them to assets/ instead of creating a temporary directory?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A couple of questions. Why are these two files the only ones needed from the manifests/ directory?

They are the only two files that the ingress-operator render command uses:

files := []string{
manifests.CustomResourceDefinitionManifest,
manifests.NamespaceManifest,
}

#309 added the ingress-operator render command for the installer to use in openshift/installer#2523 for configuring ingresscontrollers at installation time.

And why not permanently move them to assets/ instead of creating a temporary directory?

Then they wouldn't be in the right place for CVO to read them. The manifests still need to be installed by CVO if the cluster admin doesn't configure them with the installer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then they wouldn't be in the right place for CVO to read them. The manifests still need to be installed by CVO if the cluster admin doesn't configure them with the installer.

Seems like a worthwhile comment to add so that somebody doesn't move things in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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


//go:embed assets manifests
var content embed.FS

// MustAsset returns the bytes for the named asset.
func MustAsset(asset string) []byte {
Copy link
Contributor

Choose a reason for hiding this comment

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

MustAsset was called in MustAssetReader in the past. Where is the original definition?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

b, err := content.ReadFile(asset)
if err != nil {
panic(err)
}
return b
}

// MustAssetString returns a string with the named asset.
func MustAssetString(asset string) string {
return string(MustAsset(asset))
}

func MustAssetReader(asset string) io.Reader {
return bytes.NewReader(MustAsset(asset))
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/manifests/manifests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,7 @@ func TestManifests(t *testing.T) {
GatewayCRD()
HTTPRouteCRD()
ReferenceGrantCRD()

MustAsset(CustomResourceDefinitionManifest)
MustAsset(NamespaceManifest)
}
11 changes: 0 additions & 11 deletions tools/tools.go

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading