profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/DirectXMan12/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Solly Ross DirectXMan12 Google metamagical.dev @kubernetes developer, open-source enthusiast, programming language fanatic, all-around geek, Googler. She/They.

DirectXMan12/cs545_final_proj 5

Fall 2011 CS545 (Digital Image Processing) Final Project

DirectXMan12/datanozzle 3

Python client for datagrepper

DirectXMan12/AdvancedComputerNetworksProjects 1

The projects of Solly Ross and Matt Ferreira for WPI's Advanced Computer Networks course

DirectXMan12/cert-manager 1

Automatically provision and manage TLS certificates in Kubernetes

DirectXMan12/CS4432_Projects 1

Additions and customizations made to SimpleDB (not the Amazon one) by CS4432 Group 12 in C12

DirectXMan12/DynamicQuery 1

A Java library which attempts to reproduce ActiveRecord/Arel coding style in Java (with javac hackery and more)

DirectXMan12/apiserver-builder 0

The apiserver-framework implements libraries and tools to quickly and easily build Kubernetes apiservers to support custom resource types

pull request commentkubernetes-sigs/controller-runtime

:sparkles: Expose function to find controller namespace in controllerutil

@randomvariable: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-controller-runtime-test-master ef64d07d22e3f9592d57baef4c6eeb554c00d5a6 link /test pull-controller-runtime-test-master

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. </details> <!-- test report -->

randomvariable

comment created time in an hour

Pull request review commentkubernetes-sigs/controller-runtime

:sparkles: Expose function to find controller namespace in controllerutil

 type Options struct { 	// election resource will be created. 	LeaderElectionNamespace string +	// LeaderElectionUncachedNamespaceLookup if set to true will do an uncached read of the+	// in-cluster namespace+	LeaderElectionUncachedNamespaceLookup bool

Yeah, I agree. First of all was trying to fix the test, so added the uncached, but then after doing that, there's no reason to do the cached lookup for leader election where it's not going to be called very often unlike consumers within reconciliation loops. Deleting.

randomvariable

comment created time in an hour

Pull request review commentkubernetes-sigs/controller-runtime

:sparkles: Expose function to find controller namespace in controllerutil

 type Options struct { 	// election resource will be created. 	LeaderElectionNamespace string +	// LeaderElectionUncachedNamespaceLookup if set to true will do an uncached read of the+	// in-cluster namespace+	LeaderElectionUncachedNamespaceLookup bool

Hmm I'm not sure if this is worth surfacing as an option. It is kinda confusing as well (why cache this namespace in the first place? why do I care?). Is it really that hard to call options.LeaderElectionNamespace = ReadInClusterNamespaceCached() or options.LeaderElectionNamespace = ReadInClusterNamespace() depending on what mode you want when setting up Options, with a default to ReadInClusterNamespace()?

randomvariable

comment created time in 2 hours

Pull request review commentkubernetes-sigs/controller-runtime

:sparkles: Expose function to find controller namespace in controllerutil

 import ( 	"sigs.k8s.io/controller-runtime/pkg/client/apiutil" ) +var (+	// Will store memoized controller namespace+	inClusterNamespace     string+	inClusterNamespacePath = "/var/run/secrets/kubernetes.io/serviceaccount/namespace"+	// ErrNotRunningInCluster is the error for when the controller is not running in cluster+	ErrNotRunningInCluster = &NotRunningInClusterError{}+	// ErrNamespaceReadError is the error when the controller cannot read its namespace+	ErrNamespaceReadError = &NamespaceReadError{}+)++// ReadInClusterNamespace returns the namespace by which the controller is running under.+// read from "/var/run/secrets/kubernetes.io/serviceaccount/namespace".+func ReadInClusterNamespace() (string, error) {+	data, err := os.ReadFile(inClusterNamespacePath)+	if errors.Is(err, os.ErrNotExist) {+		return "", &NotRunningInClusterError{cause: err}+	} else if err != nil {+		return "", &NamespaceReadError{cause: err}+	}++	return string(data), nil+}++// ReadInClusterNamespaceCached returns the namespace by which the controller is running under.+// read from "/var/run/secrets/kubernetes.io/serviceaccount/namespace".+// Note that the resolved namespace is cached after it is successfully read from disk.+func ReadInClusterNamespaceCached() (string, error) {+	if inClusterNamespace != "" {+		return inClusterNamespace, nil+	}+	ns, err := ReadInClusterNamespace()+	if err != nil {+		return "", err+	}++	// memoize result for next call+	inClusterNamespace := ns

I should probably retire at this stage :)

randomvariable

comment created time in 2 hours

Pull request review commentkubernetes-sigs/controller-runtime

:sparkles: Expose function to find controller namespace in controllerutil

 import ( 	"sigs.k8s.io/controller-runtime/pkg/client/apiutil" ) +var (+	// Will store memoized controller namespace+	inClusterNamespace     string+	inClusterNamespacePath = "/var/run/secrets/kubernetes.io/serviceaccount/namespace"+	// ErrNotRunningInCluster is the error for when the controller is not running in cluster+	ErrNotRunningInCluster = &NotRunningInClusterError{}+	// ErrNamespaceReadError is the error when the controller cannot read its namespace+	ErrNamespaceReadError = &NamespaceReadError{}+)++// ReadInClusterNamespace returns the namespace by which the controller is running under.+// read from "/var/run/secrets/kubernetes.io/serviceaccount/namespace".+func ReadInClusterNamespace() (string, error) {+	data, err := os.ReadFile(inClusterNamespacePath)+	if errors.Is(err, os.ErrNotExist) {+		return "", &NotRunningInClusterError{cause: err}+	} else if err != nil {+		return "", &NamespaceReadError{cause: err}+	}++	return string(data), nil+}++// ReadInClusterNamespaceCached returns the namespace by which the controller is running under.+// read from "/var/run/secrets/kubernetes.io/serviceaccount/namespace".+// Note that the resolved namespace is cached after it is successfully read from disk.+func ReadInClusterNamespaceCached() (string, error) {+	if inClusterNamespace != "" {+		return inClusterNamespace, nil+	}+	ns, err := ReadInClusterNamespace()+	if err != nil {+		return "", err+	}++	// memoize result for next call+	inClusterNamespace := ns

This still isn't storing ns globally, it's redefining inClusterNamespace in the local scope

	inClusterNamespace = ns
randomvariable

comment created time in 2 hours

Pull request review commentkubernetes-sigs/controller-runtime

:sparkles: Expose function to find controller namespace in controllerutil

 import ( 	"sigs.k8s.io/controller-runtime/pkg/client/apiutil" ) +var (+	// Will store memoized controller namespace+	inClusterNamespace     string+	inClusterNamespacePath = "/var/run/secrets/kubernetes.io/serviceaccount/namespace"+	// ErrNotRunningInCluster is the error for when the controller is not running in cluster+	ErrNotRunningInCluster = &NotRunningInClusterError{}+	// ErrNamespaceReadError is the error when the controller cannot read its namespace+	ErrNamespaceReadError = &NamespaceReadError{}+)++// ReadInClusterNamespace returns the namespace by which the controller is running under.+// read from "/var/run/secrets/kubernetes.io/serviceaccount/namespace".+func ReadInClusterNamespace() (string, error) {+	data, err := os.ReadFile(inClusterNamespacePath)+	if errors.Is(err, os.ErrNotExist) {+		return "", &NotRunningInClusterError{cause: err}+	} else if err != nil {+		return "", &NamespaceReadError{cause: err}+	}++	return string(data), nil+}++// ReadInClusterNamespaceCached returns the namespace by which the controller is running under.+// read from "/var/run/secrets/kubernetes.io/serviceaccount/namespace".+// Note that the resolved namespace is cached after it is successfully read from disk.+func ReadInClusterNamespaceCached() (string, error) {+	if inClusterNamespace != "" {+		return inClusterNamespace, nil+	}+	ns, err := ReadInClusterNamespace()+	if err != nil {+		return "", err+	}++	// memoize result for next call+	inClusterNamespacePath := ns+	return inClusterNamespacePath, nil

Argh.

randomvariable

comment created time in 2 hours

pull request commentkubernetes-sigs/controller-runtime

✨ Cleanup Webhook server setup

@aayushrangwala: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-controller-runtime-test-master 090a9cf6ca21cdd3bd40f96f4493065cf2627510 link /test pull-controller-runtime-test-master

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. </details> <!-- test report -->

aayushrangwala

comment created time in 3 hours

pull request commentkubernetes-sigs/controller-runtime

⚠️ fix the leader election precedence over config file

@aayushrangwala: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-controller-runtime-apidiff-master e194da5fdead151cfccc911ac21a0a1ba4433d5c link /test pull-controller-runtime-apidiff-master
pull-controller-runtime-test-master e194da5fdead151cfccc911ac21a0a1ba4433d5c link /test pull-controller-runtime-test-master

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. </details> <!-- test report -->

aayushrangwala

comment created time in 3 hours

pull request commentkubernetes-sigs/controller-runtime

✨ Cleanup Webhook server setup

/test pull-controller-runtime-test-master

aayushrangwala

comment created time in 4 hours

pull request commentkubernetes-sigs/controller-runtime

⚠️ fix the leader election precedence over config file

/test pull-controller-runtime-test-master

aayushrangwala

comment created time in 4 hours

Pull request review commentkubernetes-sigs/kubebuilder

✨ Extend files whitelist for init cmd

 func checkDir() error { 			if strings.HasPrefix(info.Name(), ".") { 				return nil 			}+			// Allow files ending with '.md' extension+			if strings.HasSuffix(info.Name(), ".md") && !info.IsDir() {+				return nil+			}+			// Allow capitalized files except PROJECT+			isCapitalized := true+			for _, l := range info.Name() {+				if !unicode.IsUpper(l) {+					isCapitalized = false+					break+				}+			}+			if isCapitalized && info.Name() != "PROJECT" {

Yeah I was pretty sure it did.

w3st3ry

comment created time in 8 hours

pull request commentkubernetes-sigs/controller-runtime

🐛 metadata client applies patch options

It is unrelated to this PR though, isn't it?

PatchStatus doesn't apply patch options it receives in the same way so I wanted to fix it too.. I opened the issue #1514

furkhat

comment created time in 10 hours

issue openedkubernetes-sigs/controller-runtime

No use for metadata_client.PatchStatus

Metadata client's PatchStatus receives client.Object that must be of *metav1.PartialObjectMetadata type which seems useless because PartialObjectMetadata doesn't have fields that describe status.

Here

https://github.com/kubernetes-sigs/controller-runtime/blob/v0.8.3/pkg/client/metadata_client.go#{L169:L172} - exits with error if type isn't *metav1.PartialObjectMetadata
https://github.com/kubernetes-sigs/controller-runtime/blob/v0.8.3/pkg/client/client.go#L259-L260 - calls metadata_client.PatchStatus only if type is *metav1.PartialObjectMetadata

created time in 10 hours

pull request commentkubernetes-sigs/controller-runtime

⚠️ fix the leader election precedence over config file

@aayushrangwala: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-controller-runtime-apidiff-master e194da5fdead151cfccc911ac21a0a1ba4433d5c link /test pull-controller-runtime-apidiff-master
pull-controller-runtime-test-master e194da5fdead151cfccc911ac21a0a1ba4433d5c link /test pull-controller-runtime-test-master

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. </details> <!-- test report -->

aayushrangwala

comment created time in 15 hours

pull request commentkubernetes-sigs/controller-runtime

⚠️ fix the leader election precedence over config file

@aayushrangwala: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-controller-runtime-test-master a7cd860741607c66dc09f20cfe50988db7795714 link /test pull-controller-runtime-test-master
pull-controller-runtime-apidiff-master e194da5fdead151cfccc911ac21a0a1ba4433d5c link /test pull-controller-runtime-apidiff-master

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. </details> <!-- test report -->

aayushrangwala

comment created time in 15 hours

Pull request review commentkubernetes-sigs/controller-runtime

⚠️ fix the leader election precedence over config file

 func createRestConfig(gvk schema.GroupVersionKind, isUnstructured bool, baseConf  	return cfg }++// BoolPointerFlagFunc returns a function to be associated with the custom bool flag func+//+// Example:+//+// var fooPtr *bool+// flag.Func("foo", "foo usage", apiutil.BoolPointerFlagFunc(fooPtr))+func BoolPointerFlagFunc(ptr *bool) func(flagVal string) error {+	return func(flagVal string) error {

I think instead of returning nil, we should assign nil to the bool pointer. Which would imply that

  • If the user gave the flag but with empty value, it will be considered as flag not passed
  • If the user gave the flag but with some invalid value, it will be error
  • If the user gave the flag but with some valid value, it will be handled properly
aayushrangwala

comment created time in 16 hours

pull request commentkubernetes-sigs/controller-runtime

🌱 adding TokenReview.auth.k8s.io/v1 webhook support

@alvaroaleman this should be all updated.

christopherhein

comment created time in 17 hours

Pull request review commentkubernetes-sigs/controller-runtime

🌱 adding TokenReview.auth.k8s.io/v1 webhook support

+/*+Copyright 2021 The Kubernetes Authors.++Licensed under the Apache License, Version 2.0 (the "License");+you may not use this file except in compliance with the License.+You may obtain a copy of the License at++   http://www.apache.org/licenses/LICENSE-2.0++Unless required by applicable law or agreed to in writing, software+distributed under the License is distributed on an "AS IS" BASIS,+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+See the License for the specific language governing permissions and+limitations under the License.+*/++package authentication++import (+	"encoding/json"+	"errors"+	"fmt"+	"io"+	"io/ioutil"+	"net/http"++	v1 "k8s.io/api/authentication/v1"+	"k8s.io/api/authentication/v1beta1"+	"k8s.io/apimachinery/pkg/runtime"+	"k8s.io/apimachinery/pkg/runtime/schema"+	"k8s.io/apimachinery/pkg/runtime/serializer"+	utilruntime "k8s.io/apimachinery/pkg/util/runtime"+)++var authenticationScheme = runtime.NewScheme()+var authenticationCodecs = serializer.NewCodecFactory(authenticationScheme)++func init() {+	utilruntime.Must(v1.AddToScheme(authenticationScheme))+	utilruntime.Must(v1beta1.AddToScheme(authenticationScheme))+}++var _ http.Handler = &Webhook{}++func (wh *Webhook) ServeHTTP(w http.ResponseWriter, r *http.Request) {+	var body []byte+	var err error+	ctx := r.Context()+	if wh.WithContextFunc != nil {+		ctx = wh.WithContextFunc(ctx, r)+	}++	var reviewResponse Response+	if r.Body != nil {+		if body, err = ioutil.ReadAll(r.Body); err != nil {+			wh.log.Error(err, "unable to read the body from the incoming request")+			reviewResponse = Errored(err)+			wh.writeResponse(w, reviewResponse)+			return+		}+	} else {+		err = errors.New("request body is empty")

I've switched around the way this is handled, the first check r.Body == nil now checks if it's a request that doesn't support a body, like a Get and fails out then we go on to reading the body.

christopherhein

comment created time in 17 hours

Pull request review commentkubernetes-sigs/controller-runtime

🌱 adding TokenReview.auth.k8s.io/v1 webhook support

+/*+Copyright 2021 The Kubernetes Authors.++Licensed under the Apache License, Version 2.0 (the "License");+you may not use this file except in compliance with the License.+You may obtain a copy of the License at++   http://www.apache.org/licenses/LICENSE-2.0++Unless required by applicable law or agreed to in writing, software+distributed under the License is distributed on an "AS IS" BASIS,+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+See the License for the specific language governing permissions and+limitations under the License.+*/++package authentication++import (+	"encoding/json"+	"errors"+	"fmt"+	"io"+	"io/ioutil"+	"net/http"++	v1 "k8s.io/api/authentication/v1"+	"k8s.io/api/authentication/v1beta1"+	"k8s.io/apimachinery/pkg/runtime"+	"k8s.io/apimachinery/pkg/runtime/schema"+	"k8s.io/apimachinery/pkg/runtime/serializer"+	utilruntime "k8s.io/apimachinery/pkg/util/runtime"+)++var authenticationScheme = runtime.NewScheme()+var authenticationCodecs = serializer.NewCodecFactory(authenticationScheme)++func init() {+	utilruntime.Must(v1.AddToScheme(authenticationScheme))+	utilruntime.Must(v1beta1.AddToScheme(authenticationScheme))+}++var _ http.Handler = &Webhook{}++func (wh *Webhook) ServeHTTP(w http.ResponseWriter, r *http.Request) {+	var body []byte+	var err error+	ctx := r.Context()+	if wh.WithContextFunc != nil {+		ctx = wh.WithContextFunc(ctx, r)+	}++	var reviewResponse Response+	if r.Body != nil {+		if body, err = ioutil.ReadAll(r.Body); err != nil {+			wh.log.Error(err, "unable to read the body from the incoming request")+			reviewResponse = Errored(err)+			wh.writeResponse(w, reviewResponse)+			return+		}+	} else {+		err = errors.New("request body is empty")+		wh.log.Error(err, "bad request")+		reviewResponse = Errored(err)+		wh.writeResponse(w, reviewResponse)+		return+	}++	// verify the content type is accurate+	contentType := r.Header.Get("Content-Type")

So I guess that isn't what happens, the decoder doesn't seem to check what the actual headers are. If you don't have this check and the body is valid the request could be successful or could fail other places.

christopherhein

comment created time in 17 hours

pull request commentkubernetes-sigs/controller-runtime

📖 : add faq section on 3rd party APIs in envtest

(I am sorry if this is not the right place for my objection)

In the current discussions about this topic (operator-sdk, kubebuilder and here) there are basically two promoted solutions (at least as a workaround until better support):

  1. Downloading the external CRDs
  2. Referring to a go module containing the external CRDs

1.) has potential downsides as already mentioned, while 2.) introduces the problem of having a statically defined path floating around, which needs to be updated manually if dependencies in the project change. 2.) can also lead to unexpected errors if multiple versions are available in the go module cache and someone forgets to update the tests to refer to the new version of external CRDs.

As external CRDs should usually be a dependency of the project anyway (as testdata or within the controller), could it be possible to promote using go modules in the regular way and dynamically add the CRDs to envtest using the go.mod file?

E.g. adding OCP CRDs programmatically could look (very) roughly like this:

func getOCPCRDs() []string {
	const ocpModule = "github.com/openshift/api"
	modFilePath := filepath.Join("..", "..", "go.mod")

	goModBytes, err := ioutil.ReadFile(modFilePath)
	Expect(err).NotTo(HaveOccurred())

	file, err := modfile.Parse(modFilePath, goModBytes, nil)
	Expect(err).NotTo(HaveOccurred())

	ocpVersion := ""
	for _, r := range file.Require {
		if r.Mod.Path == ocpModule {
			ocpVersion = r.Mod.Version
		}
	}
	Expect(ocpVersion).ToNot(BeEmpty())

	basePath := filepath.Join(
		build.Default.GOPATH,
		"pkg",
		"mod",
		ocpModule+"@"+ocpVersion,
	)

	netNamespaceCRDPath := filepath.Join(
		basePath,
		"network",
		"v1",
		"003-netnamespace-crd.yaml",
	)

	networkConfigCRDPath := filepath.Join(
		basePath,
		"config",
		"v1",
		"0000_10_config-operator_01_network.crd.yaml",
	)

	return []string{
		netNamespaceCRDPath,
		networkConfigCRDPath,
	}
}
...
By("extracting relevant OpenShift API CRDs")
ocpCRDs := getOCPCRDs()

By("bootstrapping test environment")
testEnv = &envtest.Environment{
    ErrorIfCRDPathMissing: true,
        CRDDirectoryPaths: []string{
	   filepath.Join("..", "..", "config", "crd", "bases"),
	},
}
testEnv.CRDDirectoryPaths = append(testEnv.CRDDirectoryPaths, ocpCRDs...)

This is obviously not at all perfect, but at least removes the need to update the static go module path in the tests with every little dependency update in the overall project.

varshaprasad96

comment created time in 20 hours

push eventkubernetes-sigs/controller-runtime

Solly Ross

commit sha 066b7bbf119c9c72e13a1229be0ef3bb68332be0

Quote path with -p env The path could have spaces, single quotes, etc in in, so this quotes the path and escapes single quotes so we can export properly.

view details

Kubernetes Prow Robot

commit sha 55a329c15d6b4f91a9ff072fed6f6f05ff3339e7

Merge pull request #1513 from DirectXMan12/bug/quote-envtest-tool-path :bug: Quote path with -p env in envtest-setup

view details

push time in 21 hours

PR merged kubernetes-sigs/controller-runtime

Reviewers
:bug: Quote path with -p env in envtest-setup approved cncf-cla: yes lgtm size/L

The path could have spaces, single quotes, etc in in, so this quotes the path and escapes single quotes so we can export properly.

This is very relevant on darwin, where our default store path contains spaces (it includes "Application Support")

+132 -1

4 comments

3 changed files

DirectXMan12

pr closed time in 21 hours

Pull request review commentkubernetes-sigs/controller-runtime

:bug: Quote path with -p env in envtest-setup

 func (e *Env) PrintInfo(printFmt PrintFormat) { 	case PrintPath: 		fmt.Fprint(e.Out, path) // NB(directxman12): no newline -- want the bare path here 	case PrintEnv:-		fmt.Fprintf(e.Out, "export KUBEBUILDER_ASSETS=%s\n", path)+		// quote in case there are spaces, etc in the path+		// the weird string below works like this:+		// - you can't escape quotes in shell+		// - shell strings that are next to each other are concatenated (so "a""b""c" == "abc")+		// - you can intermix quote styles using the above+		// - so `'"'"'` --> CLOSE_QUOTE + "'" + OPEN_QUOTE+		shellQuoted := strings.ReplaceAll(path, "'", `'"'"'`)

So the result is supposed to look something like the following?

$ export FOO='/foo/'"'"'Application Support'"'"''
$ echo $FOO
/foo/'Application Support'
DirectXMan12

comment created time in 21 hours

pull request commentkubernetes-sigs/controller-runtime

:bug: Quote path with -p env in envtest-setup

@DirectXMan12: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-controller-runtime-test-master 066b7bbf119c9c72e13a1229be0ef3bb68332be0 link /test pull-controller-runtime-test-master

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. </details> <!-- test report -->

DirectXMan12

comment created time in 21 hours

issue commentkubernetes-sigs/controller-runtime

envtest: no matches for kind "Infrastructure" in version "config.openshift.io/v1"

@avrahams There is none for Routes. All OCP related CRDs are potentially to be found in the API repo, but a lot of "older" OCP resources are not published that way. Recently had contact with some Red Hat people about that and my information so far is, there is no really immediate plan to change that.

There is a manual way though. One has to create a 'fake' CRD within the correct OCP API repository path and adapt the make targets.

E.g. for Routes, a CRD file route_crd.yaml with the following content has to be created in the path https://github.com/openshift/api/tree/master/route/v1:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  # name must match the spec fields below, and be in the form: <plural>.<group>
  name: routes.route.openshift.io
spec:
  # group name to use for REST API: /apis/<group>/<version>
  group: route.openshift.io
  # list of versions supported by this CustomResourceDefinition
  versions:
    - name: v1
      # Each version can be enabled/disabled by Served flag.
      served: true
      # One and only one version must be marked as the storage version.
      storage: true
  # either Namespaced or Cluster
  scope: Namespaced
  subresources:
    # enable spec/status
    status: {}
  names:
    # plural name to be used in the URL: /apis/<group>/<version>/<plural>
    plural: routes
    # singular name to be used as an alias on the CLI and for display
    singular: route
    # kind is normally the CamelCased singular type. Your resource manifests use this.
    kind: Route

Then the Makefile has to get this line:

$(call add-crd-gen,route,./route/v1,./route/v1,./route/v1)

Updating the CRDs with

make update-codegen-crds

populates the CRD stub with the correct OpenAPI validation content.

Unfortunately it seems to only works this way, as the API repo infrastructure already expects the basic CRD to be there (I am sure one can workaround that somehow).

It works for other resources as well, but it is obviously not a very practical solution. So this is just a documentation comment for people experiencing similar problems with OCP related resources.

Just as a warning: In some of my tests I experienced validation errors populating envtest with these CRDs, but I did not investigate it further.

gee4vee

comment created time in a day

issue commentkubernetes-sigs/controller-runtime

Add logging to the creation of a health-check probe

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale

asilverman

comment created time in a day

pull request commentkubernetes-sigs/controller-runtime

:bug: Quote path with -p env in envtest-setup

@DirectXMan12: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-controller-runtime-test-master 066b7bbf119c9c72e13a1229be0ef3bb68332be0 link /test pull-controller-runtime-test-master

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. </details> <!-- test report -->

DirectXMan12

comment created time in a day

pull request commentkubernetes-sigs/controller-runtime

:bug: Quote path with -p env in envtest-setup

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: <a href="https://github.com/kubernetes-sigs/controller-runtime/pull/1513#" title="Author self-approved">DirectXMan12</a>, <a href="https://github.com/kubernetes-sigs/controller-runtime/pull/1513#pullrequestreview-652793105" title="Approved">vincepri</a>

The full list of commands accepted by this bot can be found here.

The pull request process is described here

<details > Needs approval from an approver in each of these files:

  • OWNERS [DirectXMan12,vincepri]

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment </details> <!-- META={"approvers":[]} -->

DirectXMan12

comment created time in a day

pull request commentkubernetes-sigs/controller-runtime

:bug: Quote path with -p env in envtest-setup

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: <a href="https://github.com/kubernetes-sigs/controller-runtime/pull/1513#" title="Author self-approved">DirectXMan12</a>

The full list of commands accepted by this bot can be found here.

The pull request process is described here

<details > Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment </details> <!-- META={"approvers":[]} -->

DirectXMan12

comment created time in a day