Made changes to addressable and address status. (#2713)

* changed addressable and addressstatus

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

* requested changes

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

---------

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>
This commit is contained in:
Vishal Choudhary 2023-04-03 20:42:33 +05:30 committed by GitHub
parent 696cac83c1
commit b7f2774461
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 92 additions and 3 deletions

View File

@ -38,7 +38,16 @@ import (
// typically stored in the object's `status`, as this information may
// be generated by the controller.
type Addressable struct {
// Name is the name of the address.
// +optional
Name *string `json:"name,omitempty"`
URL *apis.URL `json:"url,omitempty"`
// CACerts is the Certification Authority (CA) certificates in PEM format
// according to https://www.rfc-editor.org/rfc/rfc7468.
// +optional
CACerts *string `json:"CACerts,omitempty"`
}
var (
@ -62,7 +71,15 @@ type AddressableType struct {
// AddressStatus shows how we expect folks to embed Addressable in
// their Status field.
type AddressStatus struct {
// Address is a single Addressable address.
// If Addresses is present, Address will be ignored by clients.
// +optional
Address *Addressable `json:"address,omitempty"`
// Addresses is a list of addresses for different protocols (HTTP and HTTPS)
// If Addresses is present, Address must be ignored by clients.
// +optional
Addresses []Addressable `json:"addresses,omitempty"`
}
// Verify AddressableType resources meet duck contracts.
@ -89,9 +106,11 @@ func (a *Addressable) ConvertFrom(ctx context.Context, from apis.Convertible) er
// Populate implements duck.Populatable
func (t *AddressableType) Populate() {
name := "http"
t.Status = AddressStatus{
&Addressable{
Address: &Addressable{
// Populate ALL fields
Name: &name,
URL: &apis.URL{
Scheme: "http",
Host: "foo.com",

View File

@ -34,6 +34,13 @@ func (in *AddressStatus) DeepCopyInto(out *AddressStatus) {
*out = new(Addressable)
(*in).DeepCopyInto(*out)
}
if in.Addresses != nil {
in, out := &in.Addresses, &out.Addresses
*out = make([]Addressable, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
@ -50,11 +57,21 @@ func (in *AddressStatus) DeepCopy() *AddressStatus {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Addressable) DeepCopyInto(out *Addressable) {
*out = *in
if in.Name != nil {
in, out := &in.Name, &out.Name
*out = new(string)
**out = **in
}
if in.URL != nil {
in, out := &in.URL, &out.URL
*out = new(apis.URL)
(*in).DeepCopyInto(*out)
}
if in.CACerts != nil {
in, out := &in.CACerts, &out.CACerts
*out = new(string)
**out = **in
}
return
}

View File

@ -66,7 +66,15 @@ type AddressableType struct {
// AddressStatus shows how we expect folks to embed Addressable in
// their Status field.
type AddressStatus struct {
// Address is a single Addressable address.
// If Addresses is present, Address will be ignored by clients.
// +optional
Address *Addressable `json:"address,omitempty"`
// Addresses is a list of addresses for different protocols (HTTP and HTTPS)
// If Addresses is present, Address must be ignored by clients.
// +optional
Addresses []Addressable `json:"addresses,omitempty"`
}
var (
@ -123,10 +131,12 @@ func (a *Addressable) ConvertFrom(ctx context.Context, from apis.Convertible) er
// Populate implements duck.Populatable
func (t *AddressableType) Populate() {
name := "http"
t.Status = AddressStatus{
&Addressable{
Address: &Addressable{
// Populate ALL fields
Addressable: v1beta1.Addressable{
Name: &name,
URL: &apis.URL{
Scheme: "http",
Host: "foo.bar.svc.cluster.local",

View File

@ -33,6 +33,13 @@ func (in *AddressStatus) DeepCopyInto(out *AddressStatus) {
*out = new(Addressable)
(*in).DeepCopyInto(*out)
}
if in.Addresses != nil {
in, out := &in.Addresses, &out.Addresses
*out = make([]Addressable, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}

View File

@ -37,7 +37,16 @@ import (
// typically stored in the object's `status`, as this information may
// be generated by the controller.
type Addressable struct {
// Name is the name of the address.
// +optional
Name *string `json:"name,omitempty"`
URL *apis.URL `json:"url,omitempty"`
// CACerts is the Certification Authority (CA) certificates in PEM format
// according to https://www.rfc-editor.org/rfc/rfc7468.
// +optional
CACerts *string `json:"CACerts,omitempty"`
}
var (
@ -64,7 +73,15 @@ type AddressableType struct {
// AddressStatus shows how we expect folks to embed Addressable in
// their Status field.
type AddressStatus struct {
// Address is a single Addressable address.
// If Addresses is present, Address will be ignored by clients.
// +optional
Address *Addressable `json:"address,omitempty"`
// Addresses is a list of addresses for different protocols (HTTP and HTTPS)
// If Addresses is present, Address must be ignored by clients.
// +optional
Addresses []Addressable `json:"addresses,omitempty"`
}
// Verify AddressableType resources meet duck contracts.
@ -102,9 +119,11 @@ func (a *Addressable) ConvertFrom(ctx context.Context, from apis.Convertible) er
// Populate implements duck.Populatable
func (t *AddressableType) Populate() {
name := "http"
t.Status = AddressStatus{
&Addressable{
Address: &Addressable{
// Populate ALL fields
Name: &name,
URL: &apis.URL{
Scheme: "http",
Host: "foo.com",

View File

@ -35,6 +35,13 @@ func (in *AddressStatus) DeepCopyInto(out *AddressStatus) {
*out = new(Addressable)
(*in).DeepCopyInto(*out)
}
if in.Addresses != nil {
in, out := &in.Addresses, &out.Addresses
*out = make([]Addressable, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
@ -51,11 +58,21 @@ func (in *AddressStatus) DeepCopy() *AddressStatus {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Addressable) DeepCopyInto(out *Addressable) {
*out = *in
if in.Name != nil {
in, out := &in.Name, &out.Name
*out = new(string)
**out = **in
}
if in.URL != nil {
in, out := &in.URL, &out.URL
*out = new(apis.URL)
(*in).DeepCopyInto(*out)
}
if in.CACerts != nil {
in, out := &in.CACerts, &out.CACerts
*out = new(string)
**out = **in
}
return
}