Black lives matter.

We stand in solidarity with the Black community.

Racism is unacceptable.

It conflicts with the core values of the Kubernetes project and our community does not tolerate it.

Adding a new Config Type

To scaffold out a new config Kind, we can use kubebuilder create api.

kubebuilder create api --group config --version v2 --kind ProjectConfig --resource --controller=false --make=false

This will create a new type file in apis/config/v2/ for the ProjectConfig kind. We’ll need to change this file to embed the v1alpha1.ControllerManagerConfigurationSpec

Apache License

Copyright 2020 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

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.

We start out simply enough: we import the config/v1alpha1 API group, which is exposed through ControllerRuntime.

package v2

import (
	metav1 ""
	cfg ""

// +kubebuilder:object:root=true

Next, we’ll remove the default ProjectConfigSpec and ProjectConfigList then we’ll embed cfg.ControllerManagerConfigurationSpec in ProjectConfig.

// ProjectConfig is the Schema for the projectconfigs API
type ProjectConfig struct {
	metav1.TypeMeta `json:",inline"`

	// ControllerManagerConfigurationSpec returns the contfigurations for controllers
	cfg.ControllerManagerConfigurationSpec `json:",inline"`

	ClusterName string `json:"clusterName,omitempty"`

If you haven’t, you’ll also need to remove the ProjectConfigList from the SchemeBuilder.Register.

func init() {

Lastly, we’ll change the main.go to reference this type for parsing the file.