Skip to content

Added Git Service #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 9, 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
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,10 @@ go.work
go.work.sum

# Output directory for tests
_output/
_output/

# Binary for packages
pkg/**/output

# Environment variables file
.env
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ issues:
- path: "api/*"
linters:
- lll
- path: "internal/*"
- path: "controller/*"
linters:
- dupl
- lll
Expand Down
33 changes: 0 additions & 33 deletions Dockerfile

This file was deleted.

11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# To re-generate a bundle for another specific version without changing the standard setup, you can:
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= 0.0.1
VERSION ?= 0.0.4

# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
Expand Down Expand Up @@ -159,11 +159,11 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes

.PHONY: build
build: manifests generate fmt vet ## Build manager binary.
go build -o bin/manager cmd/main.go
go build -o bin/manager main.go

.PHONY: run
run: manifests generate fmt vet ## Run a controller from your host.
go run ./cmd/main.go
go run main.go

.PHONY: container-build
container-build: test ko ## Build the container image with the operator.
Expand Down Expand Up @@ -216,9 +216,8 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
$(KUSTOMIZE) build config/crd | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -

.PHONY: deploy
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default | $(KUBECTL) apply -f -
deploy: manifests kustomize ko ## Deploy controller to the K8s cluster specified in ~/.kube/config. This will also build and push the operator image.
$(KUSTOMIZE) build config/default | KO_DOCKER_REPO=${IMAGE_REPO} $(KO) apply ${KO_OPTS} -f -

.PHONY: undeploy
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
Expand Down
57 changes: 57 additions & 0 deletions api/v1alpha1/common_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package v1alpha1

type (
// ConditionType defines what condition type this is.
ConditionType string

// ConditionReason is a static/programmatic representation of the cause of a status condition.
ConditionReason string
)

const (

// ConditionProgressing is True when the operator is progressing
ConditionProgressing ConditionType = "Progressing"

// ConditionReady is True when the application is ready
ConditionReady ConditionType = "Ready"

// ConditionGitRepoReachable is True if the Git repository is reachable
ConditionGitRepoReachable ConditionType = "GitRepoReachable"

// ConditionOperatorDegraded is True if the operator is in a degraded state
ConditionOperatorDegraded ConditionType = "OperatorDegraded"

// ConditionResourceNotFound is True if the resource is not found
ConditionResourceNotFound ConditionType = "ResourceNotFound"

// ReasonOperatorResourceNotAvailable indicates the operator resource is not available
ReasonOperatorResourceNotAvailable ConditionReason = "OperatorResourceNotAvailable"

// ReasonSecretResourceNotFound indicates the secret resource is not found
ReasonSecretResourceNotFound ConditionReason = "SecretResourceNotFound"

// ReasonInit indicates the resource is initializing
ReasonInit ConditionReason = "Init"

// ReasonAllResourcesReady indicates all resources are ready
ReasonAllResourcesReady ConditionReason = "AllResourcesReady"

// ReasonReconcileFailed indicates the reconciliation failed
ReasonReconcileFailed ConditionReason = "ReconcileFailed"

// ReasonReconcileCompleted indicates the reconciliation completed
ReasonReconcileCompleted ConditionReason = "ReconcileCompleted"
)

// String casts the value to string.
// "c.String()" and "string(c)" are equivalent.
func (c ConditionType) String() string {
return string(c)
}

// String casts the value to string.
// "r.String()" and "string(r)" are equivalent.
func (r ConditionReason) String() string {
return string(r)
}
41 changes: 40 additions & 1 deletion api/v1alpha1/consoleapplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,58 @@ import (
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

type Git struct {
Url string `json:"url,omitempty"`
ContextDir string `json:"contextDir,omitempty"`
Reference string `json:"reference,omitempty"`
SourceSecretRef string `json:"sourceSecretRef,omitempty"`
}

type BuildConfiguration struct {
BuilderImage BuilderImage `json:"builderImage,omitempty"`
BuildOption string `json:"buildOption,omitempty"`
Env []Env `json:"env,omitempty"`
}

type BuilderImage struct {
Name string `json:"name,omitempty"`
Image string `json:"image,omitempty"`
}

type Env struct {
Name string `json:"name,omitempty"`
Value string `json:"value,omitempty"`
}

type Expose struct {
TargetPort *int32 `json:"targetPort,omitempty"`
CreateRoute bool `json:"createRoute,omitempty"`
}

type DeploymentConfiguration struct {
ResourceType string `json:"resourceType,omitempty"`
Env []Env `json:"env,omitempty"`
Expose Expose `json:"expose,omitempty"`
}

// ConsoleApplicationSpec defines the desired state of ConsoleApplication
type ConsoleApplicationSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Foo is an example field of ConsoleApplication. Edit consoleapplication_types.go to remove/update
Foo string `json:"foo,omitempty"`
ApplicationName string `json:"applicationName,omitempty"`
Git Git `json:"git,omitempty"`
ImportStrategy string `json:"importStrategy,omitempty"`
BuildConfiguration BuildConfiguration `json:"buildConfiguration,omitempty"`
DeploymentConfiguration DeploymentConfiguration `json:"deploymentConfiguration,omitempty"`
}

// ConsoleApplicationStatus defines the observed state of ConsoleApplication
type ConsoleApplicationStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
122 changes: 120 additions & 2 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading