Skip to content
This repository was archived by the owner on May 30, 2025. It is now read-only.

Commit df61ffc

Browse files
Adding resource : secret
Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>
1 parent 111adae commit df61ffc

12 files changed

Lines changed: 926 additions & 0 deletions

File tree

apis/gcp.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
iam "github.com/crossplane/provider-gcp/apis/iam/v1alpha1"
2929
kms "github.com/crossplane/provider-gcp/apis/kms/v1alpha1"
3030
pubsub "github.com/crossplane/provider-gcp/apis/pubsub/v1alpha1"
31+
secretsmanager "github.com/crossplane/provider-gcp/apis/secretsmanager/v1alpha1"
3132
servicenetworkingv1beta1 "github.com/crossplane/provider-gcp/apis/servicenetworking/v1beta1"
3233
storagev1alpha1 "github.com/crossplane/provider-gcp/apis/storage/v1alpha1"
3334
storagev1alpha3 "github.com/crossplane/provider-gcp/apis/storage/v1alpha3"
@@ -48,6 +49,7 @@ func init() {
4849
iam.SchemeBuilder.AddToScheme,
4950
kms.SchemeBuilder.AddToScheme,
5051
pubsub.SchemeBuilder.AddToScheme,
52+
secretsmanager.SchemeBuilder.AddToScheme,
5153
servicenetworkingv1beta1.SchemeBuilder.AddToScheme,
5254
storagev1alpha1.SchemeBuilder.AddToScheme,
5355
storagev1alpha3.SchemeBuilder.AddToScheme,
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
Copyright 2020 The Crossplane Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// Package secretsmanager contains GCP Secrets Manager's secrets
18+
package secretsmanager
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
Copyright 2020 The Crossplane Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// Package v1alpha1 contains managed resources, such as
18+
// secrets
19+
// +kubebuilder:object:generate=true
20+
// +groupName=secretsmanager.gcp.crossplane.io
21+
// +versionName=v1alpha1
22+
package v1alpha1
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
Copyright 2019 The Crossplane Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
import (
20+
"reflect"
21+
22+
"k8s.io/apimachinery/pkg/runtime/schema"
23+
"sigs.k8s.io/controller-runtime/pkg/scheme"
24+
)
25+
26+
// Package type metadata.
27+
const (
28+
Group = "secretsmanager.gcp.crossplane.io"
29+
Version = "v1alpha1"
30+
)
31+
32+
var (
33+
// SchemeGroupVersion is group version used to register these objects
34+
SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version}
35+
36+
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
37+
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
38+
)
39+
40+
// Secret type metadata.
41+
var (
42+
SecretKind = reflect.TypeOf(Secret{}).Name()
43+
SecretGroupKind = schema.GroupKind{Group: Group, Kind: SecretKind}.String()
44+
TopicKindAPIVersion = SecretKind + "." + SchemeGroupVersion.String()
45+
TopicGroupVersionKind = SchemeGroupVersion.WithKind(SecretKind)
46+
)
47+
48+
func init() {
49+
SchemeBuilder.Register(&Secret{}, &SecretList{})
50+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*
2+
Copyright 2020 The Crossplane Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
22+
xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
23+
)
24+
25+
// Keys used in connection secret.
26+
const (
27+
ConnectionSecretKeyTopic = "secret"
28+
ConnectionSecretKeyProjectName = "projectName"
29+
)
30+
31+
// SecretParameters defines parameters for a desired Secret Manager's secret.
32+
type SecretParameters struct {
33+
// Labels are used as additional metadata on Topic.
34+
// +optional
35+
Labels map[string]string `json:"labels,omitempty"`
36+
}
37+
38+
// SecretObservation is used to show the observed state of the
39+
// Secret resource on GCP Secrets Manager. All fields in this structure should only
40+
// be populated from GCP responses; any changes made to the k8s resource outside
41+
// of the crossplane gcp controller will be ignored and overwritten.
42+
type SecretObservation struct {
43+
// CreateTime: Output only. The time at which this KeyRing was created.
44+
CreateTime string `json:"createTime,omitempty"`
45+
46+
// Name: Output only. The resource name for the KeyRing in the
47+
// format `projects/*/locations/*/keyRings/*`.
48+
Name string `json:"name,omitempty"`
49+
}
50+
51+
// SecretSpec defines the desired state of a
52+
// Secret.
53+
type SecretSpec struct {
54+
xpv1.ResourceSpec `json:",inline"`
55+
ForProvider SecretParameters `json:"forProvider"`
56+
}
57+
58+
// SecretStatus represents the observed state of a
59+
// Secret.
60+
type SecretStatus struct {
61+
xpv1.ResourceStatus `json:",inline"`
62+
AtProvider SecretObservation `json:"atProvider,omitempty"`
63+
}
64+
65+
// +kubebuilder:object:root=true
66+
67+
// Secret is a managed resource that represents a Google Secret Manger's Secret.
68+
// +kubebuilder:subresource:status
69+
// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
70+
// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status"
71+
// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,gcp}
72+
type Secret struct {
73+
metav1.TypeMeta `json:",inline"`
74+
metav1.ObjectMeta `json:"metadata,omitempty"`
75+
76+
Spec SecretSpec `json:"spec"`
77+
Status SecretStatus `json:"status,omitempty"`
78+
}
79+
80+
// +kubebuilder:object:root=true
81+
82+
// SecretList contains a list of Secret types
83+
type SecretList struct {
84+
metav1.TypeMeta `json:",inline"`
85+
metav1.ListMeta `json:"metadata,omitempty"`
86+
Items []Secret `json:"items"`
87+
}

apis/secretsmanager/v1alpha1/zz_generated.deepcopy.go

Lines changed: 155 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)