Skip to content
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

Project Crud Operations. #3

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
34388d0
Added mew type and generated the files
Jan 29, 2024
29448ff
Configured basic Filed for kind Project
btwseeu78 Jan 31, 2024
cfaee77
minor fix for code generation
btwseeu78 Jan 31, 2024
8504c2c
minor fix for code generation
btwseeu78 Jan 31, 2024
1caeeb6
minor fix for code generation
btwseeu78 Jan 31, 2024
8f69c69
minor fix for code generation
btwseeu78 Jan 31, 2024
d7993e5
minor fix for code generation
btwseeu78 Jan 31, 2024
98a6b4c
minor fix for code generation
btwseeu78 Jan 31, 2024
f5f5029
minor fix for code generation
btwseeu78 Jan 31, 2024
de52cde
minor fix for code generation
btwseeu78 Jan 31, 2024
f362117
Fix Issues with SCaffolds
btwseeu78 Feb 1, 2024
707929c
minor fix for code generation
btwseeu78 Feb 1, 2024
369e3bb
minor fix for code generation
btwseeu78 Feb 1, 2024
30ed2b1
minor fix for code generation
btwseeu78 Feb 1, 2024
e25c247
minor fix for code generation
btwseeu78 Feb 1, 2024
30335d3
minor fix for code generation
btwseeu78 Feb 1, 2024
523f950
go fmt fix
btwseeu78 Feb 1, 2024
b15710b
go fmt fix
btwseeu78 Feb 1, 2024
d907477
new client used here
btwseeu78 Feb 3, 2024
aaf5646
provider harbor chnages with new go client
btwseeu78 Feb 4, 2024
e9e0030
Structure Change
Feb 8, 2024
ee813e1
Structure Change
Feb 8, 2024
0d8a178
Cleaner working diif need fix dump
Feb 8, 2024
d2be214
Somewhat finished
Feb 10, 2024
f95c22a
Fixed some issues with nil validation onn updates
Feb 13, 2024
9bd3e2a
Create function takes value from crd
btwseeu78 Feb 13, 2024
c83fd53
Working Copy
btwseeu78 Feb 16, 2024
3babfad
Removed debug messages
btwseeu78 Feb 16, 2024
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 apis/generate.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build generate
// +build generate

/*
Expand Down
4 changes: 2 additions & 2 deletions apis/harbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ package apis
import (
"k8s.io/apimachinery/pkg/runtime"

samplev1alpha1 "github.com/crossplane/provider-harbor/apis/sample/v1alpha1"
projectv1alpha1 "github.com/crossplane/provider-harbor/apis/project/v1alpha1"
harborv1alpha1 "github.com/crossplane/provider-harbor/apis/v1alpha1"
)

func init() {
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
AddToSchemes = append(AddToSchemes,
harborv1alpha1.SchemeBuilder.AddToScheme,
samplev1alpha1.SchemeBuilder.AddToScheme,
projectv1alpha1.SchemeBuilder.AddToScheme,
)
}

Expand Down
18 changes: 18 additions & 0 deletions apis/project/project.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
Copyright 2022 The Crossplane 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 project contains group project API versions
package project
17 changes: 17 additions & 0 deletions apis/project/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
Copyright 2022 The Crossplane 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 v1alpha1
40 changes: 40 additions & 0 deletions apis/project/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
Copyright 2020 The Crossplane 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 v1alpha1 contains the v1alpha1 group Sample resources of the harbor provider.
// +kubebuilder:object:generate=true
// +groupName=project.harbor.crossplane.io
// +versionName=v1alpha1
package v1alpha1

import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)

// Package type metadata.
const (
Group = "project.harbor.crossplane.io"
Version = "v1alpha1"
)

var (
// SchemeGroupVersion is group version used to register these objects
SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
)
95 changes: 95 additions & 0 deletions apis/project/v1alpha1/project_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
Copyright 2022 The Crossplane 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 v1alpha1

import (
"reflect"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
)

type ProjectMetadata struct {
AutoScan *string `json:"autoScan,omitempty"`
EnableContentTrust *string `json:"enableContentTrust,omitempty"`
EnableContentTrustCosign *string `json:"enableContentTrustCosign,omitempty"`
PreventVul *string `json:"preventVul,omitempty"`
Public string `json:"public,omitempty"`
ReuseSysCVEAllowlist *string `json:"reuseSysCVEAllowlist,omitempty"`
Severity *string `json:"severity,omitempty"`
}

// ProjectParameters are the configurable fields of a Project.
type ProjectParameters struct {
Metadata ProjectMetadata `json:"metadata"`
}

// ProjectObservation are the observable fields of a Project.
type ProjectObservation struct {
State string `json:"state,omitempty"`
}

// A ProjectSpec defines the desired state of a Project.
type ProjectSpec struct {
xpv1.ResourceSpec `json:",inline"`
ForProvider ProjectParameters `json:"forProvider"`
}

// A ProjectStatus represents the observed state of a Project.
type ProjectStatus struct {
xpv1.ResourceStatus `json:",inline"`
AtProvider ProjectObservation `json:"atProvider,omitempty"`
}

// +kubebuilder:object:root=true

// A Project is an example API type.
// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status"
// +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name"
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,harbor}
type Project struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ProjectSpec `json:"spec"`
Status ProjectStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

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

// Project type metadata.
var (
ProjectKind = reflect.TypeOf(Project{}).Name()
ProjectGroupKind = schema.GroupKind{Group: Group, Kind: ProjectKind}.String()
ProjectKindAPIVersion = ProjectKind + "." + SchemeGroupVersion.String()
ProjectGroupVersionKind = SchemeGroupVersion.WithKind(ProjectKind)
)

func init() {
SchemeBuilder.Register(&Project{}, &ProjectList{})
}
195 changes: 195 additions & 0 deletions apis/project/v1alpha1/zz_generated.deepcopy.go

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

Loading
Loading