Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Remove Bundle API and its controller #774

Merged
merged 7 commits into from
Jan 16, 2024
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
11 changes: 0 additions & 11 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,6 @@ builds:
- arm64
- ppc64le
- s390x
- id: rukpakctl
varshaprasad96 marked this conversation as resolved.
Show resolved Hide resolved
main: ./cmd/rukpakctl
binary: rukpakctl
tags: "{{.Env.GO_BUILD_TAGS}}"
goos:
- linux
goarch:
- amd64
- arm64
- ppc64le
- s390x
dockers:
- image_templates:
- "{{ .Env.IMAGE_REPO }}:{{ .Env.IMAGE_TAG }}-amd64"
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ COPY core core
COPY unpack unpack
COPY webhooks webhooks
COPY crdvalidator crdvalidator
COPY rukpakctl rukpakctl

EXPOSE 8080
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,12 @@ generate: $(CONTROLLER_GEN) ## Generate code and manifests
$(Q)$(CONTROLLER_GEN) webhook paths=./api/... paths=./internal/webhook/... output:stdout > ./manifests/base/apis/webhooks/resources/webhook.yaml
$(Q)$(CONTROLLER_GEN) object:headerFile=./hack/boilerplate.go.txt paths=./api/...
$(Q)$(CONTROLLER_GEN) rbac:roleName=core-admin \
paths=./internal/controllers/bundle/... \
paths=./internal/controllers/bundledeployment/... \
paths=./internal/provisioner/plain/... \
paths=./internal/provisioner/registry/... \
paths=./internal/uploadmgr/... \
output:stdout > ./manifests/base/core/resources/cluster_role.yaml
$(Q)$(CONTROLLER_GEN) rbac:roleName=webhooks-admin paths=./internal/webhook/... output:stdout > ./manifests/base/apis/webhooks/resources/cluster_role.yaml
$(Q)$(CONTROLLER_GEN) rbac:roleName=helm-provisioner-admin \
paths=./internal/controllers/bundle/... \
paths=./internal/controllers/bundledeployment/... \
paths=./internal/provisioner/helm/... \
output:stdout > ./manifests/base/provisioners/helm/resources/cluster_role.yaml
Expand Down Expand Up @@ -113,7 +110,7 @@ test-e2e: $(GINKGO) ## Run the e2e tests
$(GINKGO) --tags $(GO_BUILD_TAGS) $(E2E_FLAGS) --trace $(FOCUS) test/e2e

e2e: KIND_CLUSTER_NAME=rukpak-e2e
e2e: rukpakctl run image-registry local-git kind-load-bundles registry-load-bundles test-e2e kind-cluster-cleanup ## Run e2e tests against an ephemeral kind cluster
e2e: run image-registry local-git kind-load-bundles registry-load-bundles test-e2e kind-cluster-cleanup ## Run e2e tests against an ephemeral kind cluster

kind-cluster: $(KIND) kind-cluster-cleanup ## Standup a kind cluster
$(KIND) create cluster --name ${KIND_CLUSTER_NAME} ${KIND_CLUSTER_CONFIG}
Expand Down Expand Up @@ -171,7 +168,7 @@ uninstall: ## Remove all rukpak resources from the cluster

##@ build/load:

BINARIES=core helm unpack webhooks crdvalidator rukpakctl
BINARIES=core helm unpack webhooks crdvalidator
LINUX_BINARIES=$(join $(addprefix linux/,$(BINARIES)), )

.PHONY: build $(BINARIES) $(LINUX_BINARIES) build-container kind-load kind-load-bundles kind-cluster registry-load-bundles
Expand Down
68 changes: 1 addition & 67 deletions api/v1alpha1/bundle_types.go → api/v1alpha2/bundle_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1
package v1alpha2

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

var (
BundleGVK = SchemeBuilder.GroupVersion.WithKind("Bundle")
BundleKind = BundleGVK.Kind
)

type SourceType string
Expand All @@ -49,15 +43,6 @@ const (
PhaseUnpacked = "Unpacked"
)

// BundleSpec defines the desired state of Bundle
type BundleSpec struct {
//+kubebuilder:validation:Pattern:=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
// ProvisionerClassName sets the name of the provisioner that should reconcile this BundleDeployment.
ProvisionerClassName string `json:"provisionerClassName"`
// Source defines the configuration for the underlying Bundle content.
Source BundleSource `json:"source"`
}

type BundleSource struct {
// Type defines the kind of Bundle content being sourced.
Type SourceType `json:"type"`
Expand All @@ -68,11 +53,6 @@ type BundleSource struct {
// ConfigMaps is a list of config map references and their relative
// directory paths that represent a bundle filesystem.
ConfigMaps []ConfigMapSource `json:"configMaps,omitempty"`
// Upload is a source that enables this Bundle's content to be uploaded
// via Rukpak's bundle upload service. This source type is primarily useful
// with bundle development workflows because it enables bundle developers
// to inject a local bundle directly into the cluster.
Upload *UploadSource `json:"upload,omitempty"`
// HTTP is the remote location that backs the content of this Bundle.
HTTP *HTTPSource `json:"http,omitempty"`
}
Expand Down Expand Up @@ -141,50 +121,4 @@ type Authorization struct {
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"`
}

type UploadSource struct{}

type ProvisionerID string

// BundleStatus defines the observed state of Bundle
type BundleStatus struct {
Phase string `json:"phase,omitempty"`
ResolvedSource *BundleSource `json:"resolvedSource,omitempty"`
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
Conditions []metav1.Condition `json:"conditions,omitempty"`
ContentURL string `json:"contentURL,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:resource:scope=Cluster
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name=Type,type=string,JSONPath=`.spec.source.type`
//+kubebuilder:printcolumn:name=Phase,type=string,JSONPath=`.status.phase`
//+kubebuilder:printcolumn:name=Age,type=date,JSONPath=`.metadata.creationTimestamp`
//+kubebuilder:printcolumn:name=Provisioner,type=string,JSONPath=`.spec.provisionerClassName`,priority=1
//+kubebuilder:printcolumn:name=Resolved Source,type=string,JSONPath=`.status.resolvedSource`,priority=1

// Bundle is the Schema for the bundles API
type Bundle struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec BundleSpec `json:"spec"`
Status BundleStatus `json:"status,omitempty"`
}

func (b *Bundle) ProvisionerClassName() string {
return b.Spec.ProvisionerClassName
}

//+kubebuilder:object:root=true

// BundleList contains a list of Bundle
type BundleList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Bundle `json:"items"`
}

func init() {
SchemeBuilder.Register(&Bundle{}, &BundleList{})
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1
package v1alpha2

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -52,35 +52,24 @@ type BundleDeploymentSpec struct {
//+kubebuilder:validation:Pattern:=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
// ProvisionerClassName sets the name of the provisioner that should reconcile this BundleDeployment.
ProvisionerClassName string `json:"provisionerClassName"`
// Template describes the generated Bundle that this deployment will manage.
Template BundleTemplate `json:"template"`
// Source defines the configuration for the underlying Bundle content.
Source BundleSource `json:"source"`
// Config is provisioner specific configurations
// +kubebuilder:pruning:PreserveUnknownFields
Config runtime.RawExtension `json:"config,omitempty"`
}

// BundleTemplate defines the desired state of a Bundle resource
type BundleTemplate struct {
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the Bundle.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
Spec BundleSpec `json:"spec"`
}

// BundleDeploymentStatus defines the observed state of BundleDeployment
type BundleDeploymentStatus struct {
Conditions []metav1.Condition `json:"conditions,omitempty"`
ActiveBundle string `json:"activeBundle,omitempty"`
ResolvedSource *BundleSource `json:"resolvedSource,omitempty"`
ContentURL string `json:"contentURL,omitempty"`
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Cluster,shortName={"bd","bds"}
//+kubebuilder:printcolumn:name="Active Bundle",type=string,JSONPath=`.status.activeBundle`
//+kubebuilder:printcolumn:name="Install State",type=string,JSONPath=`.status.conditions[?(.type=="Installed")].reason`
//+kubebuilder:printcolumn:name=Age,type=date,JSONPath=`.metadata.creationTimestamp`
//+kubebuilder:printcolumn:name=Provisioner,type=string,JSONPath=`.spec.provisionerClassName`,priority=1
Expand All @@ -94,6 +83,10 @@ type BundleDeployment struct {
Status BundleDeploymentStatus `json:"status,omitempty"`
}

func (b *BundleDeployment) ProvisionerClassName() string {
return b.Spec.ProvisionerClassName
}

//+kubebuilder:object:root=true

// BundleDeploymentList contains a list of BundleDeployment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// Package v1alpha1 contains API Schema definitions for the core v1alpha1 API group
// Package v1alpha2 contains API Schema definitions for the core v1alpha2 API group
// +kubebuilder:object:generate=true
// +groupName=core.rukpak.io
package v1alpha1
package v1alpha2

import (
"k8s.io/apimachinery/pkg/runtime/schema"
Expand All @@ -26,7 +26,7 @@ import (

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "core.rukpak.io", Version: "v1alpha1"}
GroupVersion = schema.GroupVersion{Group: "core.rukpak.io", Version: "v1alpha2"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
Expand Down
Loading
Loading